This is a long-standing OOorg feature request (8 years to be more precise: http://www.openoffice.org/issues/show_bug.cgi?id=10356), hopefully it can be implemented in LibreOffice.
I think we can, but it realy make sense? I mean, professional translators are a small group of OOo Users, so for a load of people this feature is not important. This is the reason why we have extensions.
We can maby writhe a extension who also indludes price calculator. Ok th function you request is not big but maybe we can writhe samething better if we take the Extension Solution. what you think about?
Well, I wouldn't be so dismissive of this enhancement right off the butt. If this satisfies even a small group of user base, we should at least give it a fair consideration. Also, regarding using extension, we already have the word count dialog there; it may be much simpler to extend that to include this enhancement than moving the whole thing (or just the requested functionality) into an extension.
Anyway, that's my opinion.
I have added this to the EasyHacks page - sounds reasonably easy for somebody interested.
for the counting it looks like the interesting function is:
void SwTxtNode::CountWords( SwDocStat& rStat, xub_StrLen nStt, xub_StrLen nEnd ) const
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 19af890..ac83925 100644
@@ -1885,6 +1885,7 @@ void SwTxtNode::CountWords( SwDocStat& rStat,
ULONG nTmpWords = 0;
ULONG nTmpChars = 0;
+ ULONG nTmpWordsChars = 0; // Count the umber of chars used in words
// Shortcut: Whole paragraph should be considered and cached values
// are valid:
@@ -1892,6 +1893,7 @@ void SwTxtNode::CountWords( SwDocStat& rStat,
nTmpWords = GetParaNumberOfWords();
nTmpChars = GetParaNumberOfChars();
+ nTmpWordsChars = GetParaNumberOfWordsChars();
@@ -1925,9 +1927,14 @@ void SwTxtNode::CountWords( SwDocStat& rStat,
while ( aScanner.NextWord() )
- if ( aScanner.GetLen() > 1 ||
- CH_TXTATR_BREAKWORD != aExpandText.match(aBreakWord, aScanner.GetBegin() ) )
+ if(CH_TXTATR_BREAKWORD != ExpandText.match(aBreakWord, aScanner.GetBegin() ))
+ if ( aScanner.GetLen() > 1)
+ nTmpWordsChar += aScanner.GetLen();
should count the number of characters used in 'words' in a textnode.
which then need to be accumulated in the stat of the document...
then of course there are gui change to display it, and possibly some change to be able to store it in the saved document (in order not to recalculated it at every open...)...
That I have no clue where and how yet...
Just another opinion, should this important but very specialized feature not be offered in the form of an optional and external extension?
Adding "EasyHacks" to summary to make it findable.
I've started a patch for this request.
I have emailed Arnaud and he yielded this project to me - I did not mean to scare him off. I have done some analysis and proto/junk hacking.
I am drafting a plan beyond the basic fix requested here. There are currently several hard-coded exclusions/inclusions for notes, hidden and other textnode subtypes. It should be possible to come up with a system that gives a user option for where to count (what nodes to include?) and what to count (what is white? what else gets excluded?).
The plan will include involving Doc people in specifying what actual users want in this area by using TDF Wiki. Freelancers and contractors who write or translate for a living use word and character counts to estimate time for bids, to measure progress in the work and to bill for work done. There are dozens of dup/related bugs in the OO issuezilla e.g. 4568, 10356) and they make all kinds of feature requests. The Doc people (OO's committed user base) will have a better take on what users really need and want in this area.
LeMoyne - JLCastle
Sorry, you weren't quick enough: someone already fixed it ;)
Gratz to Mattias Johnsson. From looking at his patch the basic fix is in. I let myself get bogged down in warm-up patches, other stuff and the greater problem here. I still believe that the Documentation people will have much to say about what tools are useful to writers in this area of doc stats.
Thanks for this great implementation.
If you add character count without spaces, it will be great to add also paragraph counter in one step.
The paragraph counter is already implemented, we need only display it.
Created attachment 39950 [details]
Screenshot showing the wrong word count.
There is something wrong with selection ending with a punctuation. See the attached screenshot, the number of characters is the same for the those counted without space where it's not for those counted with space. Reopening - Sophie
(In reply to comment #12)
> There is something wrong with selection ending with a punctuation. See the
> attached screenshot, the number of characters is the same for the those counted
> without space where it's not for those counted with space. Reopening - Sophie
It's not only with selections ending with a punctuation.
The text "Selection." will always give 10 characters without spaces.
For example, Selecting the 'l' will give 1 word, 1 character and 10 characters without spaces. Selecting 'le' will give 1 word, 2 characters and 10 characters without spaces.
Created attachment 40320 [details]
Test case for bug, not reproduced.
I am unable to resproduce sophie's test case on Ubuntu 10.10 with version LIBREOFFICE_3_3_FREEZE-86-gbb8af21
I just tried the 3rd beta and I'm really happy with the progress that you have made with this feature. So as my way of saying thanks I made a little donation to LibreOffice.
Keep up the good work!
I also can't reproduce the bug on Ubuntu 10.04 (64bit) in the trunk
For issue in comment 11 and comment 12, fixed in this commit:
Note that this is specific to LibO 3.3.x release, because in -3-4 and master, they've been fixed after branching of -3-3:
Mark as FIXED/RESOLVED
Migrating Whiteboard tags to Keywords: (EasyHack)