summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/dapiuno.hxx2
-rw-r--r--sc/inc/editsrc.hxx2
-rw-r--r--sc/inc/fielduno.hxx2
-rw-r--r--sc/inc/srchuno.hxx5
-rw-r--r--sc/inc/undorangename.hxx2
-rw-r--r--sc/source/filter/excel/excdoc.cxx1
-rw-r--r--sc/source/filter/excel/excrecds.cxx7
-rw-r--r--sc/source/filter/excel/expop2.cxx3
-rw-r--r--sc/source/filter/excel/frmbase.cxx3
-rw-r--r--sc/source/filter/excel/tokstack.cxx3
-rw-r--r--sc/source/filter/excel/xilink.cxx3
-rw-r--r--sc/source/filter/html/htmlimp.cxx4
-rw-r--r--sc/source/filter/html/htmlpars.cxx2
-rw-r--r--sc/source/filter/inc/XclExpChangeTrack.hxx12
-rw-r--r--sc/source/filter/inc/eeimport.hxx3
-rw-r--r--sc/source/filter/inc/eeparser.hxx8
-rw-r--r--sc/source/filter/inc/excdoc.hxx6
-rw-r--r--sc/source/filter/inc/excrecds.hxx3
-rw-r--r--sc/source/filter/inc/exp_op.hxx3
-rw-r--r--sc/source/filter/inc/expbase.hxx3
-rw-r--r--sc/source/filter/inc/formel.hxx3
-rw-r--r--sc/source/filter/inc/lotattr.hxx8
-rw-r--r--sc/source/filter/inc/namebuff.hxx3
-rw-r--r--sc/source/filter/inc/rtfexp.hxx2
-rw-r--r--sc/source/filter/inc/scflt.hxx6
-rw-r--r--sc/source/filter/inc/tokstack.hxx2
-rw-r--r--sc/source/filter/inc/xilink.hxx12
-rw-r--r--sc/source/filter/lotus/lotattr.cxx1
-rw-r--r--sc/source/filter/lotus/tool.cxx3
-rw-r--r--sc/source/filter/rtf/eeimpars.cxx3
-rw-r--r--sc/source/filter/rtf/expbase.cxx3
-rw-r--r--sc/source/filter/rtf/rtfexp.cxx1
-rw-r--r--sc/source/filter/rtf/rtfimp.cxx2
-rw-r--r--sc/source/filter/starcalc/scflt.cxx12
-rw-r--r--sc/source/filter/xcl97/XclExpChangeTrack.cxx24
-rw-r--r--sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx3
-rw-r--r--sc/source/filter/xml/XMLChangeTrackingExportHelper.hxx3
-rw-r--r--sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx13
-rw-r--r--sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx10
-rw-r--r--sc/source/filter/xml/XMLStylesImportHelper.cxx3
-rw-r--r--sc/source/filter/xml/XMLStylesImportHelper.hxx16
-rw-r--r--sc/source/filter/xml/XMLTrackedChangesContext.cxx14
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx1
-rw-r--r--sc/source/filter/xml/xmlcelli.hxx2
-rw-r--r--sc/source/filter/xml/xmldpimp.cxx7
-rw-r--r--sc/source/filter/xml/xmldpimp.hxx4
-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
70 files changed, 198 insertions, 263 deletions
diff --git a/sc/inc/dapiuno.hxx b/sc/inc/dapiuno.hxx
index c8f7e88a72a1..3f98aa432593 100644
--- a/sc/inc/dapiuno.hxx
+++ b/sc/inc/dapiuno.hxx
@@ -262,7 +262,7 @@ public:
class ScDataPilotDescriptor : public ScDataPilotDescriptorBase
{
private:
- ScDPObject* mpDPObject;
+ std::unique_ptr<ScDPObject> mpDPObject;
public:
ScDataPilotDescriptor(ScDocShell* pDocSh);
diff --git a/sc/inc/editsrc.hxx b/sc/inc/editsrc.hxx
index 8ef58b768f0d..ae07f6e43907 100644
--- a/sc/inc/editsrc.hxx
+++ b/sc/inc/editsrc.hxx
@@ -74,7 +74,7 @@ public:
class ScCellEditSource : public ScEditSource
{
private:
- ScCellTextData* pCellTextData;
+ std::unique_ptr<ScCellTextData> pCellTextData;
public:
ScCellEditSource(ScDocShell* pDocSh, const ScAddress& rP);
diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx
index 170c37438590..79fc090fe412 100644
--- a/sc/inc/fielduno.hxx
+++ b/sc/inc/fielduno.hxx
@@ -196,7 +196,7 @@ class ScEditFieldObj : public cppu::WeakImplHelper<
const ScEditFieldObj& operator=(const ScEditFieldObj&) = delete;
const SfxItemPropertySet* pPropSet;
- ScEditSource* mpEditSource;
+ std::unique_ptr<ScEditSource> mpEditSource;
ESelection aSelection;
sal_Int32 meType;
diff --git a/sc/inc/srchuno.hxx b/sc/inc/srchuno.hxx
index bbe535bb1bfe..60f93d456203 100644
--- a/sc/inc/srchuno.hxx
+++ b/sc/inc/srchuno.hxx
@@ -35,13 +35,14 @@ class ScCellSearchObj : public cppu::WeakImplHelper<
{
private:
SfxItemPropertySet aPropSet;
- SvxSearchItem* pSearchItem;
+ std::unique_ptr<SvxSearchItem>
+ pSearchItem;
public:
ScCellSearchObj();
virtual ~ScCellSearchObj() override;
- SvxSearchItem* GetSearchItem() const { return pSearchItem; }
+ SvxSearchItem* GetSearchItem() const { return pSearchItem.get(); }
// XReplaceDescriptor
virtual OUString SAL_CALL getReplaceString() throw(css::uno::RuntimeException, std::exception) override;
diff --git a/sc/inc/undorangename.hxx b/sc/inc/undorangename.hxx
index 6fbbf8d42f04..2148afbb14cb 100644
--- a/sc/inc/undorangename.hxx
+++ b/sc/inc/undorangename.hxx
@@ -59,7 +59,7 @@ public:
virtual OUString GetComment() const override;
private:
- ScRangeData* mpRangeData;
+ std::unique_ptr<ScRangeData> mpRangeData;
SCTAB mnTab;
};
diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx
index cd1a46678181..6f3b2ad3d6ef 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -153,7 +153,6 @@ ExcTable::ExcTable( const XclExpRoot& rRoot, SCTAB nScTab ) :
ExcTable::~ExcTable()
{
- delete pTabNames;
}
void ExcTable::Add( XclExpRecordBase* pRec )
diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx
index b4650298447a..623041d41585 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -568,7 +568,6 @@ ExcFilterCondition::ExcFilterCondition() :
ExcFilterCondition::~ExcFilterCondition()
{
- delete pText;
}
std::size_t ExcFilterCondition::GetTextBytes() const
@@ -581,9 +580,7 @@ void ExcFilterCondition::SetCondition( sal_uInt8 nTp, sal_uInt8 nOp, double fV,
nType = nTp;
nOper = nOp;
fVal = fV;
-
- delete pText;
- (pT) ? pText = new XclExpString( *pT, EXC_STR_8BITLENGTH ) : pText = nullptr;
+ pText.reset( pT ? new XclExpString( *pT, EXC_STR_8BITLENGTH ) : nullptr);
}
void ExcFilterCondition::Save( XclExpStream& rStrm )
@@ -639,7 +636,7 @@ void ExcFilterCondition::SaveXml( XclExpXmlStream& rStrm )
rStrm.GetCurrentStream()->singleElement( XML_customFilter,
XML_operator, lcl_GetOperator( nOper ),
- XML_val, lcl_GetValue( nType, fVal, pText ).getStr(),
+ XML_val, lcl_GetValue( nType, fVal, pText.get() ).getStr(),
FSEND );
}
diff --git a/sc/source/filter/excel/expop2.cxx b/sc/source/filter/excel/expop2.cxx
index 9b77c6514507..a268427ccd69 100644
--- a/sc/source/filter/excel/expop2.cxx
+++ b/sc/source/filter/excel/expop2.cxx
@@ -64,12 +64,11 @@ ExportBiff5::ExportBiff5( XclExpRootData& rExpData, SvStream& rStrm ):
pExcRoot = &GetOldRoot();
pExcRoot->pER = this; // ExcRoot -> XclExpRoot
pExcRoot->eDateiTyp = Biff5;
- pExcDoc = new ExcDocument( *this );
+ pExcDoc.reset( new ExcDocument( *this ) );
}
ExportBiff5::~ExportBiff5()
{
- delete pExcDoc;
}
FltError ExportBiff5::Write()
diff --git a/sc/source/filter/excel/frmbase.cxx b/sc/source/filter/excel/frmbase.cxx
index 71140167f2b7..7a9df825dc3b 100644
--- a/sc/source/filter/excel/frmbase.cxx
+++ b/sc/source/filter/excel/frmbase.cxx
@@ -154,12 +154,11 @@ ConverterBase::ConverterBase( svl::SharedStringPool& rSPool, sal_uInt16 nNewBuff
eStatus( ConvOK )
{
OSL_ENSURE( nNewBuffer > 0, "ConverterBase::ConverterBase - nNewBuffer == 0!" );
- pBuffer = new sal_Char[ nNewBuffer ];
+ pBuffer.reset( new sal_Char[ nNewBuffer ] );
}
ConverterBase::~ConverterBase()
{
- delete[] pBuffer;
}
void ConverterBase::Reset()
diff --git a/sc/source/filter/excel/tokstack.cxx b/sc/source/filter/excel/tokstack.cxx
index 68993c2c21ab..70c4c683c44f 100644
--- a/sc/source/filter/excel/tokstack.cxx
+++ b/sc/source/filter/excel/tokstack.cxx
@@ -30,14 +30,13 @@
const sal_uInt16 TokenPool::nScTokenOff = 8192;
TokenStack::TokenStack( )
+ : pStack( new TokenId[ nSize ] )
{
- pStack = new TokenId[ nSize ];
Reset();
}
TokenStack::~TokenStack()
{
- delete[] pStack;
}
// !ATTENTION!": to the outside the numbering starts with 1!
diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx
index df8f5e3d6e2f..ef9f96ba8484 100644
--- a/sc/source/filter/excel/xilink.cxx
+++ b/sc/source/filter/excel/xilink.cxx
@@ -398,7 +398,7 @@ XclImpExtName::XclImpExtName( XclImpSupbook& rSupbook, XclImpStream& rStrm, XclS
}
break;
case xlExtOLE:
- mpMOper = new MOper(rSupbook.GetSharedStringPool(), rStrm);
+ mpMOper.reset( new MOper(rSupbook.GetSharedStringPool(), rStrm) );
break;
default:
;
@@ -407,7 +407,6 @@ XclImpExtName::XclImpExtName( XclImpSupbook& rSupbook, XclImpStream& rStrm, XclS
XclImpExtName::~XclImpExtName()
{
- delete mpMOper;
}
void XclImpExtName::CreateDdeData( ScDocument& rDoc, const OUString& rApplic, const OUString& rTopic ) const
diff --git a/sc/source/filter/html/htmlimp.cxx b/sc/source/filter/html/htmlimp.cxx
index 1edc926379ab..ecf3c1a569dc 100644
--- a/sc/source/filter/html/htmlimp.cxx
+++ b/sc/source/filter/html/htmlimp.cxx
@@ -93,9 +93,9 @@ ScHTMLImport::ScHTMLImport( ScDocument* pDocP, const OUString& rBaseURL, const S
SvxPaperInfo::GetPaperSize( PAPER_A4 ), MapMode( MapUnit::MapTwip ) );
}
if( bCalcWidthHeight )
- mpParser = new ScHTMLLayoutParser( mpEngine, rBaseURL, aPageSize, pDocP );
+ mpParser = new ScHTMLLayoutParser( mpEngine.get(), rBaseURL, aPageSize, pDocP );
else
- mpParser = new ScHTMLQueryParser( mpEngine, pDocP );
+ mpParser = new ScHTMLQueryParser( mpEngine.get(), pDocP );
}
ScHTMLImport::~ScHTMLImport()
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 6b46e143ffb0..337239794644 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1390,7 +1390,7 @@ void ScHTMLLayoutParser::Image( ImportInfo* pInfo )
(pActEntry->aAltText).clear();
}
pImage->aFilterName = rFilter.GetImportFormatName( nFormat );
- pImage->pGraphic = pGraphic;
+ pImage->pGraphic.reset( pGraphic );
if ( !(pImage->aSize.Width() && pImage->aSize.Height()) )
{
OutputDevice* pDefaultDev = Application::GetDefaultDevice();
diff --git a/sc/source/filter/inc/XclExpChangeTrack.hxx b/sc/source/filter/inc/XclExpChangeTrack.hxx
index eedb6fc64560..9ea74edd5a17 100644
--- a/sc/source/filter/inc/XclExpChangeTrack.hxx
+++ b/sc/source/filter/inc/XclExpChangeTrack.hxx
@@ -289,7 +289,8 @@ public:
class XclExpChTrTabIdBuffer
{
private:
- sal_uInt16* pBuffer;
+ std::unique_ptr<sal_uInt16[]>
+ pBuffer;
sal_uInt16* pLast;
sal_uInt16 nBufSize;
sal_uInt16 nLastId;
@@ -306,9 +307,9 @@ public:
void Remove();
inline sal_uInt16 GetBufferCount() const
- { return static_cast< sal_uInt16 >( (pLast - pBuffer) + 1 ); }
+ { return static_cast< sal_uInt16 >( (pLast - pBuffer.get()) + 1 ); }
inline void GetBufferCopy( sal_uInt16* pDest ) const
- { memcpy( pDest, pBuffer, sizeof(sal_uInt16) * GetBufferCount() ); }
+ { memcpy( pDest, pBuffer.get(), sizeof(sal_uInt16) * GetBufferCount() ); }
};
// XclExpChTrTabId - tab id record
@@ -343,7 +344,8 @@ private:
OUString sUsername;
DateTime aDateTime;
sal_uInt32 nIndex; // action number
- XclExpChTrAction* pAddAction; // additional record for this action
+ std::unique_ptr<XclExpChTrAction>
+ pAddAction; // additional record for this action
bool bAccepted;
protected:
@@ -402,7 +404,7 @@ public:
virtual void Save( XclExpStream& rStrm ) override;
virtual std::size_t GetLen() const override;
- inline XclExpChTrAction* GetAddAction() { return pAddAction; }
+ inline XclExpChTrAction* GetAddAction() { return pAddAction.get(); }
inline sal_uInt32 GetActionNumber() const { return nIndex; }
};
diff --git a/sc/source/filter/inc/eeimport.hxx b/sc/source/filter/inc/eeimport.hxx
index 290d72b30e92..88995c362e1d 100644
--- a/sc/source/filter/inc/eeimport.hxx
+++ b/sc/source/filter/inc/eeimport.hxx
@@ -40,7 +40,8 @@ protected:
ScRange maRange;
ScDocument* mpDoc;
ScEEParser* mpParser;
- ScTabEditEngine* mpEngine;
+ std::unique_ptr<ScTabEditEngine>
+ mpEngine;
RowHeightMap maRowHeights;
bool GraphicSize( SCCOL nCol, SCROW nRow, SCTAB nTab,
diff --git a/sc/source/filter/inc/eeparser.hxx b/sc/source/filter/inc/eeparser.hxx
index ba25d617669a..cbf746dfe729 100644
--- a/sc/source/filter/inc/eeparser.hxx
+++ b/sc/source/filter/inc/eeparser.hxx
@@ -38,15 +38,13 @@ struct ScHTMLImage
Size aSize;
Point aSpace;
OUString aFilterName;
- Graphic* pGraphic; // wird von WriteToDocument uebernommen
+ std::unique_ptr<Graphic>
+ pGraphic; // wird von WriteToDocument uebernommen
sal_Char nDir; // 1==hori, 2==verti, 3==beides
ScHTMLImage() :
- aSize( 0, 0 ), aSpace( 0, 0 ), pGraphic( nullptr ),
- nDir( nHorizontal )
+ aSize( 0, 0 ), aSpace( 0, 0 ), nDir( nHorizontal )
{}
-
- ~ScHTMLImage() { delete pGraphic; }
};
struct ScEEParseEntry
diff --git a/sc/source/filter/inc/excdoc.hxx b/sc/source/filter/inc/excdoc.hxx
index 0df4f843d661..19c5ad57b377 100644
--- a/sc/source/filter/inc/excdoc.hxx
+++ b/sc/source/filter/inc/excdoc.hxx
@@ -50,11 +50,11 @@ private:
XclExpCellTableRef mxCellTable;
SCTAB mnScTab; // table number SC document
- sal_uInt16 nExcTab; // table number Excel document
+ sal_uInt16 nExcTab; // table number Excel document
- NameBuffer* pTabNames;
+ std::unique_ptr<NameBuffer> pTabNames;
- XclExpNoteListRef mxNoteList;
+ XclExpNoteListRef mxNoteList;
// re-create and forget pRec; delete is done by ExcTable itself!
void Add( XclExpRecordBase* pRec );
diff --git a/sc/source/filter/inc/excrecds.hxx b/sc/source/filter/inc/excrecds.hxx
index 514310075cac..3636c8953107 100644
--- a/sc/source/filter/inc/excrecds.hxx
+++ b/sc/source/filter/inc/excrecds.hxx
@@ -351,7 +351,8 @@ private:
sal_uInt8 nType;
sal_uInt8 nOper;
double fVal;
- XclExpString* pText;
+ std::unique_ptr<XclExpString>
+ pText;
protected:
public:
diff --git a/sc/source/filter/inc/exp_op.hxx b/sc/source/filter/inc/exp_op.hxx
index 28f7e84a970f..3a36c45535e1 100644
--- a/sc/source/filter/inc/exp_op.hxx
+++ b/sc/source/filter/inc/exp_op.hxx
@@ -51,7 +51,8 @@ public:
class ExportBiff5 : public ExportTyp, protected XclExpRoot
{
private:
- ExcDocument* pExcDoc;
+ std::unique_ptr<ExcDocument>
+ pExcDoc;
protected:
RootData* pExcRoot;
diff --git a/sc/source/filter/inc/expbase.hxx b/sc/source/filter/inc/expbase.hxx
index e564e14841bd..4eb0459ad496 100644
--- a/sc/source/filter/inc/expbase.hxx
+++ b/sc/source/filter/inc/expbase.hxx
@@ -34,7 +34,8 @@ protected:
ScRange aRange;
ScDocument* pDoc;
SvNumberFormatter* pFormatter;
- ScFieldEditEngine* pEditEngine;
+ std::unique_ptr<ScFieldEditEngine>
+ pEditEngine;
public:
diff --git a/sc/source/filter/inc/formel.hxx b/sc/source/filter/inc/formel.hxx
index 494cd0a164ca..1fd5c5a45ce5 100644
--- a/sc/source/filter/inc/formel.hxx
+++ b/sc/source/filter/inc/formel.hxx
@@ -86,7 +86,8 @@ protected:
TokenStack aStack;
ScAddress aEingPos;
ConvErr eStatus;
- sal_Char* pBuffer; // universal buffer
+ std::unique_ptr<sal_Char[]>
+ pBuffer; // universal buffer
ConverterBase( svl::SharedStringPool& rSPool, sal_uInt16 nNewBuffer );
virtual ~ConverterBase();
diff --git a/sc/source/filter/inc/lotattr.hxx b/sc/source/filter/inc/lotattr.hxx
index 80f0307a8399..564befff6860 100644
--- a/sc/source/filter/inc/lotattr.hxx
+++ b/sc/source/filter/inc/lotattr.hxx
@@ -70,12 +70,12 @@ private:
struct ENTRY
{
- ScPatternAttr* pPattAttr;
- sal_uInt32 nHash0;
+ std::unique_ptr<ScPatternAttr> pPattAttr;
+ sal_uInt32 nHash0;
- ENTRY (ScPatternAttr* p);
+ ENTRY(ScPatternAttr* p);
- ~ENTRY ();
+ ~ENTRY();
};
inline static void MakeHash( const LotAttrWK3& rAttr, sal_uInt32& rOut )
diff --git a/sc/source/filter/inc/namebuff.hxx b/sc/source/filter/inc/namebuff.hxx
index 28167ac2b684..a4247b18aef9 100644
--- a/sc/source/filter/inc/namebuff.hxx
+++ b/sc/source/filter/inc/namebuff.hxx
@@ -151,7 +151,8 @@ private:
};
LOTUS_ROOT* m_pLotRoot;
- ScTokenArray* pScTokenArray;
+ std::unique_ptr<ScTokenArray>
+ pScTokenArray;
sal_uInt16 nIntCount;
std::vector<Entry> maEntries;
diff --git a/sc/source/filter/inc/rtfexp.hxx b/sc/source/filter/inc/rtfexp.hxx
index b289f2d47fbb..aec9f13bcf64 100644
--- a/sc/source/filter/inc/rtfexp.hxx
+++ b/sc/source/filter/inc/rtfexp.hxx
@@ -24,7 +24,7 @@
class ScRTFExport : public ScExportBase
{
- sal_uLong* pCellX; // cumulative range in a table
+ std::unique_ptr<sal_uLong[]> pCellX; // cumulative range in a table
void WriteTab( SCTAB nTab );
void WriteRow( SCTAB nTab, SCROW nRow );
diff --git a/sc/source/filter/inc/scflt.hxx b/sc/source/filter/inc/scflt.hxx
index b315bfc32adb..aa13a3870665 100644
--- a/sc/source/filter/inc/scflt.hxx
+++ b/sc/source/filter/inc/scflt.hxx
@@ -462,15 +462,13 @@ struct Sc10ColData
// Cell-Attribute definition
struct Sc10ColAttr
{
- sal_uInt16 Count;
- Sc10ColData* pData;
+ sal_uInt16 Count;
+ std::unique_ptr<Sc10ColData[]> pData;
Sc10ColAttr()
: Count(0)
- , pData(nullptr)
{
}
- ~Sc10ColAttr() { delete [] pData; }
};
// GraphHeader
diff --git a/sc/source/filter/inc/tokstack.hxx b/sc/source/filter/inc/tokstack.hxx
index e6eb8e3bd4fe..cd18b10ccac0 100644
--- a/sc/source/filter/inc/tokstack.hxx
+++ b/sc/source/filter/inc/tokstack.hxx
@@ -221,7 +221,7 @@ class TokenStack
{
private:
- TokenId* pStack; // Stack as Array
+ std::unique_ptr<TokenId[]> pStack; // Stack as Array
sal_uInt16 nPos; // Write-mark
static const sal_uInt16 nSize = 1024; // first Index outside of stack
public:
diff --git a/sc/source/filter/inc/xilink.hxx b/sc/source/filter/inc/xilink.hxx
index 7a76007b4c56..c6bb1828656e 100644
--- a/sc/source/filter/inc/xilink.hxx
+++ b/sc/source/filter/inc/xilink.hxx
@@ -152,12 +152,12 @@ private:
typedef ::std::unique_ptr< XclImpCachedMatrix > XclImpCachedMatrixPtr;
typedef ::std::unique_ptr< ScTokenArray > TokenArrayPtr;
- XclImpCachedMatrixPtr mxDdeMatrix; /// Cached results of the DDE link.
- MOper* mpMOper; /// Cached values for OLE link
- TokenArrayPtr mxArray; /// Formula tokens for external name.
- OUString maName; /// The name of the external name.
- sal_uInt32 mnStorageId; /// Storage ID for OLE object storages.
- XclImpExtNameType meType; /// Type of the external name.
+ XclImpCachedMatrixPtr mxDdeMatrix; /// Cached results of the DDE link.
+ std::unique_ptr<MOper> mpMOper; /// Cached values for OLE link
+ TokenArrayPtr mxArray; /// Formula tokens for external name.
+ OUString maName; /// The name of the external name.
+ sal_uInt32 mnStorageId; /// Storage ID for OLE object storages.
+ XclImpExtNameType meType; /// Type of the external name.
};
// Import link manager ========================================================
diff --git a/sc/source/filter/lotus/lotattr.cxx b/sc/source/filter/lotus/lotattr.cxx
index 72878ebd0c6a..3d96c4e3247c 100644
--- a/sc/source/filter/lotus/lotattr.cxx
+++ b/sc/source/filter/lotus/lotattr.cxx
@@ -42,7 +42,6 @@ LotAttrCache::ENTRY::ENTRY (ScPatternAttr* p)
LotAttrCache::ENTRY::~ENTRY ()
{
- delete pPattAttr;
}
LotAttrCache::LotAttrCache (LOTUS_ROOT* pLotRoot)
diff --git a/sc/source/filter/lotus/tool.cxx b/sc/source/filter/lotus/tool.cxx
index 729a7a1370c5..3b83d570ce6f 100644
--- a/sc/source/filter/lotus/tool.cxx
+++ b/sc/source/filter/lotus/tool.cxx
@@ -445,14 +445,13 @@ void LotusRangeList::Append( LotusRange* pLR, const OUString& rName )
RangeNameBufferWK3::RangeNameBufferWK3(LOTUS_ROOT* pLotRoot)
: m_pLotRoot(pLotRoot)
+ , pScTokenArray( new ScTokenArray )
{
- pScTokenArray = new ScTokenArray;
nIntCount = 1;
}
RangeNameBufferWK3::~RangeNameBufferWK3()
{
- delete pScTokenArray;
}
void RangeNameBufferWK3::Add( const OUString& rOrgName, const ScComplexRefData& rCRD )
diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx
index 87018f11e8b5..48158d93f258 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -65,7 +65,7 @@ ScEEImport::ScEEImport( ScDocument* pDocP, const ScRange& rRange ) :
{
const ScPatternAttr* pPattern = mpDoc->GetPattern(
maRange.aStart.Col(), maRange.aStart.Row(), maRange.aStart.Tab() );
- mpEngine = new ScTabEditEngine(*pPattern, mpDoc->GetEditPool(), mpDoc->GetEditPool());
+ mpEngine.reset( new ScTabEditEngine(*pPattern, mpDoc->GetEditPool(), mpDoc->GetEditPool()) );
mpEngine->SetUpdateMode( false );
mpEngine->EnableUndo( false );
}
@@ -74,7 +74,6 @@ ScEEImport::~ScEEImport()
{
// Sequence important, or else we crash in some dtor!
// Is guaranteed as ScEEImport is base class
- delete mpEngine; // After Parser!
}
sal_uLong ScEEImport::Read( SvStream& rStream, const OUString& rBaseURL )
diff --git a/sc/source/filter/rtf/expbase.cxx b/sc/source/filter/rtf/expbase.cxx
index c9dc1c340fbe..699306dc5f23 100644
--- a/sc/source/filter/rtf/expbase.cxx
+++ b/sc/source/filter/rtf/expbase.cxx
@@ -34,7 +34,6 @@ ScExportBase::ScExportBase( SvStream& rStrmP, ScDocument* pDocP,
ScExportBase::~ScExportBase()
{
- delete pEditEngine;
}
bool ScExportBase::GetDataArea( SCTAB nTab, SCCOL& nStartCol,
@@ -70,7 +69,7 @@ bool ScExportBase::IsEmptyTable( SCTAB nTab ) const
ScFieldEditEngine& ScExportBase::GetEditEngine() const
{
if ( !pEditEngine )
- const_cast<ScExportBase*>(this)->pEditEngine = new ScFieldEditEngine(pDoc, pDoc->GetEditPool());
+ const_cast<ScExportBase*>(this)->pEditEngine.reset( new ScFieldEditEngine(pDoc, pDoc->GetEditPool()) );
return *pEditEngine;
}
diff --git a/sc/source/filter/rtf/rtfexp.cxx b/sc/source/filter/rtf/rtfexp.cxx
index c2d065d49719..3921b585dca9 100644
--- a/sc/source/filter/rtf/rtfexp.cxx
+++ b/sc/source/filter/rtf/rtfexp.cxx
@@ -58,7 +58,6 @@ ScRTFExport::ScRTFExport( SvStream& rStrmP, ScDocument* pDocP, const ScRange& rR
ScRTFExport::~ScRTFExport()
{
- delete [] pCellX;
}
void ScRTFExport::Write()
diff --git a/sc/source/filter/rtf/rtfimp.cxx b/sc/source/filter/rtf/rtfimp.cxx
index bca3af1bbff6..8a3cd179fa47 100644
--- a/sc/source/filter/rtf/rtfimp.cxx
+++ b/sc/source/filter/rtf/rtfimp.cxx
@@ -43,7 +43,7 @@ ScEEAbsImport *ScFormatFilterPluginImpl::CreateRTFImport( ScDocument* pDoc, cons
ScRTFImport::ScRTFImport( ScDocument* pDocP, const ScRange& rRange ) :
ScEEImport( pDocP, rRange )
{
- mpParser = new ScRTFParser( mpEngine );
+ mpParser = new ScRTFParser( mpEngine.get() );
}
ScRTFImport::~ScRTFImport()
diff --git a/sc/source/filter/starcalc/scflt.cxx b/sc/source/filter/starcalc/scflt.cxx
index 2a82b828c184..9bf381d76d23 100644
--- a/sc/source/filter/starcalc/scflt.cxx
+++ b/sc/source/filter/starcalc/scflt.cxx
@@ -1722,7 +1722,7 @@ void Sc10Import::LoadColAttr(SCCOL Col, SCTAB Tab)
// Font (Name, Size)
nStart = 0;
nLimit = aFont.Count;
- pColData = aFont.pData;
+ pColData = aFont.pData.get();
for( i = 0 ; i < nLimit ; i++, pColData++ )
{
SCROW nEnd = static_cast<SCROW>(pColData->Row);
@@ -1755,7 +1755,7 @@ void Sc10Import::LoadColAttr(SCCOL Col, SCTAB Tab)
// Font color
nStart = 0;
nLimit = aColor.Count;
- pColData = aColor.pData;
+ pColData = aColor.pData.get();
for( i = 0 ; i < nLimit ; i++, pColData++ )
{
SCROW nEnd = static_cast<SCROW>(pColData->Row);
@@ -1773,7 +1773,7 @@ void Sc10Import::LoadColAttr(SCCOL Col, SCTAB Tab)
// Font attributes (Bold, Italic...)
nStart = 0;
nLimit = aAttr.Count;
- pColData = aAttr.pData;
+ pColData = aAttr.pData.get();
for( i = 0 ; i < nLimit ; i++, pColData++ )
{
SCROW nEnd = static_cast<SCROW>(pColData->Row);
@@ -1797,7 +1797,7 @@ void Sc10Import::LoadColAttr(SCCOL Col, SCTAB Tab)
// Cell alignment
nStart = 0;
nLimit = aJustify.Count;
- pColData = aJustify.pData;
+ pColData = aJustify.pData.get();
for( i = 0 ; i < nLimit ; i++, pColData++ )
{
SCROW nEnd = static_cast<SCROW>(pColData->Row);
@@ -2069,7 +2069,7 @@ void Sc10Import::LoadColAttr(SCCOL Col, SCTAB Tab)
// Number format
nStart = 0;
nLimit = aValue.Count;
- pColData = aValue.pData;
+ pColData = aValue.pData.get();
for (i=0; i<nLimit; i++, pColData++)
{
SCROW nEnd = static_cast<SCROW>(pColData->Row);
@@ -2140,7 +2140,7 @@ void Sc10Import::LoadAttr(Sc10ColAttr& rAttr)
if (!rAttr.Count)
return;
- rAttr.pData = new (::std::nothrow) Sc10ColData[rAttr.Count];
+ rAttr.pData.reset( new (::std::nothrow) Sc10ColData[rAttr.Count] );
if (rAttr.pData == nullptr)
{
nError = errOutOfMemory;
diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
index 82d0f78f2c7a..9ba10dee9334 100644
--- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
@@ -540,23 +540,22 @@ XclExpChTrTabIdBuffer::XclExpChTrTabIdBuffer( sal_uInt16 nCount ) :
nBufSize( nCount ),
nLastId( nCount )
{
- pBuffer = new sal_uInt16[ nBufSize ];
- memset( pBuffer, 0, sizeof(sal_uInt16) * nBufSize );
- pLast = pBuffer + nBufSize - 1;
+ pBuffer.reset( new sal_uInt16[ nBufSize ] );
+ memset( pBuffer.get(), 0, sizeof(sal_uInt16) * nBufSize );
+ pLast = pBuffer.get() + nBufSize - 1;
}
XclExpChTrTabIdBuffer::XclExpChTrTabIdBuffer( const XclExpChTrTabIdBuffer& rCopy ) :
nBufSize( rCopy.nBufSize ),
nLastId( rCopy.nLastId )
{
- pBuffer = new sal_uInt16[ nBufSize ];
- memcpy( pBuffer, rCopy.pBuffer, sizeof(sal_uInt16) * nBufSize );
- pLast = pBuffer + nBufSize - 1;
+ pBuffer.reset( new sal_uInt16[ nBufSize ] );
+ memcpy( pBuffer.get(), rCopy.pBuffer.get(), sizeof(sal_uInt16) * nBufSize );
+ pLast = pBuffer.get() + nBufSize - 1;
}
XclExpChTrTabIdBuffer::~XclExpChTrTabIdBuffer()
{
- delete[] pBuffer;
}
void XclExpChTrTabIdBuffer::InitFill( sal_uInt16 nIndex )
@@ -564,7 +563,7 @@ void XclExpChTrTabIdBuffer::InitFill( sal_uInt16 nIndex )
OSL_ENSURE( nIndex < nLastId, "XclExpChTrTabIdBuffer::Insert - out of range" );
sal_uInt16 nFreeCount = 0;
- for( sal_uInt16* pElem = pBuffer; pElem <= pLast; pElem++ )
+ for( sal_uInt16* pElem = pBuffer.get(); pElem <= pLast; pElem++ )
{
if( !*pElem )
nFreeCount++;
@@ -579,7 +578,7 @@ void XclExpChTrTabIdBuffer::InitFill( sal_uInt16 nIndex )
void XclExpChTrTabIdBuffer::InitFillup()
{
sal_uInt16 nFreeCount = 1;
- for( sal_uInt16* pElem = pBuffer; pElem <= pLast; pElem++ )
+ for( sal_uInt16* pElem = pBuffer.get(); pElem <= pLast; pElem++ )
if( !*pElem )
*pElem = nFreeCount++;
nLastId = nBufSize;
@@ -593,8 +592,8 @@ sal_uInt16 XclExpChTrTabIdBuffer::GetId( sal_uInt16 nIndex ) const
void XclExpChTrTabIdBuffer::Remove()
{
- OSL_ENSURE( pBuffer <= pLast, "XclExpChTrTabIdBuffer::Remove - buffer empty" );
- sal_uInt16* pElem = pBuffer;
+ OSL_ENSURE( pBuffer.get() <= pLast, "XclExpChTrTabIdBuffer::Remove - buffer empty" );
+ sal_uInt16* pElem = pBuffer.get();
while( (pElem <= pLast) && (*pElem != nLastId) )
pElem++;
while( pElem < pLast )
@@ -685,7 +684,6 @@ XclExpChTrAction::XclExpChTrAction(
XclExpChTrAction::~XclExpChTrAction()
{
- delete pAddAction;
}
void XclExpChTrAction::SetAddAction( XclExpChTrAction* pAction )
@@ -693,7 +691,7 @@ void XclExpChTrAction::SetAddAction( XclExpChTrAction* pAction )
if( pAddAction )
pAddAction->SetAddAction( pAction );
else
- pAddAction = pAction;
+ pAddAction.reset( pAction );
}
void XclExpChTrAction::AddDependentContents(
diff --git a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
index 0e0ec84a2832..b3f059fea309 100644
--- a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
@@ -51,12 +51,11 @@ ScChangeTrackingExportHelper::ScChangeTrackingExportHelper(ScXMLExport& rTempExp
sChangeIDPrefix(SC_CHANGE_ID_PREFIX)
{
pChangeTrack = rExport.GetDocument() ? rExport.GetDocument()->GetChangeTrack() : nullptr;
- pDependings = new ScChangeActionMap();
+ pDependings.reset( new ScChangeActionMap );
}
ScChangeTrackingExportHelper::~ScChangeTrackingExportHelper()
{
- delete pDependings;
}
OUString ScChangeTrackingExportHelper::GetChangeID(const sal_uInt32 nActionNumber)
diff --git a/sc/source/filter/xml/XMLChangeTrackingExportHelper.hxx b/sc/source/filter/xml/XMLChangeTrackingExportHelper.hxx
index e0f172f3d2a1..674ffb3e63da 100644
--- a/sc/source/filter/xml/XMLChangeTrackingExportHelper.hxx
+++ b/sc/source/filter/xml/XMLChangeTrackingExportHelper.hxx
@@ -23,6 +23,7 @@
#include <xmloff/xmltoken.hxx>
#include <list>
#include <map>
+#include <memory>
#include <tools/solar.h>
#include <com/sun/star/text/XText.hpp>
#include <rtl/ustrbuf.hxx>
@@ -43,7 +44,7 @@ class ScChangeTrackingExportHelper
ScChangeTrack* pChangeTrack;
ScEditEngineTextObj* pEditTextObj;
- ScChangeActionMap* pDependings;
+ std::unique_ptr<ScChangeActionMap> pDependings;
OUString sChangeIDPrefix;
css::uno::Reference<css::text::XText> xText;
diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
index 2aad7356ee5a..0051db3f1b2f 100644
--- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
@@ -86,7 +86,6 @@ ScMyDeleted::ScMyDeleted()
ScMyDeleted::~ScMyDeleted()
{
- delete pCellInfo;
}
ScMyGenerated::ScMyGenerated(ScMyCellInfo* pTempCellInfo, const ScBigRange& aTempBigRange)
@@ -98,7 +97,6 @@ ScMyGenerated::ScMyGenerated(ScMyCellInfo* pTempCellInfo, const ScBigRange& aTem
ScMyGenerated::~ScMyGenerated()
{
- delete pCellInfo;
}
ScMyBaseAction::ScMyBaseAction(const ScChangeActionType nTempActionType)
@@ -136,7 +134,6 @@ ScMyDelAction::ScMyDelAction(const ScChangeActionType nActionTypeP)
ScMyDelAction::~ScMyDelAction()
{
- delete pInsCutOff;
}
ScMyMoveAction::ScMyMoveAction()
@@ -148,7 +145,6 @@ ScMyMoveAction::ScMyMoveAction()
ScMyMoveAction::~ScMyMoveAction()
{
- delete pMoveRanges;
}
ScMyContentAction::ScMyContentAction()
@@ -159,7 +155,6 @@ ScMyContentAction::ScMyContentAction()
ScMyContentAction::~ScMyContentAction()
{
- delete pCellInfo;
}
ScMyRejAction::ScMyRejAction()
@@ -263,7 +258,7 @@ void ScXMLChangeTrackingImportHelper::SetPreviousChange(const sal_uInt32 nPrevio
OSL_ENSURE(pCurrentAction->nActionType == SC_CAT_CONTENT, "wrong action type");
ScMyContentAction* pAction = static_cast<ScMyContentAction*>(pCurrentAction);
pAction->nPreviousAction = nPreviousAction;
- pAction->pCellInfo = pCellInfo;
+ pAction->pCellInfo.reset( pCellInfo );
}
void ScXMLChangeTrackingImportHelper::SetPosition(const sal_Int32 nPosition, const sal_Int32 nCount, const sal_Int32 nTable)
@@ -313,7 +308,7 @@ void ScXMLChangeTrackingImportHelper::AddDeleted(const sal_uInt32 nID, ScMyCellI
{
ScMyDeleted* pDeleted = new ScMyDeleted();
pDeleted->nID = nID;
- pDeleted->pCellInfo = pCellInfo;
+ pDeleted->pCellInfo.reset(pCellInfo);
pCurrentAction->aDeletedList.push_front(pDeleted);
}
@@ -333,7 +328,7 @@ void ScXMLChangeTrackingImportHelper::SetInsertionCutOff(const sal_uInt32 nID, c
if ((pCurrentAction->nActionType == SC_CAT_DELETE_COLS) ||
(pCurrentAction->nActionType == SC_CAT_DELETE_ROWS))
{
- static_cast<ScMyDelAction*>(pCurrentAction)->pInsCutOff = new ScMyInsertionCutOff(nID, nPosition);
+ static_cast<ScMyDelAction*>(pCurrentAction)->pInsCutOff.reset( new ScMyInsertionCutOff(nID, nPosition) );
}
else
{
@@ -358,7 +353,7 @@ void ScXMLChangeTrackingImportHelper::SetMoveRanges(const ScBigRange& aSourceRan
{
if (pCurrentAction->nActionType == SC_CAT_MOVE)
{
- static_cast<ScMyMoveAction*>(pCurrentAction)->pMoveRanges = new ScMyMoveRanges(aSourceRange, aTargetRange);
+ static_cast<ScMyMoveAction*>(pCurrentAction)->pMoveRanges.reset( new ScMyMoveRanges(aSourceRange, aTargetRange) );
}
else
{
diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx
index de5211af8513..81a9c542c195 100644
--- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx
+++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx
@@ -60,7 +60,7 @@ struct ScMyCellInfo
struct ScMyDeleted
{
sal_uInt32 nID;
- ScMyCellInfo* pCellInfo;
+ std::unique_ptr<ScMyCellInfo> pCellInfo;
ScMyDeleted();
~ScMyDeleted();
@@ -72,7 +72,7 @@ struct ScMyGenerated
{
ScBigRange aBigRange;
sal_uInt32 nID;
- ScMyCellInfo* pCellInfo;
+ std::unique_ptr<ScMyCellInfo> pCellInfo;
ScMyGenerated(ScMyCellInfo* pCellInfo, const ScBigRange& aBigRange);
~ScMyGenerated();
@@ -137,7 +137,7 @@ struct ScMyInsAction : public ScMyBaseAction
struct ScMyDelAction : public ScMyBaseAction
{
ScMyGeneratedList aGeneratedList;
- ScMyInsertionCutOff* pInsCutOff;
+ std::unique_ptr<ScMyInsertionCutOff> pInsCutOff;
ScMyMoveCutOffs aMoveCutOffs;
sal_Int32 nD;
@@ -148,7 +148,7 @@ struct ScMyDelAction : public ScMyBaseAction
struct ScMyMoveAction : public ScMyBaseAction
{
ScMyGeneratedList aGeneratedList;
- ScMyMoveRanges* pMoveRanges;
+ std::unique_ptr<ScMyMoveRanges> pMoveRanges;
ScMyMoveAction();
virtual ~ScMyMoveAction() override;
@@ -156,7 +156,7 @@ struct ScMyMoveAction : public ScMyBaseAction
struct ScMyContentAction : public ScMyBaseAction
{
- ScMyCellInfo* pCellInfo;
+ std::unique_ptr<ScMyCellInfo> pCellInfo;
ScMyContentAction();
virtual ~ScMyContentAction() override;
diff --git a/sc/source/filter/xml/XMLStylesImportHelper.cxx b/sc/source/filter/xml/XMLStylesImportHelper.cxx
index 1cf65b434584..43d7e9a51ec5 100644
--- a/sc/source/filter/xml/XMLStylesImportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesImportHelper.cxx
@@ -47,7 +47,6 @@ ScMyStyleRanges::ScMyStyleRanges() :
ScMyStyleRanges::~ScMyStyleRanges()
{
- delete pCurrencyList;
}
void ScMyStyleRanges::AddRange(const ScRange& rRange, const sal_Int16 nType)
@@ -114,7 +113,7 @@ void ScMyStyleRanges::AddRange(const ScRange& rRange, const sal_Int16 nType)
void ScMyStyleRanges::AddCurrencyRange(const ScRange& rRange, const OUString* pCurrency)
{
if (!pCurrencyList)
- pCurrencyList = new ScMyCurrencyStylesSet();
+ pCurrencyList.reset( new ScMyCurrencyStylesSet );
ScMyCurrencyStyle aStyle;
if (pCurrency)
aStyle.sCurrency = *pCurrency;
diff --git a/sc/source/filter/xml/XMLStylesImportHelper.hxx b/sc/source/filter/xml/XMLStylesImportHelper.hxx
index 3caa5b659e46..feedc16668de 100644
--- a/sc/source/filter/xml/XMLStylesImportHelper.hxx
+++ b/sc/source/filter/xml/XMLStylesImportHelper.hxx
@@ -84,14 +84,14 @@ typedef std::set<ScMyCurrencyStyle, LessCurrencyStyle> ScMyCurrencyStylesSet;
class ScMyStyleRanges : public SvRefBase
{
- std::shared_ptr<ScSimpleRangeList> mpTextList;
- std::shared_ptr<ScSimpleRangeList> mpNumberList;
- std::shared_ptr<ScSimpleRangeList> mpTimeList;
- std::shared_ptr<ScSimpleRangeList> mpDateTimeList;
- std::shared_ptr<ScSimpleRangeList> mpPercentList;
- std::shared_ptr<ScSimpleRangeList> mpLogicalList;
- std::shared_ptr<ScSimpleRangeList> mpUndefinedList;
- ScMyCurrencyStylesSet* pCurrencyList;
+ std::shared_ptr<ScSimpleRangeList> mpTextList;
+ std::shared_ptr<ScSimpleRangeList> mpNumberList;
+ std::shared_ptr<ScSimpleRangeList> mpTimeList;
+ std::shared_ptr<ScSimpleRangeList> mpDateTimeList;
+ std::shared_ptr<ScSimpleRangeList> mpPercentList;
+ std::shared_ptr<ScSimpleRangeList> mpLogicalList;
+ std::shared_ptr<ScSimpleRangeList> mpUndefinedList;
+ std::unique_ptr<ScMyCurrencyStylesSet> pCurrencyList;
static void SetStylesToRanges(const ::std::list<ScRange>& rList,
const OUString* pStyleName, const sal_Int16 nCellType,
diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
index 4e6803d9e1c2..ce91d11ef089 100644
--- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx
+++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
@@ -178,7 +178,8 @@ class ScXMLChangeTextPContext : public ScXMLImportContext
OUString sLName;
OUStringBuffer sText;
ScXMLChangeCellContext* pChangeCellContext;
- SvXMLImportContext* pTextPContext;
+ std::unique_ptr<SvXMLImportContext>
+ pTextPContext;
sal_uInt16 nPrefix;
public:
@@ -188,8 +189,6 @@ public:
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
ScXMLChangeCellContext* pChangeCellContext);
- virtual ~ScXMLChangeTextPContext() override;
-
virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
@@ -849,11 +848,6 @@ ScXMLChangeTextPContext::ScXMLChangeTextPContext( ScXMLImport& rImport,
// here are no attributes
}
-ScXMLChangeTextPContext::~ScXMLChangeTextPContext()
-{
- delete pTextPContext;
-}
-
SvXMLImportContext *ScXMLChangeTextPContext::CreateChildContext( sal_uInt16 nTempPrefix,
const OUString& rLName,
const css::uno::Reference<css::xml::sax::XAttributeList>& xTempAttrList )
@@ -888,8 +882,8 @@ SvXMLImportContext *ScXMLChangeTextPContext::CreateChildContext( sal_uInt16 nTem
if (!pTextPContext)
{
bWasContext = false;
- pTextPContext = GetScImport().GetTextImport()->CreateTextChildContext(
- GetScImport(), nPrefix, sLName, xAttrList);
+ pTextPContext.reset( GetScImport().GetTextImport()->CreateTextChildContext(
+ GetScImport(), nPrefix, sLName, xAttrList) );
}
if (pTextPContext)
{
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 8fd7edae9d15..fb8783ce38f7 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -113,7 +113,6 @@ ScXMLTableRowCellContext::Field::Field(SvxFieldData* pData) : mpData(pData) {}
ScXMLTableRowCellContext::Field::~Field()
{
- delete mpData;
}
ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
diff --git a/sc/source/filter/xml/xmlcelli.hxx b/sc/source/filter/xml/xmlcelli.hxx
index 9765ca7440ac..8831e7d0ebfa 100644
--- a/sc/source/filter/xml/xmlcelli.hxx
+++ b/sc/source/filter/xml/xmlcelli.hxx
@@ -48,7 +48,7 @@ class ScXMLTableRowCellContext : public ScXMLImportContext
struct Field
{
- SvxFieldData* mpData;
+ std::unique_ptr<SvxFieldData> mpData;
ESelection maSelection;
Field(const Field&) = delete;
diff --git a/sc/source/filter/xml/xmldpimp.cxx b/sc/source/filter/xml/xmldpimp.cxx
index fda35975a24a..be256ea7d21c 100644
--- a/sc/source/filter/xml/xmldpimp.cxx
+++ b/sc/source/filter/xml/xmldpimp.cxx
@@ -215,7 +215,6 @@ ScXMLDataPilotTableContext::ScXMLDataPilotTableContext( ScXMLImport& rImport,
ScXMLDataPilotTableContext::~ScXMLDataPilotTableContext()
{
- delete pDPDimSaveData;
}
SvXMLImportContext *ScXMLDataPilotTableContext::CreateChildContext( sal_uInt16 nPrefix,
@@ -453,14 +452,14 @@ void ScXMLDataPilotTableContext::AddDimension(ScDPSaveDimension* pDim)
void ScXMLDataPilotTableContext::AddGroupDim(const ScDPSaveNumGroupDimension& aNumGroupDim)
{
if (!pDPDimSaveData)
- pDPDimSaveData = new ScDPDimensionSaveData();
+ pDPDimSaveData.reset( new ScDPDimensionSaveData );
pDPDimSaveData->AddNumGroupDimension(aNumGroupDim);
}
void ScXMLDataPilotTableContext::AddGroupDim(const ScDPSaveGroupDimension& aGroupDim)
{
if (!pDPDimSaveData)
- pDPDimSaveData = new ScDPDimensionSaveData();
+ pDPDimSaveData.reset( new ScDPDimensionSaveData );
pDPDimSaveData->AddGroupDimension(aGroupDim);
}
@@ -545,7 +544,7 @@ void ScXMLDataPilotTableContext::EndElement()
pDPSave->SetFilterButton(bShowFilter);
pDPSave->SetDrillDown(bDrillDown);
if (pDPDimSaveData)
- pDPSave->SetDimensionData(pDPDimSaveData);
+ pDPSave->SetDimensionData(pDPDimSaveData.get());
pDPObject->SetSaveData(*pDPSave);
ScDPCollection* pDPCollection = pDoc->GetDPCollection();
diff --git a/sc/source/filter/xml/xmldpimp.hxx b/sc/source/filter/xml/xmldpimp.hxx
index 6749b1d5a126..09e29fc217a5 100644
--- a/sc/source/filter/xml/xmldpimp.hxx
+++ b/sc/source/filter/xml/xmldpimp.hxx
@@ -77,7 +77,7 @@ class ScXMLDataPilotTableContext : public ScXMLImportContext
ScDocument* pDoc;
ScDPObject* pDPObject;
std::unique_ptr<ScDPSaveData> pDPSave;
- ScDPDimensionSaveData* pDPDimSaveData;
+ std::unique_ptr<ScDPDimensionSaveData> pDPDimSaveData;
GrandTotalItem maRowGrandTotal;
GrandTotalItem maColGrandTotal;
OUString sDataPilotTableName;
@@ -411,7 +411,7 @@ public:
class ScXMLDataPilotSubTotalsContext : public ScXMLImportContext
{
- ScXMLDataPilotFieldContext* pDataPilotField;
+ ScXMLDataPilotFieldContext* pDataPilotField;
std::vector<sal_uInt16> maFunctions;
OUString maDisplayName;
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;
}