[Libreoffice-commits] core.git: sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Jul 24 06:36:31 UTC 2018
sw/source/uibase/docvw/AnchorOverlayObject.cxx | 18 +++++-------------
sw/source/uibase/docvw/AnchorOverlayObject.hxx | 2 +-
sw/source/uibase/docvw/AnnotationWin.cxx | 4 ++--
sw/source/uibase/docvw/ShadowOverlayObject.cxx | 16 ++++------------
sw/source/uibase/docvw/ShadowOverlayObject.hxx | 4 ++--
5 files changed, 14 insertions(+), 30 deletions(-)
New commits:
commit 98c21af70727bcaae4ec0754eb922f1b50b99604
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 23 15:57:28 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jul 24 08:36:08 2018 +0200
use regular destructor for AnchorOverlayObject and ShadowOverlayObject
no need for static methods
Change-Id: I8de3bf41183ef592f9c08d8d227834fa64d772fa
Reviewed-on: https://gerrit.libreoffice.org/57849
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/uibase/docvw/AnchorOverlayObject.cxx b/sw/source/uibase/docvw/AnchorOverlayObject.cxx
index 0afa6c36f0bd..e89a79daacd8 100644
--- a/sw/source/uibase/docvw/AnchorOverlayObject.cxx
+++ b/sw/source/uibase/docvw/AnchorOverlayObject.cxx
@@ -207,19 +207,6 @@ ImplPrimitive2DIDBlock(AnchorPrimitive, PRIMITIVE2D_ID_SWSIDEBARANCHORPRIMITIVE)
return pAnchorOverlayObject;
}
-/*static*/ void AnchorOverlayObject::DestroyAnchorOverlayObject( AnchorOverlayObject* pAnchor )
-{
- if ( pAnchor )
- {
- if ( pAnchor->getOverlayManager() )
- {
- // remove this object from the chain
- pAnchor->getOverlayManager()->remove(*pAnchor);
- }
- delete pAnchor;
- }
-}
-
AnchorOverlayObject::AnchorOverlayObject( const basegfx::B2DPoint& rBasePos,
const basegfx::B2DPoint& rSecondPos,
const basegfx::B2DPoint& rThirdPos,
@@ -245,6 +232,11 @@ AnchorOverlayObject::AnchorOverlayObject( const basegfx::B2DPoint& rBasePos,
AnchorOverlayObject::~AnchorOverlayObject()
{
+ if ( getOverlayManager() )
+ {
+ // remove this object from the chain
+ getOverlayManager()->remove(*this);
+ }
}
void AnchorOverlayObject::implEnsureGeometry()
diff --git a/sw/source/uibase/docvw/AnchorOverlayObject.hxx b/sw/source/uibase/docvw/AnchorOverlayObject.hxx
index 2ae993fb036e..d249a220c7b7 100644
--- a/sw/source/uibase/docvw/AnchorOverlayObject.hxx
+++ b/sw/source/uibase/docvw/AnchorOverlayObject.hxx
@@ -46,7 +46,6 @@ class AnchorOverlayObject final : public sdr::overlay::OverlayObjectWithBasePosi
const Point& aLineStart,
const Point& aLineEnd,
const Color& aColorAnchor );
- static void DestroyAnchorOverlayObject( AnchorOverlayObject* pAnchor );
const basegfx::B2DPoint& GetSecondPosition() const { return maSecondPosition; }
const basegfx::B2DPoint& GetThirdPosition() const { return maThirdPosition; }
@@ -113,6 +112,7 @@ class AnchorOverlayObject final : public sdr::overlay::OverlayObjectWithBasePosi
const basegfx::B2DPoint& rSixthPos,
const basegfx::B2DPoint& rSeventhPos,
const Color& rBaseColor );
+ public:
virtual ~AnchorOverlayObject() override;
};
diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx
index 07cba9d60d4b..e2fc68e8761d 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -166,10 +166,10 @@ void SwAnnotationWin::dispose()
RemoveEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
- sidebarwindows::AnchorOverlayObject::DestroyAnchorOverlayObject( mpAnchor );
+ delete mpAnchor;
mpAnchor = nullptr;
- sidebarwindows::ShadowOverlayObject::DestroyShadowOverlayObject( mpShadow );
+ delete mpShadow;
mpShadow = nullptr;
mpTextRangeOverlay.reset();
diff --git a/sw/source/uibase/docvw/ShadowOverlayObject.cxx b/sw/source/uibase/docvw/ShadowOverlayObject.cxx
index b74dbae68a79..2f7385d235ec 100644
--- a/sw/source/uibase/docvw/ShadowOverlayObject.cxx
+++ b/sw/source/uibase/docvw/ShadowOverlayObject.cxx
@@ -180,18 +180,6 @@ ImplPrimitive2DIDBlock(ShadowPrimitive, PRIMITIVE2D_ID_SWSIDEBARSHADOWPRIMITIVE)
return pShadowOverlayObject;
}
-/* static */ void ShadowOverlayObject::DestroyShadowOverlayObject( ShadowOverlayObject* pShadow )
-{
- if ( pShadow )
- {
- if ( pShadow->getOverlayManager() )
- {
- pShadow->getOverlayManager()->remove(*pShadow);
- }
- delete pShadow;
- }
-}
-
ShadowOverlayObject::ShadowOverlayObject( const basegfx::B2DPoint& rBasePos,
const basegfx::B2DPoint& rSecondPosition,
Color aBaseColor )
@@ -203,6 +191,10 @@ ShadowOverlayObject::ShadowOverlayObject( const basegfx::B2DPoint& rBasePos,
ShadowOverlayObject::~ShadowOverlayObject()
{
+ if ( getOverlayManager() )
+ {
+ getOverlayManager()->remove(*this);
+ }
}
drawinglayer::primitive2d::Primitive2DContainer ShadowOverlayObject::createOverlayObjectPrimitive2DSequence()
diff --git a/sw/source/uibase/docvw/ShadowOverlayObject.hxx b/sw/source/uibase/docvw/ShadowOverlayObject.hxx
index 90731b073021..5c4582cbeaf8 100644
--- a/sw/source/uibase/docvw/ShadowOverlayObject.hxx
+++ b/sw/source/uibase/docvw/ShadowOverlayObject.hxx
@@ -46,9 +46,10 @@ private:
ShadowOverlayObject( const basegfx::B2DPoint& rBasePos,
const basegfx::B2DPoint& rSecondPosition,
Color aBaseColor );
- virtual ~ShadowOverlayObject() override;
public:
+ virtual ~ShadowOverlayObject() override;
+
void SetShadowState(ShadowState aState);
ShadowState GetShadowState() {return mShadowState;}
@@ -56,7 +57,6 @@ public:
const basegfx::B2DPoint& rPoint2 );
static ShadowOverlayObject* CreateShadowOverlayObject( SwView const & rDocView );
- static void DestroyShadowOverlayObject( ShadowOverlayObject* pShadow );
};
} } // end of namespace sw::sidebarwindows
More information about the Libreoffice-commits
mailing list