summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-17 10:12:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-01-18 06:37:03 +0000
commitf3a90d13056ca23708cc4fd9562c99d0b41a4b6f (patch)
tree514a650ae2ef4f2c3c0fc2d8bccdb7b45558996f /sd
parentc06ca5e183c232766468af4ce631e1eda130e7f9 (diff)
new loplugin: useuniqueptr: sd
Change-Id: I2fc8a2fa57cc00edf2edab9e3722c824e75cb7e5 Reviewed-on: https://gerrit.libreoffice.org/33204 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r--sd/inc/undo/undoobjects.hxx2
-rw-r--r--sd/source/core/undo/undoobjects.cxx3
-rw-r--r--sd/source/filter/eppt/eppt.hxx7
-rw-r--r--sd/source/filter/eppt/epptbase.hxx3
-rw-r--r--sd/source/filter/eppt/epptso.cxx13
-rw-r--r--sd/source/filter/ppt/pptin.cxx3
-rw-r--r--sd/source/filter/ppt/pptin.hxx2
-rw-r--r--sd/source/filter/ppt/propread.cxx13
-rw-r--r--sd/source/filter/ppt/propread.hxx8
-rw-r--r--sd/source/ui/func/fupage.cxx12
-rw-r--r--sd/source/ui/inc/fupage.hxx3
-rw-r--r--sd/source/ui/inc/unosrch.hxx2
-rw-r--r--sd/source/ui/unoidl/unosrch.cxx3
13 files changed, 33 insertions, 41 deletions
diff --git a/sd/inc/undo/undoobjects.hxx b/sd/inc/undo/undoobjects.hxx
index ee2d3bf16fcb..a1d208c5be4c 100644
--- a/sd/inc/undo/undoobjects.hxx
+++ b/sd/inc/undo/undoobjects.hxx
@@ -92,7 +92,7 @@ public:
virtual void Redo() override;
private:
- SfxUndoAction* mpUndoAnimation;
+ std::unique_ptr<SfxUndoAction> mpUndoAnimation;
bool mbNewEmptyPresObj;
SdrObjectWeakRef mxSdrObject;
};
diff --git a/sd/source/core/undo/undoobjects.cxx b/sd/source/core/undo/undoobjects.cxx
index d4e7d63421fa..101fd27927c4 100644
--- a/sd/source/core/undo/undoobjects.cxx
+++ b/sd/source/core/undo/undoobjects.cxx
@@ -186,14 +186,13 @@ UndoObjectSetText::UndoObjectSetText( SdrObject& rObject, sal_Int32 nText )
css::uno::Reference< css::drawing::XShape > xShape( rObject.getUnoShape(), css::uno::UNO_QUERY );
if( pPage->getMainSequence()->hasEffect( xShape ) )
{
- mpUndoAnimation = new UndoAnimation( static_cast< SdDrawDocument* >( pPage->GetModel() ), pPage );
+ mpUndoAnimation.reset( new UndoAnimation( static_cast< SdDrawDocument* >( pPage->GetModel() ), pPage ) );
}
}
}
UndoObjectSetText::~UndoObjectSetText()
{
- delete mpUndoAnimation;
}
void UndoObjectSetText::Undo()
diff --git a/sd/source/filter/eppt/eppt.hxx b/sd/source/filter/eppt/eppt.hxx
index 98718fe84b9d..0447c25c66f4 100644
--- a/sd/source/filter/eppt/eppt.hxx
+++ b/sd/source/filter/eppt/eppt.hxx
@@ -135,12 +135,7 @@ struct PPTExOleObjEntry
struct TextRuleEntry
{
- SvMemoryStream* pOut;
-
- explicit TextRuleEntry() :
- pOut ( nullptr ){};
-
- ~TextRuleEntry() { delete pOut; };
+ std::unique_ptr<SvMemoryStream> pOut;
};
class TextObjBinary : public TextObj
diff --git a/sd/source/filter/eppt/epptbase.hxx b/sd/source/filter/eppt/epptbase.hxx
index af03a99c7d30..8925ff2073c7 100644
--- a/sd/source/filter/eppt/epptbase.hxx
+++ b/sd/source/filter/eppt/epptbase.hxx
@@ -120,7 +120,8 @@ class PPTExBulletProvider
SvMemoryStream aBuExOutlineStream;
SvMemoryStream aBuExMasterStream;
- EscherGraphicProvider* pGraphicProv;
+ std::unique_ptr<EscherGraphicProvider>
+ pGraphicProv;
public:
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
index aa1ffcb07b7e..8be0b03d9e8e 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -97,13 +97,12 @@ using namespace ::com::sun::star;
#define FIXED_PITCH 0x01
PPTExBulletProvider::PPTExBulletProvider()
+ : pGraphicProv( new EscherGraphicProvider( EscherGraphicProviderFlags::UseInstances ) )
{
- pGraphicProv = new EscherGraphicProvider( EscherGraphicProviderFlags::UseInstances );
}
PPTExBulletProvider::~PPTExBulletProvider()
{
- delete pGraphicProv;
}
sal_uInt16 PPTExBulletProvider::GetId( const OString& rUniqueId, Size& rGraphicSize )
@@ -1266,7 +1265,10 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u
{
SvStream* pRuleOut = &rOut;
if ( pTextRule )
- pRuleOut = pTextRule->pOut = new SvMemoryStream( 0x100, 0x100 );
+ {
+ pTextRule->pOut.reset( new SvMemoryStream( 0x100, 0x100 ) );
+ pRuleOut = pTextRule->pOut.get();
+ }
sal_uInt32 nRulePos = pRuleOut->Tell();
pRuleOut->WriteUInt32( EPP_TextRulerAtom << 16 ).WriteUInt32( 0 );
@@ -2763,12 +2765,11 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
ImplGetText();
ImplWriteTextStyleAtom( *pClientTextBox, nTextType, nPObjects, &aTextRule, aExtBu, nullptr );
ImplWriteExtParaHeader( aExtBu, nPObjects++, nTextType, nPageNumber + 0x100 );
- SvMemoryStream* pOut = aTextRule.pOut;
+ SvMemoryStream* pOut = aTextRule.pOut.get();
if ( pOut )
{
pClientTextBox->WriteBytes(pOut->GetData(), pOut->Tell());
- delete pOut;
- aTextRule.pOut = nullptr;
+ aTextRule.pOut.reset();
}
if ( aExtBu.Tell() )
{
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index c5304993dcc8..c7f443c8979c 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -155,7 +155,7 @@ SdPPTImport::SdPPTImport( SdDrawDocument* pDocument, SvStream& rDocStream, SotSt
}
}
- pFilter = new ImplSdPPTImport( pDocument, rStorage, rMedium, aParam );
+ pFilter.reset( new ImplSdPPTImport( pDocument, rStorage, rMedium, aParam ) );
}
bool SdPPTImport::Import()
@@ -165,7 +165,6 @@ bool SdPPTImport::Import()
SdPPTImport::~SdPPTImport()
{
- delete pFilter;
}
ImplSdPPTImport::ImplSdPPTImport( SdDrawDocument* pDocument, SotStorage& rStorage_, SfxMedium& rMedium, PowerPointImportParam& rParam )
diff --git a/sd/source/filter/ppt/pptin.hxx b/sd/source/filter/ppt/pptin.hxx
index f9435922facf..ac5eb2811e5e 100644
--- a/sd/source/filter/ppt/pptin.hxx
+++ b/sd/source/filter/ppt/pptin.hxx
@@ -82,7 +82,7 @@ public:
class SdPPTImport
{
- ImplSdPPTImport* pFilter;
+ std::unique_ptr<ImplSdPPTImport> pFilter;
public:
diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx
index 383f403322ed..2167bda64e3e 100644
--- a/sd/source/filter/ppt/propread.cxx
+++ b/sd/source/filter/ppt/propread.cxx
@@ -28,7 +28,7 @@ PropEntry::PropEntry( sal_uInt32 nId, const sal_uInt8* pBuf, sal_uInt32 nBufSize
mnSize ( nBufSize ),
mpBuf ( new sal_uInt8[ nBufSize ] )
{
- memcpy( static_cast<void*>(mpBuf), static_cast<void const *>(pBuf), nBufSize );
+ memcpy( mpBuf.get(), pBuf, nBufSize );
};
PropEntry::PropEntry( const PropEntry& rProp ) :
@@ -36,18 +36,17 @@ PropEntry::PropEntry( const PropEntry& rProp ) :
mnSize ( rProp.mnSize ),
mpBuf ( new sal_uInt8[ mnSize ] )
{
- memcpy( static_cast<void*>(mpBuf), static_cast<void const *>(rProp.mpBuf), mnSize );
+ memcpy( mpBuf.get(), rProp.mpBuf.get(), mnSize );
};
PropEntry& PropEntry::operator=(const PropEntry& rPropEntry)
{
if ( this != &rPropEntry )
{
- delete[] mpBuf;
mnId = rPropEntry.mnId;
mnSize = rPropEntry.mnSize;
- mpBuf = new sal_uInt8[ mnSize ];
- memcpy( static_cast<void*>(mpBuf), static_cast<void const *>(rPropEntry.mpBuf), mnSize );
+ mpBuf.reset( new sal_uInt8[ mnSize ] );
+ memcpy( mpBuf.get(), rPropEntry.mpBuf.get(), mnSize );
}
return *this;
}
@@ -235,7 +234,7 @@ bool Section::GetProperty( sal_uInt32 nId, PropItem& rPropItem )
{
rPropItem.Clear();
rPropItem.SetTextEncoding( mnTextEnc );
- rPropItem.WriteBytes( (*iter)->mpBuf, (*iter)->mnSize );
+ rPropItem.WriteBytes( (*iter)->mpBuf.get(), (*iter)->mnSize );
rPropItem.Seek( STREAM_SEEK_TO_BEGIN );
return true;
}
@@ -280,7 +279,7 @@ void Section::GetDictionary(Dictionary& rDict)
if (iter == maEntries.end())
return;
- SvMemoryStream aStream( (*iter)->mpBuf, (*iter)->mnSize, StreamMode::READ );
+ SvMemoryStream aStream( (*iter)->mpBuf.get(), (*iter)->mnSize, StreamMode::READ );
aStream.Seek( STREAM_SEEK_TO_BEGIN );
sal_uInt32 nDictCount(0);
aStream.ReadUInt32( nDictCount );
diff --git a/sd/source/filter/ppt/propread.hxx b/sd/source/filter/ppt/propread.hxx
index 04c619a4565c..c874eeb4d5fd 100644
--- a/sd/source/filter/ppt/propread.hxx
+++ b/sd/source/filter/ppt/propread.hxx
@@ -85,13 +85,13 @@ typedef std::map<OUString,sal_uInt32> Dictionary;
struct PropEntry
{
- sal_uInt32 mnId;
- sal_uInt32 mnSize;
- sal_uInt8* mpBuf;
+ sal_uInt32 mnId;
+ sal_uInt32 mnSize;
+ std::unique_ptr<sal_uInt8[]> mpBuf;
PropEntry( sal_uInt32 nId, const sal_uInt8* pBuf, sal_uInt32 nBufSize );
PropEntry( const PropEntry& rProp );
- ~PropEntry() { delete[] mpBuf; } ;
+ ~PropEntry() {}
PropEntry& operator=(const PropEntry& rPropEntry);
};
diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx
index 6bf77d4ad1ff..59c7cf29b460 100644
--- a/sd/source/ui/func/fupage.cxx
+++ b/sd/source/ui/func/fupage.cxx
@@ -159,7 +159,6 @@ void FuPage::DoExecute( SfxRequest& )
FuPage::~FuPage()
{
- delete mpBackgroundObjUndoAction;
}
void FuPage::Activate()
@@ -386,8 +385,8 @@ const SfxItemSet* FuPage::ExecuteDialog( vcl::Window* pParent )
if( mbPageBckgrdDeleted )
{
- mpBackgroundObjUndoAction = new SdBackgroundObjUndoAction(
- *mpDoc, *mpPage, mpPage->getSdrPageProperties().GetItemSet());
+ mpBackgroundObjUndoAction.reset( new SdBackgroundObjUndoAction(
+ *mpDoc, *mpPage, mpPage->getSdrPageProperties().GetItemSet()) );
if(!mpPage->IsMasterPage())
{
@@ -609,9 +608,8 @@ void FuPage::ApplyItemSet( const SfxItemSet* pArgs )
if( !mbMasterPage && !mbPageBckgrdDeleted )
{
// Only this page
- delete mpBackgroundObjUndoAction;
- mpBackgroundObjUndoAction = new SdBackgroundObjUndoAction(
- *mpDoc, *mpPage, mpPage->getSdrPageProperties().GetItemSet());
+ mpBackgroundObjUndoAction.reset( new SdBackgroundObjUndoAction(
+ *mpDoc, *mpPage, mpPage->getSdrPageProperties().GetItemSet()) );
SfxItemSet aSet( *pArgs );
sdr::properties::CleanupFillProperties(aSet);
mpPage->getSdrPageProperties().ClearItem();
@@ -623,7 +621,7 @@ void FuPage::ApplyItemSet( const SfxItemSet* pArgs )
if( mpBackgroundObjUndoAction )
{
// set merge flag, because a SdUndoGroupAction could have been inserted before
- mpDocSh->GetUndoManager()->AddUndoAction( mpBackgroundObjUndoAction, true );
+ mpDocSh->GetUndoManager()->AddUndoAction( mpBackgroundObjUndoAction.get(), true );
mpBackgroundObjUndoAction = nullptr;
}
diff --git a/sd/source/ui/inc/fupage.hxx b/sd/source/ui/inc/fupage.hxx
index fe17d2a5341a..a4aead46df27 100644
--- a/sd/source/ui/inc/fupage.hxx
+++ b/sd/source/ui/inc/fupage.hxx
@@ -57,7 +57,8 @@ private:
SfxRequest& mrReq;
const SfxItemSet* mpArgs;
- SdBackgroundObjUndoAction* mpBackgroundObjUndoAction;
+ std::unique_ptr<SdBackgroundObjUndoAction>
+ mpBackgroundObjUndoAction;
Size maSize;
bool mbPageBckgrdDeleted;
bool mbMasterPage;
diff --git a/sd/source/ui/inc/unosrch.hxx b/sd/source/ui/inc/unosrch.hxx
index 8487993c0bdc..342b01024ed0 100644
--- a/sd/source/ui/inc/unosrch.hxx
+++ b/sd/source/ui/inc/unosrch.hxx
@@ -77,7 +77,7 @@ public:
class SdUnoSearchReplaceDescriptor : public ::cppu::WeakImplHelper< css::lang::XUnoTunnel, css::util::XReplaceDescriptor > // public css::util::XSearchDescriptor, css::beans::XPropertySet
{
protected:
- SvxItemPropertySet* mpPropSet;
+ std::unique_ptr<SvxItemPropertySet> mpPropSet;
bool mbBackwards;
bool mbCaseSensitive;
diff --git a/sd/source/ui/unoidl/unosrch.cxx b/sd/source/ui/unoidl/unosrch.cxx
index f043d04eab36..f48ce25a7180 100644
--- a/sd/source/ui/unoidl/unosrch.cxx
+++ b/sd/source/ui/unoidl/unosrch.cxx
@@ -704,7 +704,7 @@ UNO3_GETIMPLEMENTATION_IMPL( SdUnoSearchReplaceDescriptor );
SdUnoSearchReplaceDescriptor::SdUnoSearchReplaceDescriptor( bool bReplace ) throw (css::uno::RuntimeException)
{
- mpPropSet = new SvxItemPropertySet(ImplGetSearchPropertyMap(), SdrObject::GetGlobalDrawObjectItemPool());
+ mpPropSet.reset( new SvxItemPropertySet(ImplGetSearchPropertyMap(), SdrObject::GetGlobalDrawObjectItemPool()) );
mbBackwards = false;
mbCaseSensitive = false;
@@ -715,7 +715,6 @@ SdUnoSearchReplaceDescriptor::SdUnoSearchReplaceDescriptor( bool bReplace ) thro
SdUnoSearchReplaceDescriptor::~SdUnoSearchReplaceDescriptor() throw()
{
- delete mpPropSet;
}
// XSearchDescriptor