Kaydet (Commit) 0e714e41 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in SwAnnotationWin

Change-Id: I6c362954a8004a246773e6e72137d6eafb6e019e
Reviewed-on: https://gerrit.libreoffice.org/58011
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst ba42d00e
......@@ -108,8 +108,8 @@ class SwAnnotationWin : public vcl::Window
bool HasScrollbar() const;
bool IsScrollbarVisible() const;
ScrollBar* Scrollbar() { return mpVScrollbar; }
::sw::sidebarwindows::AnchorOverlayObject* Anchor() { return mpAnchor;}
::sw::sidebarwindows::ShadowOverlayObject* Shadow() { return mpShadow;}
::sw::sidebarwindows::AnchorOverlayObject* Anchor() { return mpAnchor.get();}
::sw::sidebarwindows::ShadowOverlayObject* Shadow() { return mpShadow.get();}
::sw::overlay::OverlayRanges* TextRange() { return mpTextRangeOverlay.get();}
long GetPostItTextHeight();
......@@ -221,8 +221,8 @@ class SwAnnotationWin : public vcl::Window
VclPtr<Edit> mpMetadataDate;
VclPtr<MenuButton> mpMenuButton;
sw::sidebarwindows::AnchorOverlayObject* mpAnchor;
sw::sidebarwindows::ShadowOverlayObject* mpShadow;
std::unique_ptr<sw::sidebarwindows::AnchorOverlayObject> mpAnchor;
std::unique_ptr<sw::sidebarwindows::ShadowOverlayObject> mpShadow;
std::unique_ptr<sw::overlay::OverlayRanges> mpTextRangeOverlay;
Color mColorAnchor;
......
......@@ -172,7 +172,7 @@ bool AnchorPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive
ImplPrimitive2DIDBlock(AnchorPrimitive, PRIMITIVE2D_ID_SWSIDEBARANCHORPRIMITIVE)
/*static*/ AnchorOverlayObject* AnchorOverlayObject::CreateAnchorOverlayObject(
/*static*/ std::unique_ptr<AnchorOverlayObject> AnchorOverlayObject::CreateAnchorOverlayObject(
SwView const & rDocView,
const SwRect& aAnchorRect,
long aPageBorder,
......@@ -180,7 +180,7 @@ ImplPrimitive2DIDBlock(AnchorPrimitive, PRIMITIVE2D_ID_SWSIDEBARANCHORPRIMITIVE)
const Point& aLineEnd,
const Color& aColorAnchor )
{
AnchorOverlayObject* pAnchorOverlayObject( nullptr );
std::unique_ptr<AnchorOverlayObject> pAnchorOverlayObject;
if ( rDocView.GetDrawView() )
{
SdrPaintWindow* pPaintWindow = rDocView.GetDrawView()->GetPaintWindow(0);
......@@ -190,7 +190,7 @@ ImplPrimitive2DIDBlock(AnchorPrimitive, PRIMITIVE2D_ID_SWSIDEBARANCHORPRIMITIVE)
if ( xOverlayManager.is() )
{
pAnchorOverlayObject = new AnchorOverlayObject(
pAnchorOverlayObject.reset(new AnchorOverlayObject(
basegfx::B2DPoint( aAnchorRect.Left() , aAnchorRect.Bottom()-5*15),
basegfx::B2DPoint( aAnchorRect.Left()-5*15 , aAnchorRect.Bottom()+5*15),
basegfx::B2DPoint( aAnchorRect.Left()+5*15 , aAnchorRect.Bottom()+5*15),
......@@ -198,7 +198,7 @@ ImplPrimitive2DIDBlock(AnchorPrimitive, PRIMITIVE2D_ID_SWSIDEBARANCHORPRIMITIVE)
basegfx::B2DPoint( aPageBorder ,aAnchorRect.Bottom()+2*15),
basegfx::B2DPoint( aLineStart.X(),aLineStart.Y()),
basegfx::B2DPoint( aLineEnd.X(),aLineEnd.Y()) ,
aColorAnchor);
aColorAnchor));
xOverlayManager->add(*pAnchorOverlayObject);
}
}
......
......@@ -40,7 +40,7 @@ enum class AnchorState
class AnchorOverlayObject final : public sdr::overlay::OverlayObjectWithBasePosition
{
public:
static AnchorOverlayObject* CreateAnchorOverlayObject( SwView const & rDocView,
static std::unique_ptr<AnchorOverlayObject> CreateAnchorOverlayObject( SwView const & rDocView,
const SwRect& aAnchorRect,
long aPageBorder,
const Point& aLineStart,
......
......@@ -78,8 +78,6 @@ SwAnnotationWin::SwAnnotationWin( SwEditWin& rEditWin,
, mpMetadataAuthor(nullptr)
, mpMetadataDate(nullptr)
, mpMenuButton(nullptr)
, mpAnchor(nullptr)
, mpShadow(nullptr)
, mpTextRangeOverlay(nullptr)
, mColorAnchor()
, mColorDark()
......@@ -166,11 +164,8 @@ void SwAnnotationWin::dispose()
RemoveEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
delete mpAnchor;
mpAnchor = nullptr;
delete mpShadow;
mpShadow = nullptr;
mpAnchor.reset();
mpShadow.reset();
mpTextRangeOverlay.reset();
......
......@@ -156,9 +156,9 @@ bool ShadowPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive
ImplPrimitive2DIDBlock(ShadowPrimitive, PRIMITIVE2D_ID_SWSIDEBARSHADOWPRIMITIVE)
/* static */ ShadowOverlayObject* ShadowOverlayObject::CreateShadowOverlayObject( SwView const & rDocView )
/* static */ std::unique_ptr<ShadowOverlayObject> ShadowOverlayObject::CreateShadowOverlayObject( SwView const & rDocView )
{
ShadowOverlayObject* pShadowOverlayObject( nullptr );
std::unique_ptr<ShadowOverlayObject> pShadowOverlayObject;
if ( rDocView.GetDrawView() )
{
......@@ -169,9 +169,9 @@ ImplPrimitive2DIDBlock(ShadowPrimitive, PRIMITIVE2D_ID_SWSIDEBARSHADOWPRIMITIVE)
if ( xOverlayManager.is() )
{
pShadowOverlayObject = new ShadowOverlayObject( basegfx::B2DPoint(0,0),
pShadowOverlayObject.reset( new ShadowOverlayObject( basegfx::B2DPoint(0,0),
basegfx::B2DPoint(0,0),
Color(0,0,0) );
Color(0,0,0) ) );
xOverlayManager->add(*pShadowOverlayObject);
}
}
......
......@@ -56,7 +56,7 @@ public:
void SetPosition( const basegfx::B2DPoint& rPoint1,
const basegfx::B2DPoint& rPoint2 );
static ShadowOverlayObject* CreateShadowOverlayObject( SwView const & rDocView );
static std::unique_ptr<ShadowOverlayObject> CreateShadowOverlayObject( SwView const & rDocView );
};
} } // end of namespace sw::sidebarwindows
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment