diff options
author | Ingrid Halama [iha] <Ingrid.Halama@oracle.com> | 2011-01-14 18:59:53 +0100 |
---|---|---|
committer | Ingrid Halama [iha] <Ingrid.Halama@oracle.com> | 2011-01-14 18:59:53 +0100 |
commit | df4eb12515da36973ad00eb2ae2b18ca303646c7 (patch) | |
tree | 39f5bf125fb80a39f7c6ada8c4fae22928fdd96a /chart2/source/controller | |
parent | dbf69a6612a5471d7ae23b1bf41afd1e9fec23a2 (diff) |
chart46: #i116468# scale tab page - better fallback after wrong input
Diffstat (limited to 'chart2/source/controller')
-rw-r--r-- | chart2/source/controller/dialogs/tp_Scale.cxx | 38 | ||||
-rw-r--r-- | chart2/source/controller/dialogs/tp_Scale.hxx | 1 |
2 files changed, 29 insertions, 10 deletions
diff --git a/chart2/source/controller/dialogs/tp_Scale.cxx b/chart2/source/controller/dialogs/tp_Scale.cxx index c12c5bdb3814..3cb2d2838e8c 100644 --- a/chart2/source/controller/dialogs/tp_Scale.cxx +++ b/chart2/source/controller/dialogs/tp_Scale.cxx @@ -98,6 +98,17 @@ void lcl_shiftControls( Control& rEdit, Control& rAuto, long nNewXPos ) rAuto.SetPosPixel(aPos); } +long lcl_getLabelDistance( Control& rControl ) +{ + return rControl.LogicToPixel( Size(RSC_SP_CTRL_DESC_X, 0), MapMode(MAP_APPFONT) ).Width(); +} + +void lcl_setValue( FormattedField& rFmtField, double fValue ) +{ + rFmtField.SetValue( fValue ); + rFmtField.SetDefaultValue( fValue ); +} + } ScaleTabPage::ScaleTabPage(Window* pWindow,const SfxItemSet& rInAttrs) : @@ -168,6 +179,18 @@ ScaleTabPage::ScaleTabPage(Window* pWindow,const SfxItemSet& rInAttrs) : m_aLB_TimeResolution.SetDropDownLineCount(3); m_aLB_MainTimeUnit.SetDropDownLineCount(3); m_aLB_HelpTimeUnit.SetDropDownLineCount(3); + + aFmtFldMin.SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl)); + aFmtFldMax.SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl)); + aFmtFldStepMain.SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl)); + aFmtFldOrigin.SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl)); +} + +IMPL_LINK( ScaleTabPage, FmtFieldModifiedHdl, FormattedField*, pFmtFied ) +{ + if( pFmtFied ) + pFmtFied->SetDefaultValue( pFmtFied->GetValue() ); + return 0; } void ScaleTabPage::StateChanged( StateChangedType nType ) @@ -178,11 +201,6 @@ void ScaleTabPage::StateChanged( StateChangedType nType ) AdjustControlPositions(); } -long lcl_getLabelDistance( Control& rControl ) -{ - return rControl.LogicToPixel( Size(RSC_SP_CTRL_DESC_X, 0), MapMode(MAP_APPFONT) ).Width(); -} - void ScaleTabPage::AdjustControlPositions() { //optimize position of the controls @@ -320,7 +338,7 @@ void ScaleTabPage::EnableControls() { //transport value from one to other control if( bWasDateAxis ) - aFmtFldStepMain.SetValue( m_aMt_MainDateStep.GetValue() ); + lcl_setValue( aFmtFldStepMain, m_aMt_MainDateStep.GetValue() ); else m_aMt_MainDateStep.SetValue( static_cast<sal_Int32>(aFmtFldStepMain.GetValue()) ); } @@ -483,7 +501,7 @@ void ScaleTabPage::Reset(const SfxItemSet& rInAttrs) if (rInAttrs.GetItemState(SCHATTR_AXIS_MIN,TRUE, &pPoolItem) == SFX_ITEM_SET) { fMin = ((const SvxDoubleItem*)pPoolItem)->GetValue(); - aFmtFldMin.SetValue( fMin ); + lcl_setValue( aFmtFldMin, fMin ); } if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_MAX,TRUE, &pPoolItem) == SFX_ITEM_SET) @@ -492,7 +510,7 @@ void ScaleTabPage::Reset(const SfxItemSet& rInAttrs) if (rInAttrs.GetItemState(SCHATTR_AXIS_MAX,TRUE, &pPoolItem) == SFX_ITEM_SET) { fMax = ((const SvxDoubleItem*)pPoolItem)->GetValue(); - aFmtFldMax.SetValue( fMax ); + lcl_setValue( aFmtFldMax, fMax ); } if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_STEP_MAIN,TRUE, &pPoolItem) == SFX_ITEM_SET) @@ -501,7 +519,7 @@ void ScaleTabPage::Reset(const SfxItemSet& rInAttrs) if (rInAttrs.GetItemState(SCHATTR_AXIS_STEP_MAIN,TRUE, &pPoolItem) == SFX_ITEM_SET) { fStepMain = ((const SvxDoubleItem*)pPoolItem)->GetValue(); - aFmtFldStepMain.SetValue( fStepMain ); + lcl_setValue( aFmtFldStepMain, fStepMain ); m_aMt_MainDateStep.SetValue( static_cast<sal_Int32>(fStepMain) ); } if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_STEP_HELP,TRUE, &pPoolItem) == SFX_ITEM_SET) @@ -520,7 +538,7 @@ void ScaleTabPage::Reset(const SfxItemSet& rInAttrs) if (rInAttrs.GetItemState(SCHATTR_AXIS_ORIGIN,TRUE, &pPoolItem) == SFX_ITEM_SET) { fOrigin = ((const SvxDoubleItem*)pPoolItem)->GetValue(); - aFmtFldOrigin.SetValue( fOrigin ); + lcl_setValue( aFmtFldOrigin, fOrigin ); } if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_TIME_RESOLUTION,TRUE, &pPoolItem) == SFX_ITEM_SET) diff --git a/chart2/source/controller/dialogs/tp_Scale.hxx b/chart2/source/controller/dialogs/tp_Scale.hxx index 953187d1d9cf..ecfc42c2c513 100644 --- a/chart2/source/controller/dialogs/tp_Scale.hxx +++ b/chart2/source/controller/dialogs/tp_Scale.hxx @@ -121,6 +121,7 @@ private: DECL_LINK( SelectAxisTypeHdl, void* ); DECL_LINK( EnableValueHdl, CheckBox* ); + DECL_LINK( FmtFieldModifiedHdl, FormattedField* ); /** shows a warning window due to an invalid input. |