[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - oox/qa oox/source

nd101 (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 10 19:11:56 UTC 2020


 oox/qa/unit/data/tdf131082.pptx |binary
 oox/qa/unit/drawingml.cxx       |   42 ++++++++++++++++++++++++++++++++++++++++
 oox/source/drawingml/shape.cxx  |    2 +
 3 files changed, 44 insertions(+)

New commits:
commit 4c8837819c7429f22eed2cdc39c4aa0ff1aaeeb6
Author:     nd101 <Fong at nd.com.cn>
AuthorDate: Tue Mar 3 15:19:07 2020 +0800
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Jun 10 21:11:21 2020 +0200

    tdf#131082 fix missing fill property of grouped shapes
    
    When shapes are grouped together, and fill property is specified
    at the group level in MSO, it fails to work in IMPRESS.
    
    This fix is to set the fill property when it is being imported.
    
    Change-Id: I89920e71fc558f54d49ef7b065c549a732bc2b10
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89862
    Tested-by: Jenkins
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96065
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/oox/qa/unit/data/tdf131082.pptx b/oox/qa/unit/data/tdf131082.pptx
new file mode 100644
index 000000000000..dbe88126f9c4
Binary files /dev/null and b/oox/qa/unit/data/tdf131082.pptx differ
diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx
index e3c455c04867..6f9688be07f8 100644
--- a/oox/qa/unit/drawingml.cxx
+++ b/oox/qa/unit/drawingml.cxx
@@ -12,7 +12,10 @@
 
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
 #include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/text/XText.hpp>
 #include <com/sun/star/frame/Desktop.hpp>
 #include <com/sun/star/frame/XStorable.hpp>
 
@@ -26,6 +29,24 @@
 
 using namespace ::com::sun::star;
 
+namespace
+{
+/// Gets one child of xShape, which one is specified by nIndex.
+uno::Reference<drawing::XShape> getChildShape(const uno::Reference<drawing::XShape>& xShape,
+                                              sal_Int32 nIndex)
+{
+    uno::Reference<container::XIndexAccess> xGroup(xShape, uno::UNO_QUERY);
+    CPPUNIT_ASSERT(xGroup.is());
+
+    CPPUNIT_ASSERT(xGroup->getCount() > nIndex);
+
+    uno::Reference<drawing::XShape> xRet(xGroup->getByIndex(nIndex), uno::UNO_QUERY);
+    CPPUNIT_ASSERT(xRet.is());
+
+    return xRet;
+}
+}
+
 /// oox drawingml tests.
 class OoxDrawingmlTest : public test::BootstrapFixture, public unotest::MacrosTest
 {
@@ -95,6 +116,27 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTransparentText)
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(75), nTransparency);
 }
 
+CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTdf131082)
+{
+    OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf131082.pptx";
+    loadAndReload(aURL, "Impress Office Open XML");
+
+    uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY);
+    uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
+                                                 uno::UNO_QUERY);
+
+    uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> XPropSet(getChildShape(getChildShape(xShape, 0), 0),
+                                                 uno::UNO_QUERY);
+
+    drawing::FillStyle eFillStyle = drawing::FillStyle_NONE;
+    XPropSet->getPropertyValue("FillStyle") >>= eFillStyle;
+
+    // Without the accompanying fix in place, this test would have failed with:
+    // with drawing::FillStyle_NONE - 0
+    CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, eFillStyle);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index cce8b9ba7bbc..8cb3d00df231 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1042,6 +1042,8 @@ Reference< XShape > const & Shape::createAndInsert(
             mpTablePropertiesPtr->pushToPropSet( rFilterBase, xSet, mpMasterTextListStyle );
 
         FillProperties aFillProperties = getActualFillProperties(pTheme, &rShapeOrParentShapeFillProps);
+        if (getFillProperties().moFillType.has() && getFillProperties().moFillType.get() == XML_grpFill)
+            getFillProperties().assignUsed(aFillProperties);
         if(!bIsCroppedGraphic)
             aFillProperties.pushToPropMap( aShapeProps, rGraphicHelper, mnRotation, nFillPhClr, mbFlipH, mbFlipV );
         LineProperties aLineProperties = getActualLineProperties(pTheme);


More information about the Libreoffice-commits mailing list