[Libreoffice-commits] core.git: include/svx svx/source

Noel Grandin noel.grandin at collabora.co.uk
Mon Jan 16 06:11:00 UTC 2017


 include/svx/galtheme.hxx         |    3 ++-
 include/svx/hlnkitem.hxx         |    7 ++++---
 include/svx/langbox.hxx          |    3 ++-
 include/svx/numinf.hxx           |    5 +++--
 include/svx/svdobj.hxx           |    3 ++-
 include/svx/svdoedge.hxx         |    2 +-
 include/svx/svdogrp.hxx          |    2 +-
 include/svx/svdorect.hxx         |    2 +-
 include/svx/svdotext.hxx         |    3 ++-
 include/svx/svdundo.hxx          |    6 +++---
 include/svx/xbitmap.hxx          |    2 +-
 include/svx/xexch.hxx            |    7 ++++---
 svx/source/dialog/langbox.cxx    |    3 +--
 svx/source/dialog/srchdlg.cxx    |   13 ++++++-------
 svx/source/form/fmshimp.cxx      |    1 -
 svx/source/gallery2/gallery1.cxx |    8 ++++----
 svx/source/inc/fmshimp.hxx       |    2 +-
 svx/source/items/hlnkitem.cxx    |   16 +++++-----------
 svx/source/items/numinf.cxx      |   11 +++--------
 svx/source/svdraw/svdobj.cxx     |    8 ++------
 svx/source/svdraw/svdocirc.cxx   |    2 +-
 svx/source/svdraw/svdoedge.cxx   |    5 ++---
 svx/source/svdraw/svdogrp.cxx    |   35 +++++++++++++++++------------------
 svx/source/svdraw/svdorect.cxx   |   13 ++++---------
 svx/source/svdraw/svdotxln.cxx   |    5 ++---
 svx/source/svdraw/svdundo.cxx    |    3 +--
 svx/source/xoutdev/xattrbmp.cxx  |   10 ++++------
 svx/source/xoutdev/xexch.cxx     |   12 ++++--------
 28 files changed, 83 insertions(+), 109 deletions(-)

New commits:
commit 0b272cdf0025ce4bca31ee01c8b3aaca042dcb62
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jan 11 13:04:35 2017 +0200

    new loplugin: useuniqueptr: svx
    
    Change-Id: I0eb3d43d7bcfc491df16a72997a0720a6aec2c5c
    Reviewed-on: https://gerrit.libreoffice.org/32959
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/svx/galtheme.hxx b/include/svx/galtheme.hxx
index f93fd1b..003c013 100644
--- a/include/svx/galtheme.hxx
+++ b/include/svx/galtheme.hxx
@@ -110,13 +110,14 @@ private:
     SAL_DLLPRIVATE void         ImplBroadcast( sal_uIntPtr nUpdatePos );
 
     SAL_DLLPRIVATE              GalleryTheme( Gallery* pGallery, GalleryThemeEntry* pThemeEntry );
-    SAL_DLLPRIVATE              virtual ~GalleryTheme() override;
 
     GalleryTheme(GalleryTheme const &) = delete;
     void operator =(GalleryTheme const &) = delete;
 
 public:
 
+    SAL_DLLPRIVATE              virtual ~GalleryTheme() override;
+
     SAL_DLLPRIVATE static GalleryThemeEntry* CreateThemeEntry( const INetURLObject& rURL, bool bReadOnly );
 
     SAL_DLLPRIVATE size_t       GetObjectCount() const { return aObjectList.size(); }
diff --git a/include/svx/hlnkitem.hxx b/include/svx/hlnkitem.hxx
index 902546d..fa70a26 100644
--- a/include/svx/hlnkitem.hxx
+++ b/include/svx/hlnkitem.hxx
@@ -25,6 +25,7 @@
 #include <svl/macitem.hxx>
 #include <svx/svxdllapi.h>
 #include <o3tl/typed_flags_set.hxx>
+#include <memory>
 
 enum class HyperDialogEvent {
     NONE                = 0x0000,
@@ -52,7 +53,7 @@ class SVX_DLLPUBLIC SvxHyperlinkItem : public SfxPoolItem
     SvxLinkInsertMode eType;
 
     OUString sIntName;
-    SvxMacroTableDtor*  pMacroTable;
+    std::unique_ptr<SvxMacroTableDtor>  pMacroTable;
 
     HyperDialogEvent nMacroEvents;
 
@@ -67,7 +68,7 @@ public:
                                     SvxLinkInsertMode eTyp,
                                     HyperDialogEvent nEvents = HyperDialogEvent::NONE,
                                     SvxMacroTableDtor *pMacroTbl =nullptr );
-    virtual ~SvxHyperlinkItem () override { delete pMacroTable; }
+    virtual ~SvxHyperlinkItem () override {}
 
     inline SvxHyperlinkItem& operator=( const SvxHyperlinkItem &rItem );
 
@@ -94,7 +95,7 @@ public:
     void SetMacro( HyperDialogEvent nEvent, const SvxMacro& rMacro );
 
     void SetMacroTable( const SvxMacroTableDtor& rTbl );
-    const SvxMacroTableDtor* GetMacroTable() const    { return pMacroTable; }
+    const SvxMacroTableDtor* GetMacroTable() const { return pMacroTable.get(); }
 
     void SetMacroEvents (const HyperDialogEvent nEvents) { nMacroEvents = nEvents; }
     HyperDialogEvent GetMacroEvents() const { return nMacroEvents; }
diff --git a/include/svx/langbox.hxx b/include/svx/langbox.hxx
index 6aeb867..4a309e2 100644
--- a/include/svx/langbox.hxx
+++ b/include/svx/langbox.hxx
@@ -90,7 +90,8 @@ protected:
     Image                   m_aNotCheckedImage;
     Image                   m_aCheckedImage;
     OUString                m_aAllString;
-    css::uno::Sequence< sal_Int16 >  *m_pSpellUsedLang;
+    std::unique_ptr<css::uno::Sequence< sal_Int16 >>
+                            m_pSpellUsedLang;
     SvxLanguageListFlags    m_nLangList;
     bool                    m_bHasLangNone;
     bool                    m_bLangNoneIsLangAll;
diff --git a/include/svx/numinf.hxx b/include/svx/numinf.hxx
index 694f8d5..c99f985 100644
--- a/include/svx/numinf.hxx
+++ b/include/svx/numinf.hxx
@@ -61,7 +61,7 @@ public:
     const OUString&         GetValueString() const { return aStringVal; }
     double                  GetValueDouble() const  { return nDoubleVal; }
 
-    const sal_uInt32*       GetDelArray() const { return pDelFormatArr; }
+    const sal_uInt32*       GetDelArray() const { return pDelFormatArr.get(); }
     void                    SetDelFormatArray( const sal_uInt32* pData,
                                                const sal_uInt32  nCount );
 
@@ -74,7 +74,8 @@ private:
     OUString            aStringVal;
     double              nDoubleVal;
 
-    sal_uInt32*         pDelFormatArr;
+    std::unique_ptr<sal_uInt32[]>
+                        pDelFormatArr;
     sal_uInt32          nDelCount;
 };
 
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index ec29c00..c5988e7 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -228,7 +228,8 @@ class SVX_DLLPUBLIC SdrObjGeoData
 public:
     Rectangle                   aBoundRect;
     Point                       aAnchor;
-    SdrGluePointList*           pGPL;
+    std::unique_ptr<SdrGluePointList>
+                                pGPL;
     bool                        bMovProt;
     bool                        bSizProt;
     bool                        bNoPrint;
diff --git a/include/svx/svdoedge.hxx b/include/svx/svdoedge.hxx
index e1e3b64..548d548 100644
--- a/include/svx/svdoedge.hxx
+++ b/include/svx/svdoedge.hxx
@@ -125,7 +125,7 @@ class SdrEdgeObjGeoData : public SdrTextObjGeoData
 public:
     SdrObjConnection            aCon1;  // Verbindungszustand des Linienanfangs
     SdrObjConnection            aCon2;  // Verbindungszustand des Linienendes
-    XPolygon*                   pEdgeTrack;
+    std::unique_ptr<XPolygon>   pEdgeTrack;
     bool                        bEdgeTrackDirty;// sal_True=Verbindungsverlauf muss neu berechnet werden.
     bool                        bEdgeTrackUserDefined;
     SdrEdgeInfoRec              aEdgeInfo;
diff --git a/include/svx/svdogrp.hxx b/include/svx/svdogrp.hxx
index b169427..cc3384c 100644
--- a/include/svx/svdogrp.hxx
+++ b/include/svx/svdogrp.hxx
@@ -42,7 +42,7 @@ protected:
     virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override;
     virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override;
 
-    SdrObjList*                 pSub;    // Subliste (Kinder)
+    std::unique_ptr<SdrObjList> pSub;    // Subliste (Kinder)
     Point                       aRefPoint; // Referenzpunkt innerhalb der Objektgruppe
 
 public:
diff --git a/include/svx/svdorect.hxx b/include/svx/svdorect.hxx
index c8e332b..11d6b7d 100644
--- a/include/svx/svdorect.hxx
+++ b/include/svx/svdorect.hxx
@@ -46,7 +46,7 @@ protected:
     virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override;
     virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override;
 
-    XPolygon* mpXPoly;
+    std::unique_ptr<XPolygon> mpXPoly;
 
 protected:
     XPolygon ImpCalcXPoly(const Rectangle& rRect1, long nRad1) const;
diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 132a778..1790e48 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -105,7 +105,8 @@ class ImpSdrObjTextLinkUserData : public SdrObjUserData
     OUString                    aFileName;   // Name des referenzierten Dokuments
     OUString                    aFilterName; // ggf. ein Filter
     DateTime                    aFileDate0;  // Unnoetiges neuladen vermeiden
-    ImpSdrObjTextLink*          pLink;
+    std::unique_ptr<ImpSdrObjTextLink>
+                                pLink;
     rtl_TextEncoding            eCharSet;
 
 public:
diff --git a/include/svx/svdundo.hxx b/include/svx/svdundo.hxx
index 1949e5d..e53ca98 100644
--- a/include/svx/svdundo.hxx
+++ b/include/svx/svdundo.hxx
@@ -587,9 +587,9 @@ class SVX_DLLPUBLIC SdrUndoDelPage : public SdrUndoPageList
 {
     // When deleting a MasterPage, we remember all relations of the
     // Character Page with the MasterPage in this UndoGroup.
-    SdrUndoGroup*               pUndoGroup;
-    std::unique_ptr<SfxPoolItem> mpFillBitmapItem;
-    bool mbHasFillBitmap;
+    std::unique_ptr<SdrUndoGroup>  pUndoGroup;
+    std::unique_ptr<SfxPoolItem>   mpFillBitmapItem;
+    bool                           mbHasFillBitmap;
 
 public:
     SdrUndoDelPage(SdrPage& rNewPg);
diff --git a/include/svx/xbitmap.hxx b/include/svx/xbitmap.hxx
index 761e8e1..a20288f 100644
--- a/include/svx/xbitmap.hxx
+++ b/include/svx/xbitmap.hxx
@@ -31,7 +31,7 @@ class SVX_DLLPUBLIC XOBitmap
 private:
     XBitmapType     eType;
     std::unique_ptr<GraphicObject> xGraphicObject;
-    sal_uInt16*     pPixelArray;
+    std::unique_ptr<sal_uInt16[]>  pPixelArray;
     Size            aArraySize;
     Color           aPixelColor;
     Color           aBckgrColor;
diff --git a/include/svx/xexch.hxx b/include/svx/xexch.hxx
index 10844c9..4722a6c 100644
--- a/include/svx/xexch.hxx
+++ b/include/svx/xexch.hxx
@@ -22,6 +22,7 @@
 
 
 #include <svx/svxdllapi.h>
+#include <memory>
 
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 //                Clipboard format for XOutDev filling attributes
@@ -35,8 +36,8 @@ class SvStream;
 class SVX_DLLPUBLIC XFillExchangeData final
 {
 private:
-    XFillAttrSetItem*   pXFillAttrSetItem;
-    SfxItemPool*        pPool;
+    std::unique_ptr<XFillAttrSetItem> pXFillAttrSetItem;
+    SfxItemPool*                      pPool;
 
 public:
                         XFillExchangeData(const XFillAttrSetItem& rXFillAttrSetItem);
@@ -47,7 +48,7 @@ public:
     SVX_DLLPUBLIC friend SvStream&    WriteXFillExchangeData( SvStream& rOStm, const XFillExchangeData& rXFillExchangeData );
     SVX_DLLPUBLIC friend SvStream&    ReadXFillExchangeData( SvStream& rIStm, XFillExchangeData& rXFillExchangeData );
 
-    XFillAttrSetItem*   GetXFillAttrSetItem() { return pXFillAttrSetItem; }
+    XFillAttrSetItem*   GetXFillAttrSetItem() { return pXFillAttrSetItem.get(); }
 };
 
 #endif // INCLUDED_SVX_XEXCH_HXX
diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx
index d746aef..4734089 100644
--- a/svx/source/dialog/langbox.cxx
+++ b/svx/source/dialog/langbox.cxx
@@ -171,7 +171,6 @@ void SvxLanguageBoxBase::ImplLanguageBoxBaseInit()
 
 SvxLanguageBoxBase::~SvxLanguageBoxBase()
 {
-    delete m_pSpellUsedLang;
 }
 
 
@@ -343,7 +342,7 @@ sal_Int32 SvxLanguageBoxBase::ImplInsertLanguage( const LanguageType nLangType,
         {
             Reference< XSpellChecker1 > xSpell( LinguMgr::GetSpellChecker(), UNO_QUERY );
             if ( xSpell.is() )
-                m_pSpellUsedLang = new Sequence< sal_Int16 >( xSpell->getLanguages() );
+                m_pSpellUsedLang.reset( new Sequence< sal_Int16 >( xSpell->getLanguages() ) );
         }
         bFound = m_pSpellUsedLang &&
             lcl_SeqHasLang( *m_pSpellUsedLang, nRealLang );
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 5d6e356..a7f025d 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -118,7 +118,7 @@ struct SearchDlg_Impl
 {
     bool        bSaveToModule  : 1,
                 bFocusOnSearch : 1;
-    sal_uInt16* pRanges;
+    std::unique_ptr<sal_uInt16[]> pRanges;
     Timer       aSelectionTimer;
 
     uno::Reference< frame::XDispatch > xCommand1Dispatch;
@@ -129,7 +129,6 @@ struct SearchDlg_Impl
     SearchDlg_Impl()
         : bSaveToModule(true)
         , bFocusOnSearch(true)
-        , pRanges(nullptr)
     {
         aCommand1URL.Complete = aCommand1URL.Main = "vnd.sun.search:SearchViaComponent1";
         aCommand1URL.Protocol = "vnd.sun.search:";
@@ -138,7 +137,7 @@ struct SearchDlg_Impl
         aCommand2URL.Protocol = "vnd.sun.search:";
         aCommand2URL.Path = "SearchViaComponent2";
     }
-    ~SearchDlg_Impl() { delete[] pRanges; }
+    ~SearchDlg_Impl() {}
 };
 
 void ListToStrArr_Impl( sal_uInt16 nId, std::vector<OUString>& rStrLst, ComboBox& rCBox )
@@ -1080,8 +1079,8 @@ void SvxSearchDialog::InitAttrList_Impl( const SfxItemSet* pSSet,
             pPtr += 2;
         }
         nCnt = pPtr - pTmp + 1;
-        pImpl->pRanges = new sal_uInt16[nCnt];
-        memcpy( pImpl->pRanges, pTmp, sizeof(sal_uInt16) * nCnt );
+        pImpl->pRanges.reset( new sal_uInt16[nCnt] );
+        memcpy( pImpl->pRanges.get(), pTmp, sizeof(sal_uInt16) * nCnt );
     }
 
     // See to it that are the texts of the attributes are correct
@@ -1979,7 +1978,7 @@ IMPL_LINK_NOARG(SvxSearchDialog, FormatHdl_Impl, Button*, void)
         return;
 
     sal_sSize nCnt = 0;
-    const sal_uInt16* pPtr = pImpl->pRanges;
+    const sal_uInt16* pPtr = pImpl->pRanges.get();
     const sal_uInt16* pTmp = pPtr;
 
     while( *pTmp )
@@ -2110,7 +2109,7 @@ IMPL_LINK_NOARG(SvxSearchDialog, AttributeHdl_Impl, Button*, void)
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     if(pFact)
     {
-        ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSvxSearchAttributeDialog( this, *pSearchList, pImpl->pRanges ));
+        ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSvxSearchAttributeDialog( this, *pSearchList, pImpl->pRanges.get() ));
         DBG_ASSERT(pDlg, "Dialog creation failed!");
         pDlg->Execute();
     }
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index 6fd5a66..6730074 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -658,7 +658,6 @@ FmXFormShell::FmXFormShell( FmFormShell& _rShell, SfxViewFrame* _pViewFrame )
 
 FmXFormShell::~FmXFormShell()
 {
-    delete m_pTextShell;
 }
 
 
diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx
index 69a380e..927f0b5 100644
--- a/svx/source/gallery2/gallery1.cxx
+++ b/svx/source/gallery2/gallery1.cxx
@@ -148,16 +148,16 @@ class GalleryThemeCacheEntry
 private:
 
     const GalleryThemeEntry*        mpThemeEntry;
-    GalleryTheme*                           mpTheme;
+    std::unique_ptr<GalleryTheme>   mpTheme;
 
 public:
 
                                 GalleryThemeCacheEntry( const GalleryThemeEntry* pThemeEntry, GalleryTheme* pTheme ) :
                                     mpThemeEntry( pThemeEntry ), mpTheme( pTheme ) {}
-                                ~GalleryThemeCacheEntry() { delete mpTheme; }
+                                ~GalleryThemeCacheEntry() {}
 
-    const GalleryThemeEntry*        GetThemeEntry() const { return mpThemeEntry; }
-    GalleryTheme*                           GetTheme() const { return mpTheme; }
+    const GalleryThemeEntry*    GetThemeEntry() const { return mpThemeEntry; }
+    GalleryTheme*               GetTheme() const { return mpTheme.get(); }
 };
 
 
diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx
index 48c518b..fc799e1 100644
--- a/svx/source/inc/fmshimp.hxx
+++ b/svx/source/inc/fmshimp.hxx
@@ -196,7 +196,7 @@ class SVX_DLLPUBLIC FmXFormShell   : public FmXFormShell_BASE
                     m_aLoadingPages;
 
     FmFormShell*                m_pShell;
-    svx::FmTextControlShell*  m_pTextShell;
+    std::unique_ptr<svx::FmTextControlShell>  m_pTextShell;
 
     svx::ControllerFeatures   m_aActiveControllerFeatures;
     svx::ControllerFeatures   m_aNavControllerFeatures;
diff --git a/svx/source/items/hlnkitem.cxx b/svx/source/items/hlnkitem.cxx
index 04cf184..cfac4a3 100644
--- a/svx/source/items/hlnkitem.cxx
+++ b/svx/source/items/hlnkitem.cxx
@@ -200,9 +200,7 @@ SvxHyperlinkItem::SvxHyperlinkItem( const SvxHyperlinkItem& rHyperlinkItem ):
     nMacroEvents = rHyperlinkItem.nMacroEvents;
 
     if( rHyperlinkItem.GetMacroTable() )
-        pMacroTable = new SvxMacroTableDtor( *rHyperlinkItem.GetMacroTable() );
-    else
-        pMacroTable=nullptr;
+        pMacroTable.reset( new SvxMacroTableDtor( *rHyperlinkItem.GetMacroTable() ) );
 
 };
 
@@ -218,9 +216,7 @@ SvxHyperlinkItem::SvxHyperlinkItem( sal_uInt16 _nWhich, const OUString& rName, c
     nMacroEvents (nEvents)
 {
     if (pMacroTbl)
-        pMacroTable = new SvxMacroTableDtor ( *pMacroTbl );
-    else
-        pMacroTable=nullptr;
+        pMacroTable.reset( new SvxMacroTableDtor ( *pMacroTbl ) );
 }
 
 SfxPoolItem* SvxHyperlinkItem::Clone( SfxItemPool* ) const
@@ -243,7 +239,7 @@ bool SvxHyperlinkItem::operator==( const SfxPoolItem& rAttr ) const
     if (!bRet)
         return false;
 
-    const SvxMacroTableDtor* pOther = static_cast<const SvxHyperlinkItem&>(rAttr).pMacroTable;
+    const SvxMacroTableDtor* pOther = static_cast<const SvxHyperlinkItem&>(rAttr).pMacroTable.get();
     if( !pMacroTable )
         return ( !pOther || pOther->empty() );
     if( !pOther )
@@ -273,16 +269,14 @@ void SvxHyperlinkItem::SetMacro( HyperDialogEvent nEvent, const SvxMacro& rMacro
     }
 
     if( !pMacroTable )
-        pMacroTable = new SvxMacroTableDtor;
+        pMacroTable.reset( new SvxMacroTableDtor );
 
     pMacroTable->Insert( nSfxEvent, rMacro);
 }
 
 void SvxHyperlinkItem::SetMacroTable( const SvxMacroTableDtor& rTbl )
 {
-    delete pMacroTable;
-
-    pMacroTable = new SvxMacroTableDtor ( rTbl );
+    pMacroTable.reset( new SvxMacroTableDtor ( rTbl ) );
 }
 
 bool SvxHyperlinkItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const
