Kaydet (Commit) 352e036a authored tarafından Noel Grandin's avatar Noel Grandin

new loplugin: useuniqueptr: svl..svtools

Change-Id: Ia4d5b37ee3cf67318e3cc01525e4b733af60d038
Reviewed-on: https://gerrit.libreoffice.org/33251Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst d0cbdac2
...@@ -516,7 +516,8 @@ public: ...@@ -516,7 +516,8 @@ public:
class SVL_DLLPUBLIC SfxMultiRecordReader: public SfxSingleRecordReader class SVL_DLLPUBLIC SfxMultiRecordReader: public SfxSingleRecordReader
{ {
sal_uInt32 _nStartPos; // start position of this record sal_uInt32 _nStartPos; // start position of this record
sal_uInt32* _pContentOfs; // offsets of the start positions std::unique_ptr<sal_uInt32[]>
_pContentOfs; // offsets of the start positions
sal_uInt32 _nContentSize; // size of each record or table position sal_uInt32 _nContentSize; // size of each record or table position
sal_uInt16 _nContentCount; // number of content items sal_uInt16 _nContentCount; // number of content items
sal_uInt16 _nContentNo; /* the index of the current content sal_uInt16 _nContentNo; /* the index of the current content
......
...@@ -20,15 +20,15 @@ ...@@ -20,15 +20,15 @@
#define INCLUDED_SVL_ISETHINT_HXX #define INCLUDED_SVL_ISETHINT_HXX
#include <svl/svldllapi.h> #include <svl/svldllapi.h>
#include <svl/hint.hxx> #include <svl/hint.hxx>
#include <memory>
class SfxItemSet; class SfxItemSet;
class SVL_DLLPUBLIC SfxItemSetHint: public SfxHint class SVL_DLLPUBLIC SfxItemSetHint: public SfxHint
{ {
SfxItemSet* _pItemSet; std::unique_ptr<SfxItemSet> _pItemSet;
public: public:
SfxItemSetHint( const SfxItemSet &rItemSet ); SfxItemSetHint( const SfxItemSet &rItemSet );
......
...@@ -138,7 +138,8 @@ class OnDemandCalendarWrapper ...@@ -138,7 +138,8 @@ class OnDemandCalendarWrapper
{ {
css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::uno::XComponentContext > m_xContext;
css::lang::Locale aLocale; css::lang::Locale aLocale;
mutable CalendarWrapper* pPtr; mutable std::unique_ptr<CalendarWrapper>
pPtr;
mutable bool bValid; mutable bool bValid;
bool bInitialized; bool bInitialized;
...@@ -150,7 +151,6 @@ public: ...@@ -150,7 +151,6 @@ public:
{} {}
~OnDemandCalendarWrapper() ~OnDemandCalendarWrapper()
{ {
delete pPtr;
} }
void init( void init(
...@@ -160,11 +160,7 @@ public: ...@@ -160,11 +160,7 @@ public:
{ {
m_xContext = rxContext; m_xContext = rxContext;
changeLocale( rLocale ); changeLocale( rLocale );
if ( pPtr ) pPtr.reset();
{
delete pPtr;
pPtr = nullptr;
}
bInitialized = true; bInitialized = true;
} }
...@@ -179,11 +175,11 @@ public: ...@@ -179,11 +175,11 @@ public:
if ( !bValid ) if ( !bValid )
{ {
if ( !pPtr ) if ( !pPtr )
pPtr = new CalendarWrapper( m_xContext ); pPtr.reset(new CalendarWrapper( m_xContext ));
pPtr->loadDefaultCalendar( aLocale ); pPtr->loadDefaultCalendar( aLocale );
bValid = true; bValid = true;
} }
return pPtr; return pPtr.get();
} }
}; };
...@@ -198,7 +194,8 @@ class OnDemandTransliterationWrapper ...@@ -198,7 +194,8 @@ class OnDemandTransliterationWrapper
css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::uno::XComponentContext > m_xContext;
LanguageType eLanguage; LanguageType eLanguage;
css::i18n::TransliterationModules nType; css::i18n::TransliterationModules nType;
mutable ::utl::TransliterationWrapper* pPtr; mutable std::unique_ptr<::utl::TransliterationWrapper>
pPtr;
mutable bool bValid; mutable bool bValid;
bool bInitialized; bool bInitialized;
...@@ -212,7 +209,6 @@ public: ...@@ -212,7 +209,6 @@ public:
{} {}
~OnDemandTransliterationWrapper() ~OnDemandTransliterationWrapper()
{ {
delete pPtr;
} }
bool isInitialized() const { return bInitialized; } bool isInitialized() const { return bInitialized; }
...@@ -225,11 +221,7 @@ public: ...@@ -225,11 +221,7 @@ public:
m_xContext = rxContext; m_xContext = rxContext;
nType = css::i18n::TransliterationModules_IGNORE_CASE; nType = css::i18n::TransliterationModules_IGNORE_CASE;
changeLocale( eLang ); changeLocale( eLang );
if ( pPtr ) pPtr.reset();
{
delete pPtr;
pPtr = nullptr;
}
bInitialized = true; bInitialized = true;
} }
...@@ -244,11 +236,11 @@ public: ...@@ -244,11 +236,11 @@ public:
if ( !bValid ) if ( !bValid )
{ {
if ( !pPtr ) if ( !pPtr )
pPtr = new ::utl::TransliterationWrapper( m_xContext, nType ); pPtr.reset( new ::utl::TransliterationWrapper( m_xContext, nType ) );
pPtr->loadModuleIfNeeded( eLanguage ); pPtr->loadModuleIfNeeded( eLanguage );
bValid = true; bValid = true;
} }
return pPtr; return pPtr.get();
} }
const ::utl::TransliterationWrapper* operator->() const { return get(); } const ::utl::TransliterationWrapper* operator->() const { return get(); }
...@@ -264,7 +256,8 @@ public: ...@@ -264,7 +256,8 @@ public:
class OnDemandNativeNumberWrapper class OnDemandNativeNumberWrapper
{ {
css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::uno::XComponentContext > m_xContext;
mutable NativeNumberWrapper* pPtr; mutable std::unique_ptr<NativeNumberWrapper>
pPtr;
bool bInitialized; bool bInitialized;
public: public:
...@@ -274,7 +267,6 @@ public: ...@@ -274,7 +267,6 @@ public:
{} {}
~OnDemandNativeNumberWrapper() ~OnDemandNativeNumberWrapper()
{ {
delete pPtr;
} }
void init( void init(
...@@ -282,19 +274,15 @@ public: ...@@ -282,19 +274,15 @@ public:
) )
{ {
m_xContext = rxContext; m_xContext = rxContext;
if ( pPtr ) pPtr.reset();
{
delete pPtr;
pPtr = nullptr;
}
bInitialized = true; bInitialized = true;
} }
NativeNumberWrapper* get() const NativeNumberWrapper* get() const
{ {
if ( !pPtr ) if ( !pPtr )
pPtr = new NativeNumberWrapper( m_xContext ); pPtr.reset(new NativeNumberWrapper( m_xContext ));
return pPtr; return pPtr.get();
} }
}; };
......
...@@ -62,7 +62,8 @@ private: ...@@ -62,7 +62,8 @@ private:
sal_uLong lEnd; sal_uLong lEnd;
sal_uInt16 nId; sal_uInt16 nId;
ResMgr *pMgr; ResMgr *pMgr;
ResMgr *pFreeMgr; std::unique_ptr<ResMgr>
pFreeMgr;
SVT_DLLPRIVATE static void GetClassString(sal_uLong lErrId, OUString &); SVT_DLLPRIVATE static void GetClassString(sal_uLong lErrId, OUString &);
virtual bool CreateString( const ErrorInfo *, OUString &, sal_uInt16 &) const override; virtual bool CreateString( const ErrorInfo *, OUString &, sal_uInt16 &) const override;
......
...@@ -419,10 +419,8 @@ private: ...@@ -419,10 +419,8 @@ private:
{ {
private: private:
DropTargetHelper& mrParent; DropTargetHelper& mrParent;
AcceptDropEvent* mpLastDragOverEvent; std::unique_ptr<AcceptDropEvent> mpLastDragOverEvent;
private:
// XEventListener // XEventListener
virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) throw(css::uno::RuntimeException, std::exception) override; virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) throw(css::uno::RuntimeException, std::exception) override;
......
...@@ -497,9 +497,9 @@ bool SfxMultiRecordReader::ReadHeader_Impl() ...@@ -497,9 +497,9 @@ bool SfxMultiRecordReader::ReadHeader_Impl()
_nContentCount << " claimed, truncating"); _nContentCount << " claimed, truncating");
_nContentCount = nMaxRecords; _nContentCount = nMaxRecords;
} }
_pContentOfs = new sal_uInt32[_nContentCount]{}; _pContentOfs.reset( new sal_uInt32[_nContentCount]{} );
#if defined(OSL_LITENDIAN) #if defined(OSL_LITENDIAN)
_pStream->ReadBytes( _pContentOfs, sizeof(sal_uInt32)*_nContentCount ); _pStream->ReadBytes( _pContentOfs.get(), sizeof(sal_uInt32)*_nContentCount );
#else #else
// (loop without braces) // (loop without braces)
for ( sal_uInt16 n = 0; n < _nContentCount; ++n ) for ( sal_uInt16 n = 0; n < _nContentCount; ++n )
...@@ -541,7 +541,6 @@ SfxMultiRecordReader::SfxMultiRecordReader( SvStream *pStream, sal_uInt16 nTag ) ...@@ -541,7 +541,6 @@ SfxMultiRecordReader::SfxMultiRecordReader( SvStream *pStream, sal_uInt16 nTag )
SfxMultiRecordReader::~SfxMultiRecordReader() SfxMultiRecordReader::~SfxMultiRecordReader()
{ {
delete[] _pContentOfs;
} }
/** /**
......
...@@ -347,7 +347,7 @@ class StylePoolImpl ...@@ -347,7 +347,7 @@ class StylePoolImpl
private: private:
std::map< const SfxItemSet*, Node > maRoot; std::map< const SfxItemSet*, Node > maRoot;
// #i86923# // #i86923#
SfxItemSet* mpIgnorableItems; std::unique_ptr<SfxItemSet> mpIgnorableItems;
public: public:
// #i86923# // #i86923#
explicit StylePoolImpl( SfxItemSet* pIgnorableItems ) explicit StylePoolImpl( SfxItemSet* pIgnorableItems )
...@@ -364,7 +364,6 @@ public: ...@@ -364,7 +364,6 @@ public:
~StylePoolImpl() ~StylePoolImpl()
{ {
delete mpIgnorableItems;
} }
std::shared_ptr<SfxItemSet> insertItemSet( const SfxItemSet& rSet ); std::shared_ptr<SfxItemSet> insertItemSet( const SfxItemSet& rSet );
......
...@@ -32,7 +32,6 @@ SfxItemSetHint::SfxItemSetHint( const SfxItemSet &rItemSet ) ...@@ -32,7 +32,6 @@ SfxItemSetHint::SfxItemSetHint( const SfxItemSet &rItemSet )
SfxItemSetHint::~SfxItemSetHint() SfxItemSetHint::~SfxItemSetHint()
{ {
delete _pItemSet;
} }
......
...@@ -223,7 +223,8 @@ typedef ::std::vector< SfxUndoListener* > UndoListeners; ...@@ -223,7 +223,8 @@ typedef ::std::vector< SfxUndoListener* > UndoListeners;
struct SfxUndoManager_Data struct SfxUndoManager_Data
{ {
::osl::Mutex aMutex; ::osl::Mutex aMutex;
SfxUndoArray* pUndoArray; std::unique_ptr<SfxUndoArray>
pUndoArray;
SfxUndoArray* pActUndoArray; SfxUndoArray* pActUndoArray;
SfxUndoArray* pFatherUndoArray; SfxUndoArray* pFatherUndoArray;
...@@ -245,12 +246,11 @@ struct SfxUndoManager_Data ...@@ -245,12 +246,11 @@ struct SfxUndoManager_Data
,mbDoing( false ) ,mbDoing( false )
,mbClearUntilTopLevel( false ) ,mbClearUntilTopLevel( false )
{ {
pActUndoArray = pUndoArray; pActUndoArray = pUndoArray.get();
} }
~SfxUndoManager_Data() ~SfxUndoManager_Data()
{ {
delete pUndoArray;
} }
// Copy assignment is forbidden and not implemented. // Copy assignment is forbidden and not implemented.
...@@ -600,7 +600,7 @@ void SfxUndoManager::ImplClearUndo( UndoManagerGuard& i_guard ) ...@@ -600,7 +600,7 @@ void SfxUndoManager::ImplClearUndo( UndoManagerGuard& i_guard )
void SfxUndoManager::ImplClearRedo( UndoManagerGuard& i_guard, bool const i_currentLevel ) void SfxUndoManager::ImplClearRedo( UndoManagerGuard& i_guard, bool const i_currentLevel )
{ {
SfxUndoArray* pUndoArray = ( i_currentLevel == IUndoManager::CurrentLevel ) ? m_xData->pActUndoArray : m_xData->pUndoArray; SfxUndoArray* pUndoArray = ( i_currentLevel == IUndoManager::CurrentLevel ) ? m_xData->pActUndoArray : m_xData->pUndoArray.get();
// clearance // clearance
while ( pUndoArray->aUndoActions.size() > pUndoArray->nCurUndoAction ) while ( pUndoArray->aUndoActions.size() > pUndoArray->nCurUndoAction )
...@@ -643,7 +643,7 @@ bool SfxUndoManager::ImplAddUndoAction_NoNotify( SfxUndoAction *pAction, bool bT ...@@ -643,7 +643,7 @@ bool SfxUndoManager::ImplAddUndoAction_NoNotify( SfxUndoAction *pAction, bool bT
ImplClearRedo( i_guard, IUndoManager::CurrentLevel ); ImplClearRedo( i_guard, IUndoManager::CurrentLevel );
// respect max number // respect max number
if( m_xData->pActUndoArray == m_xData->pUndoArray ) if( m_xData->pActUndoArray == m_xData->pUndoArray.get() )
{ {
while(m_xData->pActUndoArray->aUndoActions.size() >= m_xData->pActUndoArray->nMaxUndoActions) while(m_xData->pActUndoArray->aUndoActions.size() >= m_xData->pActUndoArray->nMaxUndoActions)
{ {
...@@ -684,7 +684,7 @@ void SfxUndoManager::AddUndoAction( SfxUndoAction *pAction, bool bTryMerge ) ...@@ -684,7 +684,7 @@ void SfxUndoManager::AddUndoAction( SfxUndoAction *pAction, bool bTryMerge )
size_t SfxUndoManager::GetUndoActionCount( bool const i_currentLevel ) const size_t SfxUndoManager::GetUndoActionCount( bool const i_currentLevel ) const
{ {
UndoManagerGuard aGuard( *m_xData ); UndoManagerGuard aGuard( *m_xData );
const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : m_xData->pUndoArray; const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : m_xData->pUndoArray.get();
return pUndoArray->nCurUndoAction; return pUndoArray->nCurUndoAction;
} }
...@@ -694,7 +694,7 @@ OUString SfxUndoManager::GetUndoActionComment( size_t nNo, bool const i_currentL ...@@ -694,7 +694,7 @@ OUString SfxUndoManager::GetUndoActionComment( size_t nNo, bool const i_currentL
UndoManagerGuard aGuard( *m_xData ); UndoManagerGuard aGuard( *m_xData );
OUString sComment; OUString sComment;
const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : m_xData->pUndoArray; const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : m_xData->pUndoArray.get();
assert(nNo < pUndoArray->nCurUndoAction); assert(nNo < pUndoArray->nCurUndoAction);
if( nNo < pUndoArray->nCurUndoAction ) if( nNo < pUndoArray->nCurUndoAction )
sComment = pUndoArray->aUndoActions[ pUndoArray->nCurUndoAction - 1 - nNo ].pAction->GetComment(); sComment = pUndoArray->aUndoActions[ pUndoArray->nCurUndoAction - 1 - nNo ].pAction->GetComment();
...@@ -833,7 +833,7 @@ size_t SfxUndoManager::GetRedoActionCount( bool const i_currentLevel ) const ...@@ -833,7 +833,7 @@ size_t SfxUndoManager::GetRedoActionCount( bool const i_currentLevel ) const
size_t SfxUndoManager::ImplGetRedoActionCount_Lock( bool const i_currentLevel ) const size_t SfxUndoManager::ImplGetRedoActionCount_Lock( bool const i_currentLevel ) const
{ {
const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : m_xData->pUndoArray; const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : m_xData->pUndoArray.get();
return pUndoArray->aUndoActions.size() - pUndoArray->nCurUndoAction; return pUndoArray->aUndoActions.size() - pUndoArray->nCurUndoAction;
} }
...@@ -855,7 +855,7 @@ OUString SfxUndoManager::GetRedoActionComment( size_t nNo, bool const i_currentL ...@@ -855,7 +855,7 @@ OUString SfxUndoManager::GetRedoActionComment( size_t nNo, bool const i_currentL
{ {
OUString sComment; OUString sComment;
UndoManagerGuard aGuard( *m_xData ); UndoManagerGuard aGuard( *m_xData );
const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : m_xData->pUndoArray; const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : m_xData->pUndoArray.get();
if ( (pUndoArray->nCurUndoAction + nNo) < pUndoArray->aUndoActions.size() ) if ( (pUndoArray->nCurUndoAction + nNo) < pUndoArray->aUndoActions.size() )
{ {
sComment = pUndoArray->aUndoActions[ pUndoArray->nCurUndoAction + nNo ].pAction->GetComment(); sComment = pUndoArray->aUndoActions[ pUndoArray->nCurUndoAction + nNo ].pAction->GetComment();
...@@ -1038,7 +1038,7 @@ bool SfxUndoManager::IsInListAction() const ...@@ -1038,7 +1038,7 @@ bool SfxUndoManager::IsInListAction() const
bool SfxUndoManager::ImplIsInListAction_Lock() const bool SfxUndoManager::ImplIsInListAction_Lock() const
{ {
return ( m_xData->pActUndoArray != m_xData->pUndoArray ); return ( m_xData->pActUndoArray != m_xData->pUndoArray.get() );
} }
...@@ -1048,7 +1048,7 @@ size_t SfxUndoManager::GetListActionDepth() const ...@@ -1048,7 +1048,7 @@ size_t SfxUndoManager::GetListActionDepth() const
size_t nDepth(0); size_t nDepth(0);
SfxUndoArray* pLookup( m_xData->pActUndoArray ); SfxUndoArray* pLookup( m_xData->pActUndoArray );
while ( pLookup != m_xData->pUndoArray ) while ( pLookup != m_xData->pUndoArray.get() )
{ {
pLookup = pLookup->pFatherUndoArray; pLookup = pLookup->pFatherUndoArray;
++nDepth; ++nDepth;
......
...@@ -286,7 +286,7 @@ const OUString* NameTranslationList::Translate( const OUString& rName ) const ...@@ -286,7 +286,7 @@ const OUString* NameTranslationList::Translate( const OUString& rName ) const
class NameTranslator_Impl : public ::svt::IContentTitleTranslation class NameTranslator_Impl : public ::svt::IContentTitleTranslation
{ {
private: private:
NameTranslationList* mpActFolder; std::unique_ptr<NameTranslationList> mpActFolder;
public: public:
explicit NameTranslator_Impl( const INetURLObject& rActualFolder ); explicit NameTranslator_Impl( const INetURLObject& rActualFolder );
virtual ~NameTranslator_Impl(); virtual ~NameTranslator_Impl();
...@@ -1399,13 +1399,12 @@ void SvtFileView::StateChanged( StateChangedType nStateChange ) ...@@ -1399,13 +1399,12 @@ void SvtFileView::StateChanged( StateChangedType nStateChange )
NameTranslator_Impl::NameTranslator_Impl( const INetURLObject& rActualFolder ) NameTranslator_Impl::NameTranslator_Impl( const INetURLObject& rActualFolder )
: mpActFolder( new NameTranslationList( rActualFolder ) )
{ {
mpActFolder = new NameTranslationList( rActualFolder );
} }
NameTranslator_Impl::~NameTranslator_Impl() NameTranslator_Impl::~NameTranslator_Impl()
{ {
delete mpActFolder;
} }
void NameTranslator_Impl::SetActualFolder( const INetURLObject& rActualFolder ) void NameTranslator_Impl::SetActualFolder( const INetURLObject& rActualFolder )
...@@ -1414,12 +1413,11 @@ 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)) if (mpActFolder->GetHashedURL() != rActualFolder.GetMainURL(INetURLObject::DecodeMechanism::NONE))
{ {
delete mpActFolder; mpActFolder.reset( new NameTranslationList( rActualFolder ) );
mpActFolder = new NameTranslationList( rActualFolder );
} }
} }
else else
mpActFolder = new NameTranslationList( rActualFolder ); mpActFolder.reset( new NameTranslationList( rActualFolder ) );
} }
bool NameTranslator_Impl::GetTranslation( const OUString& rOrg, OUString& rTrans ) const bool NameTranslator_Impl::GetTranslation( const OUString& rOrg, OUString& rTrans ) const
......
...@@ -445,7 +445,7 @@ void AssignmentPersistentData::ImplCommit() ...@@ -445,7 +445,7 @@ void AssignmentPersistentData::ImplCommit()
/// the logical field names /// the logical field names
std::vector<OUString> aLogicalFieldNames; std::vector<OUString> aLogicalFieldNames;
IAssigmentData* pConfigData; std::unique_ptr<IAssigmentData> pConfigData;
AddressBookSourceDialogData( ) AddressBookSourceDialogData( )
...@@ -474,7 +474,6 @@ void AssignmentPersistentData::ImplCommit() ...@@ -474,7 +474,6 @@ void AssignmentPersistentData::ImplCommit()
~AddressBookSourceDialogData() ~AddressBookSourceDialogData()
{ {
delete pConfigData;
} }
// Copy assignment is forbidden and not implemented. // Copy assignment is forbidden and not implemented.
...@@ -1183,8 +1182,7 @@ void AssignmentPersistentData::ImplCommit() ...@@ -1183,8 +1182,7 @@ void AssignmentPersistentData::ImplCommit()
sName = aFileNotation.get(OFileNotation::N_SYSTEM); sName = aFileNotation.get(OFileNotation::N_SYSTEM);
} }
m_pDatasource->InsertEntry(sName); m_pDatasource->InsertEntry(sName);
delete m_pImpl->pConfigData; m_pImpl->pConfigData.reset( new AssignmentPersistentData );
m_pImpl->pConfigData = new AssignmentPersistentData();
loadConfiguration(); loadConfiguration();
resetTables(); resetTables();
// will reset the fields implicitly // will reset the fields implicitly
......
...@@ -150,14 +150,14 @@ SfxErrorHandler::SfxErrorHandler(sal_uInt16 nIdP, sal_uLong lStartP, sal_uLong l ...@@ -150,14 +150,14 @@ SfxErrorHandler::SfxErrorHandler(sal_uInt16 nIdP, sal_uLong lStartP, sal_uLong l
RegisterDisplay(&aWndFunc); RegisterDisplay(&aWndFunc);
if( ! pMgr ) if( ! pMgr )
{ {
pFreeMgr = pMgr = ResMgr::CreateResMgr("ofa", Application::GetSettings().GetUILanguageTag() ); pMgr = ResMgr::CreateResMgr("ofa", Application::GetSettings().GetUILanguageTag() );
pFreeMgr.reset(pMgr);
} }
} }
SfxErrorHandler::~SfxErrorHandler() SfxErrorHandler::~SfxErrorHandler()
{ {
delete pFreeMgr;
} }
......
...@@ -228,10 +228,10 @@ struct EmbeddedObjectRef_Impl ...@@ -228,10 +228,10 @@ struct EmbeddedObjectRef_Impl
uno::Reference <embed::XEmbeddedObject> mxObj; uno::Reference <embed::XEmbeddedObject> mxObj;
EmbedEventListener_Impl* xListener; EmbedEventListener_Impl* xListener;
OUString aPersistName; OUString aPersistName;
OUString aMediaType; OUString aMediaType;
comphelper::EmbeddedObjectContainer* pContainer; comphelper::EmbeddedObjectContainer* pContainer;
Graphic* pGraphic; std::unique_ptr<Graphic> pGraphic;
sal_Int64 nViewAspect; sal_Int64 nViewAspect;
bool bIsLocked:1; bool bIsLocked:1;
bool bNeedUpdate:1; bool bNeedUpdate:1;
...@@ -265,12 +265,11 @@ struct EmbeddedObjectRef_Impl ...@@ -265,12 +265,11 @@ struct EmbeddedObjectRef_Impl
aDefaultSizeForChart_In_100TH_MM(r.aDefaultSizeForChart_In_100TH_MM) aDefaultSizeForChart_In_100TH_MM(r.aDefaultSizeForChart_In_100TH_MM)
{ {
if (r.pGraphic && !r.bNeedUpdate) if (r.pGraphic && !r.bNeedUpdate)
pGraphic = new Graphic(*r.pGraphic); pGraphic.reset( new Graphic(*r.pGraphic) );
} }
~EmbeddedObjectRef_Impl() ~EmbeddedObjectRef_Impl()
{ {
delete pGraphic;
} }
}; };
...@@ -417,14 +416,14 @@ void EmbeddedObjectRef::GetReplacement( bool bUpdate ) ...@@ -417,14 +416,14 @@ void EmbeddedObjectRef::GetReplacement( bool bUpdate )
{ {
if ( bUpdate ) if ( bUpdate )
{ {
DELETEZ( mpImpl->pGraphic ); mpImpl->pGraphic.reset();
(mpImpl->aMediaType).clear(); (mpImpl->aMediaType).clear();
mpImpl->pGraphic = new Graphic; mpImpl->pGraphic.reset( new Graphic );
mpImpl->mnGraphicVersion++; mpImpl->mnGraphicVersion++;
} }
else if ( !mpImpl->pGraphic ) else if ( !mpImpl->pGraphic )
{ {
mpImpl->pGraphic = new Graphic; mpImpl->pGraphic.reset( new Graphic );
mpImpl->mnGraphicVersion++; mpImpl->mnGraphicVersion++;
} }
else else
...@@ -458,7 +457,7 @@ const Graphic* EmbeddedObjectRef::GetGraphic() const ...@@ -458,7 +457,7 @@ const Graphic* EmbeddedObjectRef::GetGraphic() const
SAL_WARN("svtools.misc", "Something went wrong on getting the graphic: " << ex.Message); 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 Size EmbeddedObjectRef::GetSize( MapMode* pTargetMapMode ) const
...@@ -523,9 +522,7 @@ 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, void EmbeddedObjectRef::SetGraphicStream( const uno::Reference< io::XInputStream >& xInGrStream,
const OUString& rMediaType ) const OUString& rMediaType )
{ {
if ( mpImpl->pGraphic ) mpImpl->pGraphic.reset( new Graphic );
delete mpImpl->pGraphic;
mpImpl->pGraphic = new Graphic();
mpImpl->aMediaType = rMediaType; mpImpl->aMediaType = rMediaType;
mpImpl->mnGraphicVersion++; mpImpl->mnGraphicVersion++;
...@@ -552,9 +549,7 @@ void EmbeddedObjectRef::SetGraphicStream( const uno::Reference< io::XInputStream ...@@ -552,9 +549,7 @@ void EmbeddedObjectRef::SetGraphicStream( const uno::Reference< io::XInputStream
void EmbeddedObjectRef::SetGraphic( const Graphic& rGraphic, const OUString& rMediaType ) void EmbeddedObjectRef::SetGraphic( const Graphic& rGraphic, const OUString& rMediaType )
{ {
if ( mpImpl->pGraphic ) mpImpl->pGraphic.reset( new Graphic( rGraphic ) );
delete mpImpl->pGraphic;
mpImpl->pGraphic = new Graphic( rGraphic );
mpImpl->aMediaType = rMediaType; mpImpl->aMediaType = rMediaType;
mpImpl->mnGraphicVersion++; mpImpl->mnGraphicVersion++;
...@@ -837,7 +832,7 @@ void EmbeddedObjectRef::UpdateReplacement() ...@@ -837,7 +832,7 @@ void EmbeddedObjectRef::UpdateReplacement()
void EmbeddedObjectRef::UpdateReplacementOnDemand() void EmbeddedObjectRef::UpdateReplacementOnDemand()
{ {
DELETEZ( mpImpl->pGraphic ); mpImpl->pGraphic.reset();
mpImpl->bNeedUpdate = true; mpImpl->bNeedUpdate = true;
mpImpl->mnGraphicVersion++; mpImpl->mnGraphicVersion++;
......
...@@ -110,7 +110,6 @@ DropTargetHelper::DropTargetListener::DropTargetListener( DropTargetHelper& rDro ...@@ -110,7 +110,6 @@ DropTargetHelper::DropTargetListener::DropTargetListener( DropTargetHelper& rDro
DropTargetHelper::DropTargetListener::~DropTargetListener() DropTargetHelper::DropTargetListener::~DropTargetListener()
{ {
delete mpLastDragOverEvent;
} }
...@@ -156,11 +155,7 @@ void SAL_CALL DropTargetHelper::DropTargetListener::drop( const DropTargetDropEv ...@@ -156,11 +155,7 @@ void SAL_CALL DropTargetHelper::DropTargetListener::drop( const DropTargetDropEv
rDTDE.Context->dropComplete( DNDConstants::ACTION_NONE != nRet ); rDTDE.Context->dropComplete( DNDConstants::ACTION_NONE != nRet );
if( mpLastDragOverEvent ) mpLastDragOverEvent.reset();
{
delete mpLastDragOverEvent;
mpLastDragOverEvent = nullptr;
}
} }
catch( const css::uno::Exception& ) catch( const css::uno::Exception& )
{ {
...@@ -190,9 +185,7 @@ void SAL_CALL DropTargetHelper::DropTargetListener::dragOver( const DropTargetDr ...@@ -190,9 +185,7 @@ void SAL_CALL DropTargetHelper::DropTargetListener::dragOver( const DropTargetDr
try try
{ {
delete mpLastDragOverEvent; mpLastDragOverEvent.reset( new AcceptDropEvent( rDTDE.DropAction & ~DNDConstants::ACTION_DEFAULT, Point( rDTDE.LocationX, rDTDE.LocationY ), rDTDE ) );
mpLastDragOverEvent = new AcceptDropEvent( rDTDE.DropAction & ~DNDConstants::ACTION_DEFAULT, Point( rDTDE.LocationX, rDTDE.LocationY ), rDTDE );
mpLastDragOverEvent->mbDefault = ( ( rDTDE.DropAction & DNDConstants::ACTION_DEFAULT ) != 0 ); mpLastDragOverEvent->mbDefault = ( ( rDTDE.DropAction & DNDConstants::ACTION_DEFAULT ) != 0 );
const sal_Int8 nRet = mrParent.AcceptDrop( *mpLastDragOverEvent ); const sal_Int8 nRet = mrParent.AcceptDrop( *mpLastDragOverEvent );
...@@ -218,8 +211,7 @@ void SAL_CALL DropTargetHelper::DropTargetListener::dragExit( const DropTargetEv ...@@ -218,8 +211,7 @@ void SAL_CALL DropTargetHelper::DropTargetListener::dragExit( const DropTargetEv
{ {
mpLastDragOverEvent->mbLeaving = true; mpLastDragOverEvent->mbLeaving = true;
mrParent.AcceptDrop( *mpLastDragOverEvent ); mrParent.AcceptDrop( *mpLastDragOverEvent );
delete mpLastDragOverEvent; mpLastDragOverEvent.reset();
mpLastDragOverEvent = nullptr;
} }
mrParent.ImplEndDrag(); mrParent.ImplEndDrag();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment