summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-12-06 09:22:53 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-12-06 09:11:30 +0000
commitc2e070d9a8192e7aceed64a63c716c7317843747 (patch)
tree13fc89a8f1a2039de7475bac2a67d216dd7b9c39
parent252008d49203344ebe69e727a260a48bc76d7a82 (diff)
tdf#104317 RTF import: avoid setting CustomShapeGeometry on a line shape
Even Santa Claus knows it has no such property. Change-Id: I46e27868c62fabd10c6447956e40e55962ee284b Reviewed-on: https://gerrit.libreoffice.org/31668 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r--sw/qa/extras/rtfimport/data/tdf104317.rtf39
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx8
-rw-r--r--writerfilter/source/rtftok/rtfsdrimport.cxx18
3 files changed, 58 insertions, 7 deletions
diff --git a/sw/qa/extras/rtfimport/data/tdf104317.rtf b/sw/qa/extras/rtfimport/data/tdf104317.rtf
new file mode 100644
index 000000000000..3f80f3f0bd76
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf104317.rtf
@@ -0,0 +1,39 @@
+{\rtf1\ansi\ansicpg1251\uc1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1049\deflangfe1049
+{\shp
+{\*\shpinst\shpleft5940\shptop8200\shpright5940\shpbottom8480\shpfhdr0\shpbxpage\shpbxignore\shpbypage\shpbyignore\shpwr3\shpwrk0\shpfblwtxt1\shpz37\shplid1064
+{\sp
+{\sn shapeType}
+{\sv 20}
+}
+{\sp
+{\sn fFlipV}
+{\sv 1}
+}
+{\sp
+{\sn fShadow}
+{\sv 0}
+}
+{\sp
+{\sn posrelh}
+{\sv 1}
+}
+{\sp
+{\sn posrelv}
+{\sv 1}
+}
+{\sp
+{\sn fLayoutInCell}
+{\sv 0}
+}
+{\sp
+{\sn fBehindDocument}
+{\sv 1}
+}
+{\sp
+{\sn fLayoutInCell}
+{\sv 0}
+}
+}
+}
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 344a3a4acf18..2f554e1595fc 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2713,6 +2713,14 @@ DECLARE_RTFIMPORT_TEST(testTdf90697, "tdf90697.rtf")
CPPUNIT_ASSERT_EQUAL(1, getPages());
}
+DECLARE_RTFIMPORT_TEST(testTdf104317, "tdf104317.rtf")
+{
+ // This failed to load, we tried to set CustomShapeGeometry on a line shape.
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), xDrawPage->getCount());
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 61cde990e775..fa05c83e9e02 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -941,13 +941,17 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
if (obFlipH == true || obFlipV == true)
{
- // This has to be set after position and size is set, otherwise flip will affect the position.
- comphelper::SequenceAsHashMap aCustomShapeGeometry(xPropertySet->getPropertyValue("CustomShapeGeometry"));
- if (obFlipH == true)
- aCustomShapeGeometry["MirroredX"] <<= true;
- if (obFlipV == true)
- aCustomShapeGeometry["MirroredY"] <<= true;
- xPropertySet->setPropertyValue("CustomShapeGeometry", uno::makeAny(aCustomShapeGeometry.getAsConstPropertyValueList()));
+ // Line shapes have no CustomShapeGeometry.
+ if (nType != ESCHER_ShpInst_Line)
+ {
+ // This has to be set after position and size is set, otherwise flip will affect the position.
+ comphelper::SequenceAsHashMap aCustomShapeGeometry(xPropertySet->getPropertyValue("CustomShapeGeometry"));
+ if (obFlipH == true)
+ aCustomShapeGeometry["MirroredX"] <<= true;
+ if (obFlipV == true)
+ aCustomShapeGeometry["MirroredY"] <<= true;
+ xPropertySet->setPropertyValue("CustomShapeGeometry", uno::makeAny(aCustomShapeGeometry.getAsConstPropertyValueList()));
+ }
}
if (rShape.nHoriOrientRelation != 0)