[Libreoffice-commits] core.git: 2 commits - lotuswordpro/inc lotuswordpro/source

Noel Grandin noel.grandin at collabora.co.uk
Mon Mar 5 06:34:54 UTC 2018


 lotuswordpro/inc/xfilter/xfframestyle.hxx           |    9 ++--
 lotuswordpro/inc/xfilter/xfpagemaster.hxx           |   13 +++---
 lotuswordpro/source/filter/xfilter/xfframestyle.cxx |   20 +--------
 lotuswordpro/source/filter/xfilter/xfpagemaster.cxx |   42 ++++++++------------
 4 files changed, 33 insertions(+), 51 deletions(-)

New commits:
commit 04c9cb68dffa2af15661cc35bc61032b036ed2cd
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Mar 1 12:10:30 2018 +0200

    loplugin:useuniqueptr in XFPageMaster
    
    Change-Id: I0255118c8b94c301e0be50cff358bfc77b84f834
    Reviewed-on: https://gerrit.libreoffice.org/50753
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

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(
commit 5ee24060e4bb9490afb9f7322a13a52bd33dcd0b
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Mar 1 12:06:15 2018 +0200

    loplugin:useuniqueptr in XFFrameStyle
    
    Change-Id: I812c9fc7ab297e962994265e69feb80f82adc49a
    Reviewed-on: https://gerrit.libreoffice.org/50752
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/lotuswordpro/inc/xfilter/xfframestyle.hxx b/lotuswordpro/inc/xfilter/xfframestyle.hxx
index 11db8a900896..6fa40fe0bca0 100644
--- a/lotuswordpro/inc/xfilter/xfframestyle.hxx
+++ b/lotuswordpro/inc/xfilter/xfframestyle.hxx
@@ -66,6 +66,7 @@
 #include <xfilter/xfmargins.hxx>
 #include <xfilter/xfcolor.hxx>
 #include <xfilter/xfpadding.hxx>
+#include <memory>
 
 class XFBorders;
 class XFColumns;
@@ -151,10 +152,10 @@ protected:
     enumXFWrap  m_eWrap;
     XFPadding   m_aPad;
     XFMargins   m_aMargins;
-    XFBorders   *m_pBorders;
-    XFColumns   *m_pColumns;
-    XFShadow    *m_pShadow;
-    XFBGImage   *m_pBGImage;
+    std::unique_ptr<XFBorders> m_pBorders;
+    std::unique_ptr<XFColumns> m_pColumns;
+    std::unique_ptr<XFShadow>  m_pShadow;
+    std::unique_ptr<XFBGImage> m_pBGImage;
     XFColor     m_aBackColor;
     bool        m_bProtectContent;
     bool        m_bProtectSize;
diff --git a/lotuswordpro/source/filter/xfilter/xfframestyle.cxx b/lotuswordpro/source/filter/xfilter/xfframestyle.cxx
index 1127633f8ae4..f40ee4651540 100644
--- a/lotuswordpro/source/filter/xfilter/xfframestyle.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfframestyle.cxx
@@ -65,10 +65,6 @@
 
 XFFrameStyle::XFFrameStyle()
     : m_eWrap(enumXFWrapNone)
-    , m_pBorders(nullptr)
-    , m_pColumns(nullptr)
-    , m_pShadow(nullptr)
-    , m_pBGImage(nullptr)
     , m_bProtectContent(false)
     , m_bProtectSize(false)
     , m_bProtectPos(false)
@@ -82,34 +78,26 @@ XFFrameStyle::XFFrameStyle()
 
 XFFrameStyle::~XFFrameStyle()
 {
-    delete m_pBorders;
-    delete m_pColumns;
-    delete m_pShadow;
-    delete m_pBGImage;
 }
 
 void    XFFrameStyle::SetBorders(XFBorders *pBorders)
 {
-    delete m_pBorders;
-    m_pBorders = pBorders;
+    m_pBorders.reset(pBorders);
 }
 
 void    XFFrameStyle::SetColumns(XFColumns *pColumns)
 {
-    delete m_pColumns;
-    m_pColumns = pColumns;
+    m_pColumns.reset(pColumns);
 }
 
 void    XFFrameStyle::SetShadow(XFShadow *pShadow)
 {
-    delete m_pShadow;
-    m_pShadow = pShadow;
+    m_pShadow.reset(pShadow);
 }
 
 void    XFFrameStyle::SetBackImage(XFBGImage *image)
 {
-    delete m_pBGImage;
-    m_pBGImage = image;
+    m_pBGImage.reset(image);
 }
 
 enumXFStyle XFFrameStyle::GetStyleFamily()


More information about the Libreoffice-commits mailing list