From a21553033660c919b2876e752653f1051baadfaa Mon Sep 17 00:00:00 2001 From: Muhammad Haggag Date: Thu, 24 May 2012 19:49:41 +0200 Subject: [PATCH 2/2] Followup to fdo#34772: Added resource strings for word-count messages. Change-Id: I7b32f5b6ed973fd4ad4635a5265d75d4e51f04ba --- sw/source/ui/app/app.src | 10 ++++++++++ sw/source/ui/inc/app.hrc | 6 +++++- sw/source/ui/uiview/view2.cxx | 13 +++++++++---- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/sw/source/ui/app/app.src b/sw/source/ui/app/app.src index 890e8b9..3dc412b 100644 --- a/sw/source/ui/app/app.src +++ b/sw/source/ui/app/app.src @@ -550,6 +550,16 @@ String STR_OUTLINE_NUMBERING Text [ en-US ] = "Outline Numbering"; }; +String STR_STATUSBAR_WORDCOUNT_NO_SELECTION +{ + Text [ en-US ] = "Words: $1"; +}; + +String STR_STATUSBAR_WORDCOUNT +{ + Text [ en-US ] = "Words: $1 Selected: $2"; +}; + ToolBox RID_MODULE_TOOLBOX { HelpID = HID_MODULE_TOOLBOX ; diff --git a/sw/source/ui/inc/app.hrc b/sw/source/ui/inc/app.hrc index 5de0537..95356a5 100644 --- a/sw/source/ui/inc/app.hrc +++ b/sw/source/ui/inc/app.hrc @@ -125,7 +125,11 @@ #define STR_FDLG_STYLE (RC_APP_BEGIN + 106) //<-end,zhaojianwei -#define APP_ACT_END STR_FDLG_STYLE +// Status bar strings +#define STR_STATUSBAR_WORDCOUNT_NO_SELECTION (RC_APP_BEGIN + 110) +#define STR_STATUSBAR_WORDCOUNT (RC_APP_BEGIN + 111) + +#define APP_ACT_END STR_STATUSBAR_WORDCOUNT #if APP_ACT_END > RC_APP_END #error Resource-Id Ueberlauf in #file, #line diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index 9fc7179..7b37adb 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -1210,10 +1210,15 @@ void SwView::StateStatusLine(SfxItemSet &rSet) documentStats = rShell.GetUpdatedDocStat(); rShell.EndAction(); } - rSet.Put(SfxStringItem(FN_STAT_WORDCOUNT, rtl::OUStringBuffer("Words: ") - .append(rtl::OUString::valueOf(static_cast(selectionStats.nWord))) - .append('/') - .append(rtl::OUString::valueOf(static_cast(documentStats.nWord))).makeStringAndClear())); + + const sal_uInt32 stringId = selectionStats.nWord? STR_STATUSBAR_WORDCOUNT : STR_STATUSBAR_WORDCOUNT_NO_SELECTION; + rtl::OUString wordCount(SW_RES(stringId)); + wordCount = wordCount.replaceAll("$1", rtl::OUString::valueOf(static_cast(documentStats.nWord))); + if (selectionStats.nWord) + { + wordCount = wordCount.replaceAll("$2", rtl::OUString::valueOf(static_cast(selectionStats.nWord))); + } + rSet.Put(SfxStringItem(FN_STAT_WORDCOUNT, wordCount)); } break; -- 1.7.9.5