summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-18 09:47:46 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-01-18 09:26:26 +0000
commit352e036ada79bee79b0b52352cab4b05695b1abf (patch)
treecc6f80c827672e636a4db0e66d68f1edffabb4f7 /svtools
parentd0cbdac23ba545091eb9fac8b114cfc20df74ebf (diff)
new loplugin: useuniqueptr: svl..svtools
Change-Id: Ia4d5b37ee3cf67318e3cc01525e4b733af60d038 Reviewed-on: https://gerrit.libreoffice.org/33251 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/contnr/fileview.cxx10
-rw-r--r--svtools/source/dialogs/addresstemplate.cxx6
-rw-r--r--svtools/source/misc/ehdl.cxx4
-rw-r--r--svtools/source/misc/embedhlp.cxx27
-rw-r--r--svtools/source/misc/transfer2.cxx14
5 files changed, 22 insertions, 39 deletions
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 9c1e990b1f0c..dde935604857 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -286,7 +286,7 @@ const OUString* NameTranslationList::Translate( const OUString& rName ) const
class NameTranslator_Impl : public ::svt::IContentTitleTranslation
{
private:
- NameTranslationList* mpActFolder;
+ std::unique_ptr<NameTranslationList> mpActFolder;
public:
explicit NameTranslator_Impl( const INetURLObject& rActualFolder );
virtual ~NameTranslator_Impl();
@@ -1399,13 +1399,12 @@ void SvtFileView::StateChanged( StateChangedType nStateChange )
NameTranslator_Impl::NameTranslator_Impl( const INetURLObject& rActualFolder )
+ : mpActFolder( new NameTranslationList( rActualFolder ) )
{
- mpActFolder = new NameTranslationList( rActualFolder );
}
NameTranslator_Impl::~NameTranslator_Impl()
{
- delete mpActFolder;
}
void NameTranslator_Impl::SetActualFolder( const INetURLObject& rActualFolder )
@@ -1414,12 +1413,11 @@ void NameTranslator_Impl::SetActualFolder( const INetURLObject& rActualFolder )
{
if (mpActFolder->GetHashedURL() != rActualFolder.GetMainURL(INetURLObject::DecodeMechanism::NONE))
{
- delete mpActFolder;
- mpActFolder = new NameTranslationList( rActualFolder );
+ mpActFolder.reset( new NameTranslationList( rActualFolder ) );
}
}
else
- mpActFolder = new NameTranslationList( rActualFolder );
+ mpActFolder.reset( new NameTranslationList( rActualFolder ) );
}
bool NameTranslator_Impl::GetTranslation( const OUString& rOrg, OUString& rTrans ) const
diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx
index a7c805194983..8338cdeb2bce 100644
--- a/svtools/source/dialogs/addresstemplate.cxx
+++ b/svtools/source/dialogs/addresstemplate.cxx
@@ -445,7 +445,7 @@ void AssignmentPersistentData::ImplCommit()
/// the logical field names
std::vector<OUString> aLogicalFieldNames;
- IAssigmentData* pConfigData;
+ std::unique_ptr<IAssigmentData> pConfigData;
AddressBookSourceDialogData( )
@@ -474,7 +474,6 @@ void AssignmentPersistentData::ImplCommit()
~AddressBookSourceDialogData()
{
- delete pConfigData;
}
// Copy assignment is forbidden and not implemented.
@@ -1183,8 +1182,7 @@ void AssignmentPersistentData::ImplCommit()
sName = aFileNotation.get(OFileNotation::N_SYSTEM);
}
m_pDatasource->InsertEntry(sName);
- delete m_pImpl->pConfigData;
- m_pImpl->pConfigData = new AssignmentPersistentData();
+ m_pImpl->pConfigData.reset( new AssignmentPersistentData );
loadConfiguration();
resetTables();
// will reset the fields implicitly
diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx
index 60fde45acf6a..577953b62ebc 100644
--- a/svtools/source/misc/ehdl.cxx
+++ b/svtools/source/misc/ehdl.cxx
@@ -150,14 +150,14 @@ SfxErrorHandler::SfxErrorHandler(sal_uInt16 nIdP, sal_uLong lStartP, sal_uLong l
RegisterDisplay(&aWndFunc);
if( ! pMgr )
{
- pFreeMgr = pMgr = ResMgr::CreateResMgr("ofa", Application::GetSettings().GetUILanguageTag() );
+ pMgr = ResMgr::CreateResMgr("ofa", Application::GetSettings().GetUILanguageTag() );
+ pFreeMgr.reset(pMgr);
}
}
SfxErrorHandler::~SfxErrorHandler()
{
- delete pFreeMgr;
}
diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index 564b5a096479..451a469eea90 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -228,10 +228,10 @@ struct EmbeddedObjectRef_Impl
uno::Reference <embed::XEmbeddedObject> mxObj;
EmbedEventListener_Impl* xListener;
- OUString aPersistName;
- OUString aMediaType;
+ OUString aPersistName;
+ OUString aMediaType;
comphelper::EmbeddedObjectContainer* pContainer;
- Graphic* pGraphic;
+ std::unique_ptr<Graphic> pGraphic;
sal_Int64 nViewAspect;
bool bIsLocked:1;
bool bNeedUpdate:1;
@@ -265,12 +265,11 @@ struct EmbeddedObjectRef_Impl
aDefaultSizeForChart_In_100TH_MM(r.aDefaultSizeForChart_In_100TH_MM)
{
if (r.pGraphic && !r.bNeedUpdate)
- pGraphic = new Graphic(*r.pGraphic);
+ pGraphic.reset( new Graphic(*r.pGraphic) );
}
~EmbeddedObjectRef_Impl()
{
- delete pGraphic;
}
};
@@ -417,14 +416,14 @@ void EmbeddedObjectRef::GetReplacement( bool bUpdate )
{
if ( bUpdate )
{
- DELETEZ( mpImpl->pGraphic );
+ mpImpl->pGraphic.reset();
(mpImpl->aMediaType).clear();
- mpImpl->pGraphic = new Graphic;
+ mpImpl->pGraphic.reset( new Graphic );
mpImpl->mnGraphicVersion++;
}
else if ( !mpImpl->pGraphic )
{
- mpImpl->pGraphic = new Graphic;
+ mpImpl->pGraphic.reset( new Graphic );
mpImpl->mnGraphicVersion++;
}
else
@@ -458,7 +457,7 @@ const Graphic* EmbeddedObjectRef::GetGraphic() const
SAL_WARN("svtools.misc", "Something went wrong on getting the graphic: " << ex.Message);
}
- return mpImpl->pGraphic;
+ return mpImpl->pGraphic.get();
}
Size EmbeddedObjectRef::GetSize( MapMode* pTargetMapMode ) const
@@ -523,9 +522,7 @@ Size EmbeddedObjectRef::GetSize( MapMode* pTargetMapMode ) const
void EmbeddedObjectRef::SetGraphicStream( const uno::Reference< io::XInputStream >& xInGrStream,
const OUString& rMediaType )
{
- if ( mpImpl->pGraphic )
- delete mpImpl->pGraphic;
- mpImpl->pGraphic = new Graphic();
+ mpImpl->pGraphic.reset( new Graphic );
mpImpl->aMediaType = rMediaType;
mpImpl->mnGraphicVersion++;
@@ -552,9 +549,7 @@ void EmbeddedObjectRef::SetGraphicStream( const uno::Reference< io::XInputStream
void EmbeddedObjectRef::SetGraphic( const Graphic& rGraphic, const OUString& rMediaType )
{
- if ( mpImpl->pGraphic )
- delete mpImpl->pGraphic;
- mpImpl->pGraphic = new Graphic( rGraphic );
+ mpImpl->pGraphic.reset( new Graphic( rGraphic ) );
mpImpl->aMediaType = rMediaType;
mpImpl->mnGraphicVersion++;
@@ -837,7 +832,7 @@ void EmbeddedObjectRef::UpdateReplacement()
void EmbeddedObjectRef::UpdateReplacementOnDemand()
{
- DELETEZ( mpImpl->pGraphic );
+ mpImpl->pGraphic.reset();
mpImpl->bNeedUpdate = true;
mpImpl->mnGraphicVersion++;
diff --git a/svtools/source/misc/transfer2.cxx b/svtools/source/misc/transfer2.cxx
index e8fcdc13e1b2..81f68dc7eb0f 100644
--- a/svtools/source/misc/transfer2.cxx
+++ b/svtools/source/misc/transfer2.cxx
@@ -110,7 +110,6 @@ DropTargetHelper::DropTargetListener::DropTargetListener( DropTargetHelper& rDro
DropTargetHelper::DropTargetListener::~DropTargetListener()
{
- delete mpLastDragOverEvent;
}
@@ -156,11 +155,7 @@ void SAL_CALL DropTargetHelper::DropTargetListener::drop( const DropTargetDropEv
rDTDE.Context->dropComplete( DNDConstants::ACTION_NONE != nRet );
- if( mpLastDragOverEvent )
- {
- delete mpLastDragOverEvent;
- mpLastDragOverEvent = nullptr;
- }
+ mpLastDragOverEvent.reset();
}
catch( const css::uno::Exception& )
{
@@ -190,9 +185,7 @@ void SAL_CALL DropTargetHelper::DropTargetListener::dragOver( const DropTargetDr
try
{
- delete mpLastDragOverEvent;
-
- mpLastDragOverEvent = new AcceptDropEvent( rDTDE.DropAction & ~DNDConstants::ACTION_DEFAULT, Point( rDTDE.LocationX, rDTDE.LocationY ), rDTDE );
+ mpLastDragOverEvent.reset( new AcceptDropEvent( rDTDE.DropAction & ~DNDConstants::ACTION_DEFAULT, Point( rDTDE.LocationX, rDTDE.LocationY ), rDTDE ) );
mpLastDragOverEvent->mbDefault = ( ( rDTDE.DropAction & DNDConstants::ACTION_DEFAULT ) != 0 );
const sal_Int8 nRet = mrParent.AcceptDrop( *mpLastDragOverEvent );
@@ -218,8 +211,7 @@ void SAL_CALL DropTargetHelper::DropTargetListener::dragExit( const DropTargetEv
{
mpLastDragOverEvent->mbLeaving = true;
mrParent.AcceptDrop( *mpLastDragOverEvent );
- delete mpLastDragOverEvent;
- mpLastDragOverEvent = nullptr;
+ mpLastDragOverEvent.reset();
}
mrParent.ImplEndDrag();