Kaydet (Commit) 2390d3b6 authored tarafından Benjamin Ni's avatar Benjamin Ni Kaydeden (comit) Markus Mohrhard

added UI part for minLength and maxLength databar property, tdf#90197

Change-Id: I82a3655864b56d9b749e85443ca10ea9ab7a0c36
üst b24a15a0
...@@ -77,6 +77,8 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(vcl::Window* pWindow, const ScDataBar ...@@ -77,6 +77,8 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(vcl::Window* pWindow, const ScDataBar
get( mpLbAxisCol, "axis_colour" ); get( mpLbAxisCol, "axis_colour" );
get( mpEdMin, "min_value" ); get( mpEdMin, "min_value" );
get( mpEdMax, "max_value" ); get( mpEdMax, "max_value" );
get( mpLenMin, "min_length" );
get( mpLenMax, "max_length" );
maStrWarnSameValue = get<FixedText>("str_same_value")->GetText(); maStrWarnSameValue = get<FixedText>("str_same_value")->GetText();
...@@ -103,9 +105,12 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(vcl::Window* pWindow, const ScDataBar ...@@ -103,9 +105,12 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(vcl::Window* pWindow, const ScDataBar
::SetType(rData.mpUpperLimit.get(), *mpLbTypeMax); ::SetType(rData.mpUpperLimit.get(), *mpLbTypeMax);
SetValue(rData.mpLowerLimit.get(), *mpEdMin); SetValue(rData.mpLowerLimit.get(), *mpEdMin);
SetValue(rData.mpUpperLimit.get(), *mpEdMax); SetValue(rData.mpUpperLimit.get(), *mpEdMax);
mpLenMin->SetText(OUString::number(rData.mnMinLength));
mpLenMax->SetText(OUString::number(rData.mnMaxLength));
mpLbAxisCol->SelectEntry(rData.maAxisColor); mpLbAxisCol->SelectEntry(rData.maAxisColor);
TypeSelectHdl(NULL); TypeSelectHdl(NULL);
PosSelectHdl(NULL);
} }
void ScDataBarSettingsDlg::Init() void ScDataBarSettingsDlg::Init()
...@@ -150,6 +155,7 @@ void ScDataBarSettingsDlg::Init() ...@@ -150,6 +155,7 @@ void ScDataBarSettingsDlg::Init()
mpLbTypeMin->SetSelectHdl( LINK( this, ScDataBarSettingsDlg, TypeSelectHdl ) ); mpLbTypeMin->SetSelectHdl( LINK( this, ScDataBarSettingsDlg, TypeSelectHdl ) );
mpLbTypeMax->SetSelectHdl( LINK( this, ScDataBarSettingsDlg, TypeSelectHdl ) ); mpLbTypeMax->SetSelectHdl( LINK( this, ScDataBarSettingsDlg, TypeSelectHdl ) );
mpLbAxisPos->SetSelectHdl( LINK( this, ScDataBarSettingsDlg, PosSelectHdl ) );
} }
...@@ -171,6 +177,18 @@ void GetAxesPosition(ScDataBarFormatData* pData, const ListBox* rLbox) ...@@ -171,6 +177,18 @@ void GetAxesPosition(ScDataBarFormatData* pData, const ListBox* rLbox)
} }
} }
void SetBarLength(ScDataBarFormatData* pData, OUString minStr, OUString maxStr, SvNumberFormatter* mpNumberFormatter)
{
double nMinValue = 0;
sal_uInt32 nIndex = 0;
(void)mpNumberFormatter->IsNumberFormat(minStr, nIndex, nMinValue);
nIndex = 0;
double nMaxValue = 0;
(void)mpNumberFormatter->IsNumberFormat(maxStr, nIndex, nMaxValue);
pData->mnMinLength = nMinValue;
pData->mnMaxLength = nMaxValue;
}
} }
ScDataBarFormatData* ScDataBarSettingsDlg::GetData() ScDataBarFormatData* ScDataBarSettingsDlg::GetData()
...@@ -186,6 +204,7 @@ ScDataBarFormatData* ScDataBarSettingsDlg::GetData() ...@@ -186,6 +204,7 @@ ScDataBarFormatData* ScDataBarSettingsDlg::GetData()
::GetType(*mpLbTypeMin, *mpEdMin, pData->mpLowerLimit.get(), mpNumberFormatter, mpDoc, maPos); ::GetType(*mpLbTypeMin, *mpEdMin, pData->mpLowerLimit.get(), mpNumberFormatter, mpDoc, maPos);
::GetType(*mpLbTypeMax, *mpEdMax, pData->mpUpperLimit.get(), mpNumberFormatter, mpDoc, maPos); ::GetType(*mpLbTypeMax, *mpEdMax, pData->mpUpperLimit.get(), mpNumberFormatter, mpDoc, maPos);
GetAxesPosition(pData, mpLbAxisPos); GetAxesPosition(pData, mpLbAxisPos);
SetBarLength(pData, mpLenMin->GetText(), mpLenMax->GetText(), mpNumberFormatter);
return pData; return pData;
} }
...@@ -200,7 +219,19 @@ IMPL_LINK_NOARG( ScDataBarSettingsDlg, OkBtnHdl ) ...@@ -200,7 +219,19 @@ IMPL_LINK_NOARG( ScDataBarSettingsDlg, OkBtnHdl )
sal_Int32 nSelectMax = mpLbTypeMax->GetSelectEntryPos(); sal_Int32 nSelectMax = mpLbTypeMax->GetSelectEntryPos();
if( nSelectMax == COLORSCALE_MIN ) if( nSelectMax == COLORSCALE_MIN )
bWarn = true; bWarn = true;
if(!bWarn) // databar length checks
{
OUString aMinString = mpLenMin->GetText();
OUString aMaxString = mpLenMax->GetText();
double nMinValue = 0;
sal_uInt32 nIndex = 0;
(void)mpNumberFormatter->IsNumberFormat(aMinString, nIndex, nMinValue);
nIndex = 0;
double nMaxValue = 0;
(void)mpNumberFormatter->IsNumberFormat(aMaxString, nIndex, nMaxValue);
if(rtl::math::approxEqual(nMinValue, nMaxValue) || nMinValue > nMaxValue || nMaxValue > 100 || nMinValue < 0)
bWarn = true;
}
if(!bWarn && mpLbTypeMin->GetSelectEntryPos() == mpLbTypeMax->GetSelectEntryPos()) if(!bWarn && mpLbTypeMin->GetSelectEntryPos() == mpLbTypeMax->GetSelectEntryPos())
{ {
...@@ -266,4 +297,26 @@ IMPL_LINK_NOARG( ScDataBarSettingsDlg, TypeSelectHdl ) ...@@ -266,4 +297,26 @@ IMPL_LINK_NOARG( ScDataBarSettingsDlg, TypeSelectHdl )
return 0; return 0;
} }
IMPL_LINK_NOARG( ScDataBarSettingsDlg, PosSelectHdl )
{
sal_Int32 axisPos = mpLbAxisPos->GetSelectEntryPos();
if(axisPos != 2) // disable if axis vertical position is anything other than none
{
mpLenMin->Disable();
mpLenMax->Disable();
}
else
{
mpLenMin->Enable();
mpLenMax->Enable();
if(mpLenMin->GetText().isEmpty())
{
mpLenMin->SetText(OUString::number(0));
mpLenMax->SetText(OUString::number(100));
}
}
return 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -37,6 +37,8 @@ private: ...@@ -37,6 +37,8 @@ private:
Edit* mpEdMin; Edit* mpEdMin;
Edit* mpEdMax; Edit* mpEdMax;
Edit* mpLenMin;
Edit* mpLenMax;
OUString maStrWarnSameValue; OUString maStrWarnSameValue;
SvNumberFormatter* mpNumberFormatter; SvNumberFormatter* mpNumberFormatter;
...@@ -46,6 +48,7 @@ private: ...@@ -46,6 +48,7 @@ private:
DECL_LINK(OkBtnHdl, void*); DECL_LINK(OkBtnHdl, void*);
DECL_LINK(TypeSelectHdl, void*); DECL_LINK(TypeSelectHdl, void*);
DECL_LINK(PosSelectHdl, void*);
void Init(); void Init();
...@@ -58,3 +61,4 @@ public: ...@@ -58,3 +61,4 @@ public:
#endif // INCLUDED_SC_SOURCE_UI_INC_COLORFORMAT_HXX #endif // INCLUDED_SC_SOURCE_UI_INC_COLORFORMAT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -406,6 +406,97 @@ ...@@ -406,6 +406,97 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkFrame" id="frame4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
<object class="GtkGrid" id="grid3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkLabel" id="label10">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Minimum bar length (%):</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">minLength</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label11">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Maximum bar length (%):</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">maxLength</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="min_length">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char"></property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="max_length">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char"></property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label12">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Bar lengths</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
<object class="GtkLabel" id="str_same_value"> <object class="GtkLabel" id="str_same_value">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">Min value must be smaller than max value!</property> <property name="label" translatable="yes">Min value must be smaller than max value!</property>
...@@ -414,7 +505,7 @@ ...@@ -414,7 +505,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">3</property> <property name="position">4</property>
</packing> </packing>
</child> </child>
</object> </object>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment