summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-11 13:04:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-01-16 06:10:36 +0000
commit0b272cdf0025ce4bca31ee01c8b3aaca042dcb62 (patch)
treee5d3ec93289598ebfe0121e7a3d0c880c3054844 /svx
parent570d8dab6d6754ab8020cbe6624020dff7b8b624 (diff)
new loplugin: useuniqueptr: svx
Change-Id: I0eb3d43d7bcfc491df16a72997a0720a6aec2c5c Reviewed-on: https://gerrit.libreoffice.org/32959 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/dialog/langbox.cxx3
-rw-r--r--svx/source/dialog/srchdlg.cxx13
-rw-r--r--svx/source/form/fmshimp.cxx1
-rw-r--r--svx/source/gallery2/gallery1.cxx8
-rw-r--r--svx/source/inc/fmshimp.hxx2
-rw-r--r--svx/source/items/hlnkitem.cxx16
-rw-r--r--svx/source/items/numinf.cxx11
-rw-r--r--svx/source/svdraw/svdobj.cxx8
-rw-r--r--svx/source/svdraw/svdocirc.cxx2
-rw-r--r--svx/source/svdraw/svdoedge.cxx5
-rw-r--r--svx/source/svdraw/svdogrp.cxx35
-rw-r--r--svx/source/svdraw/svdorect.cxx13
-rw-r--r--svx/source/svdraw/svdotxln.cxx5
-rw-r--r--svx/source/svdraw/svdundo.cxx3
-rw-r--r--svx/source/xoutdev/xattrbmp.cxx10
-rw-r--r--svx/source/xoutdev/xexch.cxx12
16 files changed, 57 insertions, 90 deletions
diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx
index d746aef1a1fa..47340894e2a4 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 5d6e3567308c..a7f025d1c11d 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 6fd5a6683879..6730074846ea 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 69a380e623e2..927f0b5db5d0 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 48c518b3984b..fc799e139241 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 04cf184759d4..cfac4a37e620 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 f403ecf9a8fb..37c4963ef862 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 d885ed3b9ed6..f62dd3100a18 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 e4b3a01d49f0..f561e8220062 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 1dca9ab9b943..86a842841581 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 548b499348da..62a368220264 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 a1fca2ab4f23..8e07df00e16c 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 20792039e5ee..e6d4d4f6825e 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 66192509c0bf..530602459d68 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 f6fd2c967466..d014873d6cbb 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 867ece23ccbf..382ad85183e3 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: */