diff options
-rw-r--r-- | sw/qa/extras/uiwriter/data/simplefooter.docx | bin | 0 -> 18174 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 22 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8sty.cxx | 8 |
3 files changed, 30 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data/simplefooter.docx b/sw/qa/extras/uiwriter/data/simplefooter.docx Binary files differnew file mode 100644 index 000000000000..006c85ab7cc8 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/simplefooter.docx diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index b7593759971b..0aea38d4bbe7 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -50,6 +50,7 @@ #include <com/sun/star/awt/FontUnderline.hpp> #include <vcl/TypeSerializer.hxx> +#include <svx/hdft.hxx> #include <svx/svdpage.hxx> #include <svx/svdview.hxx> #include <svl/itemiter.hxx> @@ -290,6 +291,7 @@ public: void testTdf92648(); void testTdf103978_backgroundTextShape(); void testTdf117225(); + void testTdf149184(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -411,6 +413,7 @@ public: CPPUNIT_TEST(testTdf92648); CPPUNIT_TEST(testTdf103978_backgroundTextShape); CPPUNIT_TEST(testTdf117225); + CPPUNIT_TEST(testTdf149184); CPPUNIT_TEST_SUITE_END(); private: @@ -4691,6 +4694,25 @@ void SwUiWriterTest::testTdf117225() CPPUNIT_ASSERT_EQUAL(nExpected, nActual); } +void SwUiWriterTest::testTdf149184() +{ + SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "simplefooter.docx"); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + // Removing the footer for all styles + pWrtShell->ChangeHeaderOrFooter(u"", false, false, false); + // export to simplefooter.doc + uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); + uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ + { "FilterName", uno::Any(OUString("MS Word 97")) }, + }); + utl::TempFile aTempFile; + aTempFile.EnableKillingFile(); + // Without the fix in place, the test fails with: + // [CUT] sw_uiwriter7 + // Segmentation fault (core dumped) + // [_RUN_____] testTdf149184::TestBody + xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); +} CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 9f103627d576..4126b9f88a50 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -2087,6 +2087,10 @@ void MSWordExportBase::WriteHeaderFooterText( const SwFormat& rFormat, bool bHea m_bHasHdr = true; const SwFormatHeader& rHd = rFormat.GetHeader(); OSL_ENSURE( rHd.GetHeaderFormat(), "Header text is not here" ); + + if ( !rHd.GetHeaderFormat() ) + return; + pContent = &rHd.GetHeaderFormat()->GetContent(); } else @@ -2094,6 +2098,10 @@ void MSWordExportBase::WriteHeaderFooterText( const SwFormat& rFormat, bool bHea m_bHasFtr = true; const SwFormatFooter& rFt = rFormat.GetFooter(); OSL_ENSURE( rFt.GetFooterFormat(), "Footer text is not here" ); + + if ( !rFt.GetFooterFormat() ) + return; + pContent = &rFt.GetFooterFormat()->GetContent(); } |