[Libreoffice-commits] core.git: sw/qa sw/source

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 28 15:15:20 UTC 2020


 sw/qa/extras/layout/data/tdf127118.docx |binary
 sw/qa/extras/layout/layout.cxx          |    8 ++++++++
 sw/source/core/layout/findfrm.cxx       |   15 +++++++++++++--
 3 files changed, 21 insertions(+), 2 deletions(-)

New commits:
commit 30598199272db107c5dc863707685e4019ad471e
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Tue Jul 28 11:02:29 2020 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Tue Jul 28 17:14:38 2020 +0200

    tdf#127118 sw layout: fix vertical mode in split cell
    
    Merged cells split between pages could lose
    vertical direction.
    
    Change-Id: I1bbf4becd11a72022f80c394b3da6483fe0d7e6d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99583
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/qa/extras/layout/data/tdf127118.docx b/sw/qa/extras/layout/data/tdf127118.docx
new file mode 100644
index 000000000000..d26495944d72
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf127118.docx differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index d6249e412b44..6d719976579c 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -3175,6 +3175,14 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf127606)
     assertXPath(pXmlDoc, "/root/page/body/tab/row/cell/txt[3]/Special", "nHeight", "260");
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf127118)
+{
+    createDoc("tdf127118.docx");
+    xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+    // This was Horizontal: merged cell split between pages didn't keep vertical writing direction
+    assertXPath(pXmlDoc, "/root/page[2]/body/tab/row[1]/cell[1]/txt[1]", "WritingMode", "VertBTLR");
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf134685)
 {
     createDoc("tdf134685.docx");
diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index a2d6508e459c..b3d8c4dfc494 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -1482,6 +1482,17 @@ void SwFrame::SetDirFlags( bool bVert )
 
                 if ( !pAsk->mbInvalidVert )
                     mbInvalidVert = false;
+
+                if ( IsCellFrame() )
+                {
+                    SwCellFrame* pPrv = static_cast<SwCellFrame*>(this)->GetPreviousCell();
+                    if ( pPrv && !mbVertical && pPrv->IsVertical() )
+                    {
+                        mbVertical = pPrv->IsVertical();
+                        mbVertLR  = pPrv->IsVertLR();
+                        mbVertLRBT = pPrv->IsVertLRBT();
+                    }
+                }
             }
         }
         else
@@ -1637,14 +1648,14 @@ SwCellFrame* SwCellFrame::GetPreviousCell() const
 
     // find most upper row frame
     const SwFrame* pRow = GetUpper();
-    while( !pRow->IsRowFrame() || !pRow->GetUpper()->IsTabFrame() )
+    while( !pRow->IsRowFrame() || (pRow->GetUpper() && !pRow->GetUpper()->IsTabFrame()) )
         pRow = pRow->GetUpper();
 
     OSL_ENSURE( pRow->GetUpper() && pRow->GetUpper()->IsTabFrame(), "GetPreviousCell without Table" );
 
     const SwTabFrame* pTab = static_cast<const SwTabFrame*>(pRow->GetUpper());
 
-    if ( pTab->IsFollow() )
+    if ( pTab && pTab->IsFollow() )
     {
         const SwFrame* pTmp = pTab->GetFirstNonHeadlineRow();
         const bool bIsInFirstLine = ( pTmp == pRow );


More information about the Libreoffice-commits mailing list