summaryrefslogtreecommitdiff
path: root/sc/source/filter/xml
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/filter/xml
parent7c817d73402583f1b077d31a695c565a53468887 (diff)
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/filter/xml')
-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
11 files changed, 31 insertions, 45 deletions
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;