[Libreoffice-commits] .: sw/qa writerfilter/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Oct 17 03:01:35 PDT 2012


 sw/qa/extras/rtfimport/data/shptxt-pard.rtf    |   19 +++++++++++++++++++
 sw/qa/extras/rtfimport/rtfimport.cxx           |   12 ++++++++++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    3 ++-
 3 files changed, 33 insertions(+), 1 deletion(-)

New commits:
commit 6fc868c6535932bedfa0fc51d8dd5a1814d73ee8
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Oct 17 11:17:14 2012 +0200

    fix import of RTF_PARD inside RTF_SHPTXT
    
    Change-Id: Id722b61cec9b8ae6550122e192affecadfcb1217

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 0000000..31c9df5
--- /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 d0376b7..976a4f8 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 d0d0b7f..b6a1121 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;


More information about the Libreoffice-commits mailing list