sc/inc/scabstdlg.hxx | 2 sc/source/ui/attrdlg/scdlgfact.cxx | 4 - sc/source/ui/attrdlg/scdlgfact.hxx | 2 sc/source/ui/condformat/colorformat.cxx | 81 +++++++----------------------- sc/source/ui/condformat/condformatdlg.cxx | 13 ++-- sc/source/ui/inc/colorformat.hxx | 7 +- sc/source/ui/view/cellsh1.cxx | 8 +- 7 files changed, 41 insertions(+), 76 deletions(-)
New commits: commit a756aff8c6f7964784d5c09e70f192013be7ca7b Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Fri Jun 15 06:32:33 2012 +0200 use correct localization aware string to double Change-Id: Ied254ef0dc8f7dcf444738da193122a733089b5a diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index 496ab89..921773a 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -362,7 +362,7 @@ public: virtual AbstractScCondFormatDlg* CreateScCondFormatDlg (Window* pParent, ScDocument* pDoc, const ScConditionalFormat* pFormat, const ScRangeList& rList, const ScAddress& rPos, int nId ) = 0; //add for ScCondFormatDlg - virtual AbstractScDataBarSettingsDlg* CreateScDataBarSetttingsDlg (Window* pParent ,int nId ) = 0; //add for ScDataBarSettingsDlg + virtual AbstractScDataBarSettingsDlg* CreateScDataBarSetttingsDlg (Window* pParent, ScDocument* pDoc, int nId ) = 0; //add for ScDataBarSettingsDlg virtual AbstractScDataPilotDatabaseDlg * CreateScDataPilotDatabaseDlg (Window* pParent ,int nId ) = 0; //add for ScDataPilotDatabaseDlg diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index ee142d3..01c3b08 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -794,13 +794,13 @@ AbstractScCondFormatDlg* ScAbstractDialogFactory_Impl::CreateScCondFormatDlg(Win return NULL; } -AbstractScDataBarSettingsDlg* ScAbstractDialogFactory_Impl::CreateScDataBarSetttingsDlg(Window* pParent, int nId) +AbstractScDataBarSettingsDlg* ScAbstractDialogFactory_Impl::CreateScDataBarSetttingsDlg(Window* pParent, ScDocument* pDoc, int nId) { ScDataBarSettingsDlg* pDlg = NULL; switch( nId ) { case RID_SCDLG_DATABAR: - pDlg = new ScDataBarSettingsDlg( pParent ); + pDlg = new ScDataBarSettingsDlg( pParent, pDoc ); break; default: break; diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index 8667db4..5fb36e1 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -432,7 +432,7 @@ public: virtual AbstractScCondFormatDlg* CreateScCondFormatDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormat* pFormat, const ScRangeList& rRange, const ScAddress& rPos, int nId ); //add for ScDataBarSettingsDlg - virtual AbstractScDataBarSettingsDlg* CreateScDataBarSetttingsDlg (Window* pParent ,int nId ); //add for ScDataBarSettingsDlg + virtual AbstractScDataBarSettingsDlg* CreateScDataBarSetttingsDlg (Window* pParent, ScDocument* pDoc, int nId ); //add for ScDataBarSettingsDlg virtual AbstractScDataPilotDatabaseDlg * CreateScDataPilotDatabaseDlg (Window* pParent ,int nId ); //add for ScDataPilotDatabaseDlg diff --git a/sc/source/ui/condformat/colorformat.cxx b/sc/source/ui/condformat/colorformat.cxx index 2483364..7093bb1 100644 --- a/sc/source/ui/condformat/colorformat.cxx +++ b/sc/source/ui/condformat/colorformat.cxx @@ -30,12 +30,13 @@ #include "colorscale.hxx" #include "colorformat.hrc" +#include "document.hxx" #include <svx/xtable.hxx> #include <svx/drawitem.hxx> #include <vcl/msgbox.hxx> -ScDataBarSettingsDlg::ScDataBarSettingsDlg(Window* pWindow): +ScDataBarSettingsDlg::ScDataBarSettingsDlg(Window* pWindow, ScDocument* pDoc): ModalDialog( pWindow, ScResId( RID_SCDLG_DATABAR ) ), maBtnOk( this, ScResId( BTN_OK ) ), maBtnCancel( this, ScResId( BTN_CANCEL ) ), @@ -55,7 +56,8 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(Window* pWindow): maLbTypeMax( this, ScResId( LB_TYPE ) ), maLbAxisPos( this, ScResId( LB_AXIS_POSITION ) ), maEdMin( this, ScResId( ED_MIN ) ), - maEdMax( this, ScResId( ED_MAX ) ) + maEdMax( this, ScResId( ED_MAX ) ), + mpNumberFormatter( pDoc->GetFormatTable() ) { Init(); FreeResource(); @@ -83,9 +85,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 +99,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; @@ -126,7 +129,7 @@ void SetValue( ScColorScaleEntry* pEntry, Edit& aEdit) } -ScDataBarSettingsDlg::ScDataBarSettingsDlg(Window* pWindow, const ScDataBarFormatData& rData): +ScDataBarSettingsDlg::ScDataBarSettingsDlg(Window* pWindow, const ScDataBarFormatData& rData, ScDocument* pDoc): ModalDialog( pWindow, ScResId( RID_SCDLG_DATABAR ) ), maBtnOk( this, ScResId( BTN_OK ) ), maBtnCancel( this, ScResId( BTN_CANCEL ) ), @@ -147,7 +150,8 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(Window* pWindow, const ScDataBarForma maLbAxisPos( this, ScResId( LB_AXIS_POSITION ) ), maEdMin( this, ScResId( ED_MIN ) ), maEdMax( this, ScResId( ED_MAX ) ), - maStrWarnSameValue( SC_RESSTR( STR_WARN_SAME_VALUE ) ) + maStrWarnSameValue( SC_RESSTR( STR_WARN_SAME_VALUE ) ), + mpNumberFormatter( pDoc->GetFormatTable() ) { Init(); FreeResource(); @@ -176,55 +180,6 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(Window* pWindow, const ScDataBarForma TypeSelectHdl(NULL); } -ScDataBarSettingsDlg::ScDataBarSettingsDlg(Window* pWindow, ScDataBarFormat* pFormat): - ModalDialog( pWindow, ScResId( RID_SCDLG_DATABAR ) ), - maBtnOk( this, ScResId( BTN_OK ) ), - maBtnCancel( this, ScResId( BTN_CANCEL ) ), - maFlBarColors( this, ScResId( FL_BAR_COLORS ) ), - maFlAxes( this, ScResId( FL_AXIS ) ), - maFlValues( this, ScResId( FL_VALUES ) ), - maFtMin( this, ScResId( FT_MINIMUM ) ), - maFtMax( this, ScResId( FT_MAXIMUM ) ), - maFtPositive( this, ScResId( FT_POSITIVE ) ), - maFtNegative( this, ScResId( FT_NEGATIVE ) ), - maFtPosition( this, ScResId( FT_POSITION ) ), - maFtAxisColor( this, ScResId( FT_COLOR_AXIS ) ), - maLbPos( this, ScResId( LB_POS ) ), - maLbNeg( this, ScResId( LB_NEG ) ), - maLbAxisCol( this, ScResId( LB_COL_AXIS ) ), - maLbTypeMin( this, ScResId( LB_TYPE ) ), - maLbTypeMax( this, ScResId( LB_TYPE ) ), - maLbAxisPos( this, ScResId( LB_AXIS_POSITION ) ), - maEdMin( this, ScResId( ED_MIN ) ), - maEdMax( this, ScResId( ED_MAX ) ), - maStrWarnSameValue( SC_RESSTR( STR_WARN_SAME_VALUE ) ) -{ - Init(); - FreeResource(); - - const ScDataBarFormatData* pData = pFormat->GetDataBarData(); - maLbPos.SelectEntry( pData->maPositiveColor ); - if(pData->mpNegativeColor) - maLbNeg.SelectEntry( *pData->mpNegativeColor ); - - switch (pData->meAxisPosition) - { - case databar::NONE: - maLbAxisPos.SelectEntryPos(2); - break; - case databar::AUTOMATIC: - maLbAxisPos.SelectEntryPos(0); - break; - case databar::MIDDLE: - maLbAxisPos.SelectEntryPos(1); - break; - } - ::SetType(pData->mpLowerLimit.get(), maLbTypeMin); - ::SetType(pData->mpUpperLimit.get(), maLbTypeMax); - SetValue(pData->mpLowerLimit.get(), maEdMin); - SetValue(pData->mpUpperLimit.get(), maEdMax); -} - void ScDataBarSettingsDlg::Init() { SfxObjectShell* pDocSh = SfxObjectShell::Current(); @@ -305,8 +260,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 +282,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 b0930bb..91966fe 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> @@ -687,7 +685,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: @@ -893,7 +894,7 @@ IMPL_LINK_NOARG( ScCondFrmtEntry, OptionBtnHdl ) { SetColorScaleEntry(mpDataBarData->mpLowerLimit.get(), maLbDataBarMinType, maEdDataBarMin, mpDoc, maPos); SetColorScaleEntry(mpDataBarData->mpUpperLimit.get(), maLbDataBarMaxType, maEdDataBarMax, mpDoc, maPos); - ScDataBarSettingsDlg* pDlg = new ScDataBarSettingsDlg(this, *mpDataBarData); + ScDataBarSettingsDlg* pDlg = new ScDataBarSettingsDlg(this, *mpDataBarData, mpDoc); if( pDlg->Execute() == RET_OK) { mpDataBarData.reset(pDlg->GetData()); @@ -1056,7 +1057,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 c85eec5..0811c4c 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*); @@ -70,9 +72,8 @@ private: void Init(); public: - ScDataBarSettingsDlg(Window* pParent); - ScDataBarSettingsDlg(Window* pParent, const ScDataBarFormatData& rData); - ScDataBarSettingsDlg(Window* pParent, ScDataBarFormat* pFormat); + ScDataBarSettingsDlg(Window* pParent, ScDocument* pDoc); + ScDataBarSettingsDlg(Window* pParent, const ScDataBarFormatData& rData, ScDocument* pDoc); ScDataBarFormatData* GetData(); }; diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index c0a59a9..ca84b2b 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -2058,7 +2058,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) ScRangeList aRangeList; ScViewData* pData = GetViewData(); pData->GetMarkData().FillRangeListWithMarks(&aRangeList, false); - ScDocument* pDoc = GetViewData()->GetDocument(); + ScDocument* pDoc = pData->GetDocument(); ScAddress aPos(pData->GetCurX(), pData->GetCurY(), pData->GetTabNo()); AbstractScCondFormatDlg* pDlg = NULL; @@ -2089,7 +2089,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); - AbstractScDataBarSettingsDlg* pDlg = pFact->CreateScDataBarSetttingsDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_DATABAR ); + ScDocument* pDoc = GetViewData()->GetDocument(); + AbstractScDataBarSettingsDlg* pDlg = pFact->CreateScDataBarSetttingsDlg( pTabViewShell->GetDialogParent(), pDoc, RID_SCDLG_DATABAR ); OSL_ENSURE(pDlg, "Dialog create fail!"); pDlg->Execute(); delete pDlg; @@ -2101,7 +2102,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); - AbstractScDataBarSettingsDlg* pDlg = pFact->CreateScDataBarSetttingsDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_DATABAR ); + ScDocument* pDoc = GetViewData()->GetDocument(); + AbstractScDataBarSettingsDlg* pDlg = pFact->CreateScDataBarSetttingsDlg( pTabViewShell->GetDialogParent(), pDoc, RID_SCDLG_DATABAR ); OSL_ENSURE(pDlg, "Dialog create fail!"); if(pDlg->Execute() == RET_OK) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits