sw/qa/extras/ww8import/data/bnc875715.doc |binary sw/qa/extras/ww8import/ww8import.cxx | 8 ++++++ sw/source/filter/ww8/ww8par.cxx | 36 +++++++++++++++--------------- 3 files changed, 26 insertions(+), 18 deletions(-)
New commits: commit 7637f765cf2f8f65aec5490bd36bf4c745d2cfc6 Author: LuboÅ¡ LuÅák <l.lu...@collabora.com> Date: Tue Jun 24 14:14:14 2014 +0200 fix reading of section margins (bnc#875715) The reason the section ended up with incorrect margins was because that is computed as 'page margin' - 'section offset', and the order of setting these up was backwards: First InsertSection() created the section using the page margin of the old page, and only afterwards SetSwFmtPageDesc() set the page margin that should be used. Change-Id: I18ddcb0b5928879a2297b6caca766eab979abd45 diff --git a/sw/qa/extras/ww8import/data/bnc875715.doc b/sw/qa/extras/ww8import/data/bnc875715.doc new file mode 100644 index 0000000..af15e14 Binary files /dev/null and b/sw/qa/extras/ww8import/data/bnc875715.doc differ diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index 8ef83c1..6d0de33 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -407,6 +407,14 @@ DECLARE_WW8IMPORT_TEST(testBnc863018, "bnc863018.doc") CPPUNIT_ASSERT_EQUAL(sal_Int32(5002), getProperty<sal_Int32>(xTable, "TopMargin")); } +DECLARE_WW8IMPORT_TEST(testBnc875715, "bnc875715.doc") +{ + uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY); + // Was incorrectly set as -1270. + CPPUNIT_ASSERT_EQUAL(0, getProperty<sal_Int32>(xSections->getByIndex(0), "SectionLeftMargin")); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index ae1d28c..0eaf995 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -4517,24 +4517,6 @@ void wwSectionManager::InsertSegments() aSectPaM.GetPoint()->nContent.Assign( aSectPaM.GetCntntNode(), 0); - // End getting the bounds of this section, quite a job eh? - SwSectionFmt *pRet = InsertSection(aSectPaM, *aIter); - // The last section if continuous is always unbalanced - if (pRet) - { - // Set the columns to be UnBalanced if that compatability option is set - if (mrReader.pWDop->fNoColumnBalance) - pRet->SetFmtAttr(SwFmtNoBalancedColumns(true)); - else - { - // Otherwise set to unbalanced if the following section is - // not continuous, (which also means that the last section - // is unbalanced) - if (aNext == aEnd || !aNext->IsContinuous()) - pRet->SetFmtAttr(SwFmtNoBalancedColumns(true)); - } - } - bool bHasOwnHdFt = false; /* In this nightmare scenario the continuous section has its own @@ -4580,6 +4562,24 @@ void wwSectionManager::InsertSegments() aIter->mpPage = pOrig; } } + + // End getting the bounds of this section, quite a job eh? + SwSectionFmt *pRet = InsertSection(aSectPaM, *aIter); + // The last section if continuous is always unbalanced + if (pRet) + { + // Set the columns to be UnBalanced if that compatability option is set + if (mrReader.pWDop->fNoColumnBalance) + pRet->SetFmtAttr(SwFmtNoBalancedColumns(true)); + else + { + // Otherwise set to unbalanced if the following section is + // not continuous, (which also means that the last section + // is unbalanced) + if (aNext == aEnd || !aNext->IsContinuous()) + pRet->SetFmtAttr(SwFmtNoBalancedColumns(true)); + } + } } if (pTxtNd)
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits