summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-07-14 14:36:52 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-07-17 07:23:22 +0200
commitdb3860062ebf4109f48139c2556ff4041aff5d6e (patch)
treeb6ab4df909c8922e48a9c4eefa9a8f0f6a47c41f /sc
parent846f557fd591626931a9dadb38180786e090104c (diff)
extend loplugin useuniqueptr to OUString pointers
Change-Id: Ieb5bab3895e1edaff497c4a1a88303ccac097edc Reviewed-on: https://gerrit.libreoffice.org/39948 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/chartarr.hxx4
-rw-r--r--sc/source/core/tool/chartarr.cxx6
-rw-r--r--sc/source/filter/html/htmlpars.cxx10
-rw-r--r--sc/source/filter/inc/eeparser.hxx12
-rw-r--r--sc/source/filter/xml/XMLStylesImportHelper.cxx37
-rw-r--r--sc/source/filter/xml/XMLStylesImportHelper.hxx12
6 files changed, 35 insertions, 46 deletions
diff --git a/sc/inc/chartarr.hxx b/sc/inc/chartarr.hxx
index 57feca6d91a1..57013e9b0034 100644
--- a/sc/inc/chartarr.hxx
+++ b/sc/inc/chartarr.hxx
@@ -37,8 +37,8 @@ class ScMemChart
SCROW nRowCnt;
SCCOL nColCnt;
std::unique_ptr<double[]> pData;
- OUString* pColText;
- OUString* pRowText;
+ std::unique_ptr<OUString[]> pColText;
+ std::unique_ptr<OUString[]> pRowText;
ScMemChart(const ScMemChart& rMemChart) = delete;
diff --git a/sc/source/core/tool/chartarr.cxx b/sc/source/core/tool/chartarr.cxx
index ef89cbeb0710..6ce768b69543 100644
--- a/sc/source/core/tool/chartarr.cxx
+++ b/sc/source/core/tool/chartarr.cxx
@@ -47,14 +47,12 @@ ScMemChart::ScMemChart(SCCOL nCols, SCROW nRows)
memset( pData.get(), 0.0, nColCnt * nRowCnt );
- pColText = new OUString[nColCnt];
- pRowText = new OUString[nRowCnt];
+ pColText.reset( new OUString[nColCnt] );
+ pRowText.reset( new OUString[nRowCnt] );
}
ScMemChart::~ScMemChart()
{
- delete[] pRowText;
- delete[] pColText;
}
ScChartArray::ScChartArray( ScDocument* pDoc, SCTAB nTab,
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 99769779ffb9..11795a5ff086 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1012,12 +1012,12 @@ void ScHTMLLayoutParser::TableDataOn( HtmlImportInfo* pInfo )
break;
case HtmlOptionId::SDVAL:
{
- pActEntry->pValStr = new OUString( rOption.GetString() );
+ pActEntry->pValStr.reset( new OUString( rOption.GetString() ) );
}
break;
case HtmlOptionId::SDNUM:
{
- pActEntry->pNumStr = new OUString( rOption.GetString() );
+ pActEntry->pNumStr.reset( new OUString( rOption.GetString() ) );
}
break;
default: break;
@@ -1453,7 +1453,7 @@ void ScHTMLLayoutParser::AnchorOn( HtmlImportInfo* pInfo )
for (const auto & rOption : rOptions)
{
if( rOption.GetToken() == HtmlOptionId::NAME )
- pActEntry->pName = new OUString(rOption.GetString());
+ pActEntry->pName.reset( new OUString(rOption.GetString()) );
}
}
@@ -2160,8 +2160,8 @@ void ScHTMLTable::DataOn( const HtmlImportInfo& rInfo )
ProcessFormatOptions( *mxDataItemSet, rInfo );
CreateNewEntry( rInfo );
- mxCurrEntry->pValStr = pValStr.release();
- mxCurrEntry->pNumStr = pNumStr.release();
+ mxCurrEntry->pValStr.reset( pValStr.release() );
+ mxCurrEntry->pNumStr.reset( pNumStr.release() );
}
else
CreateNewEntry( rInfo );
diff --git a/sc/source/filter/inc/eeparser.hxx b/sc/source/filter/inc/eeparser.hxx
index 280446e076b7..9ecf023f59f9 100644
--- a/sc/source/filter/inc/eeparser.hxx
+++ b/sc/source/filter/inc/eeparser.hxx
@@ -51,9 +51,12 @@ struct ScEEParseEntry
{
SfxItemSet aItemSet;
ESelection aSel; // Selection in EditEngine
- OUString* pValStr; // HTML possibly SDVAL string
- OUString* pNumStr; // HTML possibly SDNUM string
- OUString* pName; // HTML possibly anchor/RangeName
+ std::unique_ptr<OUString>
+ pValStr; // HTML possibly SDVAL string
+ std::unique_ptr<OUString>
+ pNumStr; // HTML possibly SDNUM string
+ std::unique_ptr<OUString>
+ pName; // HTML possibly anchor/RangeName
OUString aAltText; // HTML IMG ALT Text
std::vector< std::unique_ptr<ScHTMLImage> > maImageList; // graphics in this cell
SCCOL nCol; // relative to the beginning of the parse
@@ -85,9 +88,6 @@ struct ScEEParseEntry
~ScEEParseEntry()
{
- delete pValStr;
- delete pNumStr;
- delete pName;
maImageList.clear();
}
};
diff --git a/sc/source/filter/xml/XMLStylesImportHelper.cxx b/sc/source/filter/xml/XMLStylesImportHelper.cxx
index a1f1b08eff6e..28142107b0d1 100644
--- a/sc/source/filter/xml/XMLStylesImportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesImportHelper.cxx
@@ -250,21 +250,13 @@ ScMyStylesImportHelper::ScMyStylesImportHelper(ScXMLImport& rTempImport)
ScMyStylesImportHelper::~ScMyStylesImportHelper()
{
- delete pPrevStyleName;
- delete pPrevCurrency;
- delete pStyleName;
- delete pCurrency;
}
void ScMyStylesImportHelper::ResetAttributes()
{
- delete pPrevStyleName;
- delete pPrevCurrency;
- pPrevStyleName = pStyleName;
- pPrevCurrency = pCurrency;
+ pPrevStyleName.reset( pStyleName.release() );
+ pPrevCurrency.reset( pCurrency.release() );
nPrevCellType = nCellType;
- pStyleName = nullptr;
- pCurrency = nullptr;
nCellType = 0;
}
@@ -311,8 +303,7 @@ void ScMyStylesImportHelper::AddDefaultRange(const ScRange& rRange)
ScRange aRange(rRange);
aRange.aStart.SetCol(nStartCol);
aRange.aEnd.SetCol(i - 1);
- delete pPrevStyleName;
- pPrevStyleName = new OUString(aPrevItr->sStyleName);
+ pPrevStyleName.reset( new OUString(aPrevItr->sStyleName) );
AddSingleRange(aRange);
nStartCol = i;
aPrevItr = aColDefaultStyles[i];
@@ -322,8 +313,7 @@ void ScMyStylesImportHelper::AddDefaultRange(const ScRange& rRange)
{
ScRange aRange(rRange);
aRange.aStart.SetCol(nStartCol);
- delete pPrevStyleName;
- pPrevStyleName = new OUString(aPrevItr->sStyleName);
+ pPrevStyleName.reset( new OUString(aPrevItr->sStyleName) );
AddSingleRange(aRange);
}
else
@@ -338,21 +328,20 @@ void ScMyStylesImportHelper::AddDefaultRange(const ScRange& rRange)
}
else
{
- delete pPrevStyleName;
- pPrevStyleName = new OUString(aRowDefaultStyle->sStyleName);
+ pPrevStyleName.reset( new OUString(aRowDefaultStyle->sStyleName) );
AddSingleRange(rRange);
}
}
void ScMyStylesImportHelper::AddSingleRange(const ScRange& rRange)
{
- ScMyStylesSet::iterator aItr(GetIterator(pPrevStyleName));
+ ScMyStylesSet::iterator aItr(GetIterator(pPrevStyleName.get()));
if (aItr != aCellStyles.end())
{
if (nPrevCellType != util::NumberFormat::CURRENCY)
aItr->xRanges->AddRange(rRange, nPrevCellType);
else
- aItr->xRanges->AddCurrencyRange(rRange, pPrevCurrency);
+ aItr->xRanges->AddCurrencyRange(rRange, pPrevCurrency.get());
}
}
@@ -383,11 +372,9 @@ void ScMyStylesImportHelper::SetRowStyle(const OUString& sStyleName)
void ScMyStylesImportHelper::SetAttributes(OUString* pStyleNameP,
OUString* pCurrencyP, const sal_Int16 nCellTypeP)
{
- delete this->pStyleName;
- delete this->pCurrency;
- this->pStyleName = pStyleNameP;
- this->pCurrency = pCurrencyP;
- this->nCellType = nCellTypeP;
+ pStyleName.reset( pStyleNameP );
+ pCurrency.reset( pCurrencyP );
+ nCellType = nCellTypeP;
}
void ScMyStylesImportHelper::AddRange(const ScRange& rRange)
@@ -396,8 +383,8 @@ void ScMyStylesImportHelper::AddRange(const ScRange& rRange)
{
bool bAddRange(false);
if (nCellType == nPrevCellType &&
- IsEqual(pStyleName, pPrevStyleName) &&
- IsEqual(pCurrency, pPrevCurrency))
+ IsEqual(pStyleName.get(), pPrevStyleName.get()) &&
+ IsEqual(pCurrency.get(), pPrevCurrency.get()))
{
if (rRange.aStart.Row() == aPrevRange.aStart.Row())
{
diff --git a/sc/source/filter/xml/XMLStylesImportHelper.hxx b/sc/source/filter/xml/XMLStylesImportHelper.hxx
index 7907726d27b4..a9eadfaeef90 100644
--- a/sc/source/filter/xml/XMLStylesImportHelper.hxx
+++ b/sc/source/filter/xml/XMLStylesImportHelper.hxx
@@ -128,10 +128,14 @@ class ScMyStylesImportHelper
std::vector<ScMyStylesSet::iterator> aColDefaultStyles;
ScMyStylesSet::iterator aRowDefaultStyle;
ScXMLImport& rImport;
- OUString* pStyleName;
- OUString* pPrevStyleName;
- OUString* pCurrency;
- OUString* pPrevCurrency;
+ std::unique_ptr<OUString>
+ pStyleName;
+ std::unique_ptr<OUString>
+ pPrevStyleName;
+ std::unique_ptr<OUString>
+ pCurrency;
+ std::unique_ptr<OUString>
+ pPrevCurrency;
ScRange aPrevRange;
sal_Int16 nCellType;
sal_Int16 nPrevCellType;