diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-08-29 19:35:06 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-08-29 19:46:33 +0200 |
commit | b705c6b4bd080dd0f7713286a1b19ce95850eb49 (patch) | |
tree | 89c8dc967f2aef072bd8d400afee055fbf067c05 /sc | |
parent | e1d56d509bf52eb83b461f4e291d348caa6c119d (diff) |
move ScProgress construction out of ScTable::Sort
Change-Id: I8e523fbb53b9c40075b62ee32d79eee0b408168e
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/document.hxx | 2 | ||||
-rw-r--r-- | sc/inc/table.hxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/documen3.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/table3.cxx | 19 | ||||
-rw-r--r-- | sc/source/ui/docshell/dbdocfun.cxx | 5 |
5 files changed, 19 insertions, 15 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index a2db35f8388c..efe8814ea67c 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1471,7 +1471,7 @@ public: SC_DLLPUBLIC SvNumberFormatter* GetFormatTable() const; - void Sort( SCTAB nTab, const ScSortParam& rSortParam, bool bKeepQuery ); + void Sort( SCTAB nTab, const ScSortParam& rSortParam, bool bKeepQuery, ScProgress* pProgress ); SCSIZE Query( SCTAB nTab, const ScQueryParam& rQueryParam, bool bKeepSub ); SC_DLLPUBLIC bool CreateQueryParam( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab, ScQueryParam& rQueryParam ); diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 223d38c9aea6..2b205e5c3042 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -753,7 +753,7 @@ public: void StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 ); void ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 ); - void Sort(const ScSortParam& rSortParam, bool bKeepQuery); + void Sort(const ScSortParam& rSortParam, bool bKeepQuery, ScProgress* pProgress); bool ValidQuery( SCROW nRow, const ScQueryParam& rQueryParam, ScBaseCell* pCell = NULL, bool* pbTestEqualCondition = NULL); @@ -863,7 +863,7 @@ private: short Compare( ScSortInfoArray*, SCCOLROW nIndex1, SCCOLROW nIndex2) const; ScSortInfoArray* CreateSortInfoArray( SCCOLROW nInd1, SCCOLROW nInd2 ); void QuickSort( ScSortInfoArray*, SCsCOLROW nLo, SCsCOLROW nHi); - void SortReorder( ScSortInfoArray*, ScProgress& ); + void SortReorder( ScSortInfoArray*, ScProgress* ); bool CreateExcelQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam); bool CreateStarQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam); diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 20a6127b4478..209ba19b3914 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -1335,13 +1335,13 @@ bool ScDocument::UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, b return false; } -void ScDocument::Sort(SCTAB nTab, const ScSortParam& rSortParam, bool bKeepQuery) +void ScDocument::Sort(SCTAB nTab, const ScSortParam& rSortParam, bool bKeepQuery, ScProgress* pProgress) { if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] ) { bool bOldDisableIdle = IsIdleDisabled(); DisableIdle( true ); - maTabs[nTab]->Sort(rSortParam, bKeepQuery); + maTabs[nTab]->Sort(rSortParam, bKeepQuery, pProgress); DisableIdle( bOldDisableIdle ); } } diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 1ea61fb05a11..7688b4e4f825 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -343,7 +343,7 @@ void ScTable::DestroySortCollator() } -void ScTable::SortReorder( ScSortInfoArray* pArray, ScProgress& rProgress ) +void ScTable::SortReorder( ScSortInfoArray* pArray, ScProgress* pProgress ) { bool bByRow = aSortParam.bByRow; SCSIZE nCount = pArray->GetCount(); @@ -372,7 +372,8 @@ void ScTable::SortReorder( ScSortInfoArray* pArray, ScProgress& rProgress ) ::std::swap(p, aTable[nOrg-nStart]); OSL_ENSURE( p == ppInfo[nPos], "SortReorder: nOrg MisMatch" ); } - rProgress.SetStateOnPercent( nPos ); + if(pProgress) + pProgress->SetStateOnPercent( nPos ); } } @@ -742,7 +743,7 @@ void ScTable::DecoladeRow( ScSortInfoArray* pArray, SCROW nRow1, SCROW nRow2 ) } } -void ScTable::Sort(const ScSortParam& rSortParam, bool bKeepQuery) +void ScTable::Sort(const ScSortParam& rSortParam, bool bKeepQuery, ScProgress* pProgress) { aSortParam = rSortParam; InitSortCollator( rSortParam ); @@ -757,13 +758,13 @@ void ScTable::Sort(const ScSortParam& rSortParam, bool bKeepQuery) aSortParam.nRow1 + 1 : aSortParam.nRow1); if (!IsSorted(nRow1, nLastRow)) { - ScProgress aProgress( pDocument->GetDocumentShell(), - ScGlobal::GetRscString(STR_PROGRESS_SORTING), nLastRow - nRow1 ); + if(pProgress) + pProgress->SetState( 0, nLastRow-nRow1 ); ScSortInfoArray* pArray = CreateSortInfoArray( nRow1, nLastRow ); if ( nLastRow - nRow1 > 255 ) DecoladeRow( pArray, nRow1, nLastRow ); QuickSort( pArray, nRow1, nLastRow ); - SortReorder( pArray, aProgress ); + SortReorder( pArray, pProgress ); delete pArray; // #i59745# update position of caption objects of cell notes ScNoteUtil::UpdateCaptionPositions( *pDocument, ScRange( aSortParam.nCol1, nRow1, nTab, aSortParam.nCol2, nLastRow, nTab ) ); @@ -780,11 +781,11 @@ void ScTable::Sort(const ScSortParam& rSortParam, bool bKeepQuery) aSortParam.nCol1 + 1 : aSortParam.nCol1); if (!IsSorted(nCol1, nLastCol)) { - ScProgress aProgress( pDocument->GetDocumentShell(), - ScGlobal::GetRscString(STR_PROGRESS_SORTING), nLastCol - nCol1 ); + if(pProgress) + pProgress->SetState( 0, nLastCol-nCol1 ); ScSortInfoArray* pArray = CreateSortInfoArray( nCol1, nLastCol ); QuickSort( pArray, nCol1, nLastCol ); - SortReorder( pArray, aProgress ); + SortReorder( pArray, pProgress ); delete pArray; // #i59745# update position of caption objects of cell notes ScNoteUtil::UpdateCaptionPositions( *pDocument, ScRange( nCol1, aSortParam.nRow1, nTab, nLastCol, aSortParam.nRow2, nTab ) ); diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index c5ac76078dde..d7cff6391edf 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -582,7 +582,10 @@ sal_Bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam, // don't call ScDocument::Sort with an empty SortParam (may be empty here if bCopy is set) if (aLocalParam.GetSortKeyCount() && aLocalParam.maKeyState[0].bDoSort) - pDoc->Sort( nTab, aLocalParam, bRepeatQuery ); + { + ScProgress aProgress(&rDocShell, ScGlobal::GetRscString(STR_PROGRESS_SORTING), 0); + pDoc->Sort( nTab, aLocalParam, bRepeatQuery, &aProgress ); + } sal_Bool bSave = sal_True; if (bCopy) |