sc/source/filter/excel/xistyle.cxx | 11 +++---- sc/source/filter/html/htmlpars.cxx | 48 +++++++++++++++---------------- sc/source/filter/inc/htmlpars.hxx | 9 ++--- sc/source/filter/inc/sheetdatabuffer.hxx | 16 +++++----- sc/source/filter/inc/xistyle.hxx | 8 ++--- sc/source/filter/oox/sheetdatabuffer.cxx | 8 ++--- 6 files changed, 49 insertions(+), 51 deletions(-)
New commits: commit d3503650d048dbd4b0c28010520d01479d1aabf1 Author: Julien Nabet <serval2...@yahoo.fr> Date: Wed Sep 13 21:15:47 2017 +0200 Replace some lists by vectors (sc/filter) Change-Id: Id5e5702045ef597db9ad1a44f99624152128f7a9 Reviewed-on: https://gerrit.libreoffice.org/42257 Reviewed-by: Julien Nabet <serval2...@yahoo.fr> Tested-by: Julien Nabet <serval2...@yahoo.fr> diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index 79df922b42a6..452e6b36b9a5 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -62,13 +62,13 @@ #include <svl/poolcach.hxx> #include <o3tl/make_unique.hxx> -#include <list> +#include <vector> #include <cppuhelper/implbase.hxx> #include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/beans/XPropertySet.hpp> -using ::std::list; +using ::std::vector; using namespace ::com::sun::star; typedef ::cppu::WeakImplHelper< container::XIndexAccess > XIndexAccess_BASE; @@ -1323,7 +1323,7 @@ const ScPatternAttr& XclImpXF::CreatePattern( bool bSkipPoolDefs ) return *mpPattern; } -void XclImpXF::ApplyPatternToAttrList( +void XclImpXF::ApplyPatternToAttrVector( std::vector<ScAttrEntry>& rAttrs, SCROW nRow1, SCROW nRow2, sal_uInt32 nForceScNumFmt) { // force creation of cell style and hard formatting, do it here to have mpStyleSheet @@ -2002,7 +2002,7 @@ void XclImpXFRangeBuffer::Finalize() sal_uInt32 nForceScNumFmt = rXFIndex.IsBoolCell() ? GetNumFmtBuffer().GetStdScNumFmt() : NUMBERFORMAT_ENTRY_NOT_FOUND; - pXF->ApplyPatternToAttrList(aAttrs, rStyle.mnScRow1, rStyle.mnScRow2, nForceScNumFmt); + pXF->ApplyPatternToAttrVector(aAttrs, rStyle.mnScRow1, rStyle.mnScRow2, nForceScNumFmt); } if (aAttrs.empty() || aAttrs.back().nEndRow != MAXROW) @@ -2018,13 +2018,12 @@ void XclImpXFRangeBuffer::Finalize() ScDocumentImport::Attrs aAttrParam; aAttrParam.mvData.swap(aAttrs); aAttrParam.mbLatinNumFmtOnly = false; // when unsure, set it to false. - rDoc.setAttrEntries(nScTab, nScCol, std::move(aAttrParam)); } } // insert hyperlink cells - for( XclImpHyperlinkList::const_iterator aLIt = maHyperlinks.begin(), aLEnd = maHyperlinks.end(); aLIt != aLEnd; ++aLIt ) + for( XclImpHyperlinkVector::const_iterator aLIt = maHyperlinks.begin(), aLEnd = maHyperlinks.end(); aLIt != aLEnd; ++aLIt ) XclImpHyperlink::InsertUrl( GetRoot(), aLIt->first, aLIt->second ); // apply cell merging diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 7a631bb63fa3..2388da9a5376 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -1866,7 +1866,7 @@ ScHTMLTable::ScHTMLTable( ScHTMLTable& rParentTable, const HtmlImportInfo& rInfo maTableItemSet( rParentTable.GetCurrItemSet() ), mrEditEngine( rParentTable.mrEditEngine ), mrEEParseList( rParentTable.mrEEParseList ), - mpCurrEntryList( nullptr ), + mpCurrEntryVector( nullptr ), maSize( 1, 1 ), mpParser(rParentTable.mpParser), mbBorderOn( false ), @@ -1914,7 +1914,7 @@ ScHTMLTable::ScHTMLTable( maTableItemSet( rPool ), mrEditEngine( rEditEngine ), mrEEParseList( rEEParseList ), - mpCurrEntryList( nullptr ), + mpCurrEntryVector( nullptr ), maSize( 1, 1 ), mpParser(pParser), mbBorderOn( false ), @@ -2322,7 +2322,7 @@ SvNumberFormatter* ScHTMLTable::GetFormatTable() bool ScHTMLTable::IsEmptyCell() const { - return mpCurrEntryList && mpCurrEntryList->empty(); + return mpCurrEntryVector && mpCurrEntryVector->empty(); } bool ScHTMLTable::IsSpaceCharInfo( const HtmlImportInfo& rInfo ) @@ -2342,10 +2342,10 @@ void ScHTMLTable::CreateNewEntry( const HtmlImportInfo& rInfo ) mxCurrEntry->aSel = rInfo.aSelection; } -void ScHTMLTable::ImplPushEntryToList( ScHTMLEntryList& rEntryList, ScHTMLEntryPtr& rxEntry ) +void ScHTMLTable::ImplPushEntryToVector( ScHTMLEntryVector& rEntryVector, ScHTMLEntryPtr& rxEntry ) { // HTML entry list does not own the entries - rEntryList.push_back( rxEntry.get() ); + rEntryVector.push_back( rxEntry.get() ); // mrEEParseList (reference to member of ScEEParser) owns the entries mrEEParseList.push_back( rxEntry.release() ); } @@ -2355,15 +2355,15 @@ bool ScHTMLTable::PushEntry( ScHTMLEntryPtr& rxEntry ) bool bPushed = false; if( rxEntry.get() && rxEntry->HasContents() ) { - if( mpCurrEntryList ) + if( mpCurrEntryVector ) { if( mbPushEmptyLine ) { ScHTMLEntryPtr xEmptyEntry = CreateEntry(); - ImplPushEntryToList( *mpCurrEntryList, xEmptyEntry ); + ImplPushEntryToVector( *mpCurrEntryVector, xEmptyEntry ); mbPushEmptyLine = false; } - ImplPushEntryToList( *mpCurrEntryList, rxEntry ); + ImplPushEntryToVector( *mpCurrEntryVector, rxEntry ); bPushed = true; } else if( mpParentTable ) @@ -2437,7 +2437,7 @@ void ScHTMLTable::InsertNewCell( const ScHTMLSize& rSpanSize ) current cell position stored in maCurrCell. */ while( ((pRange = maVMergedCells.Find( maCurrCell.MakeAddr() )) != nullptr) || ((pRange = maHMergedCells.Find( maCurrCell.MakeAddr() )) != nullptr) ) maCurrCell.mnCol = pRange->aEnd.Col() + 1; - mpCurrEntryList = &maEntryMap[ maCurrCell ]; + mpCurrEntryVector = &maEntryMap[ maCurrCell ]; /* If the new cell is merged horizontally, try to find collisions with other vertically merged ranges. In this case, shrink existing @@ -2515,7 +2515,7 @@ void ScHTMLTable::ImplDataOff() { mxDataItemSet.reset(); ++maCurrCell.mnCol; - mpCurrEntryList = nullptr; + mpCurrEntryVector = nullptr; mbDataOn = false; } } @@ -2639,7 +2639,7 @@ void ScHTMLTable::FillEmptyCells() // insert a dummy entry ScHTMLEntryPtr xEntry = CreateEntry(); - ImplPushEntryToList( maEntryMap[ ScHTMLPos( aAddr ) ], xEntry ); + ImplPushEntryToVector( maEntryMap[ ScHTMLPos( aAddr ) ], xEntry ); } } } @@ -2665,9 +2665,9 @@ void ScHTMLTable::RecalcDocSize() const ScHTMLPos& rCellPos = aMapIter->first; ScHTMLSize aCellSpan = GetSpan( rCellPos ); - const ScHTMLEntryList& rEntryList = aMapIter->second; - ScHTMLEntryList::const_iterator aListIter; - ScHTMLEntryList::const_iterator aListIterEnd = rEntryList.end(); + const ScHTMLEntryVector& rEntryVector = aMapIter->second; + ScHTMLEntryVector::const_iterator aVectorIter; + ScHTMLEntryVector::const_iterator aVectorIterEnd = rEntryVector.end(); // process the dimension of the current cell in this pass? // (pass is single and span is 1) or (pass is not single and span is not 1) @@ -2678,9 +2678,9 @@ void ScHTMLTable::RecalcDocSize() ScHTMLSize aDocSize( 1, 0 ); // resulting size of the cell in document // expand the cell size for each cell parse entry - for( aListIter = rEntryList.begin(); aListIter != aListIterEnd; ++aListIter ) + for( aVectorIter = rEntryVector.begin(); aVectorIter != aVectorIterEnd; ++aVectorIter ) { - ScHTMLTable* pTable = GetExistingTable( (*aListIter)->GetTableId() ); + ScHTMLTable* pTable = GetExistingTable( (*aVectorIter)->GetTableId() ); // find entry with maximum width if( bProcessColWidth && pTable ) aDocSize.mnCols = std::max( aDocSize.mnCols, static_cast< SCCOL >( pTable->GetDocSize( tdCol ) ) ); @@ -2717,12 +2717,12 @@ void ScHTMLTable::RecalcDocPos( const ScHTMLPos& rBasePos ) // running doc position for single entries ScHTMLPos aEntryDocPos( aCellDocPos ); - ScHTMLEntryList& rEntryList = aMapIter->second; + ScHTMLEntryVector& rEntryVector = aMapIter->second; ScHTMLEntry* pEntry = nullptr; - ScHTMLEntryList::iterator aListIterEnd = rEntryList.end(); - for( ScHTMLEntryList::iterator aListIter = rEntryList.begin(); aListIter != aListIterEnd; ++aListIter ) + ScHTMLEntryVector::iterator aVectorIterEnd = rEntryVector.end(); + for( ScHTMLEntryVector::iterator aVectorIter = rEntryVector.begin(); aVectorIter != aVectorIterEnd; ++aVectorIter ) { - pEntry = *aListIter; + pEntry = *aVectorIter; if( ScHTMLTable* pTable = GetExistingTable( pEntry->GetTableId() ) ) { pTable->RecalcDocPos( aEntryDocPos ); // recalc nested table @@ -2758,7 +2758,7 @@ void ScHTMLTable::RecalcDocPos( const ScHTMLPos& rBasePos ) // pEntry points now to last entry. if( pEntry ) { - if( (pEntry == rEntryList.front()) && (pEntry->GetTableId() == SC_HTML_NO_TABLE) ) + if( (pEntry == rEntryVector.front()) && (pEntry->GetTableId() == SC_HTML_NO_TABLE) ) { // pEntry is the only entry in this cell - merge rows of cell with single non-table entry. pEntry->nRowOverlap = aCellDocSize.mnRows; @@ -2773,7 +2773,7 @@ void ScHTMLTable::RecalcDocPos( const ScHTMLPos& rBasePos ) xDummyEntry->nCol = aEntryDocPos.mnCol; xDummyEntry->nRow = aEntryDocPos.mnRow; xDummyEntry->nColOverlap = aCellDocSize.mnCols; - ImplPushEntryToList( rEntryList, xDummyEntry ); + ImplPushEntryToVector( rEntryVector, xDummyEntry ); ++aEntryDocPos.mnRow; } } @@ -2784,11 +2784,11 @@ void ScHTMLTable::RecalcDocPos( const ScHTMLPos& rBasePos ) ScHTMLGlobalTable::ScHTMLGlobalTable( SfxItemPool& rPool, EditEngine& rEditEngine, - std::vector< ScEEParseEntry* >& rEEParseList, + std::vector< ScEEParseEntry* >& rEEParseVector, ScHTMLTableId& rnUnusedId, ScHTMLParser* pParser ) : - ScHTMLTable( rPool, rEditEngine, rEEParseList, rnUnusedId, pParser ) + ScHTMLTable( rPool, rEditEngine, rEEParseVector, rnUnusedId, pParser ) { } diff --git a/sc/source/filter/inc/htmlpars.hxx b/sc/source/filter/inc/htmlpars.hxx index 2e0ef191bde3..43575da8293a 100644 --- a/sc/source/filter/inc/htmlpars.hxx +++ b/sc/source/filter/inc/htmlpars.hxx @@ -20,7 +20,6 @@ #ifndef INCLUDED_SC_SOURCE_FILTER_INC_HTMLPARS_HXX #define INCLUDED_SC_SOURCE_FILTER_INC_HTMLPARS_HXX -#include <list> #include <memory> #include <map> #include <stack> @@ -443,8 +442,8 @@ private: typedef ::std::unique_ptr< ScHTMLTableMap > ScHTMLTableMapPtr; typedef ::std::unique_ptr< SfxItemSet > SfxItemSetPtr; typedef ::std::vector< SCCOLROW > ScSizeVec; - typedef ::std::list< ScHTMLEntry* > ScHTMLEntryList; - typedef ::std::map< ScHTMLPos, ScHTMLEntryList > ScHTMLEntryMap; + typedef ::std::vector< ScHTMLEntry* > ScHTMLEntryVector; + typedef ::std::map< ScHTMLPos, ScHTMLEntryVector > ScHTMLEntryMap; typedef ::std::unique_ptr< ScHTMLEntry > ScHTMLEntryPtr; /** Returns true, if the current cell does not contain an entry yet. */ @@ -465,7 +464,7 @@ private: void InsertLeadingEmptyLine(); /** Pushes the passed entry into the list of the current cell. */ - void ImplPushEntryToList( ScHTMLEntryList& rEntryList, ScHTMLEntryPtr& rxEntry ); + void ImplPushEntryToVector( ScHTMLEntryVector& rEntryVector, ScHTMLEntryPtr& rxEntry ); /** Tries to insert the entry into the current cell. @descr If insertion is not possible (i.e., currently no cell open), the entry will be inserted into the parent table. @@ -529,7 +528,7 @@ private: EditEngine& mrEditEngine; /// Edit engine (from ScEEParser). ::std::vector< ScEEParseEntry* >& mrEEParseList; /// List that owns the parse entries (from ScEEParser). ScHTMLEntryMap maEntryMap; /// List of entries for each cell. - ScHTMLEntryList* mpCurrEntryList; /// Current entry list from map for faster access. + ScHTMLEntryVector* mpCurrEntryVector; /// Current entry vector from map for faster access. ScHTMLEntryPtr mxCurrEntry; /// Working entry, not yet inserted in a list. ScSizeVec maCumSizes[ 2 ]; /// Cumulated cell counts for each HTML table column/row. ScHTMLSize maSize; /// Size of the table. diff --git a/sc/source/filter/inc/sheetdatabuffer.hxx b/sc/source/filter/inc/sheetdatabuffer.hxx index 86590bb43e76..ef8db4c73ae3 100644 --- a/sc/source/filter/inc/sheetdatabuffer.hxx +++ b/sc/source/filter/inc/sheetdatabuffer.hxx @@ -20,7 +20,7 @@ #ifndef INCLUDED_SC_SOURCE_FILTER_INC_SHEETDATABUFFER_HXX #define INCLUDED_SC_SOURCE_FILTER_INC_SHEETDATABUFFER_HXX -#include <list> +#include <vector> #include <map> #include <set> @@ -171,11 +171,11 @@ private: private: /** Stores cell range address and formula token array of an array formula. */ typedef std::pair< ScRange, ApiTokenSequence > ArrayFormula; - typedef ::std::list< ArrayFormula > ArrayFormulaList; + typedef ::std::vector< ArrayFormula > ArrayFormulaVector; /** Stores cell range address and settings of a table operation. */ typedef std::pair< ScRange, DataTableModel > TableOperation; - typedef ::std::list< TableOperation > TableOperationList; + typedef ::std::vector< TableOperation > TableOperationVector; /** Stores information about a range of rows with equal cell formatting. */ struct XfIdRowRange @@ -217,20 +217,20 @@ private: explicit MergedRange( const ScAddress& rAddress, sal_Int32 nHorAlign ); bool tryExpand( const ScAddress& rAddress, sal_Int32 nHorAlign ); }; - typedef ::std::list< MergedRange > MergedRangeList; + typedef ::std::vector< MergedRange > MergedRangeVector; ColStyles maStylesPerColumn; /// Stores cell styles by column ( in row ranges ) CellBlockBuffer maCellBlocks; /// Manages all open cell blocks. - ArrayFormulaList maArrayFormulas; /// All array formulas in the sheet. - TableOperationList maTableOperations; /// All table operations in the sheet. + ArrayFormulaVector maArrayFormulas; /// All array formulas in the sheet. + TableOperationVector maTableOperations; /// All table operations in the sheet. ::std::map< BinAddress, ApiTokenSequence > maSharedFormulas; /// Maps shared formula base address to defined name token index. ScAddress maSharedFmlaAddr; /// Address of a cell containing a pending shared formula. ScAddress maSharedBaseAddr; /// Base address of the pending shared formula. XfIdRowRange maXfIdRowRange; /// Cached XF identifier for a range of rows. XfIdRangeListMap maXfIdRangeLists; /// Collected XF identifiers for cell rangelists. - MergedRangeList maMergedRanges; /// Merged cell ranges. - MergedRangeList maCenterFillRanges; /// Merged cell ranges from 'center across' or 'fill' alignment. + MergedRangeVector maMergedRanges; /// Merged cell ranges. + MergedRangeVector maCenterFillRanges; /// Merged cell ranges from 'center across' or 'fill' alignment. bool mbPendingSharedFmla; /// True = maSharedFmlaAddr and maSharedBaseAddr are valid. std::map< sal_Int32, std::vector< ValueRange > > maXfIdRowRangeList; /// Cached XF identifiers for a ranges of rows, we try and process rowranges with the same XF id together }; diff --git a/sc/source/filter/inc/xistyle.hxx b/sc/source/filter/inc/xistyle.hxx index 6acd9a13d5f2..930854af35de 100644 --- a/sc/source/filter/inc/xistyle.hxx +++ b/sc/source/filter/inc/xistyle.hxx @@ -20,7 +20,7 @@ #ifndef INCLUDED_SC_SOURCE_FILTER_INC_XISTYLE_HXX #define INCLUDED_SC_SOURCE_FILTER_INC_XISTYLE_HXX -#include <list> +#include <vector> #include <memory> #include <vector> #include <tools/mempool.hxx> @@ -401,7 +401,7 @@ public: @return A read-only reference to the item set stored internally. */ const ScPatternAttr& CreatePattern( bool bSkipPoolDefs = false ); - void ApplyPatternToAttrList( + void ApplyPatternToAttrVector( ::std::vector<ScAttrEntry>& rAttrs, SCROW nRow1, SCROW nRow2, sal_uInt32 nForceScNumFmt); @@ -669,10 +669,10 @@ private: typedef std::shared_ptr< XclImpXFRangeColumn > XclImpXFRangeColumnRef; typedef ::std::vector< XclImpXFRangeColumnRef > XclImpXFRangeColumnVec; typedef ::std::pair< XclRange, OUString > XclImpHyperlinkRange; - typedef ::std::list< XclImpHyperlinkRange > XclImpHyperlinkList; + typedef ::std::vector< XclImpHyperlinkRange > XclImpHyperlinkVector; XclImpXFRangeColumnVec maColumns; /// Array of column XF index buffers. - XclImpHyperlinkList maHyperlinks; /// Maps URLs to hyperlink cells. + XclImpHyperlinkVector maHyperlinks; /// Maps URLs to hyperlink cells. ScRangeList maMergeList; /// List of merged cell ranges. }; diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx index f6c6d8be0792..67c768c0a10a 100644 --- a/sc/source/filter/oox/sheetdatabuffer.cxx +++ b/sc/source/filter/oox/sheetdatabuffer.cxx @@ -400,11 +400,11 @@ void SheetDataBuffer::addColXfStyle( sal_Int32 nXfId, sal_Int32 nFormatId, const void SheetDataBuffer::finalizeImport() { // create all array formulas - for( ArrayFormulaList::iterator aIt = maArrayFormulas.begin(), aEnd = maArrayFormulas.end(); aIt != aEnd; ++aIt ) + for( ArrayFormulaVector::iterator aIt = maArrayFormulas.begin(), aEnd = maArrayFormulas.end(); aIt != aEnd; ++aIt ) finalizeArrayFormula( aIt->first, aIt->second ); // create all table operations - for( TableOperationList::iterator aIt = maTableOperations.begin(), aEnd = maTableOperations.end(); aIt != aEnd; ++aIt ) + for( TableOperationVector::iterator aIt = maTableOperations.begin(), aEnd = maTableOperations.end(); aIt != aEnd; ++aIt ) finalizeTableOperation( aIt->first, aIt->second ); // write default formatting of remaining row range @@ -492,9 +492,9 @@ void SheetDataBuffer::finalizeImport() } // merge all cached merged ranges and update right/bottom cell borders - for( MergedRangeList::iterator aIt = maMergedRanges.begin(), aEnd = maMergedRanges.end(); aIt != aEnd; ++aIt ) + for( MergedRangeVector::iterator aIt = maMergedRanges.begin(), aEnd = maMergedRanges.end(); aIt != aEnd; ++aIt ) applyCellMerging( aIt->maRange ); - for( MergedRangeList::iterator aIt = maCenterFillRanges.begin(), aEnd = maCenterFillRanges.end(); aIt != aEnd; ++aIt ) + for( MergedRangeVector::iterator aIt = maCenterFillRanges.begin(), aEnd = maCenterFillRanges.end(); aIt != aEnd; ++aIt ) applyCellMerging( aIt->maRange ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits