[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - oox/source sw/qa

Szymon Kłos szymon.klos at collabora.com
Mon Sep 25 19:06:33 UTC 2017


 oox/source/vml/vmlshape.cxx                            |    8 ++++++++
 sw/qa/extras/ooxmlexport/data/watermark-shapetype.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx              |   13 +++++++++++++
 3 files changed, 21 insertions(+)

New commits:
commit 9778e5765ad26457da779493edde8a061266c7e3
Author: Szymon Kłos <szymon.klos at collabora.com>
Date:   Mon Aug 21 16:06:43 2017 +0200

    VML, Watermark: detect shapetype from other subdocuments
    
    In some documents Watermark wasn't visible
    because shapetype wasn't detected.
    It was impossible to use shapetype defined in header1.xml
    in shape placed in the header2.xml.
    
    Change-Id: Ib406c8fc702968684ad46efd0857b768af2820f5
    Reviewed-on: https://gerrit.libreoffice.org/41395
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    (cherry picked from commit 87f1f7fdb34fe452ac540524224e1e808ce5d3a2)
    Reviewed-on: https://gerrit.libreoffice.org/42349
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index c89b5ece1934..45e7e40ab831 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -284,6 +284,14 @@ void ShapeBase::finalizeFragmentImport()
             aType = aType.copy(1);
         if( const ShapeType* pShapeType = mrDrawing.getShapes().getShapeTypeById( aType, true ) )
             maTypeModel.assignUsed( pShapeType->getTypeModel() );
+        else {
+            // Temporary fix, shapetype not found if referenced from different substream
+            // FIXME: extend scope of ShapeContainer to store all shapetypes from the document
+            const OUString sShapeTypePrefix = "shapetype_";
+            if (aType.startsWith(sShapeTypePrefix)) {
+                maTypeModel.moShapeType = aType.copy(sShapeTypePrefix.getLength()).toInt32();
+            }
+        }
     }
 }
 
diff --git a/sw/qa/extras/ooxmlexport/data/watermark-shapetype.docx b/sw/qa/extras/ooxmlexport/data/watermark-shapetype.docx
new file mode 100755
index 000000000000..423f3cf7184f
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/watermark-shapetype.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index a22ab5d7e13f..c964aba9d43b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -655,6 +655,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf109184, "tdf109184.docx")
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xff0000), getProperty<sal_Int32>(xCell3, "BackColor"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testWatermark, "watermark-shapetype.docx")
+{
+    uno::Reference<drawing::XShape> xShape1(getShape(1), uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xPropertySet1(xShape1, uno::UNO_QUERY);
+    xShape1.is();
+
+    uno::Reference<drawing::XShape> xShape2(getShape(2), uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xPropertySet2(xShape2, uno::UNO_QUERY);
+    xShape2.is();
+
+    CPPUNIT_ASSERT_EQUAL(xPropertySet1->getPropertyValue("TextAutoGrowHeight"), xPropertySet2->getPropertyValue("TextAutoGrowHeight"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list