[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - sw/qa writerfilter/source
Michael Stahl
mstahl at redhat.com
Fri Jul 25 02:31:31 PDT 2014
sw/qa/extras/rtfimport/data/fdo79319.rtf | 60 +++++++++++++++++++++++++
sw/qa/extras/rtfimport/rtfimport.cxx | 18 +++++++
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 2
3 files changed, 80 insertions(+)
New commits:
commit ca88a0ea6ed7277e8522d83458e3cfb975fcfb7d
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Jul 18 11:55:07 2014 +0200
(related: fdo#79319): writerfilter: RTF import: don't lose shapes in header
With a horizontal rule, it's possible that there is no \par following it
in a header, so RemoveLastParagraph() will delete the paragraph where
the shape is anchored (and so the shape as well). Avoid that by adding
an extra \par if there is no \par following a shape.
(cherry picked from commit 9aa80fcb291083dc2a396db3d1be756eb4a0e54b)
Change-Id: I4840417880c98203866c9dcde51627516618f2d0
Reviewed-on: https://gerrit.libreoffice.org/10389
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/qa/extras/rtfimport/data/fdo79319.rtf b/sw/qa/extras/rtfimport/data/fdo79319.rtf
new file mode 100644
index 0000000..48f022b
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo79319.rtf
@@ -0,0 +1,60 @@
+{\rtf1
+{\header
+\par
+{\pict
+{\*\picprop\shplid1025
+{\sp
+{\sn shapeType}
+{\sv 1}
+}
+{\sp
+{\sn fFlipH}
+{\sv 0}
+}
+{\sp
+{\sn fFlipV}
+{\sv 0}
+}
+{\sp
+{\sn fillColor}
+{\sv 10070188}
+}
+{\sp
+{\sn fFilled}
+{\sv 1}
+}
+{\sp
+{\sn fLine}
+{\sv 0}
+}
+{\sp
+{\sn alignHR}
+{\sv 1}
+}
+{\sp
+{\sn dxHeightHR}
+{\sv 30}
+}
+{\sp
+{\sn fLayoutInCell}
+{\sv 1}
+}
+{\sp
+{\sn fStandardHR}
+{\sv 1}
+}
+{\sp
+{\sn fHorizRule}
+{\sv 1}
+}
+{\sp
+{\sn fLayoutInCell}
+{\sv 1}
+}
+}
+\picscalex864\picscaley6\piccropl0\piccropr0\piccropt0\piccropb0\picw1764\pich882\picwgoal1000\pichgoal500\wmetafile8\bliptag-1602651790\blipupi1752
+{\*\blipuid a07979727e802d02da96f878ba973054}
+010009000003b700000006001c00000000000400000003010800050000000b0200000000050000000c021a000807040000002e0118001c000000fb02ceff0000000000009001000000000440001254696d6573204e657720526f6d616e0000000000000000000000000000000000040000002d0100000400000002010100050000000902000000020d000000320a2c00000001000400000000000807190020631600030000001e0007000000fc020000aca899000000040000002d01010008000000fa02050000000000ffffff00040000002d0102000e00000024030500ffffffffffff1800080718000807ffffffffffff08000000fa0200000000000000000000040000002d01030007000000fc020000ffffff000000040000002d010400040000002701ffff1c000000fb021000070000000000bc02000000000102022253797374656d000000000000de60e7770806080298030802200408025ae78339040000002d0105000300000000000000}
+}
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 6f6dede..a6474fc 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -828,6 +828,24 @@ DECLARE_RTFIMPORT_TEST(testDppolyline, "dppolyline.rtf")
CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xDraws->getCount());
}
+DECLARE_RTFIMPORT_TEST(testFdo79319, "fdo79319.rtf")
+{
+ // the thin horizontal rule was imported as a big fat rectangle
+ uno::Reference<drawing::XShape> xShape(getShape(1), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(100),
+ getProperty<sal_Int16>(xShape, "RelativeWidth"));
+ // FIXME the width/height numbers here are bogus; they should be 15238 / 53
+ // (as they are when opening the file in a full soffice)
+#if 0
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(15238), xShape->getSize().Width);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(53), xShape->getSize().Height);
+ CPPUNIT_ASSERT_EQUAL(text::VertOrientation::CENTER,
+ getProperty<sal_Int16>(xShape, "VertOrient"));
+ CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER,
+ getProperty<sal_Int16>(xShape, "HoriOrient"));
+#endif
+}
+
DECLARE_RTFIMPORT_TEST(testFdo56512, "fdo56512.rtf")
{
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index ef5c241..1210aa1 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -5234,8 +5234,10 @@ int RTFDocumentImpl::popState()
{
resolvePict(true, m_pSdrImport->getCurrentShape());
}
+ m_bNeedFinalPar = true;
break;
case DESTINATION_SHAPE:
+ m_bNeedFinalPar = true;
m_bNeedCr = m_bNeedCrOrig;
if (aState.aFrame.inFrame())
{
More information about the Libreoffice-commits
mailing list