summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-05-06 13:01:27 +0200
committerPetr Mladek <pmladek@suse.cz>2013-05-07 13:21:05 +0200
commitc0c38e90b1003d72b7ddfaddd923ee39d910c0cb (patch)
tree64e8ab1ce1999dc72ee90036f170ebfee406f3d6 /sw
parent9411d4d56374a55777019d58c1e7f45767662707 (diff)
fdo#42144 WW8 export: avoid writing pointless empty footers
Regression from 1348288905ffa75d3634eee4392ba4660d28cdb9 (mismerge, I guess), when header was enabled, actually empty footer was exported, even in case footer was disabled. (cherry picked from commit 4144cd5a851466778004af9de98dbcfb019067bb) Conflicts: sw/qa/extras/ww8export/ww8export.cxx Change-Id: Ied55dc2a9f0faef87689c07935a47db384d37e1a Reviewed-on: https://gerrit.libreoffice.org/3797 Reviewed-by: Bosdonnat Cedric <cedric.bosdonnat@free.fr> Tested-by: Bosdonnat Cedric <cedric.bosdonnat@free.fr>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ww8export/data/fdo42144.odtbin0 -> 9425 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export.cxx9
-rw-r--r--sw/source/filter/ww8/wrtw8sty.cxx2
3 files changed, 10 insertions, 1 deletions
diff --git a/sw/qa/extras/ww8export/data/fdo42144.odt b/sw/qa/extras/ww8export/data/fdo42144.odt
new file mode 100644
index 000000000000..be9490079e72
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/fdo42144.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index 679f7656834b..6ed1ccd20d21 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -42,6 +42,7 @@ public:
void testFdo45724();
void testFdo46020();
void testFirstHeaderFooter();
+ void testFdo42144();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -60,6 +61,7 @@ void Test::run()
{"fdo45724.odt", &Test::testFdo45724},
{"fdo46020.odt", &Test::testFdo46020},
{"first-header-footer.doc", &Test::testFirstHeaderFooter},
+ {"fdo42144.odt", &Test::testFdo42144},
};
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
{
@@ -139,6 +141,13 @@ void Test::testFirstHeaderFooter()
CPPUNIT_ASSERT_EQUAL(OUString("Even page footer 2"), parseDump("/root/page[6]/footer/txt/text()"));
}
+void Test::testFdo42144()
+{
+ // Footer wasn't disabled -- instead empty footer was exported.
+ uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(xStyle, "FooterIsOn")));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index f002c1ff4226..d83718145192 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1182,7 +1182,7 @@ void WW8_WrPlcSepx::OutHeaderFooter( WW8Export& rWrt, bool bHeader,
else if ( rWrt.bWrtWW8 )
{
pTxtPos->Append( rCpPos );
- if (rWrt.bHasHdr && nBreakCode!=0)
+ if ((bHeader? rWrt.bHasHdr : rWrt.bHasFtr) && nBreakCode!=0)
{
rWrt.WriteStringAsPara( aEmptyStr ); // Empty paragraph for empty header/footer
rWrt.WriteStringAsPara( aEmptyStr ); // a CR that WW8 needs for end of the stream