diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-09-17 15:34:06 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-09-18 00:40:33 -0400 |
commit | d3469ce86e954d6b9c15d3442791121c8c8d015e (patch) | |
tree | 7c1e02f98ce03b13edd70e2536059159f4a98f2a /sc | |
parent | 1b9a8efb824b5fe6113a14279ea5a4c8070d260f (diff) |
Do the same for the no-parameter variant of fillTable().
Change-Id: I698e70e7713697e2951c3e6ead4b4d2198d8a6cf
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/dpcachetable.cxx | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/sc/source/core/data/dpcachetable.cxx b/sc/source/core/data/dpcachetable.cxx index 08bc7764cc7d..7c5a41f6a430 100644 --- a/sc/source/core/data/dpcachetable.cxx +++ b/sc/source/core/data/dpcachetable.cxx @@ -209,14 +209,19 @@ void ScDPCacheTable::fillTable( void ScDPCacheTable::fillTable() { - const SCROW nRowCount = getRowSize(); - const SCCOL nColCount = (SCCOL) getColSize(); - if ( nRowCount <= 0 || nColCount <= 0) + SCROW nRowCount = getRowSize(); + SCCOL nColCount = getColSize(); + if (nRowCount <= 0 || nColCount <= 0) return; maRowFlags.clear(); maRowFlags.reserve(nRowCount); + for (SCROW nRow = 0; nRow < nRowCount; ++nRow) + { + maRowFlags.push_back(RowFlag()); + maRowFlags.back().mbShowByFilter = true; + } // Initialize field entries container. maFieldEntries.clear(); @@ -227,28 +232,21 @@ void ScDPCacheTable::fillTable() { maFieldEntries.push_back( vector<SCROW>() ); SCROW nMemCount = getCache()->GetDimMemberCount( nCol ); - if ( nMemCount ) - { - std::vector< SCROW > pAdded( nMemCount, -1 ); - - for (SCROW nRow = 0; nRow < nRowCount; ++nRow ) - { - SCROW nIndex = getCache()->GetItemDataId( nCol, nRow, false ); - SCROW nOrder = getOrder( nCol, nIndex ); + if (!nMemCount) + continue; - if ( nCol == 0 ) - { - maRowFlags.push_back(RowFlag()); - maRowFlags.back().mbShowByFilter = true; - } + std::vector<SCROW> aAdded(nMemCount, -1); - pAdded[nOrder] = nIndex; - } - for ( SCROW nRow = 0; nRow < nMemCount; nRow++ ) - { - if ( pAdded[nRow] != -1 ) - maFieldEntries.back().push_back( pAdded[nRow] ); - } + for (SCROW nRow = 0; nRow < nRowCount; ++nRow) + { + SCROW nIndex = getCache()->GetItemDataId(nCol, nRow, false); + SCROW nOrder = getOrder(nCol, nIndex); + aAdded[nOrder] = nIndex; + } + for (SCROW nRow = 0; nRow < nMemCount; ++nRow) + { + if (aAdded[nRow] != -1) + maFieldEntries.back().push_back(aAdded[nRow]); } } } |