diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-01 11:18:42 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-05 07:33:57 +0100 |
commit | c0c42c56159d1d1185702cb0c400e460727dc168 (patch) | |
tree | 8852f4b342357ca277e1cf2f93e0f7f551ed6591 | |
parent | b7d4573b5c217cd5d32723092911c654452b554d (diff) |
loplugin:useuniqueptr in XFDrawStyle
Change-Id: I91ade5500596765480940b82807504e5c3fafedb
Reviewed-on: https://gerrit.libreoffice.org/50749
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | lotuswordpro/inc/xfilter/xfdrawstyle.hxx | 3 | ||||
-rw-r--r-- | lotuswordpro/source/filter/xfilter/xfdrawstyle.cxx | 10 |
2 files changed, 4 insertions, 9 deletions
diff --git a/lotuswordpro/inc/xfilter/xfdrawstyle.hxx b/lotuswordpro/inc/xfilter/xfdrawstyle.hxx index e6ea960100ca..e5a596a201ba 100644 --- a/lotuswordpro/inc/xfilter/xfdrawstyle.hxx +++ b/lotuswordpro/inc/xfilter/xfdrawstyle.hxx @@ -63,6 +63,7 @@ #include <xfilter/xfstyle.hxx> #include <xfilter/xfcolor.hxx> #include <cassert> +#include <memory> class XFDrawLineStyle; class XFDrawAreaStyle; @@ -120,7 +121,7 @@ public: virtual void ToXml(IXFStream *pStrm) override; private: - XFFontWorkStyle* m_pFontWorkStyle; + std::unique_ptr<XFFontWorkStyle> m_pFontWorkStyle; enumXFWrap m_eWrap; XFDrawLineStyle *m_pLineStyle; XFDrawAreaStyle *m_pAreaStyle; diff --git a/lotuswordpro/source/filter/xfilter/xfdrawstyle.cxx b/lotuswordpro/source/filter/xfilter/xfdrawstyle.cxx index 445919b8f1e3..bb5c76013625 100644 --- a/lotuswordpro/source/filter/xfilter/xfdrawstyle.cxx +++ b/lotuswordpro/source/filter/xfilter/xfdrawstyle.cxx @@ -64,8 +64,7 @@ #include "xffontworkstyle.hxx" #include <lwpglobalmgr.hxx> XFDrawStyle::XFDrawStyle() - : m_pFontWorkStyle(nullptr) - , m_eWrap(enumXFWrapNone) + : m_eWrap(enumXFWrapNone) , m_pLineStyle(nullptr) , m_pAreaStyle(nullptr) , m_fArrowStartSize(0.3) @@ -77,11 +76,6 @@ XFDrawStyle::XFDrawStyle() XFDrawStyle::~XFDrawStyle() { //don't delete m_pLineStyle, it was managed by XFStyleManager. - if (m_pFontWorkStyle) - { - delete m_pFontWorkStyle; - m_pFontWorkStyle = nullptr; - } } void XFDrawStyle::SetLineStyle(double width, XFColor color) @@ -117,7 +111,7 @@ void XFDrawStyle::SetFontWorkStyle(enumXFFWStyle eStyle, enumXFFWAdjust eAdjust) { if (!m_pFontWorkStyle) { - m_pFontWorkStyle = new XFFontWorkStyle(); + m_pFontWorkStyle.reset( new XFFontWorkStyle() ); } m_pFontWorkStyle->SetButtonForm(0); |