Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


please consider this for 3.5, the vmldrawing 'style' part can specifiy if the drawing is 'hidden' while I am not sure what we can do with normal shapes certainly for controls there is the 'EnableVisible' property which can be applied. This patch ensures hidden controls are indeed hidden ( and not cluttering up the screen or covering other content etc. )

Noel

From 912ff022a8594843b31bbc712ca28e3c3f7ded89 Mon Sep 17 00:00:00 2001
From: Noel Power <noel.power@novell.com>
Date: Thu, 7 Jun 2012 15:25:06 +0100
Subject: [PATCH 6/7] import vmlshape 'hidden' style attribute and apply to controls bnc#757609

ensure 'hidden' controls are imported as such.

Change-Id: Ie79e61f06d65c86db9d1a734e85b27ee368bebe8
---
 oox/inc/oox/vml/vmlshape.hxx       |    1 +
 oox/source/vml/vmlshape.cxx        |   11 +++++++++--
 oox/source/vml/vmlshapecontext.cxx |    2 ++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/oox/inc/oox/vml/vmlshape.hxx b/oox/inc/oox/vml/vmlshape.hxx
index 1926a08..3817629 100644
--- a/oox/inc/oox/vml/vmlshape.hxx
+++ b/oox/inc/oox/vml/vmlshape.hxx
@@ -79,6 +79,7 @@ struct ShapeTypeModel
     ::rtl::OUString     maMarginLeft;           /// X position of the shape bounding box to shape 
anchor (number with unit).
     ::rtl::OUString     maMarginTop;            /// Y position of the shape bounding box to shape 
anchor (number with unit).
     sal_Bool            mbAutoHeight;           /// If true, the height value is a minimum value 
(mostly used for textboxes)
+    sal_Bool            mbVisible;              /// Visible or Hidden
 
     StrokeModel         maStrokeModel;          /// Border line formatting.
     FillModel           maFillModel;            /// Shape fill formatting.
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 4f1b40f..0985daf 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -34,6 +34,7 @@
 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
 #include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
 #include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/drawing/XControlShape.hpp>
 #include <com/sun/star/graphic/XGraphic.hpp>
 #include <com/sun/star/text/HoriOrientation.hpp>
 #include <com/sun/star/text/RelOrientation.hpp>
@@ -171,7 +172,8 @@ void lclSetXShapeRect( const Reference< XShape >& rxShape, const Rectangle& rSha
 // ============================================================================
 
 ShapeTypeModel::ShapeTypeModel():
-    mbAutoHeight( sal_False )
+    mbAutoHeight( sal_False ),
+    mbVisible( sal_True )
 {
 }
 
@@ -361,7 +363,12 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& 
rxS
                 PropertySet aShapeProp( xShape );
                 if( aShapeProp.hasProperty( PROP_Name ) )
                     aShapeProp.setProperty( PROP_Name, getShapeName() );
-
+                Reference< XControlShape > xControlShape( xShape, UNO_QUERY );
+                if ( xControlShape.is() && !getTypeModel().mbVisible )
+                {
+                    PropertySet aControlShapeProp( xControlShape->getControl() );
+                    aControlShapeProp.setProperty( PROP_EnableVisible, makeAny( sal_False ) );
+                }
                 /*  Notify the drawing that a new shape has been inserted. For
                     convenience, pass the rectangle that contains position and
                     size of the shape. */
diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx
index cb64424..a8dd809 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -347,6 +347,8 @@ void ShapeTypeContext::setStyle( const OUString& rStyle )
             else if( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "margin-left" ) ) )   
mrTypeModel.maMarginLeft = aValue;
             else if( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "margin-top" ) ) )    
mrTypeModel.maMarginTop = aValue;
             else if( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "mso-fit-shape-to-text" ) ) ) 
         mrTypeModel.mbAutoHeight = sal_True;
+            else if( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "visibility" ) ) )
+                mrTypeModel.mbVisible = !aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("hidden") 
);
         }
     }
 }
-- 
1.7.3.4



Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.