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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Jul 24 06:33:43 UTC 2018


 sw/inc/docsh.hxx                  |    4 ++--
 sw/source/filter/xml/xmlimp.cxx   |    9 +++++----
 sw/source/filter/xml/xmlimp.hxx   |   10 +++++-----
 sw/source/filter/xml/xmlitemi.cxx |   10 +++++-----
 sw/source/filter/xml/xmltbli.cxx  |    4 ++--
 sw/source/uibase/app/docsh.cxx    |    6 +++---
 sw/source/uibase/app/docshini.cxx |    9 ++++-----
 7 files changed, 26 insertions(+), 26 deletions(-)

New commits:
commit c92d89b4e481d7f1777592d9f55a250e2d1a9869
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 23 11:16:34 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jul 24 08:33:29 2018 +0200

    loplugin:useuniqueptr inSwDocShell
    
    Change-Id: I9b834406b391695a18c9fdcdad9a6dd13be34c9e
    Reviewed-on: https://gerrit.libreoffice.org/57867
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index d61cd712a51a..9a88de3abeb6 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -67,7 +67,7 @@ class SW_DLLPUBLIC SwDocShell
 {
     rtl::Reference< SwDoc >                 m_xDoc;      ///< Document.
     rtl::Reference< SfxStyleSheetBasePool > m_xBasePool; ///< Passing through for formats.
-    FontList*   m_pFontList;          ///< Current Fontlist.
+    std::unique_ptr<FontList> m_pFontList;          ///< Current Fontlist.
     bool        m_IsInUpdateFontList; ///< prevent nested calls of UpdateFontList
 
     std::unique_ptr<sfx2::StyleManager> m_pStyleManager;
@@ -80,7 +80,7 @@ class SW_DLLPUBLIC SwDocShell
     SwView*     m_pView;
     SwWrtShell* m_pWrtShell;
 
-    comphelper::EmbeddedObjectContainer* m_pOLEChildList;
+    std::unique_ptr<comphelper::EmbeddedObjectContainer> m_pOLEChildList;
     sal_Int16   m_nUpdateDocMode;   ///< contains the css::document::UpdateDocMode
     bool        m_IsATemplate;      ///< prevent nested calls of UpdateFontList
 
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx
index 1692517501c5..2a40bc1d12da 100644
--- a/sw/source/uibase/app/docsh.cxx
+++ b/sw/source/uibase/app/docsh.cxx
@@ -827,7 +827,7 @@ bool SwDocShell::SaveCompleted( const uno::Reference < embed::XStorage >& xStor
             }
         }
 
-        DELETEZ(m_pOLEChildList);
+        m_pOLEChildList.reset();
         if( bResetModified )
             EnableSetModified();
     }
@@ -1080,7 +1080,7 @@ void SwDocShell::GetState(SfxItemSet& rSet)
             break;
         case SID_ATTR_CHAR_FONTLIST:
         {
-            rSet.Put( SvxFontListItem(m_pFontList, SID_ATTR_CHAR_FONTLIST) );
+            rSet.Put( SvxFontListItem(m_pFontList.get(), SID_ATTR_CHAR_FONTLIST) );
         }
         break;
         case SID_MAIL_PREPAREEXPORT:
@@ -1235,7 +1235,7 @@ void SwDocShell::RemoveOLEObjects()
                         pOLENd->IsInGlobalDocSection() ) )
         {
             if (!m_pOLEChildList)
-                m_pOLEChildList = new comphelper::EmbeddedObjectContainer;
+                m_pOLEChildList.reset( new comphelper::EmbeddedObjectContainer );
 
             OUString aObjName = pOLENd->GetOLEObj().GetCurrentPersistName();
             GetEmbeddedObjectContainer().MoveEmbeddedObject( aObjName, *m_pOLEChildList );
diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx
index cb9241609f77..0a402d2466af 100644
--- a/sw/source/uibase/app/docshini.cxx
+++ b/sw/source/uibase/app/docshini.cxx
@@ -391,13 +391,13 @@ SwDocShell::~SwDocShell()
     }
 
     RemoveLink();
-    delete m_pFontList;
+    m_pFontList.reset();
 
     // we, as BroadCaster also become our own Listener
     // (for DocInfo/FileNames/....)
     EndListening( *this );
 
-    delete m_pOLEChildList;
+    m_pOLEChildList.reset();
 }
 
 void  SwDocShell::Init_Impl()
@@ -441,9 +441,8 @@ void SwDocShell::UpdateFontList()
         OSL_ENSURE(m_xDoc.get(), "No Doc no FontList");
         if (m_xDoc.get())
         {
-            delete m_pFontList;
-            m_pFontList = new FontList( m_xDoc->getIDocumentDeviceAccess().getReferenceDevice(true) );
-            PutItem( SvxFontListItem( m_pFontList, SID_ATTR_CHAR_FONTLIST ) );
+            m_pFontList.reset( new FontList( m_xDoc->getIDocumentDeviceAccess().getReferenceDevice(true) ) );
+            PutItem( SvxFontListItem( m_pFontList.get(), SID_ATTR_CHAR_FONTLIST ) );
         }
         m_IsInUpdateFontList = false;
     }
commit 14377b33bd35a34d5be2d015c9a8d3d108153292
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 23 09:53:08 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jul 24 08:33:19 2018 +0200

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

diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index e88f90e2c621..7370eba1f353 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -59,6 +59,7 @@
 #include <strings.hrc>
 #include <svl/stritem.hxx>
 #include "xmlimp.hxx"
+#include "xmlimpit.hxx"
 #include "xmltexti.hxx"
 #include <list.hxx>
 #include <swdll.hxx>
@@ -358,7 +359,7 @@ void SwXMLDocStylesContext_Impl::EndElement()
 const SvXMLTokenMap& SwXMLImport::GetDocElemTokenMap()
 {
     if( !m_pDocElemTokenMap )
-        m_pDocElemTokenMap = new SvXMLTokenMap( aDocTokenMap );
+        m_pDocElemTokenMap.reset( new SvXMLTokenMap( aDocTokenMap ) );
 
     return *m_pDocElemTokenMap;
 }
@@ -436,9 +437,9 @@ SwXMLImport::~SwXMLImport() throw ()
         SAL_WARN("sw", "endDocument skipped, dropping shapes now to avoid dangling SvTextShapeImportHelper pointing to this");
         ClearShapeImport();
     }
-    delete m_pDocElemTokenMap;
-    delete m_pTableElemTokenMap;
-    delete m_pTableCellAttrTokenMap;
+    m_pDocElemTokenMap.reset();
+    m_pTableElemTokenMap.reset();
+    m_pTableCellAttrTokenMap.reset();
     FinitItemImport();
 }
 
diff --git a/sw/source/filter/xml/xmlimp.hxx b/sw/source/filter/xml/xmlimp.hxx
index f9e4f3f27569..fb326377d382 100644
--- a/sw/source/filter/xml/xmlimp.hxx
+++ b/sw/source/filter/xml/xmlimp.hxx
@@ -63,11 +63,11 @@ class SwXMLImport: public SvXMLImport
 {
     std::unique_ptr<SwNodeIndex> m_pSttNdIdx;
 
-    SvXMLUnitConverter      *m_pTwipUnitConv;
-    SvXMLImportItemMapper   *m_pTableItemMapper;// paragraph item import
-    SvXMLTokenMap           *m_pDocElemTokenMap;
-    SvXMLTokenMap           *m_pTableElemTokenMap;
-    SvXMLTokenMap           *m_pTableCellAttrTokenMap;
+    std::unique_ptr<SvXMLUnitConverter> m_pTwipUnitConv;
+    std::unique_ptr<SvXMLImportItemMapper> m_pTableItemMapper;// paragraph item import
+    std::unique_ptr<SvXMLTokenMap> m_pDocElemTokenMap;
+    std::unique_ptr<SvXMLTokenMap> m_pTableElemTokenMap;
+    std::unique_ptr<SvXMLTokenMap> m_pTableCellAttrTokenMap;
 
     rtl::Reference<SvXMLGraphicHelper> m_xGraphicStorageHandler;
 
diff --git a/sw/source/filter/xml/xmlitemi.cxx b/sw/source/filter/xml/xmlitemi.cxx
index b9e9239f2b62..aac6e87740e3 100644
--- a/sw/source/filter/xml/xmlitemi.cxx
+++ b/sw/source/filter/xml/xmlitemi.cxx
@@ -318,21 +318,21 @@ SvXMLImportContextRef SwXMLItemSetContext_Impl::CreateChildContext(
 
 void SwXMLImport::InitItemImport()
 {
-    m_pTwipUnitConv = new SvXMLUnitConverter( GetComponentContext(),
-            util::MeasureUnit::TWIP, util::MeasureUnit::TWIP );
+    m_pTwipUnitConv.reset( new SvXMLUnitConverter( GetComponentContext(),
+            util::MeasureUnit::TWIP, util::MeasureUnit::TWIP ) );
 
     m_xTableItemMap = new SvXMLItemMapEntries( aXMLTableItemMap );
     m_xTableColItemMap = new SvXMLItemMapEntries( aXMLTableColItemMap );
     m_xTableRowItemMap = new SvXMLItemMapEntries( aXMLTableRowItemMap );
     m_xTableCellItemMap = new SvXMLItemMapEntries( aXMLTableCellItemMap );
 
-    m_pTableItemMapper = new SwXMLImportTableItemMapper_Impl( m_xTableItemMap );
+    m_pTableItemMapper.reset( new SwXMLImportTableItemMapper_Impl( m_xTableItemMap ) );
 }
 
 void SwXMLImport::FinitItemImport()
 {
-    delete m_pTableItemMapper;
-    delete m_pTwipUnitConv;
+    m_pTableItemMapper.reset();
+    m_pTwipUnitConv.reset();
 }
 
 SvXMLImportContext *SwXMLImport::CreateTableItemImportContext(
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 4cda32f8938a..beff1d977a38 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -152,7 +152,7 @@ static const SvXMLTokenMapEntry aTableCellAttrTokenMap[] =
 const SvXMLTokenMap& SwXMLImport::GetTableElemTokenMap()
 {
     if( !m_pTableElemTokenMap )
-        m_pTableElemTokenMap = new SvXMLTokenMap( aTableElemTokenMap );
+        m_pTableElemTokenMap.reset(new SvXMLTokenMap( aTableElemTokenMap ));
 
     return *m_pTableElemTokenMap;
 }
@@ -160,7 +160,7 @@ const SvXMLTokenMap& SwXMLImport::GetTableElemTokenMap()
 const SvXMLTokenMap& SwXMLImport::GetTableCellAttrTokenMap()
 {
     if( !m_pTableCellAttrTokenMap )
-        m_pTableCellAttrTokenMap = new SvXMLTokenMap( aTableCellAttrTokenMap );
+        m_pTableCellAttrTokenMap.reset(new SvXMLTokenMap( aTableCellAttrTokenMap ));
 
     return *m_pTableCellAttrTokenMap;
 }


More information about the Libreoffice-commits mailing list