diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-06-15 06:32:33 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-06-15 06:44:12 +0200 |
commit | 146cc7a3ad8b07889dff64cf6d3db21e2d6d2147 (patch) | |
tree | ec3a1a6aa0ad02696d5ec3faf32614f9431baceb /sc | |
parent | handle formula is in new conditional format dlg (diff) | |
download | core-146cc7a3ad8b07889dff64cf6d3db21e2d6d2147.tar.gz core-146cc7a3ad8b07889dff64cf6d3db21e2d6d2147.zip |
use correct localization aware string to double
Change-Id: Ied254ef0dc8f7dcf444738da193122a733089b5a
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/condformat/colorformat.cxx | 21 | ||||
-rw-r--r-- | sc/source/ui/condformat/condformatdlg.cxx | 11 | ||||
-rw-r--r-- | sc/source/ui/inc/colorformat.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/inc/condformatdlg.hxx | 1 |
4 files changed, 23 insertions, 12 deletions
diff --git a/sc/source/ui/condformat/colorformat.cxx b/sc/source/ui/condformat/colorformat.cxx index 24833649882b..ba54db22c292 100644 --- a/sc/source/ui/condformat/colorformat.cxx +++ b/sc/source/ui/condformat/colorformat.cxx @@ -83,9 +83,10 @@ void SetType(const ScColorScaleEntry* pEntry, ListBox& aLstBox) aLstBox.SelectEntryPos(4); } -void GetType(const ListBox& rLstBox, const Edit& rEd, ScColorScaleEntry* pEntry ) +void GetType(const ListBox& rLstBox, const Edit& rEd, ScColorScaleEntry* pEntry, SvNumberFormatter* pNumberFormatter ) { double nVal = 0; + sal_uInt32 nIndex = 0; switch(rLstBox.GetSelectEntryPos()) { case 0: @@ -96,16 +97,16 @@ void GetType(const ListBox& rLstBox, const Edit& rEd, ScColorScaleEntry* pEntry break; case 2: pEntry->SetPercentile(true); - nVal = rtl::math::stringToDouble(rEd.GetText(), '.', ','); + pNumberFormatter->IsNumberFormat( rEd.GetText(), nIndex, nVal ); pEntry->SetValue(nVal); break; case 3: - nVal = rtl::math::stringToDouble(rEd.GetText(), '.', ','); pEntry->SetPercent(true); + pNumberFormatter->IsNumberFormat( rEd.GetText(), nIndex, nVal ); pEntry->SetValue(nVal); break; case 4: - nVal = rtl::math::stringToDouble(rEd.GetText(), '.', ','); + pNumberFormatter->IsNumberFormat( rEd.GetText(), nIndex, nVal ); pEntry->SetHasValue(); pEntry->SetValue(nVal); break; @@ -305,8 +306,8 @@ ScDataBarFormatData* ScDataBarSettingsDlg::GetData() pData->mpUpperLimit.reset(new ScColorScaleEntry()); pData->mpLowerLimit.reset(new ScColorScaleEntry()); - ::GetType(maLbTypeMin, maEdMin, pData->mpLowerLimit.get()); - ::GetType(maLbTypeMax, maEdMax, pData->mpUpperLimit.get()); + ::GetType(maLbTypeMin, maEdMin, pData->mpLowerLimit.get(), mpNumberFormatter); + ::GetType(maLbTypeMax, maEdMax, pData->mpUpperLimit.get(), mpNumberFormatter); GetAxesPosition(pData, maLbAxisPos); return pData; @@ -327,8 +328,12 @@ IMPL_LINK_NOARG( ScDataBarSettingsDlg, OkBtnHdl ) { rtl::OUString aMinString = maEdMin.GetText(); rtl::OUString aMaxString = maEdMax.GetText(); - double nMinValue = rtl::math::stringToDouble(aMinString, '.', ','); - double nMaxValue = rtl::math::stringToDouble(aMaxString, '.', ','); + double nMinValue = 0; + sal_uInt32 nIndex = 0; + mpNumberFormatter->IsNumberFormat(aMinString, nIndex, nMinValue); + nIndex = 0; + double nMaxValue = 0; + mpNumberFormatter->IsNumberFormat(aMaxString, nIndex, nMinValue); if(rtl::math::approxEqual(nMinValue, nMaxValue) || nMinValue > nMaxValue) bWarn = true; } diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx index 51e68c22154f..d23069294c7e 100644 --- a/sc/source/ui/condformat/condformatdlg.cxx +++ b/sc/source/ui/condformat/condformatdlg.cxx @@ -47,8 +47,6 @@ #include "colorscale.hxx" #include "colorformat.hxx" -#include <rtl/math.hxx> - #include "globstr.hrc" #include <cassert> @@ -685,7 +683,10 @@ namespace { void SetColorScaleEntry( ScColorScaleEntry* pEntry, const ListBox& rType, const Edit& rValue, ScDocument* pDoc, const ScAddress& rPos ) { - double nVal = rtl::math::stringToDouble(rValue.GetText(), '.', ','); + sal_uInt32 nIndex = 0; + double nVal = 0; + SvNumberFormatter* pNumberFormatter = pDoc->GetFormatTable(); + pNumberFormatter->IsNumberFormat(rValue.GetText(), nIndex, nVal); switch(rType.GetSelectEntryPos()) { case 0: @@ -1054,7 +1055,9 @@ ScConditionalFormat* ScCondFormatDlg::GetConditionalFormat() const IMPL_LINK_NOARG( ScCondFormatList, AddBtnHdl ) { - maEntries.push_back( new ScCondFrmtEntry(this, mpDoc) ); + ScCondFrmtEntry* pNewEntry = new ScCondFrmtEntry(this, mpDoc); + maEntries.push_back( pNewEntry ); + pNewEntry->Select(); RecalcAll(); return 0; } diff --git a/sc/source/ui/inc/colorformat.hxx b/sc/source/ui/inc/colorformat.hxx index c85eec580e9e..fffbb34bc2fb 100644 --- a/sc/source/ui/inc/colorformat.hxx +++ b/sc/source/ui/inc/colorformat.hxx @@ -30,6 +30,7 @@ #include <vcl/dialog.hxx> #include <vcl/fixed.hxx> #include <svtools/ctrlbox.hxx> +#include <svl/zforlist.hxx> #include "anyrefdg.hxx" class ScDataBarFormat; @@ -63,6 +64,7 @@ private: Edit maEdMax; rtl::OUString maStrWarnSameValue; + SvNumberFormatter* mpNumberFormatter; DECL_LINK(OkBtnHdl, void*); DECL_LINK(TypeSelectHdl, void*); diff --git a/sc/source/ui/inc/condformatdlg.hxx b/sc/source/ui/inc/condformatdlg.hxx index 2794cfdb0e0e..8b03c29e5661 100644 --- a/sc/source/ui/inc/condformatdlg.hxx +++ b/sc/source/ui/inc/condformatdlg.hxx @@ -123,6 +123,7 @@ private: ScDocument* mpDoc; ScAddress maPos; + SvNumberFormatter* mpNumberFormatter; DECL_LINK( TypeListHdl, void*); DECL_LINK( ColFormatTypeHdl, void*); |