summaryrefslogtreecommitdiffstats
path: root/sc/source/ui
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-17 10:11:31 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-01-19 05:39:18 +0000
commit9767537e22e178eb23872de138ea70e57c1a6725 (patch)
tree5abf4eee091215affc75477b08def703188de513 /sc/source/ui
parenttdf#35021 TAB_OVER_MARGIN pdf support for left/center/dec (diff)
downloadcore-9767537e22e178eb23872de138ea70e57c1a6725.tar.gz
core-9767537e22e178eb23872de138ea70e57c1a6725.zip
new loplugin: useuniqueptr: sc part 2
Change-Id: I37936a297027313e2a8ae18f355567462955739e Reviewed-on: https://gerrit.libreoffice.org/33203 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/app/inputhdl.cxx7
-rw-r--r--sc/source/ui/app/uiitems.cxx16
-rw-r--r--sc/source/ui/docshell/dataprovider.cxx2
-rw-r--r--sc/source/ui/docshell/pagedata.cxx5
-rw-r--r--sc/source/ui/inc/dataprovider.hxx4
-rw-r--r--sc/source/ui/inc/inputhdl.hxx4
-rw-r--r--sc/source/ui/inc/pagedata.hxx2
-rw-r--r--sc/source/ui/inc/printfun.hxx11
-rw-r--r--sc/source/ui/inc/uiitems.hxx14
-rw-r--r--sc/source/ui/inc/undobase.hxx9
-rw-r--r--sc/source/ui/inc/undoblk.hxx39
-rw-r--r--sc/source/ui/inc/undodat.hxx6
-rw-r--r--sc/source/ui/inc/undodraw.hxx6
-rw-r--r--sc/source/ui/undo/undobase.cxx6
-rw-r--r--sc/source/ui/undo/undoblk.cxx14
-rw-r--r--sc/source/ui/undo/undoblk3.cxx8
-rw-r--r--sc/source/ui/undo/undodat.cxx4
-rw-r--r--sc/source/ui/undo/undodraw.cxx6
-rw-r--r--sc/source/ui/undo/undorangename.cxx1
-rw-r--r--sc/source/ui/unoobj/dapiuno.cxx8
-rw-r--r--sc/source/ui/unoobj/editsrc.cxx1
-rw-r--r--sc/source/ui/unoobj/fielduno.cxx24
-rw-r--r--sc/source/ui/unoobj/srchuno.cxx5
-rw-r--r--sc/source/ui/view/printfun.cxx21
24 files changed, 91 insertions, 132 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 2f1c901eaca2..b823998e5bdb 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -4014,7 +4014,6 @@ ScInputHdlState::ScInputHdlState( const ScInputHdlState& rCpy )
ScInputHdlState::~ScInputHdlState()
{
- delete pEditData;
}
bool ScInputHdlState::operator==( const ScInputHdlState& r ) const
@@ -4023,18 +4022,16 @@ bool ScInputHdlState::operator==( const ScInputHdlState& r ) const
&& (aEndPos == r.aEndPos)
&& (aCursorPos == r.aCursorPos)
&& (aString == r.aString)
- && ScGlobal::EETextObjEqual( pEditData, r.pEditData ) );
+ && ScGlobal::EETextObjEqual( pEditData.get(), r.pEditData.get() ) );
}
ScInputHdlState& ScInputHdlState::operator=( const ScInputHdlState& r )
{
- delete pEditData;
-
aCursorPos = r.aCursorPos;
aStartPos = r.aStartPos;
aEndPos = r.aEndPos;
aString = r.aString;
- pEditData = r.pEditData ? r.pEditData->Clone() : nullptr;
+ pEditData.reset( r.pEditData ? r.pEditData->Clone() : nullptr );
return *this;
}
diff --git a/sc/source/ui/app/uiitems.cxx b/sc/source/ui/app/uiitems.cxx
index 51661bd9e470..cf6a9677e974 100644
--- a/sc/source/ui/app/uiitems.cxx
+++ b/sc/source/ui/app/uiitems.cxx
@@ -55,7 +55,6 @@ ScInputStatusItem::ScInputStatusItem( const ScInputStatusItem& rItem ) :
ScInputStatusItem::~ScInputStatusItem()
{
- delete pEditData;
}
bool ScInputStatusItem::operator==( const SfxPoolItem& rItem ) const
@@ -319,14 +318,11 @@ ScUserListItem::ScUserListItem( const ScUserListItem& rItem )
: SfxPoolItem ( rItem )
{
if ( rItem.pUserList )
- pUserList = new ScUserList( *(rItem.pUserList) );
- else
- pUserList = nullptr;
+ pUserList.reset( new ScUserList( *(rItem.pUserList) ) );
}
ScUserListItem::~ScUserListItem()
{
- delete pUserList;
}
bool ScUserListItem::operator==( const SfxPoolItem& rItem ) const
@@ -351,8 +347,7 @@ SfxPoolItem* ScUserListItem::Clone( SfxItemPool * ) const
void ScUserListItem::SetUserList( const ScUserList& rUserList )
{
- delete pUserList;
- pUserList = new ScUserList( rUserList );
+ pUserList.reset( new ScUserList( rUserList ) );
}
/**
@@ -399,9 +394,9 @@ ScPivotItem::ScPivotItem( sal_uInt16 nWhichP, const ScDPSaveData* pData,
{
// pSaveData must always exist
if ( pData )
- pSaveData = new ScDPSaveData(*pData);
+ pSaveData.reset( new ScDPSaveData(*pData) );
else
- pSaveData = new ScDPSaveData;
+ pSaveData.reset( new ScDPSaveData );
if ( pRange ) aDestRange = *pRange;
bNewSheet = bNew;
}
@@ -412,12 +407,11 @@ ScPivotItem::ScPivotItem( const ScPivotItem& rItem ) :
bNewSheet ( rItem.bNewSheet )
{
assert(rItem.pSaveData && "pSaveData");
- pSaveData = new ScDPSaveData(*rItem.pSaveData);
+ pSaveData.reset( new ScDPSaveData(*rItem.pSaveData) );
}
ScPivotItem::~ScPivotItem()
{
- delete pSaveData;
}
bool ScPivotItem::operator==( const SfxPoolItem& rItem ) const
diff --git a/sc/source/ui/docshell/dataprovider.cxx b/sc/source/ui/docshell/dataprovider.cxx
index eb037edcd1b2..f309e791e088 100644
--- a/sc/source/ui/docshell/dataprovider.cxx
+++ b/sc/source/ui/docshell/dataprovider.cxx
@@ -71,7 +71,6 @@ ExternalDataMapper::ExternalDataMapper(ScDocShell* pDocShell, const OUString& rU
ExternalDataMapper::~ExternalDataMapper()
{
- delete mpDataProvider;
}
void ExternalDataMapper::StartImport()
@@ -146,7 +145,6 @@ CSVFetchThread::CSVFetchThread(SvStream *pData, size_t nColCount):
CSVFetchThread::~CSVFetchThread()
{
- delete mpStream;
}
bool CSVFetchThread::IsRequestedTerminate()
diff --git a/sc/source/ui/docshell/pagedata.cxx b/sc/source/ui/docshell/pagedata.cxx
index 7a73ae639ac7..143c1e50119f 100644
--- a/sc/source/ui/docshell/pagedata.cxx
+++ b/sc/source/ui/docshell/pagedata.cxx
@@ -68,15 +68,12 @@ ScPageBreakData::ScPageBreakData(size_t nMax)
{
nUsed = 0;
if (nMax)
- pData = new ScPrintRangeData[nMax];
- else
- pData = nullptr;
+ pData.reset( new ScPrintRangeData[nMax] );
nAlloc = nMax;
}
ScPageBreakData::~ScPageBreakData()
{
- delete[] pData;
}
ScPrintRangeData& ScPageBreakData::GetData(size_t nPos)
diff --git a/sc/source/ui/inc/dataprovider.hxx b/sc/source/ui/inc/dataprovider.hxx
index b915c45af35e..c18b04eba037 100644
--- a/sc/source/ui/inc/dataprovider.hxx
+++ b/sc/source/ui/inc/dataprovider.hxx
@@ -44,7 +44,7 @@ class SC_DLLPUBLIC ExternalDataMapper
{
ScRange maRange;
ScDocShell* mpDocShell;
- DataProvider* mpDataProvider;
+ std::unique_ptr<DataProvider> mpDataProvider;
ScDBCollection* mpDBCollection;
OUString maURL;
@@ -88,7 +88,7 @@ typedef std::vector<Line> LinesType;
class CSVFetchThread : public salhelper::Thread
{
- SvStream *mpStream;
+ std::unique_ptr<SvStream> mpStream;
size_t mnColCount;
bool mbTerminate;
diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx
index 68dc71930cac..dd36ff84219b 100644
--- a/sc/source/ui/inc/inputhdl.hxx
+++ b/sc/source/ui/inc/inputhdl.hxx
@@ -289,14 +289,14 @@ public:
const ScAddress& GetStartPos() const { return aStartPos; }
const ScAddress& GetEndPos() const { return aEndPos; }
const OUString& GetString() const { return aString; }
- const EditTextObject* GetEditData() const { return pEditData; }
+ const EditTextObject* GetEditData() const { return pEditData.get(); }
private:
ScAddress aCursorPos;
ScAddress aStartPos;
ScAddress aEndPos;
OUString aString;
- EditTextObject* pEditData;
+ std::unique_ptr<EditTextObject> pEditData;
};
#endif
diff --git a/sc/source/ui/inc/pagedata.hxx b/sc/source/ui/inc/pagedata.hxx
index 74fa3d746626..a2325fe2bbcf 100644
--- a/sc/source/ui/inc/pagedata.hxx
+++ b/sc/source/ui/inc/pagedata.hxx
@@ -63,7 +63,7 @@ class ScPageBreakData
private:
size_t nAlloc;
size_t nUsed;
- ScPrintRangeData* pData; // Array
+ std::unique_ptr<ScPrintRangeData[]> pData;
public:
ScPageBreakData(size_t nMax);
diff --git a/sc/source/ui/inc/printfun.hxx b/sc/source/ui/inc/printfun.hxx
index 3271aa9f9d3d..b162cb559380 100644
--- a/sc/source/ui/inc/printfun.hxx
+++ b/sc/source/ui/inc/printfun.hxx
@@ -99,15 +99,14 @@ struct ScPrintState // Save Variables from ScPrintFunc
class ScPageRowEntry
{
private:
- SCROW nStartRow;
- SCROW nEndRow;
- size_t nPagesX;
- bool* pHidden;
+ SCROW nStartRow;
+ SCROW nEndRow;
+ size_t nPagesX;
+ std::unique_ptr<bool[]> pHidden;
//! Cache Number of really visible?
public:
- ScPageRowEntry() { nStartRow = nEndRow = 0; nPagesX = 0; pHidden = nullptr; }
- ~ScPageRowEntry() { delete[] pHidden; }
+ ScPageRowEntry() { nStartRow = nEndRow = 0; nPagesX = 0; }
ScPageRowEntry(const ScPageRowEntry& r);
ScPageRowEntry& operator=(const ScPageRowEntry& r);
diff --git a/sc/source/ui/inc/uiitems.hxx b/sc/source/ui/inc/uiitems.hxx
index 0bde21bdcdff..7e235acd49f9 100644
--- a/sc/source/ui/inc/uiitems.hxx
+++ b/sc/source/ui/inc/uiitems.hxx
@@ -48,7 +48,7 @@ class ScInputStatusItem : public SfxPoolItem
ScAddress aStartPos;
ScAddress aEndPos;
OUString aString;
- EditTextObject* pEditData;
+ std::unique_ptr<EditTextObject> pEditData;
const std::vector<editeng::MisspellRanges>* mpMisspellRanges;
public:
@@ -68,7 +68,7 @@ public:
const ScAddress& GetPos() const { return aCursorPos; }
const OUString& GetString() const { return aString; }
- const EditTextObject* GetEditData() const { return pEditData; }
+ const EditTextObject* GetEditData() const { return pEditData.get(); }
void SetMisspellRanges( const std::vector<editeng::MisspellRanges>* pRanges );
const std::vector<editeng::MisspellRanges>* GetMisspellRanges() const { return mpMisspellRanges;}
@@ -210,10 +210,10 @@ public:
virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override;
void SetUserList ( const ScUserList& rUserList );
- ScUserList* GetUserList () const { return pUserList; }
+ ScUserList* GetUserList () const { return pUserList.get(); }
private:
- ScUserList* pUserList;
+ std::unique_ptr<ScUserList> pUserList;
};
class ScConsolidateItem : public SfxPoolItem
@@ -249,9 +249,9 @@ public:
bool IsNewSheet() const { return bNewSheet; }
private:
- ScDPSaveData* pSaveData;
- ScRange aDestRange;
- bool bNewSheet;
+ std::unique_ptr<ScDPSaveData> pSaveData;
+ ScRange aDestRange;
+ bool bNewSheet;
};
class ScSolveItem : public SfxPoolItem
diff --git a/sc/source/ui/inc/undobase.hxx b/sc/source/ui/inc/undobase.hxx
index 00d1532ab4b2..571690f9ad4b 100644
--- a/sc/source/ui/inc/undobase.hxx
+++ b/sc/source/ui/inc/undobase.hxx
@@ -51,7 +51,8 @@ public:
protected:
ScDocShell* pDocShell;
- SfxUndoAction* pDetectiveUndo;
+ std::unique_ptr<SfxUndoAction>
+ pDetectiveUndo;
sal_Int32 mnViewShellId;
bool IsPaintLocked() const { return pDocShell->IsPaintLocked(); }
@@ -165,14 +166,14 @@ private:
class ScUndoWrapper: public SfxUndoAction // for manual merging of actions
{
- SfxUndoAction* pWrappedUndo;
- sal_Int32 mnViewShellId;
+ std::unique_ptr<SfxUndoAction> pWrappedUndo;
+ sal_Int32 mnViewShellId;
public:
ScUndoWrapper( SfxUndoAction* pUndo );
virtual ~ScUndoWrapper() override;
- SfxUndoAction* GetWrappedUndo() { return pWrappedUndo; }
+ SfxUndoAction* GetWrappedUndo() { return pWrappedUndo.get(); }
void ForgetWrappedUndo();
virtual void Undo() override;
diff --git a/sc/source/ui/inc/undoblk.hxx b/sc/source/ui/inc/undoblk.hxx
index 32704024a09c..6dd755ff153a 100644
--- a/sc/source/ui/inc/undoblk.hxx
+++ b/sc/source/ui/inc/undoblk.hxx
@@ -147,9 +147,10 @@ public:
virtual OUString GetComment() const override;
private:
- ScMarkData aMarkData;
- ScDocument* pUndoDoc;
- ScRange aExtendedRange;
+ ScMarkData aMarkData;
+ std::unique_ptr<ScDocument>
+ pUndoDoc;
+ ScRange aExtendedRange;
sal_uLong nStartChangeAction;
sal_uLong nEndChangeAction;
@@ -298,7 +299,8 @@ public:
private:
ScRange aRange;
ScMarkData aMarkData;
- ScDocument* pUndoDoc; // Block mark and deleted data
+ std::unique_ptr<ScDocument>
+ pUndoDoc; // Block mark and deleted data
sal_uLong nStartChangeAction;
sal_uLong nEndChangeAction;
InsertDeleteFlags nFlags;
@@ -406,7 +408,8 @@ public:
private:
ScRange aSource;
ScMarkData aMarkData;
- ScDocument* pUndoDoc;
+ std::unique_ptr<ScDocument>
+ pUndoDoc;
FillDir eFillDir;
FillCmd eFillCmd;
FillDateCmd eFillDateCmd;
@@ -459,7 +462,8 @@ public:
virtual OUString GetComment() const override;
private:
- ScDocument* pUndoDoc; // deleted data
+ std::unique_ptr<ScDocument>
+ pUndoDoc; // deleted data
ScMarkData aMarkData;
bool bSize;
sal_uInt16 nFormatNo;
@@ -517,7 +521,8 @@ public:
private:
ScRange aRange;
- ScDocument* pUndoDoc; // Deleted data
+ std::unique_ptr<ScDocument>
+ pUndoDoc; // Deleted data
ScRefAddress theFormulaCell;
ScRefAddress theFormulaEnd;
ScRefAddress theRowCell;
@@ -644,7 +649,8 @@ public:
virtual OUString GetComment() const override;
private:
- ScDocument* pUndoDoc;
+ std::unique_ptr<ScDocument>
+ pUndoDoc;
ScRange aRange;
ScMarkData aMarkData;
OUString aName;
@@ -670,7 +676,8 @@ public:
private:
ScMarkData aMarkData;
- ScDocument* pUndoDoc;
+ std::unique_ptr<ScDocument>
+ pUndoDoc;
OUString aStyleName;
ScRange aRange;
@@ -713,7 +720,8 @@ public:
virtual OUString GetComment() const override;
private:
- ScDocument* pUndoDoc;
+ std::unique_ptr<ScDocument>
+ pUndoDoc;
OUString aFormula;
sal_uLong nStartChangeAction;
sal_uLong nEndChangeAction;
@@ -832,7 +840,8 @@ public:
private:
ScMarkData aMarkData;
- ScDocument* pUndoDoc;
+ std::unique_ptr<ScDocument>
+ pUndoDoc;
bool bIsIncrement;
};
@@ -852,7 +861,8 @@ public:
private:
ScMarkData aMarkData;
- ScDocument* pUndoDoc;
+ std::unique_ptr<ScDocument>
+ pUndoDoc;
sal_Int32 nTransliterationType;
};
@@ -892,7 +902,8 @@ public:
private:
SCTAB nTab;
- ScDocument* pUndoDoc;
+ std::unique_ptr<ScDocument>
+ pUndoDoc;
};
class ScUndoRemoveMerge: public ScBlockUndo
@@ -920,7 +931,7 @@ private:
void SetCurTab();
std::vector<ScCellMergeOption> maOptions;
- ScDocument* pUndoDoc;
+ std::unique_ptr<ScDocument> pUndoDoc;
};
class ScUndoBorder: public ScBlockUndo
diff --git a/sc/source/ui/inc/undodat.hxx b/sc/source/ui/inc/undodat.hxx
index 140bbecd9a9a..ae55159602ff 100644
--- a/sc/source/ui/inc/undodat.hxx
+++ b/sc/source/ui/inc/undodat.hxx
@@ -60,7 +60,8 @@ private:
SCCOLROW nStart;
SCCOLROW nEnd;
SCTAB nTab;
- ScDocument* pUndoDoc;
+ std::unique_ptr<ScDocument>
+ pUndoDoc;
bool bColumns;
sal_uInt16 nLevel;
sal_uInt16 nEntry;
@@ -87,7 +88,8 @@ public:
private:
ScAddress aBlockStart;
ScAddress aBlockEnd;
- ScOutlineTable* pUndoTable;
+ std::unique_ptr<ScOutlineTable>
+ pUndoTable;
bool bColumns;
bool bMake;
};
diff --git a/sc/source/ui/inc/undodraw.hxx b/sc/source/ui/inc/undodraw.hxx
index 375283d141f4..b2ef04cdbc30 100644
--- a/sc/source/ui/inc/undodraw.hxx
+++ b/sc/source/ui/inc/undodraw.hxx
@@ -26,7 +26,7 @@ class ScDocShell;
class ScUndoDraw: public SfxUndoAction
{
- SfxUndoAction* pDrawUndo;
+ std::unique_ptr<SfxUndoAction> pDrawUndo;
ScDocShell* pDocShell;
sal_Int32 mnViewShellId;
@@ -36,8 +36,8 @@ public:
ScUndoDraw( SfxUndoAction* pUndo, ScDocShell* pDocSh );
virtual ~ScUndoDraw() override;
- SfxUndoAction* GetDrawUndo() { return pDrawUndo; }
- void ForgetDrawUndo();
+ SfxUndoAction* GetDrawUndo() { return pDrawUndo.get(); }
+ SfxUndoAction* ReleaseDrawUndo() { return pDrawUndo.release(); }
virtual void Undo() override;
virtual void Redo() override;
diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx
index 5ac882779ec3..c2b4b693ddfc 100644
--- a/sc/source/ui/undo/undobase.cxx
+++ b/sc/source/ui/undo/undobase.cxx
@@ -38,7 +38,6 @@
ScSimpleUndo::ScSimpleUndo( ScDocShell* pDocSh ) :
pDocShell( pDocSh ),
- pDetectiveUndo( nullptr ),
mnViewShellId(-1)
{
if (ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell())
@@ -52,7 +51,6 @@ sal_Int32 ScSimpleUndo::GetViewShellId() const
ScSimpleUndo::~ScSimpleUndo()
{
- delete pDetectiveUndo;
}
bool ScSimpleUndo::SetViewMarkData( const ScMarkData& rMarkData )
@@ -83,8 +81,7 @@ bool ScSimpleUndo::Merge( SfxUndoAction *pNextAction )
// ScUndoDraw is later deleted by the UndoManager
ScUndoDraw* pCalcUndo = static_cast<ScUndoDraw*>(pNextAction);
- pDetectiveUndo = pCalcUndo->GetDrawUndo();
- pCalcUndo->ForgetDrawUndo();
+ pDetectiveUndo.reset( pCalcUndo->ReleaseDrawUndo() );
return true;
}
@@ -610,7 +607,6 @@ ScUndoWrapper::ScUndoWrapper( SfxUndoAction* pUndo ) :
ScUndoWrapper::~ScUndoWrapper()
{
- delete pWrappedUndo;
}
void ScUndoWrapper::ForgetWrappedUndo()
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 45c3ffb34b2b..39f604afeb98 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -738,7 +738,6 @@ ScUndoCut::ScUndoCut( ScDocShell* pNewDocShell,
ScUndoCut::~ScUndoCut()
{
- delete pUndoDoc;
}
OUString ScUndoCut::GetComment() const
@@ -750,7 +749,7 @@ void ScUndoCut::SetChangeTrack()
{
ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
- pChangeTrack->AppendContentRange( aBlockRange, pUndoDoc,
+ pChangeTrack->AppendContentRange( aBlockRange, pUndoDoc.get(),
nStartChangeAction, nEndChangeAction, SC_CACM_CUT );
else
nStartChangeAction = nEndChangeAction = 0;
@@ -1560,7 +1559,6 @@ ScUndoUseScenario::ScUndoUseScenario( ScDocShell* pNewDocShell,
ScUndoUseScenario::~ScUndoUseScenario()
{
- delete pUndoDoc;
}
OUString ScUndoUseScenario::GetComment() const
@@ -1676,7 +1674,6 @@ ScUndoSelectionStyle::ScUndoSelectionStyle( ScDocShell* pNewDocShell,
ScUndoSelectionStyle::~ScUndoSelectionStyle()
{
- delete pUndoDoc;
}
OUString ScUndoSelectionStyle::GetComment() const
@@ -1781,7 +1778,6 @@ ScUndoEnterMatrix::ScUndoEnterMatrix( ScDocShell* pNewDocShell, const ScRange& r
ScUndoEnterMatrix::~ScUndoEnterMatrix()
{
- delete pUndoDoc;
}
OUString ScUndoEnterMatrix::GetComment() const
@@ -1794,7 +1790,7 @@ void ScUndoEnterMatrix::SetChangeTrack()
ScDocument& rDoc = pDocShell->GetDocument();
ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
- pChangeTrack->AppendContentRange( aBlockRange, pUndoDoc,
+ pChangeTrack->AppendContentRange( aBlockRange, pUndoDoc.get(),
nStartChangeAction, nEndChangeAction );
else
nStartChangeAction = nEndChangeAction = 0;
@@ -1875,7 +1871,6 @@ ScUndoIndent::ScUndoIndent( ScDocShell* pNewDocShell, const ScMarkData& rMark,
ScUndoIndent::~ScUndoIndent()
{
- delete pUndoDoc;
}
OUString ScUndoIndent::GetComment() const
@@ -1932,7 +1927,6 @@ ScUndoTransliterate::ScUndoTransliterate( ScDocShell* pNewDocShell, const ScMark
ScUndoTransliterate::~ScUndoTransliterate()
{
- delete pUndoDoc;
}
OUString ScUndoTransliterate::GetComment() const
@@ -2052,7 +2046,6 @@ ScUndoRemoveBreaks::ScUndoRemoveBreaks( ScDocShell* pNewDocShell,
ScUndoRemoveBreaks::~ScUndoRemoveBreaks()
{
- delete pUndoDoc;
}
OUString ScUndoRemoveBreaks::GetComment() const
@@ -2122,7 +2115,6 @@ ScUndoRemoveMerge::ScUndoRemoveMerge( ScDocShell* pNewDocShell,
ScUndoRemoveMerge::~ScUndoRemoveMerge()
{
- delete pUndoDoc;
}
OUString ScUndoRemoveMerge::GetComment() const
@@ -2132,7 +2124,7 @@ OUString ScUndoRemoveMerge::GetComment() const
ScDocument* ScUndoRemoveMerge::GetUndoDoc()
{
- return pUndoDoc;
+ return pUndoDoc.get();
}
void ScUndoRemoveMerge::AddCellMergeOption( const ScCellMergeOption& rOption )
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index 1d3d707bbaa5..226e15dcc44a 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -229,7 +229,6 @@ ScUndoFillTable::ScUndoFillTable( ScDocShell* pNewDocShell,
ScUndoFillTable::~ScUndoFillTable()
{
- delete pUndoDoc;
}
OUString ScUndoFillTable::GetComment() const
@@ -253,7 +252,7 @@ void ScUndoFillTable::SetChangeTrack()
{
aWorkRange.aStart.SetTab(*itr);
aWorkRange.aEnd.SetTab(*itr);
- pChangeTrack->AppendContentRange( aWorkRange, pUndoDoc,
+ pChangeTrack->AppendContentRange( aWorkRange, pUndoDoc.get(),
nTmpAction, nEndChangeAction );
if ( !nStartChangeAction )
nStartChangeAction = nTmpAction;
@@ -503,7 +502,6 @@ ScUndoAutoFill::ScUndoAutoFill( ScDocShell* pNewDocShell,
ScUndoAutoFill::~ScUndoAutoFill()
{
- delete pUndoDoc;
}
OUString ScUndoAutoFill::GetComment() const
@@ -515,7 +513,7 @@ void ScUndoAutoFill::SetChangeTrack()
{
ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
- pChangeTrack->AppendContentRange( aBlockRange, pUndoDoc,
+ pChangeTrack->AppendContentRange( aBlockRange, pUndoDoc.get(),
nStartChangeAction, nEndChangeAction );
else
nStartChangeAction = nEndChangeAction = 0;
@@ -776,7 +774,6 @@ ScUndoAutoFormat::ScUndoAutoFormat( ScDocShell* pNewDocShell,
ScUndoAutoFormat::~ScUndoAutoFormat()
{
- delete pUndoDoc;
}
OUString ScUndoAutoFormat::GetComment() const
@@ -1113,7 +1110,6 @@ ScUndoTabOp::ScUndoTabOp( ScDocShell* pNewDocShell,
ScUndoTabOp::~ScUndoTabOp()
{
- delete pUndoDoc;
}
OUString ScUndoTabOp::GetComment() const
diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx
index e78330161810..b6527a5faddd 100644
--- a/sc/source/ui/undo/undodat.cxx
+++ b/sc/source/ui/undo/undodat.cxx
@@ -65,7 +65,6 @@ ScUndoDoOutline::ScUndoDoOutline( ScDocShell* pNewDocShell,
ScUndoDoOutline::~ScUndoDoOutline()
{
- delete pUndoDoc;
}
OUString ScUndoDoOutline::GetComment() const
@@ -154,7 +153,6 @@ ScUndoMakeOutline::ScUndoMakeOutline( ScDocShell* pNewDocShell,
ScUndoMakeOutline::~ScUndoMakeOutline()
{
- delete pUndoTable;
}
OUString ScUndoMakeOutline::GetComment() const
@@ -174,7 +172,7 @@ void ScUndoMakeOutline::Undo()
ScUndoUtil::MarkSimpleBlock( pDocShell, aBlockStart, aBlockEnd );
- rDoc.SetOutlineTable( nTab, pUndoTable );
+ rDoc.SetOutlineTable( nTab, pUndoTable.get() );
SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
diff --git a/sc/source/ui/undo/undodraw.cxx b/sc/source/ui/undo/undodraw.cxx
index 110f9f3e4e94..484dd76f42ce 100644
--- a/sc/source/ui/undo/undodraw.cxx
+++ b/sc/source/ui/undo/undodraw.cxx
@@ -35,12 +35,6 @@ ScUndoDraw::ScUndoDraw( SfxUndoAction* pUndo, ScDocShell* pDocSh ) :
ScUndoDraw::~ScUndoDraw()
{
- delete pDrawUndo;
-}
-
-void ScUndoDraw::ForgetDrawUndo()
-{
- pDrawUndo = nullptr; // do not delete (DrawUndo has to be remembered from outside)
}
OUString ScUndoDraw::GetComment() const
diff --git a/sc/source/ui/undo/undorangename.cxx b/sc/source/ui/undo/undorangename.cxx
index 16624c901a6e..ec2564f357cf 100644
--- a/sc/source/ui/undo/undorangename.cxx
+++ b/sc/source/ui/undo/undorangename.cxx
@@ -87,7 +87,6 @@ ScUndoAddRangeData::ScUndoAddRangeData(ScDocShell* pDocSh, ScRangeData* pRangeDa
ScUndoAddRangeData::~ScUndoAddRangeData()
{
- delete mpRangeData;
}
void ScUndoAddRangeData::Undo()
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index 9d2af2afb35e..ecff34578f60 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -1394,20 +1394,18 @@ ScDataPilotDescriptor::ScDataPilotDescriptor(ScDocShell* pDocSh) :
ScDataPilotDescriptor::~ScDataPilotDescriptor()
{
- delete mpDPObject;
}
ScDPObject* ScDataPilotDescriptor::GetDPObject() const
{
- return mpDPObject;
+ return mpDPObject.get();
}
void ScDataPilotDescriptor::SetDPObject( ScDPObject* pDPObject )
{
- if (mpDPObject != pDPObject)
+ if (mpDPObject.get() != pDPObject)
{
- delete mpDPObject;
- mpDPObject = pDPObject;
+ mpDPObject.reset( pDPObject );
OSL_FAIL("replace DPObject should not happen");
}
}
diff --git a/sc/source/ui/unoobj/editsrc.cxx b/sc/source/ui/unoobj/editsrc.cxx
index 4d443ba0988a..678dc4a1488c 100644
--- a/sc/source/ui/unoobj/editsrc.cxx
+++ b/sc/source/ui/unoobj/editsrc.cxx
@@ -74,7 +74,6 @@ ScCellEditSource::ScCellEditSource(ScDocShell* pDocSh, const ScAddress& rP) :
ScCellEditSource::~ScCellEditSource()
{
- delete pCellTextData;
}
SvxEditSource* ScCellEditSource::Clone() const
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index e67e93822e21..d397e05c0a10 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -165,16 +165,16 @@ enum ScUnoCollectMode
class ScUnoEditEngine : public ScEditEngineDefaulter
{
ScUnoCollectMode eMode;
- sal_uInt16 nFieldCount;
+ sal_uInt16 nFieldCount;
sal_Int32 mnFieldType;
- SvxFieldData* pFound; // lokale Kopie
+ std::unique_ptr<SvxFieldData>
+ pFound; // lokale Kopie
sal_Int32 nFieldPar;
sal_Int32 nFieldPos;
- sal_uInt16 nFieldIndex;
+ sal_uInt16 nFieldIndex;
public:
explicit ScUnoEditEngine(ScEditEngineDefaulter* pSource);
- virtual ~ScUnoEditEngine() override;
virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos,
Color*& rTxtColor, Color*& rFldColor ) override;
@@ -202,11 +202,6 @@ ScUnoEditEngine::ScUnoEditEngine(ScEditEngineDefaulter* pSource)
delete pData;
}
-ScUnoEditEngine::~ScUnoEditEngine()
-{
- delete pFound;
-}
-
OUString ScUnoEditEngine::CalcFieldValue( const SvxFieldItem& rField,
sal_Int32 nPara, sal_Int32 nPos, Color*& rTxtColor, Color*& rFldColor )
{
@@ -220,14 +215,14 @@ OUString ScUnoEditEngine::CalcFieldValue( const SvxFieldItem& rField,
{
if ( eMode == SC_UNO_COLLECT_FINDINDEX && !pFound && nFieldCount == nFieldIndex )
{
- pFound = pFieldData->Clone();
+ pFound.reset( pFieldData->Clone() );
nFieldPar = nPara;
nFieldPos = nPos;
}
if ( eMode == SC_UNO_COLLECT_FINDPOS && !pFound &&
nPara == nFieldPar && nPos == nFieldPos )
{
- pFound = pFieldData->Clone();
+ pFound.reset( pFieldData->Clone() );
nFieldIndex = nFieldCount;
}
++nFieldCount;
@@ -257,7 +252,7 @@ SvxFieldData* ScUnoEditEngine::FindByIndex(sal_uInt16 nIndex)
UpdateFields();
eMode = SC_UNO_COLLECT_NONE;
- return pFound;
+ return pFound.get();
}
SvxFieldData* ScUnoEditEngine::FindByPos(sal_Int32 nPar, sal_Int32 nPos, sal_Int32 nType)
@@ -271,7 +266,7 @@ SvxFieldData* ScUnoEditEngine::FindByPos(sal_Int32 nPar, sal_Int32 nPos, sal_Int
mnFieldType = text::textfield::Type::UNSPECIFIED;
eMode = SC_UNO_COLLECT_NONE;
- return pFound;
+ return pFound.get();
}
ScCellFieldsObj::ScCellFieldsObj(
@@ -1129,13 +1124,12 @@ void ScEditFieldObj::InitDoc(
mpData.reset();
aSelection = rSel;
- mpEditSource = pEditSrc;
+ mpEditSource.reset( pEditSrc );
}
}
ScEditFieldObj::~ScEditFieldObj()
{
- delete mpEditSource;
}
SvxFieldItem ScEditFieldObj::CreateFieldItem()
diff --git a/sc/source/ui/unoobj/srchuno.cxx b/sc/source/ui/unoobj/srchuno.cxx
index e60a572946d6..7fe453fe8c57 100644
--- a/sc/source/ui/unoobj/srchuno.cxx
+++ b/sc/source/ui/unoobj/srchuno.cxx
@@ -64,9 +64,9 @@ static const SfxItemPropertyMapEntry* lcl_GetSearchPropertyMap()
#define SCREPLACEDESCRIPTOR_SERVICE "com.sun.star.util.ReplaceDescriptor"
ScCellSearchObj::ScCellSearchObj() :
- aPropSet(lcl_GetSearchPropertyMap())
+ aPropSet(lcl_GetSearchPropertyMap()),
+ pSearchItem( new SvxSearchItem( SCITEM_SEARCHDATA ) )
{
- pSearchItem = new SvxSearchItem( SCITEM_SEARCHDATA );
// Defaults:
pSearchItem->SetWordOnly(false);
pSearchItem->SetExact(false);
@@ -91,7 +91,6 @@ ScCellSearchObj::ScCellSearchObj() :
ScCellSearchObj::~ScCellSearchObj()
{
- delete pSearchItem;
}
// XSearchDescriptor
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index 58418ea01c08..def4e2aa3c9c 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -102,27 +102,23 @@ ScPageRowEntry::ScPageRowEntry(const ScPageRowEntry& r)
nPagesX = r.nPagesX;
if (r.pHidden && nPagesX)
{
- pHidden = new bool[nPagesX];
- memcpy( pHidden, r.pHidden, nPagesX * sizeof(bool) );
+ pHidden.reset( new bool[nPagesX] );
+ memcpy( pHidden.get(), r.pHidden.get(), nPagesX * sizeof(bool) );
}
- else
- pHidden = nullptr;
}
ScPageRowEntry& ScPageRowEntry::operator=(const ScPageRowEntry& r)
{
- delete[] pHidden;
-
nStartRow = r.nStartRow;
nEndRow = r.nEndRow;
nPagesX = r.nPagesX;
if (r.pHidden && nPagesX)
{
- pHidden = new bool[nPagesX];
- memcpy( pHidden, r.pHidden, nPagesX * sizeof(bool) );
+ pHidden.reset( new bool[nPagesX] );
+ memcpy( pHidden.get(), r.pHidden.get(), nPagesX * sizeof(bool) );
}
else
- pHidden = nullptr;
+ pHidden.reset();
return *this;
}
@@ -132,8 +128,7 @@ void ScPageRowEntry::SetPagesX(size_t nNew)
if (pHidden)
{
OSL_FAIL("SetPagesX nicht nach SetHidden");
- delete[] pHidden;
- pHidden = nullptr;
+ pHidden.reset();
}
nPagesX = nNew;
}
@@ -148,8 +143,8 @@ void ScPageRowEntry::SetHidden(size_t nX)
{
if (!pHidden)
{
- pHidden = new bool[nPagesX];
- memset( pHidden, false, nPagesX * sizeof(bool) );
+ pHidden.reset( new bool[nPagesX] );
+ memset( pHidden.get(), false, nPagesX * sizeof(bool) );
}
pHidden[nX] = true;
}