summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/rtfimport/data/shptxt-pard.rtf19
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx12
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx3
3 files changed, 33 insertions, 1 deletions
diff --git a/sw/qa/extras/rtfimport/data/shptxt-pard.rtf b/sw/qa/extras/rtfimport/data/shptxt-pard.rtf
new file mode 100644
index 000000000000..31c9df556bc6
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/shptxt-pard.rtf
@@ -0,0 +1,19 @@
+{\rtf1
+first par
+\par
+{\shp
+{\*\shpinst\shpleft1371\shptop6712\shpright2453\shpbottom6887\shpfhdr0\shpbxpage\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplid1026
+{\sp
+{\sn shapeType}
+{\sv 1}
+}
+{\shptxt \ltrpar
+\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe1033\loch\af31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp1033
+\rtlch\fcs1
+\af0\afs16\alang1037 \ltrch\fcs0 \f0\fs16\insrsid11286377 \hich\af0\dbch\af31505\loch\f0 shape text
+\par
+}
+}
+}
+second par\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index d0376b7aca40..976a4f8d893a 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -115,6 +115,7 @@ public:
void testFdo52475();
void testFdo55493();
void testCopyPastePageStyle();
+ void testShptxtPard();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -169,6 +170,7 @@ public:
CPPUNIT_TEST(testFdo52475);
CPPUNIT_TEST(testFdo55493);
CPPUNIT_TEST(testCopyPastePageStyle);
+ CPPUNIT_TEST(testShptxtPard);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -893,6 +895,16 @@ void Test::testCopyPastePageStyle()
CPPUNIT_ASSERT_EQUAL(sal_Int32(21001), getProperty<sal_Int32>(xPropertySet, "Width")); // Was letter, i.e. 21590
}
+void Test::testShptxtPard()
+{
+ // The problem was that \pard inside \shptxt caused loss of shape text
+ load("shptxt-pard.rtf");
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+ uno::Reference<text::XText> xText(xDraws->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("shape text"), xText->getString());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index d0d0b7f893b1..b6a1121ce4b4 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2001,7 +2001,8 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms;
m_aStates.top().aParagraphAttributes = m_aDefaultState.aParagraphAttributes;
m_aStates.top().resetFrame();
- m_pCurrentBuffer = 0;
+ if (m_aStates.top().nDestinationState != DESTINATION_SHAPETEXT)
+ m_pCurrentBuffer = 0;
break;
case RTF_SECTD:
m_aStates.top().aSectionSprms = m_aDefaultState.aSectionSprms;