[Libreoffice-commits] core.git: 2 commits - sw/inc sw/source xmloff/source
Michael Stahl
mstahl at redhat.com
Tue Aug 13 09:50:13 PDT 2013
sw/inc/doc.hxx | 5 ++---
sw/source/core/doc/doc.cxx | 17 ++++++++++-------
xmloff/source/text/txtparae.cxx | 2 +-
3 files changed, 13 insertions(+), 11 deletions(-)
New commits:
commit 91c8008051c0bb7905a6acd822d022e144f2941f
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Aug 13 18:39:08 2013 +0200
fdo#58040: sw: fine tune async word count
- count characters instead of paragraphs to better account for large or
small paragraphs
- start out with a relatively small value (5k chars) on the first run to
quickly show something to the user
Change-Id: Ic4013545692f267aab39e084415d5d794bb5a4ca
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 89f6c05..3e23690 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -2080,13 +2080,12 @@ private:
void CopyMasterFooter(const SwPageDesc &rChged, const SwFmtFooter &rFoot, SwPageDesc *pDesc, bool bLeft);
/** continue computing a chunk of document statistics
- * \param nTextNodes number of paragraphs to calculate before
- * exiting
+ * \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 nTextNodes = 250, bool bFields = true);
+ bool IncrementalDocStatCalculate(long nChars, 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 5fe4cb6..6675507 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1648,22 +1648,25 @@ void SwDoc::CalculatePagePairsForProspectPrinting(
}
// returns true while there is more to do
-bool SwDoc::IncrementalDocStatCalculate( long nTextNodes, bool bFields )
+bool SwDoc::IncrementalDocStatCalculate(long nChars, bool bFields)
{
mpDocStat->Reset();
mpDocStat->nPara = 0; // default is 1!
SwNode* pNd;
// This is the inner loop - at least while the paras are dirty.
- for( sal_uLong i = GetNodes().Count(); i > 0 && nTextNodes > 0; )
+ for( sal_uLong i = GetNodes().Count(); i > 0 && nChars > 0; )
{
switch( ( pNd = GetNodes()[ --i ])->GetNodeType() )
{
case ND_TEXTNODE:
{
+ long const nOldChars(mpDocStat->nChar);
SwTxtNode *pTxt = static_cast< SwTxtNode * >( pNd );
if (pTxt->CountWords(*mpDocStat, 0, pTxt->GetTxt().getLength()))
- nTextNodes--;
+ {
+ nChars -= (mpDocStat->nChar - nOldChars);
+ }
break;
}
case ND_TABLENODE: ++mpDocStat->nTbl; break;
@@ -1738,13 +1741,13 @@ bool SwDoc::IncrementalDocStatCalculate( long nTextNodes, bool bFields )
pType->UpdateFlds();
}
- return nTextNodes <= 0;
+ return nChars <= 0;
}
IMPL_LINK( SwDoc, DoIdleStatsUpdate, Timer *, pTimer )
{
(void)pTimer;
- if( IncrementalDocStatCalculate( 1000 ) )
+ if (IncrementalDocStatCalculate(32000))
maStatsUpdateTimer.Start();
SwView* pView = GetDocShell() ? GetDocShell()->GetView() : NULL;
@@ -1759,10 +1762,10 @@ void SwDoc::UpdateDocStat( bool bCompleteAsync, bool bFields )
{
if (!bCompleteAsync)
{
- while (IncrementalDocStatCalculate(250, bFields)) {}
+ while (IncrementalDocStatCalculate(5000, bFields)) {}
maStatsUpdateTimer.Stop();
}
- else if (IncrementalDocStatCalculate(250, bFields))
+ else if (IncrementalDocStatCalculate(5000, bFields))
maStatsUpdateTimer.Start();
}
}
commit 9e2351ffd9dc7876c1071e5b6eed10ba9aaae2cd
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Aug 13 16:06:01 2013 +0200
XMLTextParagraphExport: not finding auto style means data loss
... so use assert() to get attention for such problems.
Change-Id: I4aea1a1cb5ad497583024b326f27fb73e5be9bb7
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 6686669..7dc6bd6 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -798,7 +798,7 @@ OUString XMLTextParagraphExport::FindTextStyleAndHyperlink(
}
OUString sParent; // AutoStyles should not have parents!
sName = GetAutoStylePool().Find( XML_STYLE_FAMILY_TEXT_TEXT, sParent, xPropStates );
- DBG_ASSERT( !sName.isEmpty(), "AutoStyle could not be found" );
+ assert(!sName.isEmpty()); // AutoStyle could not be found
rbHasAutoStyle = sal_True;
}
More information about the Libreoffice-commits
mailing list