diff options
-rw-r--r-- | sw/qa/extras/rtfexport/data/fdo50831.rtf | 11 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport.cxx | 15 | ||||
-rw-r--r-- | sw/source/filter/ww8/attributeoutputbase.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.hxx | 5 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8nds.cxx | 7 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8attributeoutput.hxx | 2 |
10 files changed, 47 insertions, 13 deletions
diff --git a/sw/qa/extras/rtfexport/data/fdo50831.rtf b/sw/qa/extras/rtfexport/data/fdo50831.rtf new file mode 100644 index 000000000000..476a82f76e00 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/fdo50831.rtf @@ -0,0 +1,11 @@ +{\rtf1\ansi\deff3\adeflang1025 +{\fonttbl +{\f0\froman\fprq2\fcharset0 Times New Roman;} +{\f4\fswiss\fprq2\fcharset0 Arial;} +} +\pard\plain +\fs20\loch\f4 +\par \pard\plain +{\fs20\f4 +Foo} +\par} diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 6df0aec4c988..428b7e158b6c 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -48,6 +48,7 @@ public: void testFdo49683(); void testFdo44174(); void testFdo50087(); + void testFdo50831(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -56,6 +57,7 @@ public: CPPUNIT_TEST(testFdo49683); CPPUNIT_TEST(testFdo44174); CPPUNIT_TEST(testFdo50087); + CPPUNIT_TEST(testFdo50831); #endif CPPUNIT_TEST_SUITE_END(); @@ -129,6 +131,19 @@ void Test::testFdo50087() CPPUNIT_ASSERT_EQUAL(OUString("First line.\nSecond line."), xDocumentProperties->getDescription()); } +void Test::testFdo50831() +{ + roundtrip("fdo50831.rtf"); + + uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); + uno::Reference<beans::XPropertySet> xPropertySet(xParaEnum->nextElement(), uno::UNO_QUERY); + float fValue = 0; + xPropertySet->getPropertyValue("CharHeight") >>= fValue; + CPPUNIT_ASSERT_EQUAL(10.f, fValue); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx index 4b08cbfa13c6..c257a02582ef 100644 --- a/sw/source/filter/ww8/attributeoutputbase.hxx +++ b/sw/source/filter/ww8/attributeoutputbase.hxx @@ -159,7 +159,7 @@ public: virtual void EmptyParagraph() = 0; /// Start of the text run. - virtual void StartRun( const SwRedlineData* pRedlineData ) = 0; + virtual void StartRun( const SwRedlineData* pRedlineData, bool bSingleEmptyRun = false ) = 0; /// End of the text run. virtual void EndRun() = 0; diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 0d94c307e061..e2406d1da6e3 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -500,7 +500,7 @@ void DocxAttributeOutput::EndParagraphProperties() m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_PREPEND ); } -void DocxAttributeOutput::StartRun( const SwRedlineData* pRedlineData ) +void DocxAttributeOutput::StartRun( const SwRedlineData* pRedlineData, bool /*bSingleEmptyRun*/ ) { // if there is some redlining in the document, output it StartRedline( pRedlineData ); diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index 11b8ceed818d..3c855cf20286 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -90,7 +90,7 @@ public: virtual void EndParagraphProperties(); /// Start of the text run. - virtual void StartRun( const SwRedlineData* pRedlineData ); + virtual void StartRun( const SwRedlineData* pRedlineData, bool bSingleEmptyRun = false ); /// End of the text run. virtual void EndRun(); diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index c8efc8270c2a..9380cca7375c 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -379,11 +379,13 @@ void RtfAttributeOutput::EndParagraphProperties() m_rExport.Strm() << m_aStyles.makeStringAndClear().getStr(); } -void RtfAttributeOutput::StartRun( const SwRedlineData* pRedlineData ) +void RtfAttributeOutput::StartRun( const SwRedlineData* pRedlineData, bool bSingleEmptyRun ) { SAL_INFO("sw.rtf", OSL_THIS_FUNC); - m_aRun->append('{'); + m_bSingleEmptyRun = bSingleEmptyRun; + if (!m_bSingleEmptyRun) + m_aRun->append('{'); // if there is some redlining in the document, output it Redline( pRedlineData ); @@ -396,7 +398,8 @@ void RtfAttributeOutput::EndRun() SAL_INFO("sw.rtf", OSL_THIS_FUNC); m_aRun->append(m_rExport.sNewLine); m_aRun.appendAndClear(m_aRunText); - m_aRun->append('}'); + if (!m_bSingleEmptyRun) + m_aRun->append('}'); } void RtfAttributeOutput::StartRunProperties() @@ -3025,7 +3028,8 @@ RtfAttributeOutput::RtfAttributeOutput( RtfExport &rExport ) m_bWroteCellInfo( false ), m_bHadFieldResult( false ), m_bTableRowEnded( false ), - m_aCells() + m_aCells(), + m_bSingleEmptyRun(false) { SAL_INFO("sw.rtf", OSL_THIS_FUNC); } diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx index 4be68dbdc8b2..3957de502b43 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.hxx +++ b/sw/source/filter/ww8/rtfattributeoutput.hxx @@ -65,7 +65,7 @@ public: virtual void EndParagraphProperties(); /// Start of the text run. - virtual void StartRun( const SwRedlineData* pRedlineData ); + virtual void StartRun( const SwRedlineData* pRedlineData, bool bSingleEmptyRun = false ); /// End of the text run. virtual void EndRun(); @@ -541,6 +541,9 @@ private: /// Number of cells from the table definition, by depth. std::map<sal_uInt32,sal_uInt32> m_aCells; + + /// If we're in a paragraph that has a single empty run only. + bool m_bSingleEmptyRun; public: RtfAttributeOutput( RtfExport &rExport ); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 988c3d0efece..adeeb5a4f067 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -1806,12 +1806,13 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) do { const SwRedlineData* pRedlineData = aAttrIter.GetRedline( nAktPos ); - AttrOutput().StartRun( pRedlineData ); + xub_StrLen nNextAttr = GetNextPos( &aAttrIter, rNode, nAktPos ); + // Is this the only run in this paragraph and it's empty? + bool bSingleEmptyRun = nAktPos == 0 && nNextAttr == 0; + AttrOutput().StartRun( pRedlineData, bSingleEmptyRun ); if( nTxtTyp == TXT_FTN || nTxtTyp == TXT_EDN ) AttrOutput().FootnoteEndnoteRefTag(); - xub_StrLen nNextAttr = GetNextPos( &aAttrIter, rNode, nAktPos ); - if( nNextAttr > nEnd ) nNextAttr = nEnd; diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 52cc2bc74d43..40e85b6751e9 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -972,7 +972,7 @@ void WW8AttributeOutput::StartRunProperties() } -void WW8AttributeOutput::StartRun( const SwRedlineData* pRedlineData ) +void WW8AttributeOutput::StartRun( const SwRedlineData* pRedlineData, bool /*bSingleEmptyRun*/ ) { if (pRedlineData) { diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx index fa9c1703e3b7..f32a038eedc6 100644 --- a/sw/source/filter/ww8/ww8attributeoutput.hxx +++ b/sw/source/filter/ww8/ww8attributeoutput.hxx @@ -55,7 +55,7 @@ public: /// Start of the text run. /// - virtual void StartRun( const SwRedlineData* pRedlineData ); + virtual void StartRun( const SwRedlineData* pRedlineData, bool bSingleEmptyRun = false ); /// End of the text run. /// |