[Libreoffice-commits] core.git: sw/inc sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Jul 24 06:35:50 UTC 2018
sw/inc/AnnotationWin.hxx | 10 +++++-----
sw/source/uibase/docvw/AnnotationWin.cxx | 16 +++-------------
sw/source/uibase/docvw/AnnotationWin2.cxx | 11 +++++------
sw/source/uibase/docvw/OverlayRanges.cxx | 6 +++---
sw/source/uibase/docvw/OverlayRanges.hxx | 2 +-
5 files changed, 17 insertions(+), 28 deletions(-)
New commits:
commit 3c8a7a1553710a2798058bed0768dd8cfabf9662
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 23 15:35:19 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jul 24 08:35:26 2018 +0200
loplugin:useuniqueptr in SwAnnotationWin
Change-Id: I0a4844898a85f0513da3e3fd7a977e35a9250f1e
Reviewed-on: https://gerrit.libreoffice.org/57878
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx
index 3b865ee71df5..54136b22faf5 100644
--- a/sw/inc/AnnotationWin.hxx
+++ b/sw/inc/AnnotationWin.hxx
@@ -104,13 +104,13 @@ class SwAnnotationWin : public vcl::Window
SwEditWin& EditWin();
SwSidebarItem& GetSidebarItem() { return mrSidebarItem; }
- OutlinerView* GetOutlinerView() { return mpOutlinerView;}
+ OutlinerView* GetOutlinerView() { return mpOutlinerView.get();}
bool HasScrollbar() const;
bool IsScrollbarVisible() const;
ScrollBar* Scrollbar() { return mpVScrollbar; }
::sw::sidebarwindows::AnchorOverlayObject* Anchor() { return mpAnchor;}
::sw::sidebarwindows::ShadowOverlayObject* Shadow() { return mpShadow;}
- ::sw::overlay::OverlayRanges* TextRange() { return mpTextRangeOverlay;}
+ ::sw::overlay::OverlayRanges* TextRange() { return mpTextRangeOverlay.get();}
long GetPostItTextHeight();
@@ -212,8 +212,8 @@ class SwAnnotationWin : public vcl::Window
ImplSVEvent * mnEventId;
- OutlinerView* mpOutlinerView;
- Outliner* mpOutliner;
+ std::unique_ptr<OutlinerView> mpOutlinerView;
+ std::unique_ptr<Outliner> mpOutliner;
VclPtr<sw::sidebarwindows::SidebarTextControl> mpSidebarTextControl;
VclPtr<ScrollBar> mpVScrollbar;
@@ -223,7 +223,7 @@ class SwAnnotationWin : public vcl::Window
sw::sidebarwindows::AnchorOverlayObject* mpAnchor;
sw::sidebarwindows::ShadowOverlayObject* mpShadow;
- sw::overlay::OverlayRanges* mpTextRangeOverlay;
+ std::unique_ptr<sw::overlay::OverlayRanges> mpTextRangeOverlay;
Color mColorAnchor;
Color mColorDark;
diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx
index ac97f4f9b11c..07cba9d60d4b 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -143,17 +143,8 @@ void SwAnnotationWin::dispose()
}
mpSidebarTextControl.disposeAndClear();
- if ( mpOutlinerView )
- {
- delete mpOutlinerView;
- mpOutlinerView = nullptr;
- }
-
- if (mpOutliner)
- {
- delete mpOutliner;
- mpOutliner = nullptr;
- }
+ mpOutlinerView.reset();
+ mpOutliner.reset();
if (mpMetadataAuthor)
{
@@ -181,8 +172,7 @@ void SwAnnotationWin::dispose()
sidebarwindows::ShadowOverlayObject::DestroyShadowOverlayObject( mpShadow );
mpShadow = nullptr;
- delete mpTextRangeOverlay;
- mpTextRangeOverlay = nullptr;
+ mpTextRangeOverlay.reset();
mpMenuButton.disposeAndClear();
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 5e8b94fd77bf..f1c467db21f0 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -486,15 +486,15 @@ void SwAnnotationWin::InitControls()
}
SwDocShell* aShell = mrView.GetDocShell();
- mpOutliner = new Outliner(&aShell->GetPool(),OutlinerMode::TextObject);
- aShell->GetDoc()->SetCalcFieldValueHdl( mpOutliner );
+ mpOutliner.reset(new Outliner(&aShell->GetPool(),OutlinerMode::TextObject));
+ aShell->GetDoc()->SetCalcFieldValueHdl( mpOutliner.get() );
mpOutliner->SetUpdateMode( true );
Rescale();
mpSidebarTextControl->EnableRTL( false );
- mpOutlinerView = new OutlinerView ( mpOutliner, mpSidebarTextControl );
+ mpOutlinerView.reset(new OutlinerView ( mpOutliner.get(), mpSidebarTextControl ));
mpOutlinerView->SetBackgroundColor(COL_TRANSPARENT);
- mpOutliner->InsertView(mpOutlinerView );
+ mpOutliner->InsertView(mpOutlinerView.get() );
mpOutlinerView->SetOutputArea( PixelToLogic( tools::Rectangle(0,0,1,1) ) );
mpOutlinerView->SetAttribs(DefaultItem());
@@ -837,8 +837,7 @@ void SwAnnotationWin::SetPosAndSize()
}
else
{
- delete mpTextRangeOverlay;
- mpTextRangeOverlay = nullptr;
+ mpTextRangeOverlay.reset();
}
}
diff --git a/sw/source/uibase/docvw/OverlayRanges.cxx b/sw/source/uibase/docvw/OverlayRanges.cxx
index 7c0585d8988b..9d7cace2bdca 100644
--- a/sw/source/uibase/docvw/OverlayRanges.cxx
+++ b/sw/source/uibase/docvw/OverlayRanges.cxx
@@ -103,13 +103,13 @@ namespace sw
return aRetval;
}
- /*static*/ OverlayRanges* OverlayRanges::CreateOverlayRange(
+ /*static*/ std::unique_ptr<OverlayRanges> OverlayRanges::CreateOverlayRange(
SwView const & rDocView,
const Color& rColor,
const std::vector< basegfx::B2DRange >& rRanges,
const bool bShowSolidBorder )
{
- OverlayRanges* pOverlayRanges = nullptr;
+ std::unique_ptr<OverlayRanges> pOverlayRanges;
SdrView* pView = rDocView.GetDrawView();
if ( pView != nullptr )
@@ -119,7 +119,7 @@ namespace sw
if ( xTargetOverlay.is() )
{
- pOverlayRanges = new sw::overlay::OverlayRanges( rColor, rRanges, bShowSolidBorder );
+ pOverlayRanges.reset(new sw::overlay::OverlayRanges( rColor, rRanges, bShowSolidBorder ));
xTargetOverlay->add( *pOverlayRanges );
}
}
diff --git a/sw/source/uibase/docvw/OverlayRanges.hxx b/sw/source/uibase/docvw/OverlayRanges.hxx
index 5a4bdfc5966b..7482deef8f97 100644
--- a/sw/source/uibase/docvw/OverlayRanges.hxx
+++ b/sw/source/uibase/docvw/OverlayRanges.hxx
@@ -34,7 +34,7 @@ namespace sw
class OverlayRanges final : public sdr::overlay::OverlayObject
{
public:
- static OverlayRanges* CreateOverlayRange(
+ static std::unique_ptr<OverlayRanges> CreateOverlayRange(
SwView const & rDocView,
const Color& rColor,
const std::vector< basegfx::B2DRange >& rRanges,
More information about the Libreoffice-commits
mailing list