summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-06-01 13:41:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-06-02 18:23:45 +0200
commit6783afe24d43a1bfd0b0239d3ebb97046177111d (patch)
tree03c717a9a6353bafb2fe2b278a307fddf75f494f /sc
parent3d9bf9eea5803184da8e5e11477b6eb2f55aff3f (diff)
no need to allocate these on the heap
Change-Id: Ie11353c8711e970cc20059227d8283c79e4b126d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116586 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/documen8.cxx4
-rw-r--r--sc/source/core/data/simpleformulacalc.cxx4
-rw-r--r--sc/source/core/data/stlpool.cxx42
-rw-r--r--sc/source/core/tool/chgtrack.cxx4
-rw-r--r--sc/source/core/tool/interpr4.cxx6
5 files changed, 30 insertions, 30 deletions
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 0e7761d7b087..d9321a6634cb 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -570,7 +570,7 @@ bool ScDocument::IdleCalcTextWidth() // true = try next again
aScope.setCol(pTab->ClampToAllocatedColumns(aScope.Col()));
// Start at specified cell position (nCol, nRow, nTab).
ScColumn* pCol = &pTab->aCol[aScope.Col()];
- std::unique_ptr<ScColumnTextWidthIterator> pColIter(new ScColumnTextWidthIterator(*this, *pCol, aScope.Row(), MaxRow()));
+ std::optional<ScColumnTextWidthIterator> pColIter(std::in_place, *this, *pCol, aScope.Row(), MaxRow());
OutputDevice* pDev = nullptr;
sal_uInt16 nRestart = 0;
@@ -667,7 +667,7 @@ bool ScDocument::IdleCalcTextWidth() // true = try next again
if ( nZoom > 0 )
{
pCol = &pTab->aCol[aScope.Col()];
- pColIter.reset(new ScColumnTextWidthIterator(*this, *pCol, aScope.Row(), MaxRow()));
+ pColIter.emplace(*this, *pCol, aScope.Row(), MaxRow());
}
else
{
diff --git a/sc/source/core/data/simpleformulacalc.cxx b/sc/source/core/data/simpleformulacalc.cxx
index ad26a135c98c..5959d08318d2 100644
--- a/sc/source/core/data/simpleformulacalc.cxx
+++ b/sc/source/core/data/simpleformulacalc.cxx
@@ -50,8 +50,8 @@ void ScSimpleFormulaCalculator::Calculate()
if (mbMatrixFormula)
aInt.AssertFormulaMatrix();
- std::unique_ptr<sfx2::LinkManager> pNewLinkMgr( new sfx2::LinkManager(mrDoc.GetDocumentShell()) );
- aInt.SetLinkManager( pNewLinkMgr.get() );
+ sfx2::LinkManager aNewLinkMgr( mrDoc.GetDocumentShell() );
+ aInt.SetLinkManager( &aNewLinkMgr );
formula::StackVar aIntType = aInt.Interpret();
if ( aIntType == formula::svMatrixCell )
diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx
index 51e7f6c09e1c..3939978633f3 100644
--- a/sc/source/core/data/stlpool.cxx
+++ b/sc/source/core/data/stlpool.cxx
@@ -217,9 +217,9 @@ void ScStyleSheetPool::CreateStandardStyles()
const OUString aHelpFile;//which text???
SfxItemSet* pSet = nullptr;
SfxItemSet* pHFSet = nullptr;
- std::unique_ptr<ScEditEngineDefaulter> pEdEngine(new ScEditEngineDefaulter( EditEngine::CreatePool().get(), true ));
- pEdEngine->SetUpdateMode( false );
- std::unique_ptr<EditTextObject> pEmptyTxtObj = pEdEngine->CreateTextObject();
+ ScEditEngineDefaulter aEdEngine( EditEngine::CreatePool().get(), true );
+ aEdEngine.SetUpdateMode( false );
+ std::unique_ptr<EditTextObject> pEmptyTxtObj = aEdEngine.CreateTextObject();
std::unique_ptr<EditTextObject> pTxtObj;
ScPageHFItem aHeaderItem( ATTR_PAGE_HEADERRIGHT );
ScPageHFItem aFooterItem( ATTR_PAGE_FOOTERRIGHT );
@@ -284,9 +284,9 @@ void ScStyleSheetPool::CreateStandardStyles()
// Header:
// [empty][\sheet\][empty]
- pEdEngine->SetTextCurrentDefaults(EMPTY_OUSTRING);
- pEdEngine->QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), ESelection() );
- pTxtObj = pEdEngine->CreateTextObject();
+ aEdEngine.SetTextCurrentDefaults(EMPTY_OUSTRING);
+ aEdEngine.QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), ESelection() );
+ pTxtObj = aEdEngine.CreateTextObject();
aHeaderItem.SetLeftArea ( *pEmptyTxtObj );
aHeaderItem.SetCenterArea( *pTxtObj );
aHeaderItem.SetRightArea ( *pEmptyTxtObj );
@@ -296,10 +296,10 @@ void ScStyleSheetPool::CreateStandardStyles()
// [empty][Page \STR_PAGE\][empty]
aStr = SCSTR( STR_PAGE ) + " ";
- pEdEngine->SetTextCurrentDefaults( aStr );
+ aEdEngine.SetTextCurrentDefaults( aStr );
nStrLen = aStr.getLength();
- pEdEngine->QuickInsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(0,nStrLen,0,nStrLen) );
- pTxtObj = pEdEngine->CreateTextObject();
+ aEdEngine.QuickInsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(0,nStrLen,0,nStrLen) );
+ pTxtObj = aEdEngine.CreateTextObject();
aFooterItem.SetLeftArea ( *pEmptyTxtObj );
aFooterItem.SetCenterArea( *pTxtObj );
aFooterItem.SetRightArea ( *pEmptyTxtObj );
@@ -342,18 +342,18 @@ void ScStyleSheetPool::CreateStandardStyles()
// [\TABLE\ (\DATA\)][empty][\DATE\, \TIME\]
aStr = " ()";
- pEdEngine->SetTextCurrentDefaults( aStr );
- pEdEngine->QuickInsertField( SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD), ESelection(0,2,0,2) );
- pEdEngine->QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), ESelection() );
- pTxtObj = pEdEngine->CreateTextObject();
+ aEdEngine.SetTextCurrentDefaults( aStr );
+ aEdEngine.QuickInsertField( SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD), ESelection(0,2,0,2) );
+ aEdEngine.QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), ESelection() );
+ pTxtObj = aEdEngine.CreateTextObject();
aHeaderItem.SetLeftArea( *pTxtObj );
aHeaderItem.SetCenterArea( *pEmptyTxtObj );
aStr = ", ";
- pEdEngine->SetTextCurrentDefaults( aStr );
- pEdEngine->QuickInsertField( SvxFieldItem(SvxTimeField(), EE_FEATURE_FIELD), ESelection(0,2,0,2) );
- pEdEngine->QuickInsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SvxDateType::Var), EE_FEATURE_FIELD),
+ aEdEngine.SetTextCurrentDefaults( aStr );
+ aEdEngine.QuickInsertField( SvxFieldItem(SvxTimeField(), EE_FEATURE_FIELD), ESelection(0,2,0,2) );
+ aEdEngine.QuickInsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SvxDateType::Var), EE_FEATURE_FIELD),
ESelection() );
- pTxtObj = pEdEngine->CreateTextObject();
+ pTxtObj = aEdEngine.CreateTextObject();
aHeaderItem.SetRightArea( *pTxtObj );
pSet->Put( aHeaderItem );
@@ -364,10 +364,10 @@ void ScStyleSheetPool::CreateStandardStyles()
nStrLen = aStr.getLength();
aStr += " / ";
sal_Int32 nStrLen2 = aStr.getLength();
- pEdEngine->SetTextCurrentDefaults( aStr );
- pEdEngine->QuickInsertField( SvxFieldItem(SvxPagesField(), EE_FEATURE_FIELD), ESelection(0,nStrLen2,0,nStrLen2) );
- pEdEngine->QuickInsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(0,nStrLen,0,nStrLen) );
- pTxtObj = pEdEngine->CreateTextObject();
+ aEdEngine.SetTextCurrentDefaults( aStr );
+ aEdEngine.QuickInsertField( SvxFieldItem(SvxPagesField(), EE_FEATURE_FIELD), ESelection(0,nStrLen2,0,nStrLen2) );
+ aEdEngine.QuickInsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(0,nStrLen,0,nStrLen) );
+ pTxtObj = aEdEngine.CreateTextObject();
aFooterItem.SetLeftArea ( *pEmptyTxtObj );
aFooterItem.SetCenterArea( *pTxtObj );
aFooterItem.SetRightArea ( *pEmptyTxtObj );
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index ebe614ed7b81..d68009446dcc 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -1746,8 +1746,8 @@ void ScChangeActionContent::GetFormulaString(
else
{
OSL_FAIL( "ScChangeActionContent::GetFormulaString: aPos != pCell->aPos" );
- std::unique_ptr<ScFormulaCell> pNew(new ScFormulaCell( *pCell, pCell->GetDocument(), aPos ));
- pNew->GetFormula( rStr );
+ ScFormulaCell aNew( *pCell, pCell->GetDocument(), aPos );
+ aNew.GetFormula( rStr );
}
}
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index da1edb25c922..288d01d2eacc 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3572,7 +3572,7 @@ void ScInterpreter::ScTableOp()
PushIllegalParameter();
return;
}
- std::unique_ptr<ScInterpreterTableOpParams> pTableOp(new ScInterpreterTableOpParams);
+ std::optional<ScInterpreterTableOpParams> pTableOp(std::in_place);
if (nParamCount == 5)
{
PopSingleRef( pTableOp->aNew2 );
@@ -3583,7 +3583,7 @@ void ScInterpreter::ScTableOp()
PopSingleRef( pTableOp->aFormulaPos );
pTableOp->bValid = true;
- mrDoc.m_TableOpList.push_back(pTableOp.get());
+ mrDoc.m_TableOpList.push_back(&*pTableOp);
mrDoc.IncInterpreterTableOpLevel();
bool bReuseLastParams = (mrDoc.aLastTableOpParams == *pTableOp);
@@ -3621,7 +3621,7 @@ void ScInterpreter::ScTableOp()
}
auto const itr =
- ::std::find(mrDoc.m_TableOpList.begin(), mrDoc.m_TableOpList.end(), pTableOp.get());
+ ::std::find(mrDoc.m_TableOpList.begin(), mrDoc.m_TableOpList.end(), &*pTableOp);
if (itr != mrDoc.m_TableOpList.end())
{
mrDoc.m_TableOpList.erase(itr);