sw/inc/IDocumentStatistics.hxx | 6 ++++-- sw/inc/doc.hxx | 7 ++++--- sw/source/core/doc/doc.cxx | 21 ++++++++++++--------- sw/source/ui/uiview/view2.cxx | 2 +- 4 files changed, 21 insertions(+), 15 deletions(-)
New commits: commit 563d441f9401d8868fae0dc379e9b712019325e7 Author: Miklos Vajna <vmik...@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.michael...@canonical.com> Tested-by: Björn Michaelsen <bjoern.michael...@canonical.com> (cherry picked from commit 699b7626222ea8be1c9713a7f5e274dbfbc029ff) This also fixes fdo#67223. Signed-off-by: Michael Stahl <mst...@redhat.com> Conflicts: sw/inc/doc.hxx sw/source/core/doc/doc.cxx 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 7f5488c..6bccac2 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 ad19161..667ef5c 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 b6a7d10..81f81b6 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;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits