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

Caolán McNamara caolanm at redhat.com
Tue Feb 28 11:45:14 UTC 2017


 lotuswordpro/source/filter/lwppagelayout.cxx        |    8 ++---
 lotuswordpro/source/filter/xfilter/xfmasterpage.cxx |   29 +++++---------------
 lotuswordpro/source/filter/xfilter/xfmasterpage.hxx |   13 ++------
 3 files changed, 16 insertions(+), 34 deletions(-)

New commits:
commit 36398bb8ba85dea1d16fe86cd78b0da8380fe7ad
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 28 11:44:17 2017 +0000

    std::unique_ptr -> rtl::Reference for loplugin:refcounting
    
    Change-Id: I83cccff1f4fb172e1b6aa5c1cfda93de2e4be525

diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx
index 4b67421..35d6119 100644
--- a/lotuswordpro/source/filter/lwppagelayout.cxx
+++ b/lotuswordpro/source/filter/lwppagelayout.cxx
@@ -872,7 +872,7 @@ void LwpHeaderLayout::ParseWaterMark(XFHeaderStyle * pHeaderStyle)
 
 void LwpHeaderLayout::RegisterStyle(XFMasterPage* mp1)
 {
-    std::unique_ptr<XFHeader> xHeader(new XFHeader());
+    rtl::Reference<XFHeader> xHeader(new XFHeader());
     rtl::Reference<LwpObject> pStory = m_Content.obj();
     if(pStory.is())
     {
@@ -892,7 +892,7 @@ void LwpHeaderLayout::RegisterStyle(XFMasterPage* mp1)
 
         pChangeMgr->SetHeadFootFribMap(false);
     }
-    mp1->SetHeader(xHeader.release());
+    mp1->SetHeader(xHeader);
 }
 
 LwpFooterLayout::LwpFooterLayout( LwpObjectHeader &objHdr, LwpSvStream* pStrm )
@@ -1023,7 +1023,7 @@ void LwpFooterLayout::ParseBackColor(XFFooterStyle* pFooterStyle)
 
 void LwpFooterLayout::RegisterStyle(XFMasterPage* mp1)
 {
-    std::unique_ptr<XFFooter> xFooter(new XFFooter());
+    rtl::Reference<XFFooter> xFooter(new XFFooter());
     rtl::Reference<LwpObject> pStory = m_Content.obj(VO_STORY);
     //Call the RegisterStyle first to register the styles in footer paras, and then XFConvert()
     if(pStory.is())
@@ -1043,7 +1043,7 @@ void LwpFooterLayout::RegisterStyle(XFMasterPage* mp1)
 
         pChangeMgr->SetHeadFootFribMap(false);
     }
-    mp1->SetFooter(xFooter.release());
+    mp1->SetFooter(xFooter);
 }
 
 void LwpFooterLayout::ParseWaterMark(XFFooterStyle * pFooterStyle)
diff --git a/lotuswordpro/source/filter/xfilter/xfmasterpage.cxx b/lotuswordpro/source/filter/xfilter/xfmasterpage.cxx
index 5fe16aa..96b4b60 100644
--- a/lotuswordpro/source/filter/xfilter/xfmasterpage.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfmasterpage.cxx
@@ -63,28 +63,15 @@
 #include "xffooter.hxx"
 #include "xfheader.hxx"
 #include "../lwpglobalmgr.hxx"
-XFMasterPage::XFMasterPage()
-{
-    m_pHeader = nullptr;
-    m_pFooter = nullptr;
-}
-
-XFMasterPage::~XFMasterPage()
-{
-    delete m_pHeader;
-    delete m_pFooter;
-}
 
-void    XFMasterPage::SetHeader(XFHeader *pHeader)
+void XFMasterPage::SetHeader(rtl::Reference<XFHeader>& rHeader)
 {
-    delete m_pHeader;
-    m_pHeader = pHeader;
+    m_xHeader = rHeader;
 }
 
-void    XFMasterPage::SetFooter(XFFooter *pFooter)
+void XFMasterPage::SetFooter(rtl::Reference<XFFooter>& rFooter)
 {
-    delete m_pFooter;
-    m_pFooter = pFooter;
+    m_xFooter = rFooter;
 }
 
 enumXFStyle XFMasterPage::GetStyleFamily()
@@ -105,10 +92,10 @@ void    XFMasterPage::ToXml(IXFStream *pStrm)
     pAttrList->AddAttribute( "style:name", m_strStyleName );
     pAttrList->AddAttribute( "style:page-master-name", m_strPageMaster );
     pStrm->StartElement( "style:master-page" );
-    if( m_pHeader )
-        m_pHeader->ToXml(pStrm);
-    if( m_pFooter )
-        m_pFooter->ToXml(pStrm);
+    if (m_xHeader)
+        m_xHeader->ToXml(pStrm);
+    if (m_xFooter)
+        m_xFooter->ToXml(pStrm);
     pStrm->EndElement( "style:master-page" );
 }
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/xfilter/xfmasterpage.hxx b/lotuswordpro/source/filter/xfilter/xfmasterpage.hxx
index acd3c00..367e37c 100644
--- a/lotuswordpro/source/filter/xfilter/xfmasterpage.hxx
+++ b/lotuswordpro/source/filter/xfilter/xfmasterpage.hxx
@@ -68,16 +68,11 @@ class XFHeader;
 class XFMasterPage : public XFStyle
 {
 public:
-    XFMasterPage();
-
-    virtual ~XFMasterPage() override;
-
-public:
     void    SetPageMaster(const OUString& pm);
 
-    void    SetHeader(XFHeader *pHeader);
+    void    SetHeader(rtl::Reference<XFHeader>& rHeader);
 
-    void    SetFooter(XFFooter *pFooter);
+    void    SetFooter(rtl::Reference<XFFooter>& rFooter);
 
     virtual enumXFStyle GetStyleFamily() override;
 
@@ -85,8 +80,8 @@ public:
 
 private:
     OUString   m_strPageMaster;
-    XFHeader    *m_pHeader;
-    XFFooter    *m_pFooter;
+    rtl::Reference<XFHeader> m_xHeader;
+    rtl::Reference<XFFooter> m_xFooter;
 };
 
 #endif


More information about the Libreoffice-commits mailing list