svx/source/engine3d/scene3d.cxx |    5 +++--
 svx/source/svdraw/svdobj.cxx    |   32 ++++++++++++++++++--------------
 svx/source/svdraw/svdogrp.cxx   |    4 ++--
 svx/source/svdraw/svdovirt.cxx  |    4 ++--
 4 files changed, 25 insertions(+), 20 deletions(-)

New commits:
commit 71baa4904f9e78bece1dcc28ac1df076deddd99f
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Tue Feb 7 12:27:19 2023 +0900
Commit:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
CommitDate: Tue Feb 7 12:27:19 2023 +0900

    svx: don't access m_aOutRect directly - go through methods
    
    Change-Id: If37d6fd7108d1289f838bd3f81ae9b500c8ddb5a

diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx
index 7a886fafc036..b5a1afb0f038 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 f23f9158e56c..f9e061d59e17 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 20d605e99a2d..6c63e258a963 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 ab95fd633b16..e8f6284b3b2e 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()

Reply via email to