diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2014-06-24 14:14:14 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2014-06-25 09:44:05 +0200 |
commit | a852d9e16d028a83bd11adbcf5632a6fec0577b5 (patch) | |
tree | 5c0293f6e84c011e62d1e749d266cfb0b9bbf471 /sw | |
parent | 51b010777641244ee3beeddb65e5bce24251594c (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.
Conflicts:
sw/source/filter/ww8/ww8par.cxx
Change-Id: I18ddcb0b5928879a2297b6caca766eab979abd45
Reviewed-on: https://gerrit.libreoffice.org/9879
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
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 | 37 |
3 files changed, 27 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 dea54e55efa9..db1ca828a9a1 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -270,6 +270,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 ea556aec070a..4df118588439 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -4506,24 +4506,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 continous 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 @@ -4569,6 +4551,25 @@ 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 continous 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) |