include/oox/export/vmlexport.hxx      |    2 +-
 include/sfx2/saveastemplatedlg.hxx    |   13 ++++++-------
 oox/source/export/vmlexport.cxx       |    9 +++------
 sfx2/source/doc/saveastemplatedlg.cxx |   19 +++++++++----------
 4 files changed, 19 insertions(+), 24 deletions(-)

New commits:
commit 91afe5519613bc64f344b5bc7e7fee982a859280
Author: Noel Grandin <noel.gran...@collabora.co.uk>
Date:   Mon Apr 10 09:34:07 2017 +0200

    loplugin:inlinefields in SfxSaveAsTemplateDialog
    
    Change-Id: I7b32fc64b96e2f89edc810d4a95d3a3f6f885957
    Reviewed-on: https://gerrit.libreoffice.org/36352
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/sfx2/saveastemplatedlg.hxx 
b/include/sfx2/saveastemplatedlg.hxx
index 212e4578b5af..9c01a4915b71 100644
--- a/include/sfx2/saveastemplatedlg.hxx
+++ b/include/sfx2/saveastemplatedlg.hxx
@@ -12,14 +12,13 @@
 
 #include <sal/config.h>
 #include <sfx2/dllapi.h>
-
+#include <sfx2/doctempl.hxx>
 #include <vcl/dialog.hxx>
 #include <vcl/button.hxx>
 
 class Edit;
 class ListBox;
 class CheckBox;
-class SfxDocumentTemplates;
 
 //  class SfxSaveAsTemplateDialog 
-------------------------------------------------------------------
 
@@ -32,13 +31,13 @@ private:
     VclPtr<Edit>            mpTemplateNameEdit;
     VclPtr<PushButton>      mpOKButton;
 
-    OUString     msSelectedCategory;
-    OUString     msTemplateName;
-    sal_uInt16   mnRegionPos;
+    OUString                msSelectedCategory;
+    OUString                msTemplateName;
+    sal_uInt16              mnRegionPos;
 
-    std::vector<OUString> msCategories;
+    std::vector<OUString>   msCategories;
 
-    SfxDocumentTemplates *mpDocTemplates;
+    SfxDocumentTemplates    maDocTemplates;
 
     css::uno::Reference< css::frame::XModel > m_xModel;
 
diff --git a/sfx2/source/doc/saveastemplatedlg.cxx 
b/sfx2/source/doc/saveastemplatedlg.cxx
index 1aadfebc781a..746c0ed8fab1 100644
--- a/sfx2/source/doc/saveastemplatedlg.cxx
+++ b/sfx2/source/doc/saveastemplatedlg.cxx
@@ -37,8 +37,7 @@ SfxSaveAsTemplateDialog::SfxSaveAsTemplateDialog():
         ModalDialog(nullptr, "SaveAsTemplateDialog", 
"sfx/ui/saveastemplatedlg.ui"),
         msSelectedCategory(OUString()),
         msTemplateName(OUString()),
