reportdesign/source/core/api/ReportDefinition.cxx | 12 - reportdesign/source/ui/dlg/Condition.cxx | 2 sc/source/core/data/documen2.cxx | 2 sc/source/core/data/document.cxx | 2 sc/source/core/data/document10.cxx | 4 sc/source/core/data/documentimport.cxx | 2 sc/source/core/data/dpgroup.cxx | 18 +- sc/source/core/data/dpobject.cxx | 4 sc/source/core/data/dptabres.cxx | 2 sc/source/core/data/dptabsrc.cxx | 8 - sc/source/core/data/funcdesc.cxx | 2 sc/source/core/data/listenercontext.cxx | 4 sc/source/core/data/postit.cxx | 4 sc/source/core/data/table3.cxx | 2 sc/source/core/opencl/formulagroupcl.cxx | 47 +++--- sc/source/core/tool/calcconfig.cxx | 2 sc/source/core/tool/simplerangelist.cxx | 2 sc/source/filter/excel/excdoc.cxx | 28 ++-- sc/source/filter/excel/excrecds.cxx | 4 sc/source/filter/excel/impop.cxx | 6 sc/source/filter/excel/xechart.cxx | 112 ++++++++-------- sc/source/filter/excel/xedbdata.cxx | 4 sc/source/filter/excel/xeescher.cxx | 12 - sc/source/filter/excel/xeformula.cxx | 16 +- sc/source/filter/excel/xehelper.cxx | 4 sc/source/filter/excel/xelink.cxx | 32 ++-- sc/source/filter/excel/xename.cxx | 14 +- sc/source/filter/excel/xepivot.cxx | 10 - sc/source/filter/excel/xeroot.cxx | 36 ++--- sc/source/filter/excel/xestream.cxx | 2 sc/source/filter/excel/xestyle.cxx | 40 ++--- sc/source/filter/excel/xetable.cxx | 64 ++++----- sc/source/filter/excel/xichart.cxx | 149 ++++++++++------------ sc/source/filter/excel/xicontent.cxx | 8 - sc/source/filter/excel/xiescher.cxx | 140 ++++++++++---------- sc/source/filter/excel/xiformula.cxx | 2 sc/source/filter/excel/xilink.cxx | 2 sc/source/filter/excel/xipivot.cxx | 12 - sc/source/filter/excel/xiroot.cxx | 44 +++--- sc/source/filter/excel/xistyle.cxx | 4 sc/source/filter/excel/xlchart.cxx | 20 +- sc/source/filter/excel/xlroot.cxx | 18 +- sc/source/filter/excel/xltoolbar.cxx | 4 sc/source/filter/excel/xlview.cxx | 2 sc/source/filter/inc/autofilterbuffer.hxx | 2 sc/source/filter/oox/autofilterbuffer.cxx | 4 sc/source/filter/oox/commentsbuffer.cxx | 4 sc/source/filter/oox/condformatbuffer.cxx | 4 sc/source/filter/oox/connectionsbuffer.cxx | 2 sc/source/filter/oox/defnamesbuffer.cxx | 2 sc/source/filter/oox/drawingfragment.cxx | 14 +- sc/source/filter/oox/externallinkbuffer.cxx | 6 sc/source/filter/oox/formulabase.cxx | 6 sc/source/filter/oox/numberformatsbuffer.cxx | 4 sc/source/filter/oox/ooxformulaparser.cxx | 2 sc/source/filter/oox/pivotcachebuffer.cxx | 4 sc/source/filter/oox/pivottablebuffer.cxx | 6 sc/source/filter/oox/querytablebuffer.cxx | 2 sc/source/filter/oox/revisionfragment.cxx | 2 sc/source/filter/oox/richstring.cxx | 6 sc/source/filter/oox/scenariobuffer.cxx | 4 sc/source/filter/oox/sharedstringsbuffer.cxx | 2 sc/source/filter/oox/sheetdatacontext.cxx | 6 sc/source/filter/oox/stylesbuffer.cxx | 42 +++--- sc/source/filter/oox/tablebuffer.cxx | 2 sc/source/filter/oox/tablecolumnsbuffer.cxx | 4 sc/source/filter/oox/viewsettings.cxx | 8 - sc/source/filter/oox/workbookfragment.cxx | 4 sc/source/filter/oox/workbookhelper.cxx | 4 sc/source/filter/oox/worksheethelper.cxx | 2 sc/source/filter/rtf/eeimpars.cxx | 2 sc/source/filter/xcl97/xcl97rec.cxx | 4 sc/source/filter/xml/XMLStylesImportHelper.cxx | 14 +- sc/source/filter/xml/XMLStylesImportHelper.hxx | 2 sc/source/ui/dataprovider/dataprovider.cxx | 2 sc/source/ui/dialogs/searchresults.cxx | 2 sc/source/ui/docshell/externalrefmgr.cxx | 16 +- sc/source/ui/drawfunc/drawsh.cxx | 9 - sc/source/ui/formdlg/formula.cxx | 2 sc/source/ui/miscdlgs/retypepassdlg.cxx | 4 sc/source/ui/unoobj/chart2uno.cxx | 8 - sc/source/ui/view/scextopt.cxx | 4 82 files changed, 560 insertions(+), 565 deletions(-)
New commits: commit 1d10db1003f092f48ed09a0d45994f7481b96d84 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Jan 24 10:54:10 2020 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Jan 24 11:04:11 2020 +0100 loplugin:makeshared in sc Change-Id: Ie287b5c11a1276c56f416f17ea69cddd5992b4a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87326 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index c87dab365084..4b6e7fac9b0f 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -91,7 +91,7 @@ using namespace com::sun::star; const sal_uInt16 ScDocument::nSrcVer = SC_CURRENT_VERSION; ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) : - mpCellStringPool(new svl::SharedStringPool(*ScGlobal::pCharClass)), + mpCellStringPool(std::make_shared<svl::SharedStringPool>(*ScGlobal::pCharClass)), mpDocLinkMgr(new sc::DocumentLinkManager(pDocShell)), mbFormulaGroupCxtBlockDiscard(false), maCalcConfig( ScInterpreter::GetGlobalConfig()), diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index a7071416eb6e..9a36ed567d90 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -3526,7 +3526,7 @@ std::shared_ptr<sc::FormulaGroupContext>& ScDocument::GetFormulaGroupContext() { ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE); if (!mpFormulaGroupCxt) - mpFormulaGroupCxt.reset(new sc::FormulaGroupContext); + mpFormulaGroupCxt = std::make_shared<sc::FormulaGroupContext>(); return mpFormulaGroupCxt; } diff --git a/sc/source/core/data/document10.cxx b/sc/source/core/data/document10.cxx index 8b1496943081..a6626867b14c 100644 --- a/sc/source/core/data/document10.cxx +++ b/sc/source/core/data/document10.cxx @@ -470,9 +470,9 @@ class StartNeededListenersHandler { std::shared_ptr<sc::StartListeningContext> mpCxt; public: - explicit StartNeededListenersHandler( ScDocument& rDoc ) : mpCxt(new sc::StartListeningContext(rDoc)) {} + explicit StartNeededListenersHandler( ScDocument& rDoc ) : mpCxt(std::make_shared<sc::StartListeningContext>(rDoc)) {} explicit StartNeededListenersHandler( ScDocument& rDoc, const std::shared_ptr<const sc::ColumnSet>& rpColSet ) : - mpCxt(new sc::StartListeningContext(rDoc)) + mpCxt(std::make_shared<sc::StartListeningContext>(rDoc)) { mpCxt->setColumnSet( rpColSet); } diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx index 46d1638fbe48..2fd7f744d34c 100644 --- a/sc/source/core/data/documentimport.cxx +++ b/sc/source/core/data/documentimport.cxx @@ -647,7 +647,7 @@ public: mrDocImpl(rDocImpl), mnTab(nTab), mnCol(nCol), - mpImpl(new Impl(mrDocImpl.mnDefaultScriptNumeric)) + mpImpl(std::make_shared<Impl>(mrDocImpl.mnDefaultScriptNumeric)) {} std::shared_ptr<Impl> mpImpl; diff --git a/sc/source/core/data/dpgroup.cxx b/sc/source/core/data/dpgroup.cxx index a97ce449649c..456de9baa3d0 100644 --- a/sc/source/core/data/dpgroup.cxx +++ b/sc/source/core/data/dpgroup.cxx @@ -676,15 +676,15 @@ void ScDPGroupTableData::ModifyFilterCriteria(vector<ScDPFilteredCache::Criterio if (rNumGrpDim.IsDateDimension()) { // grouped by dates. - aCri.mpFilter.reset( - new ScDPGroupDateFilter( - aMatchValues, pDoc->GetFormatTable()->GetNullDate(), *pNumInfo)); + aCri.mpFilter = + std::make_shared<ScDPGroupDateFilter>( + aMatchValues, pDoc->GetFormatTable()->GetNullDate(), *pNumInfo); } else { // This dimension is grouped by numeric ranges. - aCri.mpFilter.reset( - new ScDPGroupNumFilter(aMatchValues, *pNumInfo)); + aCri.mpFilter = + std::make_shared<ScDPGroupNumFilter>(aMatchValues, *pNumInfo); } aNewCriteria.push_back(aCri); @@ -709,9 +709,9 @@ void ScDPGroupTableData::ModifyFilterCriteria(vector<ScDPFilteredCache::Criterio // external number group ScDPFilteredCache::Criterion aCri; aCri.mnFieldIndex = nSrcDim; // use the source dimension, not the group dimension. - aCri.mpFilter.reset( - new ScDPGroupDateFilter( - aMatchValues, pDoc->GetFormatTable()->GetNullDate(), *pNumInfo)); + aCri.mpFilter = + std::make_shared<ScDPGroupDateFilter>( + aMatchValues, pDoc->GetFormatTable()->GetNullDate(), *pNumInfo); aNewCriteria.push_back(aCri); } @@ -721,7 +721,7 @@ void ScDPGroupTableData::ModifyFilterCriteria(vector<ScDPFilteredCache::Criterio ScDPFilteredCache::Criterion aCri; aCri.mnFieldIndex = nSrcDim; - aCri.mpFilter.reset(new ScDPFilteredCache::GroupFilter()); + aCri.mpFilter = std::make_shared<ScDPFilteredCache::GroupFilter>(); ScDPFilteredCache::GroupFilter* pGrpFilter = static_cast<ScDPFilteredCache::GroupFilter*>(aCri.mpFilter.get()); diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 73b236df1f48..45736b4d4db0 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -688,7 +688,7 @@ ScDPTableData* ScDPObject::GetTableData() if (pCache) { pCache->AddReference(this); - pData.reset(new ScDatabaseDPData(pDoc, *pCache)); + pData = std::make_shared<ScDatabaseDPData>(pDoc, *pCache); } } else @@ -709,7 +709,7 @@ ScDPTableData* ScDPObject::GetTableData() if (pCache) { pCache->AddReference(this); - pData.reset(new ScSheetDPData(pDoc, *pSheetDesc, *pCache)); + pData = std::make_shared<ScSheetDPData>(pDoc, *pSheetDesc, *pCache); } } } diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx index 9c2b453d8cb7..b535d5cdc08e 100644 --- a/sc/source/core/data/dptabres.cxx +++ b/sc/source/core/data/dptabres.cxx @@ -3925,7 +3925,7 @@ void ScDPResultVisibilityData::fillFieldFilters(vector<ScDPFilteredCache::Criter long nDimIndex = itrField->second; aCri.mnFieldIndex = static_cast<sal_Int32>(nDimIndex); - aCri.mpFilter.reset(new ScDPFilteredCache::GroupFilter); + aCri.mpFilter = std::make_shared<ScDPFilteredCache::GroupFilter>(); ScDPFilteredCache::GroupFilter* pGrpFilter = static_cast<ScDPFilteredCache::GroupFilter*>(aCri.mpFilter.get()); diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx index de6e778a6565..e8bbd3c91c19 100644 --- a/sc/source/core/data/dptabsrc.cxx +++ b/sc/source/core/data/dptabsrc.cxx @@ -449,8 +449,8 @@ Sequence< Sequence<Any> > SAL_CALL ScDPSource::getDrillDownData(const Sequence<s ScDPItemData aItem(pMembers->getByIndex(nIndex)->FillItemData()); aFilterCriteria.emplace_back( ); aFilterCriteria.back().mnFieldIndex = nCol; - aFilterCriteria.back().mpFilter.reset( - new ScDPFilteredCache::SingleFilter(aItem)); + aFilterCriteria.back().mpFilter = + std::make_shared<ScDPFilteredCache::SingleFilter>(aItem); } } } @@ -696,7 +696,7 @@ void ScDPSource::FilterCacheByPageDimensions() long nMemCount = pMems->getCount(); ScDPFilteredCache::Criterion aFilter; aFilter.mnFieldIndex = static_cast<sal_Int32>(nField); - aFilter.mpFilter.reset(new ScDPFilteredCache::GroupFilter); + aFilter.mpFilter = std::make_shared<ScDPFilteredCache::GroupFilter>(); ScDPFilteredCache::GroupFilter* pGrpFilter = static_cast<ScDPFilteredCache::GroupFilter*>(aFilter.mpFilter.get()); for (long j = 0; j < nMemCount; ++j) @@ -719,7 +719,7 @@ void ScDPSource::FilterCacheByPageDimensions() aCriteria.emplace_back(); ScDPFilteredCache::Criterion& r = aCriteria.back(); r.mnFieldIndex = static_cast<sal_Int32>(nField); - r.mpFilter.reset(new ScDPFilteredCache::SingleFilter(rData)); + r.mpFilter = std::make_shared<ScDPFilteredCache::SingleFilter>(rData); } if (!aCriteria.empty()) { diff --git a/sc/source/core/data/funcdesc.cxx b/sc/source/core/data/funcdesc.cxx index a8e43efd0d04..89e07465ea67 100644 --- a/sc/source/core/data/funcdesc.cxx +++ b/sc/source/core/data/funcdesc.cxx @@ -1130,7 +1130,7 @@ const formula::IFunctionCategory* ScFunctionMgr::getCategory(sal_uInt32 nCategor if ( nCategory < (MAX_FUNCCAT-1) ) { if (m_aCategories.find(nCategory) == m_aCategories.end()) - m_aCategories[nCategory].reset(new ScFunctionCategory(aCatLists[nCategory+1].get(),nCategory)); // aCatLists[0] is "all" + m_aCategories[nCategory] = std::make_shared<ScFunctionCategory>(aCatLists[nCategory+1].get(),nCategory); // aCatLists[0] is "all" return m_aCategories[nCategory].get(); } return nullptr; diff --git a/sc/source/core/data/listenercontext.cxx b/sc/source/core/data/listenercontext.cxx index 46f0ecb5cc27..c9194eca0d24 100644 --- a/sc/source/core/data/listenercontext.cxx +++ b/sc/source/core/data/listenercontext.cxx @@ -14,7 +14,7 @@ namespace sc { StartListeningContext::StartListeningContext(ScDocument& rDoc) : - mrDoc(rDoc), mpSet(new ColumnBlockPositionSet(rDoc)) {} + mrDoc(rDoc), mpSet(std::make_shared<ColumnBlockPositionSet>(rDoc)) {} StartListeningContext::StartListeningContext( ScDocument& rDoc, const std::shared_ptr<ColumnBlockPositionSet>& pSet) : @@ -36,7 +36,7 @@ ColumnBlockPosition* StartListeningContext::getBlockPosition(SCTAB nTab, SCCOL n } EndListeningContext::EndListeningContext(ScDocument& rDoc, ScTokenArray* pOldCode) : - mrDoc(rDoc), maSet(false), mpPosSet(new ColumnBlockPositionSet(rDoc)), + mrDoc(rDoc), maSet(false), mpPosSet(std::make_shared<ColumnBlockPositionSet>(rDoc)), mpOldCode(pOldCode), maPosDelta(0,0,0) {} EndListeningContext::EndListeningContext( diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index 754c83b24f66..f58203b886b4 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -1245,7 +1245,7 @@ ScPostIt* ScNoteUtil::CreateNoteFromObjectData( { OSL_ENSURE( pItemSet && pOutlinerObj, "ScNoteUtil::CreateNoteFromObjectData - item set and outliner object expected" ); ScNoteData aNoteData( bShown ); - aNoteData.mxInitData.reset( new ScCaptionInitData ); + aNoteData.mxInitData = std::make_shared<ScCaptionInitData>(); ScCaptionInitData& rInitData = *aNoteData.mxInitData; rInitData.mxItemSet = std::move(pItemSet); rInitData.mxOutlinerObj.reset( pOutlinerObj ); @@ -1279,7 +1279,7 @@ ScPostIt* ScNoteUtil::CreateNoteFromString( if( !rNoteText.isEmpty() ) { ScNoteData aNoteData( bShown ); - aNoteData.mxInitData.reset( new ScCaptionInitData ); + aNoteData.mxInitData = std::make_shared<ScCaptionInitData>(); ScCaptionInitData& rInitData = *aNoteData.mxInitData; rInitData.maSimpleText = rNoteText; rInitData.mbDefaultPosSize = true; diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 7f881167d3d4..8f6c588cd6c7 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -849,7 +849,7 @@ class ListenerStartAction : public sc::ColumnSpanSet::ColumnAction public: explicit ListenerStartAction( ScDocument& rDoc ) : mpCol(nullptr), - mpPosSet(new sc::ColumnBlockPositionSet(rDoc)), + mpPosSet(std::make_shared<sc::ColumnBlockPositionSet>(rDoc)), maStartCxt(rDoc, mpPosSet), maEndCxt(rDoc, mpPosSet) {} diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 2a88dfc54c49..af591f871f55 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -2641,7 +2641,7 @@ static DynamicKernelArgumentRef SoPHelper( const ScCalcConfig& config, const std::string& ts, const FormulaTreeNodeRef& ft, SlidingFunctionBase* pCodeGen, int nResultSize ) { - return DynamicKernelArgumentRef(new DynamicKernelSoPArguments(config, ts, ft, pCodeGen, nResultSize)); + return std::make_shared<DynamicKernelSoPArguments>(config, ts, ft, pCodeGen, nResultSize); } template<class Base> @@ -2765,9 +2765,8 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, // Function takes numbers or strings, there are both SAL_INFO("sc.opencl", "Numbers and strings"); mvSubArguments.push_back( - DynamicKernelArgumentRef( - new DynamicKernelMixedSlidingArgument(mCalcConfig, - ts, ft->Children[i], mpCodeGen, j))); + std::make_shared<DynamicKernelMixedSlidingArgument>(mCalcConfig, + ts, ft->Children[i], mpCodeGen, j)); } else if (pDVR->GetArrays()[j].mpNumericArray && pCodeGen->takeNumeric() && @@ -2841,8 +2840,8 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, // Function takes numbers or strings, there are both SAL_INFO("sc.opencl", "Numbers and strings"); mvSubArguments.push_back( - DynamicKernelArgumentRef(new DynamicKernelMixedArgument(mCalcConfig, - ts, ft->Children[i]))); + std::make_shared<DynamicKernelMixedArgument>(mCalcConfig, + ts, ft->Children[i])); } else if (pSVR->GetArray().mpNumericArray && pCodeGen->takeNumeric() && @@ -2853,8 +2852,8 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, // they are to be treated as zero SAL_INFO("sc.opencl", "Numbers (no strings or strings treated as zero)"); mvSubArguments.push_back( - DynamicKernelArgumentRef(new VectorRef(mCalcConfig, ts, - ft->Children[i]))); + std::make_shared<VectorRef>(mCalcConfig, ts, + ft->Children[i])); } else if (pSVR->GetArray().mpNumericArray == nullptr && pCodeGen->takeNumeric() && @@ -2865,8 +2864,8 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, // strings, but they are to be treated as zero SAL_INFO("sc.opencl", "Only strings even if want numbers but should be treated as zero"); mvSubArguments.push_back( - DynamicKernelArgumentRef(new VectorRef(mCalcConfig, ts, - ft->Children[i]))); + std::make_shared<VectorRef>(mCalcConfig, ts, + ft->Children[i])); } else if (pSVR->GetArray().mpStringArray && pCodeGen->takeString()) @@ -2874,8 +2873,8 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, // There are strings, and the function takes strings. SAL_INFO("sc.opencl", "Strings only"); mvSubArguments.push_back( - DynamicKernelArgumentRef(new DynamicKernelStringArgument(mCalcConfig, - ts, ft->Children[i]))); + std::make_shared<DynamicKernelStringArgument>(mCalcConfig, + ts, ft->Children[i])); } else if (AllStringsAreNull(pSVR->GetArray().mpStringArray, pSVR->GetArrayLength()) && pSVR->GetArray().mpNumericArray == nullptr) @@ -2884,8 +2883,8 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, // array of NANs SAL_INFO("sc.opencl", "Only empty cells"); mvSubArguments.push_back( - DynamicKernelArgumentRef(new VectorRef(mCalcConfig, ts, - ft->Children[i]))); + std::make_shared<VectorRef>(mCalcConfig, ts, + ft->Children[i])); } else { @@ -2898,16 +2897,16 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, { SAL_INFO("sc.opencl", "Constant number case"); mvSubArguments.push_back( - DynamicKernelArgumentRef(new DynamicKernelConstantArgument(mCalcConfig, ts, - ft->Children[i]))); + std::make_shared<DynamicKernelConstantArgument>(mCalcConfig, ts, + ft->Children[i])); } else if (pChild->GetType() == formula::svString && pCodeGen->takeString()) { SAL_INFO("sc.opencl", "Constant string case"); mvSubArguments.push_back( - DynamicKernelArgumentRef(new ConstStringArgument(mCalcConfig, ts, - ft->Children[i]))); + std::make_shared<ConstStringArgument>(mCalcConfig, ts, + ft->Children[i])); } else { @@ -3388,13 +3387,13 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, break; case ocPi: mvSubArguments.push_back( - DynamicKernelArgumentRef(new DynamicKernelPiArgument(mCalcConfig, ts, - ft->Children[i]))); + std::make_shared<DynamicKernelPiArgument>(mCalcConfig, ts, + ft->Children[i])); break; case ocRandom: mvSubArguments.push_back( - DynamicKernelArgumentRef(new DynamicKernelRandomArgument(mCalcConfig, ts, - ft->Children[i]))); + std::make_shared<DynamicKernelRandomArgument>(mCalcConfig, ts, + ft->Children[i])); break; case ocProduct: mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, @@ -4115,7 +4114,7 @@ const DynamicKernelArgument* SymbolTable::DeclRefArg(const ScCalcConfig& config, // Allocate new symbols std::stringstream ss; ss << "tmp" << mCurId++; - DynamicKernelArgumentRef new_arg(new T(config, ss.str(), t, pCodeGen, nResultSize)); + DynamicKernelArgumentRef new_arg = std::make_shared<T>(config, ss.str(), t, pCodeGen, nResultSize); mSymbols[ref] = new_arg; mParams.push_back(new_arg); return new_arg.get(); @@ -4148,7 +4147,7 @@ std::unique_ptr<DynamicKernel> DynamicKernel::create( const ScCalcConfig& rConfi OpCode eOp = pCur->GetOpCode(); if (eOp != ocPush) { - FormulaTreeNodeRef pCurNode(new FormulaTreeNode(pCur)); + FormulaTreeNodeRef pCurNode = std::make_shared<FormulaTreeNode>(pCur); sal_uInt8 nParamCount = pCur->GetParamCount(); for (sal_uInt8 i = 0; i < nParamCount; i++) { diff --git a/sc/source/core/tool/calcconfig.cxx b/sc/source/core/tool/calcconfig.cxx index 72f86052c0ca..9ef2ccf13098 100644 --- a/sc/source/core/tool/calcconfig.cxx +++ b/sc/source/core/tool/calcconfig.cxx @@ -209,7 +209,7 @@ OUString ScOpCodeSetToSymbolicString(const ScCalcConfig::OpCodeSet& rOpCodes) ScCalcConfig::OpCodeSet ScStringToOpCodeSet(const OUString& rOpCodes) { - ScCalcConfig::OpCodeSet result(new o3tl::sorted_vector< OpCode >); + ScCalcConfig::OpCodeSet result = std::make_shared<o3tl::sorted_vector< OpCode >>(); formula::FormulaCompiler aCompiler; formula::FormulaCompiler::OpCodeMapPtr pOpCodeMap(aCompiler.GetOpCodeMap(css::sheet::FormulaLanguage::ENGLISH)); diff --git a/sc/source/core/tool/simplerangelist.cxx b/sc/source/core/tool/simplerangelist.cxx index 0dacf14d0464..671f91f5669a 100644 --- a/sc/source/core/tool/simplerangelist.cxx +++ b/sc/source/core/tool/simplerangelist.cxx @@ -175,7 +175,7 @@ ScSimpleRangeList::RangeListRef ScSimpleRangeList::findTab(SCTAB nTab) TabType::iterator itr = maTabs.find(nTab); if (itr == maTabs.end()) { - RangeListRef p(new list<Range>); + RangeListRef p = std::make_shared<list<Range>>(); pair<TabType::iterator, bool> r = maTabs.emplace(nTab, p); if (!r.second) return RangeListRef(); diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index 35e333fc4a7f..ca21fe210da5 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -110,7 +110,7 @@ ExcTable::ExcTable( const XclExpRoot& rRoot ) : XclExpRoot( rRoot ), mnScTab( SCTAB_GLOBAL ), nExcTab( EXC_NOTAB ), - mxNoteList( new XclExpNoteList ) + mxNoteList( std::make_shared<XclExpNoteList>() ) { } @@ -118,7 +118,7 @@ ExcTable::ExcTable( const XclExpRoot& rRoot, SCTAB nScTab ) : XclExpRoot( rRoot ), mnScTab( nScTab ), nExcTab( rRoot.GetTabInfo().GetXclTab( nScTab ) ), - mxNoteList( new XclExpNoteList ) + mxNoteList( std::make_shared<XclExpNoteList>() ) { } @@ -257,7 +257,7 @@ void ExcTable::FillAsHeaderBinary( ExcBoundsheetList& rBoundsheetList ) for( nC = 0 ; nC < nScTabCount ; nC++ ) if( rTabInfo.IsExportTab( nC ) ) { - ExcBoundsheetList::RecordRefType xBoundsheet( new ExcBundlesheet( rR, nC ) ); + ExcBoundsheetList::RecordRefType xBoundsheet = std::make_shared<ExcBundlesheet>( rR, nC ); aRecList.AppendRecord( xBoundsheet ); rBoundsheetList.AppendRecord( xBoundsheet ); } @@ -282,7 +282,7 @@ void ExcTable::FillAsHeaderBinary( ExcBoundsheetList& rBoundsheetList ) for( nC = 0 ; nC < nScTabCount ; nC++ ) if( rTabInfo.IsExportTab( nC ) ) { - ExcBoundsheetList::RecordRefType xBoundsheet( new ExcBundlesheet8( rR, nC ) ); + ExcBoundsheetList::RecordRefType xBoundsheet = std::make_shared<ExcBundlesheet8>( rR, nC ); aRecList.AppendRecord( xBoundsheet ); rBoundsheetList.AppendRecord( xBoundsheet ); } @@ -291,7 +291,7 @@ void ExcTable::FillAsHeaderBinary( ExcBoundsheetList& rBoundsheetList ) for( SCTAB nAdd = 0; nC < static_cast<SCTAB>(nCodenames) ; nC++, nAdd++ ) { aTmpString = lcl_GetVbaTabName( nAdd ); - ExcBoundsheetList::RecordRefType xBoundsheet( new ExcBundlesheet8( aTmpString ) ); + ExcBoundsheetList::RecordRefType xBoundsheet = std::make_shared<ExcBundlesheet8>( aTmpString ); aRecList.AppendRecord( xBoundsheet ); rBoundsheetList.AppendRecord( xBoundsheet ); } @@ -374,7 +374,7 @@ void ExcTable::FillAsHeaderXml( ExcBoundsheetList& rBoundsheetList ) for( nC = 0 ; nC < nScTabCount ; nC++ ) if( rTabInfo.IsExportTab( nC ) ) { - ExcBoundsheetList::RecordRefType xBoundsheet( new ExcBundlesheet8( rR, nC ) ); + ExcBoundsheetList::RecordRefType xBoundsheet = std::make_shared<ExcBundlesheet8>( rR, nC ); aRecList.AppendRecord( xBoundsheet ); rBoundsheetList.AppendRecord( xBoundsheet ); } @@ -384,7 +384,7 @@ void ExcTable::FillAsHeaderXml( ExcBoundsheetList& rBoundsheetList ) for( SCTAB nAdd = 0; nC < static_cast<SCTAB>(nCodenames) ; nC++, nAdd++ ) { aTmpString = lcl_GetVbaTabName( nAdd ); - ExcBoundsheetList::RecordRefType xBoundsheet( new ExcBundlesheet8( aTmpString ) ); + ExcBoundsheetList::RecordRefType xBoundsheet = std::make_shared<ExcBundlesheet8>( aTmpString ); aRecList.AppendRecord( xBoundsheet ); rBoundsheetList.AppendRecord( xBoundsheet ); } @@ -417,7 +417,7 @@ void ExcTable::FillAsTableBinary( SCTAB nCodeNameIdx ) GetObjectManager().StartSheet(); // cell table: DEFROWHEIGHT, DEFCOLWIDTH, COLINFO, DIMENSIONS, ROW, cell records - mxCellTable.reset( new XclExpCellTable( GetRoot() ) ); + mxCellTable = std::make_shared<XclExpCellTable>( GetRoot() ); //export cell notes std::vector<sc::NoteEntry> aNotes; @@ -558,7 +558,7 @@ void ExcTable::FillAsTableXml() GetObjectManager().StartSheet(); // cell table: DEFROWHEIGHT, DEFCOLWIDTH, COLINFO, DIMENSIONS, ROW, cell records - mxCellTable.reset( new XclExpCellTable( GetRoot() ) ); + mxCellTable = std::make_shared<XclExpCellTable>( GetRoot() ); //export cell notes std::vector<sc::NoteEntry> aNotes; @@ -573,7 +573,7 @@ void ExcTable::FillAsTableXml() // WSBOOL needs data from page settings, create it here, add it later auto xPageSett = std::make_shared<XclExpPageSettings>( GetRoot() ); - XclExtLstRef xExtLst( new XclExtLst( GetRoot() ) ); + XclExtLstRef xExtLst = std::make_shared<XclExtLst>( GetRoot() ); bool bFitToPages = xPageSett->GetPageData().mbFitToPages; Color aTabColor = GetRoot().GetDoc().GetTabBgColor(mnScTab); @@ -734,7 +734,7 @@ void ExcDocument::ReadDoc() { if( GetTabInfo().IsExportTab( nScTab ) ) { - ExcTableList::RecordRefType xTab( new ExcTable( GetRoot(), nScTab ) ); + ExcTableList::RecordRefType xTab = std::make_shared<ExcTable>( GetRoot(), nScTab ); maTableList.AppendRecord( xTab ); if (GetOutput() == EXC_OUTPUT_BINARY) xTab->FillAsTableBinary(nCodeNameIdx); @@ -746,7 +746,7 @@ void ExcDocument::ReadDoc() } for( ; nCodeNameIdx < nCodeNameCount; ++nScTab, ++nCodeNameIdx ) { - ExcTableList::RecordRefType xTab( new ExcTable( GetRoot(), nScTab ) ); + ExcTableList::RecordRefType xTab = std::make_shared<ExcTable>( GetRoot(), nScTab ); maTableList.AppendRecord( xTab ); xTab->FillAsEmptyTable( nCodeNameIdx ); } @@ -852,8 +852,8 @@ void ExcDocument::WriteXml( XclExpXmlStream& rStrm ) if ( rCalcConfig.mbHasStringRefSyntax || (eConv != formula::FormulaGrammar::CONV_XL_A1) ) { - XclExtLstRef xExtLst( new XclExtLst( GetRoot() ) ); - xExtLst->AddRecord( XclExpExtRef( new XclExpExtCalcPr( GetRoot(), eConv )) ); + XclExtLstRef xExtLst = std::make_shared<XclExtLst>( GetRoot() ); + xExtLst->AddRecord( std::make_shared<XclExpExtCalcPr>( GetRoot(), eConv ) ); xExtLst->SaveXml(rStrm); } diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index b68fa71e018a..f8d1861bdea1 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -944,7 +944,7 @@ XclExpAutofilter* ExcAutoFilterRecs::GetByCol( SCCOL nCol ) if( xFilter->GetCol() == static_cast<sal_uInt16>(nCol) ) return xFilter.get(); } - xFilter.reset( new XclExpAutofilter( GetRoot(), static_cast<sal_uInt16>(nCol) ) ); + xFilter = std::make_shared<XclExpAutofilter>( GetRoot(), static_cast<sal_uInt16>(nCol) ); maFilterList.AppendRecord( xFilter ); return xFilter.get(); } @@ -1005,7 +1005,7 @@ XclExpFilterManager::XclExpFilterManager( const XclExpRoot& rRoot ) : void XclExpFilterManager::InitTabFilter( SCTAB nScTab ) { - maFilterMap[ nScTab ].reset( new ExcAutoFilterRecs( GetRoot(), nScTab, nullptr ) ); + maFilterMap[ nScTab ] = std::make_shared<ExcAutoFilterRecs>( GetRoot(), nScTab, nullptr ); } XclExpRecordRef XclExpFilterManager::CreateRecord( SCTAB nScTab ) diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx index 16676c8f0192..e200dc2aea89 100644 --- a/sc/source/filter/excel/impop.cxx +++ b/sc/source/filter/excel/impop.cxx @@ -1353,9 +1353,9 @@ void ImportExcel::PostDocLoad() XclImpOutlineDataBuffer::XclImpOutlineDataBuffer( const XclImpRoot& rRoot, SCTAB nScTab ) : XclImpRoot( rRoot ), - mxColOutlineBuff( new XclImpOutlineBuffer( rRoot.GetXclMaxPos().Col() + 1 ) ), - mxRowOutlineBuff( new XclImpOutlineBuffer( rRoot.GetXclMaxPos().Row() + 1 ) ), - mxColRowBuff( new XclImpColRowSettings( rRoot ) ), + mxColOutlineBuff( std::make_shared<XclImpOutlineBuffer>( rRoot.GetXclMaxPos().Col() + 1 ) ), + mxRowOutlineBuff( std::make_shared<XclImpOutlineBuffer>( rRoot.GetXclMaxPos().Row() + 1 ) ), + mxColRowBuff( std::make_shared<XclImpColRowSettings>( rRoot ) ), mnScTab( nScTab ) { } diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index bd9e3d767e47..9c801579b728 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -293,7 +293,7 @@ void XclExpChRootData::FinalizeFutureRecBlock( XclExpStream& rStrm ) XclExpChRoot::XclExpChRoot( const XclExpRoot& rRoot, XclExpChChart& rChartData ) : XclExpRoot( rRoot ), - mxChData( new XclExpChRootData( rChartData ) ) + mxChData( std::make_shared<XclExpChRootData>( rChartData ) ) { } @@ -561,7 +561,7 @@ namespace { XclExpChLineFormatRef lclCreateLineFormat( const XclExpChRoot& rRoot, const ScfPropertySet& rPropSet, XclChObjectType eObjType ) { - XclExpChLineFormatRef xLineFmt( new XclExpChLineFormat( rRoot ) ); + XclExpChLineFormatRef xLineFmt = std::make_shared<XclExpChLineFormat>( rRoot ); xLineFmt->Convert( rRoot, rPropSet, eObjType ); const XclChFormatInfo& rFmtInfo = rRoot.GetFormatInfo( eObjType ); if( rFmtInfo.mbDeleteDefFrame && xLineFmt->IsDefault( rFmtInfo.meDefFrameType ) ) @@ -731,16 +731,16 @@ void XclExpChFrameBase::ConvertFrameBase( const XclExpChRoot& rRoot, const ScfPropertySet& rPropSet, XclChObjectType eObjType ) { // line format - mxLineFmt.reset( new XclExpChLineFormat( rRoot ) ); + mxLineFmt = std::make_shared<XclExpChLineFormat>( rRoot ); mxLineFmt->Convert( rRoot, rPropSet, eObjType ); // area format (only for frame objects) if( rRoot.GetFormatInfo( eObjType ).mbIsFrame ) { - mxAreaFmt.reset( new XclExpChAreaFormat( rRoot ) ); + mxAreaFmt = std::make_shared<XclExpChAreaFormat>( rRoot ); bool bComplexFill = mxAreaFmt->Convert( rRoot, rPropSet, eObjType ); if( (rRoot.GetBiff() == EXC_BIFF8) && bComplexFill ) { - mxEscherFmt.reset( new XclExpChEscherFormat( rRoot ) ); + mxEscherFmt = std::make_shared<XclExpChEscherFormat>( rRoot ); mxEscherFmt->Convert( rPropSet, eObjType ); if( mxEscherFmt->IsValid() ) mxAreaFmt->SetAuto( false ); @@ -754,12 +754,12 @@ void XclExpChFrameBase::SetDefaultFrameBase( const XclExpChRoot& rRoot, XclChFrameType eDefFrameType, bool bIsFrame ) { // line format - mxLineFmt.reset( new XclExpChLineFormat( rRoot ) ); + mxLineFmt = std::make_shared<XclExpChLineFormat>( rRoot ); mxLineFmt->SetDefault( eDefFrameType ); // area format (only for frame objects) if( bIsFrame ) { - mxAreaFmt.reset( new XclExpChAreaFormat( rRoot ) ); + mxAreaFmt = std::make_shared<XclExpChAreaFormat>( rRoot ); mxAreaFmt->SetDefault( eDefFrameType ); mxEscherFmt.reset(); } @@ -836,7 +836,7 @@ namespace { XclExpChFrameRef lclCreateFrame( const XclExpChRoot& rRoot, const ScfPropertySet& rPropSet, XclChObjectType eObjType ) { - XclExpChFrameRef xFrame( new XclExpChFrame( rRoot, eObjType ) ); + XclExpChFrameRef xFrame = std::make_shared<XclExpChFrame>( rRoot, eObjType ); xFrame->Convert( rPropSet ); if( xFrame->IsDeleteable() ) xFrame.reset(); @@ -1131,7 +1131,7 @@ void XclExpChFontBase::ConvertFontBase( const XclExpChRoot& rRoot, sal_uInt16 nF { if( const XclExpFont* pFont = rRoot.GetFontBuffer().GetFont( nFontIdx ) ) { - XclExpChFontRef xFont( new XclExpChFont( nFontIdx ) ); + XclExpChFontRef xFont = std::make_shared<XclExpChFont>( nFontIdx ); SetFont( xFont, pFont->GetFontData().maColor, pFont->GetFontColorId() ); } } @@ -1178,7 +1178,7 @@ void XclExpChText::ConvertTitle( Reference< XTitle > const & xTitle, sal_uInt16 } mxSrcLink.reset(); - mxObjLink.reset( new XclExpChObjectLink( nTarget, XclChDataPointPos( 0, 0 ) ) ); + mxObjLink = std::make_shared<XclExpChObjectLink>( nTarget, XclChDataPointPos( 0, 0 ) ); if( xTitle.is() ) { @@ -1187,7 +1187,7 @@ void XclExpChText::ConvertTitle( Reference< XTitle > const & xTitle, sal_uInt16 mxFrame = lclCreateFrame( GetChRoot(), aTitleProp, EXC_CHOBJTYPE_TEXT ); // string sequence - mxSrcLink.reset( new XclExpChSourceLink( GetChRoot(), EXC_CHSRCLINK_TITLE ) ); + mxSrcLink = std::make_shared<XclExpChSourceLink>( GetChRoot(), EXC_CHSRCLINK_TITLE ); sal_uInt16 nFontIdx = mxSrcLink->ConvertStringSequence( xTitle->getText() ); if (pSubTitle) { @@ -1202,7 +1202,7 @@ void XclExpChText::ConvertTitle( Reference< XTitle > const & xTitle, sal_uInt16 ConvertRotationBase( aTitleProp, true ); // manual text position - only for main title - mxFramePos.reset( new XclExpChFramePos( EXC_CHFRAMEPOS_PARENT ) ); + mxFramePos = std::make_shared<XclExpChFramePos>( EXC_CHFRAMEPOS_PARENT ); if( nTarget == EXC_CHOBJLINK_TITLE ) { Any aRelPos; @@ -1269,7 +1269,7 @@ bool XclExpChText::ConvertDataLabel( const ScfPropertySet& rPropSet, // create the CHFRLABELPROPS record for extended settings in BIFF8 if( bShowAny && (GetBiff() == EXC_BIFF8) ) { - mxLabelProps.reset( new XclExpChFrLabelProps( GetChRoot() ) ); + mxLabelProps = std::make_shared<XclExpChFrLabelProps>( GetChRoot() ); mxLabelProps->Convert( rPropSet, bShowCateg, bShowValue, bShowPercent, bShowBubble ); } @@ -1323,12 +1323,12 @@ bool XclExpChText::ConvertDataLabel( const ScfPropertySet& rPropSet, } ::insert_value( maData.mnFlags2, nLabelPos, 0, 4 ); // source link (contains number format) - mxSrcLink.reset( new XclExpChSourceLink( GetChRoot(), EXC_CHSRCLINK_TITLE ) ); + mxSrcLink = std::make_shared<XclExpChSourceLink>( GetChRoot(), EXC_CHSRCLINK_TITLE ); if( bShowValue || bShowPercent ) // percentage format wins over value format mxSrcLink->ConvertNumFmt( rPropSet, bShowPercent ); // object link - mxObjLink.reset( new XclExpChObjectLink( EXC_CHOBJLINK_DATA, rPointPos ) ); + mxObjLink = std::make_shared<XclExpChObjectLink>( EXC_CHOBJLINK_DATA, rPointPos ); } /* Return true to indicate valid label settings: @@ -1350,10 +1350,10 @@ void XclExpChText::ConvertTrendLineEquation( const ScfPropertySet& rPropSet, con maData.mnVAlign = EXC_CHTEXT_ALIGN_TOPLEFT; ConvertFontBase( GetChRoot(), rPropSet ); // source link (contains number format) - mxSrcLink.reset( new XclExpChSourceLink( GetChRoot(), EXC_CHSRCLINK_TITLE ) ); + mxSrcLink = std::make_shared<XclExpChSourceLink>( GetChRoot(), EXC_CHSRCLINK_TITLE ); mxSrcLink->ConvertNumFmt( rPropSet, false ); // object link - mxObjLink.reset( new XclExpChObjectLink( EXC_CHOBJLINK_DATA, rPointPos ) ); + mxObjLink = std::make_shared<XclExpChObjectLink>( EXC_CHOBJLINK_DATA, rPointPos ); } sal_uInt16 XclExpChText::GetAttLabelFlags() const @@ -1409,7 +1409,7 @@ XclExpChTextRef lclCreateTitle( const XclExpChRoot& rRoot, Reference< XTitled > if( xTitled.is() ) xTitle = xTitled->getTitleObject(); - XclExpChTextRef xText( new XclExpChText( rRoot ) ); + XclExpChTextRef xText = std::make_shared<XclExpChText>( rRoot ); xText->ConvertTitle( xTitle, nTarget, pSubTitle ); /* Do not delete the CHTEXT group for the main title. A missing CHTEXT will be interpreted as auto-generated title showing the series title in @@ -1565,35 +1565,35 @@ void XclExpChDataFormat::ConvertDataSeries( const ScfPropertySet& rPropSet, cons bool bIsFrame = rTypeInfo.IsSeriesFrameFormat(); if( !bIsFrame ) { - mxMarkerFmt.reset( new XclExpChMarkerFormat( GetChRoot() ) ); + mxMarkerFmt = std::make_shared<XclExpChMarkerFormat>( GetChRoot() ); mxMarkerFmt->Convert( GetChRoot(), rPropSet, maData.mnFormatIdx ); } // pie segments if( rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_PIE ) { - mxPieFmt.reset( new XclExpChPieFormat ); + mxPieFmt = std::make_shared<XclExpChPieFormat>(); mxPieFmt->Convert( rPropSet ); } // 3D bars (only allowed for entire series in BIFF8) if( IsSeriesFormat() && (GetBiff() == EXC_BIFF8) && rTypeInfo.mb3dChart && (rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_BAR) ) { - mx3dDataFmt.reset( new XclExpCh3dDataFormat ); + mx3dDataFmt = std::make_shared<XclExpCh3dDataFormat>(); mx3dDataFmt->Convert( rPropSet ); } // spline if( IsSeriesFormat() && rTypeInfo.mbSpline && !bIsFrame ) - mxSeriesFmt.reset( new XclExpUInt16Record( EXC_ID_CHSERIESFORMAT, EXC_CHSERIESFORMAT_SMOOTHED ) ); + mxSeriesFmt = std::make_shared<XclExpUInt16Record>( EXC_ID_CHSERIESFORMAT, EXC_CHSERIESFORMAT_SMOOTHED ); // data point labels - XclExpChTextRef xLabel( new XclExpChText( GetChRoot() ) ); + XclExpChTextRef xLabel = std::make_shared<XclExpChText>( GetChRoot() ); if( xLabel->ConvertDataLabel( rPropSet, rTypeInfo, maData.maPointPos ) ) { // CHTEXT groups for data labels are stored in global CHCHART group GetChartData().SetDataLabel( xLabel ); - mxAttLabel.reset( new XclExpChAttachedLabel( xLabel->GetAttLabelFlags() ) ); + mxAttLabel = std::make_shared<XclExpChAttachedLabel>( xLabel->GetAttLabelFlags() ); } } @@ -1602,7 +1602,7 @@ void XclExpChDataFormat::ConvertStockSeries( const ScfPropertySet& rPropSet, boo // set line format to invisible SetDefaultFrameBase( GetChRoot(), EXC_CHFRAMETYPE_INVISIBLE, false ); // set symbols to invisible or to 'close' series symbol - mxMarkerFmt.reset( new XclExpChMarkerFormat( GetChRoot() ) ); + mxMarkerFmt = std::make_shared<XclExpChMarkerFormat>( GetChRoot() ); mxMarkerFmt->ConvertStockSymbol( GetChRoot(), rPropSet, bCloseSymbol ); } @@ -1689,7 +1689,7 @@ bool XclExpChSerTrendLine::Convert( Reference< XRegressionCurve > const & xRegCu // line formatting XclChDataPointPos aPointPos( nSeriesIdx ); - mxDataFmt.reset( new XclExpChDataFormat( GetChRoot(), aPointPos, 0 ) ); + mxDataFmt = std::make_shared<XclExpChDataFormat>( GetChRoot(), aPointPos, 0 ); mxDataFmt->ConvertLine( aCurveProp, EXC_CHOBJTYPE_TRENDLINE ); // #i83100# show equation and correlation coefficient @@ -1700,7 +1700,7 @@ bool XclExpChSerTrendLine::Convert( Reference< XRegressionCurve > const & xRegCu // #i83100# formatting of the equation text box if( (maData.mnShowEquation != 0) || (maData.mnShowRSquared != 0) ) { - mxLabel.reset( new XclExpChText( GetChRoot() ) ); + mxLabel = std::make_shared<XclExpChText>( GetChRoot() ); mxLabel->ConvertTrendLineEquation( aEquationProp, aPointPos ); } @@ -1826,11 +1826,11 @@ XclExpChSeries::XclExpChSeries( const XclExpChRoot& rRoot, sal_uInt16 nSeriesIdx mnParentIdx( EXC_CHSERIES_INVALID ) { // CHSOURCELINK records are always required, even if unused - mxTitleLink.reset( new XclExpChSourceLink( GetChRoot(), EXC_CHSRCLINK_TITLE ) ); - mxValueLink.reset( new XclExpChSourceLink( GetChRoot(), EXC_CHSRCLINK_VALUES ) ); - mxCategLink.reset( new XclExpChSourceLink( GetChRoot(), EXC_CHSRCLINK_CATEGORY ) ); + mxTitleLink = std::make_shared<XclExpChSourceLink>( GetChRoot(), EXC_CHSRCLINK_TITLE ); + mxValueLink = std::make_shared<XclExpChSourceLink>( GetChRoot(), EXC_CHSRCLINK_VALUES ); + mxCategLink = std::make_shared<XclExpChSourceLink>( GetChRoot(), EXC_CHSRCLINK_CATEGORY ); if( GetBiff() == EXC_BIFF8 ) - mxBubbleLink.reset( new XclExpChSourceLink( GetChRoot(), EXC_CHSRCLINK_BUBBLES ) ); + mxBubbleLink = std::make_shared<XclExpChSourceLink>( GetChRoot(), EXC_CHSRCLINK_BUBBLES ); } bool XclExpChSeries::ConvertDataSeries( @@ -1890,7 +1890,7 @@ bool XclExpChSeries::ConvertDataSeries( // series formatting XclChDataPointPos aPointPos( mnSeriesIdx ); ScfPropertySet aSeriesProp( xDataSeries ); - mxSeriesFmt.reset( new XclExpChDataFormat( GetChRoot(), aPointPos, nFormatIdx ) ); + mxSeriesFmt = std::make_shared<XclExpChDataFormat>( GetChRoot(), aPointPos, nFormatIdx ); mxSeriesFmt->ConvertDataSeries( aSeriesProp, rTypeInfo ); // trend lines @@ -1941,7 +1941,7 @@ bool XclExpChSeries::ConvertDataSeries( break; aPointPos.mnPointIdx = static_cast< sal_uInt16 >( nPointIndex ); ScfPropertySet aPointProp = lclGetPointPropSet( xDataSeries, nPointIndex ); - XclExpChDataFormatRef xPointFmt( new XclExpChDataFormat( GetChRoot(), aPointPos, nFormatIdx ) ); + XclExpChDataFormatRef xPointFmt = std::make_shared<XclExpChDataFormat>( GetChRoot(), aPointPos, nFormatIdx ); xPointFmt->ConvertDataSeries( aPointProp, rTypeInfo ); maPointFmts.AppendRecord( xPointFmt ); } @@ -1986,7 +1986,7 @@ bool XclExpChSeries::ConvertStockSeries( css::uno::Reference< css::chart2::XData mxTitleLink->ConvertDataSequence( xTitleSeq, true ); // series formatting ScfPropertySet aSeriesProp( xDataSeries ); - mxSeriesFmt.reset( new XclExpChDataFormat( GetChRoot(), XclChDataPointPos( mnSeriesIdx ), nFormatIdx ) ); + mxSeriesFmt = std::make_shared<XclExpChDataFormat>( GetChRoot(), XclChDataPointPos( mnSeriesIdx ), nFormatIdx ); mxSeriesFmt->ConvertStockSeries( aSeriesProp, bCloseSymbol ); } } @@ -1997,7 +1997,7 @@ bool XclExpChSeries::ConvertTrendLine( const XclExpChSeries& rParent, Reference< { InitFromParent( rParent ); - mxTrendLine.reset( new XclExpChSerTrendLine( GetChRoot() ) ); + mxTrendLine = std::make_shared<XclExpChSerTrendLine>( GetChRoot() ); bool bOk = mxTrendLine->Convert( xRegCurve, mnSeriesIdx ); if( bOk ) { @@ -2016,12 +2016,12 @@ bool XclExpChSeries::ConvertErrorBar( const XclExpChSeries& rParent, const ScfPr { InitFromParent( rParent ); // error bar settings - mxErrorBar.reset( new XclExpChSerErrorBar( GetChRoot(), nBarId ) ); + mxErrorBar = std::make_shared<XclExpChSerErrorBar>( GetChRoot(), nBarId ); bool bOk = mxErrorBar->Convert( *mxValueLink, maData.mnValueCount, rPropSet ); if( bOk ) { // error bar formatting - mxSeriesFmt.reset( new XclExpChDataFormat( GetChRoot(), XclChDataPointPos( mnSeriesIdx ), 0 ) ); + mxSeriesFmt = std::make_shared<XclExpChDataFormat>( GetChRoot(), XclChDataPointPos( mnSeriesIdx ), 0 ); mxSeriesFmt->ConvertLine( rPropSet, EXC_CHOBJTYPE_ERRORBAR ); } return bOk; @@ -2271,7 +2271,7 @@ void XclExpChLegend::Convert( const ScfPropertySet& rPropSet ) // frame properties mxFrame = lclCreateFrame( GetChRoot(), rPropSet, EXC_CHOBJTYPE_LEGEND ); // text properties - mxText.reset( new XclExpChText( GetChRoot() ) ); + mxText = std::make_shared<XclExpChText>( GetChRoot() ); mxText->ConvertLegend( rPropSet ); // legend position and size @@ -2293,7 +2293,7 @@ void XclExpChLegend::Convert( const ScfPropertySet& rPropSet ) Reference< cssc::XChartDocument > xChart1Doc( GetChartDocument(), UNO_QUERY_THROW ); Reference< XShape > xChart1Legend( xChart1Doc->getLegend(), UNO_SET_THROW ); // coordinates in CHLEGEND record written but not used by Excel - mxFramePos.reset( new XclExpChFramePos( EXC_CHFRAMEPOS_CHARTSIZE ) ); + mxFramePos = std::make_shared<XclExpChFramePos>( EXC_CHFRAMEPOS_CHARTSIZE ); XclChFramePos& rFramePos = mxFramePos->GetFramePosData(); rFramePos.mnTLMode = EXC_CHFRAMEPOS_CHARTSIZE; css::awt::Point aLegendPos = xChart1Legend->getPosition(); @@ -2312,7 +2312,7 @@ void XclExpChLegend::Convert( const ScfPropertySet& rPropSet ) maData.mnDockMode = EXC_CHLEGEND_NOTDOCKED; // a CHFRAME record with cleared auto flags is needed if( !mxFrame ) - mxFrame.reset( new XclExpChFrame( GetChRoot(), EXC_CHOBJTYPE_LEGEND ) ); + mxFrame = std::make_shared<XclExpChFrame>( GetChRoot(), EXC_CHOBJTYPE_LEGEND ); mxFrame->SetAutoFlags( false, false ); } catch( Exception& ) @@ -2409,7 +2409,7 @@ void XclExpChTypeGroup::ConvertType( // 3d chart settings if( maTypeInfo.mb3dChart ) // only true, if Excel chart supports 3d mode { - mxChart3d.reset( new XclExpChChart3d ); + mxChart3d = std::make_shared<XclExpChChart3d>(); ScfPropertySet aDiaProp( xDiagram ); mxChart3d->Convert( aDiaProp, Is3dWallChart() ); } @@ -2494,7 +2494,7 @@ void XclExpChTypeGroup::ConvertLegend( const ScfPropertySet& rPropSet ) { if( rPropSet.GetBoolProperty( EXC_CHPROP_SHOW ) ) { - mxLegend.reset( new XclExpChLegend( GetChRoot() ) ); + mxLegend = std::make_shared<XclExpChLegend>( GetChRoot() ); mxLegend->Convert( rPropSet ); } } @@ -2546,7 +2546,7 @@ void XclExpChTypeGroup::CreateAllStockSeries( if( bHasHigh && bHasLow && aTypeProp.GetBoolProperty( EXC_CHPROP_SHOWHIGHLOW ) ) { ScfPropertySet aSeriesProp( xDataSeries ); - XclExpChLineFormatRef xLineFmt( new XclExpChLineFormat( GetChRoot() ) ); + XclExpChLineFormatRef xLineFmt = std::make_shared<XclExpChLineFormat>( GetChRoot() ); xLineFmt->Convert( GetChRoot(), aSeriesProp, EXC_CHOBJTYPE_HILOLINE ); sal_uInt16 nKey = EXC_CHCHARTLINE_HILO; m_ChartLines.insert(std::make_pair(nKey, std::make_unique<XclExpChLineFormat>(GetChRoot()))); @@ -2559,12 +2559,12 @@ void XclExpChTypeGroup::CreateAllStockSeries( // white dropbar format aTypeProp.GetProperty( xWhitePropSet, EXC_CHPROP_WHITEDAY ); ScfPropertySet aWhiteProp( xWhitePropSet ); - mxUpBar.reset( new XclExpChDropBar( GetChRoot(), EXC_CHOBJTYPE_WHITEDROPBAR ) ); + mxUpBar = std::make_shared<XclExpChDropBar>( GetChRoot(), EXC_CHOBJTYPE_WHITEDROPBAR ); mxUpBar->Convert( aWhiteProp ); // black dropbar format aTypeProp.GetProperty( xBlackPropSet, EXC_CHPROP_BLACKDAY ); ScfPropertySet aBlackProp( xBlackPropSet ); - mxDownBar.reset( new XclExpChDropBar( GetChRoot(), EXC_CHOBJTYPE_BLACKDROPBAR ) ); + mxDownBar = std::make_shared<XclExpChDropBar>( GetChRoot(), EXC_CHOBJTYPE_BLACKDROPBAR ); mxDownBar->Convert( aBlackProp ); } } @@ -2945,7 +2945,7 @@ void XclExpChAxis::Convert( Reference< XAxis > const & xAxis, Reference< XAxis > // axis line format ------------------------------------------------------- - mxAxisLine.reset( new XclExpChLineFormat( GetChRoot() ) ); + mxAxisLine = std::make_shared<XclExpChLineFormat>( GetChRoot() ); mxAxisLine->Convert( GetChRoot(), aAxisProp, EXC_CHOBJTYPE_AXISLINE ); // #i58688# axis enabled mxAxisLine->SetShowAxis( aAxisProp.GetBoolProperty( EXC_CHPROP_SHOW ) ); @@ -2955,7 +2955,7 @@ void XclExpChAxis::Convert( Reference< XAxis > const & xAxis, Reference< XAxis > ScfPropertySet aCrossingProp( xCrossingAxis ); if( bCategoryAxis ) { - mxLabelRange.reset( new XclExpChLabelRange( GetChRoot() ) ); + mxLabelRange = std::make_shared<XclExpChLabelRange>( GetChRoot() ); mxLabelRange->SetTicksBetweenCateg( rTypeInfo.mbTicksBetweenCateg ); if( xAxis.is() ) { @@ -2969,7 +2969,7 @@ void XclExpChAxis::Convert( Reference< XAxis > const & xAxis, Reference< XAxis > } else { - mxValueRange.reset( new XclExpChValueRange( GetChRoot() ) ); + mxValueRange = std::make_shared<XclExpChValueRange>( GetChRoot() ); if( xAxis.is() ) mxValueRange->Convert( xAxis->getScaleData() ); // get position of crossing axis on this axis from passed axis object @@ -2980,7 +2980,7 @@ void XclExpChAxis::Convert( Reference< XAxis > const & xAxis, Reference< XAxis > // axis caption text ------------------------------------------------------ // axis ticks properties - mxTick.reset( new XclExpChTick( GetChRoot() ) ); + mxTick = std::make_shared<XclExpChTick>( GetChRoot() ); mxTick->Convert( aAxisProp, rTypeInfo, GetAxisType() ); // axis label formatting and rotation @@ -3117,7 +3117,7 @@ sal_uInt16 XclExpChAxesSet::Convert( Reference< XDiagram > const & xDiagram, sal const Sequence< Reference< XChartType > > aChartTypeSeq = xChartTypeCont->getChartTypes(); for( const Reference< XChartType >& rChartType : aChartTypeSeq ) { - XclExpChTypeGroupRef xTypeGroup( new XclExpChTypeGroup( GetChRoot(), nGroupIdx ) ); + XclExpChTypeGroupRef xTypeGroup = std::make_shared<XclExpChTypeGroup>( GetChRoot(), nGroupIdx ); xTypeGroup->ConvertType( xDiagram, rChartType, nApiAxesSetIdx, b3dChart, bSwappedAxesSet, bHasXLabels ); /* If new chart type group cannot be inserted into a combination chart with existing type groups, insert all series into last @@ -3205,7 +3205,7 @@ sal_uInt16 XclExpChAxesSet::Convert( Reference< XDiagram > const & xDiagram, sal // the CHAXESSET record contains the inner plot area maData.maRect = CalcChartRectFromHmm( xPositioning->calculateDiagramPositionExcludingAxes() ); // the embedded CHFRAMEPOS record contains the outer plot area - mxFramePos.reset( new XclExpChFramePos( EXC_CHFRAMEPOS_PARENT ) ); + mxFramePos = std::make_shared<XclExpChFramePos>( EXC_CHFRAMEPOS_PARENT ); // for pie charts, always use inner plot area size to exclude the data labels as Excel does const XclExpChTypeGroup* pFirstTypeGroup = GetFirstTypeGroup().get(); bool bPieChart = pFirstTypeGroup && (pFirstTypeGroup->GetTypeInfo().meTypeCateg == EXC_CHTYPECATEG_PIE); @@ -3260,7 +3260,7 @@ void XclExpChAxesSet::ConvertAxis( sal_Int32 nCrossingAxisDim ) { // create and convert axis object - rxChAxis.reset( new XclExpChAxis( GetChRoot(), nAxisType ) ); + rxChAxis = std::make_shared<XclExpChAxis>( GetChRoot(), nAxisType ); sal_Int32 nApiAxisDim = rxChAxis->GetApiAxisDimension(); sal_Int32 nApiAxesSetIdx = GetApiAxesSetIndex(); Reference< XAxis > xAxis = lclGetApiAxis( xCoordSystem, nApiAxisDim, nApiAxesSetIdx ); @@ -3313,8 +3313,8 @@ XclExpChChart::XclExpChChart( const XclExpRoot& rRoot, maProps.mnEmptyMode = EXC_CHPROPS_EMPTY_SKIP; // always create both axes set objects - mxPrimAxesSet.reset( new XclExpChAxesSet( GetChRoot(), EXC_CHAXESSET_PRIMARY ) ); - mxSecnAxesSet.reset( new XclExpChAxesSet( GetChRoot(), EXC_CHAXESSET_SECONDARY ) ); + mxPrimAxesSet = std::make_shared<XclExpChAxesSet>( GetChRoot(), EXC_CHAXESSET_PRIMARY ); + mxSecnAxesSet = std::make_shared<XclExpChAxesSet>( GetChRoot(), EXC_CHAXESSET_SECONDARY ); if( xChartDoc.is() ) { @@ -3369,7 +3369,7 @@ XclExpChSeriesRef XclExpChChart::CreateSeries() sal_uInt16 nSeriesIdx = static_cast< sal_uInt16 >( maSeries.GetSize() ); if( nSeriesIdx <= EXC_CHSERIES_MAXSERIES ) { - xSeries.reset( new XclExpChSeries( GetChRoot(), nSeriesIdx ) ); + xSeries = std::make_shared<XclExpChSeries>( GetChRoot(), nSeriesIdx ); maSeries.AppendRecord( xSeries ); } return xSeries; @@ -3437,7 +3437,7 @@ XclExpChartDrawing::XclExpChartDrawing( const XclExpRoot& rRoot, /* Create a new independent object manager with own DFF stream for the DGCONTAINER, pass global manager as parent for shared usage of global DFF data (picture container etc.). */ - mxObjMgr.reset( new XclExpEmbeddedObjectManager( GetObjectManager(), rChartSize, EXC_CHART_TOTALUNITS, EXC_CHART_TOTALUNITS ) ); + mxObjMgr = std::make_shared<XclExpEmbeddedObjectManager>( GetObjectManager(), rChartSize, EXC_CHART_TOTALUNITS, EXC_CHART_TOTALUNITS ); // initialize the drawing object list mxObjMgr->StartSheet(); // process the draw page (convert all shapes) diff --git a/sc/source/filter/excel/xedbdata.cxx b/sc/source/filter/excel/xedbdata.cxx index 043c1791acf6..1417c444dc8e 100644 --- a/sc/source/filter/excel/xedbdata.cxx +++ b/sc/source/filter/excel/xedbdata.cxx @@ -128,10 +128,10 @@ void XclExpTablesManager::Initialize() switch( GetBiff() ) { case EXC_BIFF5: - pNew.reset( new XclExpTablesImpl5( GetRoot())); + pNew = std::make_shared<XclExpTablesImpl5>( GetRoot()); break; case EXC_BIFF8: - pNew.reset( new XclExpTablesImpl8( GetRoot())); + pNew = std::make_shared<XclExpTablesImpl8>( GetRoot()); break; default: assert(!"Unknown BIFF type!"); diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index 5bb9d0bb61f8..aaa9396048bf 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -1095,7 +1095,7 @@ XclExpChartObj::XclExpChartObj( XclExpObjectManager& rObjMgr, Reference< XShape css::awt::Rectangle aBoundRect; aShapeProp.GetProperty( aBoundRect, "BoundRect" ); tools::Rectangle aChartRect( Point( aBoundRect.X, aBoundRect.Y ), Size( aBoundRect.Width, aBoundRect.Height ) ); - mxChart.reset( new XclExpChart( GetRoot(), xModel, aChartRect ) ); + mxChart = std::make_shared<XclExpChart>( GetRoot(), xModel, aChartRect ); } XclExpChartObj::~XclExpChartObj() @@ -1468,14 +1468,14 @@ XclExpObjectManager::XclExpObjectManager( const XclExpRoot& rRoot ) : XclExpRoot( rRoot ) { InitStream( true ); - mxEscherEx.reset( new XclEscherEx( GetRoot(), *this, *mxDffStrm ) ); + mxEscherEx = std::make_shared<XclEscherEx>( GetRoot(), *this, *mxDffStrm ); } XclExpObjectManager::XclExpObjectManager( const XclExpObjectManager& rParent ) : XclExpRoot( rParent.GetRoot() ) { InitStream( false ); - mxEscherEx.reset( new XclEscherEx( GetRoot(), *this, *mxDffStrm, rParent.mxEscherEx.get() ) ); + mxEscherEx = std::make_shared<XclEscherEx>( GetRoot(), *this, *mxDffStrm, rParent.mxEscherEx.get() ); } XclExpObjectManager::~XclExpObjectManager() @@ -1494,7 +1494,7 @@ std::shared_ptr< XclExpRecordBase > XclExpObjectManager::CreateDrawingGroup() void XclExpObjectManager::StartSheet() { - mxObjList.reset( new XclExpObjList( GetRoot(), *mxEscherEx ) ); + mxObjList = std::make_shared<XclExpObjList>( GetRoot(), *mxEscherEx ); } std::shared_ptr< XclExpRecordBase > XclExpObjectManager::ProcessDrawing( const SdrPage* pSdrPage ) @@ -1550,7 +1550,7 @@ void XclExpObjectManager::InitStream( bool bTempFile ) { if( bTempFile ) { - mxTempFile.reset( new ::utl::TempFile ); + mxTempFile = std::make_shared<::utl::TempFile>(); if( mxTempFile->IsValid() ) { mxTempFile->EnableKillingFile(); @@ -1559,7 +1559,7 @@ void XclExpObjectManager::InitStream( bool bTempFile ) } if( !mxDffStrm.get() ) - mxDffStrm.reset( new SvMemoryStream ); + mxDffStrm = std::make_shared<SvMemoryStream>(); mxDffStrm->SetEndian( SvStreamEndian::LITTLE ); } diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx index a0e82fd160d6..f39ee5283fdf 100644 --- a/sc/source/filter/excel/xeformula.cxx +++ b/sc/source/filter/excel/xeformula.cxx @@ -167,7 +167,7 @@ XclExpFuncData::XclExpFuncData( const XclExpScToken& rTokData, mrTokData( rTokData ), mrFuncInfo( rFuncInfo ), maExtFuncData( rExtFuncData ), - mxOperands( new XclExpOperandList ), + mxOperands( std::make_shared<XclExpOperandList>() ), mpParamInfo( rFuncInfo.mpParamInfos ) { OSL_ENSURE( mrTokData.mpScToken, "XclExpFuncData::XclExpFuncData - missing core token" ); @@ -570,7 +570,7 @@ void XclExpFmlaCompImpl::Init( XclFormulaType eType ) if( mxData.get() ) maDataStack.push_back( mxData ); // new compiler working data structure - mxData.reset( new XclExpCompData( GetConfigForType( eType ) ) ); + mxData = std::make_shared<XclExpCompData>( GetConfigForType( eType ) ); } void XclExpFmlaCompImpl::Init( XclFormulaType eType, const ScTokenArray& rScTokArr, @@ -779,7 +779,7 @@ XclTokenArrayRef XclExpFmlaCompImpl::CreateTokenArray() OSL_ENSURE( mxData->mrCfg.mbAllowArrays || mxData->maExtDataVec.empty(), "XclExpFmlaCompImpl::CreateTokenArray - unexpected extended data" ); if( !mxData->mrCfg.mbAllowArrays ) mxData->maExtDataVec.clear(); - XclTokenArrayRef xTokArr( new XclTokenArray( mxData->maTokVec, mxData->maExtDataVec, mxData->mbVolatile ) ); + XclTokenArrayRef xTokArr = std::make_shared<XclTokenArray>( mxData->maTokVec, mxData->maExtDataVec, mxData->mbVolatile ); mxData.reset(); // compiler invoked recursively? - restore old working data @@ -1101,7 +1101,7 @@ XclExpScToken XclExpFmlaCompImpl::ListTerm( XclExpScToken aTokData, bool bInPare mxData->maTokVec[ nSubExprPos ] = GetTokenId( EXC_TOKID_MEMFUNC, EXC_TOKCLASS_REF ); Overwrite( nSubExprPos + 1, nSubExprSize ); // update the operand/operator stack (set the list expression as operand of the tMemFunc) - XclExpOperandListRef xOperands( new XclExpOperandList ); + XclExpOperandListRef xOperands = std::make_shared<XclExpOperandList>(); xOperands->AppendOperand( PopOperandPos(), EXC_PARAMCONV_VAL, false ); PushOperatorPos( nSubExprPos, xOperands ); } @@ -2406,14 +2406,14 @@ void XclExpFmlaCompImpl::AppendOperatorTokenId( sal_uInt8 nTokenId, const XclExp void XclExpFmlaCompImpl::AppendUnaryOperatorToken( sal_uInt8 nTokenId, sal_uInt8 nSpaces ) { - XclExpOperandListRef xOperands( new XclExpOperandList ); + XclExpOperandListRef xOperands = std::make_shared<XclExpOperandList>(); xOperands->AppendOperand( PopOperandPos(), EXC_PARAMCONV_RPO, true ); AppendOperatorTokenId( nTokenId, xOperands, nSpaces ); } void XclExpFmlaCompImpl::AppendBinaryOperatorToken( sal_uInt8 nTokenId, bool bValType, sal_uInt8 nSpaces ) { - XclExpOperandListRef xOperands( new XclExpOperandList ); + XclExpOperandListRef xOperands = std::make_shared<XclExpOperandList>(); xOperands->AppendOperand( PopOperandPos(), EXC_PARAMCONV_RPO, bValType ); xOperands->AppendOperand( PopOperandPos(), EXC_PARAMCONV_RPO, bValType ); AppendOperatorTokenId( nTokenId, xOperands, nSpaces ); @@ -2421,7 +2421,7 @@ void XclExpFmlaCompImpl::AppendBinaryOperatorToken( sal_uInt8 nTokenId, bool bVa void XclExpFmlaCompImpl::AppendLogicalOperatorToken( sal_uInt16 nXclFuncIdx, sal_uInt8 nOpCount ) { - XclExpOperandListRef xOperands( new XclExpOperandList ); + XclExpOperandListRef xOperands = std::make_shared<XclExpOperandList>(); for( sal_uInt8 nOpIdx = 0; nOpIdx < nOpCount; ++nOpIdx ) xOperands->AppendOperand( PopOperandPos(), EXC_PARAMCONV_RPX, false ); AppendOperatorTokenId( GetTokenId( EXC_TOKID_FUNCVAR, EXC_TOKCLASS_VAL ), xOperands ); @@ -2597,7 +2597,7 @@ void lclPutRangeToTokenArray( ScTokenArray& rScTokArr, const ScRange& rScRange, XclExpFormulaCompiler::XclExpFormulaCompiler( const XclExpRoot& rRoot ) : XclExpRoot( rRoot ), - mxImpl( new XclExpFmlaCompImpl( rRoot ) ) + mxImpl( std::make_shared<XclExpFmlaCompImpl>( rRoot ) ) { } diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx index 409893e7c68c..b218b128b195 100644 --- a/sc/source/filter/excel/xehelper.cxx +++ b/sc/source/filter/excel/xehelper.cxx @@ -308,7 +308,7 @@ OUString XclExpHyperlinkHelper::ProcessUrlField( const SvxURLField& rUrlField ) // there was/is already a HLINK record mbMultipleUrls = static_cast< bool >(mxLinkRec); - mxLinkRec.reset( new XclExpHyperlink( GetRoot(), rUrlField, maScPos ) ); + mxLinkRec = std::make_shared<XclExpHyperlink>( GetRoot(), rUrlField, maScPos ); if( const OUString* pRepr = mxLinkRec->GetRepr() ) aUrlRepr = *pRepr; @@ -526,7 +526,7 @@ XclExpStringRef lclCreateFormattedString( XclExpStringRef XclExpStringHelper::CreateString( const XclExpRoot& rRoot, const OUString& rString, XclStrFlags nFlags, sal_uInt16 nMaxLen ) { - XclExpStringRef xString( new XclExpString ); + XclExpStringRef xString = std::make_shared<XclExpString>(); if( rRoot.GetBiff() == EXC_BIFF8 ) xString->Assign( rString, nFlags, nMaxLen ); else diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx index 542e7ba9bd0e..a01448708cd2 100644 --- a/sc/source/filter/excel/xelink.cxx +++ b/sc/source/filter/excel/xelink.cxx @@ -957,7 +957,7 @@ XclExpExtNameDde::XclExpExtNameDde( const XclExpRoot& rRoot, { if( pResults ) { - mxMatrix.reset( new XclExpCachedMatrix( *pResults ) ); + mxMatrix = std::make_shared<XclExpCachedMatrix>( *pResults ); AddRecSize( mxMatrix->GetSize() ); } } @@ -1442,7 +1442,7 @@ XclExpExternSheetBase::XclExpExternSheetBase( const XclExpRoot& rRoot, sal_uInt1 XclExpExtNameBuffer& XclExpExternSheetBase::GetExtNameBuffer() { if( !mxExtNameBfr ) - mxExtNameBfr.reset( new XclExpExtNameBuffer( GetRoot() ) ); + mxExtNameBfr = std::make_shared<XclExpExtNameBuffer>( GetRoot() ); return *mxExtNameBfr; } @@ -1628,7 +1628,7 @@ sal_uInt16 XclExpSupbook::InsertTabName( const OUString& rTabName, ScExternalRef { SAL_WARN_IF( meType != XclSupbookType::Extern, "sc.filter", "Don't insert sheet names here" ); sal_uInt16 nSBTab = ulimit_cast< sal_uInt16 >( maXctList.GetSize() ); - XclExpXctRef xXct( new XclExpXct( GetRoot(), rTabName, nSBTab, xCacheTable ) ); + XclExpXctRef xXct = std::make_shared<XclExpXct>( GetRoot(), rTabName, nSBTab, xCacheTable ); AddRecSize( xXct->GetTabName().GetSize() ); maXctList.AppendRecord( xXct ); return nSBTab; @@ -1782,7 +1782,7 @@ XclExpSupbookBuffer::XclExpSupbookBuffer( const XclExpRoot& rRoot ) : maSBIndexVec.resize( nCount ); // self-ref SUPBOOK first of list - XclExpSupbookRef xSupbook( new XclExpSupbook( GetRoot(), ::std::max( nXclCnt, nCodeCnt ) ) ); + XclExpSupbookRef xSupbook = std::make_shared<XclExpSupbook>( GetRoot(), ::std::max( nXclCnt, nCodeCnt ) ); mnOwnDocSB = Append( xSupbook ); for( sal_uInt16 nXclTab = 0; nXclTab < nXclCnt; ++nXclTab ) maSBIndexVec[ nXclTab ].Set( mnOwnDocSB, nXclTab ); @@ -1875,7 +1875,7 @@ void XclExpSupbookBuffer::StoreCell( sal_uInt16 nFileId, const OUString& rTabNam sal_uInt16 nSupbookId; if (!GetSupbookUrl(xSupbook, nSupbookId, *pUrl)) { - xSupbook.reset(new XclExpSupbook(GetRoot(), *pUrl)); + xSupbook = std::make_shared<XclExpSupbook>(GetRoot(), *pUrl); nSupbookId = Append(xSupbook); } @@ -1907,7 +1907,7 @@ void XclExpSupbookBuffer::StoreCellRange( sal_uInt16 nFileId, const OUString& rT sal_uInt16 nSupbookId; if (!GetSupbookUrl(xSupbook, nSupbookId, *pUrl)) { - xSupbook.reset(new XclExpSupbook(GetRoot(), *pUrl)); + xSupbook = std::make_shared<XclExpSupbook>(GetRoot(), *pUrl); nSupbookId = Append(xSupbook); } @@ -1967,7 +1967,7 @@ bool XclExpSupbookBuffer::InsertAddIn( XclExpSupbookRef xSupbook; if( mnAddInSB == SAL_MAX_UINT16 ) { - xSupbook.reset( new XclExpSupbook( GetRoot() ) ); + xSupbook = std::make_shared<XclExpSupbook>( GetRoot() ); mnAddInSB = Append( xSupbook ); } else @@ -1985,7 +1985,7 @@ bool XclExpSupbookBuffer::InsertEuroTool( OUString aUrl( "\001\010EUROTOOL.XLA" ); if( !GetSupbookUrl( xSupbook, rnSupbook, aUrl ) ) { - xSupbook.reset( new XclExpSupbook( GetRoot(), aUrl, XclSupbookType::Eurotool ) ); + xSupbook = std::make_shared<XclExpSupbook>( GetRoot(), aUrl, XclSupbookType::Eurotool ); rnSupbook = Append( xSupbook ); } rnExtName = xSupbook->InsertEuroTool( rName ); @@ -1999,7 +1999,7 @@ bool XclExpSupbookBuffer::InsertDde( XclExpSupbookRef xSupbook; if( !GetSupbookDde( xSupbook, rnSupbook, rApplic, rTopic ) ) { - xSupbook.reset( new XclExpSupbook( GetRoot(), rApplic, rTopic ) ); + xSupbook = std::make_shared<XclExpSupbook>( GetRoot(), rApplic, rTopic ); rnSupbook = Append( xSupbook ); } rnExtName = xSupbook->InsertDde( rItem ); @@ -2013,7 +2013,7 @@ bool XclExpSupbookBuffer::InsertExtName( XclExpSupbookRef xSupbook; if (!GetSupbookUrl(xSupbook, rnSupbook, rUrl)) { - xSupbook.reset( new XclExpSupbook(GetRoot(), rUrl) ); + xSupbook = std::make_shared<XclExpSupbook>(GetRoot(), rUrl); rnSupbook = Append(xSupbook); } rnExtName = xSupbook->InsertExtName(rName, rArray); @@ -2033,7 +2033,7 @@ XclExpXti XclExpSupbookBuffer::GetXti( sal_uInt16 nFileId, const OUString& rTabN sal_uInt16 nSupbookId; if (!GetSupbookUrl(xSupbook, nSupbookId, *pUrl)) { - xSupbook.reset(new XclExpSupbook(GetRoot(), *pUrl)); + xSupbook = std::make_shared<XclExpSupbook>(GetRoot(), *pUrl); nSupbookId = Append(xSupbook); } aXti.mnSupbook = nSupbookId; @@ -2306,9 +2306,9 @@ void XclExpLinkManagerImpl5::CreateInternal() { XclExpExtSheetRef xRec; if( nScTab == GetCurrScTab() ) - xRec.reset( new XclExpExternSheet( GetRoot(), EXC_EXTSH_OWNTAB ) ); + xRec = std::make_shared<XclExpExternSheet>( GetRoot(), EXC_EXTSH_OWNTAB ); else - xRec.reset( new XclExpExternSheet( GetRoot(), rTabInfo.GetScTabName( nScTab ) ) ); + xRec = std::make_shared<XclExpExternSheet>( GetRoot(), rTabInfo.GetScTabName( nScTab ) ); maIntTabMap[ nScTab ] = AppendInternal( xRec ); } } @@ -2350,7 +2350,7 @@ XclExpLinkManagerImpl5::XclExpExtSheetRef XclExpLinkManagerImpl5::FindInternal( XclExpCodeMap::const_iterator aIt = maCodeMap.find( cCode ); if( aIt == maCodeMap.end() ) { - xExtSheet.reset( new XclExpExternSheet( GetRoot(), cCode ) ); + xExtSheet = std::make_shared<XclExpExternSheet>( GetRoot(), cCode ); rnExtSheet = maCodeMap[ cCode ] = AppendInternal( xExtSheet ); } else @@ -2532,10 +2532,10 @@ XclExpLinkManager::XclExpLinkManager( const XclExpRoot& rRoot ) : switch( GetBiff() ) { case EXC_BIFF5: - mxImpl.reset( new XclExpLinkManagerImpl5( rRoot ) ); + mxImpl = std::make_shared<XclExpLinkManagerImpl5>( rRoot ); break; case EXC_BIFF8: - mxImpl.reset( new XclExpLinkManagerImpl8( rRoot ) ); + mxImpl = std::make_shared<XclExpLinkManagerImpl8>( rRoot ); break; default: DBG_ERROR_BIFF(); diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx index 01b778eb044b..b65b9fb21ef1 100644 --- a/sc/source/filter/excel/xename.cxx +++ b/sc/source/filter/excel/xename.cxx @@ -447,7 +447,7 @@ sal_uInt16 XclExpNameManagerImpl::InsertName( SCTAB nTab, sal_uInt16 nScNameIdx, sal_uInt16 XclExpNameManagerImpl::InsertBuiltInName( sal_Unicode cBuiltIn, const XclTokenArrayRef& xTokArr, const ScRange& aRange ) { - XclExpNameRef xName( new XclExpName( GetRoot(), cBuiltIn ) ); + XclExpNameRef xName = std::make_shared<XclExpName>( GetRoot(), cBuiltIn ); xName->SetTokenArray( xTokArr ); xName->SetLocalTab( aRange.aStart.Tab() ); OUString sSymbol(aRange.Format(GetDoc(), ScRefFlags::RANGE_ABS_3D, ScAddress::Details( ::formula::FormulaGrammar::CONV_XL_A1))); @@ -457,7 +457,7 @@ sal_uInt16 XclExpNameManagerImpl::InsertBuiltInName( sal_Unicode cBuiltIn, const sal_uInt16 XclExpNameManagerImpl::InsertBuiltInName( sal_Unicode cBuiltIn, const XclTokenArrayRef& xTokArr, SCTAB nScTab, const ScRangeList& rRangeList ) { - XclExpNameRef xName( new XclExpName( GetRoot(), cBuiltIn ) ); + XclExpNameRef xName = std::make_shared<XclExpName>( GetRoot(), cBuiltIn ); xName->SetTokenArray( xTokArr ); xName->SetLocalTab( nScTab ); OUString sSymbol; @@ -470,7 +470,7 @@ sal_uInt16 XclExpNameManagerImpl::InsertUniqueName( const OUString& rName, const XclTokenArrayRef& xTokArr, SCTAB nScTab ) { OSL_ENSURE( !rName.isEmpty(), "XclExpNameManagerImpl::InsertUniqueName - empty name" ); - XclExpNameRef xName( new XclExpName( GetRoot(), GetUnusedName( rName ) ) ); + XclExpNameRef xName = std::make_shared<XclExpName>( GetRoot(), GetUnusedName( rName ) ); xName->SetTokenArray( xTokArr ); xName->SetLocalTab( nScTab ); return Append( xName ); @@ -491,7 +491,7 @@ sal_uInt16 XclExpNameManagerImpl::InsertRawName( const OUString& rName ) } // create a new NAME record - XclExpNameRef xName( new XclExpName( GetRoot(), rName ) ); + XclExpNameRef xName = std::make_shared<XclExpName>( GetRoot(), rName ); return Append( xName ); } @@ -510,7 +510,7 @@ sal_uInt16 XclExpNameManagerImpl::InsertMacroCall( const OUString& rMacroName, b } // create a new NAME record - XclExpNameRef xName( new XclExpName( GetRoot(), rMacroName ) ); + XclExpNameRef xName = std::make_shared<XclExpName>( GetRoot(), rMacroName ); xName->SetMacroCall( bVBasic, bFunc ); xName->SetHidden( bHidden ); @@ -616,7 +616,7 @@ sal_uInt16 XclExpNameManagerImpl::CreateName( SCTAB nTab, const ScRangeData& rRa otherwise a recursive call of this function from the formula compiler with the same defined name will not find it and will create it again. */ size_t nOldListSize = maNameList.GetSize(); - XclExpNameRef xName( new XclExpName( GetRoot(), rName ) ); + XclExpNameRef xName = std::make_shared<XclExpName>( GetRoot(), rName ); if (nTab != SCTAB_GLOBAL) xName->SetLocalTab(nTab); sal_uInt16 nNameIdx = Append( xName ); @@ -785,7 +785,7 @@ void XclExpNameManagerImpl::CreateUserNames() XclExpNameManager::XclExpNameManager( const XclExpRoot& rRoot ) : XclExpRoot( rRoot ), - mxImpl( new XclExpNameManagerImpl( rRoot ) ) + mxImpl( std::make_shared<XclExpNameManagerImpl>( rRoot ) ) { } diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx index 9f87bdffab42..33d0a8aa2200 100644 --- a/sc/source/filter/excel/xepivot.cxx +++ b/sc/source/filter/excel/xepivot.cxx @@ -766,8 +766,8 @@ void XclExpPivotCache::AddGroupFields( const ScDPObject& rDPObj ) while( pGroupDim ) { // insert the new grouping field - XclExpPCFieldRef xNewGroupField( new XclExpPCField( - GetRoot(), GetFieldCount(), rDPObj, *pGroupDim, *pCurrStdField ) ); + XclExpPCFieldRef xNewGroupField = std::make_shared<XclExpPCField>( + GetRoot(), GetFieldCount(), rDPObj, *pGroupDim, *pCurrStdField ); maFieldList.AppendRecord( xNewGroupField ); // register new grouping field at current grouping field, building a chain @@ -1631,12 +1631,12 @@ void XclExpPivotTableManager::CreatePivotTables() XclExpRecordRef XclExpPivotTableManager::CreatePivotCachesRecord() { - return XclExpRecordRef( new XclExpPivotRecWrapper( *this, EXC_PTMGR_PIVOTCACHES ) ); + return std::make_shared<XclExpPivotRecWrapper>( *this, EXC_PTMGR_PIVOTCACHES ); } XclExpRecordRef XclExpPivotTableManager::CreatePivotTablesRecord( SCTAB nScTab ) { - return XclExpRecordRef( new XclExpPivotRecWrapper( *this, nScTab ) ); + return std::make_shared<XclExpPivotRecWrapper>( *this, nScTab ); } void XclExpPivotTableManager::WritePivotCaches( XclExpStream& rStrm ) @@ -1680,7 +1680,7 @@ const XclExpPivotCache* XclExpPivotTableManager::CreatePivotCache( const ScDPObj // create a new pivot cache sal_uInt16 nNewCacheIdx = static_cast< sal_uInt16 >( maPCacheList.GetSize() ); - XclExpPivotCacheRef xNewPCache( new XclExpPivotCache( GetRoot(), rDPObj, nNewCacheIdx ) ); + XclExpPivotCacheRef xNewPCache = std::make_shared<XclExpPivotCache>( GetRoot(), rDPObj, nNewCacheIdx ); if( xNewPCache->IsValid() ) { maPCacheList.AppendRecord( xNewPCache ); diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx index 15082d46a226..6032c72d1c11 100644 --- a/sc/source/filter/excel/xeroot.cxx +++ b/sc/source/filter/excel/xeroot.cxx @@ -181,10 +181,10 @@ XclExpTablesManager& XclExpRoot::GetTablesManager() void XclExpRoot::InitializeConvert() { - mrExpData.mxTabInfo.reset( new XclExpTabInfo( GetRoot() ) ); - mrExpData.mxAddrConv.reset( new XclExpAddressConverter( GetRoot() ) ); - mrExpData.mxFmlaComp.reset( new XclExpFormulaCompiler( GetRoot() ) ); - mrExpData.mxProgress.reset( new XclExpProgressBar( GetRoot() ) ); + mrExpData.mxTabInfo = std::make_shared<XclExpTabInfo>( GetRoot() ); + mrExpData.mxAddrConv = std::make_shared<XclExpAddressConverter>( GetRoot() ); + mrExpData.mxFmlaComp = std::make_shared<XclExpFormulaCompiler>( GetRoot() ); + mrExpData.mxProgress = std::make_shared<XclExpProgressBar>( GetRoot() ); GetProgressBar().Initialize(); } @@ -195,29 +195,29 @@ void XclExpRoot::InitializeGlobals() if( GetBiff() >= EXC_BIFF5 ) { - mrExpData.mxPalette.reset( new XclExpPalette( GetRoot() ) ); - mrExpData.mxFontBfr.reset( new XclExpFontBuffer( GetRoot() ) ); - mrExpData.mxNumFmtBfr.reset( new XclExpNumFmtBuffer( GetRoot() ) ); - mrExpData.mxXFBfr.reset( new XclExpXFBuffer( GetRoot() ) ); - mrExpData.mxGlobLinkMgr.reset( new XclExpLinkManager( GetRoot() ) ); - mrExpData.mxNameMgr.reset( new XclExpNameManager( GetRoot() ) ); + mrExpData.mxPalette = std::make_shared<XclExpPalette>( GetRoot() ); + mrExpData.mxFontBfr = std::make_shared<XclExpFontBuffer>( GetRoot() ); + mrExpData.mxNumFmtBfr = std::make_shared<XclExpNumFmtBuffer>( GetRoot() ); + mrExpData.mxXFBfr = std::make_shared<XclExpXFBuffer>( GetRoot() ); + mrExpData.mxGlobLinkMgr = std::make_shared<XclExpLinkManager>( GetRoot() ); + mrExpData.mxNameMgr = std::make_shared<XclExpNameManager>( GetRoot() ); } if( GetBiff() == EXC_BIFF8 ) { - mrExpData.mxSst.reset( new XclExpSst ); - mrExpData.mxObjMgr.reset( new XclExpObjectManager( GetRoot() ) ); - mrExpData.mxFilterMgr.reset( new XclExpFilterManager( GetRoot() ) ); - mrExpData.mxPTableMgr.reset( new XclExpPivotTableManager( GetRoot() ) ); + mrExpData.mxSst = std::make_shared<XclExpSst>(); + mrExpData.mxObjMgr = std::make_shared<XclExpObjectManager>( GetRoot() ); + mrExpData.mxFilterMgr = std::make_shared<XclExpFilterManager>( GetRoot() ); + mrExpData.mxPTableMgr = std::make_shared<XclExpPivotTableManager>( GetRoot() ); // BIFF8: only one link manager for all sheets mrExpData.mxLocLinkMgr = mrExpData.mxGlobLinkMgr; - mrExpData.mxDxfs.reset( new XclExpDxfs( GetRoot() ) ); + mrExpData.mxDxfs = std::make_shared<XclExpDxfs>( GetRoot() ); } if( GetOutput() == EXC_OUTPUT_XML_2007 ) { - mrExpData.mxXmlPTableMgr.reset(new XclExpXmlPivotTableManager(GetRoot())); - mrExpData.mxTablesMgr.reset(new XclExpTablesManager(GetRoot())); + mrExpData.mxXmlPTableMgr = std::make_shared<XclExpXmlPivotTableManager>(GetRoot()); + mrExpData.mxTablesMgr = std::make_shared<XclExpTablesManager>(GetRoot()); do { @@ -266,7 +266,7 @@ void XclExpRoot::InitializeTable( SCTAB nScTab ) if( GetBiff() == EXC_BIFF5 ) { // local link manager per sheet - mrExpData.mxLocLinkMgr.reset( new XclExpLinkManager( GetRoot() ) ); + mrExpData.mxLocLinkMgr = std::make_shared<XclExpLinkManager>( GetRoot() ); } } diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index ccfa2cfc9634..c22773e1505a 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -1007,7 +1007,7 @@ bool XclExpXmlStream::exportDocument() aData.maMaxPos.SetCol( ::std::min( aData.maScMaxPos.Col(), aData.maXclMaxPos.Col() ) ); aData.maMaxPos.SetRow( ::std::min( aData.maScMaxPos.Row(), aData.maXclMaxPos.Row() ) ); aData.maMaxPos.SetTab( ::std::min( aData.maScMaxPos.Tab(), aData.maXclMaxPos.Tab() ) ); - aData.mpCompileFormulaCxt.reset( new sc::CompileFormulaContext(&rDoc) ); + aData.mpCompileFormulaCxt = std::make_shared<sc::CompileFormulaContext>(&rDoc); // set target path to get correct relative links to target document, not source INetURLObject aPath(getFileUrl()); aData.maBasePath = aPath.GetPath() + "\\"; diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index 353d8148327c..6bb80bf7dc9d 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -308,7 +308,7 @@ const sal_uInt32 EXC_PAL_MAXRAWSIZE = 1024; XclExpPaletteImpl::XclExpPaletteImpl( const XclDefaultPalette& rDefPal ) : mrDefPal( rDefPal ), - mxColorList( new XclListColorList ), + mxColorList( std::make_shared<XclListColorList>() ), mnLastIdx( 0 ) { // initialize maPalette with default colors @@ -565,7 +565,7 @@ void XclExpPaletteImpl::RawReducePalette( sal_uInt32 nPass ) */ XclListColorListRef xOldList = mxColorList; - mxColorList.reset( new XclListColorList ); + mxColorList = std::make_shared<XclListColorList>(); // maps old list indexes to new list indexes, used to update maColorIdDataVec ScfUInt32Vec aListIndexMap; @@ -751,7 +751,7 @@ XclExpPalette::XclExpPalette( const XclExpRoot& rRoot ) : XclDefaultPalette( rRoot ), XclExpRecord( EXC_ID_PALETTE ) { - mxImpl.reset( new XclExpPaletteImpl( *this ) ); + mxImpl = std::make_shared<XclExpPaletteImpl>( *this ); SetRecSize( GetColorCount() * 4 + 2 ); } @@ -1191,7 +1191,7 @@ sal_uInt16 XclExpFontBuffer::Insert( { if( bAppFont ) { - XclExpFontRef xFont( new XclExpFont( GetRoot(), rFontData, eColorType ) ); + XclExpFontRef xFont = std::make_shared<XclExpFont>( GetRoot(), rFontData, eColorType ); maFontList.ReplaceRecord( xFont, EXC_FONT_APP ); // set width of '0' character for column width export SetCharWidth( xFont->GetFontData() ); @@ -1283,7 +1283,7 @@ void XclExpFontBuffer::InitDefaultFonts() break; case EXC_BIFF8: { - XclExpFontRef xFont( new XclExpFont( GetRoot(), aFontData, EXC_COLOR_CELLTEXT ) ); + XclExpFontRef xFont = std::make_shared<XclExpFont>( GetRoot(), aFontData, EXC_COLOR_CELLTEXT ); maFontList.AppendRecord( xFont ); maFontList.AppendRecord( xFont ); maFontList.AppendRecord( xFont ); @@ -2770,7 +2770,7 @@ sal_uInt32 XclExpXFBuffer::InsertCellXF( const ScPatternAttr* pPattern, sal_Int1 auto it = std::find(rPositions.begin(), rPositions.end(), EXC_XF_DEFAULTCELL); rPositions.erase(it); // replace default cell pattern - XclExpXFRef xNewXF( new XclExpXF( GetRoot(), *pPattern, nScript ) ); + XclExpXFRef xNewXF = std::make_shared<XclExpXF>( GetRoot(), *pPattern, nScript ); maXFList.ReplaceRecord( xNewXF, EXC_XF_DEFAULTCELL ); // and add new entry in find-map maXFFindMap[ToFindKey(*xNewXF)].push_back(EXC_XF_DEFAULTCELL); @@ -2813,7 +2813,7 @@ sal_uInt32 XclExpXFBuffer::InsertStyleXF( const SfxStyleSheetBase& rStyleSheet ) if( nXFId == EXC_XFID_NOTFOUND ) { // built-in style XF not yet created - do it now - XclExpXFRef xXF( new XclExpXF( GetRoot(), rStyleSheet ) ); + XclExpXFRef xXF = std::make_shared<XclExpXF>( GetRoot(), rStyleSheet ); nXFId = AppendBuiltInXFWithStyle( xXF, nStyleId, nLevel ); // this new XF record is not predefined maBuiltInMap[ nXFId ].mbPredefined = false; @@ -2924,7 +2924,7 @@ void XclExpXFBuffer::InsertDefaultRecords() // index 0: default style if( SfxStyleSheetBase* pDefStyleSheet = GetStyleSheetPool().Find( ScResId( STR_STYLENAME_STANDARD ), SfxStyleFamily::Para ) ) { - XclExpXFRef xDefStyle( new XclExpXF( GetRoot(), *pDefStyleSheet ) ); + XclExpXFRef xDefStyle = std::make_shared<XclExpXF>( GetRoot(), *pDefStyleSheet ); sal_uInt32 nXFId = AppendBuiltInXFWithStyle( xDefStyle, EXC_STYLE_NORMAL ); // mark this XF as not predefined, prevents overwriting maBuiltInMap[ nXFId ].mbPredefined = false; @@ -2932,7 +2932,7 @@ void XclExpXFBuffer::InsertDefaultRecords() else { OSL_FAIL( "XclExpXFBuffer::InsertDefaultRecords - default style not found" ); - XclExpXFRef xDefStyle( new XclExpDefaultXF( GetRoot(), false ) ); + XclExpXFRef xDefStyle = std::make_shared<XclExpDefaultXF>( GetRoot(), false ); xDefStyle->SetAllUsedFlags( true ); AppendBuiltInXFWithStyle( xDefStyle, EXC_STYLE_NORMAL ); } @@ -2941,18 +2941,18 @@ void XclExpXFBuffer::InsertDefaultRecords() XclExpDefaultXF aLevelStyle( GetRoot(), false ); // RowLevel_1, ColLevel_1 aLevelStyle.SetFont( 1 ); - AppendBuiltInXF( XclExpXFRef( new XclExpDefaultXF( aLevelStyle ) ), EXC_STYLE_ROWLEVEL, 0 ); - AppendBuiltInXF( XclExpXFRef( new XclExpDefaultXF( aLevelStyle ) ), EXC_STYLE_COLLEVEL, 0 ); + AppendBuiltInXF( std::make_shared<XclExpDefaultXF>( aLevelStyle ), EXC_STYLE_ROWLEVEL, 0 ); + AppendBuiltInXF( std::make_shared<XclExpDefaultXF>( aLevelStyle ), EXC_STYLE_COLLEVEL, 0 ); // RowLevel_2, ColLevel_2 aLevelStyle.SetFont( 2 ); - AppendBuiltInXF( XclExpXFRef( new XclExpDefaultXF( aLevelStyle ) ), EXC_STYLE_ROWLEVEL, 1 ); - AppendBuiltInXF( XclExpXFRef( new XclExpDefaultXF( aLevelStyle ) ), EXC_STYLE_COLLEVEL, 1 ); + AppendBuiltInXF( std::make_shared<XclExpDefaultXF>( aLevelStyle ), EXC_STYLE_ROWLEVEL, 1 ); + AppendBuiltInXF( std::make_shared<XclExpDefaultXF>( aLevelStyle ), EXC_STYLE_COLLEVEL, 1 ); // RowLevel_3, ColLevel_3 ... RowLevel_7, ColLevel_7 aLevelStyle.SetFont( 0 ); for( sal_uInt8 nLevel = 2; nLevel < EXC_STYLE_LEVELCOUNT; ++nLevel ) { - AppendBuiltInXF( XclExpXFRef( new XclExpDefaultXF( aLevelStyle ) ), EXC_STYLE_ROWLEVEL, nLevel ); - AppendBuiltInXF( XclExpXFRef( new XclExpDefaultXF( aLevelStyle ) ), EXC_STYLE_COLLEVEL, nLevel ); + AppendBuiltInXF( std::make_shared<XclExpDefaultXF>( aLevelStyle ), EXC_STYLE_ROWLEVEL, nLevel ); + AppendBuiltInXF( std::make_shared<XclExpDefaultXF>( aLevelStyle ), EXC_STYLE_COLLEVEL, nLevel ); } // index 15: default hard cell format, placeholder to be able to add more built-in styles @@ -2964,15 +2964,15 @@ void XclExpXFBuffer::InsertDefaultRecords() XclExpDefaultXF aFormatStyle( GetRoot(), false ); aFormatStyle.SetFont( 1 ); aFormatStyle.SetNumFmt( 43 ); - AppendBuiltInXFWithStyle( XclExpXFRef( new XclExpDefaultXF( aFormatStyle ) ), EXC_STYLE_COMMA ); + AppendBuiltInXFWithStyle( std::make_shared<XclExpDefaultXF>( aFormatStyle ), EXC_STYLE_COMMA ); aFormatStyle.SetNumFmt( 41 ); - AppendBuiltInXFWithStyle( XclExpXFRef( new XclExpDefaultXF( aFormatStyle ) ), EXC_STYLE_COMMA_0 ); + AppendBuiltInXFWithStyle( std::make_shared<XclExpDefaultXF>( aFormatStyle ), EXC_STYLE_COMMA_0 ); aFormatStyle.SetNumFmt( 44 ); - AppendBuiltInXFWithStyle( XclExpXFRef( new XclExpDefaultXF( aFormatStyle ) ), EXC_STYLE_CURRENCY ); + AppendBuiltInXFWithStyle( std::make_shared<XclExpDefaultXF>( aFormatStyle ), EXC_STYLE_CURRENCY ); aFormatStyle.SetNumFmt( 42 ); - AppendBuiltInXFWithStyle( XclExpXFRef( new XclExpDefaultXF( aFormatStyle ) ), EXC_STYLE_CURRENCY_0 ); + AppendBuiltInXFWithStyle( std::make_shared<XclExpDefaultXF>( aFormatStyle ), EXC_STYLE_CURRENCY_0 ); aFormatStyle.SetNumFmt( 9 ); - AppendBuiltInXFWithStyle( XclExpXFRef( new XclExpDefaultXF( aFormatStyle ) ), EXC_STYLE_PERCENT ); + AppendBuiltInXFWithStyle( std::make_shared<XclExpDefaultXF>( aFormatStyle ), EXC_STYLE_PERCENT ); // other built-in style XF records (i.e. Hyperlink styles) are created on demand diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index e1f190d3c89b..259ed5031c3f 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -149,7 +149,7 @@ XclExpArrayRef XclExpArrayBuffer::CreateArray( const ScTokenArray& rScTokArr, co OSL_ENSURE( maRecMap.find( rScPos ) == maRecMap.end(), "XclExpArrayBuffer::CreateArray - array exists already" ); XclExpArrayRef& rxRec = maRecMap[ rScPos ]; - rxRec.reset( new XclExpArray( xTokArr, rScRange ) ); + rxRec = std::make_shared<XclExpArray>( xTokArr, rScRange ); return rxRec; } @@ -274,7 +274,7 @@ XclExpShrfmlaRef XclExpShrfmlaBuffer::CreateOrExtendShrfmla( { // create a new record XclTokenArrayRef xTokArr = GetFormulaCompiler().CreateFormula( EXC_FMLATYPE_SHARED, *pShrdScTokArr, &rScPos ); - xRec.reset( new XclExpShrfmla( xTokArr, rScPos ) ); + xRec = std::make_shared<XclExpShrfmla>( xTokArr, rScPos ); maRecMap[ pShrdScTokArr ] = xRec; } else @@ -522,7 +522,7 @@ XclExpTableopRef XclExpTableopBuffer::TryCreate( const ScAddress& rScPos, const XclExpTableopRef xRec; if( bOk ) { - xRec.reset( new XclExpTableop( rScPos, rRefs, nScMode ) ); + xRec = std::make_shared<XclExpTableop>( rScPos, rRefs, nScMode ); maTableopList.AppendRecord( xRec ); } @@ -1060,7 +1060,7 @@ void XclExpFormulaCell::WriteContents( XclExpStream& rStrm ) if( !aResult.isEmpty() || (rStrm.GetRoot().GetBiff() <= EXC_BIFF5) ) { rStrm << EXC_FORMULA_RES_STRING; - mxStringRec.reset( new XclExpStringRec( rStrm.GetRoot(), aResult ) ); + mxStringRec = std::make_shared<XclExpStringRec>( rStrm.GetRoot(), aResult ); } else rStrm << EXC_FORMULA_RES_EMPTY; // BIFF8 only @@ -1927,7 +1927,7 @@ void XclExpRow::Finalize( const ScfUInt16Vec& rColXFIndexes, bool bProgress ) if( nFirstFreeXclCol < nNextUsedXclCol ) { aXFId.mnCount = nNextUsedXclCol - nFirstFreeXclCol; - XclExpCellRef xNewCell( new XclExpBlankCell( XclAddress( nFirstFreeXclCol, mnXclRow ), aXFId ) ); + XclExpCellRef xNewCell = std::make_shared<XclExpBlankCell>( XclAddress( nFirstFreeXclCol, mnXclRow ), aXFId ); // insert the cell, InsertCell() may merge it with existing BLANK records InsertCell( xNewCell, nPos, false ); // insert default XF indexes into aXFIndexes @@ -2416,7 +2416,7 @@ XclExpRow& XclExpRowBuffer::GetOrCreateRow( sal_uInt32 nXclRow, bool bRowAlwaysE { mnHighestOutlineLevel = maOutlineBfr.GetLevel(); } - RowRef p(new XclExpRow(GetRoot(), nFrom, maOutlineBfr, bRowAlwaysEmpty, bHidden, nHeight)); + RowRef p = std::make_shared<XclExpRow>(GetRoot(), nFrom, maOutlineBfr, bRowAlwaysEmpty, bHidden, nHeight); maRowMap.emplace(nFrom, p); pPrevEntry = p; } @@ -2436,13 +2436,13 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) : maArrayBfr( rRoot ), maShrfmlaBfr( rRoot ), maTableopBfr( rRoot ), - mxDefrowheight( new XclExpDefrowheight ), - mxGuts( new XclExpGuts( rRoot ) ), - mxNoteList( new XclExpNoteList ), - mxMergedcells( new XclExpMergedcells( rRoot ) ), - mxHyperlinkList( new XclExpHyperlinkList ), - mxDval( new XclExpDval( rRoot ) ), - mxExtLst( new XclExtLst( rRoot ) ) + mxDefrowheight( std::make_shared<XclExpDefrowheight>() ), + mxGuts( std::make_shared<XclExpGuts>( rRoot ) ), + mxNoteList( std::make_shared<XclExpNoteList>() ), + mxMergedcells( std::make_shared<XclExpMergedcells>( rRoot ) ), + mxHyperlinkList( std::make_shared<XclExpHyperlinkList>() ), + mxDval( std::make_shared<XclExpDval>( rRoot ) ), + mxExtLst( std::make_shared<XclExtLst>( rRoot ) ) { ScDocument& rDoc = GetDoc(); SCTAB nScTab = GetCurrScTab(); @@ -2546,8 +2546,8 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) : OUString aUrl = pPattern->GetItemSet().Get(ATTR_HYPERLINK).GetValue(); if (!aUrl.isEmpty()) { - std::shared_ptr<XclExpHyperlink> aLink; - aLink.reset(new XclExpHyperlink(GetRoot(), SvxURLField(aUrl, aUrl), aScPos)); + std::shared_ptr<XclExpHyperlink> aLink = + std::make_shared<XclExpHyperlink>(GetRoot(), SvxURLField(aUrl, aUrl), aScPos); mxHyperlinkList->AppendRecord(aLink); } } @@ -2557,35 +2557,35 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) : { sal_uInt32 nScNumFmt = pPattern->GetItemSet().Get( ATTR_VALUE_FORMAT ).GetValue(); if( rFormatter.GetType( nScNumFmt ) == SvNumFormatType::LOGICAL ) - xCell.reset( new XclExpBooleanCell( - GetRoot(), aXclPos, pPattern, nMergeBaseXFId, fValue != 0.0 ) ); + xCell = std::make_shared<XclExpBooleanCell>( + GetRoot(), aXclPos, pPattern, nMergeBaseXFId, fValue != 0.0 ); } // try to create an RK value (compressed floating-point number) sal_Int32 nRkValue; if( !xCell && XclTools::GetRKFromDouble( nRkValue, fValue ) ) - xCell.reset( new XclExpRkCell( - GetRoot(), aXclPos, pPattern, nMergeBaseXFId, nRkValue ) ); + xCell = std::make_shared<XclExpRkCell>( + GetRoot(), aXclPos, pPattern, nMergeBaseXFId, nRkValue ); // else: simple floating-point number cell if( !xCell ) - xCell.reset( new XclExpNumberCell( - GetRoot(), aXclPos, pPattern, nMergeBaseXFId, fValue ) ); + xCell = std::make_shared<XclExpNumberCell>( + GetRoot(), aXclPos, pPattern, nMergeBaseXFId, fValue ); } break; case CELLTYPE_STRING: { - xCell.reset(new XclExpLabelCell( - GetRoot(), aXclPos, pPattern, nMergeBaseXFId, rScCell.mpString->getString())); + xCell = std::make_shared<XclExpLabelCell>( + GetRoot(), aXclPos, pPattern, nMergeBaseXFId, rScCell.mpString->getString()); } break; case CELLTYPE_EDIT: { XclExpHyperlinkHelper aLinkHelper( GetRoot(), aScPos ); - xCell.reset(new XclExpLabelCell( - GetRoot(), aXclPos, pPattern, nMergeBaseXFId, rScCell.mpEditText, aLinkHelper)); + xCell = std::make_shared<XclExpLabelCell>( + GetRoot(), aXclPos, pPattern, nMergeBaseXFId, rScCell.mpEditText, aLinkHelper); // add a single created HLINK record to the record list if( aLinkHelper.HasLinkRecord() ) @@ -2603,15 +2603,15 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) : OUString aUrl = pPattern->GetItemSet().Get(ATTR_HYPERLINK).GetValue(); if (!aUrl.isEmpty()) { - std::shared_ptr<XclExpHyperlink> aLink; - aLink.reset(new XclExpHyperlink(GetRoot(), SvxURLField(aUrl, aUrl), aScPos)); + std::shared_ptr<XclExpHyperlink> aLink = + std::make_shared<XclExpHyperlink>(GetRoot(), SvxURLField(aUrl, aUrl), aScPos); mxHyperlinkList->AppendRecord(aLink); } } - xCell.reset(new XclExpFormulaCell( + xCell = std::make_shared<XclExpFormulaCell>( GetRoot(), aXclPos, pPattern, nMergeBaseXFId, - *rScCell.mpFormula, maArrayBfr, maShrfmlaBfr, maTableopBfr)); + *rScCell.mpFormula, maArrayBfr, maShrfmlaBfr, maTableopBfr); } break; @@ -2620,8 +2620,8 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) : [[fallthrough]]; case CELLTYPE_NONE: { - xCell.reset( new XclExpBlankCell( - GetRoot(), aXclPos, nLastXclCol, pPattern, nMergeBaseXFId ) ); + xCell = std::make_shared<XclExpBlankCell>( + GetRoot(), aXclPos, nLastXclCol, pPattern, nMergeBaseXFId ); } break; } @@ -2700,7 +2700,7 @@ XclExpRecordRef XclExpCellTable::CreateRecord( sal_uInt16 nRecId ) const XclExpRecordRef xRec; switch( nRecId ) { - case EXC_ID3_DIMENSIONS: xRec.reset( new XclExpDelegatingRecord( &const_cast<XclExpRowBuffer*>(&maRowBfr)->GetDimensions() ) ); break; + case EXC_ID3_DIMENSIONS: xRec = std::make_shared<XclExpDelegatingRecord>( &const_cast<XclExpRowBuffer*>(&maRowBfr)->GetDimensions() ); break; case EXC_ID2_DEFROWHEIGHT: xRec = mxDefrowheight; break; case EXC_ID_GUTS: xRec = mxGuts; break; case EXC_ID_NOTE: xRec = mxNoteList; break; diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index 95de26eb643f..e8c1af46abc3 100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -214,7 +214,7 @@ struct XclImpChRootData : public XclChRootData XclImpChRoot::XclImpChRoot( const XclImpRoot& rRoot, XclImpChChart& rChartData ) : XclImpRoot( rRoot ), - mxChData( new XclImpChRootData( rChartData ) ) + mxChData( std::make_shared<XclImpChRootData>( rChartData ) ) { } @@ -520,8 +520,8 @@ void XclImpChAreaFormat::Convert( const XclImpChRoot& rRoot, XclImpChEscherFormat::XclImpChEscherFormat( const XclImpRoot& rRoot ) : mnDffFillType( mso_fillSolid ) { - maData.mxItemSet.reset( - new SfxItemSet( rRoot.GetDoc().GetDrawLayer()->GetItemPool() ) ); + maData.mxItemSet = + std::make_shared<SfxItemSet>( rRoot.GetDoc().GetDrawLayer()->GetItemPool() ); } void XclImpChEscherFormat::ReadHeaderRecord( XclImpStream& rStrm ) @@ -561,22 +561,22 @@ XclImpChFrameBase::XclImpChFrameBase( const XclChFormatInfo& rFmtInfo ) if( rFmtInfo.mbCreateDefFrame ) switch( rFmtInfo.meDefFrameType ) { case EXC_CHFRAMETYPE_AUTO: - mxLineFmt.reset( new XclImpChLineFormat ); + mxLineFmt = std::make_shared<XclImpChLineFormat>(); if( rFmtInfo.mbIsFrame ) - mxAreaFmt.reset( new XclImpChAreaFormat ); + mxAreaFmt = std::make_shared<XclImpChAreaFormat>(); break; case EXC_CHFRAMETYPE_INVISIBLE: { XclChLineFormat aLineFmt; ::set_flag( aLineFmt.mnFlags, EXC_CHLINEFORMAT_AUTO, false ); aLineFmt.mnPattern = EXC_CHLINEFORMAT_NONE; - mxLineFmt.reset( new XclImpChLineFormat( aLineFmt ) ); + mxLineFmt = std::make_shared<XclImpChLineFormat>( aLineFmt ); if( rFmtInfo.mbIsFrame ) { XclChAreaFormat aAreaFmt; ::set_flag( aAreaFmt.mnFlags, EXC_CHAREAFORMAT_AUTO, false ); aAreaFmt.mnPattern = EXC_PATT_NONE; - mxAreaFmt.reset( new XclImpChAreaFormat( aAreaFmt ) ); + mxAreaFmt = std::make_shared<XclImpChAreaFormat>( aAreaFmt ); } } break; @@ -590,15 +590,15 @@ void XclImpChFrameBase::ReadSubRecord( XclImpStream& rStrm ) switch( rStrm.GetRecId() ) { case EXC_ID_CHLINEFORMAT: - mxLineFmt.reset( new XclImpChLineFormat ); + mxLineFmt = std::make_shared<XclImpChLineFormat>(); mxLineFmt->ReadChLineFormat( rStrm ); break; case EXC_ID_CHAREAFORMAT: - mxAreaFmt.reset( new XclImpChAreaFormat ); + mxAreaFmt = std::make_shared<XclImpChAreaFormat>(); mxAreaFmt->ReadChAreaFormat( rStrm ); break; case EXC_ID_CHESCHERFORMAT: - mxEscherFmt.reset( new XclImpChEscherFormat( rStrm.GetRoot() ) ); + mxEscherFmt = std::make_shared<XclImpChEscherFormat>( rStrm.GetRoot() ); mxEscherFmt->ReadRecordGroup( rStrm ); break; } @@ -675,7 +675,7 @@ void XclImpChFrame::UpdateObjFrame( const XclObjLineData& rLineData, const XclOb default: aLineFmt.mnWeight = EXC_CHLINEFORMAT_HAIR; } ::set_flag( aLineFmt.mnFlags, EXC_CHLINEFORMAT_AUTO, rLineData.IsAuto() ); - mxLineFmt.reset( new XclImpChLineFormat( aLineFmt ) ); + mxLineFmt = std::make_shared<XclImpChLineFormat>( aLineFmt ); } ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits