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

loplugin:useuniqueptr in SvxLineStyleToolBoxControl

Change-Id: I83e1536a1d45fffbf4fc5ddb611e382568ebf26c
Reviewed-on: https://gerrit.libreoffice.org/49934Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 6e5d8bb2
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <sfx2/tbxctrl.hxx> #include <sfx2/tbxctrl.hxx>
#include <svx/svxdllapi.h> #include <svx/svxdllapi.h>
#include <svx/xtable.hxx> #include <svx/xtable.hxx>
#include <memory>
class XLineStyleItem; class XLineStyleItem;
class XLineDashItem; class XLineDashItem;
...@@ -38,8 +39,8 @@ class SvxMetricField; ...@@ -38,8 +39,8 @@ class SvxMetricField;
class SVX_DLLPUBLIC SvxLineStyleToolBoxControl : public SfxToolBoxControl class SVX_DLLPUBLIC SvxLineStyleToolBoxControl : public SfxToolBoxControl
{ {
private: private:
XLineStyleItem* pStyleItem; std::unique_ptr<XLineStyleItem> pStyleItem;
XLineDashItem* pDashItem; std::unique_ptr<XLineDashItem> pDashItem;
bool bUpdate; bool bUpdate;
......
...@@ -69,8 +69,6 @@ SvxLineStyleToolBoxControl::SvxLineStyleToolBoxControl( sal_uInt16 nSlotId, ...@@ -69,8 +69,6 @@ SvxLineStyleToolBoxControl::SvxLineStyleToolBoxControl( sal_uInt16 nSlotId,
SvxLineStyleToolBoxControl::~SvxLineStyleToolBoxControl() SvxLineStyleToolBoxControl::~SvxLineStyleToolBoxControl()
{ {
delete pStyleItem;
delete pDashItem;
} }
...@@ -95,13 +93,11 @@ void SvxLineStyleToolBoxControl::StateChanged ( ...@@ -95,13 +93,11 @@ void SvxLineStyleToolBoxControl::StateChanged (
{ {
if( nSID == SID_ATTR_LINE_STYLE ) if( nSID == SID_ATTR_LINE_STYLE )
{ {
delete pStyleItem; pStyleItem.reset( static_cast<XLineStyleItem*>(pState->Clone()) );
pStyleItem = static_cast<XLineStyleItem*>(pState->Clone());
} }
else if( nSID == SID_ATTR_LINE_DASH ) else if( nSID == SID_ATTR_LINE_DASH )
{ {
delete pDashItem; pDashItem.reset( static_cast<XLineDashItem*>(pState->Clone()) );
pDashItem = static_cast<XLineDashItem*>(pState->Clone());
} }
bUpdate = true; bUpdate = true;
......
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