diff --git a/svx/source/items/numinf.cxx b/svx/source/items/numinf.cxx
index f403ecf..37c4963 100644
--- a/svx/source/items/numinf.cxx
+++ b/svx/source/items/numinf.cxx
@@ -91,7 +91,7 @@ SvxNumberInfoItem::SvxNumberInfoItem( const SvxNumberInfoItem& rItem ) :
 {
     if ( rItem.nDelCount > 0 )
     {
-        pDelFormatArr = new sal_uInt32[ rItem.nDelCount ];
+        pDelFormatArr.reset( new sal_uInt32[ rItem.nDelCount ] );
 
         for ( sal_uInt32 i = 0; i < rItem.nDelCount; ++i )
             pDelFormatArr[i] = rItem.pDelFormatArr[i];
@@ -101,7 +101,6 @@ SvxNumberInfoItem::SvxNumberInfoItem( const SvxNumberInfoItem& rItem ) :
 
 SvxNumberInfoItem::~SvxNumberInfoItem()
 {
-    delete [] pDelFormatArr;
 }
 
 
@@ -174,17 +173,13 @@ SvStream& SvxNumberInfoItem::Store( SvStream &rStream, sal_uInt16 /*nItemVersion
 void SvxNumberInfoItem::SetDelFormatArray( const sal_uInt32* pData,
                                            const sal_uInt32 nCount )
 {
-    if ( pDelFormatArr )
-    {
-        delete []pDelFormatArr;
-        pDelFormatArr = nullptr;
-    }
+    pDelFormatArr.reset();
 
     nDelCount = nCount;
 
     if ( nCount > 0 )
     {
-        pDelFormatArr = new sal_uInt32[ nCount ];
+        pDelFormatArr.reset( new sal_uInt32[ nCount ] );
 
         if ( pData != nullptr )
         {
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index d885ed3..f62dd31 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -180,7 +180,6 @@ SdrObjGeoData::SdrObjGeoData():
 
 SdrObjGeoData::~SdrObjGeoData()
 {
-    delete pGPL;
 }
 
 SdrObjTransformInfoRec::SdrObjTransformInfoRec() :
@@ -1877,13 +1876,10 @@ void SdrObject::SaveGeoData(SdrObjGeoData& rGeo) const
         if (rGeo.pGPL!=nullptr) {
             *rGeo.pGPL=*pPlusData->pGluePoints;
         } else {
-            rGeo.pGPL=new SdrGluePointList(*pPlusData->pGluePoints);
+            rGeo.pGPL.reset( new SdrGluePointList(*pPlusData->pGluePoints) );
         }
     } else {
-        if (rGeo.pGPL!=nullptr) {
-            delete rGeo.pGPL;
-            rGeo.pGPL=nullptr;
-        }
+        rGeo.pGPL.reset();
     }
 }
 
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
index e4b3a01d..f561e82 100644
--- a/svx/source/svdraw/svdocirc.cxx
+++ b/svx/source/svdraw/svdocirc.cxx
@@ -277,7 +277,7 @@ basegfx::B2DPolygon SdrCircObj::ImpCalcXPolyCirc(const SdrObjKind eCicrleKind, c
 void SdrCircObj::RecalcXPoly()
 {
     const basegfx::B2DPolygon aPolyCirc(ImpCalcXPolyCirc(meCircleKind, maRect, nStartAngle, nEndAngle));
-    mpXPoly = new XPolygon(aPolyCirc);
+    mpXPoly.reset( new XPolygon(aPolyCirc) );
 }
 
 OUString SdrCircObj::TakeObjNameSingul() const
diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
index 1dca9ab..86a8428 100644
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -2414,15 +2414,14 @@ void SdrEdgeObj::NbcSetPoint(const Point& rPnt, sal_uInt32 i)
 }
 
 SdrEdgeObjGeoData::SdrEdgeObjGeoData()
-    : bEdgeTrackDirty(false)
+    : pEdgeTrack(new XPolygon)
+    , bEdgeTrackDirty(false)
     , bEdgeTrackUserDefined(false)
 {
-    pEdgeTrack=new XPolygon;
 }
 
 SdrEdgeObjGeoData::~SdrEdgeObjGeoData()
 {
-    delete pEdgeTrack;
 }
 
 SdrObjGeoData* SdrEdgeObj::NewGeoData() const
diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx
index 548b499..62a3682 100644
--- a/svx/source/svdraw/svdogrp.cxx
+++ b/svx/source/svdraw/svdogrp.cxx
@@ -69,7 +69,7 @@ sdr::contact::ViewContact* SdrObjGroup::CreateObjectSpecificViewContact()
 
 SdrObjGroup::SdrObjGroup()
 {
-    pSub=new SdrObjList(nullptr,nullptr);
+    pSub.reset( new SdrObjList(nullptr,nullptr) );
     pSub->SetOwnerObj(this);
     pSub->SetListKind(SdrObjListKind::GroupObj);
     bClosedObj=false;
@@ -78,13 +78,12 @@ SdrObjGroup::SdrObjGroup()
 
 SdrObjGroup::~SdrObjGroup()
 {
-    delete pSub;
 }
 
 void SdrObjGroup::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
 {
     rInfo.bNoContortion=false;
-    SdrObjList* pOL=pSub;
+    SdrObjList* pOL=pSub.get();
     const size_t nObjCount = pOL->GetObjCount();
     for (size_t i=0; i<nObjCount; ++i) {
         SdrObject* pObj=pOL->GetObj(i);
@@ -148,7 +147,7 @@ SdrLayerID SdrObjGroup::GetLayer() const
 {
     bool b1st = true;
     SdrLayerID nLay=SdrLayerID(SdrObject::GetLayer());
-    SdrObjList* pOL=pSub;
+    SdrObjList* pOL=pSub.get();
     const size_t nObjCount = pOL->GetObjCount();
     for (size_t i=0; i<nObjCount; ++i) {
         SdrLayerID nLay1=pOL->GetObj(i)->GetLayer();
@@ -162,7 +161,7 @@ SdrLayerID SdrObjGroup::GetLayer() const
 void SdrObjGroup::NbcSetLayer(SdrLayerID nLayer)
 {
     SdrObject::NbcSetLayer(nLayer);
-    SdrObjList* pOL=pSub;
+    SdrObjList* pOL=pSub.get();
     const size_t nObjCount = pOL->GetObjCount();
     for (size_t i=0; i<nObjCount; ++i) {
         pOL->GetObj(i)->NbcSetLayer(nLayer);
@@ -216,7 +215,7 @@ void SdrObjGroup::SetModel(SdrModel* pNewModel)
 
 SdrObjList* SdrObjGroup::GetSubList() const
 {
-    return pSub;
+    return pSub.get();
 }
 
 const Rectangle& SdrObjGroup::GetCurrentBoundRect() const
@@ -400,7 +399,7 @@ void SdrObjGroup::NbcMove(const Size& rSiz)
 {
     MovePoint(aRefPoint,rSiz);
     if (pSub->GetObjCount()!=0) {
-        SdrObjList* pOL=pSub;
+        SdrObjList* pOL=pSub.get();
         const size_t nObjCount = pOL->GetObjCount();
         for (size_t i=0; i<nObjCount; ++i) {
             SdrObject* pObj=pOL->GetObj(i);
@@ -432,7 +431,7 @@ void SdrObjGroup::NbcResize(const Point& rRef, const Fraction& xFact, const Frac
     }
     ResizePoint(aRefPoint,rRef,xFact,yFact);
     if (pSub->GetObjCount()!=0) {
-        SdrObjList* pOL=pSub;
+        SdrObjList* pOL=pSub.get();
         const size_t nObjCount = pOL->GetObjCount();
         for (size_t i=0; i<nObjCount; ++i) {
             SdrObject* pObj=pOL->GetObj(i);
@@ -449,7 +448,7 @@ void SdrObjGroup::NbcRotate(const Point& rRef, long nAngle, double sn, double cs
 {
     SetGlueReallyAbsolute(true);
     RotatePoint(aRefPoint,rRef,sn,cs);
-    SdrObjList* pOL=pSub;
+    SdrObjList* pOL=pSub.get();
     const size_t nObjCount = pOL->GetObjCount();
     for (size_t i=0; i<nObjCount; ++i) {
         SdrObject* pObj=pOL->GetObj(i);
@@ -464,7 +463,7 @@ void SdrObjGroup::NbcMirror(const Point& rRef1, const Point& rRef2)
 {
     SetGlueReallyAbsolute(true);
     MirrorPoint(aRefPoint,rRef1,rRef2); // implementation missing in SvdEtc!
-    SdrObjList* pOL=pSub;
+    SdrObjList* pOL=pSub.get();
     const size_t nObjCount = pOL->GetObjCount();
     for (size_t i=0; i<nObjCount; ++i) {
         SdrObject* pObj=pOL->GetObj(i);
@@ -479,7 +478,7 @@ void SdrObjGroup::NbcShear(const Point& rRef, long nAngle, double tn, bool bVShe
 {
     SetGlueReallyAbsolute(true);
     ShearPoint(aRefPoint,rRef,tn);
-    SdrObjList* pOL=pSub;
+    SdrObjList* pOL=pSub.get();
     const size_t nObjCount = pOL->GetObjCount();
     for (size_t i=0; i<nObjCount; ++i) {
         SdrObject* pObj=pOL->GetObj(i);
@@ -495,7 +494,7 @@ void SdrObjGroup::NbcSetAnchorPos(const Point& rPnt)
     aAnchor=rPnt;
     Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y());
     MovePoint(aRefPoint,aSiz);
-    SdrObjList* pOL=pSub;
+    SdrObjList* pOL=pSub.get();
     const size_t nObjCount=pOL->GetObjCount();
     for (size_t i=0; i<nObjCount; ++i) {
         SdrObject* pObj=pOL->GetObj(i);
@@ -542,7 +541,7 @@ void SdrObjGroup::Move(const Size& rSiz)
         MovePoint(aRefPoint,rSiz);
         if (pSub->GetObjCount()!=0) {
             // first move the connectors, then everything else
-            SdrObjList* pOL=pSub;
+            SdrObjList* pOL=pSub.get();
             const size_t nObjCount = pOL->GetObjCount();
             for (size_t i=0; i<nObjCount; ++i) {
                 SdrObject* pObj=pOL->GetObj(i);
@@ -586,7 +585,7 @@ void SdrObjGroup::Resize(const Point& rRef, const Fraction& xFact, const Fractio
         ResizePoint(aRefPoint,rRef,xFact,yFact);
         if (pSub->GetObjCount()!=0) {
             // move the connectors first, everything else afterwards
-            SdrObjList* pOL=pSub;
+            SdrObjList* pOL=pSub.get();
             const size_t nObjCount = pOL->GetObjCount();
             for (size_t i=0; i<nObjCount; ++i) {
                 SdrObject* pObj=pOL->GetObj(i);
@@ -615,7 +614,7 @@ void SdrObjGroup::Rotate(const Point& rRef, long nAngle, double sn, double cs)
         Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
         RotatePoint(aRefPoint,rRef,sn,cs);
         // move the connectors first, everything else afterwards
-        SdrObjList* pOL=pSub;
+        SdrObjList* pOL=pSub.get();
         const size_t nObjCount = pOL->GetObjCount();
         for (size_t i=0; i<nObjCount; ++i) {
             SdrObject* pObj=pOL->GetObj(i);
@@ -640,7 +639,7 @@ void SdrObjGroup::Mirror(const Point& rRef1, const Point& rRef2)
     Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
     MirrorPoint(aRefPoint,rRef1,rRef2); // implementation missing in SvdEtc!
     // move the connectors first, everything else afterwards
-    SdrObjList* pOL=pSub;
+    SdrObjList* pOL=pSub.get();
     const size_t nObjCount = pOL->GetObjCount();
     for (size_t i=0; i<nObjCount; ++i) {
         SdrObject* pObj=pOL->GetObj(i);
@@ -665,7 +664,7 @@ void SdrObjGroup::Shear(const Point& rRef, long nAngle, double tn, bool bVShear)
         Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
         ShearPoint(aRefPoint,rRef,tn);
         // move the connectors first, everything else afterwards
-        SdrObjList* pOL=pSub;
+        SdrObjList* pOL=pSub.get();
         const size_t nObjCount = pOL->GetObjCount();
         for (size_t i=0; i<nObjCount; ++i) {
             SdrObject* pObj=pOL->GetObj(i);
@@ -692,7 +691,7 @@ void SdrObjGroup::SetAnchorPos(const Point& rPnt)
     Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y());
     MovePoint(aRefPoint,aSiz);
     // move the connectors first, everything else afterwards
-    SdrObjList* pOL=pSub;
+    SdrObjList* pOL=pSub.get();
     const size_t nObjCount = pOL->GetObjCount();
     for (size_t i=0; i<nObjCount; ++i) {
         SdrObject* pObj=pOL->GetObj(i);
diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx
index a1fca2a..8e07df0 100644
--- a/svx/source/svdraw/svdorect.cxx
+++ b/svx/source/svdraw/svdorect.cxx
@@ -97,7 +97,6 @@ SdrRectObj::SdrRectObj(SdrObjKind eNewTextKind, const Rectangle& rRect)
 
 SdrRectObj::~SdrRectObj()
 {
-    delete mpXPoly;
 }
 
 SdrRectObj& SdrRectObj::operator=(const SdrRectObj& rCopy)
@@ -107,20 +106,17 @@ SdrRectObj& SdrRectObj::operator=(const SdrRectObj& rCopy)
 
     SdrTextObj::operator=( rCopy );
 
-    delete mpXPoly;
-
     if ( rCopy.mpXPoly )
-        mpXPoly = new XPolygon( *rCopy.mpXPoly );
+        mpXPoly.reset( new XPolygon( *rCopy.mpXPoly ) );
     else
-        mpXPoly = nullptr;
+        mpXPoly.reset();
 
     return *this;
 }
 
 void SdrRectObj::SetXPolyDirty()
 {
-    delete mpXPoly;
-    mpXPoly = nullptr;
+    mpXPoly.reset();
 }
 
 XPolygon SdrRectObj::ImpCalcXPoly(const Rectangle& rRect1, long nRad1) const
@@ -149,8 +145,7 @@ XPolygon SdrRectObj::ImpCalcXPoly(const Rectangle& rRect1, long nRad1) const
 
 void SdrRectObj::RecalcXPoly()
 {
-    delete mpXPoly;
-    mpXPoly = new XPolygon(ImpCalcXPoly(maRect,GetEckenradius()));
+    mpXPoly.reset( new XPolygon(ImpCalcXPoly(maRect,GetEckenradius())) );
 }
 
 const XPolygon& SdrRectObj::GetXPoly() const
diff --git a/svx/source/svdraw/svdotxln.cxx b/svx/source/svdraw/svdotxln.cxx
index 2079203..e6d4d4f 100644
--- a/svx/source/svdraw/svdotxln.cxx
+++ b/svx/source/svdraw/svdotxln.cxx
@@ -105,7 +105,6 @@ ImpSdrObjTextLinkUserData::ImpSdrObjTextLinkUserData():
 
 ImpSdrObjTextLinkUserData::~ImpSdrObjTextLinkUserData()
 {
-    delete pLink;
 }
 
 SdrObjUserData* ImpSdrObjTextLinkUserData::Clone(SdrObject* ) const
@@ -258,7 +257,7 @@ void SdrTextObj::ImpLinkAnmeldung()
     ImpSdrObjTextLinkUserData* pData=GetLinkUserData();
     sfx2::LinkManager* pLinkManager=pModel!=nullptr ? pModel->GetLinkManager() : nullptr;
     if (pLinkManager!=nullptr && pData!=nullptr && pData->pLink==nullptr) { // don't register twice
-        pData->pLink = new ImpSdrObjTextLink(this);
+        pData->pLink.reset( new ImpSdrObjTextLink(this) );
         pLinkManager->InsertFileLink(*pData->pLink,OBJECT_CLIENT_FILE,pData->aFileName,
                                      !pData->aFilterName.isEmpty() ?
                                       &pData->aFilterName : nullptr);
@@ -271,7 +270,7 @@ void SdrTextObj::ImpLinkAbmeldung()
     sfx2::LinkManager* pLinkManager=pModel!=nullptr ? pModel->GetLinkManager() : nullptr;
     if (pLinkManager!=nullptr && pData!=nullptr && pData->pLink!=nullptr) { // don't register twice
         // when doing Remove, *pLink is deleted implicitly
-        pLinkManager->Remove( pData->pLink );
+        pLinkManager->Remove( pData->pLink.get() );
         pData->pLink=nullptr;
     }
 }
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index 6619250..5306024 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -1489,7 +1489,7 @@ SdrUndoDelPage::SdrUndoDelPage(SdrPage& rNewPg)
                 {
                     if(!pUndoGroup)
                     {
-                        pUndoGroup = new SdrUndoGroup(rMod);
+                        pUndoGroup.reset( new SdrUndoGroup(rMod) );
                     }
 
                     pUndoGroup->AddAction(rMod.GetSdrUndoFactory().CreateUndoPageRemoveMasterPage(*pDrawPage));
@@ -1501,7 +1501,6 @@ SdrUndoDelPage::SdrUndoDelPage(SdrPage& rNewPg)
 
 SdrUndoDelPage::~SdrUndoDelPage()
 {
-    delete pUndoGroup;
 }
 
 void SdrUndoDelPage::Undo()
diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx
index f6fd2c9..d014873 100644
--- a/svx/source/xoutdev/xattrbmp.cxx
+++ b/svx/source/xoutdev/xattrbmp.cxx
@@ -47,14 +47,12 @@ using namespace ::com::sun::star;
 XOBitmap::XOBitmap( const Bitmap& rBmp ) :
     eType           ( XBitmapType::Import ),
     xGraphicObject  (new GraphicObject(rBmp)),
-    pPixelArray     ( nullptr ),
     bGraphicDirty   ( false )
 {
 }
 
 XOBitmap::~XOBitmap()
 {
-    delete [] pPixelArray;
 }
 
 Bitmap XOBitmap::GetBitmap() const
@@ -78,7 +76,7 @@ void XOBitmap::Bitmap2Array()
     const sal_uInt16    nLines = 8; // type dependent
 
     if( !pPixelArray )
-        pPixelArray = new sal_uInt16[ nLines * nLines ];
+        pPixelArray.reset( new sal_uInt16[ nLines * nLines ] );
 
     pVDev->SetOutputSizePixel( aBitmap.GetSizePixel() );
     pVDev->DrawBitmap( Point(), aBitmap );
@@ -90,10 +88,10 @@ void XOBitmap::Bitmap2Array()
         for( sal_uInt16 j = 0; j < nLines; j++ )
         {
             if ( pVDev->GetPixel( Point( j, i ) ) == aBckgrColor )
-                *( pPixelArray + j + i * nLines ) = 0;
+                pPixelArray[ j + i * nLines ] = 0;
             else
             {
-                *( pPixelArray + j + i * nLines ) = 1;
+                pPixelArray[ j + i * nLines ] = 1;
                 if( !bPixelColor )
                 {
                     aPixelColor = pVDev->GetPixel( Point( j, i ) );
@@ -120,7 +118,7 @@ void XOBitmap::Array2Bitmap()
     {
         for( sal_uInt16 j = 0; j < nLines; j++ )
         {
-            if( *( pPixelArray + j + i * nLines ) == 0 )
+            if( pPixelArray[ j + i * nLines ] == 0 )
                 pVDev->DrawPixel( Point( j, i ), aBckgrColor );
             else
                 pVDev->DrawPixel( Point( j, i ), aPixelColor );
diff --git a/svx/source/xoutdev/xexch.cxx b/svx/source/xoutdev/xexch.cxx
index 867ece2..382ad85 100644
--- a/svx/source/xoutdev/xexch.cxx
+++ b/svx/source/xoutdev/xexch.cxx
@@ -38,7 +38,6 @@ XFillExchangeData::XFillExchangeData( const XFillAttrSetItem& rXFillAttrSetItem
 
 XFillExchangeData::~XFillExchangeData()
 {
-    delete pXFillAttrSetItem;
 }
 
 /// binary export (currently w/o version control because it is not persistent)
@@ -110,8 +109,7 @@ SvStream& ReadXFillExchangeData( SvStream& rIStm, XFillExchangeData& rData )
         }
     }
 
-    delete rData.pXFillAttrSetItem;
-    rData.pXFillAttrSetItem = new XFillAttrSetItem( pSet );
+    rData.pXFillAttrSetItem.reset( new XFillAttrSetItem( pSet ) );
     rData.pPool = rData.pXFillAttrSetItem->GetItemSet().GetPool();
 
     return rIStm;
@@ -119,17 +117,15 @@ SvStream& ReadXFillExchangeData( SvStream& rIStm, XFillExchangeData& rData )
 
 XFillExchangeData& XFillExchangeData::operator=( const XFillExchangeData& rData )
 {
-    delete pXFillAttrSetItem;
-
     if( rData.pXFillAttrSetItem )
-        pXFillAttrSetItem = static_cast<XFillAttrSetItem*>( rData.pXFillAttrSetItem->Clone( pPool = rData.pXFillAttrSetItem->GetItemSet().GetPool() ) );
+        pXFillAttrSetItem.reset( static_cast<XFillAttrSetItem*>( rData.pXFillAttrSetItem->Clone( pPool = rData.pXFillAttrSetItem->GetItemSet().GetPool() ) ) );
     else
     {
         pPool = nullptr;
-        pXFillAttrSetItem = nullptr;
+        pXFillAttrSetItem.reset();
     }
 
-    return( *this );
+    return *this;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list