summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-12-20 15:06:23 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-12-21 11:26:07 +0100
commit750033e66585ddd4b4a8e5fe29b5a6739351403f (patch)
tree6d9c826084dec81dd2dcb73a851b42504246e19a /chart2
parent674b22f486a230343067ede2c0540607b1854aeb (diff)
weld ChartAxisPanel
Change-Id: Iea04954e950ad1eabc2c178e9782eb0ae20026cf Reviewed-on: https://gerrit.libreoffice.org/85613 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/sidebar/ChartAxisPanel.cxx73
-rw-r--r--chart2/source/controller/sidebar/ChartAxisPanel.hxx19
-rw-r--r--chart2/uiconfig/ui/sidebaraxis.ui11
3 files changed, 50 insertions, 53 deletions
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.cxx b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
index 419c287d3eeb..a6fd71c96d44 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
@@ -26,8 +26,6 @@
#include "ChartAxisPanel.hxx"
#include <ChartController.hxx>
-#include <vcl/lstbox.hxx>
-#include <vcl/field.hxx>
using namespace css;
using namespace css::uno;
@@ -206,19 +204,17 @@ ChartAxisPanel::ChartAxisPanel(
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
ChartController* pController)
- : PanelLayout(pParent, "ChartAxisPanel", "modules/schart/ui/sidebaraxis.ui", rxFrame),
- mxModel(pController->getModel()),
- mxModifyListener(new ChartSidebarModifyListener(this)),
- mxSelectionListener(new ChartSidebarSelectionListener(this, OBJECTTYPE_AXIS)),
- mbModelValid(true)
+ : PanelLayout(pParent, "ChartAxisPanel", "modules/schart/ui/sidebaraxis.ui", rxFrame, true)
+ , mxCBShowLabel(m_xBuilder->weld_check_button("checkbutton_show_label"))
+ , mxCBReverse(m_xBuilder->weld_check_button("checkbutton_reverse"))
+ , mxLBLabelPos(m_xBuilder->weld_combo_box("comboboxtext_label_position"))
+ , mxGridLabel(m_xBuilder->weld_widget("label_props"))
+ , mxNFRotation(m_xBuilder->weld_metric_spin_button("spinbutton1", FieldUnit::DEGREE))
+ , mxModel(pController->getModel())
+ , mxModifyListener(new ChartSidebarModifyListener(this))
+ , mxSelectionListener(new ChartSidebarSelectionListener(this, OBJECTTYPE_AXIS))
+ , mbModelValid(true)
{
- get(mpCBShowLabel, "checkbutton_show_label");
- get(mpCBReverse, "checkbutton_reverse");
-
- get(mpLBLabelPos, "comboboxtext_label_position");
- get(mpNFRotation, "spinbutton1");
- get(mpGridLabel, "label_props");
-
Initialize();
}
@@ -236,13 +232,13 @@ void ChartAxisPanel::dispose()
if (xSelectionSupplier.is())
xSelectionSupplier->removeSelectionChangeListener(mxSelectionListener);
- mpCBShowLabel.clear();
- mpCBReverse.clear();
+ mxCBShowLabel.reset();
+ mxCBReverse.reset();
- mpLBLabelPos.clear();
- mpGridLabel.clear();
+ mxLBLabelPos.reset();
+ mxGridLabel.reset();
- mpNFRotation.clear();
+ mxNFRotation.reset();
PanelLayout::dispose();
}
@@ -258,14 +254,14 @@ void ChartAxisPanel::Initialize()
updateData();
- Link<Button*,void> aLink = LINK(this, ChartAxisPanel, CheckBoxHdl);
- mpCBShowLabel->SetClickHdl(aLink);
- mpCBReverse->SetClickHdl(aLink);
+ Link<weld::ToggleButton&,void> aLink = LINK(this, ChartAxisPanel, CheckBoxHdl);
+ mxCBShowLabel->connect_toggled(aLink);
+ mxCBReverse->connect_toggled(aLink);
- Link<Edit&, void> aSpinButtonLink = LINK(this, ChartAxisPanel, TextRotationHdl);
- mpNFRotation->SetModifyHdl(aSpinButtonLink);
+ Link<weld::MetricSpinButton&, void> aSpinButtonLink = LINK(this, ChartAxisPanel, TextRotationHdl);
+ mxNFRotation->connect_value_changed(aSpinButtonLink);
- mpLBLabelPos->SetSelectHdl(LINK(this, ChartAxisPanel, ListBoxHdl));
+ mxLBLabelPos->connect_changed(LINK(this, ChartAxisPanel, ListBoxHdl));
}
void ChartAxisPanel::updateData()
@@ -276,11 +272,11 @@ void ChartAxisPanel::updateData()
OUString aCID = getCID(mxModel);
SolarMutexGuard aGuard;
- mpCBShowLabel->Check(isLabelShown(mxModel, aCID));
- mpCBReverse->Check(isReverse(mxModel, aCID));
+ mxCBShowLabel->set_active(isLabelShown(mxModel, aCID));
+ mxCBReverse->set_active(isReverse(mxModel, aCID));
- mpLBLabelPos->SelectEntryPos(getLabelPosition(mxModel, aCID));
- mpNFRotation->SetValue(getAxisRotation(mxModel, aCID));
+ mxLBLabelPos->set_active(getLabelPosition(mxModel, aCID));
+ mxNFRotation->set_value(getAxisRotation(mxModel, aCID), FieldUnit::DEGREE);
}
VclPtr<vcl::Window> ChartAxisPanel::Create (
@@ -347,33 +343,32 @@ void ChartAxisPanel::selectionChanged(bool bCorrectType)
updateData();
}
-IMPL_LINK(ChartAxisPanel, CheckBoxHdl, Button*, pButton, void)
+IMPL_LINK(ChartAxisPanel, CheckBoxHdl, weld::ToggleButton&, rCheckbox, void)
{
- CheckBox* pCheckbox = static_cast<CheckBox*>(pButton);
OUString aCID = getCID(mxModel);
- bool bChecked = pCheckbox->IsChecked();
+ bool bChecked = rCheckbox.get_active();
- if (pCheckbox == mpCBShowLabel.get())
+ if (&rCheckbox == mxCBShowLabel.get())
{
- mpGridLabel->Enable(bChecked);
+ mxGridLabel->set_sensitive(bChecked);
setLabelShown(mxModel, aCID, bChecked);
}
- else if (pCheckbox == mpCBReverse.get())
+ else if (&rCheckbox == mxCBReverse.get())
setReverse(mxModel, aCID, bChecked);
}
-IMPL_LINK_NOARG(ChartAxisPanel, ListBoxHdl, ListBox&, void)
+IMPL_LINK_NOARG(ChartAxisPanel, ListBoxHdl, weld::ComboBox&, void)
{
OUString aCID = getCID(mxModel);
- sal_Int32 nPos = mpLBLabelPos->GetSelectedEntryPos();
+ sal_Int32 nPos = mxLBLabelPos->get_active();
setLabelPosition(mxModel, aCID, nPos);
}
-IMPL_LINK(ChartAxisPanel, TextRotationHdl, Edit&, rMetricField, void)
+IMPL_LINK(ChartAxisPanel, TextRotationHdl, weld::MetricSpinButton&, rMetricField, void)
{
OUString aCID = getCID(mxModel);
- double nVal = static_cast<NumericField&>(rMetricField).GetValue();
+ double nVal = rMetricField.get_value(FieldUnit::DEGREE);
setAxisRotation(mxModel, aCID, nVal);
}
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.hxx b/chart2/source/controller/sidebar/ChartAxisPanel.hxx
index 0c9bd74ab182..dec036e1a5d6 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.hxx
@@ -15,7 +15,6 @@
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
#include <sfx2/sidebar/SidebarModelUpdate.hxx>
#include <svx/sidebar/PanelLayout.hxx>
-#include <vcl/layout.hxx>
#include "ChartSidebarModifyListener.hxx"
#include "ChartSidebarSelectionListener.hxx"
@@ -74,13 +73,11 @@ public:
private:
//ui controls
- VclPtr<CheckBox> mpCBShowLabel;
- VclPtr<CheckBox> mpCBReverse;
-
- VclPtr<ListBox> mpLBLabelPos;
- VclPtr<VclGrid> mpGridLabel;
-
- VclPtr<MetricField> mpNFRotation;
+ std::unique_ptr<weld::CheckButton> mxCBShowLabel;
+ std::unique_ptr<weld::CheckButton> mxCBReverse;
+ std::unique_ptr<weld::ComboBox> mxLBLabelPos;
+ std::unique_ptr<weld::Widget> mxGridLabel;
+ std::unique_ptr<weld::MetricSpinButton> mxNFRotation;
css::uno::Reference<css::frame::XModel> mxModel;
css::uno::Reference<css::util::XModifyListener> mxModifyListener;
@@ -90,9 +87,9 @@ private:
void Initialize();
- DECL_LINK(CheckBoxHdl, Button*, void);
- DECL_LINK(ListBoxHdl, ListBox&, void);
- DECL_LINK(TextRotationHdl, Edit&, void);
+ DECL_LINK(CheckBoxHdl, weld::ToggleButton&, void);
+ DECL_LINK(ListBoxHdl, weld::ComboBox&, void);
+ DECL_LINK(TextRotationHdl, weld::MetricSpinButton&, void);
};
} } // end of namespace ::chart::sidebar
diff --git a/chart2/uiconfig/ui/sidebaraxis.ui b/chart2/uiconfig/ui/sidebaraxis.ui
index ae5ffc08469a..bd113fd84d4e 100644
--- a/chart2/uiconfig/ui/sidebaraxis.ui
+++ b/chart2/uiconfig/ui/sidebaraxis.ui
@@ -1,7 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="chart">
<requires lib="gtk+" version="3.18"/>
+ <object class="GtkAdjustment" id="adjustmentSpinDegrees">
+ <property name="upper">359</property>
+ <property name="step_increment">5</property>
+ </object>
<object class="GtkGrid" id="ChartAxisPanel">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -88,7 +92,7 @@
<property name="valign">center</property>
<property name="label" translatable="yes" context="sidebaraxis|label2">_Text orientation:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">spinbutton1:0degrees</property>
+ <property name="mnemonic_widget">spinbutton1</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -96,9 +100,10 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="spinbutton1:0degrees">
+ <object class="GtkSpinButton" id="spinbutton1">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="adjustment">adjustmentSpinDegrees</property>
</object>
<packing>
<property name="left_attach">1</property>