summaryrefslogtreecommitdiff
path: root/chart2/source/controller/dialogs/tp_Scale.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/controller/dialogs/tp_Scale.cxx')
-rw-r--r--chart2/source/controller/dialogs/tp_Scale.cxx476
1 files changed, 207 insertions, 269 deletions
diff --git a/chart2/source/controller/dialogs/tp_Scale.cxx b/chart2/source/controller/dialogs/tp_Scale.cxx
index b785414e7a7f..21794cf1a9b6 100644
--- a/chart2/source/controller/dialogs/tp_Scale.cxx
+++ b/chart2/source/controller/dialogs/tp_Scale.cxx
@@ -43,81 +43,61 @@ namespace chart
namespace
{
-void lcl_setValue( FormattedField& rFmtField, double fValue )
+void lcl_setValue(weld::FormattedSpinButton& rFmtField, double fValue)
{
- rFmtField.SetValue( fValue );
- rFmtField.SetDefaultValue( fValue );
+ rFmtField.set_value(fValue);
}
}
-ScaleTabPage::ScaleTabPage(vcl::Window* pWindow,const SfxItemSet& rInAttrs) :
- SfxTabPage(pWindow
- , "tp_Scale"
- , "modules/schart/ui/tp_Scale.ui"
- , &rInAttrs),
- fMin(0.0),
- fMax(0.0),
- fStepMain(0.0),
- nStepHelp(0),
- fOrigin(0.0),
- m_nTimeResolution(1),
- m_nMainTimeUnit(1),
- m_nHelpTimeUnit(1),
- m_nAxisType(chart2::AxisType::REALNUMBER),
- m_bAllowDateAxis(false),
- pNumFormatter(nullptr),
- m_bShowAxisOrigin(false)
+ScaleTabPage::ScaleTabPage(TabPageParent pWindow,const SfxItemSet& rInAttrs)
+ : SfxTabPage(pWindow, "modules/schart/ui/tp_Scale.ui", "tp_Scale", &rInAttrs)
+ , fMin(0.0)
+ , fMax(0.0)
+ , fStepMain(0.0)
+ , nStepHelp(0)
+ , fOrigin(0.0)
+ , m_nTimeResolution(1)
+ , m_nMainTimeUnit(1)
+ , m_nHelpTimeUnit(1)
+ , m_nAxisType(chart2::AxisType::REALNUMBER)
+ , m_bAllowDateAxis(false)
+ , pNumFormatter(nullptr)
+ , m_bShowAxisOrigin(false)
+ , m_xCbxReverse(m_xBuilder->weld_check_button("CBX_REVERSE"))
+ , m_xCbxLogarithm(m_xBuilder->weld_check_button("CBX_LOGARITHM"))
+ , m_xBxType(m_xBuilder->weld_widget("boxTYPE"))
+ , m_xLB_AxisType(m_xBuilder->weld_combo_box("LB_AXIS_TYPE"))
+ , m_xBxMinMax(m_xBuilder->weld_widget("gridMINMAX"))
+ , m_xFmtFldMin(m_xBuilder->weld_formatted_spin_button("EDT_MIN"))
+ , m_xCbxAutoMin(m_xBuilder->weld_check_button("CBX_AUTO_MIN"))
+ , m_xFmtFldMax(m_xBuilder->weld_formatted_spin_button("EDT_MAX"))
+ , m_xCbxAutoMax(m_xBuilder->weld_check_button("CBX_AUTO_MAX"))
+ , m_xBxResolution(m_xBuilder->weld_widget("boxRESOLUTION"))
+ , m_xLB_TimeResolution(m_xBuilder->weld_combo_box("LB_TIME_RESOLUTION"))
+ , m_xCbx_AutoTimeResolution(m_xBuilder->weld_check_button("CBX_AUTO_TIME_RESOLUTION"))
+ , m_xTxtMain(m_xBuilder->weld_label("TXT_STEP_MAIN"))
+ , m_xFmtFldStepMain(m_xBuilder->weld_formatted_spin_button("EDT_STEP_MAIN"))
+ , m_xMt_MainDateStep(m_xBuilder->weld_spin_button("MT_MAIN_DATE_STEP"))
+ , m_xLB_MainTimeUnit(m_xBuilder->weld_combo_box("LB_MAIN_TIME_UNIT"))
+ , m_xCbxAutoStepMain(m_xBuilder->weld_check_button("CBX_AUTO_STEP_MAIN"))
+ , m_xTxtHelpCount(m_xBuilder->weld_label("TXT_STEP_HELP_COUNT"))
+ , m_xTxtHelp(m_xBuilder->weld_label("TXT_STEP_HELP"))
+ , m_xMtStepHelp(m_xBuilder->weld_spin_button("MT_STEPHELP"))
+ , m_xLB_HelpTimeUnit(m_xBuilder->weld_combo_box("LB_HELP_TIME_UNIT"))
+ , m_xCbxAutoStepHelp(m_xBuilder->weld_check_button("CBX_AUTO_STEP_HELP"))
+ , m_xFmtFldOrigin(m_xBuilder->weld_formatted_spin_button("EDT_ORIGIN"))
+ , m_xCbxAutoOrigin(m_xBuilder->weld_check_button("CBX_AUTO_ORIGIN"))
+ , m_xBxOrigin(m_xBuilder->weld_widget("boxORIGIN"))
{
- get(m_pCbxReverse, "CBX_REVERSE");
- get(m_pCbxLogarithm, "CBX_LOGARITHM");
- get(m_pLB_AxisType, "LB_AXIS_TYPE");
- get(m_pBxType,"boxTYPE");
-
- get(m_pBxMinMax, "gridMINMAX");
- get(m_pFmtFldMin, "EDT_MIN");
- get(m_pCbxAutoMin, "CBX_AUTO_MIN");
- get(m_pFmtFldMax, "EDT_MAX");
- get(m_pCbxAutoMax, "CBX_AUTO_MAX");
-
- get(m_pBxResolution, "boxRESOLUTION");
- get(m_pLB_TimeResolution, "LB_TIME_RESOLUTION");
- get(m_pCbx_AutoTimeResolution, "CBX_AUTO_TIME_RESOLUTION");
-
- get(m_pTxtMain, "TXT_STEP_MAIN");
- get(m_pFmtFldStepMain, "EDT_STEP_MAIN");
- get(m_pMt_MainDateStep, "MT_MAIN_DATE_STEP");
- get(m_pLB_MainTimeUnit, "LB_MAIN_TIME_UNIT");
- get(m_pCbxAutoStepMain, "CBX_AUTO_STEP_MAIN");
-
- get(m_pMtStepHelp, "MT_STEPHELP");
- get(m_pLB_HelpTimeUnit, "LB_HELP_TIME_UNIT");
- get(m_pCbxAutoStepHelp, "CBX_AUTO_STEP_HELP");
- get(m_pTxtHelpCount,"TXT_STEP_HELP_COUNT");
- get(m_pTxtHelp,"TXT_STEP_HELP");
-
- get(m_pBxOrigin,"boxORIGIN");
- get(m_pFmtFldOrigin, "EDT_ORIGIN");
- get(m_pCbxAutoOrigin, "CBX_AUTO_ORIGIN");
-
- m_pCbxAutoMin->SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
- m_pCbxAutoMax->SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
- m_pCbxAutoStepMain->SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
- m_pCbxAutoStepHelp->SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
- m_pCbxAutoOrigin->SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
- m_pCbx_AutoTimeResolution->SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
-
- m_pLB_AxisType->SetDropDownLineCount(3);
- m_pLB_AxisType->SetSelectHdl(LINK(this, ScaleTabPage, SelectAxisTypeHdl));
-
- m_pLB_TimeResolution->SetDropDownLineCount(3);
- m_pLB_MainTimeUnit->SetDropDownLineCount(3);
- m_pLB_HelpTimeUnit->SetDropDownLineCount(3);
-
- m_pFmtFldMin->SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl));
- m_pFmtFldMax->SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl));
- m_pFmtFldStepMain->SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl));
- m_pFmtFldOrigin->SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl));
+ m_xCbxAutoMin->connect_toggled(LINK(this, ScaleTabPage, EnableValueHdl));
+ m_xCbxAutoMax->connect_toggled(LINK(this, ScaleTabPage, EnableValueHdl));
+ m_xCbxAutoStepMain->connect_toggled(LINK(this, ScaleTabPage, EnableValueHdl));
+ m_xCbxAutoStepHelp->connect_toggled(LINK(this, ScaleTabPage, EnableValueHdl));
+ m_xCbxAutoOrigin->connect_toggled(LINK(this, ScaleTabPage, EnableValueHdl));
+ m_xCbx_AutoTimeResolution->connect_toggled(LINK(this, ScaleTabPage, EnableValueHdl));
+
+ m_xLB_AxisType->connect_changed(LINK(this, ScaleTabPage, SelectAxisTypeHdl));
HideAllControls();
}
@@ -127,43 +107,6 @@ ScaleTabPage::~ScaleTabPage()
disposeOnce();
}
-void ScaleTabPage::dispose()
-{
- m_pCbxReverse.clear();
- m_pCbxLogarithm.clear();
- m_pBxType.clear();
- m_pLB_AxisType.clear();
- m_pBxMinMax.clear();
- m_pFmtFldMin.clear();
- m_pCbxAutoMin.clear();
- m_pFmtFldMax.clear();
- m_pCbxAutoMax.clear();
- m_pBxResolution.clear();
- m_pLB_TimeResolution.clear();
- m_pCbx_AutoTimeResolution.clear();
- m_pTxtMain.clear();
- m_pFmtFldStepMain.clear();
- m_pMt_MainDateStep.clear();
- m_pLB_MainTimeUnit.clear();
- m_pCbxAutoStepMain.clear();
- m_pTxtHelpCount.clear();
- m_pTxtHelp.clear();
- m_pMtStepHelp.clear();
- m_pLB_HelpTimeUnit.clear();
- m_pCbxAutoStepHelp.clear();
- m_pFmtFldOrigin.clear();
- m_pCbxAutoOrigin.clear();
- m_pBxOrigin.clear();
- SfxTabPage::dispose();
-}
-
-IMPL_STATIC_LINK(
- ScaleTabPage, FmtFieldModifiedHdl, Edit&, rEdit, void )
-{
- FormattedField& rFmtField = static_cast<FormattedField&>(rEdit);
- rFmtField.SetDefaultValue( rFmtField.GetValue() );
-}
-
void ScaleTabPage::EnableControls()
{
bool bValueAxis = m_nAxisType == chart2::AxisType::REALNUMBER
@@ -171,77 +114,76 @@ void ScaleTabPage::EnableControls()
|| m_nAxisType == chart2::AxisType::DATE;
bool bDateAxis = m_nAxisType == chart2::AxisType::DATE;
- m_pBxType->Show(m_bAllowDateAxis);
+ m_xBxType->show(m_bAllowDateAxis);
- m_pCbxLogarithm->Show( bValueAxis && !bDateAxis );
+ m_xCbxLogarithm->show( bValueAxis && !bDateAxis );
- m_pBxMinMax->Show(bValueAxis);
+ m_xBxMinMax->show(bValueAxis);
- m_pTxtMain->Show( bValueAxis );
- m_pCbxAutoStepMain->Show( bValueAxis );
+ m_xTxtMain->show( bValueAxis );
+ m_xCbxAutoStepMain->show( bValueAxis );
- m_pTxtHelpCount->Show( bValueAxis && !bDateAxis );
- m_pTxtHelp->Show( bDateAxis );
- m_pMtStepHelp->Show( bValueAxis );
- m_pCbxAutoStepHelp->Show( bValueAxis );
+ m_xTxtHelpCount->show( bValueAxis && !bDateAxis );
+ m_xTxtHelp->show( bDateAxis );
+ m_xMtStepHelp->show( bValueAxis );
+ m_xCbxAutoStepHelp->show( bValueAxis );
- m_pBxOrigin->Show( m_bShowAxisOrigin && bValueAxis );
- m_pBxResolution->Show( bDateAxis );
+ m_xBxOrigin->show( m_bShowAxisOrigin && bValueAxis );
+ m_xBxResolution->show( bDateAxis );
- bool bWasDateAxis = m_pMt_MainDateStep->IsVisible();
+ bool bWasDateAxis = m_xMt_MainDateStep->get_visible();
if( bWasDateAxis != bDateAxis )
{
//transport value from one to other control
if( bWasDateAxis )
- lcl_setValue( *m_pFmtFldStepMain, m_pMt_MainDateStep->GetValue() );
+ lcl_setValue( *m_xFmtFldStepMain, m_xMt_MainDateStep->get_value() );
else
- m_pMt_MainDateStep->SetValue( static_cast<sal_Int32>(m_pFmtFldStepMain->GetValue()) );
+ m_xMt_MainDateStep->set_value(m_xFmtFldStepMain->get_value());
}
- m_pFmtFldStepMain->Show( bValueAxis && !bDateAxis );
- m_pMt_MainDateStep->Show( bDateAxis );
+ m_xFmtFldStepMain->show( bValueAxis && !bDateAxis );
+ m_xMt_MainDateStep->show( bDateAxis );
- m_pLB_MainTimeUnit->Show( bDateAxis );
- m_pLB_HelpTimeUnit->Show( bDateAxis );
+ m_xLB_MainTimeUnit->show( bDateAxis );
+ m_xLB_HelpTimeUnit->show( bDateAxis );
- EnableValueHdl(m_pCbxAutoMin);
- EnableValueHdl(m_pCbxAutoMax);
- EnableValueHdl(m_pCbxAutoStepMain);
- EnableValueHdl(m_pCbxAutoStepHelp);
- EnableValueHdl(m_pCbxAutoOrigin);
- EnableValueHdl(m_pCbx_AutoTimeResolution);
+ EnableValueHdl(*m_xCbxAutoMin);
+ EnableValueHdl(*m_xCbxAutoMax);
+ EnableValueHdl(*m_xCbxAutoStepMain);
+ EnableValueHdl(*m_xCbxAutoStepHelp);
+ EnableValueHdl(*m_xCbxAutoOrigin);
+ EnableValueHdl(*m_xCbx_AutoTimeResolution);
}
-IMPL_LINK( ScaleTabPage, EnableValueHdl, Button *, pButton, void )
+IMPL_LINK( ScaleTabPage, EnableValueHdl, weld::ToggleButton&, rCbx, void )
{
- CheckBox * pCbx = static_cast<CheckBox*>(pButton);
- bool bEnable = pCbx && !pCbx->IsChecked() && pCbx->IsEnabled();
- if (pCbx == m_pCbxAutoMin)
+ bool bEnable = !rCbx.get_active() && rCbx.get_sensitive();
+ if (&rCbx == m_xCbxAutoMin.get())
{
- m_pFmtFldMin->Enable( bEnable );
+ m_xFmtFldMin->set_sensitive( bEnable );
}
- else if (pCbx == m_pCbxAutoMax)
+ else if (&rCbx == m_xCbxAutoMax.get())
{
- m_pFmtFldMax->Enable( bEnable );
+ m_xFmtFldMax->set_sensitive( bEnable );
}
- else if (pCbx == m_pCbxAutoStepMain)
+ else if (&rCbx == m_xCbxAutoStepMain.get())
{
- m_pFmtFldStepMain->Enable( bEnable );
- m_pMt_MainDateStep->Enable( bEnable );
- m_pLB_MainTimeUnit->Enable( bEnable );
+ m_xFmtFldStepMain->set_sensitive( bEnable );
+ m_xMt_MainDateStep->set_sensitive( bEnable );
+ m_xLB_MainTimeUnit->set_sensitive( bEnable );
}
- else if (pCbx == m_pCbxAutoStepHelp)
+ else if (&rCbx == m_xCbxAutoStepHelp.get())
{
- m_pMtStepHelp->Enable( bEnable );
- m_pLB_HelpTimeUnit->Enable( bEnable );
+ m_xMtStepHelp->set_sensitive( bEnable );
+ m_xLB_HelpTimeUnit->set_sensitive( bEnable );
}
- else if (pCbx == m_pCbx_AutoTimeResolution)
+ else if (&rCbx == m_xCbx_AutoTimeResolution.get())
{
- m_pLB_TimeResolution->Enable( bEnable );
+ m_xLB_TimeResolution->set_sensitive( bEnable );
}
- else if (pCbx == m_pCbxAutoOrigin)
+ else if (&rCbx == m_xCbxAutoOrigin.get())
{
- m_pFmtFldOrigin->Enable( bEnable );
+ m_xFmtFldOrigin->set_sensitive( bEnable );
}
}
@@ -252,22 +194,22 @@ enum AxisTypeListBoxEntry
TYPE_DATE=2
};
-IMPL_LINK_NOARG(ScaleTabPage, SelectAxisTypeHdl, ListBox&, void)
+IMPL_LINK_NOARG(ScaleTabPage, SelectAxisTypeHdl, weld::ComboBox&, void)
{
- const sal_Int32 nPos = m_pLB_AxisType->GetSelectedEntryPos();
+ const sal_Int32 nPos = m_xLB_AxisType->get_active();
if( nPos==TYPE_DATE )
m_nAxisType = chart2::AxisType::DATE;
else
m_nAxisType = chart2::AxisType::CATEGORY;
if( m_nAxisType == chart2::AxisType::DATE )
- m_pCbxLogarithm->Check(false);
+ m_xCbxLogarithm->set_active(false);
EnableControls();
SetNumFormat();
}
-VclPtr<SfxTabPage> ScaleTabPage::Create(TabPageParent pWindow,const SfxItemSet* rOutAttrs)
+VclPtr<SfxTabPage> ScaleTabPage::Create(TabPageParent pParent, const SfxItemSet* rOutAttrs)
{
- return VclPtr<ScaleTabPage>::Create(pWindow.pParent, *rOutAttrs);
+ return VclPtr<ScaleTabPage>::Create(pParent, *rOutAttrs);
}
bool ScaleTabPage::FillItemSet(SfxItemSet* rOutAttrs)
@@ -276,27 +218,27 @@ bool ScaleTabPage::FillItemSet(SfxItemSet* rOutAttrs)
rOutAttrs->Put(SfxInt32Item(SCHATTR_AXISTYPE, m_nAxisType));
if(m_bAllowDateAxis)
- rOutAttrs->Put(SfxBoolItem(SCHATTR_AXIS_AUTO_DATEAXIS, m_pLB_AxisType->GetSelectedEntryPos()==TYPE_AUTO));
+ rOutAttrs->Put(SfxBoolItem(SCHATTR_AXIS_AUTO_DATEAXIS, m_xLB_AxisType->get_active()==TYPE_AUTO));
bool bAutoScale = false;
if( m_nAxisType==chart2::AxisType::CATEGORY )
bAutoScale = true;//reset scaling for category charts
- rOutAttrs->Put(SfxBoolItem(SCHATTR_AXIS_AUTO_MIN ,bAutoScale || m_pCbxAutoMin->IsChecked()));
- rOutAttrs->Put(SfxBoolItem(SCHATTR_AXIS_AUTO_MAX ,bAutoScale || m_pCbxAutoMax->IsChecked()));
- rOutAttrs->Put(SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_HELP,bAutoScale || m_pCbxAutoStepHelp->IsChecked()));
- rOutAttrs->Put(SfxBoolItem(SCHATTR_AXIS_AUTO_ORIGIN ,bAutoScale || m_pCbxAutoOrigin->IsChecked()));
- rOutAttrs->Put(SfxBoolItem(SCHATTR_AXIS_LOGARITHM ,m_pCbxLogarithm->IsChecked()));
- rOutAttrs->Put(SfxBoolItem(SCHATTR_AXIS_REVERSE ,m_pCbxReverse->IsChecked()));
+ rOutAttrs->Put(SfxBoolItem(SCHATTR_AXIS_AUTO_MIN ,bAutoScale || m_xCbxAutoMin->get_active()));
+ rOutAttrs->Put(SfxBoolItem(SCHATTR_AXIS_AUTO_MAX ,bAutoScale || m_xCbxAutoMax->get_active()));
+ rOutAttrs->Put(SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_HELP,bAutoScale || m_xCbxAutoStepHelp->get_active()));
+ rOutAttrs->Put(SfxBoolItem(SCHATTR_AXIS_AUTO_ORIGIN ,bAutoScale || m_xCbxAutoOrigin->get_active()));
+ rOutAttrs->Put(SfxBoolItem(SCHATTR_AXIS_LOGARITHM ,m_xCbxLogarithm->get_active()));
+ rOutAttrs->Put(SfxBoolItem(SCHATTR_AXIS_REVERSE ,m_xCbxReverse->get_active()));
rOutAttrs->Put(SvxDoubleItem(fMax , SCHATTR_AXIS_MAX));
rOutAttrs->Put(SvxDoubleItem(fMin , SCHATTR_AXIS_MIN));
rOutAttrs->Put(SfxInt32Item(SCHATTR_AXIS_STEP_HELP, nStepHelp));
rOutAttrs->Put(SvxDoubleItem(fOrigin , SCHATTR_AXIS_ORIGIN));
- rOutAttrs->Put(SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_MAIN,bAutoScale || m_pCbxAutoStepMain->IsChecked()));
+ rOutAttrs->Put(SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_MAIN,bAutoScale || m_xCbxAutoStepMain->get_active()));
rOutAttrs->Put(SvxDoubleItem(fStepMain,SCHATTR_AXIS_STEP_MAIN));
- rOutAttrs->Put(SfxBoolItem(SCHATTR_AXIS_AUTO_TIME_RESOLUTION,bAutoScale || m_pCbx_AutoTimeResolution->IsChecked()));
+ rOutAttrs->Put(SfxBoolItem(SCHATTR_AXIS_AUTO_TIME_RESOLUTION,bAutoScale || m_xCbx_AutoTimeResolution->get_active()));
rOutAttrs->Put(SfxInt32Item(SCHATTR_AXIS_TIME_RESOLUTION,m_nTimeResolution));
rOutAttrs->Put(SfxInt32Item(SCHATTR_AXIS_MAIN_TIME_UNIT,m_nMainTimeUnit));
@@ -332,79 +274,85 @@ void ScaleTabPage::Reset(const SfxItemSet* rInAttrs)
nPos=TYPE_AUTO;
else
nPos=TYPE_TEXT;
- m_pLB_AxisType->SelectEntryPos( nPos );
+ m_xLB_AxisType->set_active( nPos );
}
- m_pCbxAutoMin->Check();
- m_pCbxAutoMax->Check();
- m_pCbxAutoStepMain->Check();
- m_pCbxAutoStepHelp->Check();
- m_pCbxAutoOrigin->Check();
- m_pCbx_AutoTimeResolution->Check();
+ m_xCbxAutoMin->set_active(true);
+ m_xCbxAutoMax->set_active(true);
+ m_xCbxAutoStepMain->set_active(true);
+ m_xCbxAutoStepHelp->set_active(true);
+ m_xCbxAutoOrigin->set_active(true);
+ m_xCbx_AutoTimeResolution->set_active(true);
if (rInAttrs->GetItemState(SCHATTR_AXIS_AUTO_MIN,true,&pPoolItem) == SfxItemState::SET)
- m_pCbxAutoMin->Check(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
+ m_xCbxAutoMin->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
if (rInAttrs->GetItemState(SCHATTR_AXIS_MIN,true, &pPoolItem) == SfxItemState::SET)
{
fMin = static_cast<const SvxDoubleItem*>(pPoolItem)->GetValue();
- lcl_setValue( *m_pFmtFldMin, fMin );
+ lcl_setValue( *m_xFmtFldMin, fMin );
+ m_xFmtFldMin->save_value();
}
if (rInAttrs->GetItemState(SCHATTR_AXIS_AUTO_MAX,true, &pPoolItem) == SfxItemState::SET)
- m_pCbxAutoMax->Check(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
+ m_xCbxAutoMax->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
if (rInAttrs->GetItemState(SCHATTR_AXIS_MAX,true, &pPoolItem) == SfxItemState::SET)
{
fMax = static_cast<const SvxDoubleItem*>(pPoolItem)->GetValue();
- lcl_setValue( *m_pFmtFldMax, fMax );
+ lcl_setValue( *m_xFmtFldMax, fMax );
+ m_xFmtFldMax->save_value();
}
if (rInAttrs->GetItemState(SCHATTR_AXIS_AUTO_STEP_MAIN,true, &pPoolItem) == SfxItemState::SET)
- m_pCbxAutoStepMain->Check(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
+ m_xCbxAutoStepMain->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
if (rInAttrs->GetItemState(SCHATTR_AXIS_STEP_MAIN,true, &pPoolItem) == SfxItemState::SET)
{
fStepMain = static_cast<const SvxDoubleItem*>(pPoolItem)->GetValue();
- lcl_setValue( *m_pFmtFldStepMain, fStepMain );
- m_pMt_MainDateStep->SetValue( static_cast<sal_Int32>(fStepMain) );
+ lcl_setValue( *m_xFmtFldStepMain, fStepMain );
+ m_xFmtFldStepMain->save_value();
+ m_xMt_MainDateStep->set_value( static_cast<sal_Int32>(fStepMain) );
+ m_xMt_MainDateStep->save_value();
}
if (rInAttrs->GetItemState(SCHATTR_AXIS_AUTO_STEP_HELP,true, &pPoolItem) == SfxItemState::SET)
- m_pCbxAutoStepHelp->Check(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
+ m_xCbxAutoStepHelp->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
if (rInAttrs->GetItemState(SCHATTR_AXIS_LOGARITHM,true, &pPoolItem) == SfxItemState::SET)
- m_pCbxLogarithm->Check(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
+ m_xCbxLogarithm->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
if (rInAttrs->GetItemState(SCHATTR_AXIS_REVERSE,true, &pPoolItem) == SfxItemState::SET)
- m_pCbxReverse->Check(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
+ m_xCbxReverse->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
if (rInAttrs->GetItemState(SCHATTR_AXIS_STEP_HELP,true, &pPoolItem) == SfxItemState::SET)
{
nStepHelp = static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
- m_pMtStepHelp->SetValue( nStepHelp );
+ m_xMtStepHelp->set_value( nStepHelp );
+ m_xMtStepHelp->save_value();
}
if (rInAttrs->GetItemState(SCHATTR_AXIS_AUTO_ORIGIN,true, &pPoolItem) == SfxItemState::SET)
- m_pCbxAutoOrigin->Check(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
+ m_xCbxAutoOrigin->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
if (rInAttrs->GetItemState(SCHATTR_AXIS_ORIGIN,true, &pPoolItem) == SfxItemState::SET)
{
fOrigin = static_cast<const SvxDoubleItem*>(pPoolItem)->GetValue();
- lcl_setValue( *m_pFmtFldOrigin, fOrigin );
+ lcl_setValue( *m_xFmtFldOrigin, fOrigin );
+ m_xFmtFldOrigin->save_value();
}
if (rInAttrs->GetItemState(SCHATTR_AXIS_AUTO_TIME_RESOLUTION,true, &pPoolItem) == SfxItemState::SET)
- m_pCbx_AutoTimeResolution->Check(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
+ m_xCbx_AutoTimeResolution->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
if (rInAttrs->GetItemState(SCHATTR_AXIS_TIME_RESOLUTION,true, &pPoolItem) == SfxItemState::SET)
{
m_nTimeResolution = static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
- m_pLB_TimeResolution->SelectEntryPos( m_nTimeResolution );
+ m_xLB_TimeResolution->set_active( m_nTimeResolution );
}
if (rInAttrs->GetItemState(SCHATTR_AXIS_MAIN_TIME_UNIT,true, &pPoolItem) == SfxItemState::SET)
{
m_nMainTimeUnit = static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
- m_pLB_MainTimeUnit->SelectEntryPos( m_nMainTimeUnit );
+ m_xLB_MainTimeUnit->set_active( m_nMainTimeUnit );
}
if (rInAttrs->GetItemState(SCHATTR_AXIS_HELP_TIME_UNIT,true, &pPoolItem) == SfxItemState::SET)
{
m_nHelpTimeUnit = static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
- m_pLB_HelpTimeUnit->SelectEntryPos( m_nHelpTimeUnit );
+ m_xLB_HelpTimeUnit->set_active( m_nHelpTimeUnit );
}
EnableControls();
@@ -421,101 +369,101 @@ DeactivateRC ScaleTabPage::DeactivatePage(SfxItemSet* pItemSet)
bool bDateAxis = m_nAxisType == chart2::AxisType::DATE;
- sal_uInt32 nMinMaxOriginFmt = m_pFmtFldMax->GetFormatKey();
+ sal_uInt32 nMinMaxOriginFmt = m_xFmtFldMax->get_format_key();
if (pNumFormatter->GetType(nMinMaxOriginFmt) == SvNumFormatType::TEXT)
nMinMaxOriginFmt = 0;
// numberformat_text cause numbers to fail being numbers... Shouldn't happen, but can.
- sal_uInt32 nStepFmt = m_pFmtFldStepMain->GetFormatKey();
+ sal_uInt32 nStepFmt = m_xFmtFldStepMain->get_format_key();
if (pNumFormatter->GetType(nStepFmt) == SvNumFormatType::TEXT)
nStepFmt = 0;
- Control* pControl = nullptr;
+ weld::Widget* pControl = nullptr;
const char* pErrStrId = nullptr;
double fDummy;
- fMax = m_pFmtFldMax->GetValue();
- fMin = m_pFmtFldMin->GetValue();
- fOrigin = m_pFmtFldOrigin->GetValue();
- fStepMain = bDateAxis ? m_pMt_MainDateStep->GetValue() : m_pFmtFldStepMain->GetValue();
- nStepHelp = static_cast< sal_Int32 >( m_pMtStepHelp->GetValue());
- m_nTimeResolution = m_pLB_TimeResolution->GetSelectedEntryPos();
- m_nMainTimeUnit = m_pLB_MainTimeUnit->GetSelectedEntryPos();
- m_nHelpTimeUnit = m_pLB_HelpTimeUnit->GetSelectedEntryPos();
+ fMax = m_xFmtFldMax->get_value();
+ fMin = m_xFmtFldMin->get_value();
+ fOrigin = m_xFmtFldOrigin->get_value();
+ fStepMain = bDateAxis ? m_xMt_MainDateStep->get_value() : m_xFmtFldStepMain->get_value();
+ nStepHelp = m_xMtStepHelp->get_value();
+ m_nTimeResolution = m_xLB_TimeResolution->get_active();
+ m_nMainTimeUnit = m_xLB_MainTimeUnit->get_active();
+ m_nHelpTimeUnit = m_xLB_HelpTimeUnit->get_active();
if( m_nAxisType != chart2::AxisType::REALNUMBER )
- m_pCbxLogarithm->Show( false );
+ m_xCbxLogarithm->show( false );
//check which entries need user action
- if ( m_pCbxLogarithm->IsChecked() &&
- ( ( !m_pCbxAutoMin->IsChecked() && fMin <= 0.0 )
- || ( !m_pCbxAutoMax->IsChecked() && fMax <= 0.0 ) ) )
+ if ( m_xCbxLogarithm->get_active() &&
+ ( ( !m_xCbxAutoMin->get_active() && fMin <= 0.0 )
+ || ( !m_xCbxAutoMax->get_active() && fMax <= 0.0 ) ) )
{
- pControl = m_pFmtFldMin;
+ pControl = m_xFmtFldMin.get();
pErrStrId = STR_BAD_LOGARITHM;
}
// check for entries that cannot be parsed for the current number format
- else if ( m_pFmtFldMin->IsModified()
- && !m_pCbxAutoMin->IsChecked()
- && !pNumFormatter->IsNumberFormat( m_pFmtFldMin->GetText(), nMinMaxOriginFmt, fDummy))
+ else if ( m_xFmtFldMin->get_value_changed_from_saved()
+ && !m_xCbxAutoMin->get_active()
+ && !pNumFormatter->IsNumberFormat( m_xFmtFldMin->get_text(), nMinMaxOriginFmt, fDummy))
{
- pControl = m_pFmtFldMin;
+ pControl = m_xFmtFldMin.get();
pErrStrId = STR_INVALID_NUMBER;
}
- else if ( m_pFmtFldMax->IsModified()
- && !m_pCbxAutoMax->IsChecked()
- && !pNumFormatter->IsNumberFormat( m_pFmtFldMax->GetText(), nMinMaxOriginFmt, fDummy))
+ else if ( m_xFmtFldMax->get_value_changed_from_saved()
+ && !m_xCbxAutoMax->get_active()
+ && !pNumFormatter->IsNumberFormat( m_xFmtFldMax->get_text(), nMinMaxOriginFmt, fDummy))
{
- pControl = m_pFmtFldMax;
+ pControl = m_xFmtFldMax.get();
pErrStrId = STR_INVALID_NUMBER;
}
- else if ( !bDateAxis && m_pFmtFldStepMain->IsModified()
- && !m_pCbxAutoStepMain->IsChecked()
- && !pNumFormatter->IsNumberFormat( m_pFmtFldStepMain->GetText(), nStepFmt, fDummy))
+ else if ( !bDateAxis && m_xFmtFldStepMain->get_value_changed_from_saved()
+ && !m_xCbxAutoStepMain->get_active()
+ && !pNumFormatter->IsNumberFormat( m_xFmtFldStepMain->get_text(), nStepFmt, fDummy))
{
- pControl = m_pFmtFldStepMain;
+ pControl = m_xFmtFldStepMain.get();
pErrStrId = STR_INVALID_NUMBER;
}
- else if (m_pFmtFldOrigin->IsModified() && !m_pCbxAutoOrigin->IsChecked() &&
- !pNumFormatter->IsNumberFormat( m_pFmtFldOrigin->GetText(), nMinMaxOriginFmt, fDummy))
+ else if (m_xFmtFldOrigin->get_value_changed_from_saved() && !m_xCbxAutoOrigin->get_active() &&
+ !pNumFormatter->IsNumberFormat( m_xFmtFldOrigin->get_text(), nMinMaxOriginFmt, fDummy))
{
- pControl = m_pFmtFldOrigin;
+ pControl = m_xFmtFldOrigin.get();
pErrStrId = STR_INVALID_NUMBER;
}
- else if (!m_pCbxAutoStepMain->IsChecked() && fStepMain <= 0.0)
+ else if (!m_xCbxAutoStepMain->get_active() && fStepMain <= 0.0)
{
- pControl = m_pFmtFldStepMain;
+ pControl = m_xFmtFldStepMain.get();
pErrStrId = STR_STEP_GT_ZERO;
}
- else if (!m_pCbxAutoMax->IsChecked() && !m_pCbxAutoMin->IsChecked() &&
+ else if (!m_xCbxAutoMax->get_active() && !m_xCbxAutoMin->get_active() &&
fMin >= fMax)
{
- pControl = m_pFmtFldMin;
+ pControl = m_xFmtFldMin.get();
pErrStrId = STR_MIN_GREATER_MAX;
}
else if( bDateAxis )
{
- if( !m_pCbxAutoStepMain->IsChecked() && !m_pCbxAutoStepHelp->IsChecked() )
+ if( !m_xCbxAutoStepMain->get_active() && !m_xCbxAutoStepHelp->get_active() )
{
if( m_nHelpTimeUnit > m_nMainTimeUnit )
{
- pControl = m_pLB_MainTimeUnit;
+ pControl = m_xLB_MainTimeUnit.get();
pErrStrId = STR_INVALID_INTERVALS;
}
else if( m_nHelpTimeUnit == m_nMainTimeUnit && nStepHelp > fStepMain )
{
- pControl = m_pLB_MainTimeUnit;
+ pControl = m_xLB_MainTimeUnit.get();
pErrStrId = STR_INVALID_INTERVALS;
}
}
- if( !pErrStrId && !m_pCbx_AutoTimeResolution->IsChecked() )
+ if( !pErrStrId && !m_xCbx_AutoTimeResolution->get_active() )
{
- if( (!m_pCbxAutoStepMain->IsChecked() && m_nTimeResolution > m_nMainTimeUnit )
+ if( (!m_xCbxAutoStepMain->get_active() && m_nTimeResolution > m_nMainTimeUnit )
||
- (!m_pCbxAutoStepHelp->IsChecked() && m_nTimeResolution > m_nHelpTimeUnit )
+ (!m_xCbxAutoStepHelp->get_active() && m_nTimeResolution > m_nHelpTimeUnit )
)
{
- pControl = m_pLB_TimeResolution;
+ pControl = m_xLB_TimeResolution.get();
pErrStrId = STR_INVALID_TIME_UNIT;
}
}
@@ -533,20 +481,10 @@ DeactivateRC ScaleTabPage::DeactivatePage(SfxItemSet* pItemSet)
void ScaleTabPage::SetNumFormatter( SvNumberFormatter* pFormatter )
{
pNumFormatter = pFormatter;
- m_pFmtFldMax->SetFormatter( pNumFormatter );
- m_pFmtFldMin->SetFormatter( pNumFormatter );
- m_pFmtFldStepMain->SetFormatter( pNumFormatter );
- m_pFmtFldOrigin->SetFormatter( pNumFormatter );
-
- // #i6278# allow more decimal places than the output format. As
- // the numbers shown in the edit fields are used for input, it makes more
- // sense to display the values in the input format rather than the output
- // format.
- m_pFmtFldMax->UseInputStringForFormatting();
- m_pFmtFldMin->UseInputStringForFormatting();
- m_pFmtFldStepMain->UseInputStringForFormatting();
- m_pFmtFldOrigin->UseInputStringForFormatting();
-
+ m_xFmtFldMax->set_formatter( pNumFormatter );
+ m_xFmtFldMin->set_formatter( pNumFormatter );
+ m_xFmtFldStepMain->set_formatter( pNumFormatter );
+ m_xFmtFldOrigin->set_formatter( pNumFormatter );
SetNumFormat();
}
@@ -558,9 +496,9 @@ void ScaleTabPage::SetNumFormat()
{
sal_uLong nFmt = static_cast<sal_uLong>(static_cast<const SfxInt32Item*>(pPoolItem)->GetValue());
- m_pFmtFldMax->SetFormatKey( nFmt );
- m_pFmtFldMin->SetFormatKey( nFmt );
- m_pFmtFldOrigin->SetFormatKey( nFmt );
+ m_xFmtFldMax->set_format_key(nFmt);
+ m_xFmtFldMin->set_format_key(nFmt);
+ m_xFmtFldOrigin->set_format_key(nFmt);
if( pNumFormatter )
{
@@ -592,13 +530,13 @@ void ScaleTabPage::SetNumFormat()
else
nFmt = pNumFormatter->GetStandardFormat( SvNumFormatType::DATE );
- m_pFmtFldMax->SetFormatKey( nFmt );
- m_pFmtFldMin->SetFormatKey( nFmt );
- m_pFmtFldOrigin->SetFormatKey( nFmt );
+ m_xFmtFldMax->set_format_key(nFmt);
+ m_xFmtFldMin->set_format_key(nFmt);
+ m_xFmtFldOrigin->set_format_key(nFmt);
}
}
- m_pFmtFldStepMain->SetFormatKey( nFmt );
+ m_xFmtFldStepMain->set_format_key(nFmt);
}
}
@@ -609,7 +547,7 @@ void ScaleTabPage::ShowAxisOrigin( bool bShowOrigin )
m_bShowAxisOrigin = true;
}
-bool ScaleTabPage::ShowWarning(const char* pResIdMessage, Control* pControl /* = NULL */ )
+bool ScaleTabPage::ShowWarning(const char* pResIdMessage, weld::Widget* pControl /* = nullptr */)
{
if (pResIdMessage == nullptr)
return false;
@@ -618,12 +556,12 @@ bool ScaleTabPage::ShowWarning(const char* pResIdMessage, Control* pControl /* =
VclMessageType::Warning, VclButtonsType::Ok,
SchResId(pResIdMessage)));
xWarn->run();
- if( pControl )
+ if (pControl)
{
- pControl->GrabFocus();
- Edit* pEdit = dynamic_cast<Edit*>(pControl);
- if(pEdit)
- pEdit->SetSelection( Selection( 0, SELECTION_MAX ));
+ pControl->grab_focus();
+ weld::Entry* pEdit = dynamic_cast<weld::Entry*>(pControl);
+ if (pEdit)
+ pEdit->select_region(0, -1);
}
return true;
}
@@ -635,20 +573,20 @@ void ScaleTabPage::HideAllControls()
// visibility of these controls depend on axis data type, and are
// set in EnableControls().
- m_pBxType->Hide();
- m_pCbxLogarithm->Hide();
- m_pBxMinMax->Hide();
- m_pTxtMain->Hide();
- m_pFmtFldStepMain->Hide();
- m_pMt_MainDateStep->Hide();
- m_pLB_MainTimeUnit->Hide();
- m_pCbxAutoStepMain->Hide();
- m_pTxtHelpCount->Hide();
- m_pTxtHelp->Hide();
- m_pMtStepHelp->Hide();
- m_pCbxAutoStepHelp->Hide();
- m_pBxOrigin->Hide();
- m_pBxResolution->Hide();
+ m_xBxType->hide();
+ m_xCbxLogarithm->hide();
+ m_xBxMinMax->hide();
+ m_xTxtMain->hide();
+ m_xFmtFldStepMain->hide();
+ m_xMt_MainDateStep->hide();
+ m_xLB_MainTimeUnit->hide();
+ m_xCbxAutoStepMain->hide();
+ m_xTxtHelpCount->hide();
+ m_xTxtHelp->hide();
+ m_xMtStepHelp->hide();
+ m_xCbxAutoStepHelp->hide();
+ m_xBxOrigin->hide();
+ m_xBxResolution->hide();
}
} //namespace chart