-        mnRegionPos(0),
-        mpDocTemplates(new SfxDocumentTemplates)
+        mnRegionPos(0)
 {
     get(mpLBCategory, "categorylb");
     get(mpCBXDefault, "defaultcb");
@@ -121,10 +120,10 @@ IMPL_LINK_NOARG(SfxSaveAsTemplateDialog, 
SelectCategoryHdl, ListBox&, void)
 
 void SfxSaveAsTemplateDialog::initialize()
 {
-    sal_uInt16 nCount = mpDocTemplates->GetRegionCount();
+    sal_uInt16 nCount = maDocTemplates.GetRegionCount();
     for (sal_uInt16 i = 0; i < nCount; ++i)
     {
-        OUString sCategoryName(mpDocTemplates->GetFullRegionName(i));
+        OUString sCategoryName(maDocTemplates.GetFullRegionName(i));
         msCategories.push_back(sCategoryName);
     }
 }
@@ -145,10 +144,10 @@ bool SfxSaveAsTemplateDialog::IsTemplateNameUnique()
     it=find(msCategories.begin(), msCategories.end(), msSelectedCategory);
     mnRegionPos = std::distance(msCategories.begin(), it);
 
-    sal_uInt16 nEntries = mpDocTemplates->GetCount(mnRegionPos);
+    sal_uInt16 nEntries = maDocTemplates.GetCount(mnRegionPos);
     for(sal_uInt16 i = 0; i < nEntries; i++)
     {
-        OUString aName = mpDocTemplates->GetName(mnRegionPos, i);
+        OUString aName = maDocTemplates.GetName(mnRegionPos, i);
         if(aName == msTemplateName)
             return false;
     }
@@ -165,9 +164,9 @@ bool SfxSaveAsTemplateDialog::SaveTemplate()
     if (!xTemplates->storeTemplate( msSelectedCategory, msTemplateName, 
xStorable ))
         return false;
 
-    sal_uInt16 nDocId = mpDocTemplates->GetCount(mnRegionPos);
-    OUString     sURL = 
mpDocTemplates->GetTemplateTargetURLFromComponent(msSelectedCategory, 
msTemplateName);
-    bool bIsSaved = mpDocTemplates->InsertTemplate( mnRegionPos, nDocId, 
msTemplateName, sURL);
+    sal_uInt16 nDocId = maDocTemplates.GetCount(mnRegionPos);
+    OUString     sURL = 
maDocTemplates.GetTemplateTargetURLFromComponent(msSelectedCategory, 
msTemplateName);
+    bool bIsSaved = maDocTemplates.InsertTemplate( mnRegionPos, nDocId, 
msTemplateName, sURL);
 
     if (!bIsSaved)
         return false;
@@ -194,7 +193,7 @@ bool SfxSaveAsTemplateDialog::SaveTemplate()
             SfxObjectFactory::SetStandardTemplate(aServiceName, sURL);
     }
 
-    mpDocTemplates->Update();
+    maDocTemplates.Update();
     return true;
 }
 
commit 5ab0d0a69ff65eaef1bf043526040b1230fcdb89
Author: Noel Grandin <noel.gran...@collabora.co.uk>
Date:   Mon Apr 10 09:26:16 2017 +0200

    loplugin:inlinefields in oox::vml::VMLExport
    
    Change-Id: Ia6880212503b2945953ca4c3d62d3ddb1d159c7b
    Reviewed-on: https://gerrit.libreoffice.org/36351
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx
index 222be73aa7bc..aac1811a4f17 100644
--- a/include/oox/export/vmlexport.hxx
+++ b/include/oox/export/vmlexport.hxx
@@ -102,7 +102,7 @@ class OOX_DLLPUBLIC VMLExport : public EscherEx
     OStringBuffer m_ShapeStyle;
 
     /// Remember which shape types we had already written.
-    bool *m_pShapeTypeWritten;
+    std::vector<bool> m_aShapeTypeWritten;
 
 public:
                         VMLExport( ::sax_fastparser::FSHelperPtr const & 
pSerializer, VMLTextExport* pTextExport = nullptr );
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index b68fa6452c73..89d8e5bfb95c 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -65,10 +65,9 @@ VMLExport::VMLExport( ::sax_fastparser::FSHelperPtr const & 
pSerializer, VMLText
     , m_nShapeType( ESCHER_ShpInst_Nil )
     , m_nShapeFlags(0)
     , m_ShapeStyle( 200 )
-    , m_pShapeTypeWritten( new bool[ ESCHER_ShpInst_COUNT ] )
+    , m_aShapeTypeWritten( ESCHER_ShpInst_COUNT )
 {
     mnGroupLevel = 1;
-    memset( m_pShapeTypeWritten, 0, ESCHER_ShpInst_COUNT * sizeof( bool ) );
 }
 
 void VMLExport::SetFS( const ::sax_fastparser::FSHelperPtr& pSerializer )
@@ -80,8 +79,6 @@ VMLExport::~VMLExport()
 {
     delete mpOutStrm;
     mpOutStrm = nullptr;
-    delete[] m_pShapeTypeWritten;
-    m_pShapeTypeWritten = nullptr;
 }
 
 void VMLExport::OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance )
@@ -1039,10 +1036,10 @@ sal_Int32 VMLExport::StartShape()
                 if ( aShapeType != "NULL" )
                 {
                     bReferToShapeType = true;
-                    if ( !m_pShapeTypeWritten[ m_nShapeType ] )
+                    if ( !m_aShapeTypeWritten[ m_nShapeType ] )
                     {
                         m_pSerializer->write( aShapeType.getStr() );
-                        m_pShapeTypeWritten[ m_nShapeType ] = true;
+                        m_aShapeTypeWritten[ m_nShapeType ] = true;
                     }
                 }
                 else
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to