summaryrefslogtreecommitdiff
path: root/sc/source/filter/xml/xmlnexpi.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-09-03 20:34:32 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-09-04 14:00:43 +0200
commit10d86d8526126956758501604f1bd2e3fe102076 (patch)
tree58f8e587589eb1a1790133fdef4614ed19749e8d /sc/source/filter/xml/xmlnexpi.cxx
parent5f0a01ce47133de31a7f8e43d8ef5e9851a7ceb7 (diff)
no need to allocate ScMyNamedExpression with unique_ptr
Change-Id: I853aee13d3afc25e7e1ec1aa0d1a41dba7de0fb2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121623 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/filter/xml/xmlnexpi.cxx')
-rw-r--r--sc/source/filter/xml/xmlnexpi.cxx39
1 files changed, 19 insertions, 20 deletions
diff --git a/sc/source/filter/xml/xmlnexpi.cxx b/sc/source/filter/xml/xmlnexpi.cxx
index 3d4286985d61..0f07ea5defa6 100644
--- a/sc/source/filter/xml/xmlnexpi.cxx
+++ b/sc/source/filter/xml/xmlnexpi.cxx
@@ -29,18 +29,17 @@ using namespace xmloff::token;
ScXMLNamedExpressionsContext::GlobalInserter::GlobalInserter(ScXMLImport& rImport) : mrImport(rImport) {}
-void ScXMLNamedExpressionsContext::GlobalInserter::insert(ScMyNamedExpression* pExp)
+void ScXMLNamedExpressionsContext::GlobalInserter::insert(ScMyNamedExpression aExp)
{
- if (pExp)
- mrImport.AddNamedExpression(pExp);
+ mrImport.AddNamedExpression(std::move(aExp));
}
ScXMLNamedExpressionsContext::SheetLocalInserter::SheetLocalInserter(ScXMLImport& rImport, SCTAB nTab) :
mrImport(rImport), mnTab(nTab) {}
-void ScXMLNamedExpressionsContext::SheetLocalInserter::insert(ScMyNamedExpression* pExp)
+void ScXMLNamedExpressionsContext::SheetLocalInserter::insert(ScMyNamedExpression aExp)
{
- mrImport.AddNamedExpression(mnTab, pExp);
+ mrImport.AddNamedExpression(mnTab, std::move(aExp));
}
ScXMLNamedExpressionsContext::ScXMLNamedExpressionsContext(
@@ -88,10 +87,10 @@ ScXMLNamedRangeContext::ScXMLNamedRangeContext(
if (!pInserter)
return;
- ScMyNamedExpression* pNamedExpression(new ScMyNamedExpression);
+ ScMyNamedExpression aNamedExpression;
// A simple table:cell-range-address is not a formula expression, stored
// without [] brackets but with dot, .A1
- pNamedExpression->eGrammar = formula::FormulaGrammar::mergeToGrammar(
+ aNamedExpression.eGrammar = formula::FormulaGrammar::mergeToGrammar(
GetScImport().GetDocument()->GetStorageGrammar(),
formula::FormulaGrammar::CONV_OOO);
@@ -102,22 +101,22 @@ ScXMLNamedRangeContext::ScXMLNamedRangeContext(
switch (aIter.getToken())
{
case XML_ELEMENT( TABLE, XML_NAME ):
- pNamedExpression->sName = aIter.toString();
+ aNamedExpression.sName = aIter.toString();
break;
case XML_ELEMENT( TABLE, XML_CELL_RANGE_ADDRESS ):
- pNamedExpression->sContent = aIter.toString();
+ aNamedExpression.sContent = aIter.toString();
break;
case XML_ELEMENT( TABLE, XML_BASE_CELL_ADDRESS ):
- pNamedExpression->sBaseCellAddress = aIter.toString();
+ aNamedExpression.sBaseCellAddress = aIter.toString();
break;
case XML_ELEMENT( TABLE, XML_RANGE_USABLE_AS ):
- pNamedExpression->sRangeType = aIter.toString();
+ aNamedExpression.sRangeType = aIter.toString();
break;
}
}
}
- pNamedExpression->bIsExpression = false;
- pInserter->insert(pNamedExpression);
+ aNamedExpression.bIsExpression = false;
+ pInserter->insert(std::move(aNamedExpression));
}
ScXMLNamedRangeContext::~ScXMLNamedRangeContext()
@@ -133,7 +132,7 @@ ScXMLNamedExpressionContext::ScXMLNamedExpressionContext(
if (!pInserter)
return;
- ScMyNamedExpression* pNamedExpression(new ScMyNamedExpression);
+ ScMyNamedExpression aNamedExpression;
if ( rAttrList.is() )
{
@@ -142,21 +141,21 @@ ScXMLNamedExpressionContext::ScXMLNamedExpressionContext(
switch (aIter.getToken())
{
case XML_ELEMENT( TABLE, XML_NAME ):
- pNamedExpression->sName = aIter.toString();
+ aNamedExpression.sName = aIter.toString();
break;
case XML_ELEMENT( TABLE, XML_EXPRESSION ):
GetScImport().ExtractFormulaNamespaceGrammar(
- pNamedExpression->sContent, pNamedExpression->sContentNmsp,
- pNamedExpression->eGrammar, aIter.toString() );
+ aNamedExpression.sContent, aNamedExpression.sContentNmsp,
+ aNamedExpression.eGrammar, aIter.toString() );
break;
case XML_ELEMENT( TABLE, XML_BASE_CELL_ADDRESS ):
- pNamedExpression->sBaseCellAddress = aIter.toString();
+ aNamedExpression.sBaseCellAddress = aIter.toString();
break;
}
}
}
- pNamedExpression->bIsExpression = true;
- pInserter->insert(pNamedExpression);
+ aNamedExpression.bIsExpression = true;
+ pInserter->insert(std::move(aNamedExpression));
}
ScXMLNamedExpressionContext::~ScXMLNamedExpressionContext()