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

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Sun Sep 13 12:41:10 UTC 2020


 sw/qa/extras/layout/data/tdf134463.docx |binary
 sw/qa/extras/layout/layout.cxx          |    8 ++++++++
 sw/source/core/layout/flowfrm.cxx       |   24 +++++++++++++++++-------
 3 files changed, 25 insertions(+), 7 deletions(-)

New commits:
commit dc5c5e8c04185ff11477ae0d084380b095381ff4
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Fri Jul 3 16:52:45 2020 +0200
Commit:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Sun Sep 13 14:40:38 2020 +0200

    tdf#134463 DOCX import: fix other "half" of contextualSpacing
    
    Always ignore own bottom margin setting of the previous paragraph
    with contextual spacing, if the actual paragraph is identical.
    I.e. in that case, too, when the actual paragraph has no
    contextual spacing, like MSO does.
    
    Note: PARA_SPACE_MAX mode hasn't included this modification,
    yet, so only ODT documents converted from DOCX use it at the
    default setting.
    
    See also commit e318d5d8146d18e2c76e23f2e3c39527f2af9f36
    (tdf#125893 DOCX import: fix "half" contextual paragraph spacing).
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97874
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit a5073875fe551790a314b402ff209545050c17da)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98076
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    (cherry picked from commit 7f147ddd2764dd2ea92d4e4b92287ec1cf839848)
    
    Change-Id: I83fab2a2d85eeb9d48a8546d5a4e6423988d642c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102560
    Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>

diff --git a/sw/qa/extras/layout/data/tdf134463.docx b/sw/qa/extras/layout/data/tdf134463.docx
new file mode 100644
index 000000000000..9de51cc97557
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf134463.docx differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 2f5e080fba31..6b68de9e87e4 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -3079,6 +3079,14 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf125893)
     assertXPath(pXmlDoc, "/root/page/body/txt[4]/infos/prtBounds", "top", "0");
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf134463)
+{
+    createDoc("tdf134463.docx");
+    xmlDocPtr pXmlDoc = parseLayoutDump();
+    // This was 621. The previous paragraph must have zero bottom border.
+    assertXPath(pXmlDoc, "/root/page/body/txt[3]/infos/prtBounds", "top", "21");
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117188)
 {
     createDoc("tdf117188.docx");
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 85ae13a6dcf9..6c1195967c22 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1422,16 +1422,25 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs,
         if( pPrevFrame )
         {
             const bool bUseFormerLineSpacing = rIDSA.get(DocumentSettingId::OLD_LINE_SPACING);
-            const bool bContextualSpacing = pAttrs->GetULSpace().GetContext()
-                                         && lcl_getContextualSpacing(pPrevFrame)
+            const bool bContextualSpacingThis = pAttrs->GetULSpace().GetContext();
+            const bool bContextualSpacingPrev = lcl_getContextualSpacing(pPrevFrame);
+
+            const bool bContextualSpacing = bContextualSpacingThis
+                                         && bContextualSpacingPrev
                                          && lcl_IdenticalStyles(pPrevFrame, &m_rThis);
 
             // tdf#125893 always ignore own top margin setting of the actual paragraph
             // with contextual spacing, if the previous paragraph is identical
             const bool bHalfContextualSpacing = !bContextualSpacing
-                                         && pAttrs->GetULSpace().GetContext()
-                                         && !lcl_getContextualSpacing(pPrevFrame)
-                                         && lcl_getContextualSpacing(&m_rThis)
+                                         && bContextualSpacingThis
+                                         && !bContextualSpacingPrev
+                                         && lcl_IdenticalStyles(pPrevFrame, &m_rThis);
+
+            // tdf#134463 always ignore own bottom margin setting of the previous paragraph
+            // with contextual spacing, if the actual paragraph is identical
+            const bool bHalfContextualSpacingPrev = !bContextualSpacing
+                                         && !bContextualSpacingThis
+                                         && bContextualSpacingPrev
                                          && lcl_IdenticalStyles(pPrevFrame, &m_rThis);
 
             // i#11860 - use new method to determine needed spacing
@@ -1489,8 +1498,9 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs,
             }
             else
             {
-                nUpper = bContextualSpacing ? 0 : std::max(static_cast<long>(nPrevLowerSpace), bHalfContextualSpacing
-                                                           ? 0 : static_cast<long>(pAttrs->GetULSpace().GetUpper()) );
+                nUpper = bContextualSpacing ? 0 : std::max(
+                                bHalfContextualSpacingPrev ? 0 : static_cast<long>(nPrevLowerSpace),
+                                bHalfContextualSpacing     ? 0 : static_cast<long>(pAttrs->GetULSpace().GetUpper()) );
 
                 // i#11859 - consideration of the line spacing
                 //      for the upper spacing of a text frame


More information about the Libreoffice-commits mailing list