diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-01 12:10:30 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-05 07:34:44 +0100 |
commit | 04c9cb68dffa2af15661cc35bc61032b036ed2cd (patch) | |
tree | ffbd215f57de6634445d17bee3149c2bdee304dc /lotuswordpro | |
parent | 5ee24060e4bb9490afb9f7322a13a52bd33dcd0b (diff) |
loplugin:useuniqueptr in XFPageMaster
Change-Id: I0255118c8b94c301e0be50cff358bfc77b84f834
Reviewed-on: https://gerrit.libreoffice.org/50753
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'lotuswordpro')
-rw-r--r-- | lotuswordpro/inc/xfilter/xfpagemaster.hxx | 13 | ||||
-rw-r--r-- | lotuswordpro/source/filter/xfilter/xfpagemaster.cxx | 42 |
2 files changed, 24 insertions, 31 deletions
diff --git a/lotuswordpro/inc/xfilter/xfpagemaster.hxx b/lotuswordpro/inc/xfilter/xfpagemaster.hxx index 3a1e5cdcae50..1de301d54125 100644 --- a/lotuswordpro/inc/xfilter/xfpagemaster.hxx +++ b/lotuswordpro/inc/xfilter/xfpagemaster.hxx @@ -65,6 +65,7 @@ #include <xfilter/xfstyle.hxx> #include <xfilter/xfcolor.hxx> #include <xfilter/xfmargins.hxx> +#include <memory> class XFBorders; class XFShadow; @@ -126,14 +127,14 @@ private: enumXFPageUsage m_eUsage; enumXFTextDir m_eTextDir; - XFBorders *m_pBorders; - XFShadow *m_pShadow; + std::unique_ptr<XFBorders> m_pBorders; + std::unique_ptr<XFShadow> m_pShadow; XFColor m_aBackColor; - XFColumns *m_pColumns; - XFBGImage *m_pBGImage; + std::unique_ptr<XFColumns> m_pColumns; + std::unique_ptr<XFBGImage> m_pBGImage; - XFHeaderStyle *m_pHeaderStyle; - XFFooterStyle *m_pFooterStyle; + std::unique_ptr<XFHeaderStyle> m_pHeaderStyle; + std::unique_ptr<XFFooterStyle> m_pFooterStyle; //separator: enumXFAlignType m_eSepAlign; double m_fSepWidth; diff --git a/lotuswordpro/source/filter/xfilter/xfpagemaster.cxx b/lotuswordpro/source/filter/xfilter/xfpagemaster.cxx index c572138e4c04..ba69c6419912 100644 --- a/lotuswordpro/source/filter/xfilter/xfpagemaster.cxx +++ b/lotuswordpro/source/filter/xfilter/xfpagemaster.cxx @@ -69,8 +69,7 @@ #include <xfilter/xfbgimage.hxx> XFPageMaster::XFPageMaster() : m_fPageWidth(0), m_fPageHeight(0), m_eUsage(enumXFPageUsageNone), -m_eTextDir(enumXFTextDirNone), m_pBorders(nullptr), m_pShadow(nullptr), -m_pColumns(nullptr), m_pBGImage(nullptr), m_pHeaderStyle(nullptr), m_pFooterStyle(nullptr), +m_eTextDir(enumXFTextDirNone), m_eSepAlign(enumXFAlignNone), m_fSepWidth(0), m_aSepColor(0), m_fSepSpaceAbove(0), m_fSepSpaceBelow(0), m_nSepLengthPercent(0) { @@ -78,12 +77,6 @@ m_fSepSpaceBelow(0), m_nSepLengthPercent(0) XFPageMaster::~XFPageMaster() { - delete m_pBorders; - delete m_pShadow; - delete m_pColumns; - delete m_pHeaderStyle; - delete m_pFooterStyle; - delete m_pBGImage; } enumXFStyle XFPageMaster::GetStyleFamily() @@ -115,16 +108,16 @@ void XFPageMaster::SetMargins(double left, double right,double top, double bo void XFPageMaster::SetBorders(XFBorders *pBorders) { - if( m_pBorders && (pBorders != m_pBorders) ) - delete m_pBorders; - m_pBorders = pBorders; + if( pBorders == m_pBorders.get() ) + return; + m_pBorders.reset( pBorders ); } void XFPageMaster::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 XFPageMaster::SetBackColor(XFColor color) @@ -134,29 +127,28 @@ void XFPageMaster::SetBackColor(XFColor color) void XFPageMaster::SetBackImage(XFBGImage *image) { - delete m_pBGImage; - m_pBGImage = image; + m_pBGImage.reset( image ); } void XFPageMaster::SetColumns(XFColumns *pColumns) { - if( m_pColumns && (pColumns != m_pColumns) ) - delete m_pColumns; - m_pColumns = pColumns; + if( pColumns == m_pColumns.get() ) + return; + m_pColumns.reset(pColumns); } void XFPageMaster::SetHeaderStyle(XFHeaderStyle *pHeaderStyle) { - if( m_pHeaderStyle && (pHeaderStyle != m_pHeaderStyle) ) - delete m_pHeaderStyle; - m_pHeaderStyle = pHeaderStyle; + if( pHeaderStyle == m_pHeaderStyle.get() ) + return; + m_pHeaderStyle.reset( pHeaderStyle ); } void XFPageMaster::SetFooterStyle(XFFooterStyle *pFooterStyle) { - if( m_pFooterStyle && (pFooterStyle != m_pFooterStyle) ) - delete m_pFooterStyle; - m_pFooterStyle = pFooterStyle; + if( pFooterStyle == m_pFooterStyle.get() ) + return; + m_pFooterStyle.reset( pFooterStyle ); } void XFPageMaster::SetFootNoteSeparator( |