summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-08-24 13:04:47 +0500
committerMike Kaganski <mike.kaganski@collabora.com>2024-08-24 12:12:14 +0200
commitc2337ff12896b2ae09437d2cbc726971c9fb170f (patch)
tree9602e651047a79f3d40758521e35da7210ab8e2d
parent3caa0db8cfcf2ed2469e7a4cecba8a57d142dc04 (diff)
Simplify a bit
Change-Id: Ia18d2d28d1026e3a695374dd523fb23ee97b96b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172344 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--sw/source/core/layout/tabfrm.cxx9
-rw-r--r--sw/source/core/layout/wsfrm.cxx19
2 files changed, 9 insertions, 19 deletions
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index a7286a4860b9..ee3cb240c590 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3776,16 +3776,13 @@ SwTwips SwTabFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
//The upper only grows as far as needed. nReal provides the distance
//which is already available.
SwTwips nReal = aRectFnSet.GetHeight(GetUpper()->getFramePrintArea());
- SwFrame *pFrame = GetUpper()->Lower();
- while ( pFrame && GetFollow() != pFrame )
- {
+ for (SwFrame* pFrame = GetUpper()->Lower(); pFrame && GetFollow() != pFrame;
+ pFrame = pFrame->GetNext())
nReal -= aRectFnSet.GetHeight(pFrame->getFrameArea());
- pFrame = pFrame->GetNext();
- }
if ( nReal < nDist )
{
- tools::Long nTmp = GetUpper()->Grow( nDist - std::max<tools::Long>(nReal, 0), bTst, bInfo );
+ tools::Long nTmp = GetUpper()->Grow(nDist - std::max(nReal, SwTwips(0)), bTst, bInfo);
if ( IsRestrictTableGrowth() )
{
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index ce8be2555649..b776eedea063 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -2183,11 +2183,8 @@ SwTwips SwContentFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
}
SwTwips nReal = aRectFnSet.GetHeight(GetUpper()->getFramePrintArea());
- SwFrame *pFrame = GetUpper()->Lower();
- while( pFrame && nReal > 0 )
- { nReal -= aRectFnSet.GetHeight(pFrame->getFrameArea());
- pFrame = pFrame->GetNext();
- }
+ for (SwFrame* pFrame = GetUpper()->Lower(); pFrame && nReal > 0; pFrame = pFrame->GetNext())
+ nReal -= aRectFnSet.GetHeight(pFrame->getFrameArea());
if ( !bTst )
{
@@ -2224,8 +2221,7 @@ SwTwips SwContentFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
if( GetUpper() )
{
if( bTst || !GetUpper()->IsFooterFrame() )
- nReal = GetUpper()->Grow( nDist - std::max<tools::Long>(nReal, 0),
- bTst, bInfo );
+ nReal = GetUpper()->Grow(nDist - std::max(nReal, SwTwips(0)), bTst, bInfo);
else
{
nReal = 0;
@@ -2688,11 +2684,8 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
SwTwips nMin = 0;
if ( GetUpper() && !IsCellFrame() )
{
- SwFrame *pFrame = GetUpper()->Lower();
- while( pFrame )
- { nMin += aRectFnSet.GetHeight(pFrame->getFrameArea());
- pFrame = pFrame->GetNext();
- }
+ for (SwFrame* pFrame = GetUpper()->Lower(); pFrame; pFrame = pFrame->GetNext())
+ nMin += aRectFnSet.GetHeight(pFrame->getFrameArea());
nMin = aRectFnSet.GetHeight(GetUpper()->getFramePrintArea()) - nMin;
if ( nMin < 0 )
nMin = 0;
@@ -2731,7 +2724,7 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
nReal += AdjustNeighbourhood( nReal, bTst );
SwTwips nGrow = 0;
- if( 0 < nReal )
+ if( nReal > 0 )
{
SwFrame* pToGrow = GetUpper();
// NEW TABLES