Hi,<br><br>
New version of the patch. I have added a method : 
IDocumentStatistic::GetUpdatedDocStat wich check state before returning. I
 left some UpdateDocStat but I will continue it later.<br><br>Sorry for the first patch.<br><br><div class="gmail_quote">2011/8/19 Caolán McNamara <span dir="ltr">&lt;<a href="mailto:caolanm@redhat.com">caolanm@redhat.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Wed, 2011-08-17 at 21:04 +0200, Arnaud Versini wrote:<br>
&gt; Hi<br>
&gt;<br>
&gt; This patch remove unnecessary parameter SwDocStat&amp; rStat to the method<br>
&gt; IDocumentStatistics::UpdateDocStat and also limit copy of SwDocStat<br>
&gt; during file saving and statistic dialog.<br>
<br>
</div>There&#39;s a bug in the last hunk anyway,<br>
<br>
         {<br>
             SwDocStat aStat(pDocShell-&gt;GetDoc()-&gt;GetDocStat());<br>
             if(aStat.bModified)<br>
-                pDocShell-&gt;GetDoc()-&gt;UpdateDocStat( aStat );<br>
+                pDocShell-&gt;GetDoc()-&gt;UpdateDocStat();<br>
<br>
i.e. the &quot;aStat&quot; is a copy so after the UpdateDocStat is called, it&#39;s an<br>
unchanged copy, not a reference to an updated SwDocStat like it used to<br>
be, so a line or two later nValue = aStat.nChar will be wrong.<br>
<br>
Is there a specific problem you&#39;re trying to fix here ?<br></blockquote><div><br>This is only for refactoring, I&#39;ve seen some things to change when I have patched fdo#36931.</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


<br>
Looking through the DocStat stuff it looks a bit messy. Seems of it<br>
appears to want to give access to the document statistics for a fast<br>
query by some code that the stats need to be updated, and by other code<br>
just to get the stats. And some bits fail to check for bModified and<br>
force an update and some do. And the awesome rtf filter const_casts the<br>
document doc stat and updates it directly.<br></blockquote><div><br>This rtf filter will be replaced with GSoC? <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


<br>
If we want to refactor this then I suggest...<br>
<br>
a) move &quot;bModified&quot; out of the SwDocStat and add something like bool<br>
areStatsStale/statsNeedUpdating to IDocumentStatistics instead to query<br>
this fact<br></blockquote><div><br>I will do this for shells I think<br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
b) have IDocumentStatistics::GetDocStat always return updated document<br>
stats instead of having to get them, find out if they are stale and<br>
update them if they are.<br></blockquote><div><br>Done with a new method <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
That would probably avoid the problems of needing to directly call<br>
UpdateDocStat for the general case where someone just wants to get<br>
up-to-date stats, but allow any special cases of calling UpdateDocStat<br>
when areStatsStale is true in order to force update of fields that<br>
display the doc stats.<br>
<font color="#888888"><br>
C.<br>
<br>
</font></blockquote></div>Thanks<br><br clear="all"><br>-- <br>Arnaud Versini<br>