diff options
author | Luke Deller <luke@deller.id.au> | 2014-07-06 23:19:18 +1000 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-07-09 10:58:31 +0000 |
commit | f312ef98de57a5926be67421395544bb9d41b809 (patch) | |
tree | 4292737b838068de2520340d5e4af20e21b7a679 /sw/qa/extras/ww8import | |
parent | c1b562139a2e87cce2f189c50a242cf057970551 (diff) |
fix fdo#77844: header wrongly enabled from .doc
The LO page style needs page headers to be turned on if the
corresponding .doc file section has a left (=even) page header or a
first page header.
However this should not be triggered in the case where a first page
header is present but hidden due to the "different first page" header
option being disabled. This case is fixed by this commit.
Change-Id: If3de0df45378587fdbdecc6a091d2f4b60940b43
Reviewed-on: https://gerrit.libreoffice.org/10100
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sw/qa/extras/ww8import')
-rwxr-xr-x | sw/qa/extras/ww8import/data/fdo77844.doc | bin | 0 -> 28672 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8import/ww8import.cxx | 47 |
2 files changed, 47 insertions, 0 deletions
diff --git a/sw/qa/extras/ww8import/data/fdo77844.doc b/sw/qa/extras/ww8import/data/fdo77844.doc Binary files differnew file mode 100755 index 000000000000..cd7368d5d654 --- /dev/null +++ b/sw/qa/extras/ww8import/data/fdo77844.doc diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index 270d665d26a2..147fb882f19e 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -415,6 +415,53 @@ DECLARE_WW8IMPORT_TEST(testBnc875715, "bnc875715.doc") CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xSections->getByIndex(0), "SectionLeftMargin")); } +DECLARE_WW8IMPORT_TEST(testFdo77844, "fdo77844.doc") +{ + uno::Reference<container::XNameAccess> pageStyles = getStyles("PageStyles"); + + // get a page cursor + uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier( + xModel->getCurrentController(), uno::UNO_QUERY); + uno::Reference<text::XPageCursor> xCursor( + xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + + // check that the first page has no header + xCursor->jumpToFirstPage(); + OUString pageStyleName = getProperty<OUString>(xCursor, "PageStyleName"); + uno::Reference<style::XStyle> pageStyle( + pageStyles->getByName(pageStyleName), uno::UNO_QUERY); + bool headerIsOn = getProperty<bool>(pageStyle, "HeaderIsOn"); + CPPUNIT_ASSERT(!headerIsOn); + + // check that the second page has a header + xCursor->jumpToPage(2); + pageStyleName = getProperty<OUString>(xCursor, "PageStyleName"); + pageStyle.set( + pageStyles->getByName(pageStyleName), uno::UNO_QUERY); + headerIsOn = getProperty<bool>(pageStyle, "HeaderIsOn"); + CPPUNIT_ASSERT(headerIsOn); + + // check that the third page has a header + xCursor->jumpToPage(3); + pageStyleName = getProperty<OUString>(xCursor, "PageStyleName"); + pageStyle.set( + pageStyles->getByName(pageStyleName), uno::UNO_QUERY); + headerIsOn = getProperty<bool>(pageStyle, "HeaderIsOn"); + CPPUNIT_ASSERT(headerIsOn); + + // check that the fourth page has no header + // (#if'd out as this is not yet imported correctly) +#if 0 + xCursor->jumpToPage(4); + pageStyleName = getProperty<OUString>(xCursor, "PageStyleName"); + pageStyle.set( + pageStyles->getByName(pageStyleName), uno::UNO_QUERY); + headerIsOn = getProperty<bool>(pageStyle, "HeaderIsOn"); + CPPUNIT_ASSERT(!headerIsOn); +#endif +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); |