summaryrefslogtreecommitdiff
path: root/chart2/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-10-18 13:46:41 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-10-19 10:06:16 +0200
commit59a55475af8e4f6ce4f0976a73a605b012165d3a (patch)
tree9bf5f94014982ffd13295a24d7178ecd605a7f4c /chart2/source
parentdcb164b62032c389568c8114801cd0763b742852 (diff)
weld SchOptionTabPage
Change-Id: Iadcdd4b5343992517718da4adc7945e9a9f53710 Reviewed-on: https://gerrit.libreoffice.org/61958 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'chart2/source')
-rw-r--r--chart2/source/controller/dialogs/tp_SeriesToAxis.cxx162
-rw-r--r--chart2/source/controller/dialogs/tp_SeriesToAxis.hxx42
2 files changed, 87 insertions, 117 deletions
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
index 9690c47ec91b..3821f10e51fe 100644
--- a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
@@ -33,35 +33,29 @@
namespace chart
{
-SchOptionTabPage::SchOptionTabPage(vcl::Window* pWindow,const SfxItemSet& rInAttrs)
- : SfxTabPage(pWindow,
- "TP_OPTIONS",
- "modules/schart/ui/tp_SeriesToAxis.ui",
- &rInAttrs)
+SchOptionTabPage::SchOptionTabPage(TabPageParent pWindow,const SfxItemSet& rInAttrs)
+ : SfxTabPage(pWindow, "modules/schart/ui/tp_SeriesToAxis.ui", "TP_OPTIONS", &rInAttrs)
, m_nAllSeriesAxisIndex(0)
, m_bProvidesSecondaryYAxis(true)
, m_bProvidesOverlapAndGapWidth(false)
, m_bProvidesBarConnectors(false)
+ , m_xGrpAxis(m_xBuilder->weld_widget("frameGrpAxis"))
+ , m_xRbtAxis1(m_xBuilder->weld_radio_button("RBT_OPT_AXIS_1"))
+ , m_xRbtAxis2(m_xBuilder->weld_radio_button("RBT_OPT_AXIS_2"))
+ , m_xGrpBar(m_xBuilder->weld_widget("frameSettings"))
+ , m_xMTGap(m_xBuilder->weld_metric_spin_button("MT_GAP", FUNIT_PERCENT))
+ , m_xMTOverlap(m_xBuilder->weld_metric_spin_button("MT_OVERLAP", FUNIT_PERCENT))
+ , m_xCBConnect(m_xBuilder->weld_check_button("CB_CONNECTOR"))
+ , m_xCBAxisSideBySide(m_xBuilder->weld_check_button("CB_BARS_SIDE_BY_SIDE"))
+ , m_xGrpPlotOptions(m_xBuilder->weld_widget("frameFL_PLOT_OPTIONS"))
+ , m_xGridPlotOptions(m_xBuilder->weld_widget("gridPLOT_OPTIONS"))
+ , m_xRB_DontPaint(m_xBuilder->weld_radio_button("RB_DONT_PAINT"))
+ , m_xRB_AssumeZero(m_xBuilder->weld_radio_button("RB_ASSUME_ZERO"))
+ , m_xRB_ContinueLine(m_xBuilder->weld_radio_button("RB_CONTINUE_LINE"))
+ , m_xCBIncludeHiddenCells(m_xBuilder->weld_check_button("CB_INCLUDE_HIDDEN_CELLS"))
{
- get(m_pGrpAxis,"frameGrpAxis");
- get(m_pRbtAxis1,"RBT_OPT_AXIS_1");
- get(m_pRbtAxis2,"RBT_OPT_AXIS_2");
-
- get(m_pGrpBar,"frameSettings");
- get(m_pMTGap,"MT_GAP");
- get(m_pMTOverlap,"MT_OVERLAP");
- get(m_pCBConnect,"CB_CONNECTOR");
- get(m_pCBAxisSideBySide,"CB_BARS_SIDE_BY_SIDE");
-
- get(m_pGrpPlotOptions,"frameFL_PLOT_OPTIONS" );
- get(m_pGridPlotOptions,"gridPLOT_OPTIONS");
- get(m_pRB_DontPaint,"RB_DONT_PAINT");
- get(m_pRB_AssumeZero,"RB_ASSUME_ZERO");
- get(m_pRB_ContinueLine,"RB_CONTINUE_LINE");
- get(m_pCBIncludeHiddenCells,"CB_INCLUDE_HIDDEN_CELLS");
-
- m_pRbtAxis1->SetClickHdl( LINK( this, SchOptionTabPage, EnableHdl ));
- m_pRbtAxis2->SetClickHdl( LINK( this, SchOptionTabPage, EnableHdl ));
+ m_xRbtAxis1->connect_toggled(LINK(this, SchOptionTabPage, EnableHdl));
+ m_xRbtAxis2->connect_toggled(LINK(this, SchOptionTabPage, EnableHdl));
}
SchOptionTabPage::~SchOptionTabPage()
@@ -69,69 +63,50 @@ SchOptionTabPage::~SchOptionTabPage()
disposeOnce();
}
-void SchOptionTabPage::dispose()
-{
- m_pGrpAxis.clear();
- m_pRbtAxis1.clear();
- m_pRbtAxis2.clear();
- m_pGrpBar.clear();
- m_pMTGap.clear();
- m_pMTOverlap.clear();
- m_pCBConnect.clear();
- m_pCBAxisSideBySide.clear();
- m_pGrpPlotOptions.clear();
- m_pGridPlotOptions.clear();
- m_pRB_DontPaint.clear();
- m_pRB_AssumeZero.clear();
- m_pRB_ContinueLine.clear();
- m_pCBIncludeHiddenCells.clear();
- SfxTabPage::dispose();
-}
-
-IMPL_LINK_NOARG(SchOptionTabPage, EnableHdl, Button*, void)
+IMPL_LINK_NOARG(SchOptionTabPage, EnableHdl, weld::ToggleButton&, void)
{
if( m_nAllSeriesAxisIndex == 0 )
- m_pCBAxisSideBySide->Enable( m_pRbtAxis2->IsChecked());
+ m_xCBAxisSideBySide->set_sensitive( m_xRbtAxis2->get_active());
else if( m_nAllSeriesAxisIndex == 1 )
- m_pCBAxisSideBySide->Enable( m_pRbtAxis1->IsChecked());
+ m_xCBAxisSideBySide->set_sensitive( m_xRbtAxis1->get_active());
}
-VclPtr<SfxTabPage> SchOptionTabPage::Create(TabPageParent pWindow,
+VclPtr<SfxTabPage> SchOptionTabPage::Create(TabPageParent pParent,
const SfxItemSet* rOutAttrs)
{
- return VclPtr<SchOptionTabPage>::Create(pWindow.pParent, *rOutAttrs);
+ return VclPtr<SchOptionTabPage>::Create(pParent, *rOutAttrs);
}
bool SchOptionTabPage::FillItemSet(SfxItemSet* rOutAttrs)
{
- if(m_pRbtAxis2->IsChecked())
+ if(m_xRbtAxis2->get_active())
rOutAttrs->Put(SfxInt32Item(SCHATTR_AXIS,CHART_AXIS_SECONDARY_Y));
else
rOutAttrs->Put(SfxInt32Item(SCHATTR_AXIS,CHART_AXIS_PRIMARY_Y));
- if(m_pMTGap->IsVisible())
- rOutAttrs->Put(SfxInt32Item(SCHATTR_BAR_GAPWIDTH,static_cast< sal_Int32 >( m_pMTGap->GetValue())));
+ if(m_xMTGap->get_visible())
+ rOutAttrs->Put(SfxInt32Item(SCHATTR_BAR_GAPWIDTH,static_cast< sal_Int32 >( m_xMTGap->get_value(FUNIT_PERCENT))));
- if(m_pMTOverlap->IsVisible())
- rOutAttrs->Put(SfxInt32Item(SCHATTR_BAR_OVERLAP,static_cast< sal_Int32 >( m_pMTOverlap->GetValue())));
+ if(m_xMTOverlap->get_visible())
+ rOutAttrs->Put(SfxInt32Item(SCHATTR_BAR_OVERLAP,static_cast< sal_Int32 >( m_xMTOverlap->get_value(FUNIT_PERCENT))));
- if(m_pCBConnect->IsVisible())
- rOutAttrs->Put(SfxBoolItem(SCHATTR_BAR_CONNECT,m_pCBConnect->IsChecked()));
+ if(m_xCBConnect->get_visible())
+ rOutAttrs->Put(SfxBoolItem(SCHATTR_BAR_CONNECT,m_xCBConnect->get_active()));
// model property is "group bars per axis", UI feature is the other way
// round: "show bars side by side"
- if(m_pCBAxisSideBySide->IsVisible())
- rOutAttrs->Put(SfxBoolItem(SCHATTR_GROUP_BARS_PER_AXIS, ! m_pCBAxisSideBySide->IsChecked()));
+ if(m_xCBAxisSideBySide->get_visible())
+ rOutAttrs->Put(SfxBoolItem(SCHATTR_GROUP_BARS_PER_AXIS, ! m_xCBAxisSideBySide->get_active()));
- if(m_pRB_DontPaint->IsChecked())
+ if(m_xRB_DontPaint->get_active())
rOutAttrs->Put(SfxInt32Item(SCHATTR_MISSING_VALUE_TREATMENT,css::chart::MissingValueTreatment::LEAVE_GAP));
- else if(m_pRB_AssumeZero->IsChecked())
+ else if(m_xRB_AssumeZero->get_active())
rOutAttrs->Put(SfxInt32Item(SCHATTR_MISSING_VALUE_TREATMENT,css::chart::MissingValueTreatment::USE_ZERO));
- else if(m_pRB_ContinueLine->IsChecked())
+ else if(m_xRB_ContinueLine->get_active())
rOutAttrs->Put(SfxInt32Item(SCHATTR_MISSING_VALUE_TREATMENT,css::chart::MissingValueTreatment::CONTINUE));
- if (m_pCBIncludeHiddenCells->IsVisible())
- rOutAttrs->Put(SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, m_pCBIncludeHiddenCells->IsChecked()));
+ if (m_xCBIncludeHiddenCells->get_visible())
+ rOutAttrs->Put(SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, m_xCBIncludeHiddenCells->get_active()));
return true;
}
@@ -140,15 +115,15 @@ void SchOptionTabPage::Reset(const SfxItemSet* rInAttrs)
{
const SfxPoolItem *pPoolItem = nullptr;
- m_pRbtAxis1->Check();
- m_pRbtAxis2->Check(false);
+ m_xRbtAxis1->set_active(true);
+ m_xRbtAxis2->set_active(false);
if (rInAttrs->GetItemState(SCHATTR_AXIS,true, &pPoolItem) == SfxItemState::SET)
{
long nVal=static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
if(nVal==CHART_AXIS_SECONDARY_Y)
{
- m_pRbtAxis2->Check();
- m_pRbtAxis1->Check(false);
+ m_xRbtAxis2->set_active(true);
+ m_xRbtAxis1->set_active(false);
}
}
@@ -156,36 +131,36 @@ void SchOptionTabPage::Reset(const SfxItemSet* rInAttrs)
if (rInAttrs->GetItemState(SCHATTR_BAR_GAPWIDTH, true, &pPoolItem) == SfxItemState::SET)
{
nTmp = static_cast<long>(static_cast<const SfxInt32Item*>(pPoolItem)->GetValue());
- m_pMTGap->SetValue(nTmp);
+ m_xMTGap->set_value(nTmp, FUNIT_PERCENT);
}
if (rInAttrs->GetItemState(SCHATTR_BAR_OVERLAP, true, &pPoolItem) == SfxItemState::SET)
{
nTmp = static_cast<long>(static_cast<const SfxInt32Item*>(pPoolItem)->GetValue());
- m_pMTOverlap->SetValue(nTmp);
+ m_xMTOverlap->set_value(nTmp, FUNIT_PERCENT);
}
if (rInAttrs->GetItemState(SCHATTR_BAR_CONNECT, true, &pPoolItem) == SfxItemState::SET)
{
bool bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
- m_pCBConnect->Check(bCheck);
+ m_xCBConnect->set_active(bCheck);
}
if (rInAttrs->GetItemState(SCHATTR_AXIS_FOR_ALL_SERIES, true, &pPoolItem) == SfxItemState::SET)
{
m_nAllSeriesAxisIndex = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
- m_pCBAxisSideBySide->Disable();
+ m_xCBAxisSideBySide->set_sensitive(false);
}
if (rInAttrs->GetItemState(SCHATTR_GROUP_BARS_PER_AXIS, true, &pPoolItem) == SfxItemState::SET)
{
// model property is "group bars per axis", UI feature is the other way
// round: "show bars side by side"
bool bCheck = ! static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
- m_pCBAxisSideBySide->Check( bCheck );
+ m_xCBAxisSideBySide->set_active( bCheck );
}
else
{
- m_pCBAxisSideBySide->Show(false);
+ m_xCBAxisSideBySide->show(false);
}
//missing value treatment
@@ -196,31 +171,31 @@ void SchOptionTabPage::Reset(const SfxItemSet* rInAttrs)
if ( aMissingValueTreatments.size()>1 && rInAttrs->GetItemState(SCHATTR_MISSING_VALUE_TREATMENT,true, &pPoolItem) == SfxItemState::SET)
{
- m_pRB_DontPaint->Enable(false);
- m_pRB_AssumeZero->Enable(false);
- m_pRB_ContinueLine->Enable(false);
+ m_xRB_DontPaint->set_sensitive(false);
+ m_xRB_AssumeZero->set_sensitive(false);
+ m_xRB_ContinueLine->set_sensitive(false);
for(int nVal : aMissingValueTreatments)
{
if(nVal==css::chart::MissingValueTreatment::LEAVE_GAP)
- m_pRB_DontPaint->Enable();
+ m_xRB_DontPaint->set_sensitive(true);
else if(nVal==css::chart::MissingValueTreatment::USE_ZERO)
- m_pRB_AssumeZero->Enable();
+ m_xRB_AssumeZero->set_sensitive(true);
else if(nVal==css::chart::MissingValueTreatment::CONTINUE)
- m_pRB_ContinueLine->Enable();
+ m_xRB_ContinueLine->set_sensitive(true);
}
long nVal=static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
if(nVal==css::chart::MissingValueTreatment::LEAVE_GAP)
- m_pRB_DontPaint->Check();
+ m_xRB_DontPaint->set_active(true);
else if(nVal==css::chart::MissingValueTreatment::USE_ZERO)
- m_pRB_AssumeZero->Check();
+ m_xRB_AssumeZero->set_active(true);
else if(nVal==css::chart::MissingValueTreatment::CONTINUE)
- m_pRB_ContinueLine->Check();
+ m_xRB_ContinueLine->set_active(true);
}
else
{
- m_pGridPlotOptions->Show(false);
+ m_xGridPlotOptions->show(false);
}
}
@@ -228,16 +203,16 @@ void SchOptionTabPage::Reset(const SfxItemSet* rInAttrs)
if (rInAttrs->GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, true, &pPoolItem) == SfxItemState::SET)
{
bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
- m_pCBIncludeHiddenCells->Check(bVal);
+ m_xCBIncludeHiddenCells->set_active(bVal);
}
else
{
- m_pCBIncludeHiddenCells->Show(false);
+ m_xCBIncludeHiddenCells->show(false);
// check if the radiobutton guys above
// are visible. If they aren't, we can
// as well hide the whole frame
- if(!m_pGridPlotOptions->IsVisible())
- m_pGrpPlotOptions->Show(false);
+ if(!m_xGridPlotOptions->get_visible())
+ m_xGrpPlotOptions->show(false);
}
AdaptControlPositionsAndVisibility();
@@ -254,17 +229,18 @@ void SchOptionTabPage::Init( bool bProvidesSecondaryYAxis, bool bProvidesOverlap
void SchOptionTabPage::AdaptControlPositionsAndVisibility()
{
- m_pGrpAxis->Show(m_bProvidesSecondaryYAxis);
+ m_xGrpAxis->show(m_bProvidesSecondaryYAxis);
- m_pGrpBar->Show(m_bProvidesOverlapAndGapWidth);
+ m_xGrpBar->show(m_bProvidesOverlapAndGapWidth);
- m_pCBConnect->Show(m_bProvidesBarConnectors);
+ m_xCBConnect->show(m_bProvidesBarConnectors);
- if( !m_pMTGap->IsVisible() && !m_pMTOverlap->IsVisible() )
- {
- m_pGrpBar->Show(false);
- }
+ if( !m_xMTGap->get_visible() && !m_xMTOverlap->get_visible() )
+ {
+ m_xGrpBar->show(false);
+ }
}
+
} //namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
index d2d671109d4b..61a2d0b63377 100644
--- a/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
@@ -20,9 +20,7 @@
#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_SERIESTOAXIS_HXX
#include <sfx2/tabdlg.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/button.hxx>
-#include <vcl/field.hxx>
+#include <vcl/weld.hxx>
namespace chart
{
@@ -30,9 +28,8 @@ namespace chart
class SchOptionTabPage : public SfxTabPage
{
public:
- SchOptionTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs);
+ SchOptionTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs);
virtual ~SchOptionTabPage() override;
- virtual void dispose() override;
static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet* rInAttrs);
virtual bool FillItemSet(SfxItemSet* rOutAttrs) override;
@@ -44,31 +41,28 @@ private: //methods
void AdaptControlPositionsAndVisibility();
private: //member
- VclPtr<VclFrame> m_pGrpAxis;
- VclPtr<RadioButton> m_pRbtAxis1;
- VclPtr<RadioButton> m_pRbtAxis2;
-
- VclPtr<VclFrame> m_pGrpBar;
- VclPtr<MetricField> m_pMTGap;
- VclPtr<MetricField> m_pMTOverlap;
- VclPtr<CheckBox> m_pCBConnect;
- VclPtr<CheckBox> m_pCBAxisSideBySide;
-
- VclPtr<VclFrame> m_pGrpPlotOptions;
- VclPtr<VclGrid> m_pGridPlotOptions;
- VclPtr<RadioButton> m_pRB_DontPaint;
- VclPtr<RadioButton> m_pRB_AssumeZero;
- VclPtr<RadioButton> m_pRB_ContinueLine;
-
- VclPtr<CheckBox> m_pCBIncludeHiddenCells;
-
- DECL_LINK(EnableHdl, Button*, void );
+ DECL_LINK(EnableHdl, weld::ToggleButton&, void );
sal_Int32 m_nAllSeriesAxisIndex;
bool m_bProvidesSecondaryYAxis;
bool m_bProvidesOverlapAndGapWidth;
bool m_bProvidesBarConnectors;
+
+ std::unique_ptr<weld::Widget> m_xGrpAxis;
+ std::unique_ptr<weld::RadioButton> m_xRbtAxis1;
+ std::unique_ptr<weld::RadioButton> m_xRbtAxis2;
+ std::unique_ptr<weld::Widget> m_xGrpBar;
+ std::unique_ptr<weld::MetricSpinButton> m_xMTGap;
+ std::unique_ptr<weld::MetricSpinButton> m_xMTOverlap;
+ std::unique_ptr<weld::CheckButton> m_xCBConnect;
+ std::unique_ptr<weld::CheckButton> m_xCBAxisSideBySide;
+ std::unique_ptr<weld::Widget> m_xGrpPlotOptions;
+ std::unique_ptr<weld::Widget> m_xGridPlotOptions;
+ std::unique_ptr<weld::RadioButton> m_xRB_DontPaint;
+ std::unique_ptr<weld::RadioButton> m_xRB_AssumeZero;
+ std::unique_ptr<weld::RadioButton> m_xRB_ContinueLine;
+ std::unique_ptr<weld::CheckButton> m_xCBIncludeHiddenCells;
};
} //namespace chart