[Libreoffice-commits] core.git: 2 commits - lotuswordpro/inc lotuswordpro/source
Noel Grandin
noel.grandin at collabora.co.uk
Mon Mar 5 06:34:31 UTC 2018
lotuswordpro/inc/xfilter/xfheaderstyle.hxx | 7 ++---
lotuswordpro/inc/xfilter/xfparastyle.hxx | 5 ++-
lotuswordpro/source/filter/xfilter/xfheaderstyle.cxx | 18 +++----------
lotuswordpro/source/filter/xfilter/xfparastyle.cxx | 26 ++++++-------------
4 files changed, 21 insertions(+), 35 deletions(-)
New commits:
commit 8683fbd30161ef9b7e6f28be339a63b092698896
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Mar 1 11:35:23 2018 +0200
loplugin:useuniqueptr in XFParaStyle
Change-Id: I883c54698022d07dbcb72e66b1108178cf27a5ae
Reviewed-on: https://gerrit.libreoffice.org/50751
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
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,
commit 202aba9a07610b0f70e4daa13a2629f31dc29b62
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Mar 1 11:20:56 2018 +0200
loplugin:useuniqueptr in XFHeaderStyle
Change-Id: Id1e29fde9d6dfcd3c816967272c80ace85d515cc
Reviewed-on: https://gerrit.libreoffice.org/50750
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/lotuswordpro/inc/xfilter/xfheaderstyle.hxx b/lotuswordpro/inc/xfilter/xfheaderstyle.hxx
index 16795bcf56d1..3207694bcb51 100644
--- a/lotuswordpro/inc/xfilter/xfheaderstyle.hxx
+++ b/lotuswordpro/inc/xfilter/xfheaderstyle.hxx
@@ -65,6 +65,7 @@
#include <xfilter/xfborders.hxx>
#include <xfilter/xfpadding.hxx>
#include <xfilter/xfshadow.hxx>
+#include <memory>
/**
* @brief
@@ -124,10 +125,10 @@ protected:
double m_fHeight;
double m_fMinHeight;
XFMargins m_aMargin;
- XFShadow* m_pShadow;
+ std::unique_ptr<XFShadow> m_pShadow;
XFPadding m_aPadding;
- XFBorders *m_pBorders;
- XFBGImage *m_pBGImage;
+ std::unique_ptr<XFBorders> m_pBorders;
+ std::unique_ptr<XFBGImage> m_pBGImage;
XFColor m_aBackColor;
};
diff --git a/lotuswordpro/source/filter/xfilter/xfheaderstyle.cxx b/lotuswordpro/source/filter/xfilter/xfheaderstyle.cxx
index 29ad6cf4566e..d2afc95ecc67 100644
--- a/lotuswordpro/source/filter/xfilter/xfheaderstyle.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfheaderstyle.cxx
@@ -66,16 +66,10 @@ XFHeaderStyle::XFHeaderStyle(bool isFooter)
m_bDynamicSpace = true;
m_fHeight = -1;
m_fMinHeight = -1;
- m_pBorders = nullptr;
- m_pShadow = nullptr;
- m_pBGImage = nullptr;
}
XFHeaderStyle::~XFHeaderStyle()
{
- delete m_pBorders;
- delete m_pBGImage;
- delete m_pShadow;
}
void XFHeaderStyle::SetMargins(double left, double right, double bottom)
@@ -104,21 +98,19 @@ void XFHeaderStyle::SetMinHeight(double minHeight)
void XFHeaderStyle::SetShadow(XFShadow *pShadow)
{
- if( m_pShadow && (pShadow != m_pShadow) )
- delete m_pShadow;
- m_pShadow = pShadow;
+ if( pShadow == m_pShadow.get() )
+ return;
+ m_pShadow.reset( pShadow );
}
void XFHeaderStyle::SetBorders(XFBorders *pBorders)
{
- delete m_pBorders;
- m_pBorders = pBorders;
+ m_pBorders.reset(pBorders);
}
void XFHeaderStyle::SetBackImage(XFBGImage *image)
{
- delete m_pBGImage;
- m_pBGImage = image;
+ m_pBGImage.reset( image );
}
void XFHeaderStyle::SetBackColor(XFColor color)
More information about the Libreoffice-commits
mailing list