tdf#132149 ww8export: use left page properties for left style
This code was unchanged since original import from OOo.
There is some monkey business going on here to handle left/right
page styles following each other. Normally, the settings
between these pages would be identical in terms
of margins and page size etc. But not necessarily so.
So, make sure that for the left style, use the format properties
from the left style before switching over to the right style
to grab its header/footer.
[At least, that is how I understand what is happening...]
Change-Id: Idc65a14fb39566e05d32d677c90e68971d77590c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101544
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 09f847b..dfce290 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -519,11 +519,24 @@ DECLARE_OOXMLEXPORT_TEST(testTdf135343_columnSectionBreak_c15, "tdf135343_column
DECLARE_OOXMLEXPORT_TEST(testTdf132149_pgBreak, "tdf132149_pgBreak.odt")
{
// This 5 page document is designed to visually exaggerate the problems
// of emulating LO's followed-by-page-style into MSWord's sections.
// While much has been improved, there are extra pages present, which still need fixing.
xmlDocUniquePtr pDump = parseLayoutDump();
// No header on pages 1,2,3 (and currently 4).
// No header on pages 1,2,3.
assertXPath(pDump, "//page[2]/header", 0);
// Margins/page orientation between Right and Left page styles are different
assertXPath(pDump, "//page[1]/infos/prtBounds", "left", "1134"); //Right page style
assertXPath(pDump, "//page[2]/infos/prtBounds", "left", "2268"); //Left page style
assertXPath(pDump, "//page[1]/infos/bounds", "width", "8391"); //landscape
assertXPath(pDump, "//page[2]/infos/bounds", "width", "5953"); //portrait
// This two-line 3rd page ought not to exist. DID YOU FIX ME? The real page 3 should be "8391" landscape.
assertXPath(pDump, "//page[3]/infos/bounds", "width", "5953");
//Page break is not lost. This SHOULD be on page 4, but sadly it is not.
assertXPathContent(pDump, "//page[5]/header/txt", "First Page Style");
CPPUNIT_ASSERT(getXPathContent(pDump, "//page[5]/body/txt").startsWith("Lorem ipsum"));
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 0e7830c..5f4c31d 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1775,8 +1775,8 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
if ( UseOnPage::Left == ( UseOnPage::All & pPd->ReadUseOn() ) )
{
nBreakCode = 3;
pPd = pPd->GetFollow();
pPdFormat = &pPd->GetMaster();
pPdFormat = &pPd->GetMaster(); //use the current page for settings (margins/width etc)
pPd = pPd->GetFollow(); //switch to the right page for the right/odd header/footer
}
else
nBreakCode = 4;