[PATCH] fdo#34772 Word count / statistics in the status bar

Ivan Timofeev timofeev.i.s at gmail.com
Sat May 26 11:06:41 PDT 2012


Hi all,

this patch makes scrolling in writer impossible :( it always brings the 
view back to the cursor (btw so does Tools -> Word Count, but only once 
it is invoked).

It looks like the cause is the following lines:

@@ -1197,6 +1198,25 @@ void SwView::StateStatusLine(SfxItemSet &rSet)
                  }
              }
              break;
+
+            case FN_STAT_WORDCOUNT:
+            {
+                SwDocStat selectionStats;
+                SwDocStat documentStats;
+                {
+                    SwWait aWait( *GetDocShell(), sal_True );
+                    rShell.StartAction();
+                    rShell.CountWords(selectionStats);
+                    documentStats = rShell.GetUpdatedDocStat();
+                    rShell.EndAction();
+                }
+                rSet.Put(SfxStringItem(FN_STAT_WORDCOUNT, 
rtl::OUStringBuffer("Words: ")
+ 
.append(rtl::OUString::valueOf(static_cast<sal_Int64>(selectionStats.nWord)))
+                                                            .append('/')
+ 
.append(rtl::OUString::valueOf(static_cast<sal_Int64>(documentStats.nWord))).makeStringAndClear()));
+            }
+            break;


Any idea? How to count words without changing a viewpoint?

Regards,
Ivan


More information about the LibreOffice mailing list