[Libreoffice-commits] .: oox/inc oox/source

Radek Doulík rodo at kemper.freedesktop.org
Wed Aug 24 05:28:26 PDT 2011


 oox/inc/oox/drawingml/shape.hxx          |    4 ++++
 oox/inc/oox/ppt/slidepersist.hxx         |    2 +-
 oox/source/drawingml/shape.cxx           |   13 ++++++++++---
 oox/source/ppt/layoutfragmenthandler.cxx |    2 +-
 oox/source/ppt/slidepersist.cxx          |   19 +++++++++++++++++++
 5 files changed, 35 insertions(+), 5 deletions(-)

New commits:
commit 9c2ae3f245287201db1a56b447e3ed18103d3d28
Author: Radek Doulik <rodo at novell.com>
Date:   Wed Aug 24 14:23:47 2011 +0200

    fix regression of 2155c4c0af4d4eb228a0644f423aa3d9b5e8a2fb
    
      - do not drop the master shapes anymore, but rather hide them
      - it is possible to have shapes with 0x0 geometry in slides,
        these inherit proper geometry from master slide shapes - so
        when we dropped the shapes, the geometry info was lost

diff --git a/oox/inc/oox/drawingml/shape.hxx b/oox/inc/oox/drawingml/shape.hxx
index 325af38..1307d18 100644
--- a/oox/inc/oox/drawingml/shape.hxx
+++ b/oox/inc/oox/drawingml/shape.hxx
@@ -125,6 +125,7 @@ public:
     ::rtl::OUString                 getId() { return msId; }
     void                            setHidden( sal_Bool bHidden ) { mbHidden = bHidden; }
     sal_Bool                        getHidden() const { return mbHidden; };
+    void                            setHiddenMasterShape( sal_Bool bHiddenMasterShape ) { mbHiddenMasterShape = bHiddenMasterShape; }
     void                            setSubType( sal_Int32 nSubType ) { mnSubType = nSubType; }
     sal_Int32                       getSubType() const { return mnSubType; }
     void                            setSubTypeIndex( sal_uInt32 nSubTypeIndex ) { mnSubTypeIndex = nSubTypeIndex; }
@@ -254,6 +255,9 @@ private:
     sal_Bool                        mbFlipH;
     sal_Bool                        mbFlipV;
     sal_Bool                        mbHidden;
+    sal_Bool                        mbHiddenMasterShape; // master shapes can be hidden in layout slides
+                                                         // we need separate flag because we don't want
+                                                         // to propagate it when applying reference shape
 };
 
 // ---------------------------------------------------------------------
diff --git a/oox/inc/oox/ppt/slidepersist.hxx b/oox/inc/oox/ppt/slidepersist.hxx
index 619d9ab..4faf1aa 100644
--- a/oox/inc/oox/ppt/slidepersist.hxx
+++ b/oox/inc/oox/ppt/slidepersist.hxx
@@ -111,7 +111,7 @@ public:
     oox::drawingml::TextListStylePtr getOtherTextStyle() const { return maOtherTextStylePtr; }
 
     oox::drawingml::ShapePtr getShapes() { return maShapesPtr; }
-    void dropShapes() { maShapesPtr->dropChildren(); }
+    void hideShapesAsMasterShapes();
     ::std::list< boost::shared_ptr< TimeNode > >& getTimeNodeList() { return maTimeNodeList; }
     oox::ppt::HeaderFooter& getHeaderFooter(){ return maHeaderFooter; };
 
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 656df0b..07b3f5b 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -90,6 +90,7 @@ Shape::Shape( const sal_Char* pServiceName )
 , mbFlipH( false )
 , mbFlipV( false )
 , mbHidden( false )
