diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-21 12:18:56 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-22 09:03:32 -0500 |
commit | 3a22d789c22452b6a481c331db680a6b9d87a8ca (patch) | |
tree | dc2f551c38b4d654621e28bde1a73ff102bc9fee /sc | |
parent | 5db19a417952381fc6349b9691c581090d7d2679 (diff) |
Avoid re-drawing progress bar too frequently.
Change-Id: I01dcd6d421c1f648b4cd8413e3baf50fd26d4c8f
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/oox/worksheethelper.cxx | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx index 0ff929302cd6..6d0ea85cbc40 100644 --- a/sc/source/filter/oox/worksheethelper.cxx +++ b/sc/source/filter/oox/worksheethelper.cxx @@ -96,12 +96,14 @@ namespace { void lclUpdateProgressBar( const ISegmentProgressBarRef& rxProgressBar, const CellRangeAddress& rUsedArea, sal_Int32 nRow ) { - if( rxProgressBar.get() && (rUsedArea.StartRow <= nRow) && (nRow <= rUsedArea.EndRow) ) - { - double fPosition = static_cast< double >( nRow - rUsedArea.StartRow + 1 ) / (rUsedArea.EndRow - rUsedArea.StartRow + 1); - if( rxProgressBar->getPosition() < fPosition ) - rxProgressBar->setPosition( fPosition ); - } + if (!rxProgressBar || nRow < rUsedArea.StartRow || rUsedArea.EndRow < nRow) + return; + + double fCurPos = rxProgressBar->getPosition(); + double fNewPos = static_cast<double>(nRow - rUsedArea.StartRow + 1.0) / (rUsedArea.EndRow - rUsedArea.StartRow + 1.0); + if (fCurPos < fNewPos && (fNewPos - fCurPos) > 0.3) + // Try not to re-draw progress bar too frequently. + rxProgressBar->setPosition(fNewPos); } void lclUpdateProgressBar( const ISegmentProgressBarRef& rxProgressBar, double fPosition ) |