include/svx/svdobj.hxx | 2 -- svx/source/svdraw/svdobj.cxx | 29 ++++++++++------------------- 2 files changed, 10 insertions(+), 21 deletions(-)
New commits: commit 64dfe34cdc0f7db90804bceb25f1e19e534d4d1b Author: Noel Grandin <[email protected]> AuthorDate: Wed Jan 7 17:25:35 2026 +0100 Commit: Noel Grandin <[email protected]> CommitDate: Sat Jan 10 14:21:49 2026 +0100 tdf#170257 Dragging a shape over another shape changes positions Revert the following commit which seems to have caused this problem commit 11fd1adad3b23b57cfc6ffde88672154b02b15b6. tdf#154913 empty is a valid value for m_aOutRect Change-Id: I3e4ef9b27021f76e3e474d00ec59cc8e1784dfff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196781 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index 8b679ecc2373..810670e86c68 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -876,14 +876,12 @@ public: protected: const tools::Rectangle& getOutRectangle() const; - bool isOutRectangleSet() const { return m_bOutRectangleSet; } void setOutRectangleConst(tools::Rectangle const& rRectangle) const; // need to do something about this void setOutRectangle(tools::Rectangle const& rRectangle); void resetOutRectangle(); void moveOutRectangle(sal_Int32 nXDelta, sal_Int32 nYDelta); mutable tools::Rectangle m_aOutRect; // surrounding rectangle for Paint (incl. LineWidth, ...) - mutable bool m_bOutRectangleSet; // empty is a valid rectangle, so we need a separate flag to know when the cached value is not yet set Point m_aAnchor; // anchor position (Writer) SdrObjUserCall* m_pUserCall; std::unique_ptr<SdrObjPlusData> diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 898dae7d6228..c6d90fe2b106 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -357,7 +357,6 @@ void impRemoveIncarnatedSdrObjectToSdrModel(SdrObject& rSdrObject, SdrModel& rSd SdrObject::SdrObject(SdrModel& rSdrModel) : mpFillGeometryDefiningShape(nullptr) , mrSdrModelFromSdrObject(rSdrModel) - , m_bOutRectangleSet(false) , m_pUserCall(nullptr) , mpImpl(new Impl) , mpParentOfSdrObject(nullptr) @@ -395,7 +394,6 @@ SdrObject::SdrObject(SdrModel& rSdrModel) SdrObject::SdrObject(SdrModel& rSdrModel, SdrObject const & rSource) : mpFillGeometryDefiningShape(nullptr) , mrSdrModelFromSdrObject(rSdrModel) - , m_bOutRectangleSet(false) , m_pUserCall(nullptr) , mpImpl(new Impl) , mpParentOfSdrObject(nullptr) @@ -978,12 +976,13 @@ void SdrObject::SetNavigationPosition (const sal_uInt32 nNewPosition) // GetCurrentBoundRect(). const tools::Rectangle& SdrObject::GetCurrentBoundRect() const { - if (!isOutRectangleSet()) + auto const& rRectangle = getOutRectangle(); + if (rRectangle.IsEmpty()) { const_cast< SdrObject* >(this)->RecalcBoundRect(); } - return getOutRectangle(); + return rRectangle; } // To have a possibility to get the last calculated BoundRect e.g for producing @@ -1013,27 +1012,22 @@ void SdrObject::RecalcBoundRect() GetViewContact().getViewIndependentPrimitive2DContainer(xPrimitives); if (xPrimitives.empty()) - { - setOutRectangle(tools::Rectangle()); 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()) { - setOutRectangle(tools::Rectangle()); + 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; } - - 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); } void SdrObject::BroadcastObjectChange() const @@ -3233,19 +3227,16 @@ const tools::Rectangle& SdrObject::getOutRectangle() const void SdrObject::setOutRectangleConst(tools::Rectangle const& rRectangle) const { m_aOutRect = rRectangle; - m_bOutRectangleSet = true; } void SdrObject::setOutRectangle(tools::Rectangle const& rRectangle) { m_aOutRect = rRectangle; - m_bOutRectangleSet = true; } void SdrObject::resetOutRectangle() { m_aOutRect = tools::Rectangle(); - m_bOutRectangleSet = false; } void SdrObject::moveOutRectangle(sal_Int32 nXDelta, sal_Int32 nYDelta)
