[Libreoffice-commits] core.git: Branch 'distro/escriba/escriba-5.4' - sw/qa sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Oct 10 13:25:15 UTC 2018


 sw/qa/extras/layout/data/tdf106390.odt |binary
 sw/qa/extras/layout/layout.cxx         |   20 ++++++++++++++++++++
 sw/source/core/layout/paintfrm.cxx     |   14 ++++++++++----
 3 files changed, 30 insertions(+), 4 deletions(-)

New commits:
commit fb579228e72e8cb28128529941c00a5355a76c67
Author:     Mark Hung <marklh9 at gmail.com>
AuthorDate: Wed May 23 11:25:05 2018 +0800
Commit:     Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Wed Oct 10 15:24:38 2018 +0200

    tdf#106390 Intersect the table borders with upper frames.
    
    Also removes dead code because SwTabFramePainter::Insert()
    is always called with a cell frame and IsTabFrame() always
    returns false.
    
    Reviewed-on: https://gerrit.libreoffice.org/54684
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit e87cc12eaf53efa9b221eae7167ea15bc7896752)
    
    Conflicts:
            sw/qa/extras/layout/layout.cxx
            sw/source/core/layout/paintfrm.cxx
    
    Change-Id: I2505d876d20e44ded1faf760bc3b7b1d34b0fd8d

diff --git a/sw/qa/extras/layout/data/tdf106390.odt b/sw/qa/extras/layout/data/tdf106390.odt
new file mode 100755
index 000000000000..b2adf5332e34
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf106390.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 7167647ac93b..21db5db2a4f0 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -22,12 +22,14 @@ public:
     void testTdf116925();
     void testTdf117028();
     void testUserFieldTypeLanguage();
+    void testTdf106390();
 
     CPPUNIT_TEST_SUITE(SwLayoutWriter);
     CPPUNIT_TEST(testTdf116830);
     CPPUNIT_TEST(testTdf116925);
     CPPUNIT_TEST(testTdf117028);
     CPPUNIT_TEST(testUserFieldTypeLanguage);
+    CPPUNIT_TEST(testTdf106390);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -132,6 +134,24 @@ void SwLayoutWriter::testUserFieldTypeLanguage()
     assertXPath(pXmlDoc, "/root/page/body/txt/Special[@nType='POR_FLD']", "rText", "1,234.56");
 }
 
+void SwLayoutWriter::testTdf106390()
+{
+    SwDoc* pDoc = createDoc("tdf106390.odt");
+    SwDocShell* pShell = pDoc->GetDocShell();
+
+    // Dump the rendering of the first page as an XML file.
+    std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+    MetafileXmlDump dumper;
+    xmlDocPtr pXmlDoc = dumper.dumpAndParse(*xMetaFile);
+    CPPUNIT_ASSERT(pXmlDoc);
+    sal_Int32 nBottom = getXPath(pXmlDoc, "//sectrectclipregion", "bottom").toInt32();
+
+    // No end point of line segments shall go below the bottom of the clipping area.
+    const OString sXPath = "//polyline/point[@y>" + OString::number(nBottom) + "]";
+
+    assertXPath(pXmlDoc, sXPath, 0);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index e13f67d32fc3..cf71740d93ff 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2964,10 +2964,16 @@ void SwTabFramePainter::Insert( const SwFrame& rFrame, const SvxBoxItem& rBoxIte
 {
     // build 4 line entries for the 4 borders:
     SwRect aBorderRect = rFrame.Frame();
-    if ( rFrame.IsTabFrame() )
-    {
-        aBorderRect = rFrame.Prt();
-        aBorderRect.Pos() += rFrame.Frame().Pos();
+    // Frame area of a table might be larger than the containing frame
+    // so we have to intersect the border rect with upper frames til
+    // the first frame that is not part of a table.
+    const SwLayoutFrame *pUpper = rFrame.GetUpper();
+    while(pUpper)
+    {
+        aBorderRect.Intersection(pUpper->Frame());
+        if (!pUpper->IsInTab())
+            break;
+        pUpper = pUpper->GetUpper();
     }
 
     bool const bBottomAsTop(lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines(


More information about the Libreoffice-commits mailing list