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/excel/xecontent.cxx | |
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/excel/xecontent.cxx')
-rw-r--r-- | sc/source/filter/excel/xecontent.cxx | 34 |
1 files changed, 16 insertions, 18 deletions
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 |