chart2/source/controller/sidebar/ChartAxisPanel.cxx | 73 ++++------ chart2/source/controller/sidebar/ChartAxisPanel.hxx | 19 +- chart2/source/controller/sidebar/ChartErrorBarPanel.cxx | 106 ++++++-------- chart2/source/controller/sidebar/ChartErrorBarPanel.hxx | 22 +-- chart2/source/controller/sidebar/ChartSeriesPanel.cxx | 115 +++++++--------- chart2/source/controller/sidebar/ChartSeriesPanel.hxx | 29 +--- chart2/uiconfig/ui/sidebaraxis.ui | 11 + chart2/uiconfig/ui/sidebarerrorbar.ui | 41 +++-- chart2/uiconfig/ui/sidebarseries.ui | 5 9 files changed, 200 insertions(+), 221 deletions(-)
New commits: commit 750033e66585ddd4b4a8e5fe29b5a6739351403f Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Dec 20 15:06:23 2019 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sat Dec 21 11:26:07 2019 +0100 weld ChartAxisPanel Change-Id: Iea04954e950ad1eabc2c178e9782eb0ae20026cf Reviewed-on: https://gerrit.libreoffice.org/85613 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> 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> commit 674b22f486a230343067ede2c0540607b1854aeb Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Dec 20 14:33:55 2019 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sat Dec 21 11:25:45 2019 +0100 weld ChartErrorBarPanel Change-Id: I5baba4ec949e38b6c81cd6117c7bfcc2ffc61e3e Reviewed-on: https://gerrit.libreoffice.org/85611 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> 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> commit f9a2639d6a12010dd9e388fc46edc96ebab6db50 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Dec 20 14:23:16 2019 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sat Dec 21 11:25:19 2019 +0100 weld ChartSeriesPanel Change-Id: If035b4017eab094642d805cfbc724d6cdd5a115c Reviewed-on: https://gerrit.libreoffice.org/85608 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx index d2ce4e198fcc..33f0e1663585 100644 --- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx +++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx @@ -29,8 +29,6 @@ #include "ChartSeriesPanel.hxx" #include <ChartController.hxx> -#include <vcl/fixed.hxx> -#include <vcl/lstbox.hxx> #include <DataSeriesHelper.hxx> #include <RegressionCurveHelper.hxx> @@ -276,26 +274,22 @@ ChartSeriesPanel::ChartSeriesPanel( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, ChartController* pController) - : PanelLayout(pParent, "ChartSeriesPanel", "modules/schart/ui/sidebarseries.ui", rxFrame), - mxModel(pController->getModel()), - mxListener(new ChartSidebarModifyListener(this)), - mxSelectionListener(new ChartSidebarSelectionListener(this, OBJECTTYPE_DATA_SERIES)), - mbModelValid(true) + : PanelLayout(pParent, "ChartSeriesPanel", "modules/schart/ui/sidebarseries.ui", rxFrame, true) + , mxCBLabel(m_xBuilder->weld_check_button("checkbutton_label")) + , mxCBTrendline(m_xBuilder->weld_check_button("checkbutton_trendline")) + , mxCBXError(m_xBuilder->weld_check_button("checkbutton_x_error")) + , mxCBYError(m_xBuilder->weld_check_button("checkbutton_y_error")) + , mxRBPrimaryAxis(m_xBuilder->weld_radio_button("radiobutton_primary_axis")) + , mxRBSecondaryAxis(m_xBuilder->weld_radio_button("radiobutton_secondary_axis")) + , mxBoxLabelPlacement(m_xBuilder->weld_widget("datalabel_box")) + , mxLBLabelPlacement(m_xBuilder->weld_combo_box("comboboxtext_label")) + , mxFTSeriesName(m_xBuilder->weld_label("label_series_name")) + , mxFTSeriesTemplate(m_xBuilder->weld_label("label_series_tmpl")) + , mxModel(pController->getModel()) + , mxListener(new ChartSidebarModifyListener(this)) + , mxSelectionListener(new ChartSidebarSelectionListener(this, OBJECTTYPE_DATA_SERIES)) + , mbModelValid(true) { - get(mpCBLabel, "checkbutton_label"); - get(mpCBTrendline, "checkbutton_trendline"); - get(mpCBXError, "checkbutton_x_error"); - get(mpCBYError, "checkbutton_y_error"); - - get(mpRBPrimaryAxis, "radiobutton_primary_axis"); - get(mpRBSecondaryAxis, "radiobutton_secondary_axis"); - - get(mpBoxLabelPlacement, "datalabel_box"); - get(mpLBLabelPlacement, "comboboxtext_label"); - - get(mpFTSeriesName, "label_series_name"); - get(mpFTSeriesTemplate, "label_series_tmpl"); - Initialize(); } @@ -312,19 +306,19 @@ void ChartSeriesPanel::dispose() if (xSelectionSupplier.is()) xSelectionSupplier->removeSelectionChangeListener(mxSelectionListener); - mpCBLabel.clear(); - mpCBTrendline.clear(); - mpCBXError.clear(); - mpCBYError.clear(); + mxCBLabel.reset(); + mxCBTrendline.reset(); + mxCBXError.reset(); + mxCBYError.reset(); - mpRBPrimaryAxis.clear(); - mpRBSecondaryAxis.clear(); + mxRBPrimaryAxis.reset(); + mxRBSecondaryAxis.reset(); - mpBoxLabelPlacement.clear(); - mpLBLabelPlacement.clear(); + mxBoxLabelPlacement.reset(); + mxLBLabelPlacement.reset(); - mpFTSeriesName.clear(); - mpFTSeriesTemplate.clear(); + mxFTSeriesName.reset(); + mxFTSeriesTemplate.reset(); PanelLayout::dispose(); } @@ -339,17 +333,17 @@ void ChartSeriesPanel::Initialize() updateData(); - Link<Button*,void> aLink = LINK(this, ChartSeriesPanel, CheckBoxHdl); - mpCBLabel->SetClickHdl(aLink); - mpCBTrendline->SetClickHdl(aLink); - mpCBXError->SetClickHdl(aLink); - mpCBYError->SetClickHdl(aLink); + Link<weld::ToggleButton&,void> aLink = LINK(this, ChartSeriesPanel, CheckBoxHdl); + mxCBLabel->connect_toggled(aLink); + mxCBTrendline->connect_toggled(aLink); + mxCBXError->connect_toggled(aLink); + mxCBYError->connect_toggled(aLink); - Link<RadioButton&,void> aLink2 = LINK(this, ChartSeriesPanel, RadioBtnHdl); - mpRBPrimaryAxis->SetToggleHdl(aLink2); - mpRBSecondaryAxis->SetToggleHdl(aLink2); + Link<weld::ToggleButton&,void> aLink2 = LINK(this, ChartSeriesPanel, RadioBtnHdl); + mxRBPrimaryAxis->connect_toggled(aLink2); + mxRBSecondaryAxis->connect_toggled(aLink2); - mpLBLabelPlacement->SetSelectHdl(LINK(this, ChartSeriesPanel, ListBoxHdl)); + mxLBLabelPlacement->connect_changed(LINK(this, ChartSeriesPanel, ListBoxHdl)); } void ChartSeriesPanel::updateData() @@ -360,21 +354,21 @@ void ChartSeriesPanel::updateData() OUString aCID = getCID(mxModel); SolarMutexGuard aGuard; bool bLabelVisible = isDataLabelVisible(mxModel, aCID); - mpCBLabel->Check(bLabelVisible); - mpCBTrendline->Check(isTrendlineVisible(mxModel, aCID)); - mpCBXError->Check(isErrorBarVisible(mxModel, aCID, false)); - mpCBYError->Check(isErrorBarVisible(mxModel, aCID, true)); + mxCBLabel->set_active(bLabelVisible); + mxCBTrendline->set_active(isTrendlineVisible(mxModel, aCID)); + mxCBXError->set_active(isErrorBarVisible(mxModel, aCID, false)); + mxCBYError->set_active(isErrorBarVisible(mxModel, aCID, true)); bool bPrimaryAxis = isPrimaryAxis(mxModel, aCID); - mpRBPrimaryAxis->Check(bPrimaryAxis); - mpRBSecondaryAxis->Check(!bPrimaryAxis); + mxRBPrimaryAxis->set_active(bPrimaryAxis); + mxRBSecondaryAxis->set_active(!bPrimaryAxis); - mpBoxLabelPlacement->Enable(bLabelVisible); - mpLBLabelPlacement->SelectEntryPos(getDataLabelPlacement(mxModel, aCID)); + mxBoxLabelPlacement->set_sensitive(bLabelVisible); + mxLBLabelPlacement->set_active(getDataLabelPlacement(mxModel, aCID)); - OUString aFrameLabel = mpFTSeriesTemplate->GetText(); + OUString aFrameLabel = mxFTSeriesTemplate->get_label(); aFrameLabel = aFrameLabel.replaceFirst("%1", getSeriesLabel(mxModel, aCID)); - mpFTSeriesName->SetText(aFrameLabel); + mxFTSeriesName->set_label(aFrameLabel); } VclPtr<vcl::Window> ChartSeriesPanel::Create ( @@ -441,34 +435,33 @@ void ChartSeriesPanel::selectionChanged(bool bCorrectType) updateData(); } -IMPL_LINK(ChartSeriesPanel, CheckBoxHdl, Button*, pButton, void) +IMPL_LINK(ChartSeriesPanel, CheckBoxHdl, weld::ToggleButton&, rCheckBox, void) { - CheckBox* pCheckBox = static_cast<CheckBox*>(pButton); - bool bChecked = pCheckBox->IsChecked(); + bool bChecked = rCheckBox.get_active(); OUString aCID = getCID(mxModel); - if (pCheckBox == mpCBLabel.get()) + if (&rCheckBox == mxCBLabel.get()) setDataLabelVisible(mxModel, aCID, bChecked); - else if (pCheckBox == mpCBTrendline.get()) + else if (&rCheckBox == mxCBTrendline.get()) setTrendlineVisible(mxModel, aCID, bChecked); - else if (pCheckBox == mpCBXError.get()) + else if (&rCheckBox == mxCBXError.get()) setErrorBarVisible(mxModel, aCID, false, bChecked); - else if (pCheckBox == mpCBYError.get()) + else if (&rCheckBox == mxCBYError.get()) setErrorBarVisible(mxModel, aCID, true, bChecked); } -IMPL_LINK_NOARG(ChartSeriesPanel, RadioBtnHdl, RadioButton&, void) +IMPL_LINK_NOARG(ChartSeriesPanel, RadioBtnHdl, weld::ToggleButton&, void) { OUString aCID = getCID(mxModel); - bool bChecked = mpRBPrimaryAxis->IsChecked(); + bool bChecked = mxRBPrimaryAxis->get_active(); setAttachedAxisType(mxModel, aCID, bChecked); } -IMPL_LINK_NOARG(ChartSeriesPanel, ListBoxHdl, ListBox&, void) +IMPL_LINK_NOARG(ChartSeriesPanel, ListBoxHdl, weld::ComboBox&, void) { OUString aCID = getCID(mxModel); - sal_Int32 nPos = mpLBLabelPlacement->GetSelectedEntryPos(); + sal_Int32 nPos = mxLBLabelPlacement->get_active(); setDataLabelPlacement(mxModel, aCID, nPos); } diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx index 83dcbffd70ae..37a321af2b83 100644 --- a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx +++ b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx @@ -23,7 +23,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" @@ -31,8 +30,6 @@ namespace com { namespace sun { namespace star { namespace util { class XModifyListener; } } } } namespace com { namespace sun { namespace star { namespace view { class XSelectionChangeListener; } } } } -class ListBox; - namespace chart { class ChartController; @@ -80,19 +77,19 @@ public: private: //ui controls - VclPtr<CheckBox> mpCBLabel; - VclPtr<CheckBox> mpCBTrendline; - VclPtr<CheckBox> mpCBXError; - VclPtr<CheckBox> mpCBYError; + std::unique_ptr<weld::CheckButton> mxCBLabel; + std::unique_ptr<weld::CheckButton> mxCBTrendline; + std::unique_ptr<weld::CheckButton> mxCBXError; + std::unique_ptr<weld::CheckButton> mxCBYError; - VclPtr<RadioButton> mpRBPrimaryAxis; - VclPtr<RadioButton> mpRBSecondaryAxis; + std::unique_ptr<weld::RadioButton> mxRBPrimaryAxis; + std::unique_ptr<weld::RadioButton> mxRBSecondaryAxis; - VclPtr<VclHBox> mpBoxLabelPlacement; - VclPtr<ListBox> mpLBLabelPlacement; + std::unique_ptr<weld::Widget> mxBoxLabelPlacement; + std::unique_ptr<weld::ComboBox> mxLBLabelPlacement; - VclPtr<FixedText> mpFTSeriesName; - VclPtr<FixedText> mpFTSeriesTemplate; + std::unique_ptr<weld::Label> mxFTSeriesName; + std::unique_ptr<weld::Label> mxFTSeriesTemplate; css::uno::Reference<css::frame::XModel> mxModel; css::uno::Reference<css::util::XModifyListener> mxListener; @@ -102,9 +99,9 @@ private: void Initialize(); - DECL_LINK(CheckBoxHdl, Button*, void); - DECL_LINK(RadioBtnHdl, RadioButton&, void); - DECL_LINK(ListBoxHdl, ListBox&, void); + DECL_LINK(CheckBoxHdl, weld::ToggleButton&, void); + DECL_LINK(RadioBtnHdl, weld::ToggleButton&, void); + DECL_LINK(ListBoxHdl, weld::ComboBox&, void); }; } } // end of namespace ::chart::sidebar diff --git a/chart2/uiconfig/ui/sidebarseries.ui b/chart2/uiconfig/ui/sidebarseries.ui index 31dca273bb77..568569464a9e 100644 --- a/chart2/uiconfig/ui/sidebarseries.ui +++ b/chart2/uiconfig/ui/sidebarseries.ui @@ -1,5 +1,5 @@ <?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="GtkGrid" id="ChartSeriesPanel"> @@ -9,9 +9,9 @@ <object class="GtkBox" id="box1"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="border_width">6</property> <property name="orientation">vertical</property> <property name="spacing">6</property> - <property name="border_width">6</property> <child> <placeholder/> </child> @@ -242,6 +242,7 @@ <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> + <property name="group">radiobutton_primary_axis</property> </object> <packing> <property name="expand">False</property> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits