sc/inc/table.hxx | 2 +- sc/source/core/data/table3.cxx | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-)
New commits: commit ed08bc017ef65db98179ff910e9d57811120305c Author: Kohei Yoshida <[email protected]> Date: Mon Jun 30 12:02:11 2014 -0400 Pass ScSortParam to this rather than using the data member. I need a variant of this method that doesn't use ScSortParam... Change-Id: I1bba02f2db5fba5c5ee985b3adfe566d99079835 diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 9f0cff2..d84340f 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -1021,7 +1021,7 @@ private: ScRefCellValue& rCell2, SCCOL nCell2Col, SCROW nCell2Row ) const; short Compare(SCCOLROW nIndex1, SCCOLROW nIndex2) const; short Compare( ScSortInfoArray*, SCCOLROW nIndex1, SCCOLROW nIndex2) const; - ScSortInfoArray* CreateSortInfoArray( SCCOLROW nInd1, SCCOLROW nInd2, bool bKeepQuery ); + ScSortInfoArray* CreateSortInfoArray( const ScSortParam& rSortParam, SCCOLROW nInd1, SCCOLROW nInd2, bool bKeepQuery ); void QuickSort( ScSortInfoArray*, SCsCOLROW nLo, SCsCOLROW nHi); void SortReorderByColumn( ScSortInfoArray* pArray, ScProgress* pProgress ); void SortReorderByRow( ScSortInfoArray* pArray, ScProgress* pProgress ); diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index e83f86f..85a6cad 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -348,19 +348,20 @@ public: } }; -ScSortInfoArray* ScTable::CreateSortInfoArray( SCCOLROW nInd1, SCCOLROW nInd2, bool bKeepQuery ) +ScSortInfoArray* ScTable::CreateSortInfoArray( + const ScSortParam& rSortParam, SCCOLROW nInd1, SCCOLROW nInd2, bool bKeepQuery ) { sal_uInt16 nUsedSorts = 1; - while ( nUsedSorts < aSortParam.GetSortKeyCount() && aSortParam.maKeyState[nUsedSorts].bDoSort ) + while ( nUsedSorts < rSortParam.GetSortKeyCount() && rSortParam.maKeyState[nUsedSorts].bDoSort ) nUsedSorts++; ScSortInfoArray* pArray = new ScSortInfoArray( nUsedSorts, nInd1, nInd2 ); pArray->SetKeepQuery(bKeepQuery); - if ( aSortParam.bByRow ) + if ( rSortParam.bByRow ) { for ( sal_uInt16 nSort = 0; nSort < nUsedSorts; nSort++ ) { - SCCOL nCol = static_cast<SCCOL>(aSortParam.maKeyState[nSort].nField); + SCCOL nCol = static_cast<SCCOL>(rSortParam.maKeyState[nSort].nField); ScColumn* pCol = &aCol[nCol]; sc::ColumnBlockConstPosition aBlockPos; pCol->InitBlockPosition(aBlockPos); @@ -374,9 +375,9 @@ ScSortInfoArray* ScTable::CreateSortInfoArray( SCCOLROW nInd1, SCCOLROW nInd2, b // Fill row-wise data table. ScSortInfoArray::RowsType& rRows = pArray->InitDataRows( - nInd2 - nInd1 + 1, aSortParam.nCol2 - aSortParam.nCol1 + 1); + nInd2 - nInd1 + 1, rSortParam.nCol2 - rSortParam.nCol1 + 1); - for (SCCOL nCol = aSortParam.nCol1; nCol <= aSortParam.nCol2; ++nCol) + for (SCCOL nCol = rSortParam.nCol1; nCol <= rSortParam.nCol2; ++nCol) { ScColumn& rCol = aCol[nCol]; @@ -388,14 +389,14 @@ ScSortInfoArray* ScTable::CreateSortInfoArray( SCCOLROW nInd1, SCCOLROW nInd2, b for (SCROW nRow = nInd1; nRow <= nInd2; ++nRow) { ScSortInfoArray::Row& rRow = *rRows[nRow-nInd1]; - ScSortInfoArray::Cell& rCell = rRow.maCells[nCol-aSortParam.nCol1]; + ScSortInfoArray::Cell& rCell = rRow.maCells[nCol-rSortParam.nCol1]; rCell.maCell = rCol.GetCellValue(aBlockPos, nRow); rCell.mpAttr = rCol.GetCellTextAttr(aBlockPos, nRow); rCell.mpBroadcaster = rCol.GetBroadcaster(aBlockPos, nRow); rCell.mpNote = rCol.GetCellNote(aBlockPos, nRow); - if (!bUniformPattern && aSortParam.bIncludePattern) + if (!bUniformPattern && rSortParam.bIncludePattern) rCell.mpPattern = rCol.GetPattern(nRow); } } @@ -414,7 +415,7 @@ ScSortInfoArray* ScTable::CreateSortInfoArray( SCCOLROW nInd1, SCCOLROW nInd2, b { for ( sal_uInt16 nSort = 0; nSort < nUsedSorts; nSort++ ) { - SCROW nRow = aSortParam.maKeyState[nSort].nField; + SCROW nRow = rSortParam.maKeyState[nSort].nField; for ( SCCOL nCol = static_cast<SCCOL>(nInd1); nCol <= static_cast<SCCOL>(nInd2); nCol++ ) { @@ -1117,7 +1118,7 @@ void ScTable::Sort( if(pProgress) pProgress->SetState( 0, nLastRow-nRow1 ); - boost::scoped_ptr<ScSortInfoArray> pArray(CreateSortInfoArray(nRow1, nLastRow, bKeepQuery)); + boost::scoped_ptr<ScSortInfoArray> pArray(CreateSortInfoArray(aSortParam, nRow1, nLastRow, bKeepQuery)); if ( nLastRow - nRow1 > 255 ) DecoladeRow(pArray.get(), nRow1, nLastRow); @@ -1148,7 +1149,7 @@ void ScTable::Sort( if(pProgress) pProgress->SetState( 0, nLastCol-nCol1 ); - boost::scoped_ptr<ScSortInfoArray> pArray(CreateSortInfoArray(nCol1, nLastCol, bKeepQuery)); + boost::scoped_ptr<ScSortInfoArray> pArray(CreateSortInfoArray(aSortParam, nCol1, nLastCol, bKeepQuery)); QuickSort(pArray.get(), nCol1, nLastCol); SortReorderByColumn(pArray.get(), pProgress); @@ -2159,7 +2160,7 @@ void ScTable::TopTenQuery( ScQueryParam& rParam ) bSortCollatorInitialized = true; InitSortCollator( aLocalSortParam ); } - boost::scoped_ptr<ScSortInfoArray> pArray(CreateSortInfoArray(nRow1, rParam.nRow2, bGlobalKeepQuery)); + boost::scoped_ptr<ScSortInfoArray> pArray(CreateSortInfoArray(aSortParam, nRow1, rParam.nRow2, bGlobalKeepQuery)); DecoladeRow( pArray.get(), nRow1, rParam.nRow2 ); QuickSort( pArray.get(), nRow1, rParam.nRow2 ); ScSortInfo** ppInfo = pArray->GetFirstArray(); _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