+, mbHiddenMasterShape( false )
 {
     if ( pServiceName )
         msServiceName = OUString::createFromAscii( pServiceName );
@@ -122,6 +123,7 @@ Shape::Shape( const ShapePtr& pSourceShape )
 , mbFlipH( pSourceShape->mbFlipH )
 , mbFlipV( pSourceShape->mbFlipV )
 , mbHidden( pSourceShape->mbHidden )
+, mbHiddenMasterShape( pSourceShape->mbHiddenMasterShape )
 {}
 
 
@@ -203,6 +205,8 @@ void Shape::addShape(
         const awt::Rectangle* pShapeRect,
         ShapeIdMap* pShapeMap )
 {
+    OSL_TRACE("Shape::addShape id: %s", rtl::OUStringToOString(msId, RTL_TEXTENCODING_UTF8 ).getStr());
+
     try
     {
         rtl::OUString sServiceName( msServiceName );
@@ -308,6 +312,8 @@ Reference< XShape > Shape::createAndInsert(
         sal_Bool bClearText,
         basegfx::B2DHomMatrix& aParentTransformation )
 {
+    OSL_TRACE("Shape::createAndInsert id: %s", rtl::OUStringToOString(msId, RTL_TEXTENCODING_UTF8 ).getStr());
+
     awt::Rectangle aShapeRectHmm( maPosition.X / 360, maPosition.Y / 360, maSize.Width / 360, maSize.Height / 360 );
 
     OUString aServiceName = finalizeServiceName( rFilterBase, rServiceName, aShapeRectHmm );
@@ -431,10 +437,11 @@ Reference< XShape > Shape::createAndInsert(
         }
         rxShapes->add( mxShape );
 
-        if ( mbHidden )
+        if ( mbHidden || mbHiddenMasterShape )
         {
-            const OUString sHidden( CREATE_OUSTRING( "Visible" ) );
-            xSet->setPropertyValue( sHidden, Any( !mbHidden ) );
+            OSL_TRACE("invisible shape with id: %s", rtl::OUStringToOString(msId, RTL_TEXTENCODING_UTF8 ).getStr());
+            const OUString sVisible( CREATE_OUSTRING( "Visible" ) );
+            xSet->setPropertyValue( sVisible, Any( sal_False ) );
         }
 
         Reference< document::XActionLockable > xLockable( mxShape, UNO_QUERY );
diff --git a/oox/source/ppt/layoutfragmenthandler.cxx b/oox/source/ppt/layoutfragmenthandler.cxx
index a28f4b2..2455daa 100644
--- a/oox/source/ppt/layoutfragmenthandler.cxx
+++ b/oox/source/ppt/layoutfragmenthandler.cxx
@@ -70,7 +70,7 @@ ContextHandlerRef LayoutFragmentHandler::onCreateContext( sal_Int32 aElementToke
 
             OptValue< bool > aShowMasterShapes = rAttribs.getBool( XML_showMasterSp );
             if( aShowMasterShapes.has() && !aShowMasterShapes.get() ) {
-                mpSlidePersistPtr->dropShapes();
+                mpSlidePersistPtr->hideShapesAsMasterShapes();
             }
         break;
         }
diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index d8eb875..b93ea3c 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -311,6 +311,25 @@ void SlidePersist::applyTextStyles( const XmlFilterBase& rFilterBase )
     }
 }
 
+void SlidePersist::hideShapesAsMasterShapes()
+{
+    std::vector< oox::drawingml::ShapePtr >& rShapes( maShapesPtr->getChildren() );
+    std::vector< oox::drawingml::ShapePtr >::iterator aShapesIter( rShapes.begin() );
+    while( aShapesIter != rShapes.end() )
+    {
+        while( aShapesIter != rShapes.end() )
+        {
+            std::vector< oox::drawingml::ShapePtr >& rChildren( (*aShapesIter++)->getChildren() );
+            std::vector< oox::drawingml::ShapePtr >::iterator aChildIter( rChildren.begin() );
+            while( aChildIter != rChildren.end() ) {
+                PPTShape* pPPTShape = dynamic_cast< PPTShape* >( (*aChildIter++).get() );
+                OSL_TRACE("hide shape with id: %s", rtl::OUStringToOString(pPPTShape->getId(), RTL_TEXTENCODING_UTF8 ).getStr());
+                pPPTShape->setHiddenMasterShape( true );
+            }
+        }
+    }
+}
+
 } }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list