[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/inc sw/source
Miklos Vajna
vmiklos at suse.cz
Tue Jul 16 15:09:11 PDT 2013
sw/inc/IDocumentStatistics.hxx | 6 ++++--
sw/inc/doc.hxx | 7 ++++---
sw/source/core/doc/doc.cxx | 19 +++++++++++--------
sw/source/ui/uiview/view2.cxx | 2 +-
4 files changed, 20 insertions(+), 14 deletions(-)
New commits:
commit 699b7626222ea8be1c9713a7f5e274dbfbc029ff
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Tue Jul 16 18:26:18 2013 +0200
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 at canonical.com>
Tested-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>
diff --git a/sw/inc/IDocumentStatistics.hxx b/sw/inc/IDocumentStatistics.hxx
index 2c5a0501..950ea49 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 0769ae2..98a0c30 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -912,9 +912,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
*/
@@ -2087,10 +2087,11 @@ private:
/** continue computing a chunk of document statistics
* \param nTextNodes number of paragraphs to calculate before
* exiting
+ * \param bFields if stat. fields should be updated
*
* returns false when there is no more to calculate
*/
- bool IncrementalDocStatCalculate(long nTextNodes = 250);
+ bool IncrementalDocStatCalculate(long nTextNodes = 250, bool bFields = true);
/// 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 ba3c943..f52766d 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1120,11 +1120,11 @@ const SwDocStat& SwDoc::GetDocStat() const
return *mpDocStat;
}
-const SwDocStat& SwDoc::GetUpdatedDocStat( bool bCompleteAsync )
+const SwDocStat& SwDoc::GetUpdatedDocStat( bool bCompleteAsync, bool bFields )
{
if( mpDocStat->bModified )
{
- UpdateDocStat( bCompleteAsync );
+ UpdateDocStat( bCompleteAsync, bFields );
}
return *mpDocStat;
}
@@ -1644,7 +1644,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting(
}
// returns true while there is more to do
-bool SwDoc::IncrementalDocStatCalculate( long nTextNodes )
+bool SwDoc::IncrementalDocStatCalculate( long nTextNodes, bool bFields )
{
mpDocStat->Reset();
mpDocStat->nPara = 0; // default is 1!
@@ -1728,8 +1728,11 @@ bool SwDoc::IncrementalDocStatCalculate( long nTextNodes )
}
// optionally update stat. fields
- SwFieldType *pType = GetSysFldType(RES_DOCSTATFLD);
- pType->UpdateFlds();
+ if (bFields)
+ {
+ SwFieldType *pType = GetSysFldType(RES_DOCSTATFLD);
+ pType->UpdateFlds();
+ }
return nTextNodes <= 0;
}
@@ -1746,16 +1749,16 @@ IMPL_LINK( SwDoc, DoIdleStatsUpdate, Timer *, pTimer )
return 0;
}
-void SwDoc::UpdateDocStat( bool bCompleteAsync )
+void SwDoc::UpdateDocStat( bool bCompleteAsync, bool bFields )
{
if( mpDocStat->bModified )
{
if (!bCompleteAsync)
{
- while (IncrementalDocStatCalculate()) {}
+ while (IncrementalDocStatCalculate(250, bFields)) {}
maStatsUpdateTimer.Stop();
}
- else if (IncrementalDocStatCalculate())
+ else if (IncrementalDocStatCalculate(250, bFields))
maStatsUpdateTimer.Start();
}
}
diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx
index f490aab..990d485 100644
--- a/sw/source/ui/uiview/view2.cxx
+++ b/sw/source/ui/uiview/view2.cxx
@@ -1269,7 +1269,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;
More information about the Libreoffice-commits
mailing list