diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-22 13:37:14 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-25 13:22:33 +0200 |
commit | 60694088231234f9c916fb6ea15067b1bf0b9cb2 (patch) | |
tree | 24d980eff2b96ea99a761ad11015620b0b617ef0 /sc | |
parent | facd0fc931468e82e50be3f7d8af48c6187dfa96 (diff) |
convert excel filter in calc from shared_ptr to rtl::Reference
ref-counting traffic here accounts for 10% of the profile on some of my
calc imports.
Change-Id: I1b32e0e61d7bf5eb65780ec0e7fcb99f6576050a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92694
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
27 files changed, 359 insertions, 317 deletions
diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index e21164f43632..7dec24838460 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -111,7 +111,7 @@ ExcTable::ExcTable( const XclExpRoot& rRoot ) : XclExpRoot( rRoot ), mnScTab( SCTAB_GLOBAL ), nExcTab( EXC_NOTAB ), - mxNoteList( std::make_shared<XclExpNoteList>() ) + mxNoteList( new XclExpNoteList ) { } @@ -119,7 +119,7 @@ ExcTable::ExcTable( const XclExpRoot& rRoot, SCTAB nScTab ) : XclExpRoot( rRoot ), mnScTab( nScTab ), nExcTab( rRoot.GetTabInfo().GetXclTab( nScTab ) ), - mxNoteList( std::make_shared<XclExpNoteList>() ) + mxNoteList( new XclExpNoteList ) { } @@ -258,7 +258,7 @@ void ExcTable::FillAsHeaderBinary( ExcBoundsheetList& rBoundsheetList ) for( nC = 0 ; nC < nScTabCount ; nC++ ) if( rTabInfo.IsExportTab( nC ) ) { - ExcBoundsheetList::RecordRefType xBoundsheet = std::make_shared<ExcBundlesheet>( rR, nC ); + ExcBoundsheetList::RecordRefType xBoundsheet = new ExcBundlesheet( rR, nC ); aRecList.AppendRecord( xBoundsheet ); rBoundsheetList.AppendRecord( xBoundsheet ); } @@ -283,7 +283,7 @@ void ExcTable::FillAsHeaderBinary( ExcBoundsheetList& rBoundsheetList ) for( nC = 0 ; nC < nScTabCount ; nC++ ) if( rTabInfo.IsExportTab( nC ) ) { - ExcBoundsheetList::RecordRefType xBoundsheet = std::make_shared<ExcBundlesheet8>( rR, nC ); + ExcBoundsheetList::RecordRefType xBoundsheet = new ExcBundlesheet8( rR, nC ); aRecList.AppendRecord( xBoundsheet ); rBoundsheetList.AppendRecord( xBoundsheet ); } @@ -292,7 +292,7 @@ void ExcTable::FillAsHeaderBinary( ExcBoundsheetList& rBoundsheetList ) for( SCTAB nAdd = 0; nC < static_cast<SCTAB>(nCodenames) ; nC++, nAdd++ ) { aTmpString = lcl_GetVbaTabName( nAdd ); - ExcBoundsheetList::RecordRefType xBoundsheet = std::make_shared<ExcBundlesheet8>( aTmpString ); + ExcBoundsheetList::RecordRefType xBoundsheet = new ExcBundlesheet8( aTmpString ); aRecList.AppendRecord( xBoundsheet ); rBoundsheetList.AppendRecord( xBoundsheet ); } @@ -375,7 +375,7 @@ void ExcTable::FillAsHeaderXml( ExcBoundsheetList& rBoundsheetList ) for( nC = 0 ; nC < nScTabCount ; nC++ ) if( rTabInfo.IsExportTab( nC ) ) { - ExcBoundsheetList::RecordRefType xBoundsheet = std::make_shared<ExcBundlesheet8>( rR, nC ); + ExcBoundsheetList::RecordRefType xBoundsheet = new ExcBundlesheet8( rR, nC ); aRecList.AppendRecord( xBoundsheet ); rBoundsheetList.AppendRecord( xBoundsheet ); } @@ -385,7 +385,7 @@ void ExcTable::FillAsHeaderXml( ExcBoundsheetList& rBoundsheetList ) for( SCTAB nAdd = 0; nC < static_cast<SCTAB>(nCodenames) ; nC++, nAdd++ ) { aTmpString = lcl_GetVbaTabName( nAdd ); - ExcBoundsheetList::RecordRefType xBoundsheet = std::make_shared<ExcBundlesheet8>( aTmpString ); + ExcBoundsheetList::RecordRefType xBoundsheet = new ExcBundlesheet8( aTmpString ); aRecList.AppendRecord( xBoundsheet ); rBoundsheetList.AppendRecord( xBoundsheet ); } @@ -418,7 +418,7 @@ void ExcTable::FillAsTableBinary( SCTAB nCodeNameIdx ) GetObjectManager().StartSheet(); // cell table: DEFROWHEIGHT, DEFCOLWIDTH, COLINFO, DIMENSIONS, ROW, cell records - mxCellTable = std::make_shared<XclExpCellTable>( GetRoot() ); + mxCellTable = new XclExpCellTable( GetRoot() ); //export cell notes std::vector<sc::NoteEntry> aNotes; @@ -432,7 +432,7 @@ void ExcTable::FillAsTableBinary( SCTAB nCodeNameIdx ) } // WSBOOL needs data from page settings, create it here, add it later - auto xPageSett = std::make_shared<XclExpPageSettings>( GetRoot() ); + rtl::Reference<XclExpPageSettings> xPageSett = new XclExpPageSettings( GetRoot() ); bool bFitToPages = xPageSett->GetPageData().mbFitToPages; if( eBiff <= EXC_BIFF5 ) @@ -559,7 +559,7 @@ void ExcTable::FillAsTableXml() GetObjectManager().StartSheet(); // cell table: DEFROWHEIGHT, DEFCOLWIDTH, COLINFO, DIMENSIONS, ROW, cell records - mxCellTable = std::make_shared<XclExpCellTable>( GetRoot() ); + mxCellTable = new XclExpCellTable( GetRoot() ); //export cell notes std::vector<sc::NoteEntry> aNotes; @@ -573,8 +573,8 @@ void ExcTable::FillAsTableXml() } // WSBOOL needs data from page settings, create it here, add it later - auto xPageSett = std::make_shared<XclExpPageSettings>( GetRoot() ); - XclExtLstRef xExtLst = std::make_shared<XclExtLst>( GetRoot() ); + rtl::Reference<XclExpPageSettings> xPageSett = new XclExpPageSettings( GetRoot() ); + XclExtLstRef xExtLst = new XclExtLst( GetRoot() ); bool bFitToPages = xPageSett->GetPageData().mbFitToPages; Color aTabColor = GetRoot().GetDoc().GetTabBgColor(mnScTab); @@ -630,7 +630,7 @@ void ExcTable::FillAsTableXml() XclExpImgData* pImgData = xPageSett->getGraphicExport(); if (pImgData) - aRecList.AppendRecord(std::shared_ptr<XclExpRecordBase>(pImgData)); + aRecList.AppendRecord(pImgData); // <tableParts> after <drawing> and before <extLst> aRecList.AppendRecord( GetTablesManager().GetTablesBySheet( mnScTab)); @@ -735,7 +735,7 @@ void ExcDocument::ReadDoc() { if( GetTabInfo().IsExportTab( nScTab ) ) { - ExcTableList::RecordRefType xTab = std::make_shared<ExcTable>( GetRoot(), nScTab ); + ExcTableList::RecordRefType xTab = new ExcTable( GetRoot(), nScTab ); maTableList.AppendRecord( xTab ); if (GetOutput() == EXC_OUTPUT_BINARY) xTab->FillAsTableBinary(nCodeNameIdx); @@ -747,7 +747,7 @@ void ExcDocument::ReadDoc() } for( ; nCodeNameIdx < nCodeNameCount; ++nScTab, ++nCodeNameIdx ) { - ExcTableList::RecordRefType xTab = std::make_shared<ExcTable>( GetRoot(), nScTab ); + ExcTableList::RecordRefType xTab = new ExcTable( GetRoot(), nScTab ); maTableList.AppendRecord( xTab ); xTab->FillAsEmptyTable( nCodeNameIdx ); } @@ -853,8 +853,8 @@ void ExcDocument::WriteXml( XclExpXmlStream& rStrm ) if ( rCalcConfig.mbHasStringRefSyntax || (eConv != formula::FormulaGrammar::CONV_XL_A1) ) { - XclExtLstRef xExtLst = std::make_shared<XclExtLst>( GetRoot() ); - xExtLst->AddRecord( std::make_shared<XclExpExtCalcPr>( GetRoot(), eConv ) ); + XclExtLstRef xExtLst = new XclExtLst( GetRoot() ); + xExtLst->AddRecord( new XclExpExtCalcPr( GetRoot(), eConv ) ); xExtLst->SaveXml(rStrm); } diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index 16f23744d77f..494bedaf6b03 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -879,7 +879,7 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab, const rNameMgr.InsertBuiltInName( EXC_BUILTIN_EXTRACT, aDestRange ); } - m_pFilterMode.reset(new XclExpFiltermode); + m_pFilterMode = new XclExpFiltermode; } // AutoFilter else @@ -922,8 +922,8 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab, const maFilterList.RemoveAllRecords(); if( !maFilterList.IsEmpty() ) - m_pFilterMode.reset(new XclExpFiltermode); - m_pFilterInfo.reset(new XclExpAutofilterinfo( aRange.aStart, nColCnt )); + m_pFilterMode = new XclExpFiltermode; + m_pFilterInfo = new XclExpAutofilterinfo( aRange.aStart, nColCnt ); if (maFilterList.IsEmpty () && !bConflict) mbAutoFilter = true; @@ -944,7 +944,7 @@ XclExpAutofilter* ExcAutoFilterRecs::GetByCol( SCCOL nCol ) if( xFilter->GetCol() == static_cast<sal_uInt16>(nCol) ) return xFilter.get(); } - xFilter = std::make_shared<XclExpAutofilter>( GetRoot(), static_cast<sal_uInt16>(nCol) ); + xFilter = new 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 ] = std::make_shared<ExcAutoFilterRecs>( GetRoot(), nScTab, nullptr ); + maFilterMap[ nScTab ] = new ExcAutoFilterRecs( GetRoot(), nScTab, nullptr ); } XclExpRecordRef XclExpFilterManager::CreateRecord( SCTAB nScTab ) diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index 5437f5060540..9537686e782f 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -561,11 +561,11 @@ namespace { XclExpChLineFormatRef lclCreateLineFormat( const XclExpChRoot& rRoot, const ScfPropertySet& rPropSet, XclChObjectType eObjType ) { - XclExpChLineFormatRef xLineFmt = std::make_shared<XclExpChLineFormat>( rRoot ); + XclExpChLineFormatRef xLineFmt = new XclExpChLineFormat( rRoot ); xLineFmt->Convert( rRoot, rPropSet, eObjType ); const XclChFormatInfo& rFmtInfo = rRoot.GetFormatInfo( eObjType ); if( rFmtInfo.mbDeleteDefFrame && xLineFmt->IsDefault( rFmtInfo.meDefFrameType ) ) - xLineFmt.reset(); + xLineFmt.clear(); return xLineFmt; } @@ -731,21 +731,21 @@ void XclExpChFrameBase::ConvertFrameBase( const XclExpChRoot& rRoot, const ScfPropertySet& rPropSet, XclChObjectType eObjType ) { // line format - mxLineFmt = std::make_shared<XclExpChLineFormat>( rRoot ); + mxLineFmt = new XclExpChLineFormat( rRoot ); mxLineFmt->Convert( rRoot, rPropSet, eObjType ); // area format (only for frame objects) if( rRoot.GetFormatInfo( eObjType ).mbIsFrame ) { - mxAreaFmt = std::make_shared<XclExpChAreaFormat>( rRoot ); + mxAreaFmt = new XclExpChAreaFormat( rRoot ); bool bComplexFill = mxAreaFmt->Convert( rRoot, rPropSet, eObjType ); if( (rRoot.GetBiff() == EXC_BIFF8) && bComplexFill ) { - mxEscherFmt = std::make_shared<XclExpChEscherFormat>( rRoot ); + mxEscherFmt = new XclExpChEscherFormat( rRoot ); mxEscherFmt->Convert( rPropSet, eObjType ); if( mxEscherFmt->IsValid() ) mxAreaFmt->SetAuto( false ); else - mxEscherFmt.reset(); + mxEscherFmt.clear(); } } } @@ -754,14 +754,14 @@ void XclExpChFrameBase::SetDefaultFrameBase( const XclExpChRoot& rRoot, XclChFrameType eDefFrameType, bool bIsFrame ) { // line format - mxLineFmt = std::make_shared<XclExpChLineFormat>( rRoot ); + mxLineFmt = new XclExpChLineFormat( rRoot ); mxLineFmt->SetDefault( eDefFrameType ); // area format (only for frame objects) if( bIsFrame ) { - mxAreaFmt = std::make_shared<XclExpChAreaFormat>( rRoot ); + mxAreaFmt = new XclExpChAreaFormat( rRoot ); mxAreaFmt->SetDefault( eDefFrameType ); - mxEscherFmt.reset(); + mxEscherFmt.clear(); } } @@ -836,10 +836,10 @@ namespace { XclExpChFrameRef lclCreateFrame( const XclExpChRoot& rRoot, const ScfPropertySet& rPropSet, XclChObjectType eObjType ) { - XclExpChFrameRef xFrame = std::make_shared<XclExpChFrame>( rRoot, eObjType ); + XclExpChFrameRef xFrame = new XclExpChFrame( rRoot, eObjType ); xFrame->Convert( rPropSet ); if( xFrame->IsDeleteable() ) - xFrame.reset(); + xFrame.clear(); return xFrame; } @@ -1131,7 +1131,7 @@ void XclExpChFontBase::ConvertFontBase( const XclExpChRoot& rRoot, sal_uInt16 nF { if( const XclExpFont* pFont = rRoot.GetFontBuffer().GetFont( nFontIdx ) ) { - XclExpChFontRef xFont = std::make_shared<XclExpChFont>( nFontIdx ); + XclExpChFontRef xFont = new XclExpChFont( nFontIdx ); SetFont( xFont, pFont->GetFontData().maColor, pFont->GetFontColorId() ); } } @@ -1177,8 +1177,8 @@ void XclExpChText::ConvertTitle( Reference< XTitle > const & xTitle, sal_uInt16 case EXC_CHOBJLINK_ZAXIS: SetFutureRecordContext( EXC_CHFRBLOCK_TEXT_AXISTITLE, 2 ); break; } - mxSrcLink.reset(); - mxObjLink = std::make_shared<XclExpChObjectLink>( nTarget, XclChDataPointPos( 0, 0 ) ); + mxSrcLink.clear(); + mxObjLink = new 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 = std::make_shared<XclExpChSourceLink>( GetChRoot(), EXC_CHSRCLINK_TITLE ); + mxSrcLink = new 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 = std::make_shared<XclExpChFramePos>( EXC_CHFRAMEPOS_PARENT ); + mxFramePos = new 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 = std::make_shared<XclExpChFrLabelProps>( GetChRoot() ); + mxLabelProps = new 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 = std::make_shared<XclExpChSourceLink>( GetChRoot(), EXC_CHSRCLINK_TITLE ); + mxSrcLink = new XclExpChSourceLink( GetChRoot(), EXC_CHSRCLINK_TITLE ); if( bShowValue || bShowPercent ) // percentage format wins over value format mxSrcLink->ConvertNumFmt( rPropSet, bShowPercent ); // object link - mxObjLink = std::make_shared<XclExpChObjectLink>( EXC_CHOBJLINK_DATA, rPointPos ); + mxObjLink = new 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 = std::make_shared<XclExpChSourceLink>( GetChRoot(), EXC_CHSRCLINK_TITLE ); + mxSrcLink = new XclExpChSourceLink( GetChRoot(), EXC_CHSRCLINK_TITLE ); mxSrcLink->ConvertNumFmt( rPropSet, false ); // object link - mxObjLink = std::make_shared<XclExpChObjectLink>( EXC_CHOBJLINK_DATA, rPointPos ); + mxObjLink = new XclExpChObjectLink( EXC_CHOBJLINK_DATA, rPointPos ); } sal_uInt16 XclExpChText::GetAttLabelFlags() const @@ -1409,13 +1409,13 @@ XclExpChTextRef lclCreateTitle( const XclExpChRoot& rRoot, Reference< XTitled > if( xTitled.is() ) xTitle = xTitled->getTitleObject(); - XclExpChTextRef xText = std::make_shared<XclExpChText>( rRoot ); + XclExpChTextRef xText = new 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 charts that contain exactly one data series. */ if( (nTarget != EXC_CHOBJLINK_TITLE) && !xText->HasString() ) - xText.reset(); + xText.clear(); return xText; } @@ -1565,35 +1565,35 @@ void XclExpChDataFormat::ConvertDataSeries( const ScfPropertySet& rPropSet, cons bool bIsFrame = rTypeInfo.IsSeriesFrameFormat(); if( !bIsFrame ) { - mxMarkerFmt = std::make_shared<XclExpChMarkerFormat>( GetChRoot() ); + mxMarkerFmt = new XclExpChMarkerFormat( GetChRoot() ); mxMarkerFmt->Convert( GetChRoot(), rPropSet, maData.mnFormatIdx ); } // pie segments if( rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_PIE ) { - mxPieFmt = std::make_shared<XclExpChPieFormat>(); + mxPieFmt = new 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 = std::make_shared<XclExpCh3dDataFormat>(); + mx3dDataFmt = new XclExpCh3dDataFormat(); mx3dDataFmt->Convert( rPropSet ); } // spline if( IsSeriesFormat() && rTypeInfo.mbSpline && !bIsFrame ) - mxSeriesFmt = std::make_shared<XclExpUInt16Record>( EXC_ID_CHSERIESFORMAT, EXC_CHSERIESFORMAT_SMOOTHED ); + mxSeriesFmt = new XclExpUInt16Record( EXC_ID_CHSERIESFORMAT, EXC_CHSERIESFORMAT_SMOOTHED ); // data point labels - XclExpChTextRef xLabel = std::make_shared<XclExpChText>( GetChRoot() ); + XclExpChTextRef xLabel = new XclExpChText( GetChRoot() ); if( xLabel->ConvertDataLabel( rPropSet, rTypeInfo, maData.maPointPos ) ) { // CHTEXT groups for data labels are stored in global CHCHART group GetChartData().SetDataLabel( xLabel ); - mxAttLabel = std::make_shared<XclExpChAttachedLabel>( xLabel->GetAttLabelFlags() ); + mxAttLabel = new 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 = std::make_shared<XclExpChMarkerFormat>( GetChRoot() ); + mxMarkerFmt = new XclExpChMarkerFormat( GetChRoot() ); mxMarkerFmt->ConvertStockSymbol( GetChRoot(), rPropSet, bCloseSymbol ); } @@ -1689,7 +1689,7 @@ bool XclExpChSerTrendLine::Convert( Reference< XRegressionCurve > const & xRegCu // line formatting XclChDataPointPos aPointPos( nSeriesIdx ); - mxDataFmt = std::make_shared<XclExpChDataFormat>( GetChRoot(), aPointPos, 0 ); + mxDataFmt = new 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 = std::make_shared<XclExpChText>( GetChRoot() ); + mxLabel = new 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 = 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 ); + mxTitleLink = new XclExpChSourceLink( GetChRoot(), EXC_CHSRCLINK_TITLE ); + mxValueLink = new XclExpChSourceLink( GetChRoot(), EXC_CHSRCLINK_VALUES ); + mxCategLink = new XclExpChSourceLink( GetChRoot(), EXC_CHSRCLINK_CATEGORY ); if( GetBiff() == EXC_BIFF8 ) - mxBubbleLink = std::make_shared<XclExpChSourceLink>( GetChRoot(), EXC_CHSRCLINK_BUBBLES ); + mxBubbleLink = new XclExpChSourceLink( GetChRoot(), EXC_CHSRCLINK_BUBBLES ); } bool XclExpChSeries::ConvertDataSeries( @@ -1890,7 +1890,7 @@ bool XclExpChSeries::ConvertDataSeries( // series formatting XclChDataPointPos aPointPos( mnSeriesIdx ); ScfPropertySet aSeriesProp( xDataSeries ); - mxSeriesFmt = std::make_shared<XclExpChDataFormat>( GetChRoot(), aPointPos, nFormatIdx ); + mxSeriesFmt = new 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 = std::make_shared<XclExpChDataFormat>( GetChRoot(), aPointPos, nFormatIdx ); + XclExpChDataFormatRef xPointFmt = new 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 = std::make_shared<XclExpChDataFormat>( GetChRoot(), XclChDataPointPos( mnSeriesIdx ), nFormatIdx ); + mxSeriesFmt = new XclExpChDataFormat( GetChRoot(), XclChDataPointPos( mnSeriesIdx ), nFormatIdx ); mxSeriesFmt->ConvertStockSeries( aSeriesProp, bCloseSymbol ); } } @@ -1997,7 +1997,7 @@ bool XclExpChSeries::ConvertTrendLine( const XclExpChSeries& rParent, Reference< { InitFromParent( rParent ); - mxTrendLine = std::make_shared<XclExpChSerTrendLine>( GetChRoot() ); + mxTrendLine = new 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 = std::make_shared<XclExpChSerErrorBar>( GetChRoot(), nBarId ); + mxErrorBar = new XclExpChSerErrorBar( GetChRoot(), nBarId ); bool bOk = mxErrorBar->Convert( *mxValueLink, maData.mnValueCount, rPropSet ); if( bOk ) { // error bar formatting - mxSeriesFmt = std::make_shared<XclExpChDataFormat>( GetChRoot(), XclChDataPointPos( mnSeriesIdx ), 0 ); + mxSeriesFmt = new 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 = std::make_shared<XclExpChText>( GetChRoot() ); + mxText = new 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 = std::make_shared<XclExpChFramePos>( EXC_CHFRAMEPOS_CHARTSIZE ); + mxFramePos = new 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 = std::make_shared<XclExpChFrame>( GetChRoot(), EXC_CHOBJTYPE_LEGEND ); + mxFrame = new 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 = std::make_shared<XclExpChChart3d>(); + mxChart3d = new 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 = std::make_shared<XclExpChLegend>( GetChRoot() ); + mxLegend = new 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 = std::make_shared<XclExpChLineFormat>( GetChRoot() ); + XclExpChLineFormatRef xLineFmt = new 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 = std::make_shared<XclExpChDropBar>( GetChRoot(), EXC_CHOBJTYPE_WHITEDROPBAR ); + mxUpBar = new XclExpChDropBar( GetChRoot(), EXC_CHOBJTYPE_WHITEDROPBAR ); mxUpBar->Convert( aWhiteProp ); // black dropbar format aTypeProp.GetProperty( xBlackPropSet, EXC_CHPROP_BLACKDAY ); ScfPropertySet aBlackProp( xBlackPropSet ); - mxDownBar = std::make_shared<XclExpChDropBar>( GetChRoot(), EXC_CHOBJTYPE_BLACKDROPBAR ); + mxDownBar = new 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 = std::make_shared<XclExpChLineFormat>( GetChRoot() ); + mxAxisLine = new 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 = std::make_shared<XclExpChLabelRange>( GetChRoot() ); + mxLabelRange = new XclExpChLabelRange( GetChRoot() ); mxLabelRange->SetTicksBetweenCateg( rTypeInfo.mbTicksBetweenCateg ); if( xAxis.is() ) { @@ -2969,7 +2969,7 @@ void XclExpChAxis::Convert( Reference< XAxis > const & xAxis, Reference< XAxis > } else { - mxValueRange = std::make_shared<XclExpChValueRange>( GetChRoot() ); + mxValueRange = new 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 = std::make_shared<XclExpChTick>( GetChRoot() ); + mxTick = new XclExpChTick( GetChRoot() ); mxTick->Convert( aAxisProp, rTypeInfo, GetAxisType() ); // axis label formatting and rotation @@ -3032,7 +3032,7 @@ void XclExpChAxis::ConvertWall( css::uno::Reference< css::chart2::XDiagram > con } break; default: - mxWallFrame.reset(); + mxWallFrame.clear(); } } @@ -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 = std::make_shared<XclExpChTypeGroup>( GetChRoot(), nGroupIdx ); + XclExpChTypeGroupRef xTypeGroup = new 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 = std::make_shared<XclExpChFramePos>( EXC_CHFRAMEPOS_PARENT ); + mxFramePos = new 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 = std::make_shared<XclExpChAxis>( GetChRoot(), nAxisType ); + rxChAxis = new XclExpChAxis( GetChRoot(), nAxisType ); sal_Int32 nApiAxisDim = rxChAxis->GetApiAxisDimension(); sal_Int32 nApiAxesSetIdx = GetApiAxesSetIndex(); Reference< XAxis > xAxis = lclGetApiAxis( xCoordSystem, nApiAxisDim, nApiAxesSetIdx ); @@ -3369,7 +3369,7 @@ XclExpChSeriesRef XclExpChChart::CreateSeries() sal_uInt16 nSeriesIdx = static_cast< sal_uInt16 >( maSeries.GetSize() ); if( nSeriesIdx <= EXC_CHSERIES_MAXSERIES ) { - xSeries = std::make_shared<XclExpChSeries>( GetChRoot(), nSeriesIdx ); + xSeries = new XclExpChSeries( GetChRoot(), nSeriesIdx ); maSeries.AppendRecord( xSeries ); } return xSeries; diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index be701d2489f3..2ed3ae3d29ef 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -1364,14 +1364,14 @@ XclExpCondfmt::XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat if(!aExtEntries.empty() && xExtLst.get()) { - XclExpExtRef pParent = xExtLst->GetItem( XclExpExtDataBarType ); - if( !pParent.get() ) + XclExpExt* pParent = xExtLst->GetItem( XclExpExtDataBarType ); + if( !pParent ) { - xExtLst->AddRecord( XclExpExtRef(new XclExpExtCondFormat( *xExtLst )) ); + xExtLst->AddRecord( new XclExpExtCondFormat( *xExtLst ) ); pParent = xExtLst->GetItem( XclExpExtDataBarType ); } - static_cast<XclExpExtCondFormat*>(xExtLst->GetItem( XclExpExtDataBarType ).get())->AddRecord( - std::make_shared<XclExpExtConditionalFormatting>( *pParent, aExtEntries, aScRanges)); + static_cast<XclExpExtCondFormat*>(xExtLst->GetItem( XclExpExtDataBarType ))->AddRecord( + new XclExpExtConditionalFormatting( *pParent, aExtEntries, aScRanges)); } } } @@ -1961,7 +1961,7 @@ XclExpDV& XclExpDval::SearchOrCreateDv( sal_uLong nScHandle ) } // create new DV record - mxLastFoundDV.reset( new XclExpDV( *this, nScHandle ) ); + mxLastFoundDV = new XclExpDV( *this, nScHandle ); maDVList.InsertRecord( mxLastFoundDV, nCurrPos ); return *mxLastFoundDV; } diff --git a/sc/source/filter/excel/xedbdata.cxx b/sc/source/filter/excel/xedbdata.cxx index 1417c444dc8e..350f6f70e0d1 100644 --- a/sc/source/filter/excel/xedbdata.cxx +++ b/sc/source/filter/excel/xedbdata.cxx @@ -124,14 +124,14 @@ void XclExpTablesManager::Initialize() TablesMapType::iterator it = maTablesMap.find( nTab); if (it == maTablesMap.end()) { - ::std::shared_ptr< XclExpTables > pNew; + rtl::Reference< XclExpTables > pNew; switch( GetBiff() ) { case EXC_BIFF5: - pNew = std::make_shared<XclExpTablesImpl5>( GetRoot()); + pNew = new XclExpTablesImpl5( GetRoot()); break; case EXC_BIFF8: - pNew = std::make_shared<XclExpTablesImpl8>( GetRoot()); + pNew = new XclExpTablesImpl8( GetRoot()); break; default: assert(!"Unknown BIFF type!"); @@ -149,7 +149,7 @@ void XclExpTablesManager::Initialize() } } -::std::shared_ptr< XclExpTables > XclExpTablesManager::GetTablesBySheet( SCTAB nTab ) +rtl::Reference< XclExpTables > XclExpTablesManager::GetTablesBySheet( SCTAB nTab ) { TablesMapType::iterator it = maTablesMap.find(nTab); return it == maTablesMap.end() ? nullptr : it->second; diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index aaa9396048bf..53e81cbefade 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -1487,17 +1487,17 @@ XclExpDffAnchorBase* XclExpObjectManager::CreateDffAnchor() const return new XclExpDffSheetAnchor( GetRoot() ); } -std::shared_ptr< XclExpRecordBase > XclExpObjectManager::CreateDrawingGroup() +rtl::Reference< XclExpRecordBase > XclExpObjectManager::CreateDrawingGroup() { - return std::make_shared<XclExpMsoDrawingGroup>( *mxEscherEx ); + return new XclExpMsoDrawingGroup( *mxEscherEx ); } void XclExpObjectManager::StartSheet() { - mxObjList = std::make_shared<XclExpObjList>( GetRoot(), *mxEscherEx ); + mxObjList = new XclExpObjList( GetRoot(), *mxEscherEx ); } -std::shared_ptr< XclExpRecordBase > XclExpObjectManager::ProcessDrawing( const SdrPage* pSdrPage ) +rtl::Reference< XclExpRecordBase > XclExpObjectManager::ProcessDrawing( const SdrPage* pSdrPage ) { if( pSdrPage ) mxEscherEx->AddSdrPage( *pSdrPage ); @@ -1509,7 +1509,7 @@ std::shared_ptr< XclExpRecordBase > XclExpObjectManager::ProcessDrawing( const S return mxObjList; } -std::shared_ptr< XclExpRecordBase > XclExpObjectManager::ProcessDrawing( const Reference< XShapes >& rxShapes ) +rtl::Reference< XclExpRecordBase > XclExpObjectManager::ProcessDrawing( const Reference< XShapes >& rxShapes ) { if( rxShapes.is() ) mxEscherEx->AddUnoShapes( rxShapes ); diff --git a/sc/source/filter/excel/xeextlst.cxx b/sc/source/filter/excel/xeextlst.cxx index f13335a6605b..a034472b8bb1 100644 --- a/sc/source/filter/excel/xeextlst.cxx +++ b/sc/source/filter/excel/xeextlst.cxx @@ -365,21 +365,21 @@ XclExpExtCfRule::XclExpExtCfRule( const XclExpRoot& rRoot, const ScFormatEntry& case ScFormatEntry::Type::Databar: { const ScDataBarFormat& rDataBar = static_cast<const ScDataBarFormat&>(rFormat); - mxEntry.reset( new XclExpExtDataBar( *this, rDataBar, rPos ) ); + mxEntry = new XclExpExtDataBar( *this, rDataBar, rPos ); pType = "dataBar"; } break; case ScFormatEntry::Type::Iconset: { const ScIconSetFormat& rIconSet = static_cast<const ScIconSetFormat&>(rFormat); - mxEntry.reset(new XclExpExtIconSet(*this, rIconSet, rPos)); + mxEntry = new XclExpExtIconSet(*this, rIconSet, rPos); pType = "iconSet"; } break; case ScFormatEntry::Type::ExtCondition: { const ScCondFormatEntry& rCondFormat = static_cast<const ScCondFormatEntry&>(rFormat); - mxEntry.reset(new XclExpExtCF(*this, rCondFormat)); + mxEntry = new XclExpExtCF(*this, rCondFormat); pType = "cellIs"; mOperator = GetOperatorString( rCondFormat.GetOperation() ); } @@ -533,9 +533,9 @@ void XclExpExtCondFormat::SaveXml( XclExpXmlStream& rStrm ) rWorksheet->endElement( XML_ext ); } -void XclExpExtCondFormat::AddRecord( const XclExpExtConditionalFormattingRef& aEntry ) +void XclExpExtCondFormat::AddRecord( XclExpExtConditionalFormatting* pEntry ) { - maCF.AppendRecord( aEntry ); + maCF.AppendRecord( pEntry ); } void XclExtLst::SaveXml( XclExpXmlStream& rStrm ) @@ -551,12 +551,12 @@ void XclExtLst::SaveXml( XclExpXmlStream& rStrm ) rWorksheet->endElement( XML_extLst ); } -void XclExtLst::AddRecord( const XclExpExtRef& aEntry ) +void XclExtLst::AddRecord( XclExpExt* pEntry ) { - maExtEntries.AppendRecord( aEntry ); + maExtEntries.AppendRecord( pEntry ); } -XclExpExtRef XclExtLst::GetItem( XclExpExtType eType ) +XclExpExt* XclExtLst::GetItem( XclExpExtType eType ) { size_t n = maExtEntries.GetSize(); for( size_t i = 0; i < n; ++i ) @@ -565,7 +565,7 @@ XclExpExtRef XclExtLst::GetItem( XclExpExtType eType ) return maExtEntries.GetRecord( i ); } - return XclExpExtRef(); + return nullptr; } diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx index b218b128b195..6584c314aae5 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 = std::make_shared<XclExpHyperlink>( GetRoot(), rUrlField, maScPos ); + mxLinkRec = new XclExpHyperlink( GetRoot(), rUrlField, maScPos ); if( const OUString* pRepr = mxLinkRec->GetRepr() ) aUrlRepr = *pRepr; diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx index c127947a83b9..e2504f6a00b3 100644 --- a/sc/source/filter/excel/xelink.cxx +++ b/sc/source/filter/excel/xelink.cxx @@ -148,7 +148,6 @@ public: private: typedef XclExpRecordList< XclExpExtNameBase > XclExpExtNameList; - typedef XclExpExtNameList::RecordRefType XclExpExtNameRef; private: /** Returns the 1-based (Excel-like) list index of the external name or 0, if not found. */ @@ -1144,11 +1143,10 @@ sal_uInt16 XclExpExtNameBuffer::GetIndex( const OUString& rName ) const sal_uInt16 XclExpExtNameBuffer::AppendNew( XclExpExtNameBase* pExtName ) { - XclExpExtNameRef xExtName( pExtName ); size_t nSize = maNameList.GetSize(); if( nSize < 0x7FFF ) { - maNameList.AppendRecord( xExtName ); + maNameList.AppendRecord( pExtName ); return static_cast< sal_uInt16 >( nSize + 1 ); } return 0; @@ -1588,13 +1586,13 @@ void XclExpSupbook::FillRefLogEntry( XclExpRefLogEntry& rRefLogEntry, void XclExpSupbook::StoreCellRange( const ScRange& rRange, sal_uInt16 nSBTab ) { - if( XclExpXct* pXct = maXctList.GetRecord( nSBTab ).get() ) + if( XclExpXct* pXct = maXctList.GetRecord( nSBTab ) ) pXct->StoreCellRange( rRange ); } void XclExpSupbook::StoreCell_( sal_uInt16 nSBTab, const ScAddress& rCell ) { - if( XclExpXct* pXct = maXctList.GetRecord( nSBTab ).get() ) + if( XclExpXct* pXct = maXctList.GetRecord( nSBTab ) ) pXct->StoreCell_( rCell ); } @@ -1602,7 +1600,7 @@ void XclExpSupbook::StoreCellRange_( sal_uInt16 nSBTab, const ScRange& rRange ) { // multi-table range is not allowed! if( rRange.aStart.Tab() == rRange.aEnd.Tab() ) - if( XclExpXct* pXct = maXctList.GetRecord( nSBTab ).get() ) + if( XclExpXct* pXct = maXctList.GetRecord( nSBTab ) ) pXct->StoreCellRange_( rRange ); } @@ -1628,7 +1626,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 = std::make_shared<XclExpXct>( GetRoot(), rTabName, nSBTab, xCacheTable ); + XclExpXctRef xXct = new XclExpXct( GetRoot(), rTabName, nSBTab, xCacheTable ); AddRecSize( xXct->GetTabName().GetSize() ); maXctList.AppendRecord( xXct ); return nSBTab; @@ -1782,7 +1780,7 @@ XclExpSupbookBuffer::XclExpSupbookBuffer( const XclExpRoot& rRoot ) : maSBIndexVec.resize( nCount ); // self-ref SUPBOOK first of list - XclExpSupbookRef xSupbook = std::make_shared<XclExpSupbook>( GetRoot(), ::std::max( nXclCnt, nCodeCnt ) ); + XclExpSupbookRef xSupbook = new XclExpSupbook( GetRoot(), ::std::max( nXclCnt, nCodeCnt ) ); mnOwnDocSB = Append( xSupbook ); for( sal_uInt16 nXclTab = 0; nXclTab < nXclCnt; ++nXclTab ) maSBIndexVec[ nXclTab ].Set( mnOwnDocSB, nXclTab ); @@ -1875,7 +1873,7 @@ void XclExpSupbookBuffer::StoreCell( sal_uInt16 nFileId, const OUString& rTabNam sal_uInt16 nSupbookId; if (!GetSupbookUrl(xSupbook, nSupbookId, *pUrl)) { - xSupbook = std::make_shared<XclExpSupbook>(GetRoot(), *pUrl); + xSupbook = new XclExpSupbook(GetRoot(), *pUrl); nSupbookId = Append(xSupbook); } @@ -1907,7 +1905,7 @@ void XclExpSupbookBuffer::StoreCellRange( sal_uInt16 nFileId, const OUString& rT sal_uInt16 nSupbookId; if (!GetSupbookUrl(xSupbook, nSupbookId, *pUrl)) { - xSupbook = std::make_shared<XclExpSupbook>(GetRoot(), *pUrl); + xSupbook = new XclExpSupbook(GetRoot(), *pUrl); nSupbookId = Append(xSupbook); } @@ -1967,7 +1965,7 @@ bool XclExpSupbookBuffer::InsertAddIn( XclExpSupbookRef xSupbook; if( mnAddInSB == SAL_MAX_UINT16 ) { - xSupbook = std::make_shared<XclExpSupbook>( GetRoot() ); + xSupbook = new XclExpSupbook( GetRoot() ); mnAddInSB = Append( xSupbook ); } else @@ -1985,7 +1983,7 @@ bool XclExpSupbookBuffer::InsertEuroTool( OUString aUrl( "\001\010EUROTOOL.XLA" ); if( !GetSupbookUrl( xSupbook, rnSupbook, aUrl ) ) { - xSupbook = std::make_shared<XclExpSupbook>( GetRoot(), aUrl, XclSupbookType::Eurotool ); + xSupbook = new XclExpSupbook( GetRoot(), aUrl, XclSupbookType::Eurotool ); rnSupbook = Append( xSupbook ); } rnExtName = xSupbook->InsertEuroTool( rName ); @@ -1999,7 +1997,7 @@ bool XclExpSupbookBuffer::InsertDde( XclExpSupbookRef xSupbook; if( !GetSupbookDde( xSupbook, rnSupbook, rApplic, rTopic ) ) { - xSupbook = std::make_shared<XclExpSupbook>( GetRoot(), rApplic, rTopic ); + xSupbook = new XclExpSupbook( GetRoot(), rApplic, rTopic ); rnSupbook = Append( xSupbook ); } rnExtName = xSupbook->InsertDde( rItem ); @@ -2013,7 +2011,7 @@ bool XclExpSupbookBuffer::InsertExtName( XclExpSupbookRef xSupbook; if (!GetSupbookUrl(xSupbook, rnSupbook, rUrl)) { - xSupbook = std::make_shared<XclExpSupbook>(GetRoot(), rUrl); + xSupbook = new XclExpSupbook(GetRoot(), rUrl); rnSupbook = Append(xSupbook); } rnExtName = xSupbook->InsertExtName(rName, rArray); @@ -2033,7 +2031,7 @@ XclExpXti XclExpSupbookBuffer::GetXti( sal_uInt16 nFileId, const OUString& rTabN sal_uInt16 nSupbookId; if (!GetSupbookUrl(xSupbook, nSupbookId, *pUrl)) { - xSupbook = std::make_shared<XclExpSupbook>(GetRoot(), *pUrl); + xSupbook = new XclExpSupbook(GetRoot(), *pUrl); nSupbookId = Append(xSupbook); } aXti.mnSupbook = nSupbookId; @@ -2306,9 +2304,9 @@ void XclExpLinkManagerImpl5::CreateInternal() { XclExpExtSheetRef xRec; if( nScTab == GetCurrScTab() ) - xRec = std::make_shared<XclExpExternSheet>( GetRoot(), EXC_EXTSH_OWNTAB ); + xRec = new XclExpExternSheet( GetRoot(), EXC_EXTSH_OWNTAB ); else - xRec = std::make_shared<XclExpExternSheet>( GetRoot(), rTabInfo.GetScTabName( nScTab ) ); + xRec = new XclExpExternSheet( GetRoot(), rTabInfo.GetScTabName( nScTab ) ); maIntTabMap[ nScTab ] = AppendInternal( xRec ); } } @@ -2350,7 +2348,7 @@ XclExpLinkManagerImpl5::XclExpExtSheetRef XclExpLinkManagerImpl5::FindInternal( XclExpCodeMap::const_iterator aIt = maCodeMap.find( cCode ); if( aIt == maCodeMap.end() ) { - xExtSheet = std::make_shared<XclExpExternSheet>( GetRoot(), cCode ); + xExtSheet = new XclExpExternSheet( GetRoot(), cCode ); rnExtSheet = maCodeMap[ cCode ] = AppendInternal( xExtSheet ); } else diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx index b65b9fb21ef1..155968d4bac0 100644 --- a/sc/source/filter/excel/xename.cxx +++ b/sc/source/filter/excel/xename.cxx @@ -169,7 +169,8 @@ private: /** Appends a new NAME record to the record list. @return The 1-based NAME record index used elsewhere in the Excel file. */ - sal_uInt16 Append( const XclExpNameRef& xName ); + sal_uInt16 Append( XclExpName* pName ); + sal_uInt16 Append( XclExpNameRef const & rxName ) { return Append(rxName.get()); } /** Creates a new NAME record for the passed user-defined name. @return The 1-based NAME record index used elsewhere in the Excel file. */ sal_uInt16 CreateName( SCTAB nTab, const ScRangeData& rRangeData ); @@ -447,7 +448,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 = std::make_shared<XclExpName>( GetRoot(), cBuiltIn ); + XclExpNameRef xName = new 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 +458,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 = std::make_shared<XclExpName>( GetRoot(), cBuiltIn ); + XclExpNameRef xName = new XclExpName( GetRoot(), cBuiltIn ); xName->SetTokenArray( xTokArr ); xName->SetLocalTab( nScTab ); OUString sSymbol; @@ -470,7 +471,7 @@ sal_uInt16 XclExpNameManagerImpl::InsertUniqueName( const OUString& rName, const XclTokenArrayRef& xTokArr, SCTAB nScTab ) { OSL_ENSURE( !rName.isEmpty(), "XclExpNameManagerImpl::InsertUniqueName - empty name" ); - XclExpNameRef xName = std::make_shared<XclExpName>( GetRoot(), GetUnusedName( rName ) ); + XclExpNameRef xName = new XclExpName( GetRoot(), GetUnusedName( rName ) ); xName->SetTokenArray( xTokArr ); xName->SetLocalTab( nScTab ); return Append( xName ); @@ -491,7 +492,7 @@ sal_uInt16 XclExpNameManagerImpl::InsertRawName( const OUString& rName ) } // create a new NAME record - XclExpNameRef xName = std::make_shared<XclExpName>( GetRoot(), rName ); + XclExpNameRef xName = new XclExpName( GetRoot(), rName ); return Append( xName ); } @@ -510,7 +511,7 @@ sal_uInt16 XclExpNameManagerImpl::InsertMacroCall( const OUString& rMacroName, b } // create a new NAME record - XclExpNameRef xName = std::make_shared<XclExpName>( GetRoot(), rMacroName ); + XclExpNameRef xName = new XclExpName( GetRoot(), rMacroName ); xName->SetMacroCall( bVBasic, bFunc ); xName->SetHidden( bHidden ); @@ -524,7 +525,7 @@ sal_uInt16 XclExpNameManagerImpl::InsertMacroCall( const OUString& rMacroName, b const XclExpName* XclExpNameManagerImpl::GetName( sal_uInt16 nNameIdx ) const { OSL_ENSURE( maNameList.HasRecord( nNameIdx - 1 ), "XclExpNameManagerImpl::GetName - wrong record index" ); - return maNameList.GetRecord( nNameIdx - 1 ).get(); + return maNameList.GetRecord( nNameIdx - 1 ); } void XclExpNameManagerImpl::Save( XclExpStream& rStrm ) @@ -600,11 +601,11 @@ OUString XclExpNameManagerImpl::GetUnusedName( const OUString& rName ) const return aNewName; } -sal_uInt16 XclExpNameManagerImpl::Append( const XclExpNameRef& xName ) +sal_uInt16 XclExpNameManagerImpl::Append( XclExpName* pName ) { if( maNameList.GetSize() == 0xFFFF ) return 0; - maNameList.AppendRecord( xName ); + maNameList.AppendRecord( pName ); return static_cast< sal_uInt16 >( maNameList.GetSize() ); // 1-based } @@ -616,7 +617,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 = std::make_shared<XclExpName>( GetRoot(), rName ); + XclExpNameRef xName = new XclExpName( GetRoot(), rName ); if (nTab != SCTAB_GLOBAL) xName->SetLocalTab(nTab); sal_uInt16 nNameIdx = Append( xName ); diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx index 0001fd9db7c7..f21500dcf648 100644 --- a/sc/source/filter/excel/xepivot.cxx +++ b/sc/source/filter/excel/xepivot.cxx @@ -265,7 +265,7 @@ sal_uInt16 XclExpPCField::GetItemCount() const const XclExpPCItem* XclExpPCField::GetItem( sal_uInt16 nItemIdx ) const { - return GetVisItemList().GetRecord( nItemIdx ).get(); + return GetVisItemList().GetRecord( nItemIdx ); } sal_uInt16 XclExpPCField::GetItemIndex( const OUString& rItemName ) const @@ -684,7 +684,7 @@ sal_uInt16 XclExpPivotCache::GetFieldCount() const const XclExpPCField* XclExpPivotCache::GetField( sal_uInt16 nFieldIdx ) const { - return maFieldList.GetRecord( nFieldIdx ).get(); + return maFieldList.GetRecord( nFieldIdx ); } bool XclExpPivotCache::HasAddFields() const @@ -758,14 +758,14 @@ void XclExpPivotCache::AddGroupFields( const ScDPObject& rDPObj ) // loop over all existing standard fields to find their group fields for( sal_uInt16 nFieldIdx = 0; nFieldIdx < maPCInfo.mnStdFields; ++nFieldIdx ) { - if( XclExpPCField* pCurrStdField = maFieldList.GetRecord( nFieldIdx ).get() ) + if( XclExpPCField* pCurrStdField = maFieldList.GetRecord( nFieldIdx ) ) { const ScDPSaveGroupDimension* pGroupDim = pSaveDimData->GetGroupDimForBase( pCurrStdField->GetFieldName() ); XclExpPCField* pLastGroupField = pCurrStdField; while( pGroupDim ) { // insert the new grouping field - XclExpPCFieldRef xNewGroupField = std::make_shared<XclExpPCField>( + XclExpPCFieldRef xNewGroupField = new XclExpPCField( GetRoot(), GetFieldCount(), rDPObj, *pGroupDim, *pCurrStdField ); maFieldList.AppendRecord( xNewGroupField ); @@ -1146,7 +1146,7 @@ XclExpPTItem* XclExpPTField::GetItemAcc( const OUString& rName ) XclExpPTItem* pItem = nullptr; for( size_t nPos = 0, nSize = maItemList.GetSize(); !pItem && (nPos < nSize); ++nPos ) if( maItemList.GetRecord( nPos )->GetItemName() == rName ) - pItem = maItemList.GetRecord( nPos ).get(); + pItem = maItemList.GetRecord( nPos ); return pItem; } @@ -1233,7 +1233,7 @@ const XclExpPCField* XclExpPivotTable::GetCacheField( sal_uInt16 nCacheIdx ) con const XclExpPTField* XclExpPivotTable::GetField( sal_uInt16 nFieldIdx ) const { - return (nFieldIdx == EXC_SXIVD_DATA) ? &maDataOrientField : maFieldList.GetRecord( nFieldIdx ).get(); + return (nFieldIdx == EXC_SXIVD_DATA) ? &maDataOrientField : maFieldList.GetRecord( nFieldIdx ); } const XclExpPTField* XclExpPivotTable::GetField( const OUString& rName ) const @@ -1285,7 +1285,7 @@ XclExpPTField* XclExpPivotTable::GetFieldAcc( const OUString& rName ) XclExpPTField* pField = nullptr; for( size_t nPos = 0, nSize = maFieldList.GetSize(); !pField && (nPos < nSize); ++nPos ) if( maFieldList.GetRecord( nPos )->GetFieldName() == rName ) - pField = maFieldList.GetRecord( nPos ).get(); + pField = maFieldList.GetRecord( nPos ); return pField; } @@ -1630,12 +1630,12 @@ void XclExpPivotTableManager::CreatePivotTables() XclExpRecordRef XclExpPivotTableManager::CreatePivotCachesRecord() { - return std::make_shared<XclExpPivotRecWrapper>( *this, EXC_PTMGR_PIVOTCACHES ); + return new XclExpPivotRecWrapper( *this, EXC_PTMGR_PIVOTCACHES ); } XclExpRecordRef XclExpPivotTableManager::CreatePivotTablesRecord( SCTAB nScTab ) { - return std::make_shared<XclExpPivotRecWrapper>( *this, nScTab ); + return new XclExpPivotRecWrapper( *this, nScTab ); } void XclExpPivotTableManager::WritePivotCaches( XclExpStream& rStrm ) @@ -1669,20 +1669,20 @@ const XclExpPivotCache* XclExpPivotTableManager::CreatePivotCache( const ScDPObj // check all existing pivot caches for( size_t nPos = 0, nSize = maPCacheList.GetSize(); nPos < nSize; ++nPos ) { - XclExpPivotCacheRef xPCache = maPCacheList.GetRecord( nPos ); + XclExpPivotCache* pPCache = maPCacheList.GetRecord( nPos ); // pivot cache does not have grouping info and source data is equal - if( !xPCache->HasAddFields() && xPCache->HasEqualDataSource( rDPObj ) ) - return xPCache.get(); + if( !pPCache->HasAddFields() && pPCache->HasEqualDataSource( rDPObj ) ) + return pPCache; } } } // create a new pivot cache sal_uInt16 nNewCacheIdx = static_cast< sal_uInt16 >( maPCacheList.GetSize() ); - XclExpPivotCacheRef xNewPCache = std::make_shared<XclExpPivotCache>( GetRoot(), rDPObj, nNewCacheIdx ); + XclExpPivotCacheRef xNewPCache = new XclExpPivotCache( GetRoot(), rDPObj, nNewCacheIdx ); if( xNewPCache->IsValid() ) { - maPCacheList.AppendRecord( xNewPCache ); + maPCacheList.AppendRecord( xNewPCache.get() ); return xNewPCache.get(); } diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx index e73ee878cd28..ef3e619ebe10 100644 --- a/sc/source/filter/excel/xeroot.cxx +++ b/sc/source/filter/excel/xeroot.cxx @@ -196,23 +196,23 @@ void XclExpRoot::InitializeGlobals() if( GetBiff() >= EXC_BIFF5 ) { - 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() ); + mrExpData.mxPalette = new XclExpPalette( GetRoot() ); + mrExpData.mxFontBfr = new XclExpFontBuffer( GetRoot() ); + mrExpData.mxNumFmtBfr = new XclExpNumFmtBuffer( GetRoot() ); + mrExpData.mxXFBfr = new XclExpXFBuffer( GetRoot() ); + mrExpData.mxGlobLinkMgr = new XclExpLinkManager( GetRoot() ); + mrExpData.mxNameMgr = new XclExpNameManager( GetRoot() ); } if( GetBiff() == EXC_BIFF8 ) { - mrExpData.mxSst = std::make_shared<XclExpSst>(); + mrExpData.mxSst = new 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 = std::make_shared<XclExpDxfs>( GetRoot() ); + mrExpData.mxDxfs = new XclExpDxfs( GetRoot() ); } if( GetOutput() == EXC_OUTPUT_XML_2007 ) @@ -267,7 +267,7 @@ void XclExpRoot::InitializeTable( SCTAB nScTab ) if( GetBiff() == EXC_BIFF5 ) { // local link manager per sheet - mrExpData.mxLocLinkMgr = std::make_shared<XclExpLinkManager>( GetRoot() ); + mrExpData.mxLocLinkMgr = new XclExpLinkManager( GetRoot() ); } } diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index b2d2b7bdd82c..5a6ed1d1ed7f 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -1179,7 +1179,7 @@ XclExpFontBuffer::XclExpFontBuffer( const XclExpRoot& rRoot ) : const XclExpFont* XclExpFontBuffer::GetFont( sal_uInt16 nXclFont ) const { - return maFontList.GetRecord( nXclFont ).get(); + return maFontList.GetRecord( nXclFont ); } const XclFontData& XclExpFontBuffer::GetAppFontData() const @@ -1192,7 +1192,7 @@ sal_uInt16 XclExpFontBuffer::Insert( { if( bAppFont ) { - XclExpFontRef xFont = std::make_shared<XclExpFont>( GetRoot(), rFontData, eColorType ); + XclExpFontRef xFont = new XclExpFont( GetRoot(), rFontData, eColorType ); maFontList.ReplaceRecord( xFont, EXC_FONT_APP ); // set width of '0' character for column width export SetCharWidth( xFont->GetFontData() ); @@ -1284,7 +1284,7 @@ void XclExpFontBuffer::InitDefaultFonts() break; case EXC_BIFF8: { - XclExpFontRef xFont = std::make_shared<XclExpFont>( GetRoot(), aFontData, EXC_COLOR_CELLTEXT ); + XclExpFontRef xFont = new XclExpFont( GetRoot(), aFontData, EXC_COLOR_CELLTEXT ); maFontList.AppendRecord( xFont ); maFontList.AppendRecord( xFont ); maFontList.AppendRecord( xFont ); @@ -2452,7 +2452,7 @@ sal_uInt32 XclExpXFBuffer::GetDefCellXFId() const XclExpXF* XclExpXFBuffer::GetXFById( sal_uInt32 nXFId ) const { - return maXFList.GetRecord( nXFId ).get(); + return maXFList.GetRecord( nXFId ); } void XclExpXFBuffer::Finalize() @@ -2771,7 +2771,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 = std::make_shared<XclExpXF>( GetRoot(), *pPattern, nScript ); + XclExpXFRef xNewXF = new 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); @@ -2814,7 +2814,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 = std::make_shared<XclExpXF>( GetRoot(), rStyleSheet ); + XclExpXFRef xXF = new XclExpXF( GetRoot(), rStyleSheet ); nXFId = AppendBuiltInXFWithStyle( xXF, nStyleId, nLevel ); // this new XF record is not predefined maBuiltInMap[ nXFId ].mbPredefined = false; @@ -2831,7 +2831,7 @@ sal_uInt32 XclExpXFBuffer::InsertStyleXF( const SfxStyleSheetBase& rStyleSheet ) auto it = std::find(rPositions.begin(), rPositions.end(), nXFId); rPositions.erase(it); // replace predefined built-in style (ReplaceRecord() deletes old record) - auto pNewExp = std::make_shared<XclExpXF>( GetRoot(), rStyleSheet ); + XclExpXFRef pNewExp = new XclExpXF( GetRoot(), rStyleSheet ); maXFList.ReplaceRecord( pNewExp, nXFId ); // and add new entry in find-map maXFFindMap[ToFindKey(*pNewExp)].push_back(nXFId); @@ -2925,7 +2925,7 @@ void XclExpXFBuffer::InsertDefaultRecords() // index 0: default style if( SfxStyleSheetBase* pDefStyleSheet = GetStyleSheetPool().Find( ScResId( STR_STYLENAME_STANDARD ), SfxStyleFamily::Para ) ) { - XclExpXFRef xDefStyle = std::make_shared<XclExpXF>( GetRoot(), *pDefStyleSheet ); + XclExpXFRef xDefStyle = new XclExpXF( GetRoot(), *pDefStyleSheet ); sal_uInt32 nXFId = AppendBuiltInXFWithStyle( xDefStyle, EXC_STYLE_NORMAL ); // mark this XF as not predefined, prevents overwriting maBuiltInMap[ nXFId ].mbPredefined = false; @@ -2933,7 +2933,7 @@ void XclExpXFBuffer::InsertDefaultRecords() else { OSL_FAIL( "XclExpXFBuffer::InsertDefaultRecords - default style not found" ); - XclExpXFRef xDefStyle = std::make_shared<XclExpDefaultXF>( GetRoot(), false ); + XclExpXFRef xDefStyle = new XclExpDefaultXF( GetRoot(), false ); xDefStyle->SetAllUsedFlags( true ); AppendBuiltInXFWithStyle( xDefStyle, EXC_STYLE_NORMAL ); } @@ -2942,18 +2942,18 @@ void XclExpXFBuffer::InsertDefaultRecords() XclExpDefaultXF aLevelStyle( GetRoot(), false ); // RowLevel_1, ColLevel_1 aLevelStyle.SetFont( 1 ); - AppendBuiltInXF( std::make_shared<XclExpDefaultXF>( aLevelStyle ), EXC_STYLE_ROWLEVEL, 0 ); - AppendBuiltInXF( std::make_shared<XclExpDefaultXF>( aLevelStyle ), EXC_STYLE_COLLEVEL, 0 ); + AppendBuiltInXF( new XclExpDefaultXF( aLevelStyle ), EXC_STYLE_ROWLEVEL, 0 ); + AppendBuiltInXF( new XclExpDefaultXF( aLevelStyle ), EXC_STYLE_COLLEVEL, 0 ); // RowLevel_2, ColLevel_2 aLevelStyle.SetFont( 2 ); - AppendBuiltInXF( std::make_shared<XclExpDefaultXF>( aLevelStyle ), EXC_STYLE_ROWLEVEL, 1 ); - AppendBuiltInXF( std::make_shared<XclExpDefaultXF>( aLevelStyle ), EXC_STYLE_COLLEVEL, 1 ); + AppendBuiltInXF( new XclExpDefaultXF( aLevelStyle ), EXC_STYLE_ROWLEVEL, 1 ); + AppendBuiltInXF( new 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( std::make_shared<XclExpDefaultXF>( aLevelStyle ), EXC_STYLE_ROWLEVEL, nLevel ); - AppendBuiltInXF( std::make_shared<XclExpDefaultXF>( aLevelStyle ), EXC_STYLE_COLLEVEL, nLevel ); + AppendBuiltInXF( new XclExpDefaultXF( aLevelStyle ), EXC_STYLE_ROWLEVEL, nLevel ); + AppendBuiltInXF( new XclExpDefaultXF( aLevelStyle ), EXC_STYLE_COLLEVEL, nLevel ); } // index 15: default hard cell format, placeholder to be able to add more built-in styles @@ -2965,15 +2965,15 @@ void XclExpXFBuffer::InsertDefaultRecords() XclExpDefaultXF aFormatStyle( GetRoot(), false ); aFormatStyle.SetFont( 1 ); aFormatStyle.SetNumFmt( 43 ); - AppendBuiltInXFWithStyle( std::make_shared<XclExpDefaultXF>( aFormatStyle ), EXC_STYLE_COMMA ); + AppendBuiltInXFWithStyle( new XclExpDefaultXF( aFormatStyle ), EXC_STYLE_COMMA ); aFormatStyle.SetNumFmt( 41 ); - AppendBuiltInXFWithStyle( std::make_shared<XclExpDefaultXF>( aFormatStyle ), EXC_STYLE_COMMA_0 ); + AppendBuiltInXFWithStyle( new XclExpDefaultXF( aFormatStyle ), EXC_STYLE_COMMA_0 ); aFormatStyle.SetNumFmt( 44 ); - AppendBuiltInXFWithStyle( std::make_shared<XclExpDefaultXF>( aFormatStyle ), EXC_STYLE_CURRENCY ); + AppendBuiltInXFWithStyle( new XclExpDefaultXF( aFormatStyle ), EXC_STYLE_CURRENCY ); aFormatStyle.SetNumFmt( 42 ); - AppendBuiltInXFWithStyle( std::make_shared<XclExpDefaultXF>( aFormatStyle ), EXC_STYLE_CURRENCY_0 ); + AppendBuiltInXFWithStyle( new XclExpDefaultXF( aFormatStyle ), EXC_STYLE_CURRENCY_0 ); aFormatStyle.SetNumFmt( 9 ); - AppendBuiltInXFWithStyle( std::make_shared<XclExpDefaultXF>( aFormatStyle ), EXC_STYLE_PERCENT ); + AppendBuiltInXFWithStyle( new 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 d23cb5f083ad..78c76fd34d65 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 = std::make_shared<XclExpArray>( xTokArr, rScRange ); + rxRec = new XclExpArray( xTokArr, rScRange ); return rxRec; } @@ -276,7 +276,7 @@ XclExpShrfmlaRef XclExpShrfmlaBuffer::CreateOrExtendShrfmla( { // create a new record XclTokenArrayRef xTokArr = GetFormulaCompiler().CreateFormula( EXC_FMLATYPE_SHARED, *pShrdScTokArr, &rScPos ); - xRec = std::make_shared<XclExpShrfmla>( xTokArr, rScPos ); + xRec = new XclExpShrfmla( xTokArr, rScPos ); maRecMap[ pShrdScTokArr ] = xRec; } else @@ -461,7 +461,7 @@ XclExpTableopRef XclExpTableopBuffer::CreateOrExtendTableop( // try to find an existing TABLEOP record for this cell position for( size_t nPos = 0, nSize = maTableopList.GetSize(); !xRec && (nPos < nSize); ++nPos ) { - XclExpTableopRef xTempRec = maTableopList.GetRecord( nPos ); + XclExpTableop* xTempRec = maTableopList.GetRecord( nPos ); if( xTempRec->TryExtend( rScPos, aRefs ) ) xRec = xTempRec; } @@ -524,7 +524,7 @@ XclExpTableopRef XclExpTableopBuffer::TryCreate( const ScAddress& rScPos, const XclExpTableopRef xRec; if( bOk ) { - xRec = std::make_shared<XclExpTableop>( rScPos, rRefs, nScMode ); + xRec = new XclExpTableop( rScPos, rRefs, nScMode ); maTableopList.AppendRecord( xRec ); } @@ -1063,7 +1063,7 @@ void XclExpFormulaCell::WriteContents( XclExpStream& rStrm ) if( !aResult.isEmpty() || (rStrm.GetRoot().GetBiff() <= EXC_BIFF5) ) { rStrm << EXC_FORMULA_RES_STRING; - mxStringRec = std::make_shared<XclExpStringRec>( rStrm.GetRoot(), aResult ); + mxStringRec = new XclExpStringRec( rStrm.GetRoot(), aResult ); } else rStrm << EXC_FORMULA_RES_EMPTY; // BIFF8 only @@ -1902,9 +1902,9 @@ void XclExpRow::Finalize( const ScfUInt16Vec& rColXFIndexes, bool bProgress ) ScfUInt16Vec aXFIndexes( nColCount, EXC_XF_NOTFOUND ); for( nPos = 0, nSize = maCellList.GetSize(); nPos < nSize; ++nPos ) { - XclExpCellRef xCell = maCellList.GetRecord( nPos ); - xCell->ConvertXFIndexes( GetRoot() ); - xCell->GetBlankXFIndexes( aXFIndexes ); + XclExpCellBase* pCell = maCellList.GetRecord( nPos ); + pCell->ConvertXFIndexes( GetRoot() ); + pCell->GetBlankXFIndexes( aXFIndexes ); } // *** Fill gaps with BLANK/MULBLANK cell records *** --------------------- @@ -1930,7 +1930,7 @@ void XclExpRow::Finalize( const ScfUInt16Vec& rColXFIndexes, bool bProgress ) if( nFirstFreeXclCol < nNextUsedXclCol ) { aXFId.mnCount = nNextUsedXclCol - nFirstFreeXclCol; - XclExpCellRef xNewCell = std::make_shared<XclExpBlankCell>( XclAddress( nFirstFreeXclCol, mnXclRow ), aXFId ); + XclExpCellRef xNewCell = new 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 @@ -2027,7 +2027,7 @@ void XclExpRow::Finalize( const ScfUInt16Vec& rColXFIndexes, bool bProgress ) nPos = 0; while( nPos < maCellList.GetSize() ) // do not cache list size, may change in the loop { - XclExpCellRef xCell = maCellList.GetRecord( nPos ); + XclExpCellBase* xCell = maCellList.GetRecord( nPos ); xCell->RemoveUnusedBlankCells( aXFIndexes ); if( xCell->IsEmpty() ) maCellList.RemoveRecord( nPos ); @@ -2091,7 +2091,7 @@ void XclExpRow::InsertCell( XclExpCellRef xCell, size_t nPos, bool bIsMergedBase ::set_flag( mnFlags, EXC_ROW_UNSYNCED ); // try to merge with previous cell, insert the new cell if not successful - XclExpCellRef xPrevCell = maCellList.GetRecord( nPos - 1 ); + XclExpCellBase* xPrevCell = maCellList.GetRecord( nPos - 1 ); if( xPrevCell && xPrevCell->TryMerge( *xCell ) ) xCell = xPrevCell; else @@ -2439,13 +2439,13 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) : maArrayBfr( rRoot ), maShrfmlaBfr( rRoot ), maTableopBfr( 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 ) ) + 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 ) ) { ScDocument& rDoc = GetDoc(); SCTAB nScTab = GetCurrScTab(); @@ -2549,8 +2549,8 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) : OUString aUrl = pPattern->GetItemSet().Get(ATTR_HYPERLINK).GetValue(); if (!aUrl.isEmpty()) { - std::shared_ptr<XclExpHyperlink> aLink = - std::make_shared<XclExpHyperlink>(GetRoot(), SvxURLField(aUrl, aUrl), aScPos); + rtl::Reference<XclExpHyperlink> aLink = + new XclExpHyperlink(GetRoot(), SvxURLField(aUrl, aUrl), aScPos); mxHyperlinkList->AppendRecord(aLink); } } @@ -2560,26 +2560,26 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) : { sal_uInt32 nScNumFmt = pPattern->GetItemSet().Get( ATTR_VALUE_FORMAT ).GetValue(); if( rFormatter.GetType( nScNumFmt ) == SvNumFormatType::LOGICAL ) - xCell = std::make_shared<XclExpBooleanCell>( + xCell = new 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 = std::make_shared<XclExpRkCell>( + xCell = new XclExpRkCell( GetRoot(), aXclPos, pPattern, nMergeBaseXFId, nRkValue ); // else: simple floating-point number cell if( !xCell ) - xCell = std::make_shared<XclExpNumberCell>( + xCell = new XclExpNumberCell( GetRoot(), aXclPos, pPattern, nMergeBaseXFId, fValue ); } break; case CELLTYPE_STRING: { - xCell = std::make_shared<XclExpLabelCell>( + xCell = new XclExpLabelCell( GetRoot(), aXclPos, pPattern, nMergeBaseXFId, rScCell.mpString->getString()); } break; @@ -2587,7 +2587,7 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) : case CELLTYPE_EDIT: { XclExpHyperlinkHelper aLinkHelper( GetRoot(), aScPos ); - xCell = std::make_shared<XclExpLabelCell>( + xCell = new XclExpLabelCell( GetRoot(), aXclPos, pPattern, nMergeBaseXFId, rScCell.mpEditText, aLinkHelper); // add a single created HLINK record to the record list @@ -2606,13 +2606,13 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) : OUString aUrl = pPattern->GetItemSet().Get(ATTR_HYPERLINK).GetValue(); if (!aUrl.isEmpty()) { - std::shared_ptr<XclExpHyperlink> aLink = - std::make_shared<XclExpHyperlink>(GetRoot(), SvxURLField(aUrl, aUrl), aScPos); + rtl::Reference<XclExpHyperlink> aLink = + new XclExpHyperlink(GetRoot(), SvxURLField(aUrl, aUrl), aScPos); mxHyperlinkList->AppendRecord(aLink); } } - xCell = std::make_shared<XclExpFormulaCell>( + xCell = new XclExpFormulaCell( GetRoot(), aXclPos, pPattern, nMergeBaseXFId, *rScCell.mpFormula, maArrayBfr, maShrfmlaBfr, maTableopBfr); } @@ -2623,7 +2623,7 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) : [[fallthrough]]; case CELLTYPE_NONE: { - xCell = std::make_shared<XclExpBlankCell>( + xCell = new XclExpBlankCell( GetRoot(), aXclPos, nLastXclCol, pPattern, nMergeBaseXFId ); } break; @@ -2703,7 +2703,7 @@ XclExpRecordRef XclExpCellTable::CreateRecord( sal_uInt16 nRecId ) const XclExpRecordRef xRec; switch( nRecId ) { - case EXC_ID3_DIMENSIONS: xRec = std::make_shared<XclExpDelegatingRecord>( &const_cast<XclExpRowBuffer*>(&maRowBfr)->GetDimensions() ); break; + case EXC_ID3_DIMENSIONS: xRec = new 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 7dd250846761..2dbc8802b627 100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -561,7 +561,7 @@ XclImpChFrameBase::XclImpChFrameBase( const XclChFormatInfo& rFmtInfo ) if( rFmtInfo.mbCreateDefFrame ) switch( rFmtInfo.meDefFrameType ) { case EXC_CHFRAMETYPE_AUTO: - mxLineFmt = std::make_shared<XclImpChLineFormat>(); + mxLineFmt = new XclImpChLineFormat(); if( rFmtInfo.mbIsFrame ) mxAreaFmt = std::make_shared<XclImpChAreaFormat>(); break; @@ -570,7 +570,7 @@ XclImpChFrameBase::XclImpChFrameBase( const XclChFormatInfo& rFmtInfo ) XclChLineFormat aLineFmt; ::set_flag( aLineFmt.mnFlags, EXC_CHLINEFORMAT_AUTO, false ); aLineFmt.mnPattern = EXC_CHLINEFORMAT_NONE; - mxLineFmt = std::make_shared<XclImpChLineFormat>( aLineFmt ); + mxLineFmt = new XclImpChLineFormat( aLineFmt ); if( rFmtInfo.mbIsFrame ) { XclChAreaFormat aAreaFmt; @@ -590,7 +590,7 @@ void XclImpChFrameBase::ReadSubRecord( XclImpStream& rStrm ) switch( rStrm.GetRecId() ) { case EXC_ID_CHLINEFORMAT: - mxLineFmt = std::make_shared<XclImpChLineFormat>(); + mxLineFmt = new XclImpChLineFormat(); mxLineFmt->ReadChLineFormat( rStrm ); break; case EXC_ID_CHAREAFORMAT: @@ -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 = std::make_shared<XclImpChLineFormat>( aLineFmt ); + mxLineFmt = new XclImpChLineFormat( aLineFmt ); } if( rFillData.IsFilled() && (!mxAreaFmt || !mxAreaFmt->HasArea()) && !mxEscherFmt ) @@ -1460,7 +1460,7 @@ void XclImpChDataFormat::UpdateSeriesFormat( const XclChExtTypeInfo& rTypeInfo, /* Create missing but required formats. Existing line, area, and marker format objects are needed to create automatic series formatting. */ if( !mxLineFmt ) - mxLineFmt = std::make_shared<XclImpChLineFormat>(); + mxLineFmt = new XclImpChLineFormat(); if( !mxAreaFmt && !mxEscherFmt ) mxAreaFmt = std::make_shared<XclImpChAreaFormat>(); if( !mxMarkerFmt ) @@ -1478,7 +1478,7 @@ void XclImpChDataFormat::UpdatePointFormat( const XclChExtTypeInfo& rTypeInfo, c if( pSeriesFmt ) { if( IsAutoLine() && pSeriesFmt->IsAutoLine() ) - mxLineFmt.reset(); + mxLineFmt.clear(); if( IsAutoArea() && pSeriesFmt->IsAutoArea() ) mxAreaFmt.reset(); if( IsAutoMarker() && pSeriesFmt->IsAutoMarker() ) @@ -1490,7 +1490,7 @@ void XclImpChDataFormat::UpdatePointFormat( const XclChExtTypeInfo& rTypeInfo, c mx3dDataFmt.reset(); // remove point line formats for linear chart types, TODO: implement in OOChart if( !rTypeInfo.IsSeriesFrameFormat() ) - mxLineFmt.reset(); + mxLineFmt.clear(); // remove formats not used for the current chart type RemoveUnusedFormats( rTypeInfo ); @@ -1501,7 +1501,7 @@ void XclImpChDataFormat::UpdatePointFormat( const XclChExtTypeInfo& rTypeInfo, c void XclImpChDataFormat::UpdateTrendLineFormat() { if( !mxLineFmt ) - mxLineFmt = std::make_shared<XclImpChLineFormat>(); + mxLineFmt = new XclImpChLineFormat(); mxAreaFmt.reset(); mxEscherFmt.reset(); mxMarkerFmt.reset(); @@ -3279,9 +3279,9 @@ void XclImpChAxis::Finalize() mxValueRange = std::make_shared<XclImpChValueRange>( GetChRoot() ); // remove invisible grid lines completely if( mxMajorGrid && !mxMajorGrid->HasLine() ) - mxMajorGrid.reset(); + mxMajorGrid.clear(); if( mxMinorGrid && !mxMinorGrid->HasLine() ) - mxMinorGrid.reset(); + mxMinorGrid.clear(); // default tick settings different in OOChart and Excel if( !mxTick ) mxTick = std::make_shared<XclImpChTick>( GetChRoot() ); @@ -3291,7 +3291,7 @@ void XclImpChAxis::Finalize() XclChLineFormat aLineFmt; // set "show axis" flag, default if line format record is missing ::set_flag( aLineFmt.mnFlags, EXC_CHLINEFORMAT_SHOWAXIS ); - mxAxisLine = std::make_shared<XclImpChLineFormat>( aLineFmt ); + mxAxisLine = new XclImpChLineFormat( aLineFmt ); } // add wall/floor frame for 3d charts if( !mxWallFrame ) @@ -3490,7 +3490,7 @@ void XclImpChAxis::ReadChAxisLine( XclImpStream& rStrm ) { if( pxLineFmt && (nRecId == EXC_ID_CHLINEFORMAT) ) { - (*pxLineFmt) = std::make_shared<XclImpChLineFormat>(); + (*pxLineFmt) = new XclImpChLineFormat(); (*pxLineFmt)->ReadChLineFormat( rStrm ); } else if( bWallFrame && mxWallFrame ) diff --git a/sc/source/filter/inc/excdoc.hxx b/sc/source/filter/inc/excdoc.hxx index df90b1b2fb5e..cd303242aa8f 100644 --- a/sc/source/filter/inc/excdoc.hxx +++ b/sc/source/filter/inc/excdoc.hxx @@ -40,9 +40,9 @@ class ExcTable : public XclExpRecordBase, public XclExpRoot { private: typedef XclExpRecordList< ExcBundlesheetBase > ExcBoundsheetList; - typedef std::shared_ptr< XclExpCellTable > XclExpCellTableRef; - typedef XclExpRecordList< XclExpNote > XclExpNoteList; - typedef std::shared_ptr< XclExpNoteList > XclExpNoteListRef; + typedef rtl::Reference< XclExpCellTable > XclExpCellTableRef; + typedef XclExpRecordList< XclExpNote > XclExpNoteList; + typedef rtl::Reference< XclExpNoteList > XclExpNoteListRef; XclExpRecordList<> aRecList; XclExpCellTableRef mxCellTable; diff --git a/sc/source/filter/inc/excrecds.hxx b/sc/source/filter/inc/excrecds.hxx index dadeef2ae165..147808e4e758 100644 --- a/sc/source/filter/inc/excrecds.hxx +++ b/sc/source/filter/inc/excrecds.hxx @@ -413,8 +413,8 @@ private: typedef XclExpAutofilterList::RecordRefType XclExpAutofilterRef; XclExpAutofilterList maFilterList; - std::unique_ptr<XclExpFiltermode> m_pFilterMode; - std::unique_ptr<XclExpAutofilterinfo> m_pFilterInfo; + rtl::Reference<XclExpFiltermode> m_pFilterMode; + rtl::Reference<XclExpAutofilterinfo> m_pFilterInfo; ScRange maRef; bool mbAutoFilter; }; @@ -439,7 +439,7 @@ public: private: using XclExpRoot::CreateRecord; - typedef std::shared_ptr< ExcAutoFilterRecs > XclExpTabFilterRef; + typedef rtl::Reference< ExcAutoFilterRecs > XclExpTabFilterRef; typedef ::std::map< SCTAB, XclExpTabFilterRef > XclExpTabFilterMap; XclExpTabFilterMap maFilterMap; diff --git a/sc/source/filter/inc/xechart.hxx b/sc/source/filter/inc/xechart.hxx index 8cae7ee7bf4b..db3fcf62d5ab 100644 --- a/sc/source/filter/inc/xechart.hxx +++ b/sc/source/filter/inc/xechart.hxx @@ -218,7 +218,7 @@ private: XclChFramePos maData; /// Position of the frame. }; -typedef std::shared_ptr< XclExpChFramePos > XclExpChFramePosRef; +typedef rtl::Reference< XclExpChFramePos > XclExpChFramePosRef; class XclExpChLineFormat : public XclExpRecord { @@ -251,7 +251,7 @@ private: sal_uInt32 mnColorId; /// Line color identifier. }; -typedef std::shared_ptr< XclExpChLineFormat > XclExpChLineFormatRef; +typedef rtl::Reference< XclExpChLineFormat > XclExpChLineFormatRef; class XclExpChAreaFormat : public XclExpRecord { @@ -283,7 +283,7 @@ private: sal_uInt32 mnBackColorId; /// Pattern background color identifier. }; -typedef std::shared_ptr< XclExpChAreaFormat > XclExpChAreaFormatRef; +typedef rtl::Reference< XclExpChAreaFormat > XclExpChAreaFormatRef; class XclExpChEscherFormat : public XclExpChGroupBase { @@ -316,7 +316,7 @@ private: sal_uInt32 mnColor2Id; /// Second fill color identifier. }; -typedef std::shared_ptr< XclExpChEscherFormat > XclExpChEscherFormatRef; +typedef rtl::Reference< XclExpChEscherFormat > XclExpChEscherFormatRef; /** Base class for record groups containing frame formatting. @@ -383,7 +383,7 @@ private: XclChObjectType meObjType; /// Type of the represented object. }; -typedef std::shared_ptr< XclExpChFrame > XclExpChFrameRef; +typedef rtl::Reference< XclExpChFrame > XclExpChFrameRef; // Source links =============================================================== @@ -418,7 +418,7 @@ private: XclExpStringRef mxString; /// Text data (CHSTRING record). }; -typedef std::shared_ptr< XclExpChSourceLink > XclExpChSourceLinkRef; +typedef rtl::Reference< XclExpChSourceLink > XclExpChSourceLinkRef; // Text ======================================================================= @@ -429,7 +429,7 @@ public: explicit XclExpChFont( sal_uInt16 nFontIdx ); }; -typedef std::shared_ptr< XclExpChFont > XclExpChFontRef; +typedef rtl::Reference< XclExpChFont > XclExpChFontRef; /** The CHOBJECTLINK record linking a text object to a specific chart object. */ class XclExpChObjectLink : public XclExpRecord @@ -444,7 +444,7 @@ private: XclChObjectLink maData; /// Contents of the CHOBJECTLINK record. }; -typedef std::shared_ptr< XclExpChObjectLink > XclExpChObjectLinkRef; +typedef rtl::Reference< XclExpChObjectLink > XclExpChObjectLinkRef; /** Additional data label settings in the future record CHFRLABELPROPS. */ class XclExpChFrLabelProps : public XclExpChFutureRecordBase @@ -465,7 +465,7 @@ private: XclChFrLabelProps maData; /// Contents of the CHFRLABELPROPS record. }; -typedef std::shared_ptr< XclExpChFrLabelProps > XclExpChFrLabelPropsRef; +typedef rtl::Reference< XclExpChFrLabelProps > XclExpChFrLabelPropsRef; /** Base class for objects with font settings. Provides font conversion helper functions. */ class XclExpChFontBase @@ -533,7 +533,7 @@ private: sal_uInt32 mnTextColorId; /// Text color identifier. }; -typedef std::shared_ptr< XclExpChText > XclExpChTextRef; +typedef rtl::Reference< XclExpChText > XclExpChTextRef; // Data series ================================================================ @@ -569,7 +569,7 @@ private: sal_uInt32 mnFillColorId; /// Fill color identifier. }; -typedef std::shared_ptr< XclExpChMarkerFormat > XclExpChMarkerFormatRef; +typedef rtl::Reference< XclExpChMarkerFormat > XclExpChMarkerFormatRef; /** The CHPIEFORMAT record containing data point formatting data for pie segments. */ class XclExpChPieFormat : public XclExpUInt16Record @@ -581,7 +581,7 @@ public: void Convert( const ScfPropertySet& rPropSet ); }; -typedef std::shared_ptr< XclExpChPieFormat > XclExpChPieFormatRef; +typedef rtl::Reference< XclExpChPieFormat > XclExpChPieFormatRef; /** The CH3DDATAFORMAT record containing the bar type in 3D bar charts. */ class XclExpCh3dDataFormat : public XclExpRecord @@ -599,7 +599,7 @@ private: XclCh3dDataFormat maData; /// Contents of the CH3DDATAFORMAT record. }; -typedef std::shared_ptr< XclExpCh3dDataFormat > XclExpCh3dDataFormatRef; +typedef rtl::Reference< XclExpCh3dDataFormat > XclExpCh3dDataFormatRef; /** The CHATTACHEDLABEL record that contains the type of a data point label. */ class XclExpChAttachedLabel : public XclExpUInt16Record @@ -608,7 +608,7 @@ public: explicit XclExpChAttachedLabel( sal_uInt16 nFlags ); }; -typedef std::shared_ptr< XclExpChAttachedLabel > XclExpChAttLabelRef; +typedef rtl::Reference< XclExpChAttachedLabel > XclExpChAttLabelRef; /** Represents the CHDATAFORMAT record group containing data point properties. @@ -647,7 +647,7 @@ private: XclExpChAttLabelRef mxAttLabel; /// Data point label type (CHATTACHEDLABEL record). }; -typedef std::shared_ptr< XclExpChDataFormat > XclExpChDataFormatRef; +typedef rtl::Reference< XclExpChDataFormat > XclExpChDataFormatRef; /** Represents the CHSERTRENDLINE record containing settings for a trend line. */ class XclExpChSerTrendLine : public XclExpRecord, protected XclExpChRoot @@ -673,7 +673,7 @@ private: XclExpChTextRef mxLabel; /// Formatting of the equation text box. }; -typedef std::shared_ptr< XclExpChSerTrendLine > XclExpChSerTrendLineRef; +typedef rtl::Reference< XclExpChSerTrendLine > XclExpChSerTrendLineRef; /** Represents the CHSERERRORBAR record containing settings for error bars. */ class XclExpChSerErrorBar : public XclExpRecord, protected XclExpChRoot @@ -691,7 +691,7 @@ private: XclChSerErrorBar maData; /// Contents of the CHSERERRORBAR record. }; -typedef std::shared_ptr< XclExpChSerErrorBar > XclExpChSerErrorBarRef; +typedef rtl::Reference< XclExpChSerErrorBar > XclExpChSerErrorBarRef; /** Represents the CHSERIES record group describing a data series in a chart. @@ -759,7 +759,7 @@ private: sal_uInt16 mnParentIdx; /// 0-based index of parent series (trend lines and error bars). }; -typedef std::shared_ptr< XclExpChSeries > XclExpChSeriesRef; +typedef rtl::Reference< XclExpChSeries > XclExpChSeriesRef; // Chart type groups ========================================================== @@ -810,7 +810,7 @@ private: XclChChart3d maData; /// Contents of the CHCHART3D record. }; -typedef std::shared_ptr< XclExpChChart3d > XclExpChChart3dRef; +typedef rtl::Reference< XclExpChChart3d > XclExpChChart3dRef; /** Represents the CHLEGEND record group describing the chart legend. @@ -838,7 +838,7 @@ private: XclExpChFrameRef mxFrame; /// Legend frame format (CHFRAME group). }; -typedef std::shared_ptr< XclExpChLegend > XclExpChLegendRef; +typedef rtl::Reference< XclExpChLegend > XclExpChLegendRef; /** Represents the CHDROPBAR record group describing pos/neg bars in line charts. @@ -863,7 +863,7 @@ private: XclChObjectType meObjType; /// Type of the dropbar. }; -typedef std::shared_ptr< XclExpChDropBar > XclExpChDropBarRef; +typedef rtl::Reference< XclExpChDropBar > XclExpChDropBarRef; /** Represents the CHTYPEGROUP record group describing a group of series. @@ -938,7 +938,7 @@ private: XclExpChLineFormatMap m_ChartLines; /// Global line formats (CHCHARTLINE group). }; -typedef std::shared_ptr< XclExpChTypeGroup > XclExpChTypeGroupRef; +typedef rtl::Reference< XclExpChTypeGroup > XclExpChTypeGroupRef; // Axes ======================================================================= @@ -965,7 +965,7 @@ private: XclChDateRange maDateData; /// Contents of the CHDATERANGE record. }; -typedef std::shared_ptr< XclExpChLabelRange > XclExpChLabelRangeRef; +typedef rtl::Reference< XclExpChLabelRange > XclExpChLabelRangeRef; class XclExpChValueRange : public XclExpRecord, protected XclExpChRoot { @@ -984,7 +984,7 @@ private: XclChValueRange maData; /// Contents of the CHVALUERANGE record. }; -typedef std::shared_ptr< XclExpChValueRange > XclExpChValueRangeRef; +typedef rtl::Reference< XclExpChValueRange > XclExpChValueRangeRef; class XclExpChTick : public XclExpRecord, protected XclExpChRoot { @@ -1006,7 +1006,7 @@ private: sal_uInt32 mnTextColorId; /// Axis labels text color identifier. }; -typedef std::shared_ptr< XclExpChTick > XclExpChTickRef; +typedef rtl::Reference< XclExpChTick > XclExpChTickRef; /** Represents the CHAXIS record group describing an entire chart axis. @@ -1056,7 +1056,7 @@ private: sal_uInt16 mnNumFmtIdx; /// Index into number format buffer (CHFORMAT record). }; -typedef std::shared_ptr< XclExpChAxis > XclExpChAxisRef; +typedef rtl::Reference< XclExpChAxis > XclExpChAxisRef; /** Represents the CHAXESSET record group describing an axes set (X/Y/Z axes). @@ -1178,7 +1178,7 @@ public: private: std::shared_ptr< XclExpObjectManager > mxObjMgr; - std::shared_ptr< XclExpRecordBase > mxObjRecs; + rtl::Reference< XclExpRecordBase > mxObjRecs; }; /** Represents the entire chart substream (all records in BOF/EOF block). */ diff --git a/sc/source/filter/inc/xedbdata.hxx b/sc/source/filter/inc/xedbdata.hxx index 962f823084b6..5d075966463b 100644 --- a/sc/source/filter/inc/xedbdata.hxx +++ b/sc/source/filter/inc/xedbdata.hxx @@ -57,10 +57,10 @@ public: virtual ~XclExpTablesManager() override; void Initialize(); - ::std::shared_ptr< XclExpTables > GetTablesBySheet( SCTAB nTab ); + rtl::Reference< XclExpTables > GetTablesBySheet( SCTAB nTab ); private: - typedef ::std::map< SCTAB, ::std::shared_ptr< XclExpTables > > TablesMapType; + typedef ::std::map< SCTAB, rtl::Reference< XclExpTables > > TablesMapType; TablesMapType maTablesMap; }; diff --git a/sc/source/filter/inc/xeescher.hxx b/sc/source/filter/inc/xeescher.hxx index 11eb5c3065ac..b1b61a5feab1 100644 --- a/sc/source/filter/inc/xeescher.hxx +++ b/sc/source/filter/inc/xeescher.hxx @@ -391,17 +391,17 @@ public: /** Creates and returns the MSODRAWINGGROUP record containing global DFF data in the DGGCONTAINER. */ - std::shared_ptr< XclExpRecordBase > CreateDrawingGroup(); + rtl::Reference< XclExpRecordBase > CreateDrawingGroup(); /** Initializes the object manager for a new sheet. */ void StartSheet(); /** Processes a drawing page and returns the record block containing all related records (MSODRAWING, OBJ, TXO, charts, etc.). */ - std::shared_ptr< XclExpRecordBase > ProcessDrawing( const SdrPage* pSdrPage ); + rtl::Reference< XclExpRecordBase > ProcessDrawing( const SdrPage* pSdrPage ); /** Processes a collection of UNO shapes and returns the record block containing all related records (MSODRAWING, OBJ, TXO, charts, etc.). */ - std::shared_ptr< XclExpRecordBase > ProcessDrawing( const css::uno::Reference< css::drawing::XShapes >& rxShapes ); + rtl::Reference< XclExpRecordBase > ProcessDrawing( const css::uno::Reference< css::drawing::XShapes >& rxShapes ); /** Finalizes the object manager after conversion of all sheets. */ void EndDocument(); @@ -422,7 +422,7 @@ private: std::shared_ptr< ::utl::TempFile > mxTempFile; std::shared_ptr< SvStream > mxDffStrm; std::shared_ptr< XclEscherEx > mxEscherEx; - std::shared_ptr< XclExpObjList > mxObjList; + rtl::Reference< XclExpObjList > mxObjList; }; class XclExpEmbeddedObjectManager : public XclExpObjectManager diff --git a/sc/source/filter/inc/xeextlst.hxx b/sc/source/filter/inc/xeextlst.hxx index 809b6ba37831..a88b823e49a9 100644 --- a/sc/source/filter/inc/xeextlst.hxx +++ b/sc/source/filter/inc/xeextlst.hxx @@ -147,7 +147,7 @@ private: const char* mOperator; }; -typedef std::shared_ptr<XclExpExt> XclExpExtRef; +typedef rtl::Reference<XclExpExt> XclExpExtRef; class XclExpExtConditionalFormatting : public XclExpRecordBase, protected XclExpRoot { @@ -160,7 +160,7 @@ private: ScRangeList maRange; }; -typedef std::shared_ptr<XclExpExtConditionalFormatting> XclExpExtConditionalFormattingRef; +typedef rtl::Reference<XclExpExtConditionalFormatting> XclExpExtConditionalFormattingRef; class XclExpExtCondFormat : public XclExpExt { @@ -170,7 +170,7 @@ public: virtual XclExpExtType GetType() override { return XclExpExtDataBarType; } - void AddRecord( const XclExpExtConditionalFormattingRef& aFormat ); + void AddRecord( XclExpExtConditionalFormatting* pFormat ); private: XclExpRecordList< XclExpExtConditionalFormatting > maCF; @@ -194,15 +194,16 @@ public: explicit XclExtLst( const XclExpRoot& rRoot); virtual void SaveXml( XclExpXmlStream& rStrm ) override; - void AddRecord( const XclExpExtRef& aEntry ); + void AddRecord( XclExpExt* pEntry ); + void AddRecord( XclExpExtRef& aEntry ) { AddRecord(aEntry.get()); } - XclExpExtRef GetItem( XclExpExtType eType ); + XclExpExt* GetItem( XclExpExtType eType ); private: XclExpRecordList< XclExpExt > maExtEntries; }; -typedef std::shared_ptr< XclExtLst > XclExtLstRef; +typedef rtl::Reference< XclExtLst > XclExtLstRef; #endif diff --git a/sc/source/filter/inc/xehelper.hxx b/sc/source/filter/inc/xehelper.hxx index 107a7aee1871..a92c1a8e65bd 100644 --- a/sc/source/filter/inc/xehelper.hxx +++ b/sc/source/filter/inc/xehelper.hxx @@ -175,7 +175,7 @@ class XclExpHyperlink; class XclExpHyperlinkHelper : protected XclExpRoot { public: - typedef std::shared_ptr< XclExpHyperlink > XclExpHyperlinkRef; + typedef rtl::Reference< XclExpHyperlink > XclExpHyperlinkRef; explicit XclExpHyperlinkHelper( const XclExpRoot& rRoot, const ScAddress& rScPos ); virtual ~XclExpHyperlinkHelper() override; diff --git a/sc/source/filter/inc/xepivot.hxx b/sc/source/filter/inc/xepivot.hxx index 261c05297d38..98fbdf52e8a5 100644 --- a/sc/source/filter/inc/xepivot.hxx +++ b/sc/source/filter/inc/xepivot.hxx @@ -153,7 +153,7 @@ private: sal_uInt16 mnTypeFlags; /// Collected item data type flags. }; -class XclExpPivotCache : protected XclExpRoot +class XclExpPivotCache : public salhelper::SimpleReferenceObject, protected XclExpRoot { public: explicit XclExpPivotCache( const XclExpRoot& rRoot, @@ -219,6 +219,8 @@ private: bool mbValid; /// true = The cache is valid for export. }; +typedef rtl::Reference<XclExpPivotCache> XclExpPivotCacheRef; + // Pivot table class XclExpPivotTable; @@ -426,7 +428,6 @@ private: private: typedef XclExpRecordList< XclExpPivotCache > XclExpPivotCacheList; - typedef XclExpPivotCacheList::RecordRefType XclExpPivotCacheRef; typedef XclExpRecordList< XclExpPivotTable > XclExpPivotTableList; typedef XclExpPivotTableList::RecordRefType XclExpPivotTableRef; diff --git a/sc/source/filter/inc/xerecord.hxx b/sc/source/filter/inc/xerecord.hxx index c35a1c576ee8..b18fa735d258 100644 --- a/sc/source/filter/inc/xerecord.hxx +++ b/sc/source/filter/inc/xerecord.hxx @@ -23,7 +23,9 @@ #include "xlconst.hxx" #include "xestream.hxx" #include "xlstream.hxx" -#include <memory> +#include <salhelper/simplereferenceobject.hxx> +#include <rtl/ref.hxx> +#include <type_traits> // Base classes to export Excel records ======================================= @@ -34,14 +36,20 @@ records contained in the class). Derive from XclExpRecord (instead from this class) to write common records. */ -class XclExpRecordBase +class XclExpRecordBase : public salhelper::SimpleReferenceObject { public: - XclExpRecordBase() = default; - XclExpRecordBase(XclExpRecordBase const &) = default; - XclExpRecordBase(XclExpRecordBase &&) = default; - XclExpRecordBase & operator =(XclExpRecordBase const &) = default; - XclExpRecordBase & operator =(XclExpRecordBase &&) = default; + XclExpRecordBase() {} + + // this class is stored both ref-counted and by value + XclExpRecordBase(XclExpRecordBase const &) + : salhelper::SimpleReferenceObject() {} + XclExpRecordBase(XclExpRecordBase &&) + : salhelper::SimpleReferenceObject() {} + XclExpRecordBase& operator=(XclExpRecordBase const &) + { return *this; } + XclExpRecordBase& operator=(XclExpRecordBase &&) noexcept + { return *this; } virtual ~XclExpRecordBase(); @@ -50,6 +58,18 @@ public: virtual void SaveXml( XclExpXmlStream& rStrm ); }; +/*namespace std +{ + template<typename T, + typename = typename std::enable_if< + std::is_base_of<XclExpRecordBase,T>::value + >::type> + class shared_ptr + { + shared_ptr() {} + }; +};*/ + class XclExpDelegatingRecord : public XclExpRecordBase { public: @@ -129,12 +149,9 @@ public: sal_uInt16 nRecId = EXC_ID_UNKNOWN, std::size_t nRecSize = 0 ); - virtual ~XclExpRecord() override; + XclExpRecord(XclExpRecord const &) = default; - XclExpRecord(XclExpRecord const &) = default; - XclExpRecord(XclExpRecord &&) = default; - XclExpRecord & operator =(XclExpRecord const &) = default; - XclExpRecord & operator =(XclExpRecord &&) = default; + virtual ~XclExpRecord() override; /** Returns the current record ID. */ sal_uInt16 GetRecId() const { return mnRecId; } @@ -305,7 +322,7 @@ template< typename RecType = XclExpRecordBase > class XclExpRecordList : public XclExpRecordBase { public: - typedef std::shared_ptr< RecType > RecordRefType; + typedef rtl::Reference< RecType > RecordRefType; bool IsEmpty() const { return maRecs.empty(); } size_t GetSize() const { return maRecs.size(); } @@ -314,32 +331,44 @@ public: bool HasRecord( size_t nPos ) const { return nPos < maRecs.size(); } /** Returns reference to an existing record or empty reference on error. */ - RecordRefType GetRecord( size_t nPos ) const - { return (nPos < maRecs.size()) ? maRecs[ nPos ] : RecordRefType(); } + RecType* GetRecord( size_t nPos ) const + { return nPos < maRecs.size() ? maRecs[ nPos ].get() : nullptr; } /** Returns reference to the first existing record or empty reference, if list is empty. */ - RecordRefType GetFirstRecord() const - { return maRecs.empty() ? RecordRefType() : maRecs.front(); } + RecType* GetFirstRecord() const + { return maRecs.empty() ? nullptr : maRecs.front().get(); } /** Returns reference to the last existing record or empty reference, if list is empty. */ - RecordRefType GetLastRecord() const - { return maRecs.empty() ? RecordRefType() : maRecs.back(); } + RecType* GetLastRecord() const + { return maRecs.empty() ? nullptr : maRecs.back().get(); } /** Inserts a record at the specified position into the list. */ - void InsertRecord( RecordRefType xRec, size_t nPos ) - { if( xRec.get() ) maRecs.insert( maRecs.begin() + ::std::min( nPos, maRecs.size() ), xRec ); } + void InsertRecord( RecType* pRec, size_t nPos ) + { assert(pRec); maRecs.insert( maRecs.begin() + ::std::min( nPos, maRecs.size() ), pRec ); } + void InsertRecord( RecordRefType pRec, size_t nPos ) + { assert(pRec); maRecs.insert( maRecs.begin() + ::std::min( nPos, maRecs.size() ), std::move(pRec) ); } /** Appends a record to the list. */ - void AppendRecord( RecordRefType xRec ) - { if( xRec.get() ) maRecs.push_back( xRec ); } + void AppendRecord( RecType* pRec ) + { if (pRec) maRecs.push_back( pRec ); } + void AppendRecord( const RecordRefType& xRec ) + { if (xRec) maRecs.push_back( xRec.get() ); } + void AppendRecord( RecordRefType xRec ) && + { if (xRec) maRecs.push_back( std::move(xRec) ); } /** Replaces the record at the specified position from the list with the passed record. */ - void ReplaceRecord( RecordRefType xRec, size_t nPos ) - { RemoveRecord( nPos ); InsertRecord( xRec, nPos ); } + void ReplaceRecord( RecType* pRec, size_t nPos ) + { if (pRec) maRecs[nPos] = pRec; else RemoveRecord( nPos ); } + void ReplaceRecord( RecordRefType const & xRec, size_t nPos ) + { ReplaceRecord(xRec.get(), nPos); } /** Appends a newly created record to the list. */ void AppendNewRecord( RecType* pRec ) - { if( pRec ) AppendRecord( RecordRefType( pRec ) ); } + { assert(pRec); maRecs.push_back( pRec ); } + void AppendNewRecord( RecordRefType const & xRec ) + { AppendNewRecord(xRec.get()); } + void AppendNewRecord( RecordRefType xRec ) && + { assert(xRec); maRecs.append(std::move(xRec)); } /** Removes the record at the specified position from the list. */ void RemoveRecord( size_t nPos ) - { if( nPos < maRecs.size() ) maRecs.erase( maRecs.begin() + nPos ); } + { maRecs.erase( maRecs.begin() + nPos ); } /** Removes all records from the list. */ void RemoveAllRecords() { maRecs.clear(); } diff --git a/sc/source/filter/inc/xeroot.hxx b/sc/source/filter/inc/xeroot.hxx index 34d44d752377..2d1a3e404e1c 100644 --- a/sc/source/filter/inc/xeroot.hxx +++ b/sc/source/filter/inc/xeroot.hxx @@ -23,6 +23,7 @@ #include "xlroot.hxx" #include <compiler.hxx> #include <memory> +#include <rtl/ref.hxx> // Forward declarations of objects in public use ============================== @@ -31,8 +32,8 @@ namespace com { namespace sun { namespace star { namespace beans { struct NamedV class XclExpRecordBase; class XclExpString; -typedef std::shared_ptr< XclExpRecordBase > XclExpRecordRef; -typedef std::shared_ptr< XclExpString > XclExpStringRef; +typedef rtl::Reference< XclExpRecordBase > XclExpRecordRef; +typedef std::shared_ptr< XclExpString > XclExpStringRef; // Global data ================================================================ @@ -63,17 +64,17 @@ struct XclExpRootData : public XclRootData typedef std::shared_ptr< XclExpFormulaCompiler > XclExpFmlaCompRef; typedef std::shared_ptr< XclExpProgressBar > XclExpProgressRef; - typedef std::shared_ptr< XclExpSst > XclExpSstRef; - typedef std::shared_ptr< XclExpPalette > XclExpPaletteRef; - typedef std::shared_ptr< XclExpFontBuffer > XclExpFontBfrRef; - typedef std::shared_ptr< XclExpNumFmtBuffer > XclExpNumFmtBfrRef; - typedef std::shared_ptr< XclExpXFBuffer > XclExpXFBfrRef; - typedef std::shared_ptr< XclExpNameManager > XclExpNameMgrRef; - typedef std::shared_ptr< XclExpLinkManager > XclExpLinkMgrRef; + typedef rtl::Reference< XclExpSst > XclExpSstRef; + typedef rtl::Reference< XclExpPalette > XclExpPaletteRef; + typedef rtl::Reference< XclExpFontBuffer > XclExpFontBfrRef; + typedef rtl::Reference< XclExpNumFmtBuffer > XclExpNumFmtBfrRef; + typedef rtl::Reference< XclExpXFBuffer > XclExpXFBfrRef; + typedef rtl::Reference< XclExpNameManager > XclExpNameMgrRef; + typedef rtl::Reference< XclExpLinkManager > XclExpLinkMgrRef; typedef std::shared_ptr< XclExpObjectManager > XclExpObjectMgrRef; typedef std::shared_ptr< XclExpFilterManager > XclExpFilterMgrRef; typedef std::shared_ptr< XclExpPivotTableManager > XclExpPTableMgrRef; - typedef std::shared_ptr< XclExpDxfs > XclExpDxfsRef; + typedef rtl::Reference< XclExpDxfs > XclExpDxfsRef; XclExpTabInfoRef mxTabInfo; /// Calc->Excel sheet index conversion. XclExpAddrConvRef mxAddrConv; /// The address converter. diff --git a/sc/source/filter/inc/xetable.hxx b/sc/source/filter/inc/xetable.hxx index 2c4a820014f4..50b4d248ab5b 100644 --- a/sc/source/filter/inc/xetable.hxx +++ b/sc/source/filter/inc/xetable.hxx @@ -91,7 +91,7 @@ protected: XclAddress maBaseXclPos; /// Address of base cell (first FORMULA record). }; -typedef std::shared_ptr< XclExpRangeFmlaBase > XclExpRangeFmlaRef; +typedef rtl::Reference< XclExpRangeFmlaBase > XclExpRangeFmlaRef; // Array formulas ============================================================= @@ -121,7 +121,7 @@ private: XclTokenArrayRef mxTokArr; /// The token array of a matrix formula. }; -typedef std::shared_ptr< XclExpArray > XclExpArrayRef; +typedef rtl::Reference< XclExpArray > XclExpArrayRef; /** Caches all ARRAY records. */ class XclExpArrayBuffer : protected XclExpRoot @@ -170,7 +170,7 @@ private: sal_uInt8 mnUsedCount; /// Number of FORMULA records referring to this record. }; -typedef std::shared_ptr< XclExpShrfmla > XclExpShrfmlaRef; +typedef rtl::Reference< XclExpShrfmla > XclExpShrfmlaRef; /** Caches all SHRFMLA records and provides functions to update their ranges. */ class XclExpShrfmlaBuffer : protected XclExpRoot @@ -241,7 +241,7 @@ private: bool mbValid; /// true = Contains valid references. }; -typedef std::shared_ptr< XclExpTableop > XclExpTableopRef; +typedef rtl::Reference< XclExpTableop > XclExpTableopRef; /** Contains all created TABLEOP records and supports creating or updating them. */ class XclExpTableopBuffer : protected XclExpRoot @@ -311,7 +311,7 @@ private: XclAddress maXclPos; /// Address of the cell. }; -typedef std::shared_ptr< XclExpCellBase > XclExpCellRef; +typedef rtl::Reference< XclExpCellBase > XclExpCellRef; // Single cell records ======================================================== @@ -994,12 +994,12 @@ private: typedef XclExpRecordList< XclExpNote > XclExpNoteList; typedef XclExpRecordList< XclExpHyperlink > XclExpHyperlinkList; - typedef std::shared_ptr< XclExpDefrowheight > XclExpDefrowhRef; - typedef std::shared_ptr< XclExpNoteList > XclExpNoteListRef; - typedef std::shared_ptr< XclExpMergedcells > XclExpMergedcellsRef; - typedef std::shared_ptr< XclExpHyperlinkList > XclExpHyperlinkRef; - typedef std::shared_ptr< XclExpDval > XclExpDvalRef; - typedef std::shared_ptr< XclExtLst > XclExtLstRef; + typedef rtl::Reference< XclExpDefrowheight > XclExpDefrowhRef; + typedef rtl::Reference< XclExpNoteList > XclExpNoteListRef; + typedef rtl::Reference< XclExpMergedcells > XclExpMergedcellsRef; + typedef rtl::Reference< XclExpHyperlinkList > XclExpHyperlinkRef; + typedef rtl::Reference< XclExpDval > XclExpDvalRef; + typedef rtl::Reference< XclExtLst > XclExtLstRef; XclExpColinfoBuffer maColInfoBfr; /// Buffer for column formatting. XclExpRowBuffer maRowBfr; /// Rows and cell records. diff --git a/sc/source/filter/inc/xichart.hxx b/sc/source/filter/inc/xichart.hxx index 5a686ca4e7e9..133f2c5a8466 100644 --- a/sc/source/filter/inc/xichart.hxx +++ b/sc/source/filter/inc/xichart.hxx @@ -20,6 +20,7 @@ #ifndef INCLUDED_SC_SOURCE_FILTER_INC_XICHART_HXX #define INCLUDED_SC_SOURCE_FILTER_INC_XICHART_HXX +#include <salhelper/simplereferenceobject.hxx> #include <set> #include <map> #include <memory> @@ -220,7 +221,7 @@ private: typedef std::shared_ptr< XclImpChFramePos > XclImpChFramePosRef; /** The CHLINEFORMAT record containing line formatting data. */ -class XclImpChLineFormat +class XclImpChLineFormat : public salhelper::SimpleReferenceObject { public: /** Creates a new line format object with automatic formatting. */ @@ -228,6 +229,16 @@ public: /** Creates a new line format object with the passed formatting. */ explicit XclImpChLineFormat( const XclChLineFormat& rLineFmt ) : maData( rLineFmt ) {} + // this class is stored both ref-counted and by value + XclImpChLineFormat(XclImpChLineFormat const & rOther) + : salhelper::SimpleReferenceObject(), maData(rOther.maData) {} + XclImpChLineFormat(XclImpChLineFormat && rOther) + : salhelper::SimpleReferenceObject(), maData(std::move(rOther.maData)) {} + XclImpChLineFormat& operator=(XclImpChLineFormat const & rOther) + { maData = rOther.maData; return *this; } + XclImpChLineFormat& operator=(XclImpChLineFormat && rOther) noexcept + { maData = std::move(rOther.maData); return *this; } + /** Reads the CHLINEFORMAT record (basic line properties). */ void ReadChLineFormat( XclImpStream& rStrm ); @@ -249,7 +260,7 @@ private: XclChLineFormat maData; /// Contents of the CHLINEFORMAT record. }; -typedef std::shared_ptr< XclImpChLineFormat > XclImpChLineFormatRef; +typedef rtl::Reference< XclImpChLineFormat > XclImpChLineFormatRef; /** The CHAREAFORMAT record containing simple area formatting data (solid or patterns). */ class XclImpChAreaFormat |