tdf#138600 sw: fix too small print area for btlr text in nested table
Regression from commit 435ab51ec8
(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@collabora.com>
This commit is contained in:
BIN
sw/qa/core/layout/data/btlr-nested-cell.odt
Normal file
BIN
sw/qa/core/layout/data/btlr-nested-cell.odt
Normal file
Binary file not shown.
@@ -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/";
|
||||
|
||||
@@ -228,6 +230,30 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextboxModification)
|
||||
CPPUNIT_ASSERT(!pDocShell->IsModified());
|
||||
}
|
||||
|
||||
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: */
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user