[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - include/oox oox/source sd/qa

Grzegorz Araminowicz (via logerrit) logerrit at kemper.freedesktop.org
Tue May 21 07:31:23 UTC 2019


 include/oox/drawingml/shape.hxx          |    2 ++
 oox/source/drawingml/shape.cxx           |   17 +++++++++++++++++
 oox/source/ppt/pptshapegroupcontext.cxx  |   25 ++++++++++++++-----------
 oox/source/shape/ShapeContextHandler.cxx |   19 ++-----------------
 sd/qa/unit/import-tests-smartart.cxx     |    1 +
 5 files changed, 36 insertions(+), 28 deletions(-)

New commits:
commit cdb764a6367daaa4842be57d144275a87c2802b4
Author:     Grzegorz Araminowicz <grzegorz.araminowicz at collabora.com>
AuthorDate: Fri Mar 15 23:50:13 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue May 21 09:30:23 2019 +0200

    PPTX import: save also OOXDrawing in InteropGrabBag
    
    Change-Id: Ieaf341dd13e06046044f3523c3aad74476160402
    Reviewed-on: https://gerrit.libreoffice.org/69328
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/72473

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index aaade775c00c..9e879b47bc9c 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -225,6 +225,8 @@ public:
     /// Changes reference semantics to value semantics for fill properties.
     void cloneFillProperties();
 
+    void keepDiagramDrawing(::oox::core::XmlFilterBase& rFilterBase, const OUString& rFragmentPath);
+
 protected:
 
     enum FrameType
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 3e04f3b7494e..4848f4086e02 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -64,6 +64,7 @@
 #include <com/sun/star/beans/XMultiPropertySet.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/xml/AttributeData.hpp>
+#include <com/sun/star/xml/dom/XDocument.hpp>
 #include <com/sun/star/xml/sax/XFastSAXSerializable.hpp>
 #include <com/sun/star/drawing/HomogenMatrix3.hpp>
 #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
@@ -1394,6 +1395,22 @@ Reference< XShape > const & Shape::createAndInsert(
     return mxShape;
 }
 
+void Shape::keepDiagramDrawing(XmlFilterBase& rFilterBase, const OUString& rFragmentPath)
+{
+    uno::Sequence<uno::Any> diagramDrawing(2);
+    // drawingValue[0] => dom, drawingValue[1] => Sequence of associated relationships
+
+    sal_Int32 length = maDiagramDoms.getLength();
+    maDiagramDoms.realloc(length + 1);
+
+    diagramDrawing[0] <<= rFilterBase.importFragment(rFragmentPath);
+    diagramDrawing[1] <<= resolveRelationshipsOfTypeFromOfficeDoc(rFilterBase, rFragmentPath, "image");
+
+    beans::PropertyValue* pValue = maDiagramDoms.getArray();
+    pValue[length].Name = "OOXDrawing";
+    pValue[length].Value <<= diagramDrawing;
+}
+
 void Shape::keepDiagramCompatibilityInfo()
 {
     try
diff --git a/oox/source/ppt/pptshapegroupcontext.cxx b/oox/source/ppt/pptshapegroupcontext.cxx
index 9a775655518f..6535e12d3f81 100644
--- a/oox/source/ppt/pptshapegroupcontext.cxx
+++ b/oox/source/ppt/pptshapegroupcontext.cxx
@@ -148,17 +148,20 @@ void PPTShapeGroupContext::importExtDrawings( )
     if( pGraphicShape )
     {
         for (auto const& extDrawing : pGraphicShape->getExtDrawings())
-            {
-                getFilter().importFragment( new ExtDrawingFragmentHandler( getFilter(), getFragmentPathFromRelId(extDrawing),
-                                                                           mpSlidePersistPtr,
-                                                                           meShapeLocation,
-                                                                           mpGroupShapePtr,
-                                                                           pGraphicShape ) );
-                // Apply font color imported from color fragment
-                if( pGraphicShape->getFontRefColorForNodes().isUsed() )
-                    applyFontRefColor(mpGroupShapePtr, pGraphicShape->getFontRefColorForNodes());
-            }
-            pGraphicShape = oox::drawingml::ShapePtr( nullptr );
+        {
+            OUString aFragmentPath = getFragmentPathFromRelId(extDrawing);
+            getFilter().importFragment( new ExtDrawingFragmentHandler( getFilter(), aFragmentPath,
+                                                                       mpSlidePersistPtr,
+                                                                       meShapeLocation,
+                                                                       mpGroupShapePtr,
+                                                                       pGraphicShape ) );
+            pGraphicShape->keepDiagramDrawing(getFilter(), aFragmentPath);
+
+            // Apply font color imported from color fragment
+            if( pGraphicShape->getFontRefColorForNodes().isUsed() )
+                applyFontRefColor(mpGroupShapePtr, pGraphicShape->getFontRefColorForNodes());
+        }
+        pGraphicShape = oox::drawingml::ShapePtr( nullptr );
     }
 }
 
diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx
index b80af12ac15e..2747572f0479 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -425,23 +425,8 @@ ShapeContextHandler::getShape()
                     oox::drawingml::ShapePtr pShapePtr( new Shape( "com.sun.star.drawing.GroupShape" ) );
                     pShapePtr->setDiagramType();
                     mxFilterBase->importFragment(new ShapeDrawingFragmentHandler(*mxFilterBase, aFragmentPath, pShapePtr));
-
-                    uno::Sequence<beans::PropertyValue> aValue(mpShape->getDiagramDoms());
-                    uno::Sequence < uno::Any > diagramDrawing(2);
-                    // drawingValue[0] => dom, drawingValue[1] => Sequence of associated relationships
-
-                    sal_Int32 length = aValue.getLength();
-                    aValue.realloc(length+1);
-
-                    diagramDrawing[0] <<= mxFilterBase->importFragment( aFragmentPath );
-                    diagramDrawing[1] <<= pShapePtr->resolveRelationshipsOfTypeFromOfficeDoc(
-                                *mxFilterBase, aFragmentPath, "image" );
-
-                    beans::PropertyValue* pValue = aValue.getArray();
-                    pValue[length].Name = "OOXDrawing";
-                    pValue[length].Value <<= diagramDrawing;
-
-                    pShapePtr->setDiagramDoms( aValue );
+                    pShapePtr->setDiagramDoms(mpShape->getDiagramDoms());
+                    pShapePtr->keepDiagramDrawing(*mxFilterBase, aFragmentPath);
 
                     pShapePtr->addShape( *mxFilterBase, mpThemePtr.get(), xShapes, aMatrix, pShapePtr->getFillProperties() );
                     xResult = pShapePtr->getXShape();
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index fc09e270247f..c8f64fee859f 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -916,6 +916,7 @@ void SdImportTestSmartArt::testInteropGrabBag()
     CPPUNIT_ASSERT(aGrabBag.find("OOXLayout") != aGrabBag.end());
     CPPUNIT_ASSERT(aGrabBag.find("OOXStyle") != aGrabBag.end());
     CPPUNIT_ASSERT(aGrabBag.find("OOXColor") != aGrabBag.end());
+    CPPUNIT_ASSERT(aGrabBag.find("OOXDrawing") != aGrabBag.end());
 
     xDocShRef->DoClose();
 }


More information about the Libreoffice-commits mailing list