diff options
author | László Németh <nemeth@numbertext.org> | 2020-07-28 11:02:29 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-07-28 17:14:38 +0200 |
commit | 30598199272db107c5dc863707685e4019ad471e (patch) | |
tree | 9b00135cadf4d6acd5e3b1d6ede9f615798459bf | |
parent | 50b36951dbf080509c49bf326131afb8c2390d2d (diff) |
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@numbertext.org>
-rw-r--r-- | sw/qa/extras/layout/data/tdf127118.docx | bin | 0 -> 10819 bytes | |||
-rw-r--r-- | sw/qa/extras/layout/layout.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/layout/findfrm.cxx | 15 |
3 files changed, 21 insertions, 2 deletions
diff --git a/sw/qa/extras/layout/data/tdf127118.docx b/sw/qa/extras/layout/data/tdf127118.docx Binary files differnew file mode 100644 index 000000000000..d26495944d72 --- /dev/null +++ b/sw/qa/extras/layout/data/tdf127118.docx 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 ); |