The request was raised on Twitter (https://twitter.com/sfmnemonic/status/1083379610035896323) to improve the word count in Writer. We have <n> words, <m> characters currently either for all text or the selection. On click the dialog shows some more info. Sounds sufficient to me, in particular with the selection forward/backward the current position, and I would resolve the request as WFM. However the code is simple and enhancements would be possible as easy hacks.
In the first step we should count the words/characters before and after the cursor and show this information at the dialog. The second step with be to provide an option to switch between the different variants, perhaps per radio button in the dialog. Bjoern offered mentoring...
Bjoern, could you please add a few code pointers to allow Izabella to start? I jump in with pleasure when in comes to the UI.
No code pointers, no easy hack. Please reassign if you want, Izabella.
The dialog is implemented in sw/source/ui/dialog/wordcountdialog.cxx. Values are taken from SwDocStat (sw/source/core/doc/docstat.cxx) updated probably per SwDoc::CountWords() but since CountWords has several implementations I'm not sure here. Expert knowledge needed, Bjoern.
*** Bug 123333 has been marked as a duplicate of this bug. ***
*** Bug 150631 has been marked as a duplicate of this bug. ***
Re-evaluating the EasyHack in 2023 This issue is still relevant, as the word count dialog in Writer is the same as before.
(In reply to Heiko Tietze from comment #0) > The request was raised on Twitter > (https://twitter.com/sfmnemonic/status/1083379610035896323) it seems to me that the tweet has been deleted, I can't access it, what's the requested enhancement?
(In reply to Abdallah Elhdad from comment #8) > (In reply to Heiko Tietze from comment #0) > > The request was raised on Twitter > > (https://twitter.com/sfmnemonic/status/1083379610035896323) > > it seems to me that the tweet has been deleted, I can't access it, what's > the requested enhancement? The requested enhancement is described in this report, you don't need that tweet.
I'm almost done with the solution for this, but I'm a bit confused. how should I deal with the extracted two objects of SwDocStat -for the char, word count before and after the cursor-, in the function SwEditShell::CountWords, it passes only one object, should I change the signature of the function? or create a new function that takes two SwDocStat objects as [out]? another question is how I should approach the UI?, with the consideration of two labels of `Selection` and `Document` on top of the dialog.
(In reply to Abdallah Elhdad from comment #10) > I'm almost done with the solution for this, but I'm a bit confused. > > how should I deal with the extracted two objects of SwDocStat -for the char, > word count before and after the cursor-, in the function > SwEditShell::CountWords, it passes only one object, should I change the > signature of the function? or create a new function that takes two SwDocStat > objects as [out]? You decide :-). Submit a patch and let the developers review. > another question is how I should approach the UI?, with the consideration of > two labels of `Selection` and `Document` on top of the dialog. Create a ui file with Glade (or just hack the XML yourself), add controls to your liking, and load it with welding as done on other places. To make a dialog nice and informative it needs more than two information. Could imagine: * Total word/character count * Selection word/character count * Before/After cursor word/character count <- this is the request actually * Number of pages, chapters, figures... Don't worry if the dialog has design flaws. Happy to improve this later.
Created attachment 186582 [details] Mockup (In reply to Heiko Tietze from comment #11) > You decide :-). Submit a patch and let the developers review. I will work on it in a new -not missy- branch and push for sure! > To make a dialog nice and informative it needs more than two information. > Could imagine: > * Total word/character count > * Selection word/character count > * Before/After cursor word/character count <- this is the request actually > * Number of pages, chapters, figures... maybe in the future, the redesign of the dialog is considered -due to different measures-, for now, I will work with this mockup I made if you have any comments.
(In reply to Abdallah Elhdad from comment #12) > Created attachment 186582 [details] > Mockup LGTM, before/after needs to get separated of course. Not sure if characters before/after is needed. > (In reply to Heiko Tietze from comment #11) > I will work on it in a new -not missy- branch and push for sure! As long the patch is not submitted it's fine to work on master. And submission is done after the review process. > maybe in the future, the redesign of the dialog is considered -due to > different measures-, for now, I will work with this mockup I made if you > have any comments. Sounds good.
(In reply to Heiko Tietze from comment #13) > LGTM, before/after needs to get separated of course. Not sure if characters > before/after is needed. in comment #1 adding a char count was suggested, adding the char' count is an easyHack, I will work on the word count for now.
I don't know if it's a good practice to mention here that I pushed a patch, someone let me know please:) oh btw, I did push a patch and it's waiting for a review:) https://gerrit.libreoffice.org/c/core/+/150309
(In reply to Abdallah Elhdad from comment #15) > I don't know if it's a good practice to mention here that I pushed a patch, > someone let me know please:) > > oh btw, I did push a patch and it's waiting for a review:) > > https://gerrit.libreoffice.org/c/core/+/150309 The patch was never finished, so someone else can create a new patch based on it after carefully reading the last review comments. An appropriate line should be added to the end of the commit message indicating co-author: Co-authored-by: name <name@example.com>