diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-07-16 18:26:18 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-07-16 18:46:20 +0200 |
commit | e2484e3998f2c5036fb8e3584d4b1c72db19bfd3 (patch) | |
tree | ea31615acfe120cacf3b5ccb31710ca95b098b96 | |
parent | 8c9f41f2e6600296e3663c681b3902d2a4d7bbd6 (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.
Change-Id: If237df1f31436357022ca8d77b924681e403abd8
-rw-r--r-- | sw/inc/IDocumentStatistics.hxx | 6 | ||||
-rw-r--r-- | sw/inc/doc.hxx | 7 | ||||
-rw-r--r-- | sw/source/core/doc/doc.cxx | 19 | ||||
-rw-r--r-- | sw/source/ui/uiview/view2.cxx | 2 |
4 files changed, 20 insertions, 14 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 9a6d715b8774..854b86992bae 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -910,9 +910,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 */ @@ -2082,10 +2082,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 139735dac7bc..4840727cb3a9 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 9865284f6242..3805b6980511 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -1268,7 +1268,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; |