[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Wed Dec 16 08:09:27 UTC 2020
sw/qa/core/layout/data/btlr-nested-cell.odt |binary
sw/qa/core/layout/layout.cxx | 28 +++++++++++++++++++++++++++-
sw/source/core/layout/ssfrm.cxx | 3 ++-
3 files changed, 29 insertions(+), 2 deletions(-)
New commits:
commit 20f12960ae546ab90b1e216d5ed3f0dc576f1b48
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Dec 14 21:05:02 2020 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Dec 16 09:08:55 2020 +0100
tdf#138600 sw: fix too small print area for btlr text in nested table
Regression from commit 435ab51ec8920033b7865f27f4afee8a852a0b31
(tdf#128399 sw btlr: fix clicking to lower rotated cell, 2019-10-29),
the bugdoc has a btlr table cell and the row frame of the outer table
has a bottom value which is very small at the point when
SwFrame::GetPaintArea() is invoked for the inner btlr cell.
This means the "cell should not leave its parent" mechanism kicks in and
reduces the bottom of the paint area to a small value, so the text is
not visible at all.
Fix the problem by teaching SwFrame::GetPaintArea() that btlr cell
frames are OK to leave their parent towards the bottom of the page; that
parent will grow at a later phase of the layout process anyway.
Change-Id: I99334bbf0116df8d8ed27f192c81c0441b6c797d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107730
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107787
diff --git a/sw/qa/core/layout/data/btlr-nested-cell.odt b/sw/qa/core/layout/data/btlr-nested-cell.odt
new file mode 100644
index 000000000000..ca7a4798db97
Binary files /dev/null and b/sw/qa/core/layout/data/btlr-nested-cell.odt differ
diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx
index 2151b870da13..76445faa4cfe 100644
--- a/sw/qa/core/layout/layout.cxx
+++ b/sw/qa/core/layout/layout.cxx
@@ -10,6 +10,7 @@
#include <swmodeltestbase.hxx>
#include <vcl/gdimtf.hxx>
+#include <svx/svdpage.hxx>
#include <wrtsh.hxx>
#include <docsh.hxx>
@@ -17,7 +18,8 @@
#include <drawdoc.hxx>
#include <IDocumentDrawModelAccess.hxx>
#include <IDocumentState.hxx>
-#include <svx/svdpage.hxx>
+#include <IDocumentLayoutAccess.hxx>
+#include <rootfrm.hxx>
char const DATA_DIRECTORY[] = "/sw/qa/core/layout/data/";
@@ -216,6 +218,30 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxAutoGrowVertical)
CPPUNIT_ASSERT(aShapeRect.IsInside(aFlyRect));
}
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBtlrNestedCell)
+{
+ // Load a document with a nested table, the inner A1 cell has a btlr text direction.
+ load(DATA_DIRECTORY, "btlr-nested-cell.odt");
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ SwFrame* pPage = pLayout->GetLower();
+ SwFrame* pBody = pPage->GetLower();
+ SwFrame* pOuterTable = pBody->GetLower()->GetNext();
+ SwFrame* pInnerTable = pOuterTable->GetLower()->GetLower()->GetLower();
+
+ // Check the paint area of the only text frame in the cell.
+ SwFrame* pTextFrame = pInnerTable->GetLower()->GetLower()->GetLower();
+ tools::Long nFrameBottom = pTextFrame->getFrameArea().Bottom();
+ SwRect aPaintArea = pTextFrame->GetPaintArea();
+
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected greater or equal than: 2829
+ // - Actual : 2080
+ // i.e. part of the text frame area was not painted, hiding the actual text.
+ CPPUNIT_ASSERT_GREATEREQUAL(nFrameBottom, aPaintArea.Bottom());
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx
index 467a60a9d374..d8404b947c04 100644
--- a/sw/source/core/layout/ssfrm.cxx
+++ b/sw/source/core/layout/ssfrm.cxx
@@ -633,7 +633,8 @@ SwRect SwFrame::GetPaintArea() const
pTmp->IsCellFrame() || pTmp->IsRowFrame() || //nobody leaves a table!
pTmp->IsRootFrame() )
{
- if( bLeft || aRectFnSet.XDiff(nTmpLeft, nLeft) > 0 )
+ // BTLR is OK to expand towards the physical down direction. Physical down is left.
+ if( bLeft || (aRectFnSet.XDiff(nTmpLeft, nLeft) > 0 && !IsVertLRBT()) )
nLeft = nTmpLeft;
if( bRight || aRectFnSet.XDiff(nRight, nTmpRight) > 0 )
nRight = nTmpRight;
More information about the Libreoffice-commits
mailing list