summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Balland-Poirier <laurent.balland-poirier@laposte.net>2013-12-13 07:25:20 +0100
committerTomaž Vajngerl <quikee@gmail.com>2013-12-14 10:46:39 +0100
commitfefdd355b5acc465159a57ee2972d1574fc1ef49 (patch)
treebe648de1a2d4ac56d43f681e6f9509c4c4b526e8
parent4031765b004dded31f04c54f9a055b7a3d0053f2 (diff)
fdo#40316 Remove SpinButton in UI for extrapolate trendline
UI Trendline: Spinbutton are not adapted for real value of x-values used in extrapolate For/Back-ward. Replaced with FormattedFiled like Intercept value Change-Id: Idc49f842a0f76906eb3c027e15a493e625c3d535 Reviewed-on: https://gerrit.libreoffice.org/7067 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r--chart2/source/controller/dialogs/res_Trendline.cxx53
-rw-r--r--chart2/source/controller/dialogs/res_Trendline.hxx4
-rw-r--r--chart2/uiconfig/ui/tp_Trendline.ui9
3 files changed, 27 insertions, 39 deletions
diff --git a/chart2/source/controller/dialogs/res_Trendline.cxx b/chart2/source/controller/dialogs/res_Trendline.cxx
index c8bba7e290b4..91552e47405c 100644
--- a/chart2/source/controller/dialogs/res_Trendline.cxx
+++ b/chart2/source/controller/dialogs/res_Trendline.cxx
@@ -54,8 +54,8 @@ TrendlineResources::TrendlineResources( Window * pParent, const SfxItemSet& rInA
pTabPage->get(m_pNF_Degree,"degree");
pTabPage->get(m_pNF_Period,"period");
pTabPage->get(m_pEE_Name,"entry_name");
- pTabPage->get(m_pNF_ExtrapolateForward,"extrapolateForward");
- pTabPage->get(m_pNF_ExtrapolateBackward,"extrapolateBackward");
+ pTabPage->get(m_pFmtFld_ExtrapolateForward,"extrapolateForward");
+ pTabPage->get(m_pFmtFld_ExtrapolateBackward,"extrapolateBackward");
pTabPage->get(m_pCB_SetIntercept,"setIntercept");
pTabPage->get(m_pFmtFld_InterceptValue,"interceptValue");
pTabPage->get(m_pCB_ShowEquation,"showEquation");
@@ -81,11 +81,6 @@ TrendlineResources::TrendlineResources( Window * pParent, const SfxItemSet& rInA
m_pNF_Period->SetModifyHdl( aLink );
m_pFmtFld_InterceptValue->SetModifyHdl( aLink );
- m_pNF_ExtrapolateForward->SetMin( SAL_MIN_INT64 );
- m_pNF_ExtrapolateForward->SetMax( SAL_MAX_INT64 );
- m_pNF_ExtrapolateBackward->SetMin( SAL_MIN_INT64 );
- m_pNF_ExtrapolateBackward->SetMax( SAL_MAX_INT64 );
-
Reset( rInAttrs );
UpdateControlStates();
}
@@ -159,27 +154,21 @@ void TrendlineResources::Reset( const SfxItemSet& rInAttrs )
m_pNF_Period->SetValue( 2 );
}
+ double nValue = 0.0;
if( rInAttrs.GetItemState( SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD, sal_True, &pPoolItem ) == SFX_ITEM_SET )
{
- double nValue = static_cast< const SvxDoubleItem * >( pPoolItem )->GetValue() * 100;
- m_pNF_ExtrapolateForward->SetValue( (sal_Int64) nValue );
- }
- else
- {
- m_pNF_ExtrapolateForward->SetValue( 0 );
+ nValue = ((const SvxDoubleItem*)pPoolItem)->GetValue() ;
}
+ lcl_setValue( *m_pFmtFld_ExtrapolateForward, nValue );
+ nValue = 0.0;
if( rInAttrs.GetItemState( SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD, sal_True, &pPoolItem ) == SFX_ITEM_SET )
{
- double nValue = static_cast< const SvxDoubleItem * >( pPoolItem )->GetValue() * 100;
- m_pNF_ExtrapolateBackward->SetValue( (sal_Int64) nValue );
- }
- else
- {
- m_pNF_ExtrapolateBackward->SetValue( 0 );
+ nValue = ((const SvxDoubleItem*)pPoolItem)->GetValue() ;
}
+ lcl_setValue( *m_pFmtFld_ExtrapolateBackward, nValue );
- double nValue = 0.0;;
+ nValue = 0.0;
if( rInAttrs.GetItemState( SCHATTR_REGRESSION_INTERCEPT_VALUE, sal_True, &pPoolItem ) == SFX_ITEM_SET )
{
nValue = ((const SvxDoubleItem*)pPoolItem)->GetValue() ;
@@ -273,19 +262,21 @@ sal_Bool TrendlineResources::FillItemSet(SfxItemSet& rOutAttrs) const
sal_Int32 aPeriod = m_pNF_Period->GetValue();
rOutAttrs.Put(SfxInt32Item( SCHATTR_REGRESSION_PERIOD, aPeriod ) );
- double aExtrapolateForwardValue = m_pNF_ExtrapolateForward->GetValue() / 100.0;
- rOutAttrs.Put(SvxDoubleItem( aExtrapolateForwardValue, SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD ) );
+ sal_uInt32 nIndex = 0;
+ double aValue = 0.0;
+ m_pNumFormatter->IsNumberFormat(m_pFmtFld_ExtrapolateForward->GetText(),nIndex,aValue);
+ rOutAttrs.Put(SvxDoubleItem( aValue, SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD ) );
- double aExtrapolateBackwardValue = m_pNF_ExtrapolateBackward->GetValue() / 100.0;
- rOutAttrs.Put(SvxDoubleItem( aExtrapolateBackwardValue, SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD ) );
+ aValue = 0.0;
+ m_pNumFormatter->IsNumberFormat(m_pFmtFld_ExtrapolateBackward->GetText(),nIndex,aValue);
+ rOutAttrs.Put(SvxDoubleItem( aValue, SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD ) );
if( m_pCB_SetIntercept->GetState() != STATE_DONTKNOW )
rOutAttrs.Put( SfxBoolItem( SCHATTR_REGRESSION_SET_INTERCEPT, m_pCB_SetIntercept->IsChecked() ));
- double aInterceptValue = 0.0;
- sal_uInt32 nIndex = 0;
- m_pNumFormatter->IsNumberFormat(m_pFmtFld_InterceptValue->GetText(),nIndex,aInterceptValue);
- rOutAttrs.Put(SvxDoubleItem( aInterceptValue, SCHATTR_REGRESSION_INTERCEPT_VALUE ) );
+ aValue = 0.0;
+ m_pNumFormatter->IsNumberFormat(m_pFmtFld_InterceptValue->GetText(),nIndex,aValue);
+ rOutAttrs.Put(SvxDoubleItem( aValue, SCHATTR_REGRESSION_INTERCEPT_VALUE ) );
return sal_True;
}
@@ -304,8 +295,8 @@ void TrendlineResources::UpdateControlStates()
{
bool bMovingAverage = ( m_eTrendLineType == CHREGRESS_MOVING_AVERAGE );
bool bInterceptAvailable = ( m_eTrendLineType == CHREGRESS_LINEAR ) || ( m_eTrendLineType == CHREGRESS_POLYNOMIAL );
- m_pNF_ExtrapolateForward->Enable(!bMovingAverage);
- m_pNF_ExtrapolateBackward->Enable(!bMovingAverage);
+ m_pFmtFld_ExtrapolateForward->Enable(!bMovingAverage);
+ m_pFmtFld_ExtrapolateBackward->Enable(!bMovingAverage);
m_pCB_SetIntercept->Enable( bInterceptAvailable );
m_pFmtFld_InterceptValue->Enable( bInterceptAvailable );
if(bMovingAverage)
@@ -348,6 +339,8 @@ IMPL_LINK( TrendlineResources, ChangeValue, void *, pNumericField)
void TrendlineResources::SetNumFormatter( SvNumberFormatter* pFormatter )
{
m_pNumFormatter = pFormatter;
+ m_pFmtFld_ExtrapolateForward->SetFormatter( m_pNumFormatter );
+ m_pFmtFld_ExtrapolateBackward->SetFormatter( m_pNumFormatter );
m_pFmtFld_InterceptValue->SetFormatter( m_pNumFormatter );
}
diff --git a/chart2/source/controller/dialogs/res_Trendline.hxx b/chart2/source/controller/dialogs/res_Trendline.hxx
index 37f25b9771f2..60575057e18c 100644
--- a/chart2/source/controller/dialogs/res_Trendline.hxx
+++ b/chart2/source/controller/dialogs/res_Trendline.hxx
@@ -63,8 +63,8 @@ private:
NumericField* m_pNF_Degree;
NumericField* m_pNF_Period;
Edit* m_pEE_Name;
- NumericField* m_pNF_ExtrapolateForward;
- NumericField* m_pNF_ExtrapolateBackward;
+ FormattedField* m_pFmtFld_ExtrapolateForward;
+ FormattedField* m_pFmtFld_ExtrapolateBackward;
CheckBox* m_pCB_SetIntercept;
FormattedField* m_pFmtFld_InterceptValue;
CheckBox* m_pCB_ShowEquation;
diff --git a/chart2/uiconfig/ui/tp_Trendline.ui b/chart2/uiconfig/ui/tp_Trendline.ui
index b5a0fadf48f7..e9ce8ef13372 100644
--- a/chart2/uiconfig/ui/tp_Trendline.ui
+++ b/chart2/uiconfig/ui/tp_Trendline.ui
@@ -398,15 +398,12 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="extrapolateForward">
+ <object class="svtlo-FormattedField" id="extrapolateForward">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="caps_lock_warning">False</property>
<property name="input_purpose">number</property>
- <property name="adjustment">adjustmentForwardBacward</property>
- <property name="digits">2</property>
- <property name="numeric">True</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -416,12 +413,10 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="extrapolateBackward">
+ <object class="svtlo-FormattedField" id="extrapolateBackward">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
- <property name="adjustment">adjustmentForwardBacward</property>
- <property name="digits">2</property>
</object>
<packing>
<property name="left_attach">1</property>