[Libreoffice-commits] .: Branch 'libreoffice-3-6' - oox/inc oox/source

Petr Mladek pmladek at kemper.freedesktop.org
Thu Aug 9 05:10:54 PDT 2012


 oox/inc/oox/ppt/pptshapegroupcontext.hxx |    1 
 oox/source/drawingml/diagram/diagram.cxx |   66 ++++++++++++++++---------------
 oox/source/ppt/pptshapegroupcontext.cxx  |   11 ++++-
 3 files changed, 45 insertions(+), 33 deletions(-)

New commits:
commit dc29a85982a4b54657be3f448dd8d37d2144a020
Author: Muthu Subramanian <sumuthu at suse.com>
Date:   Mon Jun 25 19:25:52 2012 +0530

    n#759210: Certain smartart drawings weren't imported.
    
    SmartArt info was reset, when there was a chart (e.g.)
    in the same slide.
    
    This also fixes fdo#50907.
    
    (cherry picked from commit 11c5699dad06fb0d7fc0e458550a1dac82f8ee5f)
    
    Signed-off-by: Petr Mladek <pmladek at suse.cz>

diff --git a/oox/inc/oox/ppt/pptshapegroupcontext.hxx b/oox/inc/oox/ppt/pptshapegroupcontext.hxx
index 7e2a6d3..841e741 100644
--- a/oox/inc/oox/ppt/pptshapegroupcontext.hxx
+++ b/oox/inc/oox/ppt/pptshapegroupcontext.hxx
@@ -39,6 +39,7 @@ class PPTShapeGroupContext : public ::oox::drawingml::ShapeGroupContext
     SlidePersistPtr     mpSlidePersistPtr;
     ShapeLocation       meShapeLocation;
     oox::drawingml::ShapePtr    pGraphicShape;
+    void                importExtDrawings();
 
 public:
     PPTShapeGroupContext(
diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx
index 8e6586d..002e20a 100644
--- a/oox/source/drawingml/diagram/diagram.cxx
+++ b/oox/source/drawingml/diagram/diagram.cxx
@@ -395,40 +395,44 @@ void loadDiagram( ShapePtr& pShape,
                 pShape->addExtDrawingRelId( *aIt );
     }
 
-    // layout
-    if( !rLayoutPath.isEmpty() )
+    // extLst is present, lets bet on that and ignore the rest of the data from here
+    if( !pData->getExtDrawings().size() )
     {
-        rtl::Reference< core::FragmentHandler > xRef(
-            new DiagramLayoutFragmentHandler( rFilter, rLayoutPath, pLayout ));
-        importFragment(rFilter,
-                       loadFragment(rFilter,xRef),
-                       "DiagramLayout",
-                       pShape,
-                       xRef);
-    }
+        // layout
+        if( !rLayoutPath.isEmpty() )
+        {
+            rtl::Reference< core::FragmentHandler > xRef(
+                    new DiagramLayoutFragmentHandler( rFilter, rLayoutPath, pLayout ));
+            importFragment(rFilter,
+                    loadFragment(rFilter,xRef),
+                    "DiagramLayout",
+                    pShape,
+                    xRef);
+        }
 
-    // style
-    if( !rQStylePath.isEmpty() )
-    {
-        rtl::Reference< core::FragmentHandler > xRef(
-            new DiagramQStylesFragmentHandler( rFilter, rQStylePath, pDiagram->getStyles() ));
-        importFragment(rFilter,
-                       loadFragment(rFilter,xRef),
-                       "DiagramQStyle",
-                       pShape,
-                       xRef);
-    }
+        // style
+        if( !rQStylePath.isEmpty() )
+        {
+            rtl::Reference< core::FragmentHandler > xRef(
+                    new DiagramQStylesFragmentHandler( rFilter, rQStylePath, pDiagram->getStyles() ));
+            importFragment(rFilter,
+                    loadFragment(rFilter,xRef),
+                    "DiagramQStyle",
+                    pShape,
+                    xRef);
+        }
 
-    // colors
-    if( !rColorStylePath.isEmpty() )
-    {
-        rtl::Reference< core::FragmentHandler > xRef(
-            new ColorFragmentHandler( rFilter, rColorStylePath, pDiagram->getColors() ));
-        importFragment(rFilter,
-                       loadFragment(rFilter,xRef),
-                       "DiagramColorStyle",
-                       pShape,
-                       xRef);
+        // colors
+        if( !rColorStylePath.isEmpty() )
+        {
+            rtl::Reference< core::FragmentHandler > xRef(
+                    new ColorFragmentHandler( rFilter, rColorStylePath, pDiagram->getColors() ));
+            importFragment(rFilter,
+                    loadFragment(rFilter,xRef),
+                    "DiagramColorStyle",
+                    pShape,
+                    xRef);
+        }
     }
 
     // diagram loaded. now lump together & attach to shape
diff --git a/oox/source/ppt/pptshapegroupcontext.cxx b/oox/source/ppt/pptshapegroupcontext.cxx
index 0529ec6..3dbf067 100644
--- a/oox/source/ppt/pptshapegroupcontext.cxx
+++ b/oox/source/ppt/pptshapegroupcontext.cxx
@@ -128,6 +128,8 @@ Reference< XFastContextHandler > PPTShapeGroupContext::createFastChildContext( s
         break;
     case PPT_TOKEN( graphicFrame ): // CT_GraphicalObjectFrame
         {
+            if( pGraphicShape )
+                importExtDrawings();
             pGraphicShape = oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.OLE2Shape" ) );
             xRet.set( new oox::drawingml::GraphicalObjectFrameContext( *this, mpGroupShapePtr, pGraphicShape, true ) );
         }
@@ -141,9 +143,9 @@ Reference< XFastContextHandler > PPTShapeGroupContext::createFastChildContext( s
     return xRet;
 }
 
-void PPTShapeGroupContext::endFastElement( sal_Int32 nElement ) throw (SAXException, RuntimeException)
+void PPTShapeGroupContext::importExtDrawings( )
 {
-    if( nElement == PPT_TOKEN( spTree ) && pGraphicShape )
+    if( pGraphicShape )
     {
         for( ::std::vector<OUString>::const_iterator aIt = pGraphicShape->getExtDrawings().begin(), aEnd = pGraphicShape->getExtDrawings().end();
                     aIt != aEnd; ++aIt )
@@ -160,6 +162,11 @@ void PPTShapeGroupContext::endFastElement( sal_Int32 nElement ) throw (SAXExcept
     }
 }
 
+void PPTShapeGroupContext::endFastElement( sal_Int32 /*nElement*/ ) throw (SAXException, RuntimeException)
+{
+    importExtDrawings();
+}
+
 } }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list