summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2017-08-21 16:06:43 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2017-08-23 23:27:12 +0200
commite6d6d80bb75333c60d3d6163d1b40955546d125b (patch)
treebf37f605a13ce75eb65e8ee9467af09452364392
parentdfc0f39d32665051d9010ff25b686e88215925b0 (diff)
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@collabora.com> Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com> (cherry picked from commit 87f1f7fdb34fe452ac540524224e1e808ce5d3a2) Reviewed-on: https://gerrit.libreoffice.org/41465
-rw-r--r--oox/source/vml/vmlshape.cxx8
-rwxr-xr-xsw/qa/extras/ooxmlexport/data/watermark-shapetype.docxbin0 -> 17830 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport9.cxx13
3 files changed, 21 insertions, 0 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index a22da262281d..11d08754c01a 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -282,6 +282,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
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/watermark-shapetype.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index fd5b1716afe3..ccba14821d76 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -389,6 +389,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf107684, "tdf107684.odt")
assertXPath(pXmlDoc, "//w:style[@w:styleId='Heading1']/w:pPr/w:outlineLvl", 1);
}
+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: */