[PATCH 6/7] import vmlshape 'hidden' style attribute and apply to controls bnc#757609

Noel Power noel.power at novell.com
Thu Jun 7 07:25:06 PDT 2012


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



--------------090706080603080803080504--


More information about the LibreOffice mailing list