summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-04-11 09:28:54 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-04-11 17:55:41 +0200
commit883d20c5eb68893c73ab2fd5d3bfee528d0a02d1 (patch)
treed0b95e12b3fcb569a61839b16e088be12032811c
parent09fa378e11cec924f9cd2b95d0eedb2599fa088e (diff)
move ScProgress outside of ScTable::Fill
-rw-r--r--sc/inc/document.hxx4
-rw-r--r--sc/inc/table.hxx6
-rw-r--r--sc/source/core/data/documen3.cxx4
-rw-r--r--sc/source/core/data/table4.cxx68
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx9
-rw-r--r--sc/source/ui/docshell/dbdocimp.cxx8
-rw-r--r--sc/source/ui/docshell/docfunc.cxx41
-rw-r--r--sc/source/ui/undo/undoblk3.cxx18
8 files changed, 108 insertions, 50 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 99bbc54ac44b..42b294970742 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1148,10 +1148,10 @@ public:
void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
void Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
- const ScMarkData& rMark,
+ ScProgress* pProgress, const ScMarkData& rMark,
sal_uLong nFillCount, FillDir eFillDir = FILL_TO_BOTTOM,
FillCmd eFillCmd = FILL_LINEAR, FillDateCmd eFillDateCmd = FILL_DAY,
- double nStepValue = 1.0, double nMaxValue = 1E307);
+ double nStepValue = 1.0, double nMaxValue = 1E307 );
rtl::OUString GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY );
bool GetSelectionFunction( ScSubTotalFunc eFunc,
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 0c440f9f4fe7..2261718fd803 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -477,7 +477,7 @@ public:
const ScRangeData::IndexMap& rMap );
void Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd,
- double nStepValue, double nMaxValue);
+ double nStepValue, double nMaxValue, ScProgress* pProgress);
String GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY );
void UpdateSelectionFunction( ScFunctionData& rData,
@@ -792,13 +792,13 @@ private:
sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd,
FillDateCmd eFillDateCmd,
double nStepValue, double nMaxValue, sal_uInt16 nMinDigits,
- bool bAttribs, ScProgress& rProgress );
+ bool bAttribs, ScProgress* pProgress );
void FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
FillCmd& rCmd, FillDateCmd& rDateCmd,
double& rInc, sal_uInt16& rMinDigits,
ScUserListData*& rListData, sal_uInt16& rListIndex);
void FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
- sal_uLong nFillCount, FillDir eFillDir, ScProgress& rProgress );
+ sal_uLong nFillCount, FillDir eFillDir, ScProgress* pProgress );
bool ValidNextPos( SCCOL nCol, SCROW nRow, const ScMarkData& rMark,
bool bMarked, bool bUnprotected );
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index e0d57a6a8659..f016df5ba88b 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -1100,7 +1100,7 @@ void ScDocument::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY )
maTabs[i]->UpdateGrow( rArea, nGrowX, nGrowY );
}
-void ScDocument::Fill(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark,
+void ScDocument::Fill(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScProgress* pProgress, const ScMarkData& rMark,
sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd,
double nStepValue, double nMaxValue)
{
@@ -1112,7 +1112,7 @@ void ScDocument::Fill(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const
if (maTabs[*itr])
maTabs[*itr]->Fill(nCol1, nRow1, nCol2, nRow2,
nFillCount, eFillDir, eFillCmd, eFillDateCmd,
- nStepValue, nMaxValue);
+ nStepValue, nMaxValue, pProgress);
}
rtl::OUString ScDocument::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY )
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 44eb2262061a..e3d57beeeab7 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -467,7 +467,7 @@ void ScTable::FillFormula(sal_uLong& /* nFormulaCounter */, bool /* bFirst */, S
}
void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
- sal_uLong nFillCount, FillDir eFillDir, ScProgress& rProgress )
+ sal_uLong nFillCount, FillDir eFillDir, ScProgress* pProgress )
{
if ( (nFillCount == 0) || !ValidColRow(nCol1, nRow1) || !ValidColRow(nCol2, nRow2) )
return;
@@ -541,7 +541,9 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
DeleteArea(static_cast<SCCOL>(nIMin), nRow1, static_cast<SCCOL>(nIMax), nRow2, IDF_AUTOFILL);
}
- sal_uLong nProgress = rProgress.GetState();
+ sal_uLong nProgress = 0;
+ if (pProgress)
+ nProgress = pProgress->GetState();
//
// ausfuehren
@@ -701,8 +703,11 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
if (rInner == nIEnd) break;
if (bPositive) ++rInner; else --rInner;
}
- nProgress += nIMax - nIMin + 1;
- rProgress.SetStateOnPercent( nProgress );
+ if(pProgress)
+ {
+ nProgress += nIMax - nIMin + 1;
+ pProgress->SetStateOnPercent( nProgress );
+ }
}
else if (eFillCmd == FILL_SIMPLE) // Auffuellen mit Muster
{
@@ -871,11 +876,12 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
// und auch dann nicht fuer jede einzelne
++nProgress;
- if ( eCellType == CELLTYPE_FORMULA || eCellType == CELLTYPE_EDIT )
- rProgress.SetStateOnPercent( nProgress );
+ if ( pProgress && (eCellType == CELLTYPE_FORMULA || eCellType == CELLTYPE_EDIT) )
+ pProgress->SetStateOnPercent( nProgress );
}
- rProgress.SetStateOnPercent( nProgress );
+ if (pProgress)
+ pProgress->SetStateOnPercent( nProgress );
}
else
{
@@ -886,13 +892,14 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
FillSeries( static_cast<SCCOL>(nCol), nRow1,
static_cast<SCCOL>(nCol), nRow2, nFillCount, eFillDir,
eFillCmd, eDateCmd, nInc, nEndVal, nMinDigits, false,
- rProgress );
+ pProgress );
else
FillSeries( nCol1, static_cast<SCROW>(nRow), nCol2,
static_cast<SCROW>(nRow), nFillCount, eFillDir,
eFillCmd, eDateCmd, nInc, nEndVal, nMinDigits, false,
- rProgress );
- nProgress = rProgress.GetState();
+ pProgress );
+ if (pProgress)
+ nProgress = pProgress->GetState();
}
nActFormCnt += nMaxFormCnt;
@@ -1246,7 +1253,7 @@ void ScTable::IncDate(double& rVal, sal_uInt16& nDayOfMonth, double nStep, FillD
void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd,
double nStepValue, double nMaxValue, sal_uInt16 nArgMinDigits,
- bool bAttribs, ScProgress& rProgress )
+ bool bAttribs, ScProgress* pProgress )
{
//
// Richtung auswerten
@@ -1315,7 +1322,9 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
else
DeleteArea(static_cast<SCCOL>(nIMin), nRow1, static_cast<SCCOL>(nIMax), nRow2, nDel);
- sal_uLong nProgress = rProgress.GetState();
+ sal_uLong nProgress = 0;
+ if (pProgress)
+ nProgress = pProgress->GetState();
//
// ausfuehren
@@ -1358,7 +1367,8 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
FillFormula(nInd, bFirst, (ScFormulaCell*)pSrcCell,
static_cast<SCCOL>(nCol), nRow, (rInner == nIEnd) );
bFirst = false;
- rProgress.SetStateOnPercent( ++nProgress );
+ if(pProgress)
+ pProgress->SetStateOnPercent( ++nProgress );
}
}
else if (eCellType != CELLTYPE_NOTE)
@@ -1371,7 +1381,8 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
aCol[nCol].Insert( aDestPos.Row(), pSrcCell->Clone( *pDocument ) );
}
nProgress += nIMax - nIMin + 1;
- rProgress.SetStateOnPercent( nProgress );
+ if(pProgress)
+ pProgress->SetStateOnPercent( nProgress );
}
}
else if (eCellType == CELLTYPE_VALUE || eCellType == CELLTYPE_FORMULA)
@@ -1449,7 +1460,8 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
if (bPositive) ++rInner; else --rInner;
}
nProgress += nIMax - nIMin + 1;
- rProgress.SetStateOnPercent( nProgress );
+ if(pProgress)
+ pProgress->SetStateOnPercent( nProgress );
}
else if (eCellType == CELLTYPE_STRING || eCellType == CELLTYPE_EDIT)
{
@@ -1554,14 +1566,17 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
if (bPositive) ++rInner; else --rInner;
}
}
- nProgress += nIMax - nIMin + 1;
- rProgress.SetStateOnPercent( nProgress );
+ if(pProgress)
+ {
+ nProgress += nIMax - nIMin + 1;
+ pProgress->SetStateOnPercent( nProgress );
+ }
}
}
- else
+ else if(pProgress)
{
nProgress += nIMax - nIMin + 1;
- rProgress.SetStateOnPercent( nProgress );
+ pProgress->SetStateOnPercent( nProgress );
}
++nActFormCnt;
}
@@ -1569,22 +1584,13 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
void ScTable::Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd,
- double nStepValue, double nMaxValue)
+ double nStepValue, double nMaxValue, ScProgress* pProgress)
{
- sal_uLong nProgCount;
- if (eFillDir == FILL_TO_BOTTOM || eFillDir == FILL_TO_TOP)
- nProgCount = nCol2 - nCol1 + 1;
- else
- nProgCount = nRow2 - nRow1 + 1;
- nProgCount *= nFillCount;
- ScProgress aProgress( pDocument->GetDocumentShell(),
- ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount );
-
if (eFillCmd == FILL_AUTO)
- FillAuto(nCol1, nRow1, nCol2, nRow2, nFillCount, eFillDir, aProgress);
+ FillAuto(nCol1, nRow1, nCol2, nRow2, nFillCount, eFillDir, pProgress);
else
FillSeries(nCol1, nRow1, nCol2, nRow2, nFillCount, eFillDir,
- eFillCmd, eFillDateCmd, nStepValue, nMaxValue, 0, true, aProgress);
+ eFillCmd, eFillDateCmd, nStepValue, nMaxValue, 0, true, pProgress);
}
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index f935ef977246..0e25ee0d38f0 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -61,6 +61,7 @@
#include "hints.hxx"
#include "queryentry.hxx"
#include "markdata.hxx"
+#include "progress.hxx"
#include <set>
@@ -886,8 +887,14 @@ sal_Bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
ScMarkData aMark;
aMark.SelectOneTable(nDestTab);
SCROW nFStartY = aLocalParam.nRow1 + ( aLocalParam.bHasHeader ? 1 : 0 );
+
+ sal_uLong nProgCount = nFormulaCols;
+ nProgCount *= aLocalParam.nRow2 - nFStartY;
+ ScProgress aProgress( pDoc->GetDocumentShell(),
+ ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount );
+
pDoc->Fill( aLocalParam.nCol2+1, nFStartY,
- aLocalParam.nCol2+nFormulaCols, nFStartY, aMark,
+ aLocalParam.nCol2+nFormulaCols, nFStartY, &aProgress, aMark,
aLocalParam.nRow2 - nFStartY,
FILL_TO_BOTTOM, FILL_SIMPLE );
}
diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx
index 39b2b80f7799..92f6b4599ef7 100644
--- a/sc/source/ui/docshell/dbdocimp.cxx
+++ b/sc/source/ui/docshell/dbdocimp.cxx
@@ -597,8 +597,14 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
// fill formulas
ScMarkData aMark;
aMark.SelectOneTable(nTab);
+
+ sal_uLong nProgCount = nFormulaCols;
+ nProgCount *= nEndRow-rParam.nRow1-1;
+ ScProgress aProgress( pDoc->GetDocumentShell(),
+ ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount );
+
pDoc->Fill( nEndCol+1, rParam.nRow1+1, nEndCol+nFormulaCols, rParam.nRow1+1,
- aMark, nEndRow-rParam.nRow1-1, FILL_TO_BOTTOM, FILL_SIMPLE );
+ &aProgress, aMark, nEndRow-rParam.nRow1-1, FILL_TO_BOTTOM, FILL_SIMPLE );
}
// if new range is smaller, clear old contents
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 973968d21bb6..379887f45f9b 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -100,6 +100,7 @@
#include "clipparam.hxx"
#include "externalrefmgr.hxx"
#include "undorangename.hxx"
+#include "progress.hxx"
#include <memory>
#include <basic/basmgr.hxx>
@@ -4078,9 +4079,18 @@ bool ScDocFunc::FillSimple( const ScRange& rRange, const ScMarkData* pTabMark,
pDoc->CopyToDocument( aCopyRange, IDF_AUTOFILL, false, pUndoDoc, &aMark );
}
+ sal_uLong nProgCount;
+ if (eDir == FILL_TO_BOTTOM || eDir == FILL_TO_TOP)
+ nProgCount = aSourceArea.aEnd.Col() - aSourceArea.aStart.Col() + 1;
+ else
+ nProgCount = aSourceArea.aEnd.Row() - aSourceArea.aStart.Row() + 1;
+ nProgCount *= nCount;
+ ScProgress aProgress( pDoc->GetDocumentShell(),
+ ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount );
+
pDoc->Fill( aSourceArea.aStart.Col(), aSourceArea.aStart.Row(),
- aSourceArea.aEnd.Col(), aSourceArea.aEnd.Row(), aMark,
- nCount, eDir, FILL_SIMPLE );
+ aSourceArea.aEnd.Col(), aSourceArea.aEnd.Row(), &aProgress,
+ aMark, nCount, eDir, FILL_SIMPLE );
AdjustRowHeight(aRange);
if ( bRecord ) // Draw-Undo erst jetzt verfuegbar
@@ -4194,9 +4204,19 @@ sal_Bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMar
SCTAB nTab = aDestArea.aStart.Tab();
pDoc->SetValue( nValX, nValY, nTab, fStart );
}
+
+ sal_uLong nProgCount;
+ if (eDir == FILL_TO_BOTTOM || eDir == FILL_TO_TOP)
+ nProgCount = aSourceArea.aEnd.Col() - aSourceArea.aStart.Col() + 1;
+ else
+ nProgCount = aSourceArea.aEnd.Row() - aSourceArea.aStart.Row() + 1;
+ nProgCount *= nCount;
+ ScProgress aProgress( pDoc->GetDocumentShell(),
+ ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount );
+
pDoc->Fill( aSourceArea.aStart.Col(), aSourceArea.aStart.Row(),
- aSourceArea.aEnd.Col(), aSourceArea.aEnd.Row(), aMark,
- nCount, eDir, eCmd, eDateCmd, fStep, fMax );
+ aSourceArea.aEnd.Col(), aSourceArea.aEnd.Row(), &aProgress,
+ aMark, nCount, eDir, eCmd, eDateCmd, fStep, fMax );
AdjustRowHeight(rRange);
rDocShell.PostPaintGridAll();
@@ -4325,9 +4345,18 @@ sal_Bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillD
IDF_AUTOFILL, false, pUndoDoc, &aMark );
}
+ sal_uLong nProgCount;
+ if (eDir == FILL_TO_BOTTOM || eDir == FILL_TO_TOP)
+ nProgCount = aSourceArea.aEnd.Col() - aSourceArea.aStart.Col() + 1;
+ else
+ nProgCount = aSourceArea.aEnd.Row() - aSourceArea.aStart.Row() + 1;
+ nProgCount *= nCount;
+ ScProgress aProgress( pDoc->GetDocumentShell(),
+ ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount );
+
pDoc->Fill( aSourceArea.aStart.Col(), aSourceArea.aStart.Row(),
- aSourceArea.aEnd.Col(), aSourceArea.aEnd.Row(), aMark,
- nCount, eDir, eCmd, eDateCmd, fStep, fMax );
+ aSourceArea.aEnd.Col(), aSourceArea.aEnd.Row(), &aProgress,
+ aMark, nCount, eDir, eCmd, eDateCmd, fStep, fMax );
AdjustRowHeight(aDestArea);
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index 3286614bb530..78ea86b28b7a 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -60,6 +60,7 @@
#include "paramisc.hxx"
#include "postit.hxx"
#include "docuno.hxx"
+#include "progress.hxx"
// STATIC DATA ---------------------------------------------------------------
@@ -714,11 +715,20 @@ void ScUndoAutoFill::Redo()
SCTAB nTab = aSource.aStart.Tab();
pDoc->SetValue( nValX, nValY, nTab, fStartValue );
}
+ sal_uLong nProgCount;
+ if (eFillDir == FILL_TO_BOTTOM || eFillDir == FILL_TO_TOP)
+ nProgCount = aSource.aEnd.Col() - aSource.aStart.Col() + 1;
+ else
+ nProgCount = aSource.aEnd.Row() - aSource.aStart.Row() + 1;
+ nProgCount *= nCount;
+ ScProgress aProgress( pDoc->GetDocumentShell(),
+ ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount );
+
pDoc->Fill( aSource.aStart.Col(), aSource.aStart.Row(),
- aSource.aEnd.Col(), aSource.aEnd.Row(),
- aMarkData, nCount,
- eFillDir, eFillCmd, eFillDateCmd,
- fStepValue, fMaxValue );
+ aSource.aEnd.Col(), aSource.aEnd.Row(), &aProgress,
+ aMarkData, nCount,
+ eFillDir, eFillCmd, eFillDateCmd,
+ fStepValue, fMaxValue );
SetChangeTrack();