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

Noel Grandin noel.grandin at collabora.co.uk
Fri Nov 17 07:11:35 UTC 2017


 sw/source/filter/ww8/docxexport.cxx |   18 +++++-------------
 sw/source/filter/ww8/docxexport.hxx |    9 +++++----
 2 files changed, 10 insertions(+), 17 deletions(-)

New commits:
commit 56379beb1ea55c1262382039aba2dbb335e92b67
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Nov 16 14:55:57 2017 +0200

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

diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index cc9b518ff1a5..2cab3777a532 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -480,7 +480,7 @@ void DocxExport::OutputDML(uno::Reference<drawing::XShape> const & xShape)
         nNamespace = XML_wpg;
     else if (xServiceInfo->supportsService("com.sun.star.drawing.GraphicObjectShape"))
         nNamespace = XML_pic;
-    oox::drawingml::ShapeExport aExport(nNamespace, m_pAttrOutput->GetSerializer(), nullptr, m_pFilter, oox::drawingml::DOCUMENT_DOCX, m_pAttrOutput);
+    oox::drawingml::ShapeExport aExport(nNamespace, m_pAttrOutput->GetSerializer(), nullptr, m_pFilter, oox::drawingml::DOCUMENT_DOCX, m_pAttrOutput.get());
     aExport.WriteShape(xShape);
 }
 
@@ -1557,28 +1557,20 @@ DocxExport::DocxExport( DocxExportFilter *pFilter, SwDoc *pDocument, SwPaM *pCur
     SetFS(m_pDocumentFS);
 
     // the DrawingML access
-    m_pDrawingML = new oox::drawingml::DrawingML(m_pDocumentFS, m_pFilter, oox::drawingml::DOCUMENT_DOCX);
+    m_pDrawingML.reset(new oox::drawingml::DrawingML(m_pDocumentFS, m_pFilter, oox::drawingml::DOCUMENT_DOCX));
 
     // the attribute output for the document
-    m_pAttrOutput = new DocxAttributeOutput( *this, m_pDocumentFS, m_pDrawingML );
+    m_pAttrOutput.reset(new DocxAttributeOutput( *this, m_pDocumentFS, m_pDrawingML.get() ));
 
     // the related VMLExport
-    m_pVMLExport = new VMLExport( m_pDocumentFS, m_pAttrOutput );
+    m_pVMLExport.reset(new VMLExport( m_pDocumentFS, m_pAttrOutput.get() ));
 
     // the related drawing export
-    m_pSdrExport = new DocxSdrExport( *this, m_pDocumentFS, m_pDrawingML );
+    m_pSdrExport.reset(new DocxSdrExport( *this, m_pDocumentFS, m_pDrawingML.get() ));
 }
 
 DocxExport::~DocxExport()
 {
-    delete m_pSdrExport;
-    m_pSdrExport = nullptr;
-    delete m_pVMLExport;
-    m_pVMLExport = nullptr;
-    delete m_pAttrOutput;
-    m_pAttrOutput = nullptr;
-    delete m_pDrawingML;
-    m_pDrawingML = nullptr;
 }
 
 DocxSettingsData::DocxSettingsData()
diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx
index df65f3d39e93..b553ba3f2601 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -27,6 +27,7 @@
 #include <rtl/ustring.hxx>
 
 #include <cstdio>
+#include <memory>
 #include <vector>
 #include <boost/optional.hpp>
 #include <ndole.hxx>
@@ -75,10 +76,10 @@ class DocxExport : public MSWordExportBase
     ::sax_fastparser::FSHelperPtr mpFS;
 
     /// Access to the DrawingML writer.
-    oox::drawingml::DrawingML *m_pDrawingML;
+    std::unique_ptr<oox::drawingml::DrawingML> m_pDrawingML;
 
     /// Attribute output for document.
-    DocxAttributeOutput *m_pAttrOutput;
+    std::unique_ptr<DocxAttributeOutput> m_pAttrOutput;
 
     /// Sections/headers/footers
     MSWordSections *m_pSections;
@@ -99,10 +100,10 @@ class DocxExport : public MSWordExportBase
     sal_Int32 m_nHeadersFootersInSection;
 
     /// Exporter of the VML shapes.
-    oox::vml::VMLExport *m_pVMLExport;
+    std::unique_ptr<oox::vml::VMLExport> m_pVMLExport;
 
     /// Exporter of drawings.
-    DocxSdrExport* m_pSdrExport;
+    std::unique_ptr<DocxSdrExport> m_pSdrExport;
 
     /// If the result will be a .docm file or not.
     bool m_bDocm;


More information about the Libreoffice-commits mailing list