summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Ni <benjaminniri@hotmail.com>2015-04-02 16:00:10 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-04-03 03:21:16 +0200
commit2390d3b6064d3fc0ec814620947ce18410d657f6 (patch)
tree22ce41f81da5df750fd49f0a06cbd9d1e22b9591
parentb24a15a0aaea310806259eaa20a7d509ce30e5c8 (diff)
added UI part for minLength and maxLength databar property, tdf#90197
Change-Id: I82a3655864b56d9b749e85443ca10ea9ab7a0c36
-rw-r--r--sc/source/ui/condformat/colorformat.cxx55
-rw-r--r--sc/source/ui/inc/colorformat.hxx4
-rw-r--r--sc/uiconfig/scalc/ui/databaroptions.ui93
3 files changed, 150 insertions, 2 deletions
diff --git a/sc/source/ui/condformat/colorformat.cxx b/sc/source/ui/condformat/colorformat.cxx
index 8b02134f072d..c29f0fb43df7 100644
--- a/sc/source/ui/condformat/colorformat.cxx
+++ b/sc/source/ui/condformat/colorformat.cxx
@@ -77,6 +77,8 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(vcl::Window* pWindow, const ScDataBar
get( mpLbAxisCol, "axis_colour" );
get( mpEdMin, "min_value" );
get( mpEdMax, "max_value" );
+ get( mpLenMin, "min_length" );
+ get( mpLenMax, "max_length" );
maStrWarnSameValue = get<FixedText>("str_same_value")->GetText();
@@ -103,9 +105,12 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(vcl::Window* pWindow, const ScDataBar
::SetType(rData.mpUpperLimit.get(), *mpLbTypeMax);
SetValue(rData.mpLowerLimit.get(), *mpEdMin);
SetValue(rData.mpUpperLimit.get(), *mpEdMax);
+ mpLenMin->SetText(OUString::number(rData.mnMinLength));
+ mpLenMax->SetText(OUString::number(rData.mnMaxLength));
mpLbAxisCol->SelectEntry(rData.maAxisColor);
TypeSelectHdl(NULL);
+ PosSelectHdl(NULL);
}
void ScDataBarSettingsDlg::Init()
@@ -150,6 +155,7 @@ void ScDataBarSettingsDlg::Init()
mpLbTypeMin->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)
}
}
+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()
@@ -186,6 +204,7 @@ ScDataBarFormatData* ScDataBarSettingsDlg::GetData()
::GetType(*mpLbTypeMin, *mpEdMin, pData->mpLowerLimit.get(), mpNumberFormatter, mpDoc, maPos);
::GetType(*mpLbTypeMax, *mpEdMax, pData->mpUpperLimit.get(), mpNumberFormatter, mpDoc, maPos);
GetAxesPosition(pData, mpLbAxisPos);
+ SetBarLength(pData, mpLenMin->GetText(), mpLenMax->GetText(), mpNumberFormatter);
return pData;
}
@@ -200,7 +219,19 @@ IMPL_LINK_NOARG( ScDataBarSettingsDlg, OkBtnHdl )
sal_Int32 nSelectMax = mpLbTypeMax->GetSelectEntryPos();
if( nSelectMax == COLORSCALE_MIN )
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())
{
@@ -266,4 +297,26 @@ IMPL_LINK_NOARG( ScDataBarSettingsDlg, TypeSelectHdl )
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: */
+
diff --git a/sc/source/ui/inc/colorformat.hxx b/sc/source/ui/inc/colorformat.hxx
index 23f036c280c9..672ce74318dd 100644
--- a/sc/source/ui/inc/colorformat.hxx
+++ b/sc/source/ui/inc/colorformat.hxx
@@ -37,6 +37,8 @@ private:
Edit* mpEdMin;
Edit* mpEdMax;
+ Edit* mpLenMin;
+ Edit* mpLenMax;
OUString maStrWarnSameValue;
SvNumberFormatter* mpNumberFormatter;
@@ -46,6 +48,7 @@ private:
DECL_LINK(OkBtnHdl, void*);
DECL_LINK(TypeSelectHdl, void*);
+ DECL_LINK(PosSelectHdl, void*);
void Init();
@@ -58,3 +61,4 @@ public:
#endif // INCLUDED_SC_SOURCE_UI_INC_COLORFORMAT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
diff --git a/sc/uiconfig/scalc/ui/databaroptions.ui b/sc/uiconfig/scalc/ui/databaroptions.ui
index 1fa0f684cb66..c53476991582 100644
--- a/sc/uiconfig/scalc/ui/databaroptions.ui
+++ b/sc/uiconfig/scalc/ui/databaroptions.ui
@@ -406,6 +406,97 @@
</packing>
</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">
<property name="can_focus">False</property>
<property name="label" translatable="yes">Min value must be smaller than max value!</property>
@@ -414,7 +505,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">3</property>
+ <property name="position">4</property>
</packing>
</child>
</object>