summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-12-20 14:33:55 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-12-21 11:25:45 +0100
commit674b22f486a230343067ede2c0540607b1854aeb (patch)
treea084ce733fe10e4d0207ccb39a8b90cc275dce12
parentf9a2639d6a12010dd9e388fc46edc96ebab6db50 (diff)
weld ChartErrorBarPanel
Change-Id: I5baba4ec949e38b6c81cd6117c7bfcc2ffc61e3e Reviewed-on: https://gerrit.libreoffice.org/85611 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--chart2/source/controller/sidebar/ChartErrorBarPanel.cxx106
-rw-r--r--chart2/source/controller/sidebar/ChartErrorBarPanel.hxx22
-rw-r--r--chart2/uiconfig/ui/sidebarerrorbar.ui41
3 files changed, 80 insertions, 89 deletions
diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
index 4ef3c19228dd..eb9f622d2012 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
@@ -23,9 +23,6 @@
#include "ChartErrorBarPanel.hxx"
#include <ChartController.hxx>
-#include <vcl/lstbox.hxx>
-#include <vcl/field.hxx>
-#include <vcl/button.hxx>
#include <vcl/svapp.hxx>
using namespace css;
@@ -235,23 +232,18 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
ChartErrorBarPanel::ChartErrorBarPanel(
vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
- ChartController* pController)
- : PanelLayout(pParent, "ChartErrorBarPanel", "modules/schart/ui/sidebarerrorbar.ui", rxFrame),
- mxModel(pController->getModel()),
- mxListener(new ChartSidebarModifyListener(this)),
- mbModelValid(true)
+ const css::uno::Reference<css::frame::XFrame>& rxFrame, ChartController* pController)
+ : PanelLayout(pParent, "ChartErrorBarPanel", "modules/schart/ui/sidebarerrorbar.ui", rxFrame, true)
+ , mxRBPosAndNeg(m_xBuilder->weld_radio_button("radiobutton_positive_negative"))
+ , mxRBPos(m_xBuilder->weld_radio_button("radiobutton_positive"))
+ , mxRBNeg(m_xBuilder->weld_radio_button("radiobutton_negative"))
+ , mxLBType(m_xBuilder->weld_combo_box("comboboxtext_type"))
+ , mxMFPos(m_xBuilder->weld_spin_button("spinbutton_pos"))
+ , mxMFNeg(m_xBuilder->weld_spin_button("spinbutton_neg"))
+ , mxModel(pController->getModel())
+ , mxListener(new ChartSidebarModifyListener(this))
+ , mbModelValid(true)
{
-
- get(mpRBPosAndNeg, "radiobutton_positive_negative");
- get(mpRBPos, "radiobutton_positive");
- get(mpRBNeg, "radiobutton_negative");
-
- get(mpLBType, "comboboxtext_type");
-
- get(mpMFPos, "spinbutton_pos");
- get(mpMFNeg, "spinbutton_neg");
-
Initialize();
}
@@ -265,14 +257,14 @@ void ChartErrorBarPanel::dispose()
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->removeModifyListener(mxListener);
- mpRBPosAndNeg.clear();
- mpRBPos.clear();
- mpRBNeg.clear();
+ mxRBPosAndNeg.reset();
+ mxRBPos.reset();
+ mxRBNeg.reset();
- mpLBType.clear();
+ mxLBType.reset();
- mpMFPos.clear();
- mpMFNeg.clear();
+ mxMFPos.reset();
+ mxMFNeg.reset();
PanelLayout::dispose();
}
@@ -281,22 +273,22 @@ void ChartErrorBarPanel::Initialize()
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->addModifyListener(mxListener);
- mpRBNeg->Check(false);
- mpRBPos->Check(false);
- mpRBPosAndNeg->Check(false);
+ mxRBNeg->set_active(false);
+ mxRBPos->set_active(false);
+ mxRBPosAndNeg->set_active(false);
updateData();
- Link<RadioButton&,void> aLink = LINK(this, ChartErrorBarPanel, RadioBtnHdl);
- mpRBPosAndNeg->SetToggleHdl(aLink);
- mpRBPos->SetToggleHdl(aLink);
- mpRBNeg->SetToggleHdl(aLink);
+ Link<weld::ToggleButton&,void> aLink = LINK(this, ChartErrorBarPanel, RadioBtnHdl);
+ mxRBPosAndNeg->connect_toggled(aLink);
+ mxRBPos->connect_toggled(aLink);
+ mxRBNeg->connect_toggled(aLink);
- mpLBType->SetSelectHdl(LINK(this, ChartErrorBarPanel, ListBoxHdl));
+ mxLBType->connect_changed(LINK(this, ChartErrorBarPanel, ListBoxHdl));
- Link<Edit&,void> aLink2 = LINK(this, ChartErrorBarPanel, NumericFieldHdl);
- mpMFPos->SetModifyHdl(aLink2);
- mpMFNeg->SetModifyHdl(aLink2);
+ Link<weld::SpinButton&,void> aLink2 = LINK(this, ChartErrorBarPanel, NumericFieldHdl);
+ mxMFPos->connect_value_changed(aLink2);
+ mxMFNeg->connect_value_changed(aLink2);
}
void ChartErrorBarPanel::updateData()
@@ -311,37 +303,37 @@ void ChartErrorBarPanel::updateData()
SolarMutexGuard aGuard;
if (bPos && bNeg)
- mpRBPosAndNeg->Check();
+ mxRBPosAndNeg->set_active(true);
else if (bPos)
- mpRBPos->Check();
+ mxRBPos->set_active(true);
else if (bNeg)
- mpRBNeg->Check();
+ mxRBNeg->set_active(true);
sal_Int32 nTypePos = getTypePos(mxModel, aCID);
- mpLBType->SelectEntryPos(nTypePos);
+ mxLBType->set_active(nTypePos);
if (nTypePos <= 1)
{
if (bPos)
- mpMFPos->Enable();
+ mxMFPos->set_sensitive(true);
else
- mpMFPos->Disable();
+ mxMFPos->set_sensitive(false);
if (bNeg)
- mpMFNeg->Enable();
+ mxMFNeg->set_sensitive(true);
else
- mpMFNeg->Disable();
+ mxMFNeg->set_sensitive(false);
double nValPos = getValue(mxModel, aCID, ErrorBarDirection::POSITIVE);
double nValNeg = getValue(mxModel, aCID, ErrorBarDirection::NEGATIVE);
- mpMFPos->SetValue(nValPos);
- mpMFNeg->SetValue(nValNeg);
+ mxMFPos->set_value(nValPos);
+ mxMFNeg->set_value(nValNeg);
}
else
{
- mpMFPos->Disable();
- mpMFNeg->Disable();
+ mxMFPos->set_sensitive(false);
+ mxMFNeg->set_sensitive(false);
}
}
@@ -399,31 +391,31 @@ void ChartErrorBarPanel::updateModel(
xBroadcasterNew->addModifyListener(mxListener);
}
-IMPL_LINK_NOARG(ChartErrorBarPanel, RadioBtnHdl, RadioButton&, void)
+IMPL_LINK_NOARG(ChartErrorBarPanel, RadioBtnHdl, weld::ToggleButton&, void)
{
OUString aCID = getCID(mxModel);
- bool bPos = mpRBPosAndNeg->IsChecked() || mpRBPos->IsChecked();
- bool bNeg = mpRBPosAndNeg->IsChecked() || mpRBNeg->IsChecked();
+ bool bPos = mxRBPosAndNeg->get_active() || mxRBPos->get_active();
+ bool bNeg = mxRBPosAndNeg->get_active() || mxRBNeg->get_active();
setShowPositiveError(mxModel, aCID, bPos);
setShowNegativeError(mxModel, aCID, bNeg);
}
-IMPL_LINK_NOARG(ChartErrorBarPanel, ListBoxHdl, ListBox&, void)
+IMPL_LINK_NOARG(ChartErrorBarPanel, ListBoxHdl, weld::ComboBox&, void)
{
OUString aCID = getCID(mxModel);
- sal_Int32 nPos = mpLBType->GetSelectedEntryPos();
+ sal_Int32 nPos = mxLBType->get_active();
setTypePos(mxModel, aCID, nPos);
}
-IMPL_LINK(ChartErrorBarPanel, NumericFieldHdl, Edit&, rMetricField, void)
+IMPL_LINK(ChartErrorBarPanel, NumericFieldHdl, weld::SpinButton&, rMetricField, void)
{
OUString aCID = getCID(mxModel);
- double nVal = static_cast<NumericField&>(rMetricField).GetValue();
- if (&rMetricField == mpMFPos.get())
+ double nVal = rMetricField.get_value();
+ if (&rMetricField == mxMFPos.get())
setValue(mxModel, aCID, nVal, ErrorBarDirection::POSITIVE);
- else if (&rMetricField == mpMFNeg.get())
+ else if (&rMetricField == mxMFNeg.get())
setValue(mxModel, aCID, nVal, ErrorBarDirection::NEGATIVE);
}
diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
index c6e20976f9ae..01125ba0c532 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
@@ -20,10 +20,6 @@
namespace com { namespace sun { namespace star { namespace util { class XModifyListener; } } } }
-class ListBox;
-class NumericField;
-class Edit;
-
namespace chart {
class ChartController;
@@ -68,14 +64,14 @@ public:
private:
//ui controls
- VclPtr<RadioButton> mpRBPosAndNeg;
- VclPtr<RadioButton> mpRBPos;
- VclPtr<RadioButton> mpRBNeg;
+ std::unique_ptr<weld::RadioButton> mxRBPosAndNeg;
+ std::unique_ptr<weld::RadioButton> mxRBPos;
+ std::unique_ptr<weld::RadioButton> mxRBNeg;
- VclPtr<ListBox> mpLBType;
+ std::unique_ptr<weld::ComboBox> mxLBType;
- VclPtr<NumericField> mpMFPos;
- VclPtr<NumericField> mpMFNeg;
+ std::unique_ptr<weld::SpinButton> mxMFPos;
+ std::unique_ptr<weld::SpinButton> mxMFNeg;
css::uno::Reference<css::frame::XModel> mxModel;
css::uno::Reference<css::util::XModifyListener> mxListener;
@@ -84,9 +80,9 @@ private:
void Initialize();
- DECL_LINK(RadioBtnHdl, RadioButton&, void);
- DECL_LINK(ListBoxHdl, ListBox&, void);
- DECL_LINK(NumericFieldHdl, Edit&, void);
+ DECL_LINK(RadioBtnHdl, weld::ToggleButton&, void);
+ DECL_LINK(ListBoxHdl, weld::ComboBox&, void);
+ DECL_LINK(NumericFieldHdl, weld::SpinButton&, void);
};
} } // end of namespace ::chart::sidebar
diff --git a/chart2/uiconfig/ui/sidebarerrorbar.ui b/chart2/uiconfig/ui/sidebarerrorbar.ui
index 80055b23f604..032fcce7037b 100644
--- a/chart2/uiconfig/ui/sidebarerrorbar.ui
+++ b/chart2/uiconfig/ui/sidebarerrorbar.ui
@@ -1,21 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="chart">
<requires lib="gtk+" version="3.18"/>
+ <object class="GtkAdjustment" id="adjustmentNEG">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustmentPOS">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="pixbuf">chart2/res/errorup_30.png</property>
+ <property name="icon_name">chart2/res/errorup_30.png</property>
</object>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="pixbuf">chart2/res/errorbothverti_30.png</property>
+ <property name="icon_name">chart2/res/errorbothverti_30.png</property>
</object>
<object class="GtkImage" id="image3">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="pixbuf">chart2/res/errordown_30.png</property>
+ <property name="icon_name">chart2/res/errordown_30.png</property>
</object>
<object class="GtkGrid" id="ChartErrorBarPanel">
<property name="visible">True</property>
@@ -52,8 +62,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -73,8 +81,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -87,8 +93,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -101,8 +105,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -111,13 +113,12 @@
<property name="can_focus">True</property>
<property name="halign">start</property>
<property name="text" translatable="yes" context="sidebarerrorbar|spinbutton_pos">0.00</property>
+ <property name="adjustment">adjustmentPOS</property>
<property name="digits">2</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -127,13 +128,12 @@
<property name="halign">start</property>
<property name="text" translatable="yes" context="sidebarerrorbar|spinbutton_neg">0.00</property>
<property name="input_purpose">alpha</property>
+ <property name="adjustment">adjustmentNEG</property>
<property name="digits">2</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -146,10 +146,11 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_underline">True</property>
<property name="tooltip_text" translatable="yes" context="sidebarerrorbar|radiobutton_positive_negative|tooltip_text">Positive and Negative</property>
<property name="image">image2</property>
+ <property name="use_underline">True</property>
<property name="xalign">0</property>
+ <property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -163,11 +164,12 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_underline">True</property>
<property name="tooltip_text" translatable="yes" context="sidebarerrorbar|radiobutton_positive|tooltip_text">Positive</property>
<property name="image">image1</property>
+ <property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
+ <property name="group">radiobutton_positive_negative</property>
</object>
<packing>
<property name="expand">False</property>
@@ -180,11 +182,12 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_underline">True</property>
<property name="tooltip_text" translatable="yes" context="sidebarerrorbar|radiobutton_negative|tooltip_text">Negative</property>
<property name="image">image3</property>
+ <property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
+ <property name="group">radiobutton_positive_negative</property>
</object>
<packing>
<property name="expand">False</property>