summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-03-01 11:35:23 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-03-05 07:34:19 +0100
commit8683fbd30161ef9b7e6f28be339a63b092698896 (patch)
tree178c734f115c554d597eab265974290ea5c3de2b
parent202aba9a07610b0f70e4daa13a2629f31dc29b62 (diff)
loplugin:useuniqueptr in XFParaStyle
Change-Id: I883c54698022d07dbcb72e66b1108178cf27a5ae Reviewed-on: https://gerrit.libreoffice.org/50751 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--lotuswordpro/inc/xfilter/xfparastyle.hxx5
-rw-r--r--lotuswordpro/source/filter/xfilter/xfparastyle.cxx26
2 files changed, 12 insertions, 19 deletions
diff --git a/lotuswordpro/inc/xfilter/xfparastyle.hxx b/lotuswordpro/inc/xfilter/xfparastyle.hxx
index 2992a3bc0fa2..2efced099158 100644
--- a/lotuswordpro/inc/xfilter/xfparastyle.hxx
+++ b/lotuswordpro/inc/xfilter/xfparastyle.hxx
@@ -77,6 +77,7 @@
#include <xfilter/xfdropcap.hxx>
#include <xfilter/xfstylecont.hxx>
#include <xfilter/xflineheight.hxx>
+#include <memory>
#define XFPARA_FLAG_FONT 0X00000001
#define XFPARA_FLAG_DROPCAP 0X00000002
@@ -231,8 +232,8 @@ protected:
XFStyleContainer m_aTabs;
rtl::Reference<XFFont> m_pFont;
XFShadow m_aShadow;
- XFBorders *m_pBorders;
- XFBGImage *m_pBGImage;
+ std::unique_ptr<XFBorders> m_pBorders;
+ std::unique_ptr<XFBGImage> m_pBGImage;
XFDropcap m_aDropcap;
XFLineHeight m_aLineHeight;
XFBreaks m_aBreaks;
diff --git a/lotuswordpro/source/filter/xfilter/xfparastyle.cxx b/lotuswordpro/source/filter/xfilter/xfparastyle.cxx
index 97ac01022f80..9336e5374c55 100644
--- a/lotuswordpro/source/filter/xfilter/xfparastyle.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfparastyle.cxx
@@ -104,14 +104,10 @@ XFParaStyle::XFParaStyle(const XFParaStyle& other)
, m_bNumberRight(other.m_bNumberRight)
{
if( other.m_pBorders )
- m_pBorders = new XFBorders(*other.m_pBorders);
- else
- m_pBorders = nullptr;
+ m_pBorders.reset( new XFBorders(*other.m_pBorders) );
if( other.m_pBGImage )
- m_pBGImage = new XFBGImage(*other.m_pBGImage);
- else
- m_pBGImage = nullptr;
+ m_pBGImage.reset( new XFBGImage(*other.m_pBGImage) );
for (size_t i = 0; i < other.m_aTabs.GetCount(); ++i)
{
@@ -134,7 +130,7 @@ XFParaStyle& XFParaStyle::operator=(const XFParaStyle& other)
if (this != &other)
{
// first , clean member
- delete m_pBGImage;
+ m_pBGImage.reset();
m_aTabs.Reset();
m_strParentStyleName = other.m_strParentStyleName;
@@ -151,14 +147,14 @@ XFParaStyle& XFParaStyle::operator=(const XFParaStyle& other)
m_pFont = other.m_pFont;
if( other.m_pBorders )
- m_pBorders = new XFBorders(*other.m_pBorders);
+ m_pBorders.reset( new XFBorders(*other.m_pBorders) );
else
- m_pBorders = nullptr;
+ m_pBorders.reset();
m_aBackColor = other.m_aBackColor;
if( other.m_pBGImage )
- m_pBGImage = new XFBGImage(*other.m_pBGImage);
+ m_pBGImage.reset( new XFBGImage(*other.m_pBGImage) );
else
- m_pBGImage = nullptr;
+ m_pBGImage.reset();
m_aShadow = other.m_aShadow;
m_aMargin = other.m_aMargin;
@@ -186,8 +182,6 @@ XFParaStyle& XFParaStyle::operator=(const XFParaStyle& other)
XFParaStyle::~XFParaStyle()
{
- delete m_pBorders;
- delete m_pBGImage;
}
enumXFStyle XFParaStyle::GetStyleFamily()
@@ -232,14 +226,12 @@ void XFParaStyle::SetBackColor(XFColor const & color)
void XFParaStyle::SetBackImage(XFBGImage *image)
{
- delete m_pBGImage;
- m_pBGImage = image;
+ m_pBGImage.reset( image );
}
void XFParaStyle::SetBorders(XFBorders *pBorders)
{
- delete m_pBorders;
- m_pBorders = pBorders;
+ m_pBorders.reset( pBorders );
}
void XFParaStyle::SetDropCap(sal_Int16 nLength,