[Libreoffice-commits] core.git: sw/source

Samuel Mehrbrodt s.mehrbrodt at gmail.com
Fri Nov 15 01:59:46 PST 2013


 sw/source/ui/app/app.src      |    4 ++--
 sw/source/ui/uiview/view2.cxx |   15 ++++++---------
 2 files changed, 8 insertions(+), 11 deletions(-)

New commits:
commit 01af3e2efd4f7e0994340cb5b09c252323de63d9
Author: Samuel Mehrbrodt <s.mehrbrodt at gmail.com>
Date:   Tue Oct 29 20:36:22 2013 +0100

    fdo#70978 Improve Word Count display
    
    Change-Id: I82b81d2fd33be47987268fbd3b32d461a136acf8
    Reviewed-on: https://gerrit.libreoffice.org/6479
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/ui/app/app.src b/sw/source/ui/app/app.src
index e5c6ac6..bc8cd0e 100644
--- a/sw/source/ui/app/app.src
+++ b/sw/source/ui/app/app.src
@@ -506,12 +506,12 @@ String STR_OUTLINE_NUMBERING
 
 String STR_STATUSBAR_WORDCOUNT_NO_SELECTION
 {
-    Text [ en-US ] = "Words (characters): $1 ($2)";
+    Text [ en-US ] = "%1 words, %2 characters";
 };
 
 String STR_STATUSBAR_WORDCOUNT
 {
-    Text [ en-US ] = "Words (characters): $1 ($2) Selected: $3 ($4)";
+    Text [ en-US ] = "%1 words, %2 characters selected";
 };
 
 String STR_CONVERT_TEXT_TABLE
diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx
index eae1397..388cf6a 100644
--- a/sw/source/ui/uiview/view2.cxx
+++ b/sw/source/ui/uiview/view2.cxx
@@ -1266,15 +1266,12 @@ void SwView::StateStatusLine(SfxItemSet &rSet)
                     documentStats = rShell.GetDoc()->GetUpdatedDocStat( true /* complete-async */, false /* don't update fields */ );
                 }
 
-                const sal_uInt32 stringId = selectionStats.nWord? STR_STATUSBAR_WORDCOUNT : STR_STATUSBAR_WORDCOUNT_NO_SELECTION;
-                OUString wordCount(SW_RES(stringId));
-                wordCount = wordCount.replaceAll("$1", OUString::number(documentStats.nWord));
-                wordCount = wordCount.replaceAll("$2", OUString::number(documentStats.nChar));
-                if (selectionStats.nWord)
-                {
-                    wordCount = wordCount.replaceAll("$3", OUString::number(selectionStats.nWord));
-                    wordCount = wordCount.replaceAll("$4", OUString::number(selectionStats.nChar));
-                }
+                OUString wordCount(SW_RES(selectionStats.nWord ?
+                                          STR_STATUSBAR_WORDCOUNT : STR_STATUSBAR_WORDCOUNT_NO_SELECTION));
+                wordCount = wordCount.replaceFirst("%1",
+                                OUString::number(selectionStats.nWord ? selectionStats.nWord : documentStats.nWord));
+                wordCount = wordCount.replaceFirst("%2",
+                                OUString::number(selectionStats.nChar ? selectionStats.nChar : documentStats.nChar));
                 rSet.Put(SfxStringItem(FN_STAT_WORDCOUNT, wordCount));
 
                 SwWordCountWrapper *pWrdCnt = (SwWordCountWrapper*)GetViewFrame()->GetChildWindow(SwWordCountWrapper::GetChildWindowId());


More information about the Libreoffice-commits mailing list