[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/qa writerfilter/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jul 22 09:20:27 UTC 2020
sw/qa/extras/rtfimport/data/picture-in-textframe.rtf | 29 +++++++++++++++++++
sw/qa/extras/rtfimport/rtfimport.cxx | 16 ++++++++++
writerfilter/source/rtftok/rtfsdrimport.cxx | 5 +++
3 files changed, 50 insertions(+)
New commits:
commit 5ccf0dac637345bab3d3a4e37ea6707c6d9bd0a6
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Jul 20 21:22:14 2020 +0200
Commit: Michael Stahl <michael.stahl at cib.de>
CommitDate: Wed Jul 22 11:19:56 2020 +0200
tdf#134400 RTF import: fix unexpected inner properties for picture-in-textframe
Regression from commit 4ab658b56f5c6ff0082d38d8ace1924d11e30e96 (RTF
import: implement support for tables inside text frames, 2013-06-16),
the problem was that both the outer "textbox" and the inner "picture
frame" object had a shapeType property, and the properties were stored
in a vector. So by the time RTFSdrImport::initShape() looked up the
shape type for the inner shape, it thought it's not a picture frame,
leading to data loss.
(cherry picked from commit 5a083be34456e91427d0f2e2fea172f49f4502db)
Change-Id: I4a536789371619d1d54afa8c8d41c7d273b0d21b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99118
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99167
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
diff --git a/sw/qa/extras/rtfimport/data/picture-in-textframe.rtf b/sw/qa/extras/rtfimport/data/picture-in-textframe.rtf
new file mode 100644
index 000000000000..ec0a07690bdf
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/picture-in-textframe.rtf
@@ -0,0 +1,29 @@
+{\rtf1
+\paperw10080\paperh12960\margl1066\margr1066\margt1642\margb1066
+\pard\plain
+{\shp
+{\*\shpinst\shpleft31\shptop105\shpright4108\shpbottom3887\shpfhdr0\shpwr2\shpwrk3\shpfblwtxt0
+{\sp
+{\sn shapeType}
+{\sv 202}
+}
+{\shptxt \pard\plain
+before
+{\*\shppict
+{\pict
+{\*\picprop\shplid1025
+{\sp
+{\sn shapeType}
+{\sv 75}
+}
+}
+\picscalex23\picscaley24\piccropl0\piccropr0\piccropt0\piccropb0\picw30372\pich22437\picwgoal17219\pichgoal12720\pngblip
+47494638396110001000d5ff00000000ffffffc0c0c0555f00ffffaafcfcfcf6f6f6eaeaeae6e6e6e4e4e4e3e3e3c2c2c2c1c1c1bcbcbcb5b5b5b3b3b3b0b0b0adadada5a5a5a2a2a2a1a1a19f9f9f9494948a8a8a8888888686867b7b7b6c6c6c5c5c5c4e4e4e4b4b4b4747474646463d3d3d3c3c3c2e2e2e2525251b1b1b18181810101009090906060603030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000021f90401000002002c0000000010001000000684408170482c0a06c8a4728924389f506833b281302a8e6b164b18103024c52111504cca67332102e0042e9a40d9319f8300a343c1200f54e47f7e2a00001e0b0a7d0d728a010d838400261a7c0d94947784252700127e9d159f6c8411140019080ea7a9a85f842122281612b1b3b25d6b1f29291d0fbbbdbc5d5e51c34e4cc64a46c94341003b
+}
+}
+after\par
+}
+}
+}
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index d2c2d4d24c8f..42c0108c020f 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -933,6 +933,22 @@ CPPUNIT_TEST_FIXTURE(Test, testOleInline)
getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType"));
}
+CPPUNIT_TEST_FIXTURE(Test, testPictureInTextframe)
+{
+ load(mpTestDocumentPath, "picture-in-textframe.rtf");
+ uno::Reference<drawing::XDrawPageSupplier> xTextDocument(mxComponent, uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPage> xDrawPage = xTextDocument->getDrawPage();
+ uno::Reference<beans::XPropertySet> xInnerShape(xDrawPage->getByIndex(1), uno::UNO_QUERY);
+ text::TextContentAnchorType eAnchorType = text::TextContentAnchorType_AT_PARAGRAPH;
+ xInnerShape->getPropertyValue("AnchorType") >>= eAnchorType;
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 1
+ // - Actual : 4
+ // i.e. the properties of the inner shape (including its anchor type and bitmap fill) were lost
+ // on import.
+ CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, eAnchorType);
+}
+
CPPUNIT_TEST_FIXTURE(Test, testTdf128611)
{
load(mpTestDocumentPath, "tdf128611.rtf");
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 85f61129b1f3..ddd2337a9945 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -1129,6 +1129,11 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
m_rImport.Mapper().endShape();
}
}
+
+ // If the shape has an inner shape, the inner object's properties should not be influenced by
+ // the outer one.
+ rShape.getProperties().clear();
+
m_xShape = xShape;
}
More information about the Libreoffice-commits
mailing list