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