[Libreoffice-commits] core.git: Branch 'feature/RotateFlyFrame' - 206 commits - basctl/source basegfx/source basic/source bean/native bin/gbuild-to-ide bin/gbuild-to-ideNS bridges/source canvas/source chart2/qa chart2/source comphelper/source compilerplugins/clang configure.ac connectivity/source cppcanvas/source cppuhelper/source cui/source dbaccess/source desktop/source dictionaries drawinglayer/source dtrans/source editeng/source embeddedobj/source embedserv/source emfio/inc emfio/source extensions/source external/coinmp external/curl external/firebird external/gpgme external/icu external/libabw external/libassuan external/libcdr external/libebook external/libepubgen external/libetonyek external/libfreehand external/libgpg-error external/libmspub external/libmwaw external/libodfgen external/liborcus external/libpagemaker external/libqxp external/librevenge external/libstaroffice external/libvisio external/libwpd external/libwpg external/libwps external/libxslt external/libzmf external/nss exte rnal/redland filter/source formula/source fpicker/source framework/source helpcontent2 hwpfilter/source i18nlangtag/source i18npool/inc i18npool/source i18npool/util include/LibreOfficeKit include/o3tl include/sal include/sfx2 include/svl include/svx include/systools include/tools include/unotools include/vcl ios/LibreOfficeKit ios/LibreOfficeLight jurt/source libreofficekit/qa o3tl/CppunitTest_o3tl_tests.mk o3tl/qa odk/source offapi/com offapi/UnoApi_offapi.mk oox/source pyuno/zipcore README.md reportdesign/source RepositoryExternal.mk sal/osl scaddins/source sc/inc sc/qa sc/source sc/uiconfig sdext/source sd/qa sd/source setup_native/source sfx2/sdi sfx2/source shell/inc shell/qa shell/source slideshow/source solenv/gbuild starmath/source svl/source svtools/source svx/source svx/uiconfig sw/inc sw/qa sw/source toolkit/source tools/source ucb/source unotools/source uui/source vcl/inc vcl/opengl vcl/qa vcl/source vcl/unx vcl/win winaccessibility/inc winaccessibility/source wizards/s ource xmloff/inc xmloff/source xmlsecurity/source
Armin Le Grand
Armin.Le.Grand at cib.de
Sun Oct 29 23:36:45 UTC 2017
Rebased ref, commits from common ancestor:
commit a00d1d912fba487aec398b235568ebdf02871d8a
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date: Fri Oct 27 12:39:00 2017 +0200
RotateFlyFrame: Moved change executers to cxx
Moved SwFrameRect::FrameWriteAccess::~FrameWriteAccess()
and SwFrameRect::PrintWriteAccess::~PrintWriteAccess() to
implementation side and added compare op's for SwRcet to
write only if needed
Change-Id: I85d0e61009116f4b17d1ce0337e3f0d2cc031159
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index e57c2af0617b..a46a50bf8326 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -149,7 +149,7 @@ public:
public:
FrameWriteAccess(SwFrameRect& rTarget) : SwRect(rTarget.getSwFrame()), mrTarget(rTarget) {}
~FrameWriteAccess();
- void setSwRect(const SwRect& rNew) { *(reinterpret_cast< SwRect* >(this)) = rNew; }
+ void setSwRect(const SwRect& rNew) { *reinterpret_cast< SwRect* >(this) = rNew; }
};
// same for print
@@ -164,7 +164,7 @@ public:
public:
PrintWriteAccess(SwFrameRect& rTarget) : SwRect(rTarget.getSwPrint()), mrTarget(rTarget) {}
~PrintWriteAccess();
- void setSwRect(const SwRect& rNew) { *(reinterpret_cast< SwRect* >(this)) = rNew; }
+ void setSwRect(const SwRect& rNew) { *reinterpret_cast< SwRect* >(this) = rNew; }
};
};
commit 867bdab007c52f1d6e741410ac92e2ce56c5aa67
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date: Fri Oct 27 12:39:00 2017 +0200
RotateFlyFrame: Moved change executers to cxx
Moved SwFrameRect::FrameWriteAccess::~FrameWriteAccess()
and SwFrameRect::PrintWriteAccess::~PrintWriteAccess() to
implementation side and added compare op's for SwRcet to
write only if needed
Change-Id: I85d0e61009116f4b17d1ce0337e3f0d2cc031159
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index cfe5589a10b1..e57c2af0617b 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -148,7 +148,7 @@ public:
public:
FrameWriteAccess(SwFrameRect& rTarget) : SwRect(rTarget.getSwFrame()), mrTarget(rTarget) {}
- ~FrameWriteAccess() { mrTarget.maFrameRect = *this; }
+ ~FrameWriteAccess();
void setSwRect(const SwRect& rNew) { *(reinterpret_cast< SwRect* >(this)) = rNew; }
};
@@ -163,7 +163,7 @@ public:
public:
PrintWriteAccess(SwFrameRect& rTarget) : SwRect(rTarget.getSwPrint()), mrTarget(rTarget) {}
- ~PrintWriteAccess() { mrTarget.maPrintRect = *this; }
+ ~PrintWriteAccess();
void setSwRect(const SwRect& rNew) { *(reinterpret_cast< SwRect* >(this)) = rNew; }
};
};
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 1c301a161d2f..40ffaa5d0eec 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -59,6 +59,22 @@ SwFrameRect::SwFrameRect()
{
}
+SwFrameRect::FrameWriteAccess::~FrameWriteAccess()
+{
+ if(mrTarget.maFrameRect != *this)
+ {
+ mrTarget.maFrameRect = *this;
+ }
+}
+
+SwFrameRect::PrintWriteAccess::~PrintWriteAccess()
+{
+ if(mrTarget.maPrintRect != *this)
+ {
+ mrTarget.maPrintRect = *this;
+ }
+}
+
SwFrame::SwFrame( SwModify *pMod, SwFrame* pSib )
: SwFrameRect(),
SwClient( pMod ),
commit 55e2f79275bf0853d2dfa0e4e354950118f0439b
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date: Thu Oct 26 14:55:41 2017 +0200
RotateFlyFrame: Adapted to get methods and WriteAccess helpers
Change-Id: Ife3c1b2391ad7beae8c7f31f796b1454709ddd26
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index c126267190cb..18fa63ca2b99 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -480,9 +480,8 @@ void SwNoTextFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
if ( !mbValidSize )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.Width( GetUpper()->getSwPrint().Width() );
- setSwFrame(aFrm);
}
MakePrtArea( rAttrs );
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index a278cad455b8..7918f5388c63 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -836,9 +836,8 @@ static void lcl_NotifyNeighbours( const SdrMarkList *pLst )
{
bCheckNeighbours = true;
pFly->InvalidatePos();
- SwRect aFrm(pFly->getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*pFly);
aFrm.Pos().Y() += 1;
- pFly->setSwFrame(aFrm);
}
pPage = pFly->FindPageFrame();
@@ -884,9 +883,8 @@ static void lcl_NotifyNeighbours( const SdrMarkList *pLst )
pAct->getSwFrame().Bottom() >= aRect.Top() )
{
pAct->InvalidatePos();
- SwRect aFrm(pAct->getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*pAct);
aFrm.Pos().Y() += 1;
- pAct->setSwFrame(aFrm);
}
}
}
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index e8f3579a6866..cfe5589a10b1 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -133,9 +133,39 @@ public:
const SwRect& getSwFrame() const { return maFrameRect; }
const SwRect& getSwPrint() const { return maPrintRect; }
- // set methods - only way allowed to change these, see above
- void setSwFrame(const SwRect& rNew) { maFrameRect = rNew; }
- void setSwPrint(const SwRect& rNew) { maPrintRect = rNew; }
+ // helper class(es) for FrameRect/PrintRect manipulation. These
+ // have to be used to apply changes. They hold a copy of the SwRect
+ // for manipulation, it gets written back at destruction. Thus this
+ // mechanism depends on scope usage, take care. It prevents errors using
+ // different instances of SwFrame in get/set methods which is more safe
+ class FrameWriteAccess : public SwRect
+ {
+ private:
+ SwFrameRect& mrTarget;
+
+ FrameWriteAccess(const FrameWriteAccess&) = delete;
+ FrameWriteAccess& operator=(const FrameWriteAccess&) = delete;
+
+ public:
+ FrameWriteAccess(SwFrameRect& rTarget) : SwRect(rTarget.getSwFrame()), mrTarget(rTarget) {}
+ ~FrameWriteAccess() { mrTarget.maFrameRect = *this; }
+ void setSwRect(const SwRect& rNew) { *(reinterpret_cast< SwRect* >(this)) = rNew; }
+ };
+
+ // same for print
+ class PrintWriteAccess : public SwRect
+ {
+ private:
+ SwFrameRect& mrTarget;
+
+ PrintWriteAccess(const PrintWriteAccess&) = delete;
+ PrintWriteAccess& operator=(const PrintWriteAccess&) = delete;
+
+ public:
+ PrintWriteAccess(SwFrameRect& rTarget) : SwRect(rTarget.getSwPrint()), mrTarget(rTarget) {}
+ ~PrintWriteAccess() { mrTarget.maPrintRect = *this; }
+ void setSwRect(const SwRect& rNew) { *(reinterpret_cast< SwRect* >(this)) = rNew; }
+ };
};
/**
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index bbd0bd7cf9e3..09b6a56793ac 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -500,7 +500,7 @@ void SwFrame::MakePos()
SwRectFnSet aRectFnSet((IsCellFrame() && GetUpper() ? GetUpper() : this));
if ( !bUseUpper && pPrv )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.Pos( pPrv->getSwFrame().Pos() );
if( FRM_NEIGHBOUR & nMyType )
@@ -544,8 +544,6 @@ void SwFrame::MakePos()
{
aFrm.Pos().setY(aFrm.Pos().getY() + pPrv->getSwFrame().Height());
}
-
- setSwFrame(aFrm);
}
else if ( GetUpper() )
{
@@ -571,7 +569,7 @@ void SwFrame::MakePos()
pPrv = lcl_Prev( this, false );
if ( !bUseUpper && pPrv )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.Pos( pPrv->getSwFrame().Pos() );
if( FRM_NEIGHBOUR & nMyType )
@@ -608,12 +606,10 @@ void SwFrame::MakePos()
{
aFrm.Pos().setY(aFrm.Pos().getY() + pPrv->getSwFrame().Height());
}
-
- setSwFrame(aFrm);
}
else
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.Pos( GetUpper()->getSwFrame().Pos() );
if( GetUpper()->IsFlyFrame() )
@@ -640,24 +636,21 @@ void SwFrame::MakePos()
{
aFrm.Pos().setX(aFrm.Pos().getX() - aFrm.Width() + GetUpper()->getSwPrint().Width());
}
-
- setSwFrame(aFrm);
}
}
else
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.Pos().setX(0);
aFrm.Pos().setY(0);
- setSwFrame(aFrm);
}
if( IsBodyFrame() && aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() && !mbReverse && GetUpper() )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.Pos().setX(aFrm.Pos().getX() + GetUpper()->getSwPrint().Width() - aFrm.Width());
- setSwFrame(aFrm);
}
+
mbValidPos = true;
}
}
@@ -780,17 +773,15 @@ void SwPageFrame::MakeAll(vcl::RenderContext* pRenderContext)
{
if ( IsEmptyPage() )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.Width( 0 );
aFrm.Width( 0 );
- setSwFrame(aFrm);
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aPrt.Height( 0 );
aPrt.Height( 0 );
aPrt.Left( 0 );
aPrt.Top( 0 );
- setSwPrint(aPrt);
mbValidSize = mbValidPrtArea = true;
}
@@ -819,39 +810,41 @@ void SwPageFrame::MakeAll(vcl::RenderContext* pRenderContext)
nWidth += + 2 * aBorder.Width();
nWidth = std::max( nWidth, 2L * aBorder.Width() + 4*MM50 );
- SwRect aFrm(getSwFrame());
- aFrm.Width( nWidth );
-
- SwLayoutFrame *pBody = FindBodyCont();
- if ( pBody && pBody->Lower() && pBody->Lower()->IsColumnFrame() )
{
- // Columns have a fixed height
- aFrm.Height( pAttrs->GetSize().Height() );
- }
- else
- {
- // In pages without columns, the content defines the size.
- long nBot = GetContentHeight(nTop, nBottom);
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aFrm.Width( nWidth );
- // #i35143# - If second page frame
- // exists, the first page doesn't have to fulfill the
- // visible area.
- if ( !GetPrev() && !GetNext() )
+ SwLayoutFrame *pBody = FindBodyCont();
+ if ( pBody && pBody->Lower() && pBody->Lower()->IsColumnFrame() )
+ {
+ // Columns have a fixed height
+ aFrm.Height( pAttrs->GetSize().Height() );
+ }
+ else
{
- nBot = std::max( nBot, pSh->VisArea().Height() );
+ // In pages without columns, the content defines the size.
+ long nBot = GetContentHeight(nTop, nBottom);
+
+ // #i35143# - If second page frame
+ // exists, the first page doesn't have to fulfill the
+ // visible area.
+ if ( !GetPrev() && !GetNext() )
+ {
+ nBot = std::max( nBot, pSh->VisArea().Height() );
+ }
+ // #i35143# - Assure, that the page
+ // doesn't exceed the defined browse height.
+ aFrm.Height( std::min( nBot, BROWSE_HEIGHT ) );
}
- // #i35143# - Assure, that the page
- // doesn't exceed the defined browse height.
- aFrm.Height( std::min( nBot, BROWSE_HEIGHT ) );
}
- setSwFrame(aFrm);
- SwRect aPrt(getSwPrint());
- aPrt.Left ( pAttrs->CalcLeftLine() + aBorder.Width() );
- aPrt.Top ( nTop );
- aPrt.Width( getSwFrame().Width() - ( aPrt.Left() + pAttrs->CalcRightLine() + aBorder.Width() ) );
- aPrt.Height( getSwFrame().Height() - (nTop + nBottom) );
- setSwPrint(aPrt);
+ {
+ SwFrameRect::PrintWriteAccess aPrt(*this);
+ aPrt.Left ( pAttrs->CalcLeftLine() + aBorder.Width() );
+ aPrt.Top ( nTop );
+ aPrt.Width( getSwFrame().Width() - ( aPrt.Left() + pAttrs->CalcRightLine() + aBorder.Width() ) );
+ aPrt.Height( getSwFrame().Height() - (nTop + nBottom) );
+ }
mbValidSize = mbValidPrtArea = true;
continue;
@@ -874,12 +867,9 @@ void SwPageFrame::MakeAll(vcl::RenderContext* pRenderContext)
if (height > 0)
{
ChgSize(Size(getSwFrame().Width(), height));
-
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aPrt.Top(0);
aPrt.Height(height);
- setSwPrint(aPrt);
-
mbValidSize = mbValidPrtArea = true;
continue;
}
@@ -893,9 +883,8 @@ void SwPageFrame::MakeAll(vcl::RenderContext* pRenderContext)
// the attribute.
//FIXME: This resets the size when (mbValidSize && !mbValidPrtArea).
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.SSize( pAttrs->GetSize() );
- setSwFrame(aFrm);
}
Format( pRenderContext, pAttrs );
}
@@ -958,7 +947,7 @@ void SwLayoutFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
}
const long nDiff = nPrtWidth - (getSwFrame().*fnRect->fnGetWidth)();
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
if( IsNeighbourFrame() && IsRightToLeft() )
{
@@ -968,8 +957,6 @@ void SwLayoutFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
{
(aFrm.*fnRect->fnAddRight)( nDiff );
}
-
- setSwFrame(aFrm);
}
else
{
@@ -1045,12 +1032,13 @@ bool SwContentFrame::MakePrtArea( const SwBorderAttrs &rAttrs )
static_cast<SwTextFrame*>(this)->HideHidden();
}
- SwRect aPrt(getSwPrint());
- aPrt.Pos().setX(0);
- aPrt.Pos().setY(0);
- aRectFnSet.SetWidth( aPrt, aRectFnSet.GetWidth(getSwFrame()) );
- aRectFnSet.SetHeight( aPrt, 0 );
- setSwPrint(aPrt);
+ {
+ SwFrameRect::PrintWriteAccess aPrt(*this);
+ aPrt.Pos().setX(0);
+ aPrt.Pos().setY(0);
+ aRectFnSet.SetWidth( aPrt, aRectFnSet.GetWidth(getSwFrame()) );
+ aRectFnSet.SetHeight( aPrt, 0 );
+ }
nUpper = -( aRectFnSet.GetHeight(getSwFrame()) );
}
@@ -1102,16 +1090,15 @@ bool SwContentFrame::MakePrtArea( const SwBorderAttrs &rAttrs )
nWidth -= rAttrs.CalcRightLine();
nWidth = std::max( nMinWidth, nWidth );
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aRectFnSet.SetWidth( aPrt, std::min( nWidth, aRectFnSet.GetWidth(aPrt) ) );
- setSwPrint(aPrt);
}
if ( aRectFnSet.GetWidth(getSwPrint()) <= MINLAY )
{
// The PrtArea should already be at least MINLAY wide, matching the
// minimal values of the UI
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aRectFnSet.SetWidth( aPrt, std::min( long(MINLAY), aRectFnSet.GetWidth(getSwFrame()) ) );
SwTwips nTmp = aRectFnSet.GetWidth(getSwFrame()) - aRectFnSet.GetWidth(aPrt);
@@ -1119,8 +1106,6 @@ bool SwContentFrame::MakePrtArea( const SwBorderAttrs &rAttrs )
{
aRectFnSet.SetLeft( aPrt, nTmp );
}
-
- setSwPrint(aPrt);
}
// The following rules apply for VarSize:
@@ -1143,9 +1128,10 @@ bool SwContentFrame::MakePrtArea( const SwBorderAttrs &rAttrs )
nLower=0;
}
- SwRect aPrt(getSwPrint());
- aRectFnSet.SetPosY( aPrt, (!aRectFnSet.IsVert() || mbReverse) ? nUpper : nLower);
- setSwPrint(aPrt);
+ {
+ SwFrameRect::PrintWriteAccess aPrt(*this);
+ aRectFnSet.SetPosY( aPrt, (!aRectFnSet.IsVert() || mbReverse) ? nUpper : nLower);
+ }
nUpper += nLower;
nUpper -= aRectFnSet.GetHeight(getSwFrame()) - aRectFnSet.GetHeight(getSwPrint());
@@ -1389,9 +1375,10 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
mbValidPrtArea = false;
}
- SwRect aFrm(getSwFrame());
- aRectFnSet.SetWidth( aFrm, nNewFrameWidth );
- setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aRectFnSet.SetWidth( aFrm, nNewFrameWidth );
+ }
// When a lower of a vertically aligned fly frame changes its size we need to recalculate content pos.
if( GetUpper() && GetUpper()->IsFlyFrame() &&
@@ -1518,9 +1505,10 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
Prepare( PREP_POS_CHGD, static_cast<const void*>(&bFormatted), false );
if ( !mbValidSize )
{
- SwRect aFrm(getSwFrame());
- aRectFnSet.SetWidth( aFrm, aRectFnSet.GetWidth(GetUpper()->getSwPrint()) );
- setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aRectFnSet.SetWidth( aFrm, aRectFnSet.GetWidth(GetUpper()->getSwPrint()) );
+ }
if ( !mbValidPrtArea )
{
@@ -1879,7 +1867,7 @@ void MakeNxt( SwFrame *pFrame, SwFrame *pNxt )
const SwBorderAttrs &rAttrs = *aAccess.Get();
if ( !pNxt->GetValidSizeFlag() )
{
- SwRect aFrm(pNxt->getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*pNxt);
if( pNxt->IsVertical() )
{
@@ -1889,8 +1877,6 @@ void MakeNxt( SwFrame *pFrame, SwFrame *pNxt )
{
aFrm.Width( pNxt->GetUpper()->getSwPrint().Width() );
}
-
- pNxt->setSwFrame(aFrm);
}
static_cast<SwContentFrame*>(pNxt)->MakePrtArea( rAttrs );
pNxt->Format( pNxt->getRootFrame()->GetCurrShell()->GetOut(), &rAttrs );
@@ -1902,7 +1888,7 @@ void MakeNxt( SwFrame *pFrame, SwFrame *pNxt )
const SwBorderAttrs &rAttrs = *aAccess.Get();
if ( !pNxt->GetValidSizeFlag() )
{
- SwRect aFrm(pNxt->getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*pNxt);
if( pNxt->IsVertical() )
{
@@ -1912,8 +1898,6 @@ void MakeNxt( SwFrame *pFrame, SwFrame *pNxt )
{
aFrm.Width( pNxt->GetUpper()->getSwPrint().Width() );
}
-
- pNxt->setSwFrame(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 3f319f69aeae..8e425948d0c6 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -129,10 +129,11 @@ SwFlyFrame::SwFlyFrame( SwFlyFrameFormat *pFormat, SwFrame* pSib, SwFrame *pAnch
mbRightToLeft = false;
}
- SwRect aFrm(getSwFrame());
- aFrm.Width( rFrameSize.GetWidth() );
- aFrm.Height( rFrameSize.GetHeightSizeType() == ATT_VAR_SIZE ? MINFLY : rFrameSize.GetHeight() );
- setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aFrm.Width( rFrameSize.GetWidth() );
+ aFrm.Height( rFrameSize.GetHeightSizeType() == ATT_VAR_SIZE ? MINFLY : rFrameSize.GetHeight() );
+ }
// Fixed or variable Height?
if ( rFrameSize.GetHeightSizeType() == ATT_MIN_SIZE )
@@ -153,9 +154,9 @@ SwFlyFrame::SwFlyFrame( SwFlyFrameFormat *pFormat, SwFrame* pSib, SwFrame *pAnch
InsertCnt();
// Put it somewhere outside so that out document is not formatted unnecessarily often
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.Pos().setX(FAR_AWAY);
aFrm.Pos().setY(FAR_AWAY);
- setSwFrame(aFrm);
}
void SwFlyFrame::Chain( SwFrame* _pAnch )
@@ -227,10 +228,11 @@ void SwFlyFrame::InsertColumns()
{
// Start off PrtArea to be as large as Frame, so that we can put in the columns
// properly. It'll adjust later on.
- SwRect aPrt(getSwPrint());
- aPrt.Width( getSwFrame().Width() );
- aPrt.Height( getSwFrame().Height() );
- setSwPrint(aPrt);
+ {
+ SwFrameRect::PrintWriteAccess aPrt(*this);
+ aPrt.Width( getSwFrame().Width() );
+ aPrt.Height( getSwFrame().Height() );
+ }
const SwFormatCol aOld; // ChgColumns() also needs an old value passed
ChgColumns( aOld, rCol );
@@ -557,18 +559,21 @@ bool SwFlyFrame::FrameSizeChg( const SwFormatFrameSize &rFrameSize )
const SwRect aOld( GetObjRectWithSpaces() );
const Size aOldSz( getSwPrint().SSize() );
const SwTwips nDiffWidth = getSwFrame().Width() - rFrameSize.GetWidth();
- SwRect aFrm(getSwFrame());
- aFrm.Height( aFrm.Height() - nDiffHeight );
- aFrm.Width ( aFrm.Width() - nDiffWidth );
- setSwFrame(aFrm);
+
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aFrm.Height( aFrm.Height() - nDiffHeight );
+ aFrm.Width ( aFrm.Width() - nDiffWidth );
+ }
// #i68520#
InvalidateObjRectWithSpaces();
- SwRect aPrt(getSwPrint());
- aPrt.Height( aPrt.Height() - nDiffHeight );
- aPrt.Width ( aPrt.Width() - nDiffWidth );
- setSwPrint(aPrt);
+ {
+ SwFrameRect::PrintWriteAccess aPrt(*this);
+ aPrt.Height( aPrt.Height() - nDiffHeight );
+ aPrt.Width ( aPrt.Width() - nDiffWidth );
+ }
ChgLowersProp( aOldSz );
::Notify( this, FindPageFrame(), aOld );
@@ -1166,10 +1171,11 @@ void SwFlyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA
if ( getSwFrame().Top() == FAR_AWAY && getSwFrame().Left() == FAR_AWAY )
{
// Remove safety switch (see SwFrame::CTor)
- SwRect aFrm(getSwFrame());
- aFrm.Pos().setX(0);
- aFrm.Pos().setY(0);
- setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aFrm.Pos().setX(0);
+ aFrm.Pos().setY(0);
+ }
// #i68520#
InvalidateObjRectWithSpaces();
@@ -1209,15 +1215,17 @@ void SwFlyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA
if ( nRemaining < MINFLY )
nRemaining = MINFLY;
- SwRect aPrt(getSwPrint());
- aRectFnSet.SetHeight( aPrt, nRemaining );
- setSwPrint(aPrt);
+ {
+ SwFrameRect::PrintWriteAccess aPrt(*this);
+ aRectFnSet.SetHeight( aPrt, nRemaining );
+ }
nRemaining -= aRectFnSet.GetHeight(getSwFrame());
- SwRect aFrm(getSwFrame());
- aRectFnSet.AddBottom( aFrm, nRemaining + nUL );
- setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aRectFnSet.AddBottom( aFrm, nRemaining + nUL );
+ }
// #i68520#
if ( nRemaining + nUL != 0 )
@@ -1249,15 +1257,17 @@ void SwFlyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA
if( nNewSize < MINFLY )
nNewSize = MINFLY;
- SwRect aPrt(getSwPrint());
- aRectFnSet.SetHeight( aPrt, nNewSize );
- setSwPrint(aPrt);
+ {
+ SwFrameRect::PrintWriteAccess aPrt(*this);
+ aRectFnSet.SetHeight( aPrt, nNewSize );
+ }
nNewSize += nUL - aRectFnSet.GetHeight(getSwFrame());
- SwRect aFrm(getSwFrame());
- aRectFnSet.AddBottom( aFrm, nNewSize );
- setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aRectFnSet.AddBottom( aFrm, nNewSize );
+ }
// #i68520#
if ( nNewSize != 0 )
@@ -1289,15 +1299,17 @@ void SwFlyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA
if( nNewSize < MINFLY )
nNewSize = MINFLY;
- SwRect aPrt(getSwPrint());
- aRectFnSet.SetWidth( aPrt, nNewSize );
- setSwPrint(aPrt);
+ {
+ SwFrameRect::PrintWriteAccess aPrt(*this);
+ aRectFnSet.SetWidth( aPrt, nNewSize );
+ }
nNewSize += nLR - aRectFnSet.GetWidth(getSwFrame());
- SwRect aFrm(getSwFrame());
- aRectFnSet.AddRight( aFrm, nNewSize );
- setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aRectFnSet.AddRight( aFrm, nNewSize );
+ }
// #i68520#
if ( nNewSize != 0 )
@@ -1643,11 +1655,12 @@ void SwFlyFrame::MakeObjPos()
// update relative position
SetCurrRelPos( aObjPositioning.GetRelPos() );
- SwRectFnSet aRectFnSet(GetAnchorFrame());
- SwRect aFrm(getSwFrame());
- aFrm.Pos( aObjPositioning.GetRelPos() );
- aFrm.Pos() += aRectFnSet.GetPos(GetAnchorFrame()->getSwFrame());
- setSwFrame(aFrm);
+ {
+ SwRectFnSet aRectFnSet(GetAnchorFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aFrm.Pos( aObjPositioning.GetRelPos() );
+ aFrm.Pos() += aRectFnSet.GetPos(GetAnchorFrame()->getSwFrame());
+ }
// #i69335#
InvalidateObjRectWithSpaces();
@@ -1841,9 +1854,10 @@ SwTwips SwFlyFrame::Shrink_( SwTwips nDist, bool bTst )
{
SwRect aOld( GetObjRectWithSpaces() );
- SwRect aFrm(getSwFrame());
- aRectFnSet.SetHeight( aFrm, nHeight - nVal );
- setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aRectFnSet.SetHeight( aFrm, nHeight - nVal );
+ }
// #i68520#
if ( nHeight - nVal != 0 )
@@ -1853,9 +1867,10 @@ SwTwips SwFlyFrame::Shrink_( SwTwips nDist, bool bTst )
nHeight = aRectFnSet.GetHeight(getSwPrint());
- SwRect aPrt(getSwPrint());
- aRectFnSet.SetHeight( aPrt, nHeight - nVal );
- setSwPrint(aPrt);
+ {
+ SwFrameRect::PrintWriteAccess aPrt(*this);
+ aRectFnSet.SetHeight( aPrt, nHeight - nVal );
+ }
InvalidatePos_();
InvalidateSize();
@@ -2555,20 +2570,16 @@ const SwRect SwFlyFrame::GetObjBoundRect() const
bool SwFlyFrame::SetObjTop_( const SwTwips _nTop )
{
const bool bChanged( getSwFrame().Pos().getY() != _nTop );
- SwRect aFrm(getSwFrame());
-
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.Pos().setY(_nTop);
- setSwFrame(aFrm);
return bChanged;
}
bool SwFlyFrame::SetObjLeft_( const SwTwips _nLeft )
{
const bool bChanged( getSwFrame().Pos().getX() != _nLeft );
- SwRect aFrm(getSwFrame());
-
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.Pos().setX(_nLeft);
- setSwFrame(aFrm);
return bChanged;
}
diff --git a/sw/source/core/layout/flyincnt.cxx b/sw/source/core/layout/flyincnt.cxx
index ec28f3bdbdca..6544bad582ab 100644
--- a/sw/source/core/layout/flyincnt.cxx
+++ b/sw/source/core/layout/flyincnt.cxx
@@ -74,9 +74,10 @@ void SwFlyInContentFrame::SetRefPoint( const Point& rPoint,
SetCurrRelPos( rRelAttr );
SwRectFnSet aRectFnSet(GetAnchorFrame());
- SwRect aFrm(getSwFrame());
- aRectFnSet.SetPos( aFrm, rPoint + rRelPos );
- setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aRectFnSet.SetPos( aFrm, rPoint + rRelPos );
+ }
// #i68520#
InvalidateObjRectWithSpaces();
@@ -262,10 +263,8 @@ void SwFlyInContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
if ( getSwFrame().Left() == (pFrame->getSwFrame().Left()+pFrame->getSwPrint().Left()) &&
getSwFrame().Width() > pFrame->getSwPrint().Width() )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.Width( pFrame->getSwPrint().Width() );
- setSwFrame(aFrm);
-
mbValidPrtArea = false;
m_bWidthClipped = true;
}
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index a93ce3d1350e..9226ee283336 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -297,9 +297,11 @@ void SwFlyFreeFrame::CheckClip( const SwFormatFrameSize &rSz )
if ( !pHeader || !pHeader->IsHeaderFrame() )
{
const long nOld = getSwFrame().Top();
- SwRect aFrm(getSwFrame());
- aFrm.Pos().Y() = std::max( aClip.Top(), nClipBot - aFrm.Height() );
- setSwFrame(aFrm);
+
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aFrm.Pos().Y() = std::max( aClip.Top(), nClipBot - aFrm.Height() );
+ }
if ( getSwFrame().Top() != nOld )
{
@@ -312,9 +314,11 @@ void SwFlyFreeFrame::CheckClip( const SwFormatFrameSize &rSz )
if ( bRig )
{
const long nOld = getSwFrame().Left();
- SwRect aFrm(getSwFrame());
- aFrm.Pos().X() = std::max( aClip.Left(), nClipRig - aFrm.Width() );
- setSwFrame(aFrm);
+
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aFrm.Pos().X() = std::max( aClip.Left(), nClipRig - aFrm.Width() );
+ }
if ( getSwFrame().Left() != nOld )
{
@@ -323,9 +327,8 @@ void SwFlyFreeFrame::CheckClip( const SwFormatFrameSize &rSz )
// are avoiding another one.
if( rH.GetHoriOrient() == text::HoriOrientation::LEFT )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.Pos().X() = nOld;
- setSwFrame(aFrm);
}
else
{
@@ -436,19 +439,23 @@ void SwFlyFreeFrame::CheckClip( const SwFormatFrameSize &rSz )
const long nPrtWidthDiff = getSwFrame().Width() - getSwPrint().Width();
maUnclippedFrame = getSwFrame();
- SwRect aFrm(getSwFrame());
- aFrm.Height( aFrameRect.Height() );
- aFrm.Width ( std::max( long(MINLAY), aFrameRect.Width() ) );
- setSwFrame(aFrm);
-
- SwRect aPrt(getSwPrint());
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aFrm.Height( aFrameRect.Height() );
+ aFrm.Width ( std::max( long(MINLAY), aFrameRect.Width() ) );
+ }
if ( Lower() && Lower()->IsColumnFrame() )
{
ColLock(); //lock grow/shrink
- const Size aTmpOldSize( aPrt.SSize() );
- aPrt.Height( getSwFrame().Height() - nPrtHeightDiff );
- aPrt.Width ( getSwFrame().Width() - nPrtWidthDiff );
+ const Size aTmpOldSize( getSwPrint().SSize() );
+
+ {
+ SwFrameRect::PrintWriteAccess aPrt(*this);
+ aPrt.Height( getSwFrame().Height() - nPrtHeightDiff );
+ aPrt.Width ( getSwFrame().Width() - nPrtWidthDiff );
+ }
+
ChgLowersProp( aTmpOldSize );
SwFrame *pLow = Lower();
do
@@ -465,11 +472,10 @@ void SwFlyFreeFrame::CheckClip( const SwFormatFrameSize &rSz )
}
else
{
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aPrt.Height( getSwFrame().Height() - nPrtHeightDiff );
aPrt.Width ( getSwFrame().Width() - nPrtWidthDiff );
}
-
- setSwPrint(aPrt);
}
}
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 95cee18ec659..471f46a851b8 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1120,7 +1120,7 @@ static void lcl_SetPos( SwFrame& _rNewFrame,
const SwLayoutFrame& _rLayFrame )
{
SwRectFnSet aRectFnSet(&_rLayFrame);
- SwRect aFrm(_rNewFrame.getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(_rNewFrame);
aRectFnSet.SetPos( aFrm, aRectFnSet.GetPos(_rLayFrame.getSwFrame()) );
// move position by one SwTwip in text flow direction in order to get
@@ -1133,8 +1133,6 @@ static void lcl_SetPos( SwFrame& _rNewFrame,
{
aFrm.Pos().Y() += 1;
}
-
- _rNewFrame.setSwFrame(aFrm);
}
void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 20d68c0fa1f4..a1b8dcef7768 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -191,7 +191,7 @@ void SwFootnoteContFrame::Format( vcl::RenderContext* /*pRenderContext*/, const
if ( !mbValidPrtArea )
{
mbValidPrtArea = true;
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aRectFnSet.SetTop( aPrt, nBorder );
aRectFnSet.SetWidth( aPrt, aRectFnSet.GetWidth(getSwFrame()) );
@@ -201,8 +201,6 @@ void SwFootnoteContFrame::Format( vcl::RenderContext* /*pRenderContext*/, const
{
mbValidSize = false;
}
-
- setSwPrint(aPrt);
}
if ( !mbValidSize )
@@ -243,10 +241,9 @@ void SwFootnoteContFrame::Format( vcl::RenderContext* /*pRenderContext*/, const
nDiff = aRectFnSet.GetHeight(getSwFrame());
}
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aRectFnSet.AddBottom( aFrm, -nDiff );
aRectFnSet.AddHeight( aFrm, -nDiff );
- setSwFrame(aFrm);
}
}
nDiff = aRectFnSet.GetHeight(getSwFrame()) - nRemaining;
@@ -262,10 +259,8 @@ void SwFootnoteContFrame::Format( vcl::RenderContext* /*pRenderContext*/, const
if( nPrtHeight < 0 )
{
const SwTwips nTmpDiff = std::max( aRectFnSet.GetTop(getSwPrint()), -nPrtHeight );
-
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aRectFnSet.SubTop( aPrt, nTmpDiff );
- setSwPrint(aPrt);
}
}
}
@@ -340,15 +335,13 @@ SwTwips SwFootnoteContFrame::GrowFrame( SwTwips nDist, bool bTst, bool )
if ( !bTst )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aRectFnSet.SetHeight( aFrm, aRectFnSet.GetHeight(aFrm) + nDist );
if( IsVertical() && !IsVertLR() && !IsReverse() )
{
aFrm.Pos().X() -= nDist;
}
-
- setSwFrame(aFrm);
}
long nGrow = nDist - nAvail,
nReal = 0;
@@ -389,15 +382,13 @@ SwTwips SwFootnoteContFrame::GrowFrame( SwTwips nDist, bool bTst, bool )
nDist -= nReal;
// We can only respect the boundless wish so much
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.SSize().Height() -= nDist;
if( IsVertical() && !IsVertLR() && !IsReverse() )
{
aFrm.Pos().X() += nDist;
}
-
- setSwFrame(aFrm);
}
// growing happens upwards, so successors to not need to be invalidated
@@ -1926,13 +1917,11 @@ void SwFootnoteBossFrame::MoveFootnotes_( SwFootnoteFrames &rFootnoteArr, bool b
{
pTmp->Prepare( PREP_MOVEFTN );
- SwRect aFrm(pTmp->getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*pTmp);
aRectFnSet.SetHeight(aFrm, 0);
- pTmp->setSwFrame(aFrm);
- SwRect aPrt(pTmp->getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*pTmp);
aRectFnSet.SetHeight(aPrt, 0);
- pTmp->setSwPrint(aPrt);
pTmp = pTmp->FindNext();
}
@@ -1942,24 +1931,24 @@ void SwFootnoteBossFrame::MoveFootnotes_( SwFootnoteFrames &rFootnoteArr, bool b
pCnt->Prepare( PREP_MOVEFTN );
}
- SwRect aFrm(pCnt->getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*pCnt);
aRectFnSet.SetHeight(aFrm, 0);
- pCnt->setSwFrame(aFrm);
- SwRect aPrt(pCnt->getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*pCnt);
aRectFnSet.SetHeight(aPrt, 0);
- pCnt->setSwPrint(aPrt);
pCnt = pCnt->GetNext();
}
- SwRect aFrm(pFootnote->getSwFrame());
- aRectFnSet.SetHeight(aFrm, 0);
- pFootnote->setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*pFootnote);
+ aRectFnSet.SetHeight(aFrm, 0);
+ }
- SwRect aPrt(pFootnote->getSwPrint());
- aRectFnSet.SetHeight(aPrt, 0);
- pFootnote->setSwPrint(aPrt);
+ {
+ SwFrameRect::PrintWriteAccess aPrt(*pFootnote);
+ aRectFnSet.SetHeight(aPrt, 0);
+ }
pFootnote->Calc(getRootFrame()->GetCurrShell()->GetOut());
pFootnote->GetUpper()->Calc(getRootFrame()->GetCurrShell()->GetOut());
@@ -2749,10 +2738,11 @@ bool SwContentFrame::MoveFootnoteCntFwd( bool bMakePage, SwFootnoteBossFrame *pO
pNewUp->InsertBefore( pTmpFootnote, pTmpFootnote->Lower() );
static_cast<SwSectionFrame*>(pNewUp)->Init();
- SwRect aFrm(pNewUp->getSwFrame());
- aFrm.Pos() = pTmpFootnote->getSwFrame().Pos();
- aFrm.Pos().Y() += 1; // for notifications
- pNewUp->setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*pNewUp);
+ aFrm.Pos() = pTmpFootnote->getSwFrame().Pos();
+ aFrm.Pos().Y() += 1; // for notifications
+ }
// 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 1f99057c639a..6a066db2db36 100644
--- a/sw/source/core/layout/hffrm.cxx
+++ b/sw/source/core/layout/hffrm.cxx
@@ -111,8 +111,6 @@ SwHeadFootFrame::SwHeadFootFrame( SwFrameFormat * pFormat, SwFrame* pSib, SwFram
void SwHeadFootFrame::FormatPrt(SwTwips & nUL, const SwBorderAttrs * pAttrs)
{
- SwRect aPrt(getSwPrint());
-
if (GetEatSpacing())
{
/* The minimal height of the print area is the minimal height of the
@@ -173,6 +171,7 @@ void SwHeadFootFrame::FormatPrt(SwTwips & nUL, const SwBorderAttrs * pAttrs)
/* set print area */
// OD 23.01.2003 #106895# - add first parameter to <SwBorderAttrs::CalcRight(..)>
SwTwips nLR = pAttrs->CalcLeft( this ) + pAttrs->CalcRight( this );
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aPrt.Left(pAttrs->CalcLeft(this));
@@ -203,6 +202,7 @@ void SwHeadFootFrame::FormatPrt(SwTwips & nUL, const SwBorderAttrs * pAttrs)
else
{
// Set position
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aPrt.Left( pAttrs->CalcLeft( this ) );
aPrt.Top ( pAttrs->CalcTop() );
@@ -212,10 +212,8 @@ void SwHeadFootFrame::FormatPrt(SwTwips & nUL, const SwBorderAttrs * pAttrs)
SwTwips nLR = pAttrs->CalcLeft( this ) + pAttrs->CalcRight( this );
aPrt.Width ( getSwFrame().Width() - nLR );
aPrt.Height( getSwFrame().Height()- nUL );
-
}
- setSwPrint(aPrt);
mbValidPrtArea = true;
}
@@ -380,13 +378,11 @@ void SwHeadFootFrame::FormatSize(SwTwips nUL, const SwBorderAttrs * pAttrs)
if ( nBot > nDeadLine )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.Bottom( nDeadLine );
- setSwFrame(aFrm);
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aPrt.SSize().Height() = getSwFrame().Height() - nBorder;
- setSwPrint(aPrt);
}
}
mbValidSize = mbValidPrtArea = true;
@@ -491,10 +487,9 @@ SwTwips SwHeadFootFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
{
if (! IsHeaderFrame())
{
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aPrt.Top(aPrt.Top() - nEat);
aPrt.Height(aPrt.Height() - nEat);
- setSwPrint(aPrt);
}
InvalidateAll();
@@ -609,10 +604,9 @@ SwTwips SwHeadFootFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo )
{
if (! IsHeaderFrame() )
{
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aPrt.Top(aPrt.Top() + nShrink);
aPrt.Height(aPrt.Height() - nShrink);
- setSwPrint(aPrt);
}
InvalidateAll();
diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx
index 60ce7c3576b9..32e2643deb3b 100644
--- a/sw/source/core/layout/laycache.cxx
+++ b/sw/source/core/layout/laycache.cxx
@@ -806,10 +806,11 @@ bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex )
{
mrpFrame->InsertBehind( mrpLay, mrpPrv );
- SwRect aFrm(mrpFrame->getSwFrame());
- aFrm.Pos() = mrpLay->getSwFrame().Pos();
- aFrm.Pos().Y() += 1;
- mrpFrame->setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*mrpFrame);
+ aFrm.Pos() = mrpLay->getSwFrame().Pos();
+ aFrm.Pos().Y() += 1;
+ }
mrpPrv = mrpFrame;
if( mrpFrame->IsTabFrame() )
@@ -881,9 +882,8 @@ bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex )
CheckFlyCache_( pLastPage );
if( mrpPrv && mrpPrv->IsTextFrame() && !mrpPrv->GetValidSizeFlag() )
{
- SwRect aFrm(mrpPrv->getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*mrpPrv);
aFrm.Height( mrpPrv->GetUpper()->getSwPrint().Height() );
- mrpPrv->setSwFrame(aFrm);
}
bRet = true;
@@ -916,10 +916,11 @@ bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex )
pSct->Init();
}
- SwRect aFrm(pSct->getSwFrame());
- aFrm.Pos() = mrpLay->getSwFrame().Pos();
- aFrm.Pos().Y() += 1; //because of the notifications
- pSct->setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*pSct);
+ aFrm.Pos() = mrpLay->getSwFrame().Pos();
+ aFrm.Pos().Y() += 1; //because of the notifications
+ }
mrpLay = pSct;
if ( mrpLay->Lower() && mrpLay->Lower()->IsLayoutFrame() )
@@ -1018,7 +1019,7 @@ void SwLayHelper::CheckFlyCache_( SwPageFrame* pPage )
if ( pFly->getSwFrame().Left() == FAR_AWAY )
{
// we get the stored information
- SwRect aFrm(pFly->getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*pFly);
aFrm.Pos().X() = pFlyCache->Left() + pPage->getSwFrame().Left();
aFrm.Pos().Y() = pFlyCache->Top() + pPage->getSwFrame().Top();
@@ -1027,8 +1028,6 @@ void SwLayHelper::CheckFlyCache_( SwPageFrame* pPage )
aFrm.Width( pFlyCache->Width() );
aFrm.Height( pFlyCache->Height() );
}
-
- pFly->setSwFrame(aFrm);
}
++aFlyCacheSetIt;
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index f22203b2abed..b63190b1d38e 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -96,7 +96,7 @@ void SwBodyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder
nHeight = 0;
}
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.Height( nHeight );
if( IsVertical() && !IsVertLR() && !IsReverse() && nWidth != aFrm.Width() )
@@ -105,7 +105,6 @@ void SwBodyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder
}
aFrm.Width( nWidth );
- setSwFrame(aFrm);
}
bool bNoGrid = true;
@@ -128,7 +127,8 @@ void SwBodyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder
nSize -= nBorder;
nBorder /= 2;
}
- SwRect aPrt(getSwPrint());
+
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aRectFnSet.SetPosX( aPrt, nBorder );
aRectFnSet.SetWidth( aPrt, nSize );
@@ -151,18 +151,16 @@ void SwBodyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder
aRectFnSet.SetPosY( aPrt, bAdjust ? nBorder : 0 );
aRectFnSet.SetHeight( aPrt, nSize );
- setSwPrint(aPrt);
}
}
if( bNoGrid )
{
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aPrt.Pos().setX(0);
aPrt.Pos().setY(0);
aPrt.Height( getSwFrame().Height() );
aPrt.Width( getSwFrame().Width() );
- setSwPrint(aPrt);
}
mbValidSize = mbValidPrtArea = true;
@@ -194,26 +192,27 @@ 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(getSwFrame());
- if ( bBrowseMode )
{
- aFrm.Height( 0 );
- long nWidth = pSh->VisArea().Width();
+ SwFrameRect::FrameWriteAccess aFrm(*this);
- if ( !nWidth )
+ if ( bBrowseMode )
{
- nWidth = 5000; // changes anyway
- }
+ aFrm.Height( 0 );
+ long nWidth = pSh->VisArea().Width();
- aFrm.Width ( nWidth );
- }
- else
- {
- aFrm.SSize( pFormat->GetFrameSize().GetSize() );
- }
+ if ( !nWidth )
+ {
+ nWidth = 5000; // changes anyway
+ }
- setSwFrame(aFrm);
+ aFrm.Width ( nWidth );
+ }
+ else
+ {
+ aFrm.SSize( pFormat->GetFrameSize().GetSize() );
+ }
+ }
// create and insert body area if it is not a blank page
SwDoc *pDoc = pFormat->GetDoc();
@@ -625,10 +624,11 @@ void SwPageFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
static_cast<const SwFormatChg*>(pNew)->pChangedFormat->GetFrameSize() :
static_cast<const SwFormatFrameSize&>(*pNew);
- SwRect aFrm(getSwFrame());
- aFrm.Height( std::max( rSz.GetHeight(), long(MINLAY) ) );
- aFrm.Width ( std::max( rSz.GetWidth(), long(MINLAY) ) );
- setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aFrm.Height( std::max( rSz.GetHeight(), long(MINLAY) ) );
+ aFrm.Width ( std::max( rSz.GetWidth(), long(MINLAY) ) );
+ }
if ( GetUpper() )
{
@@ -1356,9 +1356,8 @@ SwTwips SwRootFrame::GrowFrame( SwTwips nDist, bool bTst, bool )
{
if ( !bTst )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.SSize().Height() += nDist;
- setSwFrame(aFrm);
}
return nDist;
@@ -1371,9 +1370,8 @@ SwTwips SwRootFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool )
if ( !bTst )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.SSize().Height() -= nDist;
- setSwFrame(aFrm);
}
return nDist;
@@ -1589,9 +1587,10 @@ void SwRootFrame::AssertPageFlys( SwPageFrame *pPage )
Size SwRootFrame::ChgSize( const Size& aNewSize )
{
- SwRect aFrm(getSwFrame());
- aFrm.SSize() = aNewSize;
- setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aFrm.SSize() = aNewSize;
+ }
InvalidatePrt_();
mbFixSize = false;
@@ -1604,21 +1603,18 @@ void SwRootFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
{
mbValidPos = true;
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.Pos().setX(DOCUMENTBORDER);
aFrm.Pos().setY(DOCUMENTBORDER);
- setSwFrame(aFrm);
}
if ( !mbValidPrtArea )
{
mbValidPrtArea = true;
-
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aPrt.Pos().setX(0);
aPrt.Pos().setY(0);
aPrt.SSize( getSwFrame().SSize() );
- setSwPrint(aPrt);
}
if ( !mbValidSize )
@@ -1931,19 +1927,19 @@ static void lcl_MoveAllLowers( SwFrame* pFrame, const Point& rOffset )
const SwRect aFrame( pFrame->getSwFrame() );
// first move the current frame
- SwRect aFrm(pFrame->getSwFrame());
-
- if (aFrm.Pos().X() != FAR_AWAY)
{
- aFrm.Pos().X() += rOffset.X();
- }
+ SwFrameRect::FrameWriteAccess aFrm(*pFrame);
- if (aFrm.Pos().Y() != FAR_AWAY)
- {
- aFrm.Pos().Y() += rOffset.Y();
- }
+ if (aFrm.Pos().X() != FAR_AWAY)
+ {
+ aFrm.Pos().X() += rOffset.X();
+ }
- pFrame->setSwFrame(aFrm);
+ if (aFrm.Pos().Y() != FAR_AWAY)
+ {
+ aFrm.Pos().Y() += rOffset.Y();
+ }
+ }
// Don't forget accessibility:
if( pFrame->IsAccessibleFrame() )
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 94e8dae37885..79627835e543 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -102,18 +102,21 @@ void SwSectionFrame::Init()
SwRectFnSet aRectFnSet(this);
long nWidth = aRectFnSet.GetWidth(GetUpper()->getSwPrint());
- SwRect aFrm(getSwFrame());
- aRectFnSet.SetWidth( aFrm, nWidth );
- aRectFnSet.SetHeight( aFrm, 0 );
- setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aRectFnSet.SetWidth( aFrm, nWidth );
+ aRectFnSet.SetHeight( aFrm, 0 );
+ }
// #109700# LRSpace for sections
const SvxLRSpaceItem& rLRSpace = GetFormat()->GetLRSpace();
- SwRect aPrt(getSwPrint());
- aRectFnSet.SetLeft( aPrt, rLRSpace.GetLeft() );
- aRectFnSet.SetWidth( aPrt, nWidth - rLRSpace.GetLeft() - rLRSpace.GetRight() );
- aRectFnSet.SetHeight( aPrt, 0 );
- setSwPrint(aPrt);
+
+ {
+ SwFrameRect::PrintWriteAccess aPrt(*this);
+ aRectFnSet.SetLeft( aPrt, rLRSpace.GetLeft() );
+ aRectFnSet.SetWidth( aPrt, nWidth - rLRSpace.GetLeft() - rLRSpace.GetRight() );
+ aRectFnSet.SetHeight( aPrt, 0 );
+ }
const SwFormatCol &rCol = GetFormat()->GetCol();
if( ( rCol.GetNumCols() > 1 || IsAnyNoteAtEnd() ) && !IsInFootnote() )
@@ -201,9 +204,10 @@ void SwSectionFrame::DelEmpty( bool bRemove )
SetFollow(nullptr);
if( pUp )
{
- SwRect aFrm(getSwFrame());
- aFrm.Height( 0 );
- setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aFrm.Height( 0 );
+ }
// If we are destroyed immediately anyway, we don't need
// to put us into the list
@@ -215,7 +219,10 @@ void SwSectionFrame::DelEmpty( bool bRemove )
getRootFrame()->RemoveFromList( this );
}
else if( getRootFrame() )
+ {
getRootFrame()->InsertEmptySct( this );
+ }
+
m_pSection = nullptr; // like this a reanimation is virtually impossible though
}
}
@@ -293,13 +300,11 @@ void SwSectionFrame::Cut_( bool bRemove )
{
if( !bRemove )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aRectFnSet.SetHeight( aFrm, 0 );
- setSwFrame(aFrm);
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aRectFnSet.SetHeight( aPrt, 0 );
- setSwPrint(aPrt);
}
pUp->Shrink( nFrameHeight );
@@ -1070,9 +1075,10 @@ void SwSectionFrame::CheckClipping( bool bGrow, bool bMaximize )
const Size aOldSz( getSwPrint().SSize() );
long nTop = aRectFnSet.GetTopMargin(*this);
- SwRect aFrm(getSwFrame());
- aRectFnSet.SetBottom( aFrm, nDeadLine );
- setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aRectFnSet.SetBottom( aFrm, nDeadLine );
+ }
nDiff = aRectFnSet.GetHeight(getSwFrame());
if( nTop > nDiff )
@@ -1127,9 +1133,10 @@ void SwSectionFrame::SimpleFormat()
// order to get calculated lowers, not only if there space left in its upper.
if( aRectFnSet.BottomDist( getSwFrame(), nDeadLine ) >= 0 )
{
- SwRect aFrm(getSwFrame());
- aRectFnSet.SetBottom( aFrm, nDeadLine );
- setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aRectFnSet.SetBottom( aFrm, nDeadLine );
+ }
long nHeight = aRectFnSet.GetHeight(getSwFrame());
long nTop = CalcUpperSpace();
@@ -1213,9 +1220,10 @@ class ExtraFormatToPositionObjs
Size aOldSectPrtSize( mpSectFrame->getSwPrint().SSize() );
SwTwips nDiff = aRectFnSet.BottomDist( mpSectFrame->getSwFrame(), aRectFnSet.GetPrtBottom(*mpSectFrame->GetUpper()) );
- SwRect aFrm(mpSectFrame->getSwFrame());
- aRectFnSet.AddBottom( aFrm, nDiff );
- mpSectFrame->setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*mpSectFrame);
+ aRectFnSet.AddBottom( aFrm, nDiff );
+ }
aRectFnSet.SetYMargins( *mpSectFrame, nTopMargin, 0 );
// #i59789#
@@ -1341,16 +1349,19 @@ void SwSectionFrame::Format( vcl::RenderContext* pRenderContext, const SwBorderA
if( GetUpper() )
{
- long nWidth = aRectFnSet.GetWidth(GetUpper()->getSwPrint());
- SwRect aFrm(getSwFrame());
- aRectFnSet.SetWidth( aFrm, nWidth );
- setSwFrame(aFrm);
+ const long nWidth = aRectFnSet.GetWidth(GetUpper()->getSwPrint());
+
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aRectFnSet.SetWidth( aFrm, nWidth );
+ }
// #109700# LRSpace for sections
- const SvxLRSpaceItem& rLRSpace = GetFormat()->GetLRSpace();
- SwRect aPrt(getSwPrint());
- aRectFnSet.SetWidth( aPrt, nWidth - rLRSpace.GetLeft() - rLRSpace.GetRight() );
- setSwPrint(aPrt);
+ {
+ const SvxLRSpaceItem& rLRSpace = GetFormat()->GetLRSpace();
+ SwFrameRect::PrintWriteAccess aPrt(*this);
+ aRectFnSet.SetWidth( aPrt, nWidth - rLRSpace.GetLeft() - rLRSpace.GetRight() );
+ }
// OD 15.10.2002 #103517# - allow grow in online layout
// Thus, set <..IsBrowseMode()> as parameter <bGrow> on calling
@@ -1437,9 +1448,10 @@ void SwSectionFrame::Format( vcl::RenderContext* pRenderContext, const SwBorderA
long nTmp = nRemaining - aRectFnSet.GetHeight(getSwFrame());
long nTop = aRectFnSet.GetTopMargin(*this);
- SwRect aFrm(getSwFrame());
- aRectFnSet.AddBottom( aFrm, nTmp );
- setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aRectFnSet.AddBottom( aFrm, nTmp );
+ }
aRectFnSet.SetYMargins( *this, nTop, 0 );
InvalidateNextPos();
@@ -2053,14 +2065,16 @@ SwTwips SwSectionFrame::Grow_( SwTwips nDist, bool bTst )
GetUpper()->InvalidateSize();
}
- SwRect aFrm(getSwFrame());
- aRectFnSet.AddBottom( aFrm, nGrow );
- setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aRectFnSet.AddBottom( aFrm, nGrow );
+ }
- long nPrtHeight = aRectFnSet.GetHeight(getSwPrint()) + nGrow;
- SwRect aPrt(getSwPrint());
- aRectFnSet.SetHeight( aPrt, nPrtHeight );
- setSwPrint(aPrt);
+ {
+ const long nPrtHeight = aRectFnSet.GetHeight(getSwPrint()) + nGrow;
+ SwFrameRect::PrintWriteAccess aPrt(*this);
+ aRectFnSet.SetHeight( aPrt, nPrtHeight );
+ }
if( Lower() && Lower()->IsColumnFrame() && Lower()->GetNext() )
{
@@ -2142,14 +2156,16 @@ SwTwips SwSectionFrame::Shrink_( SwTwips nDist, bool bTst )
InvalidatePage();
}
- SwRect aFrm(getSwFrame());
- aRectFnSet.AddBottom( aFrm, -nDist );
- setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aRectFnSet.AddBottom( aFrm, -nDist );
+ }
- long nPrtHeight = aRectFnSet.GetHeight(getSwPrint()) - nDist;
- SwRect aPrt(getSwPrint());
- aRectFnSet.SetHeight( aPrt, nPrtHeight );
- setSwPrint(aPrt);
+ {
+ const long nPrtHeight = aRectFnSet.GetHeight(getSwPrint()) - nDist;
+ SwFrameRect::PrintWriteAccess aPrt(*this);
+ aRectFnSet.SetHeight( aPrt, nPrtHeight );
+ }
// We do not allow a section frame to shrink the its upper
// footer frame. This is because in the calculation of a
diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx
index fcd7aa9a88c5..edcc34354ff8 100644
--- a/sw/source/core/layout/ssfrm.cxx
+++ b/sw/source/core/layout/ssfrm.cxx
@@ -55,13 +55,11 @@ bool SwFrame::SetMinLeft( long nDeadline )
SwTwips nDiff = nDeadline - getSwFrame().Left();
if( nDiff > 0 )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.Left( nDeadline );
- setSwFrame(aFrm);
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aPrt.Width( aPrt.Width() - nDiff );
- setSwPrint(aPrt);
return true;
}
@@ -73,13 +71,11 @@ bool SwFrame::SetMaxBottom( long nDeadline )
SwTwips nDiff = getSwFrame().Top() + getSwFrame().Height() - nDeadline;
if( nDiff > 0 )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.Height( aFrm.Height() - nDiff );
- setSwFrame(aFrm);
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aPrt.Height( aPrt.Height() - nDiff );
- setSwPrint(aPrt);
return true;
}
@@ -91,13 +87,11 @@ bool SwFrame::SetMinTop( long nDeadline )
SwTwips nDiff = nDeadline - getSwFrame().Top();
if( nDiff > 0 )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.Top( nDeadline );
- setSwFrame(aFrm);
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aPrt.Height( aPrt.Height() - nDiff );
- setSwPrint(aPrt);
return true;
}
@@ -109,13 +103,11 @@ bool SwFrame::SetMaxRight( long nDeadline )
SwTwips nDiff = getSwFrame().Left() + getSwFrame().Width() - nDeadline;
if( nDiff > 0 )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.Width( aFrm.Width() - nDiff );
- setSwFrame(aFrm);
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aPrt.Width( aPrt.Width() - nDiff );
- setSwPrint(aPrt);
return true;
}
@@ -124,7 +116,7 @@ bool SwFrame::SetMaxRight( long nDeadline )
void SwFrame::MakeBelowPos( const SwFrame* pUp, const SwFrame* pPrv, bool bNotify )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
if( pPrv )
{
@@ -141,13 +133,11 @@ void SwFrame::MakeBelowPos( const SwFrame* pUp, const SwFrame* pPrv, bool bNotif
{
aFrm.Pos().Y() += 1;
}
-
- setSwFrame(aFrm);
}
void SwFrame::MakeUpperPos( const SwFrame* pUp, const SwFrame* pPrv, bool bNotify )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
if( pPrv )
{
@@ -165,13 +155,11 @@ void SwFrame::MakeUpperPos( const SwFrame* pUp, const SwFrame* pPrv, bool bNotif
{
aFrm.Pos().Y() -= 1;
}
-
- setSwFrame(aFrm);
}
void SwFrame::MakeLeftPos( const SwFrame* pUp, const SwFrame* pPrv, bool bNotify )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
if( pPrv )
{
@@ -189,13 +177,11 @@ void SwFrame::MakeLeftPos( const SwFrame* pUp, const SwFrame* pPrv, bool bNotify
{
aFrm.Pos().X() -= 1;
}
-
- setSwFrame(aFrm);
}
void SwFrame::MakeRightPos( const SwFrame* pUp, const SwFrame* pPrv, bool bNotify )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
if( pPrv )
{
@@ -212,40 +198,34 @@ void SwFrame::MakeRightPos( const SwFrame* pUp, const SwFrame* pPrv, bool bNotif
{
aFrm.Pos().X() += 1;
}
-
- setSwFrame(aFrm);
}
void SwFrame::SetTopBottomMargins( long nTop, long nBot )
{
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aPrt.Top( nTop );
aPrt.Height( getSwFrame().Height() - nTop - nBot );
- setSwPrint(aPrt);
}
void SwFrame::SetBottomTopMargins( long nBot, long nTop )
{
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aPrt.Top( nTop );
aPrt.Height( getSwFrame().Height() - nTop - nBot );
- setSwPrint(aPrt);
}
void SwFrame::SetLeftRightMargins( long nLeft, long nRight)
{
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aPrt.Left( nLeft );
aPrt.Width( getSwFrame().Width() - nLeft - nRight );
- setSwPrint(aPrt);
}
void SwFrame::SetRightLeftMargins( long nRight, long nLeft)
{
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aPrt.Left( nLeft );
aPrt.Width( getSwFrame().Width() - nLeft - nRight );
- setSwPrint(aPrt);
}
/// checks the layout direction and invalidates the lower frames recursively, if necessary.
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index e2c096ba561c..cdf0ef0b9d01 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -353,14 +353,12 @@ static void lcl_ShrinkCellsAndAllContent( SwRowFrame& rRow )
if (bAllRowsCollapsed)
{
// All rows of this table have 0 height -> set height of the table itself as well.
- SwRect aFrm(pTmp->getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*pTmp);
aRectFnSet.SetHeight(aFrm, 0);
- pTmp->setSwFrame(aFrm);
- SwRect aPrt(pTmp->getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*pTmp);
aRectFnSet.SetTop(aPrt, 0);
aRectFnSet.SetHeight(aPrt, 0);
- pTmp->setSwPrint(aPrt);
}
else
bAllLowersCollapsed = false;
@@ -368,7 +366,7 @@ static void lcl_ShrinkCellsAndAllContent( SwRowFrame& rRow )
else
{
pTmp->Shrink(aRectFnSet.GetHeight(pTmp->getSwFrame()));
- SwRect aPrt(pTmp->getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*pTmp);
aRectFnSet.SetTop(aPrt, 0);
aRectFnSet.SetHeight(aPrt, 0);
@@ -376,8 +374,6 @@ static void lcl_ShrinkCellsAndAllContent( SwRowFrame& rRow )
{
bAllLowersCollapsed = false;
}
-
- pTmp->setSwPrint(aPrt);
}
pTmp = pTmp->GetPrev();
@@ -392,14 +388,12 @@ 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.
- SwRect aFrm(pCurrMasterCell->getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*pCurrMasterCell);
aRectFnSet.SetHeight(aFrm, 0);
- pCurrMasterCell->setSwFrame(aFrm);
- SwRect aPrt(pCurrMasterCell->getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*pCurrMasterCell);
aRectFnSet.SetTop(aPrt, 0);
aRectFnSet.SetHeight(aPrt, 0);
- pCurrMasterCell->setSwPrint(aPrt);
}
else
bAllCellsCollapsed = false;
@@ -410,14 +404,12 @@ static void lcl_ShrinkCellsAndAllContent( SwRowFrame& rRow )
if (bAllCellsCollapsed)
{
// All cells have 0 height -> set height of row as well.
- SwRect aFrm(rRow.getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(rRow);
aRectFnSet.SetHeight(aFrm, 0);
- rRow.setSwFrame(aFrm);
- SwRect aPrt(rRow.getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(rRow);
aRectFnSet.SetTop(aPrt, 0);
aRectFnSet.SetHeight(aPrt, 0);
- rRow.setSwPrint(aPrt);
}
}
@@ -805,9 +797,8 @@ static void lcl_AdjustRowSpanCells( SwRowFrame* pRow )
if ( nDiff )
{
- SwRect aFrm(pCellFrame->getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*pCellFrame);
aRectFnSet.AddBottom(aFrm, nDiff);
- pCellFrame->setSwFrame(aFrm);
}
}
@@ -1164,14 +1155,16 @@ bool SwTabFrame::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowK
pFoll = new SwTabFrame( *this );
// We give the follow table an initial width.
- SwRect aFrm(pFoll->getSwFrame());
- aRectFnSet.AddWidth(aFrm, aRectFnSet.GetWidth(getSwFrame()));
- aRectFnSet.SetLeft(aFrm, aRectFnSet.GetLeft(getSwFrame()));
- pFoll->setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*pFoll);
+ aRectFnSet.AddWidth(aFrm, aRectFnSet.GetWidth(getSwFrame()));
+ aRectFnSet.SetLeft(aFrm, aRectFnSet.GetLeft(getSwFrame()));
+ }
- SwRect aPrt(pFoll->getSwPrint());
- aRectFnSet.AddWidth(aPrt, aRectFnSet.GetWidth(getSwPrint()));
- pFoll->setSwPrint(aPrt);
+ {
+ SwFrameRect::PrintWriteAccess aPrt(*pFoll);
+ aRectFnSet.AddWidth(aPrt, aRectFnSet.GetWidth(getSwPrint()));
+ }
// Insert the new follow table
pFoll->InsertBehind( GetUpper(), this );
@@ -2762,9 +2755,8 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA
aRectFnSet.GetWidth(getSwFrame());
if( nDiff )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aRectFnSet.AddRight( aFrm, nDiff );
- setSwFrame(aFrm);
}
}
@@ -2984,9 +2976,8 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA
nWidth -= getSwPrint().Left();
nWidth -= pAttrs->CalcRightLine();
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aPrt.Width( std::min( nWidth, aPrt.Width() ) );
- setSwPrint(aPrt);
}
if ( nOldHeight != aRectFnSet.GetHeight(getSwPrint()) )
@@ -3053,9 +3044,10 @@ SwTwips SwTabFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
if ( !bTst )
{
- SwRect aFrm(getSwFrame());
- aRectFnSet.AddBottom( aFrm, nDist );
- setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aRectFnSet.AddBottom( aFrm, nDist );
+ }
SwRootFrame *pRootFrame = getRootFrame();
if( pRootFrame && pRootFrame->IsAnyShellAccessible() &&
@@ -4101,12 +4093,14 @@ void SwRowFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA
//RowFrames don't have borders and so on therefore the PrtArea always
//matches the Frame.
mbValidPrtArea = true;
- SwRect aPrt(getSwPrint());
- aPrt.Left( 0 );
- aPrt.Top( 0 );
- aPrt.Width ( getSwFrame().Width() );
- aPrt.Height( getSwFrame().Height() );
- setSwPrint(aPrt);
+
+ {
+ SwFrameRect::PrintWriteAccess aPrt(*this);
+ aPrt.Left( 0 );
+ aPrt.Top( 0 );
+ aPrt.Width ( getSwFrame().Width() );
+ aPrt.Height( getSwFrame().Height() );
+ }
// #i29550#
// Here we calculate the top-printing area for the lower cell frames
@@ -4283,9 +4277,10 @@ void SwRowFrame::AdjustCells( const SwTwips nHeight, const bool bHeight )
const long nDiff = nHeight - aRectFnSet.GetHeight(pCellFrame->getSwFrame());
if ( nDiff )
{
- SwRect aFrm(pCellFrame->getSwFrame());
- aRectFnSet.AddBottom( aFrm, nDiff );
- pCellFrame->setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*pCellFrame);
+ aRectFnSet.AddBottom( aFrm, nDiff );
+ }
pCellFrame->InvalidatePrt_();
}
@@ -4330,11 +4325,8 @@ void SwRowFrame::AdjustCells( const SwTwips nHeight, const bool bHeight )
if ( nDiff )
{
aOldFrame = pToAdjust->getSwFrame();
-
- SwRect aFrm(pToAdjust->getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*pToAdjust);
aRectFnSet.AddBottom( aFrm, nDiff );
- pToAdjust->setSwFrame(aFrm);
-
pNotify = pToAdjust;
}
@@ -4401,9 +4393,8 @@ SwTwips SwRowFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
nDist -= nReal;
if ( !bTst )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aRectFnSet.AddBottom( aFrm, nReal );
- setSwFrame(aFrm);
}
}
}
@@ -4485,15 +4476,13 @@ SwTwips SwRowFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo )
if ( !bTst )
{
SwTwips nHeight = aRectFnSet.GetHeight(getSwFrame());
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aRectFnSet.SetHeight( aFrm, nHeight - nReal );
if( IsVertical() && !IsVertLR() && !aRectFnSet.IsRev() )
{
aFrm.Pos().X() += nReal;
}
-
- setSwFrame(aFrm);
}
SwLayoutFrame* pFrame = GetUpper();
@@ -4506,15 +4495,13 @@ SwTwips SwRowFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo )
{
nReal -= nTmp;
SwTwips nHeight = aRectFnSet.GetHeight(getSwFrame());
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aRectFnSet.SetHeight( aFrm, nHeight + nReal );
if( IsVertical() && !IsVertLR() && !aRectFnSet.IsRev() )
{
aFrm.Pos().X() -= nReal;
}
-
- setSwFrame(aFrm);
}
nReal = nTmp;
}
@@ -4646,10 +4633,13 @@ static bool lcl_ArrangeLowers( SwLayoutFrame *pLay, long lYStart, bool bInva )
bRet = true;
const long lDiff = aRectFnSet.YDiff( lYStart, nFrameTop );
const long lDiffX = lYStart - nFrameTop;
- SwRect aFrm(pFrame->getSwFrame());
- aRectFnSet.SubTop( aFrm, -lDiff );
- aRectFnSet.AddBottom( aFrm, lDiff );
- pFrame->setSwFrame(aFrm);
+
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*pFrame);
+ aRectFnSet.SubTop( aFrm, -lDiff );
+ aRectFnSet.AddBottom( aFrm, lDiff );
+ }
+
pFrame->SetCompletePaint();
if ( !pFrame->GetNext() )
@@ -4705,10 +4695,11 @@ static bool lcl_ArrangeLowers( SwLayoutFrame *pLay, long lYStart, bool bInva )
!pFly->ConsiderObjWrapInfluenceOnObjPos();
if ( bDirectMove )
{
- SwRect aFrm(pFly->getSwFrame());
- aRectFnSet.SubTop( aFrm, -lDiff );
- aRectFnSet.AddBottom( aFrm, lDiff );
- pFly->setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*pFly);
+ aRectFnSet.SubTop( aFrm, -lDiff );
+ aRectFnSet.AddBottom( aFrm, lDiff );
+ }
pFly->GetVirtDrawObj()->SetRectsDirty();
// --> OD 2004-08-17 - also notify view of <SdrObject>
@@ -4979,24 +4970,27 @@ void SwCellFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder
pPre = pPre->GetNext();
}
}
+
const long nDiff = nWidth - aRectFnSet.GetWidth(getSwFrame());
- SwRect aFrm(getSwFrame());
- if( IsNeighbourFrame() && IsRightToLeft() )
{
- aRectFnSet.SubLeft( aFrm, nDiff );
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+
+ if( IsNeighbourFrame() && IsRightToLeft() )
+ {
+ aRectFnSet.SubLeft( aFrm, nDiff );
+ }
+ else
+ {
+ aRectFnSet.AddRight( aFrm, nDiff );
+ }
}
- else
+
{
- aRectFnSet.AddRight( aFrm, nDiff );
+ SwFrameRect::PrintWriteAccess aPrt(*this);
+ aRectFnSet.AddRight( aPrt, nDiff );
}
- setSwFrame(aFrm);
-
- SwRect aPrt(getSwPrint());
- aRectFnSet.AddRight( aPrt, nDiff );
- setSwPrint(aPrt);
-
//Adjust the height, it's defined through the content and the border.
const long nDiffHeight = nRemaining - aRectFnSet.GetHeight(getSwFrame());
if ( nDiffHeight )
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index cacac35d75db..1c301a161d2f 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -467,14 +467,17 @@ Size SwFrame::ChgSize( const Size& aNewSize )
if ( aNewSize == aOldSize )
return aOldSize;
- SwRect aFrm(getSwFrame());
-
if ( GetUpper() )
{
bool bNeighb = IsNeighbourFrame();
SwRectFn fnRect = IsVertical() == bNeighb ? fnRectHori : ( IsVertLR() ? fnRectVertL2R : fnRectVert );
SwRect aNew( Point(0,0), aNewSize );
- (aFrm.*fnRect->fnSetWidth)( (aNew.*fnRect->fnGetWidth)() );
+
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ (aFrm.*fnRect->fnSetWidth)( (aNew.*fnRect->fnGetWidth)() );
+ }
+
long nNew = (aNew.*fnRect->fnGetHeight)();
long nDiff = nNew - (getSwFrame().*fnRect->fnGetHeight)();
@@ -484,11 +487,16 @@ Size SwFrame::ChgSize( const Size& aNewSize )
SwNeighbourAdjust::GrowShrink !=
static_cast<SwFootnoteBossFrame*>(GetUpper())->NeighbourhoodAdjustment() )
{
- (aFrm.*fnRect->fnSetHeight)( nNew );
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ (aFrm.*fnRect->fnSetHeight)( nNew );
+ }
+
SwTwips nReal = static_cast<SwLayoutFrame*>(this)->AdjustNeighbourhood(nDiff);
if ( nReal != nDiff )
{
+ SwFrameRect::FrameWriteAccess aFrm(*this);
(aFrm.*fnRect->fnSetHeight)( nNew - nDiff + nReal );
}
}
@@ -503,7 +511,7 @@ Size SwFrame::ChgSize( const Size& aNewSize )
else
Shrink( -nDiff );
- if ( GetUpper() && (aFrm.*fnRect->fnGetHeight)() != nNew )
+ if ( GetUpper() && (getSwFrame().*fnRect->fnGetHeight)() != nNew )
{
GetUpper()->InvalidateSize_();
}
@@ -512,17 +520,17 @@ Size SwFrame::ChgSize( const Size& aNewSize )
// 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.
+ SwFrameRect::FrameWriteAccess aFrm(*this);
(aFrm.*fnRect->fnSetHeight)( nNew );
}
}
}
else
{
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.SSize( aNewSize );
}
- setSwFrame(aFrm);
-
if ( getSwFrame().SSize() != aOldSize )
{
SwPageFrame *pPage = FindPageFrame();
@@ -1156,17 +1164,20 @@ void SwLayoutFrame::Cut()
if( nReal < nShrink )
{
const SwTwips nOldHeight = aRectFnSet.GetHeight(getSwFrame());
- SwRect aFrm(getSwFrame());
// seems as if this needs to be frowarded to the SwFrame already here,
// changing to zero seems temporary anyways
- aRectFnSet.SetHeight( aFrm, 0 );
- setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aRectFnSet.SetHeight( aFrm, 0 );
+ }
nReal += pUp->Shrink( nShrink - nReal );
- aRectFnSet.SetHeight( aFrm, nOldHeight );
- setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aRectFnSet.SetHeight( aFrm, nOldHeight );
+ }
}
if( SwNeighbourAdjust::GrowAdjust == nAdjust && nReal < nShrink )
@@ -1226,9 +1237,8 @@ SwTwips SwFrame::Grow( SwTwips nDist, bool bTst, bool bInfo )
{
nPrtHeight = aRectFnSet.GetHeight(getSwPrint());
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aRectFnSet.SetHeight( aPrt, nPrtHeight + ( IsContentFrame() ? nDist : nReal ) );
- setSwPrint(aPrt);
}
return nReal;
}
@@ -1268,9 +1278,8 @@ SwTwips SwFrame::Shrink( SwTwips nDist, bool bTst, bool bInfo )
if( !bTst )
{
const SwTwips nPrtHeight = aRectFnSet.GetHeight(getSwPrint());
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aRectFnSet.SetHeight( aPrt, nPrtHeight - ( IsContentFrame() ? nDist : nReal ) );
- setSwPrint(aPrt);
}
return nReal;
}
@@ -1345,9 +1354,10 @@ SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst )
const long nTmp = nChg - pBody->getSwPrint().Height();
if ( !bTst )
{
- SwRect aFrm(pBody->getSwFrame());
- aFrm.Height(std::max( 0L, aFrm.Height() - nChg ));
- pBody->setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*pBody);
+ aFrm.Height(std::max( 0L, aFrm.Height() - nChg ));
+ }
pBody->InvalidatePrt_();
pBody->InvalidateSize_();
@@ -1402,15 +1412,13 @@ SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst )
if ( !bTst && nChg )
{
{
- SwRect aFrm(pUp->getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*pUp);
aFrm.SSize().Height() += nChg;
- pUp->setSwFrame(aFrm);
}
{
- SwRect aPrt(pUp->getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*pUp);
aPrt.SSize().Height() += nChg;
- pUp->setSwPrint(aPrt);
}
if ( pViewShell )
@@ -1440,9 +1448,8 @@ SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst )
if ( IsBodyFrame() )
{
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aPrt.SSize().Height() = nOldFrameHeight;
- setSwPrint(aPrt);
}
if ( pUp->GetUpper() )
@@ -1450,13 +1457,11 @@ SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst )
static_cast<SwRootFrame*>(pUp->GetUpper())->CheckViewLayout( nullptr, nullptr );
}
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aFrm.SSize().Height() = nOldFrameHeight;
- setSwFrame(aFrm);
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
aPrt.SSize().Height() = nOldPrtHeight;
- setSwPrint(aPrt);
mbCompletePaint = bOldComplete;
}
@@ -1552,15 +1557,16 @@ SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst )
nAdd = nAddMax;
if ( !bTst )
{
- SwRect aFrm(pFrame->GetNext()->getSwFrame());
- aRectFnSet.SetHeight(aFrm, nAddMax-nAdd);
-
- if( aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() && !aRectFnSet.IsRev() )
{
- aFrm.Pos().X() += nAdd;
+ SwFrameRect::FrameWriteAccess aFrm(*pFrame->GetNext());
+ aRectFnSet.SetHeight(aFrm, nAddMax-nAdd);
+
+ if( aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() && !aRectFnSet.IsRev() )
+ {
+ aFrm.Pos().X() += nAdd;
+ }
}
- pFrame->GetNext()->setSwFrame(aFrm);
pFrame->GetNext()->InvalidatePrt();
if ( pFrame->GetNext()->GetNext() )
@@ -1576,15 +1582,16 @@ SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst )
{
SwTwips nTmp = aRectFnSet.GetHeight(pFrame->getSwFrame());
- SwRect aFrm(pFrame->getSwFrame());
- aRectFnSet.SetHeight( aFrm, nTmp - nReal );
-
- if( aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() && !aRectFnSet.IsRev() )
{
- aFrm.Pos().X() += nReal;
+ SwFrameRect::FrameWriteAccess aFrm(*pFrame);
+ aRectFnSet.SetHeight( aFrm, nTmp - nReal );
+
+ if( aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() && !aRectFnSet.IsRev() )
+ {
+ aFrm.Pos().X() += nReal;
+ }
}
- pFrame->setSwFrame(aFrm);
pFrame->InvalidatePrt();
if ( pFrame->GetNext() )
@@ -1807,15 +1814,15 @@ SwTwips SwContentFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
{
if ( !bTst )
{
- SwRect aFrm(getSwFrame());
- aRectFnSet.SetHeight( aFrm, nFrameHeight + nDist );
-
- if( IsVertical() && !IsVertLR() && !IsReverse() )
{
- aFrm.Pos().X() -= nDist;
- }
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aRectFnSet.SetHeight( aFrm, nFrameHeight + nDist );
- setSwFrame(aFrm);
+ if( IsVertical() && !IsVertLR() && !IsReverse() )
+ {
+ aFrm.Pos().X() -= nDist;
+ }
+ }
if ( GetNext() )
{
@@ -1845,16 +1852,17 @@ SwTwips SwContentFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
{
//Contents are always resized to the wished value.
long nOld = aRectFnSet.GetHeight(getSwFrame());
- SwRect aFrm(getSwFrame());
-
- aRectFnSet.SetHeight( aFrm, nOld + nDist );
- if( IsVertical()&& !IsVertLR() && !IsReverse() )
{
- aFrm.Pos().X() -= nDist;
- }
+ SwFrameRect::FrameWriteAccess aFrm(*this);
- setSwFrame(aFrm);
+ aRectFnSet.SetHeight( aFrm, nOld + nDist );
+
+ if( IsVertical()&& !IsVertLR() && !IsReverse() )
+ {
+ aFrm.Pos().X() -= nDist;
+ }
+ }
SwTabFrame *pTab = (nOld && IsInTab()) ? FindTabFrame() : nullptr;
if (pTab)
@@ -1942,15 +1950,16 @@ SwTwips SwContentFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo )
nRstHeight = nDist;
}
- SwRect aFrm(getSwFrame());
- aRectFnSet.SetHeight( aFrm, aRectFnSet.GetHeight(aFrm) - nDist );
-
- if( IsVertical() && !IsVertLR() )
{
- aFrm.Pos().X() += nDist;
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aRectFnSet.SetHeight( aFrm, aRectFnSet.GetHeight(aFrm) - nDist );
+
+ if( IsVertical() && !IsVertLR() )
+ {
+ aFrm.Pos().X() += nDist;
+ }
}
- setSwFrame(aFrm);
nDist = nRstHeight;
SwTabFrame *pTab = IsInTab() ? FindTabFrame() : nullptr;
if (pTab)
@@ -2338,7 +2347,7 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
bool bChgPos = IsVertical() && !IsReverse();
if ( !bTst )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aRectFnSet.SetHeight( aFrm, nFrameHeight + nDist );
if( bChgPos && !IsVertLR() )
@@ -2346,7 +2355,6 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
aFrm.Pos().X() -= nDist;
}
- setSwFrame(aFrm);
bMoveAccFrame = true;
}
@@ -2425,7 +2433,7 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
// NEW TABLES
( !IsCellFrame() || static_cast<SwCellFrame*>(this)->GetLayoutRowSpan() > 1 ) )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aRectFnSet.SetHeight( aFrm, nFrameHeight + nReal );
if( bChgPos && !IsVertLR() )
@@ -2433,7 +2441,6 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
aFrm.Pos().X() = nFramePos - nReal;
}
- setSwFrame(aFrm);
bMoveAccFrame = true;
}
@@ -2533,7 +2540,7 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo )
SwTwips nRealDist = nReal;
if ( !bTst )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aRectFnSet.SetHeight( aFrm, nFrameHeight - nReal );
if( bChgPos && !IsVertLR() )
@@ -2541,7 +2548,6 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo )
aFrm.Pos().X() += nReal;
}
- setSwFrame(aFrm);
bMoveAccFrame = true;
}
@@ -2559,7 +2565,7 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo )
nReal *= -1;
if ( !bTst && IsBodyFrame() && nReal < nRealDist )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aRectFnSet.SetHeight( aFrm, aRectFnSet.GetHeight(aFrm) + nRealDist - nReal );
if( bChgPos && !IsVertLR() )
@@ -2567,7 +2573,6 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo )
aFrm.Pos().X() += nRealDist - nReal;
}
- setSwFrame(aFrm);
OSL_ENSURE( !IsAccessibleFrame(), "bMoveAccFrame has to be set!" );
}
}
@@ -2577,7 +2582,7 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo )
SwTwips nTmp = GetUpper()->Shrink( nReal, bTst, bInfo );
if ( nTmp != nReal )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aRectFnSet.SetHeight( aFrm, aRectFnSet.GetHeight(aFrm) + nReal - nTmp );
if( bChgPos && !IsVertLR() )
@@ -2585,7 +2590,6 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo )
aFrm.Pos().X() += nTmp - nReal;
}
- setSwFrame(aFrm);
OSL_ENSURE( !IsAccessibleFrame(), "bMoveAccFrame has to be set!" );
nReal = nTmp;
}
@@ -2892,9 +2896,8 @@ 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.
- SwRect aFrm(pLowerFrame->getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*pLowerFrame);
aFrm.Width( getSwPrint().Width() );
- pLowerFrame->setSwFrame(aFrm);
}
else if( rOldSize.Width() && !pLowerFrame->IsFootnoteFrame() )
{
@@ -2924,9 +2927,8 @@ void SwLayoutFrame::ChgLowersProp( const Size& rOldSize )
(pLowerFrame->getSwFrame().Width() * getSwPrint().Width()) / rOldSize.Width();
}
- SwRect aFrm(pLowerFrame->getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*pLowerFrame);
aFrm.Width( nNewWidth );
- pLowerFrame->setSwFrame(aFrm);
}
}
if ( bHeightChgd )
@@ -2938,9 +2940,8 @@ 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.
- SwRect aFrm(pLowerFrame->getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*pLowerFrame);
aFrm.Height( getSwPrint().Height() );
- pLowerFrame->setSwFrame(aFrm);
}
// OD 01.10.2002 #102211#
// add conditions <!pLowerFrame->IsHeaderFrame()> and
@@ -2997,9 +2998,8 @@ void SwLayoutFrame::ChgLowersProp( const Size& rOldSize )
nNewHeight = 0;
}
- SwRect aFrm(pLowerFrame->getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*pLowerFrame);
aFrm.Height( nNewHeight );
- pLowerFrame->setSwFrame(aFrm);
}
}
}
@@ -3038,9 +3038,8 @@ void SwLayoutFrame::ChgLowersProp( const Size& rOldSize )
nNewHeight = nSum;
}
- SwRect aFrm(pLowerFrame->getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*pLowerFrame);
aFrm.Height( nNewHeight );
- pLowerFrame->setSwFrame(aFrm);
}
}
}
@@ -3428,9 +3427,10 @@ void SwLayoutFrame::FormatWidthCols( const SwBorderAttrs &rAttrs,
long nTop = aRectFnSet.GetTopMargin(*this);
// #i23129# - correction
// to the calculated maximum height.
- SwRect aFrm(getSwFrame());
- aRectFnSet.AddBottom( aFrm, nMaximum - aRectFnSet.GetHeight(getSwFrame()) );
- setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aRectFnSet.AddBottom( aFrm, nMaximum - aRectFnSet.GetHeight(getSwFrame()) );
+ }
if( nTop > nMaximum )
nTop = nMaximum;
@@ -3636,9 +3636,10 @@ void SwLayoutFrame::FormatWidthCols( const SwBorderAttrs &rAttrs,
long nTop = aRectFnSet.GetTopMargin(*this);
nDiff = aRectFnSet.GetHeight(getSwPrint()) + nDiff + nBorder - aRectFnSet.GetHeight(getSwFrame());
- SwRect aFrm(getSwFrame());
- aRectFnSet.AddBottom( aFrm, nDiff );
- setSwFrame(aFrm);
+ {
+ SwFrameRect::FrameWriteAccess aFrm(*this);
+ aRectFnSet.AddBottom( aFrm, nDiff );
+ }
// #i68520#
SwFlyFrame *pFlyFrame = dynamic_cast<SwFlyFrame*>(this);
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index f7a1fd49aa7b..79921b43c4df 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -374,11 +374,10 @@ void SwTextFrame::AdjustFrame( const SwTwips nChgHght, bool bHasToFit )
if( aRectFnSet.BottomDist( pCont->getSwFrame(), nBot ) > 0 )
{
- SwRect aFrm(getSwFrame());
+ SwFrameRect::FrameWriteAccess aFrm(*this);
aRectFnSet.AddBottom( aFrm, nChgHght );
- setSwFrame(aFrm);
- SwRect aPrt(getSwPrint());
+ SwFrameRect::PrintWriteAccess aPrt(*this);
if( aRectFnSet.IsVert() )
{
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list