Kaydet (Commit) 849f575a authored tarafından Caolán McNamara's avatar Caolán McNamara

weld ScFourierAnalysisDialog

Change-Id: I87e28f62cf03f4a612def322fda5e03d702bec4c
Reviewed-on: https://gerrit.libreoffice.org/70543
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 8d526da3
...@@ -26,11 +26,11 @@ ...@@ -26,11 +26,11 @@
#include <strings.hrc> #include <strings.hrc>
ScFourierAnalysisDialog::ScFourierAnalysisDialog(SfxBindings* pSfxBindings, ScFourierAnalysisDialog::ScFourierAnalysisDialog(SfxBindings* pSfxBindings,
SfxChildWindow* pChildWindow, vcl::Window* pParent, SfxChildWindow* pChildWindow,
ScViewData* pViewData) weld::Window* pParent, ScViewData* pViewData)
: ScStatisticsInputOutputDialog(pSfxBindings, pChildWindow, pParent, pViewData, : ScStatisticsInputOutputDialogController(pSfxBindings, pChildWindow, pParent, pViewData,
"FourierAnalysisDialog", "modules/scalc/ui/fourieranalysisdialog.ui",
"modules/scalc/ui/fourieranalysisdialog.ui") "FourierAnalysisDialog")
, maLabelAddr(ScAddress::INITIALIZE_INVALID) , maLabelAddr(ScAddress::INITIALIZE_INVALID)
, maActualInputRange(ScAddress::INITIALIZE_INVALID) , maActualInputRange(ScAddress::INITIALIZE_INVALID)
, mnLen(0) , mnLen(0)
...@@ -40,32 +40,22 @@ ScFourierAnalysisDialog::ScFourierAnalysisDialog(SfxBindings* pSfxBindings, ...@@ -40,32 +40,22 @@ ScFourierAnalysisDialog::ScFourierAnalysisDialog(SfxBindings* pSfxBindings,
, mbWithLabels(false) , mbWithLabels(false)
, mbInverse(false) , mbInverse(false)
, mbPolar(false) , mbPolar(false)
, mxWithLabelsCheckBox(m_xBuilder->weld_check_button("withlabels-check"))
, mxInverseCheckBox(m_xBuilder->weld_check_button("inverse-check"))
, mxPolarCheckBox(m_xBuilder->weld_check_button("polar-check"))
, mxMinMagnitudeField(m_xBuilder->weld_spin_button("minmagnitude-spin"))
, mxErrorMessage(m_xBuilder->weld_label("error-message"))
{ {
SetText(ScResId(STR_FOURIER_ANALYSIS)); m_xDialog->set_title(ScResId(STR_FOURIER_ANALYSIS));
get(mpWithLabelsCheckBox, "withlabels-check");
get(mpInverseCheckBox, "inverse-check");
get(mpPolarCheckBox, "polar-check");
get(mpMinMagnitudeField, "minmagnitude-spin");
get(mpErrorMessage, "error-message");
mpWithLabelsCheckBox->SetToggleHdl(LINK(this, ScFourierAnalysisDialog, CheckBoxHdl));
}
ScFourierAnalysisDialog::~ScFourierAnalysisDialog() { disposeOnce(); }
bool ScFourierAnalysisDialog::Close() mxWithLabelsCheckBox->connect_toggled(LINK(this, ScFourierAnalysisDialog, CheckBoxHdl));
{
return DoClose(ScFourierAnalysisDialogWrapper::GetChildWindowId());
} }
void ScFourierAnalysisDialog::dispose() ScFourierAnalysisDialog::~ScFourierAnalysisDialog() {}
void ScFourierAnalysisDialog::Close()
{ {
mpWithLabelsCheckBox.disposeAndClear(); DoClose(ScFourierAnalysisDialogWrapper::GetChildWindowId());
mpInverseCheckBox.disposeAndClear();
mpPolarCheckBox.disposeAndClear();
mpMinMagnitudeField.disposeAndClear();
mpErrorMessage.disposeAndClear();
ScStatisticsInputOutputDialog::dispose();
} }
const char* ScFourierAnalysisDialog::GetUndoNameId() { return STR_FOURIER_ANALYSIS; } const char* ScFourierAnalysisDialog::GetUndoNameId() { return STR_FOURIER_ANALYSIS; }
...@@ -120,20 +110,20 @@ bool ScFourierAnalysisDialog::InputRangesValid() ...@@ -120,20 +110,20 @@ bool ScFourierAnalysisDialog::InputRangesValid()
{ {
if (!mInputRange.IsValid()) if (!mInputRange.IsValid())
{ {
mpErrorMessage->SetText(ScResId(STR_MESSAGE_INVALID_INPUT_RANGE)); mxErrorMessage->set_label(ScResId(STR_MESSAGE_INVALID_INPUT_RANGE));
return false; return false;
} }
if (!mOutputAddress.IsValid()) if (!mOutputAddress.IsValid())
{ {
mpErrorMessage->SetText(ScResId(STR_MESSAGE_INVALID_OUTPUT_ADDR)); mxErrorMessage->set_label(ScResId(STR_MESSAGE_INVALID_OUTPUT_ADDR));
return false; return false;
} }
mInputRange.PutInOrder(); mInputRange.PutInOrder();
mbGroupedByColumn = mGroupedBy == BY_COLUMN; mbGroupedByColumn = mGroupedBy == BY_COLUMN;
mbWithLabels = mpWithLabelsCheckBox->IsChecked(); mbWithLabels = mxWithLabelsCheckBox->get_active();
mbUse3DAddresses = mInputRange.aStart.Tab() != mOutputAddress.Tab(); mbUse3DAddresses = mInputRange.aStart.Tab() != mOutputAddress.Tab();
...@@ -147,13 +137,13 @@ bool ScFourierAnalysisDialog::InputRangesValid() ...@@ -147,13 +137,13 @@ bool ScFourierAnalysisDialog::InputRangesValid()
{ {
OUString aMsg = mbGroupedByColumn ? ScResId(STR_MESSAGE_INVALID_NUMCOLS) OUString aMsg = mbGroupedByColumn ? ScResId(STR_MESSAGE_INVALID_NUMCOLS)
: ScResId(STR_MESSAGE_INVALID_NUMROWS); : ScResId(STR_MESSAGE_INVALID_NUMROWS);
mpErrorMessage->SetText(aMsg); mxErrorMessage->set_label(aMsg);
return false; return false;
} }
if (mbWithLabels && nLen < 2) if (mbWithLabels && nLen < 2)
{ {
mpErrorMessage->SetText(ScResId(STR_MESSAGE_NODATA_IN_RANGE)); mxErrorMessage->set_label(ScResId(STR_MESSAGE_NODATA_IN_RANGE));
return false; return false;
} }
...@@ -164,7 +154,7 @@ bool ScFourierAnalysisDialog::InputRangesValid() ...@@ -164,7 +154,7 @@ bool ScFourierAnalysisDialog::InputRangesValid()
if (nLastOutputRow > MAXROW) if (nLastOutputRow > MAXROW)
{ {
mpErrorMessage->SetText(ScResId(STR_MESSAGE_OUTPUT_TOO_LONG)); mxErrorMessage->set_label(ScResId(STR_MESSAGE_OUTPUT_TOO_LONG));
return false; return false;
} }
...@@ -190,17 +180,17 @@ bool ScFourierAnalysisDialog::InputRangesValid() ...@@ -190,17 +180,17 @@ bool ScFourierAnalysisDialog::InputRangesValid()
} }
maActualInputRange = ScRange(aActualStart, mInputRange.aEnd); maActualInputRange = ScRange(aActualStart, mInputRange.aEnd);
mpErrorMessage->SetText(""); mxErrorMessage->set_label("");
return true; return true;
} }
void ScFourierAnalysisDialog::getOptions() void ScFourierAnalysisDialog::getOptions()
{ {
mbInverse = mpInverseCheckBox->IsChecked(); mbInverse = mxInverseCheckBox->get_active();
mbPolar = mpPolarCheckBox->IsChecked(); mbPolar = mxPolarCheckBox->get_active();
sal_Int32 nDeciBels = static_cast<sal_Int32>(mpMinMagnitudeField->GetValue()); sal_Int32 nDeciBels = static_cast<sal_Int32>(mxMinMagnitudeField->get_value());
if (nDeciBels <= -150) if (nDeciBels <= -150)
mfMinMag = 0.0; mfMinMag = 0.0;
else else
...@@ -242,6 +232,9 @@ void ScFourierAnalysisDialog::genFormula(OUString& rFormula) ...@@ -242,6 +232,9 @@ void ScFourierAnalysisDialog::genFormula(OUString& rFormula)
+ OUString::boolean(mbInverse) + ";true;" + OUString::number(mfMinMag) + ")"; + OUString::boolean(mbInverse) + ";true;" + OUString::number(mfMinMag) + ")";
} }
IMPL_LINK_NOARG(ScFourierAnalysisDialog, CheckBoxHdl, CheckBox&, void) { ValidateDialogInput(); } IMPL_LINK_NOARG(ScFourierAnalysisDialog, CheckBoxHdl, weld::ToggleButton&, void)
{
ValidateDialogInput();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -13,14 +13,8 @@ ...@@ -13,14 +13,8 @@
#include "StatisticsInputOutputDialog.hxx" #include "StatisticsInputOutputDialog.hxx"
class ScFourierAnalysisDialog : public ScStatisticsInputOutputDialog class ScFourierAnalysisDialog : public ScStatisticsInputOutputDialogController
{ {
VclPtr<CheckBox> mpWithLabelsCheckBox;
VclPtr<CheckBox> mpInverseCheckBox;
VclPtr<CheckBox> mpPolarCheckBox;
VclPtr<NumericField> mpMinMagnitudeField;
VclPtr<FixedText> mpErrorMessage;
ScAddress maLabelAddr; ScAddress maLabelAddr;
ScRange maActualInputRange; ScRange maActualInputRange;
SCSIZE mnLen; SCSIZE mnLen;
...@@ -33,16 +27,21 @@ class ScFourierAnalysisDialog : public ScStatisticsInputOutputDialog ...@@ -33,16 +27,21 @@ class ScFourierAnalysisDialog : public ScStatisticsInputOutputDialog
bool mbInverse : 1; bool mbInverse : 1;
bool mbPolar : 1; bool mbPolar : 1;
std::unique_ptr<weld::CheckButton> mxWithLabelsCheckBox;
std::unique_ptr<weld::CheckButton> mxInverseCheckBox;
std::unique_ptr<weld::CheckButton> mxPolarCheckBox;
std::unique_ptr<weld::SpinButton> mxMinMagnitudeField;
std::unique_ptr<weld::Label> mxErrorMessage;
public: public:
ScFourierAnalysisDialog(SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent, ScFourierAnalysisDialog(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent,
ScViewData* pViewData); ScViewData* pViewData);
virtual ~ScFourierAnalysisDialog() override; virtual ~ScFourierAnalysisDialog() override;
virtual bool Close() override; virtual void Close() override;
protected: protected:
void dispose() override;
virtual const char* GetUndoNameId() override; virtual const char* GetUndoNameId() override;
virtual ScRange ApplyOutput(ScDocShell* pDocShell) override; virtual ScRange ApplyOutput(ScDocShell* pDocShell) override;
virtual bool InputRangesValid() override; virtual bool InputRangesValid() override;
...@@ -52,7 +51,7 @@ private: ...@@ -52,7 +51,7 @@ private:
void getDataLabel(OUString& rLabel); void getDataLabel(OUString& rLabel);
void genFormula(OUString& rFormula); void genFormula(OUString& rFormula);
DECL_LINK(CheckBoxHdl, CheckBox&, void); DECL_LINK(CheckBoxHdl, weld::ToggleButton&, void);
}; };
#endif #endif
......
...@@ -142,7 +142,7 @@ private: ...@@ -142,7 +142,7 @@ private:
}; };
class ScFourierAnalysisDialogWrapper : class ScFourierAnalysisDialogWrapper :
public ChildWindowWrapper<SID_FOURIER_ANALYSIS_DIALOG> public ChildControllerWrapper<SID_FOURIER_ANALYSIS_DIALOG>
{ {
private: private:
ScFourierAnalysisDialogWrapper() = delete; ScFourierAnalysisDialogWrapper() = delete;
......
...@@ -330,12 +330,6 @@ VclPtr<SfxModelessDialog> ScTabViewShell::CreateRefDialog( ...@@ -330,12 +330,6 @@ VclPtr<SfxModelessDialog> ScTabViewShell::CreateRefDialog(
} }
break; break;
case SID_FOURIER_ANALYSIS_DIALOG:
{
pResult = VclPtr<ScFourierAnalysisDialog>::Create( pB, pCW, pParent, &GetViewData() );
}
break;
case SID_OPENDLG_OPTSOLVER: case SID_OPENDLG_OPTSOLVER:
{ {
ScViewData& rViewData = GetViewData(); ScViewData& rViewData = GetViewData();
...@@ -527,6 +521,11 @@ std::unique_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont ...@@ -527,6 +521,11 @@ std::unique_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
xResult.reset(new ScChiSquareTestDialog(pB, pCW, pParent, &GetViewData())); xResult.reset(new ScChiSquareTestDialog(pB, pCW, pParent, &GetViewData()));
} }
break; break;
case SID_FOURIER_ANALYSIS_DIALOG:
{
xResult.reset(new ScFourierAnalysisDialog(pB, pCW, pParent, &GetViewData()));
}
break;
} }
if (xResult) if (xResult)
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
<!-- Generated with glade 3.22.1 --> <!-- Generated with glade 3.22.1 -->
<interface domain="sc"> <interface domain="sc">
<requires lib="gtk+" version="3.18"/> <requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/>
<object class="GtkAdjustment" id="adjustment1"> <object class="GtkAdjustment" id="adjustment1">
<property name="lower">-150</property> <property name="lower">-150</property>
<property name="upper">150</property> <property name="upper">150</property>
...@@ -15,6 +14,8 @@ ...@@ -15,6 +14,8 @@
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="title" translatable="yes" context="fourieranalysisdialog|FourierAnalysisDialog">Fourier Analysis</property> <property name="title" translatable="yes" context="fourieranalysisdialog|FourierAnalysisDialog">Fourier Analysis</property>
<property name="resizable">False</property> <property name="resizable">False</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<child> <child>
<placeholder/> <placeholder/>
...@@ -118,11 +119,12 @@ ...@@ -118,11 +119,12 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="foruilo-RefEdit" id="input-range-edit"> <object class="GtkEntry" id="input-range-edit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="activates_default">True</property>
<property name="width_chars">30</property> <property name="width_chars">30</property>
</object> </object>
<packing> <packing>
...@@ -131,7 +133,7 @@ ...@@ -131,7 +133,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="foruilo-RefButton" id="input-range-button"> <object class="GtkButton" id="input-range-button">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
...@@ -156,11 +158,12 @@ ...@@ -156,11 +158,12 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="foruilo-RefEdit" id="output-range-edit"> <object class="GtkEntry" id="output-range-edit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="activates_default">True</property>
<property name="width_chars">30</property> <property name="width_chars">30</property>
</object> </object>
<packing> <packing>
...@@ -169,7 +172,7 @@ ...@@ -169,7 +172,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="foruilo-RefButton" id="output-range-button"> <object class="GtkButton" id="output-range-button">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
...@@ -409,6 +412,7 @@ ...@@ -409,6 +412,7 @@
</child> </child>
<action-widgets> <action-widgets>
<action-widget response="-5">ok</action-widget> <action-widget response="-5">ok</action-widget>
<action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget> <action-widget response="-11">help</action-widget>
</action-widgets> </action-widgets>
</object> </object>
......
...@@ -83,6 +83,8 @@ sc/uiconfig/scalc/ui/externaldata.ui://GtkTreeView[@id='ranges'] no-labelled-by ...@@ -83,6 +83,8 @@ sc/uiconfig/scalc/ui/externaldata.ui://GtkTreeView[@id='ranges'] no-labelled-by
sc/uiconfig/scalc/ui/externaldata.ui://GtkTreeViewColumn[@id='treeviewcolumn1'] no-labelled-by sc/uiconfig/scalc/ui/externaldata.ui://GtkTreeViewColumn[@id='treeviewcolumn1'] no-labelled-by
sc/uiconfig/scalc/ui/externaldata.ui://GtkLabel[@id='secondsft'] orphan-label sc/uiconfig/scalc/ui/externaldata.ui://GtkLabel[@id='secondsft'] orphan-label
sc/uiconfig/scalc/ui/fourieranalysisdialog.ui://GtkLabel[@id='error-message'] orphan-label sc/uiconfig/scalc/ui/fourieranalysisdialog.ui://GtkLabel[@id='error-message'] orphan-label
sc/uiconfig/scalc/ui/fourieranalysisdialog.ui://GtkButton[@id='input-range-button'] button-no-label
sc/uiconfig/scalc/ui/fourieranalysisdialog.ui://GtkButton[@id='output-range-button'] button-no-label
sc/uiconfig/scalc/ui/functionpanel.ui://GtkComboBoxText[@id='category'] no-labelled-by sc/uiconfig/scalc/ui/functionpanel.ui://GtkComboBoxText[@id='category'] no-labelled-by
sc/uiconfig/scalc/ui/functionpanel.ui://GtkTreeView[@id='funclist:border'] no-labelled-by sc/uiconfig/scalc/ui/functionpanel.ui://GtkTreeView[@id='funclist:border'] no-labelled-by
sc/uiconfig/scalc/ui/functionpanel.ui://GtkLabel[@id='funcdesc:border'] orphan-label sc/uiconfig/scalc/ui/functionpanel.ui://GtkLabel[@id='funcdesc:border'] orphan-label
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment