diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2017-10-26 09:15:25 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2017-10-30 12:13:14 +0100 |
commit | 46d233c026fd104f449bb99c1c6f80de34c9a4c6 (patch) | |
tree | 10a684ac6b5646c8077b5aca33c2c395c20f4d92 /sw/source | |
parent | 94cf44656492e408ef6c7f6e18deffe519f22018 (diff) |
Migrated from SwFrame::FrameWA to setFrame
Change-Id: I01f7b828fe2134411cc76639e880da46b415d767
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/doc/notxtfrm.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/frmedt/feshview.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/inc/frame.hxx | 6 | ||||
-rw-r--r-- | sw/source/core/layout/calcmove.cxx | 193 | ||||
-rw-r--r-- | sw/source/core/layout/fly.cxx | 64 | ||||
-rw-r--r-- | sw/source/core/layout/flyincnt.cxx | 11 | ||||
-rw-r--r-- | sw/source/core/layout/flylay.cxx | 29 | ||||
-rw-r--r-- | sw/source/core/layout/frmtool.cxx | 14 | ||||
-rw-r--r-- | sw/source/core/layout/ftnfrm.cxx | 56 | ||||
-rw-r--r-- | sw/source/core/layout/hffrm.cxx | 9 | ||||
-rw-r--r-- | sw/source/core/layout/laycache.cxx | 38 | ||||
-rw-r--r-- | sw/source/core/layout/pagechg.cxx | 91 | ||||
-rw-r--r-- | sw/source/core/layout/sectfrm.cxx | 64 | ||||
-rw-r--r-- | sw/source/core/layout/ssfrm.cxx | 92 | ||||
-rw-r--r-- | sw/source/core/layout/tabfrm.cxx | 100 | ||||
-rw-r--r-- | sw/source/core/layout/wsfrm.cxx | 216 | ||||
-rw-r--r-- | sw/source/core/text/frmform.cxx | 32 | ||||
-rw-r--r-- | sw/source/core/text/txtfrm.cxx | 93 |
18 files changed, 848 insertions, 274 deletions
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index e6fa91367bb0..3a12e77a99a2 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -479,7 +479,11 @@ void SwNoTextFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) MakePos(); if ( !mbValidSize ) - FrameWA().Width( GetUpper()->PrintRA().Width() ); + { + SwRect aFrm(FrameRA()); + aFrm.Width( GetUpper()->PrintRA().Width() ); + setFrame(aFrm); + } MakePrtArea( rAttrs ); diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 721e368e2a73..40e56fd365fa 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -836,7 +836,9 @@ static void lcl_NotifyNeighbours( const SdrMarkList *pLst ) { bCheckNeighbours = true; pFly->InvalidatePos(); - pFly->FrameWA().Pos().Y() += 1; + SwRect aFrm(pFly->FrameRA()); + aFrm.Pos().Y() += 1; + pFly->setFrame(aFrm); } pPage = pFly->FindPageFrame(); @@ -882,7 +884,9 @@ static void lcl_NotifyNeighbours( const SdrMarkList *pLst ) pAct->FrameRA().Bottom() >= aRect.Top() ) { pAct->InvalidatePos(); - pAct->FrameWA().Pos().Y() += 1; + SwRect aFrm(pAct->FrameRA()); + aFrm.Pos().Y() += 1; + pAct->setFrame(aFrm); } } } diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx index db610c0079f7..e753c9267999 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -132,8 +132,12 @@ public: const SwRect& FrameRA() const { return maFrameRect; } const SwRect& PrintRA() const { return maPrintRect; } + // set methods + void setFrame(const SwRect& rNew) { maFrameRect = rNew; } + void setPrint(const SwRect& rNew) { maPrintRect = rNew; } + // write accesses - SwRect& FrameWA() { return maFrameRect; } +// SwRect& FrameWA() { return maFrameRect; } SwRect& PrintWA() { return maPrintRect; } }; diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index d5983173059c..8b90c935bc45 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -500,35 +500,52 @@ void SwFrame::MakePos() SwRectFnSet aRectFnSet((IsCellFrame() && GetUpper() ? GetUpper() : this)); if ( !bUseUpper && pPrv ) { - FrameWA().Pos( pPrv->FrameRA().Pos() ); + SwRect aFrm(FrameRA()); + aFrm.Pos( pPrv->FrameRA().Pos() ); + if( FRM_NEIGHBOUR & nMyType ) { - bool bR2L = IsRightToLeft(); + const bool bR2L = IsRightToLeft(); + if( bR2L ) - aRectFnSet.SetPosX( FrameWA(), aRectFnSet.GetLeft(FrameRA()) - - aRectFnSet.GetWidth(FrameRA()) ); + { + aRectFnSet.SetPosX( aFrm, aRectFnSet.GetLeft(aFrm) - aRectFnSet.GetWidth(aFrm) ); + } else - aRectFnSet.SetPosX( FrameWA(), aRectFnSet.GetLeft(FrameRA()) + - aRectFnSet.GetWidth(pPrv->FrameRA()) ); + { + aRectFnSet.SetPosX( aFrm, aRectFnSet.GetLeft(aFrm) + aRectFnSet.GetWidth(pPrv->FrameRA()) ); + } // cells may now leave their uppers if( aRectFnSet.IsVert() && SwFrameType::Cell & nMyType && !mbReverse ) - FrameWA().Pos().setX(FrameRA().Pos().getX() - FrameRA().Width() + pPrv->FrameRA().Width()); + { + aFrm.Pos().setX(aFrm.Pos().getX() - aFrm.Width() + pPrv->FrameRA().Width()); + } } else if( aRectFnSet.IsVert() && FRM_NOTE_VERT & nMyType ) { if( mbReverse ) - FrameWA().Pos().setX(FrameRA().Pos().getX() + pPrv->FrameRA().Width()); + { + aFrm.Pos().setX(aFrm.Pos().getX() + pPrv->FrameRA().Width()); + } else { if ( aRectFnSet.IsVertL2R() ) - FrameWA().Pos().setX(FrameRA().Pos().getX() + pPrv->FrameRA().Width()); + { + aFrm.Pos().setX(aFrm.Pos().getX() + pPrv->FrameRA().Width()); + } else - FrameWA().Pos().setX(FrameRA().Pos().getX() - FrameRA().Width()); - } + { + aFrm.Pos().setX(aFrm.Pos().getX() - aFrm.Width()); + } + } } else - FrameWA().Pos().setY(FrameRA().Pos().getY() + pPrv->FrameRA().Height()); + { + aFrm.Pos().setY(aFrm.Pos().getY() + pPrv->FrameRA().Height()); + } + + setFrame(aFrm); } else if ( GetUpper() ) { @@ -554,60 +571,93 @@ void SwFrame::MakePos() pPrv = lcl_Prev( this, false ); if ( !bUseUpper && pPrv ) { - FrameWA().Pos( pPrv->FrameRA().Pos() ); + SwRect aFrm(FrameRA()); + aFrm.Pos( pPrv->FrameRA().Pos() ); + if( FRM_NEIGHBOUR & nMyType ) { - bool bR2L = IsRightToLeft(); + const bool bR2L = IsRightToLeft(); + if( bR2L ) - aRectFnSet.SetPosX( FrameWA(), aRectFnSet.GetLeft(FrameRA()) - - aRectFnSet.GetWidth(FrameRA()) ); + { + aRectFnSet.SetPosX( aFrm, aRectFnSet.GetLeft(aFrm) - aRectFnSet.GetWidth(aFrm) ); + } else - aRectFnSet.SetPosX( FrameWA(), aRectFnSet.GetLeft(FrameRA()) + - aRectFnSet.GetWidth(pPrv->FrameRA()) ); + { + aRectFnSet.SetPosX( aFrm, aRectFnSet.GetLeft(aFrm) + aRectFnSet.GetWidth(pPrv->FrameRA()) ); + } // cells may now leave their uppers if( aRectFnSet.IsVert() && SwFrameType::Cell & nMyType && !mbReverse ) - FrameWA().Pos().setX(FrameRA().Pos().getX() - FrameRA().Width() + pPrv->FrameRA().Width()); + { + aFrm.Pos().setX(aFrm.Pos().getX() - aFrm.Width() + pPrv->FrameRA().Width()); + } } else if( aRectFnSet.IsVert() && FRM_NOTE_VERT & nMyType ) { if( mbReverse ) - FrameWA().Pos().setX(FrameRA().Pos().getX() + pPrv->FrameRA().Width()); + { + aFrm.Pos().setX(aFrm.Pos().getX() + pPrv->FrameRA().Width()); + } else - FrameWA().Pos().setX(FrameRA().Pos().getX() - FrameRA().Width()); + { + aFrm.Pos().setX(aFrm.Pos().getX() - aFrm.Width()); + } } else - FrameWA().Pos().setY(FrameRA().Pos().getY() + pPrv->FrameRA().Height()); + { + aFrm.Pos().setY(aFrm.Pos().getY() + pPrv->FrameRA().Height()); + } + + setFrame(aFrm); } else { - FrameWA().Pos( GetUpper()->FrameRA().Pos() ); + SwRect aFrm(FrameRA()); + aFrm.Pos( GetUpper()->FrameRA().Pos() ); + if( GetUpper()->IsFlyFrame() ) - FrameWA().Pos() += static_cast<SwFlyFrame*>(GetUpper())->ContentPos(); + { + aFrm.Pos() += static_cast<SwFlyFrame*>(GetUpper())->ContentPos(); + } else - FrameWA().Pos() += GetUpper()->PrintRA().Pos(); + { + aFrm.Pos() += GetUpper()->PrintRA().Pos(); + } if( FRM_NEIGHBOUR & nMyType && IsRightToLeft() ) { if( aRectFnSet.IsVert() ) - FrameWA().Pos().setY(FrameRA().Pos().getY() + GetUpper()->PrintRA().Height() - - FrameRA().Height()); + { + aFrm.Pos().setY(aFrm.Pos().getY() + GetUpper()->PrintRA().Height() - aFrm.Height()); + } else - FrameWA().Pos().setX(FrameRA().Pos().getX() + GetUpper()->PrintRA().Width() - - FrameRA().Width()); + { + aFrm.Pos().setX(aFrm.Pos().getX() + GetUpper()->PrintRA().Width() - aFrm.Width()); + } } else if( aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() && FRM_NOTE_VERT & nMyType && !mbReverse ) - FrameWA().Pos().setX(FrameRA().Pos().getX() - FrameRA().Width() + GetUpper()->PrintRA().Width()); + { + aFrm.Pos().setX(aFrm.Pos().getX() - aFrm.Width() + GetUpper()->PrintRA().Width()); + } + + setFrame(aFrm); } } else { - FrameWA().Pos().setX(0); - FrameWA().Pos().setY(0); + SwRect aFrm(FrameRA()); + aFrm.Pos().setX(0); + aFrm.Pos().setY(0); + setFrame(aFrm); } if( IsBodyFrame() && aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() && !mbReverse && GetUpper() ) - FrameWA().Pos().setX(FrameRA().Pos().getX() + GetUpper()->PrintRA().Width() - FrameRA().Width()); + { + SwRect aFrm(FrameRA()); + aFrm.Pos().setX(aFrm.Pos().getX() + GetUpper()->PrintRA().Width() - aFrm.Width()); + setFrame(aFrm); + } mbValidPos = true; } } @@ -730,9 +780,15 @@ void SwPageFrame::MakeAll(vcl::RenderContext* pRenderContext) { if ( IsEmptyPage() ) { - FrameWA().Width( 0 ); PrintWA().Width( 0 ); - FrameWA().Height( 0 ); PrintWA().Height( 0 ); - PrintWA().Left( 0 ); PrintWA().Top( 0 ); + SwRect aFrm(FrameRA()); + aFrm.Width( 0 ); + aFrm.Width( 0 ); + setFrame(aFrm); + + PrintWA().Height( 0 ); + PrintWA().Height( 0 ); + PrintWA().Left( 0 ); + PrintWA().Top( 0 ); mbValidSize = mbValidPrtArea = true; } else @@ -758,15 +814,16 @@ void SwPageFrame::MakeAll(vcl::RenderContext* pRenderContext) if (nWidth < nDefWidth) nWidth = nDefWidth; nWidth += + 2 * aBorder.Width(); - nWidth = std::max( nWidth, 2L * aBorder.Width() + 4*MM50 ); - FrameWA().Width( nWidth ); + + SwRect aFrm(FrameRA()); + aFrm.Width( nWidth ); SwLayoutFrame *pBody = FindBodyCont(); if ( pBody && pBody->Lower() && pBody->Lower()->IsColumnFrame() ) { // Columns have a fixed height - FrameWA().Height( pAttrs->GetSize().Height() ); + aFrm.Height( pAttrs->GetSize().Height() ); } else { @@ -782,13 +839,15 @@ void SwPageFrame::MakeAll(vcl::RenderContext* pRenderContext) } // #i35143# - Assure, that the page // doesn't exceed the defined browse height. - FrameWA().Height( std::min( nBot, BROWSE_HEIGHT ) ); + aFrm.Height( std::min( nBot, BROWSE_HEIGHT ) ); } + setFrame(aFrm); + PrintWA().Left ( pAttrs->CalcLeftLine() + aBorder.Width() ); PrintWA().Top ( nTop ); - PrintWA().Width( FrameRA().Width() - ( PrintRA().Left() - + pAttrs->CalcRightLine() + aBorder.Width() ) ); + PrintWA().Width( FrameRA().Width() - ( PrintRA().Left() + pAttrs->CalcRightLine() + aBorder.Width() ) ); PrintWA().Height( FrameRA().Height() - (nTop + nBottom) ); + mbValidSize = mbValidPrtArea = true; continue; } @@ -825,7 +884,11 @@ void SwPageFrame::MakeAll(vcl::RenderContext* pRenderContext) // Set FixSize. For pages, this is not done from Upper, but from // the attribute. //FIXME: This resets the size when (mbValidSize && !mbValidPrtArea). - FrameWA().SSize( pAttrs->GetSize() ); + { + SwRect aFrm(FrameRA()); + aFrm.SSize( pAttrs->GetSize() ); + setFrame(aFrm); + } Format( pRenderContext, pAttrs ); } } @@ -887,11 +950,18 @@ void SwLayoutFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) } const long nDiff = nPrtWidth - (FrameRA().*fnRect->fnGetWidth)(); + SwRect aFrm(FrameRA()); if( IsNeighbourFrame() && IsRightToLeft() ) - (FrameWA().*fnRect->fnSubLeft)( nDiff ); + { + (aFrm.*fnRect->fnSubLeft)( nDiff ); + } else - (FrameWA().*fnRect->fnAddRight)( nDiff ); + { + (aFrm.*fnRect->fnAddRight)( nDiff ); + } + + setFrame(aFrm); } else { @@ -1295,7 +1365,9 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) mbValidPrtArea = false; } - aRectFnSet.SetWidth( FrameWA(), nNewFrameWidth ); + SwRect aFrm(FrameRA()); + aRectFnSet.SetWidth( aFrm, nNewFrameWidth ); + setFrame(aFrm); // When a lower of a vertically aligned fly frame changes its size we need to recalculate content pos. if( GetUpper() && GetUpper()->IsFlyFrame() && @@ -1422,7 +1494,10 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) Prepare( PREP_POS_CHGD, static_cast<const void*>(&bFormatted), false ); if ( !mbValidSize ) { - aRectFnSet.SetWidth( FrameWA(), aRectFnSet.GetWidth(GetUpper()->PrintRA()) ); + SwRect aFrm(FrameRA()); + aRectFnSet.SetWidth( aFrm, aRectFnSet.GetWidth(GetUpper()->PrintRA()) ); + setFrame(aFrm); + if ( !mbValidPrtArea ) { const long nOldW = aRectFnSet.GetWidth(PrintRA()); @@ -1780,10 +1855,18 @@ void MakeNxt( SwFrame *pFrame, SwFrame *pNxt ) const SwBorderAttrs &rAttrs = *aAccess.Get(); if ( !pNxt->GetValidSizeFlag() ) { + SwRect aFrm(pNxt->FrameRA()); + if( pNxt->IsVertical() ) - pNxt->FrameWA().Height( pNxt->GetUpper()->PrintRA().Height() ); + { + aFrm.Height( pNxt->GetUpper()->PrintRA().Height() ); + } else - pNxt->FrameWA().Width( pNxt->GetUpper()->PrintRA().Width() ); + { + aFrm.Width( pNxt->GetUpper()->PrintRA().Width() ); + } + + pNxt->setFrame(aFrm); } static_cast<SwContentFrame*>(pNxt)->MakePrtArea( rAttrs ); pNxt->Format( pNxt->getRootFrame()->GetCurrShell()->GetOut(), &rAttrs ); @@ -1795,10 +1878,18 @@ void MakeNxt( SwFrame *pFrame, SwFrame *pNxt ) const SwBorderAttrs &rAttrs = *aAccess.Get(); if ( !pNxt->GetValidSizeFlag() ) { + SwRect aFrm(pNxt->FrameRA()); + if( pNxt->IsVertical() ) - pNxt->FrameWA().Height( pNxt->GetUpper()->PrintRA().Height() ); + { + aFrm.Height( pNxt->GetUpper()->PrintRA().Height() ); + } else - pNxt->FrameWA().Width( pNxt->GetUpper()->PrintRA().Width() ); + { + aFrm.Width( pNxt->GetUpper()->PrintRA().Width() ); + } + + pNxt->setFrame(aFrm); } pNxt->Format( pNxt->getRootFrame()->GetCurrShell()->GetOut(), &rAttrs ); } diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 08b361376f7e..cf4afef72fac 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -129,8 +129,10 @@ SwFlyFrame::SwFlyFrame( SwFlyFrameFormat *pFormat, SwFrame* pSib, SwFrame *pAnch mbRightToLeft = false; } - FrameWA().Width( rFrameSize.GetWidth() ); - FrameWA().Height( rFrameSize.GetHeightSizeType() == ATT_VAR_SIZE ? MINFLY : rFrameSize.GetHeight() ); + SwRect aFrm(FrameRA()); + aFrm.Width( rFrameSize.GetWidth() ); + aFrm.Height( rFrameSize.GetHeightSizeType() == ATT_VAR_SIZE ? MINFLY : rFrameSize.GetHeight() ); + setFrame(aFrm); // Fixed or variable Height? if ( rFrameSize.GetHeightSizeType() == ATT_MIN_SIZE ) @@ -151,8 +153,9 @@ SwFlyFrame::SwFlyFrame( SwFlyFrameFormat *pFormat, SwFrame* pSib, SwFrame *pAnch InsertCnt(); // Put it somewhere outside so that out document is not formatted unnecessarily often - FrameWA().Pos().setX(FAR_AWAY); - FrameWA().Pos().setY(FAR_AWAY); + aFrm.Pos().setX(FAR_AWAY); + aFrm.Pos().setY(FAR_AWAY); + setFrame(aFrm); } void SwFlyFrame::Chain( SwFrame* _pAnch ) @@ -551,8 +554,11 @@ bool SwFlyFrame::FrameSizeChg( const SwFormatFrameSize &rFrameSize ) const SwRect aOld( GetObjRectWithSpaces() ); const Size aOldSz( PrintRA().SSize() ); const SwTwips nDiffWidth = FrameRA().Width() - rFrameSize.GetWidth(); - FrameWA().Height( FrameRA().Height() - nDiffHeight ); - FrameWA().Width ( FrameRA().Width() - nDiffWidth ); + SwRect aFrm(FrameRA()); + aFrm.Height( aFrm.Height() - nDiffHeight ); + aFrm.Width ( aFrm.Width() - nDiffWidth ); + setFrame(aFrm); + // #i68520# InvalidateObjRectWithSpaces(); PrintWA().Height( PrintRA().Height() - nDiffHeight ); @@ -1153,8 +1159,11 @@ void SwFlyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA if ( FrameRA().Top() == FAR_AWAY && FrameRA().Left() == FAR_AWAY ) { // Remove safety switch (see SwFrame::CTor) - FrameWA().Pos().setX(0); - FrameWA().Pos().setY(0); + SwRect aFrm(FrameRA()); + aFrm.Pos().setX(0); + aFrm.Pos().setY(0); + setFrame(aFrm); + // #i68520# InvalidateObjRectWithSpaces(); } @@ -1195,7 +1204,11 @@ void SwFlyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA aRectFnSet.SetHeight( PrintWA(), nRemaining ); nRemaining -= aRectFnSet.GetHeight(FrameRA()); - aRectFnSet.AddBottom( FrameWA(), nRemaining + nUL ); + + SwRect aFrm(FrameRA()); + aRectFnSet.AddBottom( aFrm, nRemaining + nUL ); + setFrame(aFrm); + // #i68520# if ( nRemaining + nUL != 0 ) { @@ -1227,7 +1240,11 @@ void SwFlyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA nNewSize = MINFLY; aRectFnSet.SetHeight( PrintWA(), nNewSize ); nNewSize += nUL - aRectFnSet.GetHeight(FrameRA()); - aRectFnSet.AddBottom( FrameWA(), nNewSize ); + + SwRect aFrm(FrameRA()); + aRectFnSet.AddBottom( aFrm, nNewSize ); + setFrame(aFrm); + // #i68520# if ( nNewSize != 0 ) { @@ -1259,7 +1276,11 @@ void SwFlyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA nNewSize = MINFLY; aRectFnSet.SetWidth( PrintWA(), nNewSize ); nNewSize += nLR - aRectFnSet.GetWidth(FrameRA()); - aRectFnSet.AddRight( FrameWA(), nNewSize ); + + SwRect aFrm(FrameRA()); + aRectFnSet.AddRight( aFrm, nNewSize ); + setFrame(aFrm); + // #i68520# if ( nNewSize != 0 ) { @@ -1605,8 +1626,11 @@ void SwFlyFrame::MakeObjPos() SetCurrRelPos( aObjPositioning.GetRelPos() ); SwRectFnSet aRectFnSet(GetAnchorFrame()); - FrameWA().Pos( aObjPositioning.GetRelPos() ); - FrameWA().Pos() += aRectFnSet.GetPos(GetAnchorFrame()->FrameRA()); + SwRect aFrm(FrameRA()); + aFrm.Pos( aObjPositioning.GetRelPos() ); + aFrm.Pos() += aRectFnSet.GetPos(GetAnchorFrame()->FrameRA()); + setFrame(aFrm); + // #i69335# InvalidateObjRectWithSpaces(); } @@ -1798,7 +1822,11 @@ SwTwips SwFlyFrame::Shrink_( SwTwips nDist, bool bTst ) if ( !bTst ) { SwRect aOld( GetObjRectWithSpaces() ); - aRectFnSet.SetHeight( FrameWA(), nHeight - nVal ); + + SwRect aFrm(FrameRA()); + aRectFnSet.SetHeight( aFrm, nHeight - nVal ); + setFrame(aFrm); + // #i68520# if ( nHeight - nVal != 0 ) { @@ -2504,16 +2532,20 @@ const SwRect SwFlyFrame::GetObjBoundRect() const bool SwFlyFrame::SetObjTop_( const SwTwips _nTop ) { const bool bChanged( FrameRA().Pos().getY() != _nTop ); + SwRect aFrm(FrameRA()); - FrameWA().Pos().setY(_nTop); + aFrm.Pos().setY(_nTop); + setFrame(aFrm); return bChanged; } bool SwFlyFrame::SetObjLeft_( const SwTwips _nLeft ) { const bool bChanged( FrameRA().Pos().getX() != _nLeft ); + SwRect aFrm(FrameRA()); - FrameWA().Pos().setX(_nLeft); + aFrm.Pos().setX(_nLeft); + setFrame(aFrm); return bChanged; } diff --git a/sw/source/core/layout/flyincnt.cxx b/sw/source/core/layout/flyincnt.cxx index 962bc6e9fb82..1c1867157e8f 100644 --- a/sw/source/core/layout/flyincnt.cxx +++ b/sw/source/core/layout/flyincnt.cxx @@ -73,7 +73,11 @@ void SwFlyInContentFrame::SetRefPoint( const Point& rPoint, aRef = rPoint; SetCurrRelPos( rRelAttr ); SwRectFnSet aRectFnSet(GetAnchorFrame()); - aRectFnSet.SetPos( FrameWA(), rPoint + rRelPos ); + + SwRect aFrm(FrameRA()); + aRectFnSet.SetPos( aFrm, rPoint + rRelPos ); + setFrame(aFrm); + // #i68520# InvalidateObjRectWithSpaces(); if( pNotify ) @@ -258,7 +262,10 @@ void SwFlyInContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) if ( FrameRA().Left() == (pFrame->FrameRA().Left()+pFrame->PrintRA().Left()) && FrameRA().Width() > pFrame->PrintRA().Width() ) { - FrameWA().Width( pFrame->PrintRA().Width() ); + SwRect aFrm(FrameRA()); + aFrm.Width( pFrame->PrintRA().Width() ); + setFrame(aFrm); + mbValidPrtArea = false; m_bWidthClipped = true; } diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index c1c84a8cfac3..f49909a16e86 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -297,25 +297,40 @@ void SwFlyFreeFrame::CheckClip( const SwFormatFrameSize &rSz ) if ( !pHeader || !pHeader->IsHeaderFrame() ) { const long nOld = FrameRA().Top(); - FrameWA().Pos().Y() = std::max( aClip.Top(), nClipBot - FrameRA().Height() ); + SwRect aFrm(FrameRA()); + aFrm.Pos().Y() = std::max( aClip.Top(), nClipBot - aFrm.Height() ); + setFrame(aFrm); + if ( FrameRA().Top() != nOld ) + { bAgain = true; + } + m_bHeightClipped = true; } } if ( bRig ) { const long nOld = FrameRA().Left(); - FrameWA().Pos().X() = std::max( aClip.Left(), nClipRig - FrameRA().Width() ); + SwRect aFrm(FrameRA()); + aFrm.Pos().X() = std::max( aClip.Left(), nClipRig - aFrm.Width() ); + setFrame(aFrm); + if ( FrameRA().Left() != nOld ) { const SwFormatHoriOrient &rH = GetFormat()->GetHoriOrient(); // Left-aligned ones may not be moved to the left when they // are avoiding another one. if( rH.GetHoriOrient() == text::HoriOrientation::LEFT ) - FrameWA().Pos().X() = nOld; + { + SwRect aFrm(FrameRA()); + aFrm.Pos().X() = nOld; + setFrame(aFrm); + } else + { bAgain = true; + } } m_bWidthClipped = true; } @@ -420,8 +435,12 @@ void SwFlyFreeFrame::CheckClip( const SwFormatFrameSize &rSz ) const long nPrtHeightDiff = FrameRA().Height() - PrintRA().Height(); const long nPrtWidthDiff = FrameRA().Width() - PrintRA().Width(); maUnclippedFrame = FrameRA(); - FrameWA().Height( aFrameRect.Height() ); - FrameWA().Width ( std::max( long(MINLAY), aFrameRect.Width() ) ); + + SwRect aFrm(FrameRA()); + aFrm.Height( aFrameRect.Height() ); + aFrm.Width ( std::max( long(MINLAY), aFrameRect.Width() ) ); + setFrame(aFrm); + if ( Lower() && Lower()->IsColumnFrame() ) { ColLock(); //lock grow/shrink diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 5e8d1d19e3cd..e720e0ac97f2 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -1120,13 +1120,21 @@ static void lcl_SetPos( SwFrame& _rNewFrame, const SwLayoutFrame& _rLayFrame ) { SwRectFnSet aRectFnSet(&_rLayFrame); - aRectFnSet.SetPos( _rNewFrame.FrameWA(), aRectFnSet.GetPos(_rLayFrame.FrameRA()) ); + SwRect aFrm(_rNewFrame.FrameRA()); + aRectFnSet.SetPos( aFrm, aRectFnSet.GetPos(_rLayFrame.FrameRA()) ); + // move position by one SwTwip in text flow direction in order to get // notifications for a new calculated position after its formatting. if ( aRectFnSet.IsVert() ) - _rNewFrame.FrameWA().Pos().X() -= 1; + { + aFrm.Pos().X() -= 1; + } else - _rNewFrame.FrameWA().Pos().Y() += 1; + { + aFrm.Pos().Y() += 1; + } + + _rNewFrame.setFrame(aFrm); } void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc, diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index f6ddc37391c8..c332c975ad1f 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -232,9 +232,14 @@ void SwFootnoteContFrame::Format( vcl::RenderContext* /*pRenderContext*/, const if( nDiff > 0 ) { if( nDiff > aRectFnSet.GetHeight(FrameRA()) ) + { nDiff = aRectFnSet.GetHeight(FrameRA()); - aRectFnSet.AddBottom( FrameWA(), -nDiff ); - aRectFnSet.AddHeight( PrintWA(), -nDiff ); + } + + SwRect aFrm(FrameRA()); + aRectFnSet.AddBottom( aFrm, -nDiff ); + aRectFnSet.AddHeight( aFrm, -nDiff ); + setFrame(aFrm); } } nDiff = aRectFnSet.GetHeight(FrameRA()) - nRemaining; @@ -326,10 +331,15 @@ SwTwips SwFootnoteContFrame::GrowFrame( SwTwips nDist, bool bTst, bool ) if ( !bTst ) { - aRectFnSet.SetHeight( FrameWA(), aRectFnSet.GetHeight(FrameRA()) + nDist ); + SwRect aFrm(FrameRA()); + aRectFnSet.SetHeight( aFrm, aRectFnSet.GetHeight(aFrm) + nDist ); if( IsVertical() && !IsVertLR() && !IsReverse() ) - FrameWA().Pos().X() -= nDist; + { + aFrm.Pos().X() -= nDist; + } + + setFrame(aFrm); } long nGrow = nDist - nAvail, nReal = 0; @@ -368,11 +378,17 @@ SwTwips SwFootnoteContFrame::GrowFrame( SwTwips nDist, bool bTst, bool ) if ( nReal != nDist ) { nDist -= nReal; + // We can only respect the boundless wish so much - FrameWA().SSize().Height() -= nDist; + SwRect aFrm(FrameRA()); + aFrm.SSize().Height() -= nDist; if( IsVertical() && !IsVertLR() && !IsReverse() ) - FrameWA().Pos().X() += nDist; + { + aFrm.Pos().X() += nDist; + } + + setFrame(aFrm); } // growing happens upwards, so successors to not need to be invalidated @@ -1900,19 +1916,34 @@ void SwFootnoteBossFrame::MoveFootnotes_( SwFootnoteFrames &rFootnoteArr, bool b while( pTmp && static_cast<SwLayoutFrame*>(pCnt)->IsAnLower( pTmp ) ) { pTmp->Prepare( PREP_MOVEFTN ); - aRectFnSet.SetHeight(pTmp->FrameWA(), 0); + + SwRect aFrm(pTmp->FrameRA()); + aRectFnSet.SetHeight(aFrm, 0); + pTmp->setFrame(aFrm); + aRectFnSet.SetHeight(pTmp->PrintWA(), 0); pTmp = pTmp->FindNext(); } } else + { pCnt->Prepare( PREP_MOVEFTN ); - aRectFnSet.SetHeight(pCnt->FrameWA(), 0); + } + + SwRect aFrm(pCnt->FrameRA()); + aRectFnSet.SetHeight(aFrm, 0); + pCnt->setFrame(aFrm); + aRectFnSet.SetHeight(pCnt->PrintWA(), 0); pCnt = pCnt->GetNext(); } - aRectFnSet.SetHeight(pFootnote->FrameWA(), 0); + + SwRect aFrm(pFootnote->FrameRA()); + aRectFnSet.SetHeight(aFrm, 0); + pFootnote->setFrame(aFrm); + aRectFnSet.SetHeight(pFootnote->PrintWA(), 0); + pFootnote->Calc(getRootFrame()->GetCurrShell()->GetOut()); pFootnote->GetUpper()->Calc(getRootFrame()->GetCurrShell()->GetOut()); @@ -2700,8 +2731,11 @@ bool SwContentFrame::MoveFootnoteCntFwd( bool bMakePage, SwFootnoteBossFrame *pO pNewUp = new SwSectionFrame( *pSect, false ); pNewUp->InsertBefore( pTmpFootnote, pTmpFootnote->Lower() ); static_cast<SwSectionFrame*>(pNewUp)->Init(); - pNewUp->FrameWA().Pos() = pTmpFootnote->FrameRA().Pos(); - pNewUp->FrameWA().Pos().Y() += 1; // for notifications + + SwRect aFrm(pNewUp->FrameRA()); + aFrm.Pos() = pTmpFootnote->FrameRA().Pos(); + aFrm.Pos().Y() += 1; // for notifications + pNewUp->setFrame(aFrm); // If the section frame has a successor then the latter needs // to be moved behind the new Follow of the section frame. diff --git a/sw/source/core/layout/hffrm.cxx b/sw/source/core/layout/hffrm.cxx index b34ce9b6933a..af61a110736b 100644 --- a/sw/source/core/layout/hffrm.cxx +++ b/sw/source/core/layout/hffrm.cxx @@ -364,12 +364,15 @@ void SwHeadFootFrame::FormatSize(SwTwips nUL, const SwBorderAttrs * pAttrs) // Don't overwrite the lower edge of the upper if ( GetUpper() && FrameRA().Height() ) { - const SwTwips nDeadLine = GetUpper()->FrameRA().Top() + - GetUpper()->PrintRA().Bottom(); + const SwTwips nDeadLine = GetUpper()->FrameRA().Top() + GetUpper()->PrintRA().Bottom(); const SwTwips nBot = FrameRA().Bottom(); + if ( nBot > nDeadLine ) { - FrameWA().Bottom( nDeadLine ); + SwRect aFrm(FrameRA()); + aFrm.Bottom( nDeadLine ); + setFrame(aFrm); + PrintWA().SSize().Height() = FrameRA().Height() - nBorder; } } diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx index e6e44a7ce007..14175a52d191 100644 --- a/sw/source/core/layout/laycache.cxx +++ b/sw/source/core/layout/laycache.cxx @@ -805,8 +805,12 @@ bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex ) if( bSplit ) { mrpFrame->InsertBehind( mrpLay, mrpPrv ); - mrpFrame->FrameWA().Pos() = mrpLay->FrameRA().Pos(); - mrpFrame->FrameWA().Pos().Y() += 1; + + SwRect aFrm(mrpFrame->FrameRA()); + aFrm.Pos() = mrpLay->FrameRA().Pos(); + aFrm.Pos().Y() += 1; + mrpFrame->setFrame(aFrm); + mrpPrv = mrpFrame; if( mrpFrame->IsTabFrame() ) { @@ -876,7 +880,11 @@ bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex ) { CheckFlyCache_( pLastPage ); if( mrpPrv && mrpPrv->IsTextFrame() && !mrpPrv->GetValidSizeFlag() ) - mrpPrv->FrameWA().Height( mrpPrv->GetUpper()->PrintRA().Height() ); + { + SwRect aFrm(mrpPrv->FrameRA()); + aFrm.Height( mrpPrv->GetUpper()->PrintRA().Height() ); + mrpPrv->setFrame(aFrm); + } bRet = true; mrpPrv = nullptr; @@ -902,10 +910,16 @@ bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex ) } mrpActualSection->SetSectionFrame( pSct ); pSct->InsertBehind( mrpLay, nullptr ); + if( bInit ) + { pSct->Init(); - pSct->FrameWA().Pos() = mrpLay->FrameRA().Pos(); - pSct->FrameWA().Pos().Y() += 1; //because of the notifications + } + + SwRect aFrm(pSct->FrameRA()); + aFrm.Pos() = mrpLay->FrameRA().Pos(); + aFrm.Pos().Y() += 1; //because of the notifications + pSct->setFrame(aFrm); mrpLay = pSct; if ( mrpLay->Lower() && mrpLay->Lower()->IsLayoutFrame() ) @@ -1004,15 +1018,17 @@ void SwLayHelper::CheckFlyCache_( SwPageFrame* pPage ) if ( pFly->FrameRA().Left() == FAR_AWAY ) { // we get the stored information - pFly->FrameWA().Pos().X() = pFlyCache->Left() + - pPage->FrameRA().Left(); - pFly->FrameWA().Pos().Y() = pFlyCache->Top() + - pPage->FrameRA().Top(); + SwRect aFrm(pFly->FrameRA()); + aFrm.Pos().X() = pFlyCache->Left() + pPage->FrameRA().Left(); + aFrm.Pos().Y() = pFlyCache->Top() + pPage->FrameRA().Top(); + if ( mpImpl->IsUseFlyCache() ) { - pFly->FrameWA().Width( pFlyCache->Width() ); - pFly->FrameWA().Height( pFlyCache->Height() ); + aFrm.Width( pFlyCache->Width() ); + aFrm.Height( pFlyCache->Height() ); } + + pFly->setFrame(aFrm); } ++aFlyCacheSetIt; diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 8d2fff147361..6d27aaea599c 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -90,13 +90,22 @@ void SwBodyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder } pFrame = pFrame->GetNext(); } while ( pFrame ); + if ( nHeight < 0 ) + { nHeight = 0; - FrameWA().Height( nHeight ); + } + + SwRect aFrm(FrameRA()); + aFrm.Height( nHeight ); + + if( IsVertical() && !IsVertLR() && !IsReverse() && nWidth != aFrm.Width() ) + { + aFrm.Pos().setX(aFrm.Pos().getX() + aFrm.Width() - nWidth); + } - if( IsVertical() && !IsVertLR() && !IsReverse() && nWidth != FrameRA().Width() ) - FrameWA().Pos().setX(FrameRA().Pos().getX() + FrameRA().Width() - nWidth); - FrameWA().Width( nWidth ); + aFrm.Width( nWidth ); + setFrame(aFrm); } bool bNoGrid = true; @@ -179,16 +188,26 @@ SwPageFrame::SwPageFrame( SwFrameFormat *pFormat, SwFrame* pSib, SwPageDesc *pPg SwViewShell *pSh = getRootFrame()->GetCurrShell(); const bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode(); vcl::RenderContext* pRenderContext = pSh ? pSh->GetOut() : nullptr; + SwRect aFrm(FrameRA()); + if ( bBrowseMode ) { - FrameWA().Height( 0 ); + aFrm.Height( 0 ); long nWidth = pSh->VisArea().Width(); + if ( !nWidth ) + { nWidth = 5000; // changes anyway - FrameWA().Width ( nWidth ); + } + + aFrm.Width ( nWidth ); } else - FrameWA().SSize( pFormat->GetFrameSize().GetSize() ); + { + aFrm.SSize( pFormat->GetFrameSize().GetSize() ); + } + + setFrame(aFrm); // create and insert body area if it is not a blank page SwDoc *pDoc = pFormat->GetDoc(); @@ -600,11 +619,15 @@ void SwPageFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew, static_cast<const SwFormatChg*>(pNew)->pChangedFormat->GetFrameSize() : static_cast<const SwFormatFrameSize&>(*pNew); - FrameWA().Height( std::max( rSz.GetHeight(), long(MINLAY) ) ); - FrameWA().Width ( std::max( rSz.GetWidth(), long(MINLAY) ) ); + SwRect aFrm(FrameRA()); + aFrm.Height( std::max( rSz.GetHeight(), long(MINLAY) ) ); + aFrm.Width ( std::max( rSz.GetWidth(), long(MINLAY) ) ); + setFrame(aFrm); if ( GetUpper() ) + { static_cast<SwRootFrame*>(GetUpper())->CheckViewLayout( nullptr, nullptr ); + } } // cleanup Window if( pSh && pSh->GetWin() && aOldPageFrameRect.HasArea() ) @@ -1326,7 +1349,12 @@ sw::sidebarwindows::SidebarPosition SwPageFrame::SidebarPosition() const SwTwips SwRootFrame::GrowFrame( SwTwips nDist, bool bTst, bool ) { if ( !bTst ) - FrameWA().SSize().Height() += nDist; + { + SwRect aFrm(FrameRA()); + aFrm.SSize().Height() += nDist; + setFrame(aFrm); + } + return nDist; } @@ -1336,7 +1364,12 @@ SwTwips SwRootFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool ) OSL_ENSURE( nDist <= FrameRA().Height(), "nDist greater than current size." ); if ( !bTst ) - FrameWA().SSize().Height() -= nDist; + { + SwRect aFrm(FrameRA()); + aFrm.SSize().Height() -= nDist; + setFrame(aFrm); + } + return nDist; } @@ -1550,7 +1583,10 @@ void SwRootFrame::AssertPageFlys( SwPageFrame *pPage ) Size SwRootFrame::ChgSize( const Size& aNewSize ) { - FrameWA().SSize() = aNewSize; + SwRect aFrm(FrameRA()); + aFrm.SSize() = aNewSize; + setFrame(aFrm); + InvalidatePrt_(); mbFixSize = false; return FrameRA().SSize(); @@ -1559,19 +1595,27 @@ Size SwRootFrame::ChgSize( const Size& aNewSize ) void SwRootFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) { if ( !mbValidPos ) - { mbValidPos = true; - FrameWA().Pos().setX(DOCUMENTBORDER); - FrameWA().Pos().setY(DOCUMENTBORDER); + { + mbValidPos = true; + + SwRect aFrm(FrameRA()); + aFrm.Pos().setX(DOCUMENTBORDER); + aFrm.Pos().setY(DOCUMENTBORDER); + setFrame(aFrm); } + if ( !mbValidPrtArea ) { mbValidPrtArea = true; PrintWA().Pos().setX(0); PrintWA().Pos().setY(0); PrintWA().SSize( FrameRA().SSize() ); } + if ( !mbValidSize ) + { // SSize is set by the pages (Cut/Paste). mbValidSize = true; + } } void SwRootFrame::ImplInvalidateBrowseWidth() @@ -1877,10 +1921,19 @@ static void lcl_MoveAllLowers( SwFrame* pFrame, const Point& rOffset ) const SwRect aFrame( pFrame->FrameRA() ); // first move the current frame - if (pFrame->FrameRA().Pos().X() != FAR_AWAY) - pFrame->FrameWA().Pos().X() += rOffset.X(); - if (pFrame->FrameRA().Pos().Y() != FAR_AWAY) - pFrame->FrameWA().Pos().Y() += rOffset.Y(); + SwRect aFrm(pFrame->FrameRA()); + + if (aFrm.Pos().X() != FAR_AWAY) + { + aFrm.Pos().X() += rOffset.X(); + } + + if (aFrm.Pos().Y() != FAR_AWAY) + { + aFrm.Pos().Y() += rOffset.Y(); + } + + pFrame->setFrame(aFrm); // Don't forget accessibility: if( pFrame->IsAccessibleFrame() ) diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index fc7686210355..dd42553cbc2f 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -101,8 +101,11 @@ void SwSectionFrame::Init() assert(GetUpper() && "SwSectionFrame::Init before insertion?!"); SwRectFnSet aRectFnSet(this); long nWidth = aRectFnSet.GetWidth(GetUpper()->PrintRA()); - aRectFnSet.SetWidth( FrameWA(), nWidth ); - aRectFnSet.SetHeight( FrameWA(), 0 ); + + SwRect aFrm(FrameRA()); + aRectFnSet.SetWidth( aFrm, nWidth ); + aRectFnSet.SetHeight( aFrm, 0 ); + setFrame(aFrm); // #109700# LRSpace for sections const SvxLRSpaceItem& rLRSpace = GetFormat()->GetLRSpace(); @@ -197,7 +200,10 @@ void SwSectionFrame::DelEmpty( bool bRemove ) SetFollow(nullptr); if( pUp ) { - FrameWA().Height( 0 ); + SwRect aFrm(FrameRA()); + aFrm.Height( 0 ); + setFrame(aFrm); + // If we are destroyed immediately anyway, we don't need // to put us into the list if( bRemove ) @@ -286,7 +292,10 @@ void SwSectionFrame::Cut_( bool bRemove ) { if( !bRemove ) { - aRectFnSet.SetHeight( FrameWA(), 0 ); + SwRect aFrm(FrameRA()); + aRectFnSet.SetHeight( aFrm, 0 ); + setFrame(aFrm); + aRectFnSet.SetHeight( PrintWA(), 0 ); } pUp->Shrink( nFrameHeight ); @@ -1056,7 +1065,11 @@ void SwSectionFrame::CheckClipping( bool bGrow, bool bMaximize ) nDeadLine = aRectFnSet.GetTop(FrameRA()); const Size aOldSz( PrintRA().SSize() ); long nTop = aRectFnSet.GetTopMargin(*this); - aRectFnSet.SetBottom( FrameWA(), nDeadLine ); + + SwRect aFrm(FrameRA()); + aRectFnSet.SetBottom( aFrm, nDeadLine ); + setFrame(aFrm); + nDiff = aRectFnSet.GetHeight(FrameRA()); if( nTop > nDiff ) nTop = nDiff; @@ -1110,7 +1123,10 @@ void SwSectionFrame::SimpleFormat() // order to get calculated lowers, not only if there space left in its upper. if( aRectFnSet.BottomDist( FrameRA(), nDeadLine ) >= 0 ) { - aRectFnSet.SetBottom( FrameWA(), nDeadLine ); + SwRect aFrm(FrameRA()); + aRectFnSet.SetBottom( aFrm, nDeadLine ); + setFrame(aFrm); + long nHeight = aRectFnSet.GetHeight(FrameRA()); long nTop = CalcUpperSpace(); if( nTop > nHeight ) @@ -1191,9 +1207,12 @@ class ExtraFormatToPositionObjs SwRectFnSet aRectFnSet(mpSectFrame); SwTwips nTopMargin = aRectFnSet.GetTopMargin(*mpSectFrame); Size aOldSectPrtSize( mpSectFrame->PrintRA().SSize() ); - SwTwips nDiff = aRectFnSet.BottomDist( mpSectFrame->FrameRA(), - aRectFnSet.GetPrtBottom(*mpSectFrame->GetUpper()) ); - aRectFnSet.AddBottom( mpSectFrame->FrameWA(), nDiff ); + SwTwips nDiff = aRectFnSet.BottomDist( mpSectFrame->FrameRA(), aRectFnSet.GetPrtBottom(*mpSectFrame->GetUpper()) ); + + SwRect aFrm(mpSectFrame->FrameRA()); + aRectFnSet.AddBottom( aFrm, nDiff ); + mpSectFrame->setFrame(aFrm); + aRectFnSet.SetYMargins( *mpSectFrame, nTopMargin, 0 ); // #i59789# // suppress formatting, if printing area of section is too narrow @@ -1319,12 +1338,14 @@ void SwSectionFrame::Format( vcl::RenderContext* pRenderContext, const SwBorderA if( GetUpper() ) { long nWidth = aRectFnSet.GetWidth(GetUpper()->PrintRA()); - aRectFnSet.SetWidth( FrameWA(), nWidth ); + + SwRect aFrm(FrameRA()); + aRectFnSet.SetWidth( aFrm, nWidth ); + setFrame(aFrm); // #109700# LRSpace for sections const SvxLRSpaceItem& rLRSpace = GetFormat()->GetLRSpace(); - aRectFnSet.SetWidth( PrintWA(), nWidth - rLRSpace.GetLeft() - - rLRSpace.GetRight() ); + aRectFnSet.SetWidth( PrintWA(), nWidth - rLRSpace.GetLeft() - rLRSpace.GetRight() ); // OD 15.10.2002 #103517# - allow grow in online layout // Thus, set <..IsBrowseMode()> as parameter <bGrow> on calling @@ -1410,9 +1431,14 @@ void SwSectionFrame::Format( vcl::RenderContext* pRenderContext, const SwBorderA { long nTmp = nRemaining - aRectFnSet.GetHeight(FrameRA()); long nTop = aRectFnSet.GetTopMargin(*this); - aRectFnSet.AddBottom( FrameWA(), nTmp ); + + SwRect aFrm(FrameRA()); + aRectFnSet.AddBottom( aFrm, nTmp ); + setFrame(aFrm); + aRectFnSet.SetYMargins( *this, nTop, 0 ); InvalidateNextPos(); + if (m_pLower && (!m_pLower->IsColumnFrame() || !m_pLower->GetNext())) { // If a single-column section just created the space that @@ -2021,7 +2047,11 @@ SwTwips SwSectionFrame::Grow_( SwTwips nDist, bool bTst ) if( GetUpper() && GetUpper()->IsHeaderFrame() ) GetUpper()->InvalidateSize(); } - aRectFnSet.AddBottom( FrameWA(), nGrow ); + + SwRect aFrm(FrameRA()); + aRectFnSet.AddBottom( aFrm, nGrow ); + setFrame(aFrm); + long nPrtHeight = aRectFnSet.GetHeight(PrintRA()) + nGrow; aRectFnSet.SetHeight( PrintWA(), nPrtHeight ); @@ -2104,7 +2134,11 @@ SwTwips SwSectionFrame::Shrink_( SwTwips nDist, bool bTst ) SetCompletePaint(); InvalidatePage(); } - aRectFnSet.AddBottom( FrameWA(), -nDist ); + + SwRect aFrm(FrameRA()); + aRectFnSet.AddBottom( aFrm, -nDist ); + setFrame(aFrm); + long nPrtHeight = aRectFnSet.GetHeight(PrintRA()) - nDist; aRectFnSet.SetHeight( PrintWA(), nPrtHeight ); diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx index e611d0329436..6f965a25b721 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -55,7 +55,10 @@ bool SwFrame::SetMinLeft( long nDeadline ) SwTwips nDiff = nDeadline - FrameRA().Left(); if( nDiff > 0 ) { - FrameWA().Left( nDeadline ); + SwRect aFrm(FrameRA()); + aFrm.Left( nDeadline ); + setFrame(aFrm); + PrintWA().Width( PrintRA().Width() - nDiff ); return true; } @@ -67,7 +70,10 @@ bool SwFrame::SetMaxBottom( long nDeadline ) SwTwips nDiff = FrameRA().Top() + FrameRA().Height() - nDeadline; if( nDiff > 0 ) { - FrameWA().Height( FrameRA().Height() - nDiff ); + SwRect aFrm(FrameRA()); + aFrm.Height( aFrm.Height() - nDiff ); + setFrame(aFrm); + PrintWA().Height( PrintRA().Height() - nDiff ); return true; } @@ -79,7 +85,10 @@ bool SwFrame::SetMinTop( long nDeadline ) SwTwips nDiff = nDeadline - FrameRA().Top(); if( nDiff > 0 ) { - FrameWA().Top( nDeadline ); + SwRect aFrm(FrameRA()); + aFrm.Top( nDeadline ); + setFrame(aFrm); + PrintWA().Height( PrintRA().Height() - nDiff ); return true; } @@ -91,7 +100,10 @@ bool SwFrame::SetMaxRight( long nDeadline ) SwTwips nDiff = FrameRA().Left() + FrameRA().Width() - nDeadline; if( nDiff > 0 ) { - FrameWA().Width( FrameRA().Width() - nDiff ); + SwRect aFrm(FrameRA()); + aFrm.Width( aFrm.Width() - nDiff ); + setFrame(aFrm); + PrintWA().Width( PrintRA().Width() - nDiff ); return true; } @@ -100,68 +112,96 @@ bool SwFrame::SetMaxRight( long nDeadline ) void SwFrame::MakeBelowPos( const SwFrame* pUp, const SwFrame* pPrv, bool bNotify ) { + SwRect aFrm(FrameRA()); + if( pPrv ) { - FrameWA().Pos( pPrv->FrameRA().Pos() ); - FrameWA().Pos().Y() += pPrv->FrameRA().Height(); + aFrm.Pos( pPrv->FrameRA().Pos() ); + aFrm.Pos().Y() += pPrv->FrameRA().Height(); } else { - FrameWA().Pos( pUp->FrameRA().Pos() ); - FrameWA().Pos() += pUp->PrintRA().Pos(); + aFrm.Pos( pUp->FrameRA().Pos() ); + aFrm.Pos() += pUp->PrintRA().Pos(); } + if( bNotify ) - FrameWA().Pos().Y() += 1; + { + aFrm.Pos().Y() += 1; + } + + setFrame(aFrm); } void SwFrame::MakeUpperPos( const SwFrame* pUp, const SwFrame* pPrv, bool bNotify ) { + SwRect aFrm(FrameRA()); + if( pPrv ) { - FrameWA().Pos( pPrv->FrameRA().Pos() ); - FrameWA().Pos().Y() -= FrameRA().Height(); + aFrm.Pos( pPrv->FrameRA().Pos() ); + aFrm.Pos().Y() -= aFrm.Height(); } else { - FrameWA().Pos( pUp->FrameRA().Pos() ); - FrameWA().Pos() += pUp->PrintRA().Pos(); - FrameWA().Pos().Y() += pUp->PrintRA().Height() - FrameRA().Height(); + aFrm.Pos( pUp->FrameRA().Pos() ); + aFrm.Pos() += pUp->PrintRA().Pos(); + aFrm.Pos().Y() += pUp->PrintRA().Height() - aFrm.Height(); } + if( bNotify ) - FrameWA().Pos().Y() -= 1; + { + aFrm.Pos().Y() -= 1; + } + + setFrame(aFrm); } void SwFrame::MakeLeftPos( const SwFrame* pUp, const SwFrame* pPrv, bool bNotify ) { + SwRect aFrm(FrameRA()); + if( pPrv ) { - FrameWA().Pos( pPrv->FrameRA().Pos() ); - FrameWA().Pos().X() -= FrameRA().Width(); + aFrm.Pos( pPrv->FrameRA().Pos() ); + aFrm.Pos().X() -= aFrm.Width(); } else { - FrameWA().Pos( pUp->FrameRA().Pos() ); - FrameWA().Pos() += pUp->PrintRA().Pos(); - FrameWA().Pos().X() += pUp->PrintRA().Width() - FrameRA().Width(); + aFrm.Pos( pUp->FrameRA().Pos() ); + aFrm.Pos() += pUp->PrintRA().Pos(); + aFrm.Pos().X() += pUp->PrintRA().Width() - aFrm.Width(); } + if( bNotify ) - FrameWA().Pos().X() -= 1; + { + aFrm.Pos().X() -= 1; + } + + setFrame(aFrm); } void SwFrame::MakeRightPos( const SwFrame* pUp, const SwFrame* pPrv, bool bNotify ) { + SwRect aFrm(FrameRA()); + if( pPrv ) { - FrameWA().Pos( pPrv->FrameRA().Pos() ); - FrameWA().Pos().X() += pPrv->FrameRA().Width(); + aFrm.Pos( pPrv->FrameRA().Pos() ); + aFrm.Pos().X() += pPrv->FrameRA().Width(); } else { - FrameWA().Pos( pUp->FrameRA().Pos() ); - FrameWA().Pos() += pUp->PrintRA().Pos(); + aFrm.Pos( pUp->FrameRA().Pos() ); + aFrm.Pos() += pUp->PrintRA().Pos(); } + if( bNotify ) - FrameWA().Pos().X() += 1; + { + aFrm.Pos().X() += 1; + } + + setFrame(aFrm); } void SwFrame::SetTopBottomMargins( long nTop, long nBot ) diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index d7b0ece213f2..91c5fabd7b99 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -353,7 +353,10 @@ static void lcl_ShrinkCellsAndAllContent( SwRowFrame& rRow ) if (bAllRowsCollapsed) { // All rows of this table have 0 height -> set height of the table itself as well. - aRectFnSet.SetHeight(pTmp->FrameWA(), 0); + SwRect aFrm(pTmp->FrameRA()); + aRectFnSet.SetHeight(aFrm, 0); + pTmp->setFrame(aFrm); + aRectFnSet.SetTop(pTmp->PrintWA(), 0); aRectFnSet.SetHeight(pTmp->PrintWA(), 0); } @@ -382,7 +385,10 @@ static void lcl_ShrinkCellsAndAllContent( SwRowFrame& rRow ) if (bAllLowersCollapsed) { // All lower frame of this cell have 0 height -> set height of the cell itself as well. - aRectFnSet.SetHeight(pCurrMasterCell->FrameWA(), 0); + SwRect aFrm(pCurrMasterCell->FrameRA()); + aRectFnSet.SetHeight(aFrm, 0); + pCurrMasterCell->setFrame(aFrm); + aRectFnSet.SetTop(pCurrMasterCell->PrintWA(), 0); aRectFnSet.SetHeight(pCurrMasterCell->PrintWA(), 0); } @@ -395,7 +401,10 @@ static void lcl_ShrinkCellsAndAllContent( SwRowFrame& rRow ) if (bAllCellsCollapsed) { // All cells have 0 height -> set height of row as well. - aRectFnSet.SetHeight(rRow.FrameWA(), 0); + SwRect aFrm(rRow.FrameRA()); + aRectFnSet.SetHeight(aFrm, 0); + rRow.setFrame(aFrm); + aRectFnSet.SetTop(rRow.PrintWA(), 0); aRectFnSet.SetHeight(rRow.PrintWA(), 0); } @@ -782,8 +791,13 @@ static void lcl_AdjustRowSpanCells( SwRowFrame* pRow ) // calculate height of cell: const long nNewCellHeight = lcl_GetHeightOfRows( pRow, nLayoutRowSpan ); const long nDiff = nNewCellHeight - aRectFnSet.GetHeight(pCellFrame->FrameRA()); + if ( nDiff ) - aRectFnSet.AddBottom(pCellFrame->FrameWA(), nDiff); + { + SwRect aFrm(pCellFrame->FrameRA()); + aRectFnSet.AddBottom(aFrm, nDiff); + pCellFrame->setFrame(aFrm); + } } pCellFrame = static_cast<SwCellFrame*>(pCellFrame->GetNext()); @@ -1139,9 +1153,12 @@ bool SwTabFrame::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowK pFoll = new SwTabFrame( *this ); // We give the follow table an initial width. - aRectFnSet.AddWidth(pFoll->FrameWA(), aRectFnSet.GetWidth(FrameRA())); + SwRect aFrm(pFoll->FrameRA()); + aRectFnSet.AddWidth(aFrm, aRectFnSet.GetWidth(FrameRA())); + aRectFnSet.SetLeft(aFrm, aRectFnSet.GetLeft(FrameRA())); + pFoll->setFrame(aFrm); + aRectFnSet.AddWidth(pFoll->PrintWA(), aRectFnSet.GetWidth(PrintRA())); - aRectFnSet.SetLeft(pFoll->FrameWA(), aRectFnSet.GetLeft(FrameRA())); // Insert the new follow table pFoll->InsertBehind( GetUpper(), this ); @@ -2731,7 +2748,11 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA long nDiff = aRectFnSet.GetWidth(GetUpper()->PrintRA()) - aRectFnSet.GetWidth(FrameRA()); if( nDiff ) - aRectFnSet.AddRight( FrameWA(), nDiff ); + { + SwRect aFrm(FrameRA()); + aRectFnSet.AddRight( aFrm, nDiff ); + setFrame(aFrm); + } } //VarSize is always the height. @@ -3016,7 +3037,9 @@ SwTwips SwTabFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) if ( !bTst ) { - aRectFnSet.AddBottom( FrameWA(), nDist ); + SwRect aFrm(FrameRA()); + aRectFnSet.AddBottom( aFrm, nDist ); + setFrame(aFrm); SwRootFrame *pRootFrame = getRootFrame(); if( pRootFrame && pRootFrame->IsAnyShellAccessible() && @@ -4242,7 +4265,10 @@ void SwRowFrame::AdjustCells( const SwTwips nHeight, const bool bHeight ) const long nDiff = nHeight - aRectFnSet.GetHeight(pCellFrame->FrameRA()); if ( nDiff ) { - aRectFnSet.AddBottom( pCellFrame->FrameWA(), nDiff ); + SwRect aFrm(pCellFrame->FrameRA()); + aRectFnSet.AddBottom( aFrm, nDiff ); + pCellFrame->setFrame(aFrm); + pCellFrame->InvalidatePrt_(); } } @@ -4286,7 +4312,11 @@ void SwRowFrame::AdjustCells( const SwTwips nHeight, const bool bHeight ) if ( nDiff ) { aOldFrame = pToAdjust->FrameRA(); - aRectFnSet.AddBottom( pToAdjust->FrameWA(), nDiff ); + + SwRect aFrm(pToAdjust->FrameRA()); + aRectFnSet.AddBottom( aFrm, nDiff ); + pToAdjust->setFrame(aFrm); + pNotify = pToAdjust; } @@ -4352,7 +4382,11 @@ SwTwips SwRowFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) nReal = std::min( nAdditionalSpace, nDist ); nDist -= nReal; if ( !bTst ) - aRectFnSet.AddBottom( FrameWA(), nReal ); + { + SwRect aFrm(FrameRA()); + aRectFnSet.AddBottom( aFrm, nReal ); + setFrame(aFrm); + } } } @@ -4433,10 +4467,15 @@ SwTwips SwRowFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) if ( !bTst ) { SwTwips nHeight = aRectFnSet.GetHeight(FrameRA()); - aRectFnSet.SetHeight( FrameWA(), nHeight - nReal ); + SwRect aFrm(FrameRA()); + aRectFnSet.SetHeight( aFrm, nHeight - nReal ); if( IsVertical() && !IsVertLR() && !aRectFnSet.IsRev() ) - FrameWA().Pos().X() += nReal; + { + aFrm.Pos().X() += nReal; + } + + setFrame(aFrm); } SwLayoutFrame* pFrame = GetUpper(); @@ -4449,10 +4488,15 @@ SwTwips SwRowFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) { nReal -= nTmp; SwTwips nHeight = aRectFnSet.GetHeight(FrameRA()); - aRectFnSet.SetHeight( FrameWA(), nHeight + nReal ); + SwRect aFrm(FrameRA()); + aRectFnSet.SetHeight( aFrm, nHeight + nReal ); if( IsVertical() && !IsVertLR() && !aRectFnSet.IsRev() ) - FrameWA().Pos().X() -= nReal; + { + aFrm.Pos().X() -= nReal; + } + + setFrame(aFrm); } nReal = nTmp; } @@ -4584,9 +4628,12 @@ static bool lcl_ArrangeLowers( SwLayoutFrame *pLay, long lYStart, bool bInva ) bRet = true; const long lDiff = aRectFnSet.YDiff( lYStart, nFrameTop ); const long lDiffX = lYStart - nFrameTop; - aRectFnSet.SubTop( pFrame->FrameWA(), -lDiff ); - aRectFnSet.AddBottom( pFrame->FrameWA(), lDiff ); + SwRect aFrm(pFrame->FrameRA()); + aRectFnSet.SubTop( aFrm, -lDiff ); + aRectFnSet.AddBottom( aFrm, lDiff ); + pFrame->setFrame(aFrm); pFrame->SetCompletePaint(); + if ( !pFrame->GetNext() ) pFrame->SetRetouche(); if( bInva ) @@ -4640,8 +4687,11 @@ static bool lcl_ArrangeLowers( SwLayoutFrame *pLay, long lYStart, bool bInva ) !pFly->ConsiderObjWrapInfluenceOnObjPos(); if ( bDirectMove ) { - aRectFnSet.SubTop( pFly->FrameWA(), -lDiff ); - aRectFnSet.AddBottom( pFly->FrameWA(), lDiff ); + SwRect aFrm(pFly->FrameRA()); + aRectFnSet.SubTop( aFrm, -lDiff ); + aRectFnSet.AddBottom( aFrm, lDiff ); + pFly->setFrame(aFrm); + pFly->GetVirtDrawObj()->SetRectsDirty(); // --> OD 2004-08-17 - also notify view of <SdrObject> // instance, which represents the Writer fly frame in @@ -4912,10 +4962,18 @@ void SwCellFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder } } const long nDiff = nWidth - aRectFnSet.GetWidth(FrameRA()); + SwRect aFrm(FrameRA()); + if( IsNeighbourFrame() && IsRightToLeft() ) - aRectFnSet.SubLeft( FrameWA(), nDiff ); + { + aRectFnSet.SubLeft( aFrm, nDiff ); + } else - aRectFnSet.AddRight( FrameWA(), nDiff ); + { + aRectFnSet.AddRight( aFrm, nDiff ); + } + + setFrame(aFrm); aRectFnSet.AddRight( PrintWA(), nDiff ); //Adjust the height, it's defined through the content and the border. diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 7bbbf608a879..0a1b3876901d 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -467,26 +467,30 @@ Size SwFrame::ChgSize( const Size& aNewSize ) if ( aNewSize == aOldSize ) return aOldSize; + SwRect aFrm(FrameRA()); + if ( GetUpper() ) { bool bNeighb = IsNeighbourFrame(); - SwRectFn fnRect = IsVertical() == bNeighb ? - fnRectHori : ( IsVertLR() ? fnRectVertL2R : fnRectVert ); - + SwRectFn fnRect = IsVertical() == bNeighb ? fnRectHori : ( IsVertLR() ? fnRectVertL2R : fnRectVert ); SwRect aNew( Point(0,0), aNewSize ); - (FrameWA().*fnRect->fnSetWidth)( (aNew.*fnRect->fnGetWidth)() ); + (aFrm.*fnRect->fnSetWidth)( (aNew.*fnRect->fnGetWidth)() ); long nNew = (aNew.*fnRect->fnGetHeight)(); long nDiff = nNew - (FrameRA().*fnRect->fnGetHeight)(); + if( nDiff ) { if ( GetUpper()->IsFootnoteBossFrame() && HasFixSize() && SwNeighbourAdjust::GrowShrink != static_cast<SwFootnoteBossFrame*>(GetUpper())->NeighbourhoodAdjustment() ) { - (FrameWA().*fnRect->fnSetHeight)( nNew ); + (aFrm.*fnRect->fnSetHeight)( nNew ); SwTwips nReal = static_cast<SwLayoutFrame*>(this)->AdjustNeighbourhood(nDiff); + if ( nReal != nDiff ) - (FrameWA().*fnRect->fnSetHeight)( nNew - nDiff + nReal ); + { + (aFrm.*fnRect->fnSetHeight)( nNew - nDiff + nReal ); + } } else { @@ -499,19 +503,25 @@ Size SwFrame::ChgSize( const Size& aNewSize ) else Shrink( -nDiff ); - if ( GetUpper() && (FrameRA().*fnRect->fnGetHeight)() != nNew ) + if ( GetUpper() && (aFrm.*fnRect->fnGetHeight)() != nNew ) + { GetUpper()->InvalidateSize_(); + } } // Even if grow/shrink did not yet set the desired width, for // example when called by ChgColumns to set the column width, we // set the right width now. - (FrameWA().*fnRect->fnSetHeight)( nNew ); + (aFrm.*fnRect->fnSetHeight)( nNew ); } } } else - FrameWA().SSize( aNewSize ); + { + aFrm.SSize( aNewSize ); + } + + setFrame(aFrm); if ( FrameRA().SSize() != aOldSize ) { @@ -1145,11 +1155,20 @@ void SwLayoutFrame::Cut() nReal = -AdjustNeighbourhood( -nShrink ); if( nReal < nShrink ) { - SwTwips nOldHeight = aRectFnSet.GetHeight(FrameRA()); - aRectFnSet.SetHeight( FrameWA(), 0 ); + const SwTwips nOldHeight = aRectFnSet.GetHeight(FrameRA()); + SwRect aFrm(FrameRA()); + + // seems as if this needs to be frowarded to the SwFrame already here, + // changing to zero seems temporary anyways + aRectFnSet.SetHeight( aFrm, 0 ); + setFrame(aFrm); + nReal += pUp->Shrink( nShrink - nReal ); - aRectFnSet.SetHeight( FrameWA(), nOldHeight ); + + aRectFnSet.SetHeight( aFrm, nOldHeight ); + setFrame(aFrm); } + if( SwNeighbourAdjust::GrowAdjust == nAdjust && nReal < nShrink ) AdjustNeighbourhood( nReal - nShrink ); } @@ -1323,7 +1342,10 @@ SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst ) const long nTmp = nChg - pBody->PrintRA().Height(); if ( !bTst ) { - pBody->FrameWA().Height(std::max( 0L, pBody->FrameRA().Height() - nChg )); + SwRect aFrm(pBody->FrameRA()); + aFrm.Height(std::max( 0L, aFrm.Height() - nChg )); + pBody->setFrame(aFrm); + pBody->InvalidatePrt_(); pBody->InvalidateSize_(); if ( pBody->GetNext() ) @@ -1376,8 +1398,14 @@ SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst ) } if ( !bTst && nChg ) { - pUp->FrameWA().SSize().Height() += nChg; + { + SwRect aFrm(pUp->FrameRA()); + aFrm.SSize().Height() += nChg; + pUp->setFrame(aFrm); + } + pUp->PrintWA().SSize().Height() += nChg; + if ( pViewShell ) pViewShell->Imp()->SetFirstVisPageInvalid(); @@ -1409,8 +1437,12 @@ SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst ) static_cast<SwRootFrame*>(pUp->GetUpper())->CheckViewLayout( nullptr, nullptr ); //static_cast<SwPageFrame*>(pUp)->AdjustRootSize( CHG_CHGPAGE, &aOldRect ); - FrameWA().SSize().Height() = nOldFrameHeight; + SwRect aFrm(FrameRA()); + aFrm.SSize().Height() = nOldFrameHeight; + setFrame(aFrm); + PrintWA().SSize().Height() = nOldPrtHeight; + mbCompletePaint = bOldComplete; } if ( !IsBodyFrame() ) @@ -1505,12 +1537,21 @@ SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst ) nAdd = nAddMax; if ( !bTst ) { - aRectFnSet.SetHeight(pFrame->GetNext()->FrameWA(), nAddMax-nAdd); + SwRect aFrm(pFrame->GetNext()->FrameRA()); + aRectFnSet.SetHeight(aFrm, nAddMax-nAdd); + if( aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() && !aRectFnSet.IsRev() ) - pFrame->GetNext()->FrameWA().Pos().X() += nAdd; + { + aFrm.Pos().X() += nAdd; + } + + pFrame->GetNext()->setFrame(aFrm); pFrame->GetNext()->InvalidatePrt(); + if ( pFrame->GetNext()->GetNext() ) + { pFrame->GetNext()->GetNext()->InvalidatePos_(); + } } } } @@ -1519,13 +1560,22 @@ SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst ) if ( !bTst && nReal ) { SwTwips nTmp = aRectFnSet.GetHeight(pFrame->FrameRA()); - aRectFnSet.SetHeight( pFrame->FrameWA(), nTmp - nReal ); + + SwRect aFrm(pFrame->FrameRA()); + aRectFnSet.SetHeight( aFrm, nTmp - nReal ); + if( aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() && !aRectFnSet.IsRev() ) - pFrame->FrameWA().Pos().X() += nReal; + { + aFrm.Pos().X() += nReal; + } + + pFrame->setFrame(aFrm); pFrame->InvalidatePrt(); + if ( pFrame->GetNext() ) pFrame->GetNext()->InvalidatePos_(); - if( nReal < 0 && pFrame->IsInSct() ) + + if( nReal < 0 && pFrame->IsInSct() ) { SwLayoutFrame* pUp = pFrame->GetUpper(); if( pUp && nullptr != ( pUp = pUp->GetUpper() ) && pUp->IsSctFrame() && @@ -1742,9 +1792,16 @@ SwTwips SwContentFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) { if ( !bTst ) { - aRectFnSet.SetHeight( FrameWA(), nFrameHeight + nDist ); + SwRect aFrm(FrameRA()); + aRectFnSet.SetHeight( aFrm, nFrameHeight + nDist ); + if( IsVertical() && !IsVertLR() && !IsReverse() ) - FrameWA().Pos().X() -= nDist; + { + aFrm.Pos().X() -= nDist; + } + + setFrame(aFrm); + if ( GetNext() ) { GetNext()->InvalidatePos(); @@ -1773,9 +1830,17 @@ SwTwips SwContentFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) { //Contents are always resized to the wished value. long nOld = aRectFnSet.GetHeight(FrameRA()); - aRectFnSet.SetHeight( FrameWA(), nOld + nDist ); + SwRect aFrm(FrameRA()); + + aRectFnSet.SetHeight( aFrm, nOld + nDist ); + if( IsVertical()&& !IsVertLR() && !IsReverse() ) - FrameWA().Pos().X() -= nDist; + { + aFrm.Pos().X() -= nDist; + } + + setFrame(aFrm); + SwTabFrame *pTab = (nOld && IsInTab()) ? FindTabFrame() : nullptr; if (pTab) { @@ -1858,10 +1923,19 @@ SwTwips SwContentFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) nRstHeight = nDist + nRstHeight - nNextHeight; } else + { nRstHeight = nDist; - aRectFnSet.SetHeight( FrameWA(), aRectFnSet.GetHeight(FrameRA()) - nDist ); + } + + SwRect aFrm(FrameRA()); + aRectFnSet.SetHeight( aFrm, aRectFnSet.GetHeight(aFrm) - nDist ); + if( IsVertical() && !IsVertLR() ) - FrameWA().Pos().X() += nDist; + { + aFrm.Pos().X() += nDist; + } + + setFrame(aFrm); nDist = nRstHeight; SwTabFrame *pTab = IsInTab() ? FindTabFrame() : nullptr; if (pTab) @@ -2249,9 +2323,15 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) bool bChgPos = IsVertical() && !IsReverse(); if ( !bTst ) { - aRectFnSet.SetHeight( FrameWA(), nFrameHeight + nDist ); + SwRect aFrm(FrameRA()); + aRectFnSet.SetHeight( aFrm, nFrameHeight + nDist ); + if( bChgPos && !IsVertLR() ) - FrameWA().Pos().X() -= nDist; + { + aFrm.Pos().X() -= nDist; + } + + setFrame(aFrm); bMoveAccFrame = true; } @@ -2330,9 +2410,15 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) // NEW TABLES ( !IsCellFrame() || static_cast<SwCellFrame*>(this)->GetLayoutRowSpan() > 1 ) ) { - aRectFnSet.SetHeight( FrameWA(), nFrameHeight + nReal ); + SwRect aFrm(FrameRA()); + aRectFnSet.SetHeight( aFrm, nFrameHeight + nReal ); + if( bChgPos && !IsVertLR() ) - FrameWA().Pos().X() = nFramePos - nReal; + { + aFrm.Pos().X() = nFramePos - nReal; + } + + setFrame(aFrm); bMoveAccFrame = true; } @@ -2432,9 +2518,15 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) SwTwips nRealDist = nReal; if ( !bTst ) { - aRectFnSet.SetHeight( FrameWA(), nFrameHeight - nReal ); + SwRect aFrm(FrameRA()); + aRectFnSet.SetHeight( aFrm, nFrameHeight - nReal ); + if( bChgPos && !IsVertLR() ) - FrameWA().Pos().X() += nReal; + { + aFrm.Pos().X() += nReal; + } + + setFrame(aFrm); bMoveAccFrame = true; } @@ -2452,10 +2544,15 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) nReal *= -1; if ( !bTst && IsBodyFrame() && nReal < nRealDist ) { - aRectFnSet.SetHeight( FrameWA(), aRectFnSet.GetHeight(FrameRA()) - + nRealDist - nReal ); + SwRect aFrm(FrameRA()); + aRectFnSet.SetHeight( aFrm, aRectFnSet.GetHeight(aFrm) + nRealDist - nReal ); + if( bChgPos && !IsVertLR() ) - FrameWA().Pos().X() += nRealDist - nReal; + { + aFrm.Pos().X() += nRealDist - nReal; + } + + setFrame(aFrm); OSL_ENSURE( !IsAccessibleFrame(), "bMoveAccFrame has to be set!" ); } } @@ -2465,10 +2562,15 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) SwTwips nTmp = GetUpper()->Shrink( nReal, bTst, bInfo ); if ( nTmp != nReal ) { - aRectFnSet.SetHeight( FrameWA(), aRectFnSet.GetHeight(FrameRA()) - + nReal - nTmp ); + SwRect aFrm(FrameRA()); + aRectFnSet.SetHeight( aFrm, aRectFnSet.GetHeight(aFrm) + nReal - nTmp ); + if( bChgPos && !IsVertLR() ) - FrameWA().Pos().X() += nTmp - nReal; + { + aFrm.Pos().X() += nTmp - nReal; + } + + setFrame(aFrm); OSL_ENSURE( !IsAccessibleFrame(), "bMoveAccFrame has to be set!" ); nReal = nTmp; } @@ -2775,7 +2877,9 @@ void SwLayoutFrame::ChgLowersProp( const Size& rOldSize ) // In horizontal layout set width of header, footer, // foot note container, foot note, body and no-text // frames to its upper width. - pLowerFrame->FrameWA().Width( PrintRA().Width() ); + SwRect aFrm(pLowerFrame->FrameRA()); + aFrm.Width( PrintRA().Width() ); + pLowerFrame->setFrame(aFrm); } else if( rOldSize.Width() && !pLowerFrame->IsFootnoteFrame() ) { @@ -2804,7 +2908,10 @@ void SwLayoutFrame::ChgLowersProp( const Size& rOldSize ) nNewWidth = (pLowerFrame->FrameRA().Width() * PrintRA().Width()) / rOldSize.Width(); } - pLowerFrame->FrameWA().Width( nNewWidth ); + + SwRect aFrm(pLowerFrame->FrameRA()); + aFrm.Width( nNewWidth ); + pLowerFrame->setFrame(aFrm); } } if ( bHeightChgd ) @@ -2816,7 +2923,9 @@ void SwLayoutFrame::ChgLowersProp( const Size& rOldSize ) // no-text frames to its upper height. // In horizontal layout set height of column frames // to its upper height. - pLowerFrame->FrameWA().Height( PrintRA().Height() ); + SwRect aFrm(pLowerFrame->FrameRA()); + aFrm.Height( PrintRA().Height() ); + pLowerFrame->setFrame(aFrm); } // OD 01.10.2002 #102211# // add conditions <!pLowerFrame->IsHeaderFrame()> and @@ -2872,7 +2981,10 @@ void SwLayoutFrame::ChgLowersProp( const Size& rOldSize ) "ChgLowersProg - negative height for lower."); nNewHeight = 0; } - pLowerFrame->FrameWA().Height( nNewHeight ); + + SwRect aFrm(pLowerFrame->FrameRA()); + aFrm.Height( nNewHeight ); + pLowerFrame->setFrame(aFrm); } } } @@ -2910,7 +3022,10 @@ void SwLayoutFrame::ChgLowersProp( const Size& rOldSize ) nSum == pLowerFrame->FrameRA().Height() ) nNewHeight = nSum; } - pLowerFrame->FrameWA().Height( nNewHeight ); + + SwRect aFrm(pLowerFrame->FrameRA()); + aFrm.Height( nNewHeight ); + pLowerFrame->setFrame(aFrm); } } } @@ -3298,8 +3413,10 @@ void SwLayoutFrame::FormatWidthCols( const SwBorderAttrs &rAttrs, long nTop = aRectFnSet.GetTopMargin(*this); // #i23129# - correction // to the calculated maximum height. - aRectFnSet.AddBottom( FrameWA(), nMaximum - - aRectFnSet.GetHeight(FrameRA()) ); + SwRect aFrm(FrameRA()); + aRectFnSet.AddBottom( aFrm, nMaximum - aRectFnSet.GetHeight(FrameRA()) ); + setFrame(aFrm); + if( nTop > nMaximum ) nTop = nMaximum; aRectFnSet.SetYMargins( *this, nTop, 0 ); @@ -3502,9 +3619,12 @@ void SwLayoutFrame::FormatWidthCols( const SwBorderAttrs &rAttrs, { Size aOldSz( PrintRA().SSize() ); long nTop = aRectFnSet.GetTopMargin(*this); - nDiff = aRectFnSet.GetHeight(PrintRA()) + nDiff + nBorder - - aRectFnSet.GetHeight(FrameRA()); - aRectFnSet.AddBottom( FrameWA(), nDiff ); + nDiff = aRectFnSet.GetHeight(PrintRA()) + nDiff + nBorder - aRectFnSet.GetHeight(FrameRA()); + + SwRect aFrm(FrameRA()); + aRectFnSet.AddBottom( aFrm, nDiff ); + setFrame(aFrm); + // #i68520# SwFlyFrame *pFlyFrame = dynamic_cast<SwFlyFrame*>(this); if (pFlyFrame) diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index 565d1be246d5..6830624b19c1 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -374,11 +374,19 @@ void SwTextFrame::AdjustFrame( const SwTwips nChgHght, bool bHasToFit ) if( aRectFnSet.BottomDist( pCont->FrameRA(), nBot ) > 0 ) { - aRectFnSet.AddBottom( FrameWA(), nChgHght ); + SwRect aFrm(FrameRA()); + aRectFnSet.AddBottom( aFrm, nChgHght ); + setFrame(aFrm); + if( aRectFnSet.IsVert() ) + { PrintWA().SSize().Width() += nChgHght; + } else + { PrintWA().SSize().Height() += nChgHght; + } + return; } } @@ -793,16 +801,23 @@ bool SwTextFrame::CalcPreps() } else if ( aRectFnSet.IsVert() ) { - FrameWA().Width( FrameRA().Width() + FrameRA().Left() ); + SwRect aFrm(FrameRA()); + aFrm.Width( aFrm.Width() + aFrm.Left() ); + aFrm.Left( 0 ); + setFrame(aFrm); + PrintWA().Width( PrintRA().Width() + FrameRA().Left() ); - FrameWA().Left( 0 ); SetWidow( true ); } else { SwTwips nTmp = TWIPS_MAX/2 - (FrameRA().Top()+10000); SwTwips nDiff = nTmp - FrameRA().Height(); - FrameWA().Height( nTmp ); + + SwRect aFrm(FrameRA()); + aFrm.Height( nTmp ); + setFrame(aFrm); + PrintWA().Height( PrintRA().Height() + nDiff ); SetWidow( true ); } @@ -1788,10 +1803,17 @@ void SwTextFrame::Format( vcl::RenderContext* pRenderContext, const SwBorderAttr if( pMaster ) pMaster->Prepare( PREP_FOLLOW_FOLLOWS ); SwTwips nMaxY = aRectFnSet.GetPrtBottom(*GetUpper()); + if( aRectFnSet.OverStep( FrameRA(), nMaxY ) ) + { aRectFnSet.SetLimit( *this, nMaxY ); + } else if( aRectFnSet.BottomDist( FrameRA(), nMaxY ) < 0 ) - aRectFnSet.AddBottom( FrameWA(), -aRectFnSet.GetHeight(FrameRA()) ); + { + SwRect aFrm(FrameRA()); + aRectFnSet.AddBottom( aFrm, -aRectFnSet.GetHeight(aFrm) ); + setFrame(aFrm); + } } else { diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index cfb3d1b111d4..4ab7fabbef81 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -103,8 +103,11 @@ void SwTextFrame::SwapWidthAndHeight() } const long nFrameWidth = FrameRA().Width(); - FrameWA().Width( FrameRA().Height() ); - FrameWA().Height( nFrameWidth ); + SwRect aFrm(FrameRA()); + aFrm.Width( aFrm.Height() ); + aFrm.Height( nFrameWidth ); + setFrame(aFrm); + const long nPrtWidth = PrintRA().Width(); PrintWA().Width( PrintRA().Height() ); PrintWA().Height( nPrtWidth ); @@ -1532,25 +1535,33 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid, switch( ePrep ) { - case PREP_MOVEFTN : FrameWA().Height(0); - PrintWA().Height(0); - InvalidatePrt_(); - InvalidateSize_(); - SAL_FALLTHROUGH; - case PREP_ADJUST_FRM : pPara->SetPrepAdjust(); - if( IsFootnoteNumFrame() != pPara->IsFootnoteNum() || - IsUndersized() ) - { - InvalidateRange( SwCharRange( 0, 1 ), 1); - if( GetOfst() && !IsFollow() ) - SetOfst_( 0 ); - } - break; - case PREP_MUST_FIT : pPara->SetPrepMustFit(true); - SAL_FALLTHROUGH; - case PREP_WIDOWS_ORPHANS : pPara->SetPrepAdjust(); - break; + case PREP_MOVEFTN : + { + SwRect aFrm(FrameRA()); + aFrm.Height(0); + setFrame(aFrm); + } + PrintWA().Height(0); + InvalidatePrt_(); + InvalidateSize_(); + SAL_FALLTHROUGH; + case PREP_ADJUST_FRM : + pPara->SetPrepAdjust(); + if( IsFootnoteNumFrame() != pPara->IsFootnoteNum() || + IsUndersized() ) + { + InvalidateRange( SwCharRange( 0, 1 ), 1); + if( GetOfst() && !IsFollow() ) + SetOfst_( 0 ); + } + break; + case PREP_MUST_FIT : + pPara->SetPrepMustFit(true); + SAL_FALLTHROUGH; + case PREP_WIDOWS_ORPHANS : + pPara->SetPrepAdjust(); + break; case PREP_WIDOWS : // MustFit is stronger than anything else if( pPara->IsPrepMustFit() ) @@ -1862,14 +1873,19 @@ SwTestFormat::SwTestFormat( SwTextFrame* pTextFrame, const SwFrame* pPre, SwTwip SwRectFnSet aRectFnSet(pFrame); SwTwips nLower = aRectFnSet.GetBottomMargin(*pFrame); - pFrame->FrameWA() = pFrame->GetUpper()->PrintRA(); - pFrame->FrameWA() += pFrame->GetUpper()->FrameRA().Pos(); + SwRect aFrm(pFrame->FrameRA()); + aFrm = pFrame->GetUpper()->PrintRA(); + aFrm += pFrame->GetUpper()->FrameRA().Pos(); + aRectFnSet.SetHeight( aFrm, nMaxHeight ); - aRectFnSet.SetHeight( pFrame->FrameWA(), nMaxHeight ); if( pFrame->GetPrev() ) - aRectFnSet.SetPosY( pFrame->FrameWA(), - aRectFnSet.GetBottom(pFrame->GetPrev()->FrameRA()) - - ( aRectFnSet.IsVert() ? nMaxHeight + 1 : 0 ) ); + { + aRectFnSet.SetPosY( + aFrm, + aRectFnSet.GetBottom(pFrame->GetPrev()->FrameRA()) - ( aRectFnSet.IsVert() ? nMaxHeight + 1 : 0 ) ); + } + + pFrame->setFrame(aFrm); SwBorderAttrAccess aAccess( SwFrame::GetCache(), pFrame ); const SwBorderAttrs &rAttrs = *aAccess.Get(); @@ -1907,7 +1923,10 @@ SwTestFormat::SwTestFormat( SwTextFrame* pTextFrame, const SwFrame* pPre, SwTwip SwTestFormat::~SwTestFormat() { - pFrame->FrameWA() = aOldFrame; + SwRect aFrm(pFrame->FrameRA()); + aFrm = aOldFrame; + pFrame->setFrame(aFrm); + pFrame->PrintWA() = aOldPrt; pFrame->SetPara( pOldPara ); } @@ -2118,12 +2137,17 @@ SwTwips SwTextFrame::CalcFitToContent() pPage->PrintRA().Height() : pPage->PrintRA().Width(); - FrameWA().Width( nPageWidth ); + SwRect aFrm(FrameRA()); + aFrm.Width( nPageWidth ); + setFrame(aFrm); + PrintWA().Width( nPageWidth ); // i#25422 objects anchored as character in RTL if ( IsRightToLeft() ) - FrameWA().Pos().X() += nOldFrameWidth - nPageWidth; + { + aFrm.Pos().X() += nOldFrameWidth - nPageWidth; + } TextFrameLockGuard aLock( this ); @@ -2133,16 +2157,17 @@ SwTwips SwTextFrame::CalcFitToContent() SwHookOut aHook( aInf ); // i#54031 - assure mininum of MINLAY twips. - const SwTwips nMax = std::max( (SwTwips)MINLAY, - aLine.CalcFitToContent_() + 1 ); - - FrameWA().Width( nOldFrameWidth ); + const SwTwips nMax = std::max( (SwTwips)MINLAY, aLine.CalcFitToContent_() + 1 ); + aFrm.Width( nOldFrameWidth ); PrintWA().Width( nOldPrtWidth ); // i#25422 objects anchored as character in RTL if ( IsRightToLeft() ) - FrameWA().Pos() = aOldFramePos; + { + aFrm.Pos() = aOldFramePos; + } + setFrame(aFrm); SetPara( pOldPara ); return nMax; |