summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-05-28 09:04:51 +0500
committerMike Kaganski <mike.kaganski@collabora.com>2024-05-29 13:17:30 +0200
commitfc1e6a64bd0517a7e67f08860c29b44d030220eb (patch)
tree4453ad1ec7af2e435a776fdfc009150e27372eda /sw/source
parent981542c1d218ae7ecf30431555560aed152f8ab1 (diff)
tdf#161202: lowers shouldn't move forward because of lack of space
... in hidden section. So make sure to set heights of lowers to zero, too. testOldComplexMergeTableInTable turned out to be a nice test for this. Change-Id: I334aaaf2becf0ac1ff61faed2e5f697f344c78d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168151 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/inc/frame.hxx1
-rw-r--r--sw/source/core/layout/calcmove.cxx6
-rw-r--r--sw/source/core/layout/flowfrm.cxx9
-rw-r--r--sw/source/core/layout/sectfrm.cxx2
-rw-r--r--sw/source/core/layout/tabfrm.cxx13
-rw-r--r--sw/source/core/layout/trvlfrm.cxx16
6 files changed, 46 insertions, 1 deletions
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 4f0df45e2d30..9972248e9744 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -903,6 +903,7 @@ public:
bool IsProtected() const;
virtual bool IsHiddenNow() const;
+ void MakeValidZeroHeight();
bool IsColLocked() const { return mbColLocked; }
virtual bool IsDeleteForbidden() const { return mnForbidDelete > 0; }
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index 6e8112308002..dbd6ffe88b91 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -965,6 +965,9 @@ void SwLayoutFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
const SwLayNotify aNotify( this );
bool bVert = IsVertical();
+ if (IsHiddenNow())
+ MakeValidZeroHeight();
+
SwRectFn fnRect = ( IsNeighbourFrame() == bVert )? fnRectHori : ( IsVertLR() ? (IsVertLRBT() ? fnRectVertL2RB2T : fnRectVertL2R) : fnRectVert );
std::optional<SwBorderAttrAccess> oAccess;
@@ -1281,6 +1284,9 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
return;
}
+ if (IsHiddenNow())
+ MakeValidZeroHeight();
+
std::optional<SwFrameDeleteGuard> oDeleteGuard(std::in_place, this);
LockJoin();
tools::Long nFormatCount = 0;
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 1cb5cf7bf47a..66ec8ea9e7c2 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1498,6 +1498,9 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs,
const SwFrame* pPr,
const bool _bConsiderGrid ) const
{
+ if (m_rThis.IsHiddenNow())
+ return 0;
+
const SwFrame* pPrevFrame = GetPrevFrameForUpperSpaceCalc_( pPr );
std::optional<SwBorderAttrAccess> oAccess;
@@ -1803,6 +1806,9 @@ SwTwips SwFlowFrame::GetUpperSpaceAmountConsideredForPrevFrameAndPageGrid() cons
SwTwips SwFlowFrame::CalcLowerSpace( const SwBorderAttrs* _pAttrs ) const
{
+ if (m_rThis.IsHiddenNow())
+ return 0;
+
SwTwips nLowerSpace = 0;
std::optional<SwBorderAttrAccess> oAttrAccess;
@@ -1853,6 +1859,9 @@ SwTwips SwFlowFrame::CalcLowerSpace( const SwBorderAttrs* _pAttrs ) const
SwTwips SwFlowFrame::CalcAddLowerSpaceAsLastInTableCell(
const SwBorderAttrs* _pAttrs ) const
{
+ if (m_rThis.IsHiddenNow())
+ return 0;
+
SwTwips nAdditionalLowerSpace = 0;
IDocumentSettingAccess const& rIDSA(m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess());
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 78278da9cb38..23b427c1507b 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -1211,7 +1211,7 @@ void SwSectionFrame::SimpleFormat()
SwTwips nDeadLine = aRectFnSet.GetPrtBottom(*GetUpper());
// OD 22.10.2002 #97265# - call always method <lcl_ColumnRefresh(..)>, in
// order to get calculated lowers, not only if there space left in its upper.
- if( aRectFnSet.BottomDist( getFrameArea(), nDeadLine ) >= 0 )
+ if (aRectFnSet.BottomDist(getFrameArea(), nDeadLine) >= 0)
{
{
SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 8cd16b8d80ce..21012d31a28e 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -2251,6 +2251,9 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
}
}
+ if (IsHiddenNow())
+ MakeValidZeroHeight();
+
int nUnSplitted = 5; // Just another loop control :-(
int nThrowAwayValidLayoutLimit = 5; // And another one :-(
SwRectFnSet aRectFnSet(this);
@@ -3197,6 +3200,16 @@ bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper,
tools::Long& rRightOffset,
SwTwips *const pSpaceBelowBottom) const
{
+ if (IsHiddenNow())
+ {
+ rUpper = 0;
+ rLeftOffset = 0;
+ rRightOffset = 0;
+ if (pSpaceBelowBottom)
+ *pSpaceBelowBottom = 0;
+ return false;
+ }
+
bool bInvalidatePrtArea = false;
const SwPageFrame *pPage = FindPageFrame();
const SwFlyFrame* pMyFly = FindFlyFrame();
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index fdbf55110ccd..00144c36e6d5 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -1730,6 +1730,22 @@ bool SwFrame::IsHiddenNow() const
return false;
}
+void SwFrame::MakeValidZeroHeight()
+{
+ SwRectFnSet aRectFnSet(this);
+ {
+ SwFrameAreaDefinition::FrameAreaWriteAccess area(*this);
+ aRectFnSet.SetHeight(area, 0);
+ }
+ {
+ SwFrameAreaDefinition::FramePrintAreaWriteAccess area(*this);
+ aRectFnSet.SetHeight(area, 0);
+ }
+ setFrameAreaSizeValid(true);
+ setFramePrintAreaValid(true);
+ setFrameAreaPositionValid(false);
+}
+
/** @return the physical page number */
sal_uInt16 SwFrame::GetPhyPageNum() const
{