diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2014-06-24 14:14:14 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2014-06-24 14:18:38 +0200 |
commit | 7637f765cf2f8f65aec5490bd36bf4c745d2cfc6 (patch) | |
tree | c577103e8cf561cdd11c4fcf4142e096832f0af8 /sw | |
parent | 56bbd709904b3a8b8932acbf72df4192d873c18f (diff) |
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
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ww8import/data/bnc875715.doc | bin | 0 -> 41472 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8import/ww8import.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 36 |
3 files changed, 26 insertions, 18 deletions
diff --git a/sw/qa/extras/ww8import/data/bnc875715.doc b/sw/qa/extras/ww8import/data/bnc875715.doc Binary files differnew file mode 100644 index 000000000000..af15e1434eb7 --- /dev/null +++ b/sw/qa/extras/ww8import/data/bnc875715.doc diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index 8ef83c1dfb28..6d0de33c099c 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 ae1d28cfea65..0eaf995c4cb3 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) |