Resolves: fdo#51818 format word count numbers with locale rules

Change-Id: Ia203a622ab2cd63d644895bb792b0569a61eb81a
This commit is contained in:
Caolán McNamara
2014-04-07 12:12:50 +01:00
parent 66154591e8
commit eae2e87ba4

View File

@@ -29,7 +29,9 @@
#include <comphelper/string.hxx> #include <comphelper/string.hxx>
#include <sfx2/viewfrm.hxx> #include <sfx2/viewfrm.hxx>
#include <svl/cjkoptions.hxx> #include <svl/cjkoptions.hxx>
#include <unotools/localedatawrapper.hxx>
#include <vcl/msgbox.hxx> #include <vcl/msgbox.hxx>
#include <vcl/settings.hxx>
IMPL_LINK_NOARG(SwWordCountFloatDlg, CloseHdl) IMPL_LINK_NOARG(SwWordCountFloatDlg, CloseHdl)
{ {
@@ -48,23 +50,23 @@ SwWordCountFloatDlg::~SwWordCountFloatDlg()
namespace namespace
{ {
void setValue(FixedText *pWidget, sal_uLong nValue) void setValue(FixedText *pWidget, sal_uLong nValue, const LocaleDataWrapper& rLocaleData)
{ {
OUString sValue(OUString::number(nValue)); pWidget->SetText(rLocaleData.getNum(nValue, 0));
pWidget->SetText(sValue);
} }
} }
void SwWordCountFloatDlg::SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc) void SwWordCountFloatDlg::SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc)
{ {
setValue(m_pCurrentWordFT, rCurrent.nWord); const LocaleDataWrapper& rLocaleData = GetSettings().GetUILocaleDataWrapper();
setValue(m_pCurrentCharacterFT, rCurrent.nChar); setValue(m_pCurrentWordFT, rCurrent.nWord, rLocaleData);
setValue(m_pCurrentCharacterExcludingSpacesFT, rCurrent.nCharExcludingSpaces); setValue(m_pCurrentCharacterFT, rCurrent.nChar, rLocaleData);
setValue(m_pCurrentCjkcharsFT, rCurrent.nAsianWord); setValue(m_pCurrentCharacterExcludingSpacesFT, rCurrent.nCharExcludingSpaces, rLocaleData);
setValue(m_pDocWordFT, rDoc.nWord); setValue(m_pCurrentCjkcharsFT, rCurrent.nAsianWord, rLocaleData);
setValue(m_pDocCharacterFT, rDoc.nChar); setValue(m_pDocWordFT, rDoc.nWord, rLocaleData);
setValue(m_pDocCharacterExcludingSpacesFT, rDoc.nCharExcludingSpaces); setValue(m_pDocCharacterFT, rDoc.nChar, rLocaleData);
setValue(m_pDocCjkcharsFT, rDoc.nAsianWord); setValue(m_pDocCharacterExcludingSpacesFT, rDoc.nCharExcludingSpaces, rLocaleData);
setValue(m_pDocCjkcharsFT, rDoc.nAsianWord, rLocaleData);
bool bShowCJK = (SvtCJKOptions().IsAnyEnabled() || rDoc.nAsianWord); bool bShowCJK = (SvtCJKOptions().IsAnyEnabled() || rDoc.nAsianWord);
bool bToggleCJK = m_pCurrentCjkcharsFT->IsVisible() != bShowCJK; bool bToggleCJK = m_pCurrentCjkcharsFT->IsVisible() != bShowCJK;