svx: don't access m_aOutRect directly - go through methods
Change-Id: If37d6fd7108d1289f838bd3f81ae9b500c8ddb5a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146601
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
diff --git a/include/svx/svdomeas.hxx b/include/svx/svdomeas.hxx
index cf0f06e..7ddf4d7 100644
--- a/include/svx/svdomeas.hxx
+++ b/include/svx/svdomeas.hxx
@@ -65,7 +65,7 @@ private:
{
bTextDirty=true;
SetTextSizeDirty();
if (!m_aOutRect.IsEmpty())
if (!getOutRectangle().IsEmpty())
{
SetBoundRectDirty();
SetBoundAndSnapRectsDirty(/*bNotMyself*/true);
diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx
index 7a886fa..b5a1afb 100644
--- a/svx/source/engine3d/scene3d.cxx
+++ b/svx/source/engine3d/scene3d.cxx
@@ -524,8 +524,9 @@ void E3dScene::RotateScene (const Point& rRef, double sn, double cs)
{
Point UpperLeft, LowerRight, Center, NewCenter;
UpperLeft = m_aOutRect.TopLeft();
LowerRight = m_aOutRect.BottomRight();
auto const& rRectangle = getOutRectangle();
UpperLeft = rRectangle.TopLeft();
LowerRight = rRectangle.BottomRight();
tools::Long dxOutRectHalf = std::abs(UpperLeft.X() - LowerRight.X());
dxOutRectHalf /= 2;
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index f23f915..f9e061d 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -328,7 +328,7 @@ SdrObjList* SdrObject::getChildrenOfSdrObject() const
void SdrObject::SetBoundRectDirty()
{
m_aOutRect = tools::Rectangle();
resetOutRectangle();
}
#ifdef DBG_UTIL
@@ -425,7 +425,7 @@ SdrObject::SdrObject(SdrModel& rSdrModel, SdrObject const & rSource)
// draw object, an SdrObject needs to be provided, as in the normal constructor.
mpProperties = rSource.GetProperties().Clone(*this);
m_aOutRect=rSource.m_aOutRect;
setOutRectangle(rSource.getOutRectangle());
mnLayerID = rSource.mnLayerID;
m_aAnchor =rSource.m_aAnchor;
m_bVirtObj=rSource.m_bVirtObj;
@@ -925,12 +925,13 @@ void SdrObject::SetNavigationPosition (const sal_uInt32 nNewPosition)
// GetCurrentBoundRect().
const tools::Rectangle& SdrObject::GetCurrentBoundRect() const
{
if(m_aOutRect.IsEmpty())
auto const& rRectangle = getOutRectangle();
if (rRectangle.IsEmpty())
{
const_cast< SdrObject* >(this)->RecalcBoundRect();
}
return m_aOutRect;
return rRectangle;
}
// To have a possibility to get the last calculated BoundRect e.g for producing
@@ -939,7 +940,7 @@ const tools::Rectangle& SdrObject::GetCurrentBoundRect() const
// a new method for accessing the last BoundRect.
const tools::Rectangle& SdrObject::GetLastBoundRect() const
{
return m_aOutRect;
return getOutRectangle();
}
void SdrObject::RecalcBoundRect()
@@ -948,8 +949,10 @@ void SdrObject::RecalcBoundRect()
if ((getSdrModelFromSdrObject().isLocked()) || utl::ConfigManager::IsFuzzing())
return;
auto const& rRectangle = getOutRectangle();
// central new method which will calculate the BoundRect using primitive geometry
if(!m_aOutRect.IsEmpty())
if (!rRectangle.IsEmpty())
return;
// Use view-independent data - we do not want any connections
@@ -957,20 +960,21 @@ void SdrObject::RecalcBoundRect()
drawinglayer::primitive2d::Primitive2DContainer xPrimitives;
GetViewContact().getViewIndependentPrimitive2DContainer(xPrimitives);
if(xPrimitives.empty())
if (xPrimitives.empty())
return;
// use neutral ViewInformation and get the range of the primitives
const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
const basegfx::B2DRange aRange(xPrimitives.getB2DRange(aViewInformation2D));
if(!aRange.isEmpty())
if (!aRange.isEmpty())
{
m_aOutRect = tools::Rectangle(
static_cast<tools::Long>(floor(aRange.getMinX())),
static_cast<tools::Long>(floor(aRange.getMinY())),
static_cast<tools::Long>(ceil(aRange.getMaxX())),
static_cast<tools::Long>(ceil(aRange.getMaxY())));
tools::Rectangle aNewRectangle(
tools::Long(floor(aRange.getMinX())),
tools::Long(floor(aRange.getMinY())),
tools::Long(ceil(aRange.getMaxX())),
tools::Long(ceil(aRange.getMaxY())));
setOutRectangle(aNewRectangle);
return;
}
}
@@ -1664,7 +1668,7 @@ void SdrObject::RecalcSnapRect()
const tools::Rectangle& SdrObject::GetSnapRect() const
{
return m_aOutRect;
return getOutRectangle();
}
void SdrObject::NbcSetSnapRect(const tools::Rectangle& rRect)
diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx
index 20d605e..6c63e25 100644
--- a/svx/source/svdraw/svdogrp.cxx
+++ b/svx/source/svdraw/svdogrp.cxx
@@ -250,7 +250,7 @@ const tools::Rectangle& SdrObjGroup::GetCurrentBoundRect() const
setOutRectangleConst(GetAllObjBoundRect());
}
return m_aOutRect;
return getOutRectangle();
}
const tools::Rectangle& SdrObjGroup::GetSnapRect() const
@@ -262,7 +262,7 @@ const tools::Rectangle& SdrObjGroup::GetSnapRect() const
}
else
{
return m_aOutRect;
return getOutRectangle();
}
}
diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx
index ab95fd6..e8f6284 100644
--- a/svx/source/svdraw/svdovirt.cxx
+++ b/svx/source/svdraw/svdovirt.cxx
@@ -146,7 +146,7 @@ const tools::Rectangle& SdrVirtObj::GetCurrentBoundRect() const
auto aRectangle = mxRefObj->GetCurrentBoundRect(); // TODO: Optimize this.
aRectangle += m_aAnchor;
setOutRectangleConst(aRectangle);
return m_aOutRect;
return getOutRectangle();
}
const tools::Rectangle& SdrVirtObj::GetLastBoundRect() const
@@ -154,7 +154,7 @@ const tools::Rectangle& SdrVirtObj::GetLastBoundRect() const
auto aRectangle = mxRefObj->GetLastBoundRect(); // TODO: Optimize this.
aRectangle += m_aAnchor;
setOutRectangleConst(aRectangle);
return m_aOutRect;
return getOutRectangle();
}
void SdrVirtObj::RecalcBoundRect()
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 156f73a..a7c57ec 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -2428,24 +2428,24 @@ void SwDrawVirtObj::NbcSetAnchorPos(const Point& rPnt)
const tools::Rectangle& SwDrawVirtObj::GetCurrentBoundRect() const
{
if (m_aOutRect.IsEmpty())
if (getOutRectangle().IsEmpty())
{
const_cast<SwDrawVirtObj*>(this)->RecalcBoundRect();
}
return m_aOutRect;
return getOutRectangle();
}
const tools::Rectangle& SwDrawVirtObj::GetLastBoundRect() const
{
return m_aOutRect;
return getOutRectangle();
}
Point SwDrawVirtObj::GetOffset() const
{
// do NOT use IsEmpty() here, there is already a useful offset
// in the position
if (m_aOutRect == tools::Rectangle())
if (getOutRectangle() == tools::Rectangle())
{
return Point();
}
diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx
index 9e2b96c..3095d5a 100644
--- a/sw/source/core/draw/dflyobj.cxx
+++ b/sw/source/core/draw/dflyobj.cxx
@@ -559,7 +559,7 @@ void SwVirtFlyDrawObj::SetRect() const
const tools::Rectangle& SwVirtFlyDrawObj::GetCurrentBoundRect() const
{
SetRect();
return m_aOutRect;
return getOutRectangle();
}
const tools::Rectangle& SwVirtFlyDrawObj::GetLastBoundRect() const
@@ -580,7 +580,7 @@ void SwVirtFlyDrawObj::RecalcSnapRect()
const tools::Rectangle& SwVirtFlyDrawObj::GetSnapRect() const
{
SetRect();
return m_aOutRect;
return getOutRectangle();
}
void SwVirtFlyDrawObj::SetSnapRect(const tools::Rectangle& )
@@ -601,7 +601,7 @@ void SwVirtFlyDrawObj::NbcSetSnapRect(const tools::Rectangle& )
const tools::Rectangle& SwVirtFlyDrawObj::GetLogicRect() const
{
SetRect();
return m_aOutRect;
return getOutRectangle();
}
void SwVirtFlyDrawObj::SetLogicRect(const tools::Rectangle& )