summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Hung <marklm9@gmail.com>2022-08-14 15:23:14 +0800
committerMiklos Vajna <vmiklos@collabora.com>2022-08-15 11:39:09 +0200
commit1bf82b26aea3a403920a64cdfcb4671c947c7a01 (patch)
tree1f6e00eed63fddf396455a24b501876bb9cc7047
parentexternal/lxml: Fix -Wincompatible-function-pointer-types (diff)
downloadcore-1bf82b26aea3a403920a64cdfcb4671c947c7a01.tar.gz
core-1bf82b26aea3a403920a64cdfcb4671c947c7a01.zip
tdf#135991 fix unexpected hidden RTL sections.
SwLayoutFrame::MakeAll tried to manipulate the height instead of the width for SwCellFrame and SwColumnFrame ( i.e. when IsNeghbourFrame() is true. ), by selecting a wrong SwRectFn. SwRectFn fnRect = bVert == IsNeighbourFrame() ? fnRectHori : ( IsVertLR() ? (IsVertLRBT() ? fnRectVertL2RB2T : fnRectVertL2R) : fnRectVert ); It doesn't make sense to select among fnRectVertL2RBT, fnRectVertL2R, and fnRectVert if the layout is horizontal. The frame position got a negative top value and make the frame invisble. Check he following commit for reference: commit c90b6806d18c8ed25015eb2ecdff13c7bab2572d Author: Andreas Martens <ama@openoffice.org> Date: Wed Sep 19 07:45:10 2001 +0000 Chg: Moving vertical help functions from SwFrm to SwRect Change-Id: I2f6da9cdbc2947de95a6fb9ce8fa94a79360c83a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138250 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--sw/qa/extras/layout/data/tdf135991.odtbin0 -> 12299 bytes
-rw-r--r--sw/qa/extras/layout/layout2.cxx8
-rw-r--r--sw/source/core/layout/calcmove.cxx46
3 files changed, 33 insertions, 21 deletions
diff --git a/sw/qa/extras/layout/data/tdf135991.odt b/sw/qa/extras/layout/data/tdf135991.odt
new file mode 100644
index 000000000000..f490ee9fb28c
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf135991.odt
Binary files differ
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index c4d1a976fe7c..09e113fc4ed0 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -2301,6 +2301,14 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf124261)
#endif
}
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf135991)
+{
+ createSwDoc(DATA_DIRECTORY, "tdf135991.odt");
+ auto pDump = parseLayoutDump();
+ // There used to be negative values that made the column frames invisible.
+ assertXPath(pDump, "//bounds[@top<0]", 0);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index 1bc2506a72f4..1869794300f6 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -949,7 +949,7 @@ void SwLayoutFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
const SwLayNotify aNotify( this );
bool bVert = IsVertical();
- SwRectFn fnRect = ( IsNeighbourFrame() == bVert )? fnRectHori : ( IsVertLR() ? (IsVertLRBT() ? fnRectVertL2RB2T : fnRectVertL2R) : fnRectVert );
+ SwRectFn fnRect = bVert ? ( IsVertLR() ? (IsVertLRBT() ? fnRectVertL2RB2T : fnRectVertL2R) : fnRectVert ) : fnRectHori;
std::optional<SwBorderAttrAccess> oAccess;
const SwBorderAttrs*pAttrs = nullptr;
@@ -975,32 +975,36 @@ void SwLayoutFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
{
// Set FixSize; VarSize is set by Format() after calculating the PrtArea
setFramePrintAreaValid(false);
-
- SwTwips nPrtWidth = (GetUpper()->getFramePrintArea().*fnRect->fnGetWidth)();
- if( bVert && ( IsBodyFrame() || IsFootnoteContFrame() ) )
- {
- SwFrame* pNxt = GetPrev();
- while( pNxt && !pNxt->IsHeaderFrame() )
- pNxt = pNxt->GetPrev();
- if( pNxt )
- nPrtWidth -= pNxt->getFrameArea().Height();
- pNxt = GetNext();
- while( pNxt && !pNxt->IsFooterFrame() )
- pNxt = pNxt->GetNext();
- if( pNxt )
- nPrtWidth -= pNxt->getFrameArea().Height();
- }
-
- const tools::Long nDiff = nPrtWidth - (getFrameArea().*fnRect->fnGetWidth)();
SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
- if( IsNeighbourFrame() && IsRightToLeft() )
+ if (IsNeighbourFrame())
{
- (aFrm.*fnRect->fnSubLeft)( nDiff );
+ SwTwips nPrtHeight = (GetUpper()->getFramePrintArea().*fnRect->fnGetHeight)();
+ const tools::Long nDiff = nPrtHeight - (getFrameArea().*fnRect->fnGetHeight)();
+ (aFrm.*fnRect->fnAddBottom)( nDiff );
}
else
{
- (aFrm.*fnRect->fnAddRight)( nDiff );
+ SwTwips nPrtWidth = (GetUpper()->getFramePrintArea().*fnRect->fnGetWidth)();
+ if( bVert && ( IsBodyFrame() || IsFootnoteContFrame() ) )
+ {
+ SwFrame* pNxt = GetPrev();
+ while( pNxt && !pNxt->IsHeaderFrame() )
+ pNxt = pNxt->GetPrev();
+ if( pNxt )
+ nPrtWidth -= pNxt->getFrameArea().Height();
+ pNxt = GetNext();
+ while( pNxt && !pNxt->IsFooterFrame() )
+ pNxt = pNxt->GetNext();
+ if( pNxt )
+ nPrtWidth -= pNxt->getFrameArea().Height();
+ }
+
+ const tools::Long nDiff = nPrtWidth - (getFrameArea().*fnRect->fnGetWidth)();
+ if(IsRightToLeft() )
+ (aFrm.*fnRect->fnSubLeft)( nDiff );
+ else
+ (aFrm.*fnRect->fnAddRight)( nDiff );
}
}
else