diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-07 14:17:38 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-03-10 19:22:01 +0100 |
commit | 6529cd54c29c5800340530a1b8182c341fbeeafb (patch) | |
tree | 2b09ee9429a0759b8104575aa97e1f4aeadd443e /sc/source/filter | |
parent | 4ea605cb5c31fe4c7d3931a656782a652b4d96fc (diff) |
don't use heap for elements in ScRangeList
no need to store small objects like this out of line.
Also
- add move constructor and move assignment operator
- drop Assign method since it now has the same
signature as push_back
Change-Id: I9a8647d3a11f24166a83d399a358a2bce3b2cb79
Reviewed-on: https://gerrit.libreoffice.org/50899
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source/filter')
27 files changed, 101 insertions, 107 deletions
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx index 499c315baf26..b7c7afab7ba6 100644 --- a/sc/source/filter/excel/excform.cxx +++ b/sc/source/filter/excel/excform.cxx @@ -1423,7 +1423,7 @@ void ExcelToSc::GetAbsRefs( ScRangeList& rRangeList, XclImpStream& rStrm, std::s nRow1 &= 0x3FFF; nRow2 &= 0x3FFF; if( GetAddressConverter().ConvertRange( aScRange, XclRange( nCol1, nRow1, nCol2, nRow2 ), nTab1, nTab2, true ) ) - rRangeList.Append( aScRange ); + rRangeList.push_back( aScRange ); } break; diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx index ccd2211a275e..515e89ca2c53 100644 --- a/sc/source/filter/excel/excform8.cxx +++ b/sc/source/filter/excel/excform8.cxx @@ -1580,7 +1580,7 @@ void ExcelToSc8::GetAbsRefs( ScRangeList& r, XclImpStream& aIn, std::size_t nLen nCol1 &= 0x3FFF; nCol2 &= 0x3FFF; if( GetAddressConverter().ConvertRange( aScRange, XclRange( nCol1, nRow1, nCol2, nRow2 ), nTab1, nTab2, true ) ) - r.Append( aScRange ); + r.push_back( aScRange ); } break; case 0x1C: // Error Value [314 266] diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 7eb0f6854530..473200a13c5a 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -258,7 +258,7 @@ void XclExpMergedcells::AppendRange( const ScRange& rRange, sal_uInt32 nBaseXFId { if( GetBiff() == EXC_BIFF8 ) { - maMergedRanges.Append( rRange ); + maMergedRanges.push_back( rRange ); maBaseXFIds.push_back( nBaseXFId ); } } @@ -270,8 +270,8 @@ sal_uInt32 XclExpMergedcells::GetBaseXFId( const ScAddress& rPos ) const ScRangeList& rNCRanges = const_cast< ScRangeList& >( maMergedRanges ); for ( size_t i = 0, nRanges = rNCRanges.size(); i < nRanges; ++i, ++aIt ) { - const ScRange* pScRange = rNCRanges[ i ]; - if( pScRange->In( rPos ) ) + const ScRange & rScRange = rNCRanges[ i ]; + if( rScRange.In( rPos ) ) return *aIt; } return EXC_XFID_NOTFOUND; @@ -308,12 +308,10 @@ void XclExpMergedcells::SaveXml( XclExpXmlStream& rStrm ) FSEND ); for( size_t i = 0; i < nCount; ++i ) { - if( const ScRange* pRange = maMergedRanges[ i ] ) - { - rWorksheet->singleElement( XML_mergeCell, - XML_ref, XclXmlUtils::ToOString( *pRange ).getStr(), + const ScRange & rRange = maMergedRanges[ i ]; + rWorksheet->singleElement( XML_mergeCell, + XML_ref, XclXmlUtils::ToOString( rRange ).getStr(), FSEND ); - } } rWorksheet->endElement( XML_mergeCells ); } @@ -540,9 +538,9 @@ XclExpLabelranges::XclExpLabelranges( const XclExpRoot& rRoot ) : // row labels only over 1 column (restriction of Excel97/2000/XP) for ( size_t i = 0, nRanges = maRowRanges.size(); i < nRanges; ++i ) { - ScRange* pScRange = maRowRanges[ i ]; - if( pScRange->aStart.Col() != pScRange->aEnd.Col() ) - pScRange->aEnd.SetCol( pScRange->aStart.Col() ); + ScRange & rScRange = maRowRanges[ i ]; + if( rScRange.aStart.Col() != rScRange.aEnd.Col() ) + rScRange.aEnd.SetCol( rScRange.aStart.Col() ); } // col label ranges FillRangeList( maColRanges, rRoot.GetDoc().GetColNameRangesRef(), nScTab ); @@ -556,7 +554,7 @@ void XclExpLabelranges::FillRangeList( ScRangeList& rScRanges, ScRangePair* pRangePair = (*xLabelRangesRef)[i]; const ScRange& rScRange = pRangePair->GetRange( 0 ); if( rScRange.aStart.Tab() == nScTab ) - rScRanges.Append( rScRange ); + rScRanges.push_back( rScRange ); } } @@ -1345,8 +1343,8 @@ XclExpColorScale::XclExpColorScale( const XclExpRoot& rRoot, const ScColorScaleF XclExpRoot( rRoot ), mnPriority( nPriority ) { - const ScRange* pRange = rFormat.GetRange().front(); - ScAddress aAddr = pRange->aStart; + const ScRange & rRange = rFormat.GetRange().front(); + ScAddress aAddr = rRange.aStart; for(ScColorScaleEntries::const_iterator itr = rFormat.begin(); itr != rFormat.end(); ++itr) { @@ -1385,8 +1383,8 @@ XclExpDataBar::XclExpDataBar( const XclExpRoot& rRoot, const ScDataBarFormat& rF mnPriority( nPriority ), maGUID(rGUID) { - const ScRange* pRange = rFormat.GetRange().front(); - ScAddress aAddr = pRange->aStart; + const ScRange & rRange = rFormat.GetRange().front(); + ScAddress aAddr = rRange.aStart; // exact position is not important, we allow only absolute refs mpCfvoLowerLimit.reset( new XclExpCfvo( GetRoot(), *mrFormat.GetDataBarData()->mpLowerLimit.get(), aAddr, true ) ); mpCfvoUpperLimit.reset( new XclExpCfvo( GetRoot(), *mrFormat.GetDataBarData()->mpUpperLimit.get(), aAddr, false ) ); @@ -1438,8 +1436,8 @@ XclExpIconSet::XclExpIconSet( const XclExpRoot& rRoot, const ScIconSetFormat& rF mrFormat( rFormat ), mnPriority( nPriority ) { - const ScRange* pRange = rFormat.GetRange().front(); - ScAddress aAddr = pRange->aStart; + const ScRange & rRange = rFormat.GetRange().front(); + ScAddress aAddr = rRange.aStart; for (auto const& itr : rFormat) { // exact position is not important, we allow only absolute refs diff --git a/sc/source/filter/excel/xeextlst.cxx b/sc/source/filter/excel/xeextlst.cxx index 52d90b14867e..0fa28198e2e2 100644 --- a/sc/source/filter/excel/xeextlst.cxx +++ b/sc/source/filter/excel/xeextlst.cxx @@ -308,7 +308,7 @@ XclExpExtConditionalFormatting::XclExpExtConditionalFormatting( const XclExpRoot XclExpRoot(rRoot), maRange(rRange) { - ScAddress aAddr = maRange.front()->aStart; + ScAddress aAddr = maRange.front().aStart; for (auto itr = rData.begin(), itrEnd = rData.end(); itr != itrEnd; ++itr) { const ScFormatEntry* pEntry = itr->pEntry; diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx index dab92a0ba6a9..3cd1bd9a06bf 100644 --- a/sc/source/filter/excel/xeformula.cxx +++ b/sc/source/filter/excel/xeformula.cxx @@ -2630,7 +2630,7 @@ XclTokenArrayRef XclExpFormulaCompiler::CreateFormula( XclFormulaType eType, con { if( nIdx > 0 ) aScTokArr.AddOpCode( ocUnion ); - lclPutRangeToTokenArray( aScTokArr, *rScRanges[ nIdx ], nCurrScTab, b3DRefOnly ); + lclPutRangeToTokenArray( aScTokArr, rScRanges[ nIdx ], nCurrScTab, b3DRefOnly ); } return mxImpl->CreateFormula( eType, aScTokArr ); } diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx index d9f7e3806e28..0d9d7b473462 100644 --- a/sc/source/filter/excel/xehelper.cxx +++ b/sc/source/filter/excel/xehelper.cxx @@ -250,8 +250,8 @@ void XclExpAddressConverter::ValidateRangeList( ScRangeList& rScRanges, bool bWa { for ( size_t nRange = rScRanges.size(); nRange > 0; ) { - ScRange* pScRange = rScRanges[ --nRange ]; - if( !CheckRange( *pScRange, bWarn ) ) + ScRange & rScRange = rScRanges[ --nRange ]; + if( !CheckRange( rScRange, bWarn ) ) rScRanges.Remove(nRange); } } @@ -262,12 +262,10 @@ void XclExpAddressConverter::ConvertRangeList( XclRangeList& rXclRanges, rXclRanges.clear(); for( size_t nPos = 0, nCount = rScRanges.size(); nPos < nCount; ++nPos ) { - if( const ScRange* pScRange = rScRanges[ nPos ] ) - { - XclRange aXclRange( ScAddress::UNINITIALIZED ); - if( ConvertRange( aXclRange, *pScRange, bWarn ) ) - rXclRanges.push_back( aXclRange ); - } + const ScRange & rScRange = rScRanges[ nPos ]; + XclRange aXclRange( ScAddress::UNINITIALIZED ); + if( ConvertRange( aXclRange, rScRange, bWarn ) ) + rXclRanges.push_back( aXclRange ); } } diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx index 7b315d195476..d0f957924a99 100644 --- a/sc/source/filter/excel/xename.cxx +++ b/sc/source/filter/excel/xename.cxx @@ -602,7 +602,7 @@ void XclExpNameManagerImpl::CreateBuiltInNames() aRange.aStart.SetTab( nScTab ); aRange.aEnd.SetTab( nScTab ); aRange.PutInOrder(); - aRangeList.Append( aRange ); + aRangeList.push_back( aRange ); } // create the NAME record (do not warn if ranges are shrunken) GetAddressConverter().ValidateRangeList( aRangeList, false ); @@ -615,12 +615,12 @@ void XclExpNameManagerImpl::CreateBuiltInNames() ScRangeList aTitleList; // repeated columns if( const ScRange* pColRange = rDoc.GetRepeatColRange( nScTab ) ) - aTitleList.Append( ScRange( + aTitleList.push_back( ScRange( pColRange->aStart.Col(), 0, nScTab, pColRange->aEnd.Col(), GetXclMaxPos().Row(), nScTab ) ); // repeated rows if( const ScRange* pRowRange = rDoc.GetRepeatRowRange( nScTab ) ) - aTitleList.Append( ScRange( + aTitleList.push_back( ScRange( 0, pRowRange->aStart.Row(), nScTab, GetXclMaxPos().Col(), pRowRange->aEnd.Row(), nScTab ) ); // create the NAME record @@ -695,7 +695,7 @@ sal_uInt16 XclExpNameManager::InsertBuiltInName( sal_Unicode cBuiltIn, const ScR if( !rRangeList.empty() ) { XclTokenArrayRef xTokArr = GetFormulaCompiler().CreateFormula( EXC_FMLATYPE_NAME, rRangeList ); - nNameIdx = mxImpl->InsertBuiltInName( cBuiltIn, xTokArr, rRangeList.front()->aStart.Tab(), rRangeList ); + nNameIdx = mxImpl->InsertBuiltInName( cBuiltIn, xTokArr, rRangeList.front().aStart.Tab(), rRangeList ); } return nNameIdx; } diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 537c494cde52..5a1c4a96df8a 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -778,7 +778,7 @@ OString XclXmlUtils::ToOString( const XclRangeList& rRanges ) for( XclRangeVector::const_iterator i = rRanges.begin(), end = rRanges.end(); i != end; ++i ) { - aRanges.Append( lcl_ToRange( *i ) ); + aRanges.push_back( lcl_ToRange( *i ) ); } return ToOString( aRanges ); } diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index 5c01b7e82c8c..91244a77bca1 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -448,7 +448,6 @@ void XclImpLabelranges::ReadLabelranges( XclImpStream& rStrm ) SCTAB nScTab = rRoot.GetCurrScTab(); XclImpAddressConverter& rAddrConv = rRoot.GetAddressConverter(); ScRangePairListRef xLabelRangesRef; - const ScRange* pScRange = nullptr; XclRangeList aRowXclRanges, aColXclRanges; rStrm >> aRowXclRanges >> aColXclRanges; @@ -459,8 +458,8 @@ void XclImpLabelranges::ReadLabelranges( XclImpStream& rStrm ) xLabelRangesRef = rDoc.GetRowNameRangesRef(); for ( size_t i = 0, nRanges = aRowScRanges.size(); i < nRanges; ++i ) { - pScRange = aRowScRanges[ i ]; - ScRange aDataRange( *pScRange ); + const ScRange & rScRange = aRowScRanges[ i ]; + ScRange aDataRange( rScRange ); if( aDataRange.aEnd.Col() < MAXCOL ) { aDataRange.aStart.SetCol( aDataRange.aEnd.Col() + 1 ); @@ -471,7 +470,7 @@ void XclImpLabelranges::ReadLabelranges( XclImpStream& rStrm ) aDataRange.aEnd.SetCol( aDataRange.aStart.Col() - 1 ); aDataRange.aStart.SetCol( 0 ); } - xLabelRangesRef->Append( ScRangePair( *pScRange, aDataRange ) ); + xLabelRangesRef->Append( ScRangePair( rScRange, aDataRange ) ); } // column label ranges @@ -481,8 +480,8 @@ void XclImpLabelranges::ReadLabelranges( XclImpStream& rStrm ) for ( size_t i = 0, nRanges = aColScRanges.size(); i < nRanges; ++i ) { - pScRange = aColScRanges[ i ]; - ScRange aDataRange( *pScRange ); + const ScRange & rScRange = aColScRanges[ i ]; + ScRange aDataRange( rScRange ); if( aDataRange.aEnd.Row() < MAXROW ) { aDataRange.aStart.SetRow( aDataRange.aEnd.Row() + 1 ); @@ -493,7 +492,7 @@ void XclImpLabelranges::ReadLabelranges( XclImpStream& rStrm ) aDataRange.aEnd.SetRow( aDataRange.aStart.Row() - 1 ); aDataRange.aStart.SetRow( 0 ); } - xLabelRangesRef->Append( ScRangePair( *pScRange, aDataRange ) ); + xLabelRangesRef->Append( ScRangePair( rScRange, aDataRange ) ); } } @@ -651,7 +650,7 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm ) // *** formulas *** - const ScAddress& rPos = maRanges.front()->aStart; // assured above that maRanges is not empty + const ScAddress& rPos = maRanges.front().aStart; // assured above that maRanges is not empty ExcelToSc& rFmlaConv = GetOldFmlaConverter(); ::std::unique_ptr< ScTokenArray > xTokArr1; @@ -690,7 +689,7 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm ) { mxScCondFmt.reset( new ScConditionalFormat( 0/*nKey*/, &GetDocRef() ) ); if(maRanges.size() > 1) - maRanges.Join(*maRanges[0], true); + maRanges.Join(maRanges[0], true); mxScCondFmt->SetRange(maRanges); } @@ -705,7 +704,7 @@ void XclImpCondFormat::Apply() { ScDocument& rDoc = GetDoc(); - SCTAB nTab = maRanges.front()->aStart.Tab(); + SCTAB nTab = maRanges.front().aStart.Tab(); sal_uLong nKey = rDoc.AddCondFormat( mxScCondFmt->Clone(), nTab ); rDoc.AddCondFormatData( maRanges, nTab, nKey ); @@ -888,7 +887,7 @@ void XclImpValidationManager::ReadDV( XclImpStream& rStrm ) return; // first range for base address for relative references - const ScRange& rScRange = *aScRanges.front(); // aScRanges is not empty + const ScRange& rScRange = aScRanges.front(); // aScRanges is not empty // process string list of a list validity (convert to list of string tokens) if( xTokArr1.get() && (eValMode == SC_VALID_LIST) && ::get_flag( nFlags, EXC_DV_STRINGLIST ) ) @@ -938,9 +937,9 @@ void XclImpValidationManager::Apply() // apply all ranges for ( size_t i = 0, nRanges = rItem.maRanges.size(); i < nRanges; ++i ) { - const ScRange* pScRange = rItem.maRanges[ i ]; - rDoc.ApplyPatternAreaTab( pScRange->aStart.Col(), pScRange->aStart.Row(), - pScRange->aEnd.Col(), pScRange->aEnd.Row(), pScRange->aStart.Tab(), aPattern ); + const ScRange & rScRange = rItem.maRanges[ i ]; + rDoc.ApplyPatternAreaTab( rScRange.aStart.Col(), rScRange.aStart.Row(), + rScRange.aEnd.Col(), rScRange.aEnd.Row(), rScRange.aStart.Tab(), aPattern ); } } maDVItems.clear(); diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index f38c13f75ca0..94b2d0130d0b 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -1927,8 +1927,8 @@ void XclImpControlHelper::ReadCellLinkFormula( XclImpStream& rStrm, bool bWithBo // Use first cell of first range if ( !aScRanges.empty() ) { - const ScRange* pScRange = aScRanges.front(); - mxCellLink.reset( new ScAddress( pScRange->aStart ) ); + const ScRange & rScRange = aScRanges.front(); + mxCellLink.reset( new ScAddress( rScRange.aStart ) ); } } @@ -1939,8 +1939,8 @@ void XclImpControlHelper::ReadSourceRangeFormula( XclImpStream& rStrm, bool bWit // Use first range if ( !aScRanges.empty() ) { - const ScRange* pScRange = aScRanges.front(); - mxSrcRange.reset( new ScRange( *pScRange ) ); + const ScRange & rScRange = aScRanges.front(); + mxSrcRange.reset( new ScRange( rScRange ) ); } } diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx index 3633a01a32eb..c2b65d12745d 100644 --- a/sc/source/filter/excel/xihelper.cxx +++ b/sc/source/filter/excel/xihelper.cxx @@ -131,7 +131,7 @@ void XclImpAddressConverter::ConvertRangeList( ScRangeList& rScRanges, { ScRange aScRange( ScAddress::UNINITIALIZED ); if( ConvertRange( aScRange, *aIt, nScTab, nScTab, bWarn ) ) - rScRanges.Append( aScRange ); + rScRanges.push_back( aScRange ); } } diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index 1059f886d38b..75100c81b557 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -1905,11 +1905,11 @@ void XclImpXFRangeBuffer::SetXF( const ScAddress& rScPos, sal_uInt16 nXFIndex, X if( pXF && ((pXF->GetHorAlign() == EXC_XF_HOR_CENTER_AS) || (pXF->GetHorAlign() == EXC_XF_HOR_FILL)) ) { // expand last merged range if this attribute is set repeatedly - ScRange* pRange = maMergeList.empty() ? nullptr : maMergeList.back(); + ScRange* pRange = maMergeList.empty() ? nullptr : &maMergeList.back(); if (pRange && (pRange->aEnd.Row() == nScRow) && (pRange->aEnd.Col() + 1 == nScCol) && (eMode == xlXFModeBlank)) pRange->aEnd.IncCol(); else if( eMode != xlXFModeBlank ) // do not merge empty cells - maMergeList.Append( ScRange( nScCol, nScRow, 0 ) ); + maMergeList.push_back( ScRange( nScCol, nScRow, 0 ) ); } } } @@ -1970,7 +1970,7 @@ void XclImpXFRangeBuffer::SetHyperlink( const XclRange& rXclRange, const OUStrin void XclImpXFRangeBuffer::SetMerge( SCCOL nScCol1, SCROW nScRow1, SCCOL nScCol2, SCROW nScRow2 ) { if( (nScCol1 < nScCol2) || (nScRow1 < nScRow2) ) - maMergeList.Append( ScRange( nScCol1, nScRow1, 0, nScCol2, nScRow2, 0 ) ); + maMergeList.push_back( ScRange( nScCol1, nScRow1, 0, nScCol2, nScRow2, 0 ) ); } void XclImpXFRangeBuffer::Finalize() @@ -2029,17 +2029,17 @@ void XclImpXFRangeBuffer::Finalize() // apply cell merging for ( size_t i = 0, nRange = maMergeList.size(); i < nRange; ++i ) { - const ScRange* pRange = maMergeList[ i ]; - const ScAddress& rStart = pRange->aStart; - const ScAddress& rEnd = pRange->aEnd; + const ScRange & rRange = maMergeList[ i ]; + const ScAddress& rStart = rRange.aStart; + const ScAddress& rEnd = rRange.aEnd; bool bMultiCol = rStart.Col() != rEnd.Col(); bool bMultiRow = rStart.Row() != rEnd.Row(); // set correct right border if( bMultiCol ) - SetBorderLine( *pRange, nScTab, SvxBoxItemLine::RIGHT ); + SetBorderLine( rRange, nScTab, SvxBoxItemLine::RIGHT ); // set correct lower border if( bMultiRow ) - SetBorderLine( *pRange, nScTab, SvxBoxItemLine::BOTTOM ); + SetBorderLine( rRange, nScTab, SvxBoxItemLine::BOTTOM ); // do merge if( bMultiCol || bMultiRow ) rDoc.getDoc().DoMerge( nScTab, rStart.Col(), rStart.Row(), rEnd.Col(), rEnd.Row() ); diff --git a/sc/source/filter/html/htmlimp.cxx b/sc/source/filter/html/htmlimp.cxx index 40655830d47e..a5f1f11abe4b 100644 --- a/sc/source/filter/html/htmlimp.cxx +++ b/sc/source/filter/html/htmlimp.cxx @@ -221,7 +221,7 @@ OUString ScHTMLImport::GetHTMLRangeNameList( const ScDocument* pDoc, const OUStr if( pRangeData->IsReference( aRange ) && !aRangeList.In( aRange ) ) { aNewName = ScGlobal::addToken(aNewName, aToken, ';'); - aRangeList.Append( aRange ); + aRangeList.push_back( aRange ); } } else diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index fd596fbcf173..e53eec4d04fe 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -445,10 +445,10 @@ void ScHTMLLayoutParser::SkipLocked( ScEEParseEntry* pE, bool bJoin ) bAgain = false; for ( size_t i = 0, nRanges = xLockedList->size(); i < nRanges; ++i ) { - ScRange* pR = (*xLockedList)[i]; - if ( pR->Intersects( aRange ) ) + ScRange & rR = (*xLockedList)[i]; + if ( rR.Intersects( aRange ) ) { - pE->nCol = pR->aEnd.Col() + 1; + pE->nCol = rR.aEnd.Col() + 1; SCCOL nTmp = pE->nCol + pE->nColOverlap - 1; if ( pE->nCol > MAXCOL || nTmp > MAXCOL ) bBadCol = true; @@ -2428,7 +2428,7 @@ void ScHTMLTable::InsertNewCell( const ScHTMLSize& rSpanSize ) } if( rSpanSize.mnRows > 1 ) { - maVMergedCells.Append( aNewRange ); + maVMergedCells.push_back( aNewRange ); /* Do not insert vertically merged ranges into maUsedCells yet, because they may be shrunken (see above). The final vertically merged ranges are inserted in FillEmptyCells(). */ @@ -2436,7 +2436,7 @@ void ScHTMLTable::InsertNewCell( const ScHTMLSize& rSpanSize ) else { if( rSpanSize.mnCols > 1 ) - maHMergedCells.Append( aNewRange ); + maHMergedCells.push_back( aNewRange ); /* Insert horizontally merged ranges and single cells into maUsedCells, they will not be changed anymore. */ maUsedCells.Join( aNewRange ); @@ -2589,8 +2589,8 @@ void ScHTMLTable::FillEmptyCells() // insert the final vertically merged ranges into maUsedCells for ( size_t i = 0, nRanges = maVMergedCells.size(); i < nRanges; ++i ) { - ScRange* pRange = maVMergedCells[ i ]; - maUsedCells.Join( *pRange ); + ScRange & rRange = maVMergedCells[ i ]; + maUsedCells.Join( rRange ); } for( ScAddress aAddr; aAddr.Row() < maSize.mnRows; aAddr.IncRow() ) diff --git a/sc/source/filter/oox/addressconverter.cxx b/sc/source/filter/oox/addressconverter.cxx index 9f77412e3c7d..987cef40c99c 100644 --- a/sc/source/filter/oox/addressconverter.cxx +++ b/sc/source/filter/oox/addressconverter.cxx @@ -421,7 +421,7 @@ bool AddressConverter::convertToCellRange( ScRange& orRange, void AddressConverter::validateCellRangeList( ScRangeList& orRanges, bool bTrackOverflow ) { for( size_t nIndex = orRanges.size(); nIndex > 0; --nIndex ) - if( !validateCellRange( *orRanges[ nIndex - 1 ], true, bTrackOverflow ) ) + if( !validateCellRange( orRanges[ nIndex - 1 ], true, bTrackOverflow ) ) orRanges.Remove( nIndex - 1 ); } @@ -435,7 +435,7 @@ void AddressConverter::convertToCellRangeList( ScRangeList& orRanges, { OUString aToken = rString.getToken( 0, ' ', nPos ); if( !aToken.isEmpty() && convertToCellRange( aRange, aToken, nSheet, true, bTrackOverflow ) ) - orRanges.Append(aRange); + orRanges.push_back(aRange); } } @@ -445,7 +445,7 @@ void AddressConverter::convertToCellRangeList( ScRangeList& orRanges, ScRange aRange; for( ::std::vector< BinRange >::const_iterator aIt = rBinRanges.begin(), aEnd = rBinRanges.end(); aIt != aEnd; ++aIt ) if( convertToCellRange( aRange, *aIt, nSheet, true, bTrackOverflow ) ) - orRanges.Append( aRange ); + orRanges.push_back( aRange ); } Sequence<CellRangeAddress> AddressConverter::toApiSequence(const ScRangeList& orRanges) @@ -455,7 +455,7 @@ Sequence<CellRangeAddress> AddressConverter::toApiSequence(const ScRangeList& or CellRangeAddress* pApiRanges = aRangeSequence.getArray(); for (size_t i = 0; i < nSize; ++i) { - ScUnoConversion::FillApiRange(pApiRanges[i], *orRanges[i]); + ScUnoConversion::FillApiRange(pApiRanges[i], orRanges[i]); } return aRangeSequence; } diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx index 175b4a43798e..22f2445aa33c 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -1117,7 +1117,7 @@ void CondFormatBuffer::finalizeImport() ScDocument* pDoc = &getScDocument(); const ScRangeList& rRange = (*itr)->getRange(); - SCTAB nTab = rRange.front()->aStart.Tab(); + SCTAB nTab = rRange.front().aStart.Tab(); ScConditionalFormat* pFormat = findFormatByRange(rRange, pDoc, nTab); if (!pFormat) { diff --git a/sc/source/filter/oox/defnamesbuffer.cxx b/sc/source/filter/oox/defnamesbuffer.cxx index 5b6adf58801b..84bba7249227 100644 --- a/sc/source/filter/oox/defnamesbuffer.cxx +++ b/sc/source/filter/oox/defnamesbuffer.cxx @@ -378,7 +378,7 @@ void DefinedName::convertFormula( const css::uno::Sequence<css::sheet::ExternalL const ScAddress& rMaxPos = getAddressConverter().getMaxAddress(); for (size_t i = 0, nSize = aTitleRanges.size(); i < nSize; ++i) { - const ScRange& rRange = *aTitleRanges[i]; + const ScRange& rRange = aTitleRanges[i]; bool bFullRow = (rRange.aStart.Col() == 0) && ( rRange.aEnd.Col() >= rMaxPos.Col() ); bool bFullCol = (rRange.aStart.Row() == 0) && ( rRange.aEnd.Row() >= rMaxPos.Row() ); if( !bHasRowTitles && bFullRow && !bFullCol ) diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx index b5b39510ed76..52fc82a73650 100644 --- a/sc/source/filter/oox/extlstcontext.cxx +++ b/sc/source/filter/oox/extlstcontext.cxx @@ -163,8 +163,8 @@ void ExtConditionalFormattingContext::onEndElement() SCTAB nTab = getSheetIndex(); for (size_t i = 0; i < aRange.size(); ++i) { - aRange[i]->aStart.SetTab(nTab); - aRange[i]->aEnd.SetTab(nTab); + aRange[i].aStart.SetTab(nTab); + aRange[i].aEnd.SetTab(nTab); } std::vector< std::unique_ptr<ExtCfCondFormat> >& rExtFormats = getCondFormats().importExtCondFormat(); diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx index 2cb2ae9d0ddc..476f0deba2cd 100644 --- a/sc/source/filter/oox/formulabase.cxx +++ b/sc/source/filter/oox/formulabase.cxx @@ -1499,7 +1499,7 @@ TokenToRangeListState lclProcessRef( ScRangeList& orRanges, const Any& rData, sa ScAddress aAddress; // ignore invalid addresses (with #REF! errors), but do not stop parsing if( lclConvertToCellAddress( aAddress, aSingleRef, nForbiddenFlags, nFilterBySheet ) ) - orRanges.Append( ScRange(aAddress, aAddress) ); + orRanges.push_back( ScRange(aAddress, aAddress) ); return STATE_REF; } ComplexReference aComplexRef; @@ -1508,7 +1508,7 @@ TokenToRangeListState lclProcessRef( ScRangeList& orRanges, const Any& rData, sa ScRange aRange; // ignore invalid ranges (with #REF! errors), but do not stop parsing if( lclConvertToCellRange( aRange, aComplexRef, nForbiddenFlags, nFilterBySheet ) ) - orRanges.Append( aRange ); + orRanges.push_back( aRange ); return STATE_REF; } return STATE_ERROR; @@ -1610,7 +1610,7 @@ bool FormulaProcessorBase::extractCellRange( ScRange& orRange, lclProcessRef( aRanges, extractReference( rTokens ), -1 ); if( !aRanges.empty() ) { - orRange = *aRanges.front(); + orRange = aRanges.front(); return true; } return false; diff --git a/sc/source/filter/oox/scenariobuffer.cxx b/sc/source/filter/oox/scenariobuffer.cxx index 33dd467472df..aaa00d9720d4 100644 --- a/sc/source/filter/oox/scenariobuffer.cxx +++ b/sc/source/filter/oox/scenariobuffer.cxx @@ -108,7 +108,7 @@ void Scenario::finalizeImport() ScRangeList aRanges; for( ScenarioCellVector::iterator aIt = maCells.begin(), aEnd = maCells.end(); aIt != aEnd; ++aIt ) if( !aIt->mbDeleted && rAddrConv.checkCellAddress( aIt->maPos, true ) ) - aRanges.Append( ScRange(aIt->maPos, aIt->maPos) ); + aRanges.push_back( ScRange(aIt->maPos, aIt->maPos) ); if( !aRanges.empty() && !maModel.maName.isEmpty() ) try { diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx index d9d98b84532d..cf44072cd9e3 100644 --- a/sc/source/filter/oox/sheetdatabuffer.cxx +++ b/sc/source/filter/oox/sheetdatabuffer.cxx @@ -336,7 +336,7 @@ void addIfNotInMyMap( const StylesBuffer& rStyles, std::map< FormatKeyPair, ScRa // add ranges from the rangelist to the existing rangelist for the // matching style ( should we check if they overlap ? ) for (size_t i = 0, nSize = rRangeList.size(); i < nSize; ++i) - it->second.Append(*rRangeList[i]); + it->second.push_back(rRangeList[i]); return; } } @@ -423,7 +423,7 @@ void SheetDataBuffer::finalizeImport() { const ScRangeList& rRanges( it->second ); for (size_t i = 0, nSize = rRanges.size(); i < nSize; ++i) - addColXfStyle( it->first.first, it->first.second, *rRanges[i]); + addColXfStyle( it->first.first, it->first.second, rRanges[i]); } for ( std::map< sal_Int32, std::vector< ValueRange > >::iterator it = maXfIdRowRangeList.begin(), it_end = maXfIdRowRangeList.end(); it != it_end; ++it ) @@ -660,7 +660,7 @@ void SheetDataBuffer::setCellFormat( const CellModel& rModel ) if( rModel.mnXfId >= 0 ) { ScRangeList& rRangeList = maXfIdRangeLists[ XfIdNumFmtKey( rModel.mnXfId, -1 ) ]; - ScRange* pLastRange = rRangeList.empty() ? nullptr : rRangeList.back(); + ScRange* pLastRange = rRangeList.empty() ? nullptr : &rRangeList.back(); /* The xlsx sheet data contains row wise information. * It is sufficient to check if the row range size is one */ @@ -674,28 +674,28 @@ void SheetDataBuffer::setCellFormat( const CellModel& rModel ) } else { - rRangeList.Append(ScRange(rModel.maCellAddr)); - pLastRange = rRangeList.back(); + rRangeList.push_back(ScRange(rModel.maCellAddr)); + pLastRange = &rRangeList.back(); } if (rRangeList.size() > 1) { for (size_t i = rRangeList.size() - 1; i != 0; --i) { - ScRange* pMergeRange = rRangeList[i - 1]; - if (pLastRange->aStart.Tab() != pMergeRange->aStart.Tab()) + ScRange& rMergeRange = rRangeList[i - 1]; + if (pLastRange->aStart.Tab() != rMergeRange.aStart.Tab()) break; /* Try to merge this with the previous range */ - if (pLastRange->aStart.Row() == (pMergeRange->aEnd.Row() + 1) && - pLastRange->aStart.Col() == pMergeRange->aStart.Col() && - pLastRange->aEnd.Col() == pMergeRange->aEnd.Col()) + if (pLastRange->aStart.Row() == (rMergeRange.aEnd.Row() + 1) && + pLastRange->aStart.Col() == rMergeRange.aStart.Col() && + pLastRange->aEnd.Col() == rMergeRange.aEnd.Col()) { - pMergeRange->aEnd.SetRow(pLastRange->aEnd.Row()); + rMergeRange.aEnd.SetRow(pLastRange->aEnd.Row()); rRangeList.Remove(rRangeList.size() - 1); break; } - else if (pLastRange->aStart.Row() > (pMergeRange->aEnd.Row() + 1)) + else if (pLastRange->aStart.Row() > (rMergeRange.aEnd.Row() + 1)) break; // Un-necessary to check with any other rows } } diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 7d5c910ff39d..a4ecfd8860fe 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1382,9 +1382,9 @@ ExcEScenario::ExcEScenario( const XclExpRoot& rRoot, SCTAB nTab ) for( size_t nRange = 0; (nRange < pRList->size()) && bContLoop; nRange++ ) { - const ScRange* pRange = (*pRList)[nRange]; - for( nRow = pRange->aStart.Row(); (nRow <= pRange->aEnd.Row()) && bContLoop; nRow++ ) - for( nCol = pRange->aStart.Col(); (nCol <= pRange->aEnd.Col()) && bContLoop; nCol++ ) + const ScRange & rRange = (*pRList)[nRange]; + for( nRow = rRange.aStart.Row(); (nRow <= rRange.aEnd.Row()) && bContLoop; nRow++ ) + for( nCol = rRange.aStart.Col(); (nCol <= rRange.aEnd.Col()) && bContLoop; nCol++ ) { if( rDoc.HasValueData( nCol, nRow, nTab ) ) { diff --git a/sc/source/filter/xml/xmlcondformat.cxx b/sc/source/filter/xml/xmlcondformat.cxx index 3db4904f99ca..6fdcdee9b5b8 100644 --- a/sc/source/filter/xml/xmlcondformat.cxx +++ b/sc/source/filter/xml/xmlcondformat.cxx @@ -264,7 +264,7 @@ void SAL_CALL ScXMLConditionalFormatContext::endFastElement( sal_Int32 /*nElemen // conditions could be loosened, but I am too tired to think on that right now.) if (pFormat->size() == 1 && pFormat->GetRange().size() == 1 && - pFormat->GetRange()[0]->aStart == aSrcPos && + pFormat->GetRange()[0].aStart == aSrcPos && HasOneSingleFullyRelativeReference( pTokens, aOffsetForSingleRelRef )) { bSingleRelativeReference = true; @@ -327,7 +327,7 @@ void SAL_CALL ScXMLConditionalFormatContext::endFastElement( sal_Int32 /*nElemen // Mark cache entry as fresh, do necessary mangling of it and just return aCacheEntry.mnAge = 0; for (size_t k = 0; k < pFormat->GetRange().size(); ++k) - aCacheEntry.mpFormat->GetRangeList().Join(*(pFormat->GetRange()[k])); + aCacheEntry.mpFormat->GetRangeList().Join(pFormat->GetRange()[k]); return; } } diff --git a/sc/source/filter/xml/xmlsceni.cxx b/sc/source/filter/xml/xmlsceni.cxx index 5a934b0cb222..ed3c8b0dd49b 100644 --- a/sc/source/filter/xml/xmlsceni.cxx +++ b/sc/source/filter/xml/xmlsceni.cxx @@ -114,10 +114,9 @@ void SAL_CALL ScXMLTableScenarioContext::endFastElement( sal_Int32 /*nElement*/ pDoc->SetScenarioData( nCurrTable, sComment, aBorderColor, nFlags ); for( size_t i = 0; i < aScenarioRanges.size(); ++i ) { - ScRange* pRange(aScenarioRanges[ i ]); - if( pRange ) - pDoc->ApplyFlagsTab( pRange->aStart.Col(), pRange->aStart.Row(), - pRange->aEnd.Col(), pRange->aEnd.Row(), nCurrTable, ScMF::Scenario ); + ScRange const & rRange = aScenarioRanges[ i ]; + pDoc->ApplyFlagsTab( rRange.aStart.Col(), rRange.aStart.Row(), + rRange.aEnd.Col(), rRange.aEnd.Row(), nCurrTable, ScMF::Scenario ); } pDoc->SetActiveScenario( nCurrTable, bIsActive ); } diff --git a/sc/source/filter/xml/xmlstyli.cxx b/sc/source/filter/xml/xmlstyli.cxx index 0970b1a15be3..5087bf0591b9 100644 --- a/sc/source/filter/xml/xmlstyli.cxx +++ b/sc/source/filter/xml/xmlstyli.cxx @@ -511,8 +511,8 @@ void XMLTableStyleContext::ApplyCondFormat( const uno::Sequence<table::CellRange size_t n = aRangeList.size(); for(size_t i = 0; i < n; ++i) { - const ScRange* pRange = aRangeList[i]; - rRangeList.Join(*pRange); + const ScRange & rRange = aRangeList[i]; + rRangeList.Join(rRange); } pDoc->AddCondFormatData( aRangeList, nTab, nCondId ); diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx index a71d38ed263e..520d484c28a9 100644 --- a/sc/source/filter/xml/xmlsubti.cxx +++ b/sc/source/filter/xml/xmlsubti.cxx @@ -275,7 +275,7 @@ void ScMyTables::AddMatrixRange( nEndColumn, nEndRow, maCurrentCellPos.Tab() ); - maMatrixRangeList.Append(aScRange); + maMatrixRangeList.push_back(aScRange); ScDocumentImport& rDoc = rImport.GetDoc(); ScTokenArray aCode; diff --git a/sc/source/filter/xml/xmltabi.cxx b/sc/source/filter/xml/xmltabi.cxx index 6cfa897a78ba..82e8c9010aac 100644 --- a/sc/source/filter/xml/xmltabi.cxx +++ b/sc/source/filter/xml/xmltabi.cxx @@ -368,7 +368,7 @@ void SAL_CALL ScXMLTableContext::endFastElement(sal_Int32 /*nElement*/) size_t nCount = aRangeList.size(); for (size_t i=0; i< nCount; i++ ) { - pDoc->AddPrintRange( nCurTab, *aRangeList[i] ); + pDoc->AddPrintRange( nCurTab, aRangeList[i] ); } } else if (!bPrintEntireSheet) |