sw/qa/extras/layout/data/tdf128198-1.docx |binary
 sw/qa/extras/layout/layout.cxx            |   21 +++++++++++++++++++++
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx |    6 ------
 sw/source/core/text/itrform2.cxx          |    3 ++-
 4 files changed, 23 insertions(+), 7 deletions(-)

New commits:
commit 81082204ca500c40c5f2e7d615422747c973a6ac
Author:     Michael Stahl <michael.st...@cib.de>
AuthorDate: Mon Aug 10 19:14:54 2020 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Aug 11 17:37:15 2020 +0200

    tdf#128198 sw: text formatting: only consider upper margin for first line
    
    The non-first lines start below the first one so the margin is already
    included in the previous line's Y position.
    
    Also move the testTdf116486 to layout.cxx.
    
    (regression from d07fc485d46f431405a3f6a002f951a08c559677)
    
    Change-Id: I574516ea5f9600e2d861e43162b1a69488c68819
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100440
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@cib.de>
    (cherry picked from commit 99ef50f97b6d8461b8953c2555298c7bbeb3405b)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100369
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/extras/ooxmlimport/data/tdf116486.docx 
b/sw/qa/extras/layout/data/tdf116486.docx
similarity index 100%
rename from sw/qa/extras/ooxmlimport/data/tdf116486.docx
rename to sw/qa/extras/layout/data/tdf116486.docx
diff --git a/sw/qa/extras/layout/data/tdf128198-1.docx 
b/sw/qa/extras/layout/data/tdf128198-1.docx
new file mode 100644
index 000000000000..7c9974d562b9
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf128198-1.docx differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index d2fba4c8299e..44512e2ce8a2 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -1164,6 +1164,27 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134277)
                                  xmlXPathNodeSetGetLength(pXmlNodes));
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116486)
+{
+    SwDoc* pDoc = createDoc("tdf116486.docx");
+    CPPUNIT_ASSERT(pDoc);
+    OUString aTop = parseDump("/root/page/body/txt/Special", "nHeight");
+    CPPUNIT_ASSERT_EQUAL(OUString("4006"), aTop);
+}
+
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128198)
+{
+    SwDoc* pDoc = createDoc("tdf128198-1.docx");
+    CPPUNIT_ASSERT(pDoc);
+    xmlDocUniquePtr pLayout = parseLayoutDump();
+    // the problem was that line 5 was truncated at "this  "
+    // due to the fly anchored in previous paragraph
+    assertXPath(pLayout, "/root/page/body/txt[2]/LineBreak[5]", "Line",
+                "to access any service, any time, anywhere. From this  
perspective, satellite "
+                "boasts some ");
+    assertXPath(pLayout, "/root/page/body/txt[2]/LineBreak[6]", "Line", 
"significant advantages. ");
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testNoLineBreakAtSlash)
 {
     load(DATA_DIRECTORY, "no-line-break-at-slash.fodt");
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 78e79add953a..1c3b36535c6e 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -418,12 +418,6 @@ DECLARE_OOXMLIMPORT_TEST(testTdf114217, "tdf114217.docx")
     CPPUNIT_ASSERT_EQUAL(0, getShapes());
 }
 
-DECLARE_OOXMLIMPORT_TEST(testTdf116486, "tdf116486.docx")
-{
-    OUString aTop = parseDump("/root/page/body/txt/Special", "nHeight");
-    CPPUNIT_ASSERT_EQUAL(OUString("4006"), aTop);
-}
-
 DECLARE_OOXMLIMPORT_TEST(testTdf119200, "tdf119200.docx")
 {
     auto xPara = getParagraph(1);
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 61621611fb73..8d0cda953729 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -2357,7 +2357,8 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo 
&rInf )
     // tdf#116486: consider also the upper margin from getFramePrintArea 
because intersections
     //             with this additional space should lead to repositioning of 
paragraphs
     //             For compatibility we grab a related compat flag:
-    if 
(GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS))
+    if 
(GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS)
+        && IsFirstTextLine())
     {
         const long nUpper = m_pFrame->getFramePrintArea().Top();
         // Increase the rectangle
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to