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

Muthu Subramanian sumuthu at kemper.freedesktop.org
Mon Jun 25 06:54:04 PDT 2012


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

New commits:
commit 11c5699dad06fb0d7fc0e458550a1dac82f8ee5f
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.

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..bf2a99f 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 )
@@ -154,12 +156,16 @@ void PPTShapeGroupContext::endFastElement( sal_Int32 nElement ) throw (SAXExcept
                                                                            mpMasterShapePtr,
                                                                            mpGroupShapePtr,
                                                                            pGraphicShape ) );
-
             }
-        pGraphicShape = oox::drawingml::ShapePtr( (PPTShape *)NULL );
+            pGraphicShape = oox::drawingml::ShapePtr( (PPTShape *)NULL );
     }
 }
 
+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