summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-06-01 09:38:32 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-06-01 10:52:47 +0200
commit63b00ec7d8d140853feb7108a788bfc4f0c79db6 (patch)
tree73d3589ae411699ddab6e6e24bf4c8e2a03ebf8f
parent21d14c51c2f07b795ba286430eb96cca0085f627 (diff)
no need to allocate these on the heap
Change-Id: I6eb3853883c724b5cb28bbf4debf6f56a587ff88 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116515 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sc/source/filter/xml/xmlsubti.cxx20
-rw-r--r--sc/source/ui/app/inputhdl.cxx4
-rw-r--r--sc/source/ui/docshell/docsh3.cxx8
-rw-r--r--sc/source/ui/docshell/docsh5.cxx6
-rw-r--r--sc/source/ui/formdlg/formula.cxx7
-rw-r--r--sc/source/ui/undo/undotab.cxx12
-rw-r--r--sc/source/ui/view/viewfun2.cxx24
-rw-r--r--sc/source/ui/view/viewfun4.cxx4
-rw-r--r--sc/source/ui/view/viewfun5.cxx16
-rw-r--r--sd/source/core/drawdoc3.cxx2
-rw-r--r--sd/source/filter/eppt/eppt.cxx6
-rw-r--r--sd/source/filter/eppt/epptso.cxx20
-rw-r--r--starmath/source/view.cxx20
13 files changed, 74 insertions, 75 deletions
diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx
index a83ef254ac8d..1b8ce5ae575c 100644
--- a/sc/source/filter/xml/xmlsubti.cxx
+++ b/sc/source/filter/xml/xmlsubti.cxx
@@ -196,16 +196,16 @@ void ScMyTables::DeleteTable()
uno::Sequence<sal_Int8> aHash;
::comphelper::Base64::decode(aHash, maProtectionData.maPassword);
- std::unique_ptr<ScTableProtection> pProtect(new ScTableProtection);
- pProtect->setProtected(maProtectionData.mbProtected);
- pProtect->setPasswordHash(aHash, maProtectionData.meHash1, maProtectionData.meHash2);
- pProtect->setOption(ScTableProtection::SELECT_LOCKED_CELLS, maProtectionData.mbSelectProtectedCells);
- pProtect->setOption(ScTableProtection::SELECT_UNLOCKED_CELLS, maProtectionData.mbSelectUnprotectedCells);
- pProtect->setOption(ScTableProtection::INSERT_COLUMNS, maProtectionData.mbInsertColumns);
- pProtect->setOption(ScTableProtection::INSERT_ROWS, maProtectionData.mbInsertRows);
- pProtect->setOption(ScTableProtection::DELETE_COLUMNS, maProtectionData.mbDeleteColumns);
- pProtect->setOption(ScTableProtection::DELETE_ROWS, maProtectionData.mbDeleteRows);
- rImport.GetDocument()->SetTabProtection(maCurrentCellPos.Tab(), pProtect.get());
+ ScTableProtection aProtect;
+ aProtect.setProtected(maProtectionData.mbProtected);
+ aProtect.setPasswordHash(aHash, maProtectionData.meHash1, maProtectionData.meHash2);
+ aProtect.setOption(ScTableProtection::SELECT_LOCKED_CELLS, maProtectionData.mbSelectProtectedCells);
+ aProtect.setOption(ScTableProtection::SELECT_UNLOCKED_CELLS, maProtectionData.mbSelectUnprotectedCells);
+ aProtect.setOption(ScTableProtection::INSERT_COLUMNS, maProtectionData.mbInsertColumns);
+ aProtect.setOption(ScTableProtection::INSERT_ROWS, maProtectionData.mbInsertRows);
+ aProtect.setOption(ScTableProtection::DELETE_COLUMNS, maProtectionData.mbDeleteColumns);
+ aProtect.setOption(ScTableProtection::DELETE_ROWS, maProtectionData.mbDeleteRows);
+ rImport.GetDocument()->SetTabProtection(maCurrentCellPos.Tab(), &aProtect);
}
void ScMyTables::AddColStyle(const sal_Int32 nRepeat, const OUString& rCellStyleName)
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index ab68cdac40c2..194049e999e8 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1737,7 +1737,7 @@ static OUString lcl_Calculate( const OUString& rFormula, ScDocument& rDoc, const
if(rFormula.isEmpty())
return OUString();
- std::unique_ptr<ScSimpleFormulaCalculator> pCalc( new ScSimpleFormulaCalculator( rDoc, rPos, rFormula, false ) );
+ std::optional<ScSimpleFormulaCalculator> pCalc( std::in_place, rDoc, rPos, rFormula, false );
// FIXME: HACK! In order to not get a #REF! for ColRowNames, if a name is actually inserted as a Range
// into the whole Formula, but is interpreted as a single cell reference when displaying it on its own
@@ -1749,7 +1749,7 @@ static OUString lcl_Calculate( const OUString& rFormula, ScDocument& rDoc, const
{ // ==1: Single one is as a Parameter always a Range
// ==0: It might be one, if ...
OUString aBraced = "(" + rFormula + ")";
- pCalc.reset( new ScSimpleFormulaCalculator( rDoc, rPos, aBraced, false ) );
+ pCalc.emplace( rDoc, rPos, aBraced, false );
}
else
bColRowName = false;
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index aec3aa7d5620..39808c00aa3f 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -1178,14 +1178,14 @@ bool ScDocShell::MergeSharedDocument( ScDocShell* pSharedDocShell )
// merge own changes into shared document
sal_uLong nActStartShared = pSharedAction->GetActionNumber();
sal_uLong nActEndShared = pSharedTrack->GetActionMax();
- std::unique_ptr<ScDocument> pTmpDoc(new ScDocument);
+ std::optional<ScDocument> pTmpDoc(std::in_place);
for ( sal_Int32 nIndex = 0; nIndex < m_aDocument.GetTableCount(); ++nIndex )
{
OUString sTabName;
pTmpDoc->CreateValidTabName( sTabName );
pTmpDoc->InsertTab( SC_TAB_APPEND, sTabName );
}
- m_aDocument.GetChangeTrack()->Clone( pTmpDoc.get() );
+ m_aDocument.GetChangeTrack()->Clone( &*pTmpDoc );
ScChangeActionMergeMap aOwnInverseMergeMap;
pSharedDocShell->MergeDocument( *pTmpDoc, true, true, 0, &aOwnInverseMergeMap, true );
pTmpDoc.reset();
@@ -1226,14 +1226,14 @@ bool ScDocShell::MergeSharedDocument( ScDocShell* pSharedDocShell )
pSharedTrack->Undo( nActStartOwn, nActEndOwn );
// clone change track for merging into own document
- pTmpDoc.reset(new ScDocument);
+ pTmpDoc.emplace();
for ( sal_Int32 nIndex = 0; nIndex < m_aDocument.GetTableCount(); ++nIndex )
{
OUString sTabName;
pTmpDoc->CreateValidTabName( sTabName );
pTmpDoc->InsertTab( SC_TAB_APPEND, sTabName );
}
- pThisTrack->Clone( pTmpDoc.get() );
+ pThisTrack->Clone( &*pTmpDoc );
// undo own changes since last save in own document
sal_uLong nStartShared = pThisAction->GetActionNumber();
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index fad7e64c1698..08ac3b5f0fe0 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -987,9 +987,9 @@ bool ScDocShell::MoveTable( SCTAB nSrcTab, SCTAB nDestTab, bool bCopy, bool bRec
return true; // nothing to do, but valid
}
- std::unique_ptr<ScProgress> pProgress(new ScProgress(this, ScResId(STR_UNDO_MOVE_TAB),
- m_aDocument.GetCodeCount(), true));
- bool bDone = m_aDocument.MoveTab( nSrcTab, nDestTab, pProgress.get() );
+ std::optional<ScProgress> pProgress(std::in_place, this, ScResId(STR_UNDO_MOVE_TAB),
+ m_aDocument.GetCodeCount(), true);
+ bool bDone = m_aDocument.MoveTab( nSrcTab, nDestTab, &*pProgress );
pProgress.reset();
if (!bDone)
{
diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx
index 4af9a35fb7a5..93f51d2c91d2 100644
--- a/sc/source/ui/formdlg/formula.cxx
+++ b/sc/source/ui/formdlg/formula.cxx
@@ -297,8 +297,8 @@ void ScFormulaDlg::Close()
bool ScFormulaDlg::calculateValue( const OUString& rStrExp, OUString& rStrResult, bool bMatrixFormula )
{
- std::unique_ptr<ScSimpleFormulaCalculator> pFCell( new ScSimpleFormulaCalculator(
- *m_pDoc, m_CursorPos, rStrExp, bMatrixFormula));
+ std::optional<ScSimpleFormulaCalculator> pFCell(std::in_place,
+ *m_pDoc, m_CursorPos, rStrExp, bMatrixFormula);
pFCell->SetLimitString(true);
// HACK! to avoid neither #REF! from ColRowNames
@@ -312,8 +312,7 @@ bool ScFormulaDlg::calculateValue( const OUString& rStrExp, OUString& rStrResult
{ // ==1: area
// ==0: would be an area if...
OUString aBraced = "(" + rStrExp + ")";
- pFCell.reset( new ScSimpleFormulaCalculator(
- *m_pDoc, m_CursorPos, aBraced, bMatrixFormula));
+ pFCell.emplace(*m_pDoc, m_CursorPos, aBraced, bMatrixFormula);
pFCell->SetLimitString(true);
}
else
diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx
index 51596baf9d42..e0def882cea6 100644
--- a/sc/source/ui/undo/undotab.cxx
+++ b/sc/source/ui/undo/undotab.cxx
@@ -495,8 +495,8 @@ void ScUndoMoveTab::DoChange( bool bUndo ) const
if (bUndo) // UnDo
{
size_t i = mpNewTabs->size();
- std::unique_ptr<ScProgress> pProgress(new ScProgress(pDocShell , ScResId(STR_UNDO_MOVE_TAB),
- i * rDoc.GetCodeCount(), true));
+ ScProgress aProgress(pDocShell, ScResId(STR_UNDO_MOVE_TAB),
+ i * rDoc.GetCodeCount(), true);
for (; i > 0; --i)
{
SCTAB nDestTab = (*mpNewTabs)[i-1];
@@ -504,7 +504,7 @@ void ScUndoMoveTab::DoChange( bool bUndo ) const
if (nDestTab > MAXTAB) // appended ?
nDestTab = rDoc.GetTableCount() - 1;
- rDoc.MoveTab( nDestTab, nOldTab, pProgress.get() );
+ rDoc.MoveTab( nDestTab, nOldTab, &aProgress );
pViewShell->GetViewData().MoveTab( nDestTab, nOldTab );
pViewShell->SetTabNo( nOldTab, true );
if (mpOldNames)
@@ -517,8 +517,8 @@ void ScUndoMoveTab::DoChange( bool bUndo ) const
else
{
size_t n = mpNewTabs->size();
- std::unique_ptr<ScProgress> pProgress(new ScProgress(pDocShell , ScResId(STR_UNDO_MOVE_TAB),
- n * rDoc.GetCodeCount(), true));
+ ScProgress aProgress(pDocShell, ScResId(STR_UNDO_MOVE_TAB),
+ n * rDoc.GetCodeCount(), true);
for (size_t i = 0; i < n; ++i)
{
SCTAB nDestTab = (*mpNewTabs)[i];
@@ -527,7 +527,7 @@ void ScUndoMoveTab::DoChange( bool bUndo ) const
if (nDestTab > MAXTAB) // appended ?
nDestTab = rDoc.GetTableCount() - 1;
- rDoc.MoveTab( nOldTab, nNewTab, pProgress.get() );
+ rDoc.MoveTab( nOldTab, nNewTab, &aProgress );
pViewShell->GetViewData().MoveTab( nOldTab, nNewTab );
pViewShell->SetTabNo( nDestTab, true );
if (mpNewNames)
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index fe9778297853..b87e60becb3f 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -810,15 +810,15 @@ OUString ScViewFunc::GetAutoSumFormula( const ScRangeList& rRangeList, bool bSub
{
ScViewData& rViewData = GetViewData();
ScDocument& rDoc = rViewData.GetDocument();
- std::unique_ptr<ScTokenArray> pArray(new ScTokenArray(rDoc));
+ ScTokenArray aArray(rDoc);
- pArray->AddOpCode(bSubTotal ? ocSubTotal : eCode);
- pArray->AddOpCode(ocOpen);
+ aArray.AddOpCode(bSubTotal ? ocSubTotal : eCode);
+ aArray.AddOpCode(ocOpen);
if (bSubTotal)
{
- pArray->AddDouble( GetSubTotal( eCode ) );
- pArray->AddOpCode(ocSep);
+ aArray.AddDouble( GetSubTotal( eCode ) );
+ aArray.AddOpCode(ocSep);
}
if(!rRangeList.empty())
@@ -829,16 +829,16 @@ OUString ScViewFunc::GetAutoSumFormula( const ScRangeList& rRangeList, bool bSub
{
const ScRange & r = aRangeList[i];
if (i != 0)
- pArray->AddOpCode(ocSep);
+ aArray.AddOpCode(ocSep);
ScComplexRefData aRef;
aRef.InitRangeRel(rDoc, r, rAddr);
- pArray->AddDoubleReference(aRef);
+ aArray.AddDoubleReference(aRef);
}
}
- pArray->AddOpCode(ocClose);
+ aArray.AddOpCode(ocClose);
- ScCompiler aComp(rDoc, rAddr, *pArray, rDoc.GetGrammar());
+ ScCompiler aComp(rDoc, rAddr, aArray, rDoc.GetGrammar());
OUStringBuffer aBuf;
aComp.CreateStringFromTokenArray(aBuf);
OUString aFormula = aBuf.makeStringAndClear();
@@ -927,11 +927,11 @@ void ScViewFunc::EnterBlock( const OUString& rString, const EditTextObject* pDat
// MarkData was already MarkToSimple'ed in PasteFromClip
ScRange aRange;
rMark.GetMarkArea( aRange );
- std::unique_ptr<ScPatternAttr> pPattern(new ScPatternAttr( rDoc.GetPool() ));
- pPattern->GetItemSet().Put( *pItem );
+ ScPatternAttr aPattern( rDoc.GetPool() );
+ aPattern.GetItemSet().Put( *pItem );
SvNumFormatType nNewType = rDoc.GetFormatTable()->GetType( pItem->GetValue() );
rDoc.ApplyPatternIfNumberformatIncompatible( aRange, rMark,
- *pPattern, nNewType );
+ aPattern, nNewType );
}
}
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index da38a099826b..c19240f6cba5 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -88,7 +88,7 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow,
const bool bRecord (rDoc.IsUndoEnabled());
const ScPatternAttr* pPattern = rDoc.GetPattern( nStartCol, nStartRow, nTab );
- std::unique_ptr<ScTabEditEngine> pEngine(new ScTabEditEngine( *pPattern, rDoc.GetEnginePool(), &rDoc ));
+ std::optional<ScTabEditEngine> pEngine(std::in_place, *pPattern, rDoc.GetEnginePool(), &rDoc );
pEngine->EnableUndo( false );
vcl::Window* pActWin = GetActiveWin();
@@ -96,7 +96,7 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow,
{
pEngine->SetPaperSize(Size(100000,100000));
ScopedVclPtrInstance< vcl::Window > aWin( pActWin );
- EditView aEditView( pEngine.get(), aWin.get() );
+ EditView aEditView( &*pEngine, aWin.get() );
aEditView.SetOutputArea(tools::Rectangle(0,0,100000,100000));
// same method now for clipboard or drag&drop
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index daa2e9c17db3..5fe89ae675cb 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -585,17 +585,17 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
uno::Reference <io::XInputStream> xStm = aDataHelper.GetInputStream(nFormatId, OUString());
if (xStm.is())
{
- std::unique_ptr<ScDocument> pInsDoc(new ScDocument( SCDOCMODE_CLIP ));
+ ScDocument aInsDoc( SCDOCMODE_CLIP );
SCTAB nSrcTab = 0; // Biff5 in clipboard: always sheet 0
- pInsDoc->ResetClip( &rDoc, nSrcTab );
+ aInsDoc.ResetClip( &rDoc, nSrcTab );
SfxMedium aMed;
aMed.GetItemSet()->Put( SfxUnoAnyItem( SID_INPUTSTREAM, uno::makeAny( xStm ) ) );
- ErrCode eErr = ScFormatFilter::Get().ScImportExcel( aMed, pInsDoc.get(), EIF_AUTO );
+ ErrCode eErr = ScFormatFilter::Get().ScImportExcel( aMed, &aInsDoc, EIF_AUTO );
if ( eErr == ERRCODE_NONE )
{
ScRange aSource;
- const ScExtDocOptions* pExtOpt = pInsDoc->GetExtDocOptions();
+ const ScExtDocOptions* pExtOpt = aInsDoc.GetExtDocOptions();
const ScExtTabSettings* pTabSett = pExtOpt ? pExtOpt->GetTabSettings( nSrcTab ) : nullptr;
if( pTabSett && pTabSett->maUsedArea.IsValid() )
{
@@ -611,8 +611,8 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
OSL_FAIL("no dimension"); //! possible?
SCCOL nFirstCol, nLastCol;
SCROW nFirstRow, nLastRow;
- if ( pInsDoc->GetDataStart( nSrcTab, nFirstCol, nFirstRow ) )
- pInsDoc->GetCellArea( nSrcTab, nLastCol, nLastRow );
+ if ( aInsDoc.GetDataStart( nSrcTab, nFirstCol, nFirstRow ) )
+ aInsDoc.GetCellArea( nSrcTab, nLastCol, nLastRow );
else
{
nFirstCol = nLastCol = 0;
@@ -629,8 +629,8 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
Unmark();
}
- pInsDoc->SetClipArea( aSource );
- PasteFromClip( InsertDeleteFlags::ALL, pInsDoc.get(),
+ aInsDoc.SetClipArea( aSource );
+ PasteFromClip( InsertDeleteFlags::ALL, &aInsDoc,
ScPasteFunc::NONE, false, false, false, INS_NONE, InsertDeleteFlags::NONE,
bAllowDialogs );
bRet = true;
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index fe99838bd31c..0b2af6470786 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -1027,7 +1027,7 @@ bool SdDrawDocument::InsertBookmarkAsObject(
if (pBMView)
{
// Insert selected objects
- std::unique_ptr<::sd::View> pView(new ::sd::View(*this, nullptr));
+ std::optional<::sd::View> pView(std::in_place, *this, nullptr);
pView->EndListening(*this);
// Look for the page into which the objects are supposed to be inserted
diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx
index 237fd2276f5d..04a84c3a129e 100644
--- a/sd/source/filter/eppt/eppt.cxx
+++ b/sd/source/filter/eppt/eppt.cxx
@@ -1423,9 +1423,9 @@ extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool ExportPPT( const std::vector< css::bean
SvMemoryStream* pVBA,
sal_uInt32 nCnvrtFlags )
{
- std::unique_ptr<PPTWriter> pPPTWriter(new PPTWriter( rSvStorage, rXModel, rXStatInd, pVBA, nCnvrtFlags ));
- pPPTWriter->exportPPT(rMediaData);
- bool bStatus = pPPTWriter->IsValid();
+ PPTWriter aPPTWriter( rSvStorage, rXModel, rXStatInd, pVBA, nCnvrtFlags );
+ aPPTWriter.exportPPT(rMediaData);
+ bool bStatus = aPPTWriter.IsValid();
return bStatus;
}
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
index 77095a8e497e..1b7248814ab5 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -88,7 +88,7 @@ sal_uInt16 PPTExBulletProvider::GetId(Graphic const & rGraphic, Size& rGraphicSi
if (!rGraphic.IsNone())
{
Graphic aMappedGraphic, aGraphic(rGraphic);
- std::unique_ptr<GraphicObject> xGraphicObject(new GraphicObject(aGraphic));
+ GraphicObject aGraphicObject(aGraphic);
Size aPrefSize( aGraphic.GetPrefSize() );
BitmapEx aBmpEx( aGraphic.GetBitmapEx() );
@@ -117,11 +117,11 @@ sal_uInt16 PPTExBulletProvider::GetId(Graphic const & rGraphic, Size& rGraphicSi
static_cast<sal_Int32>(static_cast<double>(rGraphicSize.Height()) / fYScale + 0.5 ) );
aMappedGraphic = Graphic( aBmpEx );
- xGraphicObject.reset(new GraphicObject(aMappedGraphic));
+ aGraphicObject = GraphicObject(aMappedGraphic);
}
}
}
- sal_uInt32 nId = pGraphicProv->GetBlibID(aBuExPictureStream, *xGraphicObject);
+ sal_uInt32 nId = pGraphicProv->GetBlibID(aBuExPictureStream, aGraphicObject);
if ( nId && ( nId < 0x10000 ) )
nRetValue = static_cast<sal_uInt16>(nId) - 1;
@@ -3104,8 +3104,8 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape > const & rXSha
if ( y == nRowCount - 1 && nPosition != maRect.Bottom())
maRect.SetBottom( nPosition );
}
- std::unique_ptr<ContainerGuard> xSpgrContainer(new ContainerGuard(mpPptEscherEx.get(), ESCHER_SpgrContainer));
- std::unique_ptr<ContainerGuard> xSpContainer(new ContainerGuard(mpPptEscherEx.get(), ESCHER_SpContainer));
+ std::optional<ContainerGuard> xSpgrContainer(std::in_place, mpPptEscherEx.get(), ESCHER_SpgrContainer);
+ std::optional<ContainerGuard> xSpContainer(std::in_place, mpPptEscherEx.get(), ESCHER_SpContainer);
mpPptEscherEx->AddAtom( 16, ESCHER_Spgr, 1 );
mpStrm ->WriteInt32( maRect.Left() ) // Bounding box for the grouped shapes to which they are attached
.WriteInt32( maRect.Top() )
@@ -3161,7 +3161,7 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape > const & rXSha
aAny >>= mbFontIndependentLineSpacing;
EscherPropertyContainer aPropOptSp;
- std::unique_ptr<ContainerGuard> xCellContainer(new ContainerGuard(mpPptEscherEx.get(), ESCHER_SpContainer));
+ std::optional<ContainerGuard> xCellContainer(std::in_place, mpPptEscherEx.get(), ESCHER_SpContainer);
ImplCreateShape( ESCHER_ShpInst_Rectangle,
ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty | ShapeFlag::Child,
aSolverContainer );
@@ -3179,12 +3179,12 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape > const & rXSha
// need write client data for extend bullet
if ( aExtBu.Tell() )
{
- std::unique_ptr<SvMemoryStream> pClientData(new SvMemoryStream( 0x200, 0x200 ));
- ImplProgTagContainer( pClientData.get(), &aExtBu );
+ SvMemoryStream aClientData( 0x200, 0x200 );
+ ImplProgTagContainer( &aClientData, &aExtBu );
mpStrm->WriteUInt32( ( ESCHER_ClientData << 16 ) | 0xf )
- .WriteUInt32( pClientData->Tell() );
+ .WriteUInt32( aClientData.Tell() );
- mpStrm->WriteBytes(pClientData->GetData(), pClientData->Tell());
+ mpStrm->WriteBytes(aClientData.GetData(), aClientData.Tell());
}
aPropOptSp.Commit( *mpStrm );
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index b6d832fb1130..e0b79fc42d07 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -1731,13 +1731,13 @@ void SmViewShell::Execute(SfxRequest& rReq)
xStrm = aDataHelper.GetInputStream(nId, "");
if (xStrm.is())
{
- std::unique_ptr<SfxMedium> pClipboardMedium(new SfxMedium());
- pClipboardMedium->GetItemSet(); //generate initial itemset, not sure if necessary
+ SfxMedium aClipboardMedium;
+ aClipboardMedium.GetItemSet(); //generate initial itemset, not sure if necessary
std::shared_ptr<const SfxFilter> pMathFilter =
SfxFilter::GetFilterByName(MATHML_XML);
- pClipboardMedium->SetFilter(pMathFilter);
- pClipboardMedium->setStreamToLoadFrom(xStrm, true /*bIsReadOnly*/);
- InsertFrom(*pClipboardMedium);
+ aClipboardMedium.SetFilter(pMathFilter);
+ aClipboardMedium.setStreamToLoadFrom(xStrm, true /*bIsReadOnly*/);
+ InsertFrom(aClipboardMedium);
GetDoc()->UpdateText();
}
}
@@ -1754,11 +1754,11 @@ void SmViewShell::Execute(SfxRequest& rReq)
if (!aString.startsWith("<?xml"))
aString = "<?xml version=\"1.0\"?>\n" + aString;
- std::unique_ptr<SfxMedium> pClipboardMedium(new SfxMedium());
- pClipboardMedium->GetItemSet(); //generates initial itemset, not sure if necessary
+ SfxMedium aClipboardMedium;
+ aClipboardMedium.GetItemSet(); //generates initial itemset, not sure if necessary
std::shared_ptr<const SfxFilter> pMathFilter =
SfxFilter::GetFilterByName(MATHML_XML);
- pClipboardMedium->SetFilter(pMathFilter);
+ aClipboardMedium.SetFilter(pMathFilter);
std::unique_ptr<SvMemoryStream> pStrm;
// The text to be imported might asserts encoding like 'encoding="utf-8"' but FORMAT_STRING is UTF-16.
@@ -1785,8 +1785,8 @@ void SmViewShell::Execute(SfxRequest& rReq)
pStrm.reset(new SvMemoryStream( const_cast<sal_Unicode *>(aString.getStr()), aString.getLength() * sizeof(sal_Unicode), StreamMode::READ));
}
uno::Reference<io::XInputStream> xStrm2( new ::utl::OInputStreamWrapper(*pStrm) );
- pClipboardMedium->setStreamToLoadFrom(xStrm2, true /*bIsReadOnly*/);
- InsertFrom(*pClipboardMedium);
+ aClipboardMedium.setStreamToLoadFrom(xStrm2, true /*bIsReadOnly*/);
+ InsertFrom(aClipboardMedium);
GetDoc()->UpdateText();
}
}