[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - sw/qa sw/source

Luboš Luňák l.lunak at collabora.com
Tue Jun 24 08:27:41 PDT 2014


 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 ead8309b638b138d5ebb4a5bac36871479cacaab
Author: Luboš Luňák <l.lunak at 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
    (cherry picked from commit 7637f765cf2f8f65aec5490bd36bf4c745d2cfc6)
    Reviewed-on: https://gerrit.libreoffice.org/9878
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

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 4712493..27274f2 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4519,24 +4519,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
@@ -4582,6 +4564,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)


More information about the Libreoffice-commits mailing list