summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-07-16 18:26:18 +0200
committerMichael Stahl <mstahl@redhat.com>2013-08-29 13:53:40 +0200
commit563d441f9401d8868fae0dc379e9b712019325e7 (patch)
tree4c42fbf1819fa8d479089bf830e202d0452ede91
parent6ae2a7521f5ea34d052e7eb51a63f936d1d06aae (diff)
fdo#63273 sw: let word count not update stat. fields
Updating fields would generate loads of selection change events and it's not what we asked for. Regression from ce14342c4292628a641a72d4f63d9c048e030c6a. (cherry picked from commit e2484e3998f2c5036fb8e3584d4b1c72db19bfd3) Change-Id: If237df1f31436357022ca8d77b924681e403abd8 Reviewed-on: https://gerrit.libreoffice.org/4943 Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com> Tested-by: Björn Michaelsen <bjoern.michaelsen@canonical.com> (cherry picked from commit 699b7626222ea8be1c9713a7f5e274dbfbc029ff) This also fixes fdo#67223. Signed-off-by: Michael Stahl <mstahl@redhat.com> Conflicts: sw/inc/doc.hxx sw/source/core/doc/doc.cxx
-rw-r--r--sw/inc/IDocumentStatistics.hxx6
-rw-r--r--sw/inc/doc.hxx7
-rw-r--r--sw/source/core/doc/doc.cxx21
-rw-r--r--sw/source/ui/uiview/view2.cxx2
4 files changed, 21 insertions, 15 deletions
diff --git a/sw/inc/IDocumentStatistics.hxx b/sw/inc/IDocumentStatistics.hxx
index 2c5a05019ccb..950ea49236f1 100644
--- a/sw/inc/IDocumentStatistics.hxx
+++ b/sw/inc/IDocumentStatistics.hxx
@@ -43,8 +43,9 @@
* modified and returns a reference to the result.
* \param bCompleteAsync if true will return a partial result,
* and potentially trigger a timeout to complete the work.
+ * \param bFields if stat. fields should be updated
*/
- virtual const SwDocStat &GetUpdatedDocStat(bool bCompleteAsync) = 0;
+ virtual const SwDocStat &GetUpdatedDocStat(bool bCompleteAsync, bool bFields) = 0;
/// Set the document statistics
virtual void SetDocStat(const SwDocStat& rStat) = 0;
@@ -53,8 +54,9 @@
* Updates the internal document's statistics
* \param bCompleteAsync if true it may do part of the
* work and trigger a timeout to complete it.
+ * \param bFields if stat. fields should be updated
*/
- virtual void UpdateDocStat(bool bCompleteAsync) = 0;
+ virtual void UpdateDocStat(bool bCompleteAsync, bool bFields) = 0;
protected:
virtual ~IDocumentStatistics() {};
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 7f5488cf538f..6bccac2668c8 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -909,9 +909,9 @@ public:
*/
virtual void DocInfoChgd();
virtual const SwDocStat &GetDocStat() const;
- virtual const SwDocStat &GetUpdatedDocStat(bool bCompleteAsync = false);
+ virtual const SwDocStat &GetUpdatedDocStat(bool bCompleteAsync = false, bool bFields = true);
virtual void SetDocStat(const SwDocStat& rStat);
- virtual void UpdateDocStat(bool bCompleteAsync = false);
+ virtual void UpdateDocStat(bool bCompleteAsync = false, bool bFields = true);
/** IDocumentState
*/
@@ -2071,10 +2071,11 @@ private:
/** continue computing a chunk of document statistics
* \param nChars number of characters to count before exiting
+ * \param bFields if stat. fields should be updated
*
* returns false when there is no more to calculate
*/
- bool IncrementalDocStatCalculate(long nChars);
+ bool IncrementalDocStatCalculate(long nChars, bool bFields);
/// Our own 'StatsUpdateTimer' calls the following method
DECL_LINK( DoIdleStatsUpdate, Timer * );
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index ad191619a800..667ef5c8e80b 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1157,11 +1157,11 @@ const SwDocStat& SwDoc::GetDocStat() const
return *pDocStat;
}
-const SwDocStat& SwDoc::GetUpdatedDocStat( bool bCompleteAsync )
+const SwDocStat& SwDoc::GetUpdatedDocStat( bool bCompleteAsync, bool bFields )
{
if( pDocStat->bModified )
{
- UpdateDocStat( bCompleteAsync );
+ UpdateDocStat( bCompleteAsync, bFields );
}
return *pDocStat;
}
@@ -1684,7 +1684,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting(
}
// returns true while there is more to do
-bool SwDoc::IncrementalDocStatCalculate(long nChars)
+bool SwDoc::IncrementalDocStatCalculate( long nChars, bool bFields )
{
pDocStat->Reset();
pDocStat->nPara = 0; // default is 1!
@@ -1771,8 +1771,11 @@ bool SwDoc::IncrementalDocStatCalculate(long nChars)
}
// optionally update stat. fields
- SwFieldType *pType = GetSysFldType(RES_DOCSTATFLD);
- pType->UpdateFlds();
+ if (bFields)
+ {
+ SwFieldType *pType = GetSysFldType(RES_DOCSTATFLD);
+ pType->UpdateFlds();
+ }
return nChars <= 0;
}
@@ -1780,7 +1783,7 @@ bool SwDoc::IncrementalDocStatCalculate(long nChars)
IMPL_LINK( SwDoc, DoIdleStatsUpdate, Timer *, pTimer )
{
(void)pTimer;
- if (IncrementalDocStatCalculate(32000))
+ if (IncrementalDocStatCalculate(32000, true))
aStatsUpdateTimer.Start();
SwView* pView = GetDocShell() ? GetDocShell()->GetView() : NULL;
@@ -1789,16 +1792,16 @@ IMPL_LINK( SwDoc, DoIdleStatsUpdate, Timer *, pTimer )
return 0;
}
-void SwDoc::UpdateDocStat( bool bCompleteAsync )
+void SwDoc::UpdateDocStat( bool bCompleteAsync, bool bFields )
{
if( pDocStat->bModified )
{
if (!bCompleteAsync)
{
- while (IncrementalDocStatCalculate(5000)) {}
+ while (IncrementalDocStatCalculate(5000, bFields)) {}
aStatsUpdateTimer.Stop();
}
- else if (IncrementalDocStatCalculate(5000))
+ else if (IncrementalDocStatCalculate(5000, bFields))
aStatsUpdateTimer.Start();
}
}
diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx
index b6a7d1020280..81f81b647016 100644
--- a/sw/source/ui/uiview/view2.cxx
+++ b/sw/source/ui/uiview/view2.cxx
@@ -1253,7 +1253,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet)
SwDocStat documentStats;
{
rShell.CountWords(selectionStats);
- documentStats = rShell.GetDoc()->GetUpdatedDocStat( true /* complete-async */ );
+ documentStats = rShell.GetDoc()->GetUpdatedDocStat( true /* complete-async */, false /* don't update fields */ );
}
const sal_uInt32 stringId = selectionStats.nWord? STR_STATUSBAR_WORDCOUNT : STR_STATUSBAR_WORDCOUNT_NO_SELECTION;