sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx | 22 sc/source/ui/StatisticsDialogs/RegressionDialog.cxx | 94 +- sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx | 319 ++++++++++ sc/source/ui/inc/MovingAverageDialog.hxx | 9 sc/source/ui/inc/RegressionDialog.hxx | 29 sc/source/ui/inc/StatisticsTwoVariableDialog.hxx | 73 ++ sc/source/ui/inc/reffact.hxx | 4 sc/source/ui/view/tabvwshc.cxx | 22 sc/uiconfig/scalc/ui/movingaveragedialog.ui | 146 ++-- sc/uiconfig/scalc/ui/regressiondialog.ui | 27 solenv/sanitizers/ui/modules/scalc.suppr | 13 11 files changed, 570 insertions(+), 188 deletions(-)
New commits: commit 5a816c4241c98b97d464007f25657b946eb29005 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Apr 10 11:36:45 2019 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Apr 11 09:54:55 2019 +0200 weld ScRegressionDialog Change-Id: I26cbf2b5ed7482daa8d02adb206b6a783524985a Reviewed-on: https://gerrit.libreoffice.org/70517 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx b/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx index 11ac7b017e77..02b57e2e75db 100644 --- a/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx @@ -132,49 +132,35 @@ static size_t lcl_GetNumRowsColsInRange(const ScRange& rRange, bool bRows) ScRegressionDialog::ScRegressionDialog( SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, - vcl::Window* pParent, ScViewData* pViewData ) : - ScStatisticsTwoVariableDialog( + weld::Window* pParent, ScViewData* pViewData ) + : ScStatisticsTwoVariableDialogController( pSfxBindings, pChildWindow, pParent, pViewData, - "RegressionDialog", "modules/scalc/ui/regressiondialog.ui" ), - mbUnivariate(true), - mnNumIndependentVars(1), - mnNumObservations(0), - mbUse3DAddresses(false), - mbCalcIntercept(true) + "modules/scalc/ui/regressiondialog.ui", "RegressionDialog") + , mbUnivariate(true) + , mnNumIndependentVars(1) + , mnNumObservations(0) + , mbUse3DAddresses(false) + , mbCalcIntercept(true) + , mxWithLabelsCheckBox(m_xBuilder->weld_check_button("withlabels-check")) + , mxLinearRadioButton(m_xBuilder->weld_radio_button("linear-radio")) + , mxLogarithmicRadioButton(m_xBuilder->weld_radio_button("logarithmic-radio")) + , mxPowerRadioButton(m_xBuilder->weld_radio_button("power-radio")) + , mxErrorMessage(m_xBuilder->weld_label("error-message")) + , mxConfidenceLevelField(m_xBuilder->weld_spin_button("confidencelevel-spin")) + , mxCalcResidualsCheckBox(m_xBuilder->weld_check_button("calcresiduals-check")) + , mxNoInterceptCheckBox(m_xBuilder->weld_check_button("nointercept-check")) { - get(mpWithLabelsCheckBox, "withlabels-check"); - get(mpLinearRadioButton, "linear-radio"); - get(mpLogarithmicRadioButton, "logarithmic-radio"); - get(mpPowerRadioButton, "power-radio"); - get(mpConfidenceLevelField, "confidencelevel-spin"); - get(mpCalcResidualsCheckBox, "calcresiduals-check"); - get(mpNoInterceptCheckBox, "nointercept-check"); - get(mpErrorMessage, "error-message"); - mpWithLabelsCheckBox->SetToggleHdl(LINK(this, ScRegressionDialog, CheckBoxHdl)); - mpConfidenceLevelField->SetModifyHdl(LINK(this, ScRegressionDialog, NumericFieldHdl)); + mxWithLabelsCheckBox->connect_toggled(LINK(this, ScRegressionDialog, CheckBoxHdl)); + mxConfidenceLevelField->connect_value_changed(LINK(this, ScRegressionDialog, NumericFieldHdl)); } ScRegressionDialog::~ScRegressionDialog() { - disposeOnce(); } -bool ScRegressionDialog::Close() +void ScRegressionDialog::Close() { - return DoClose(ScRegressionDialogWrapper::GetChildWindowId()); -} - -void ScRegressionDialog::dispose() -{ - mpWithLabelsCheckBox.disposeAndClear(); - mpLinearRadioButton.disposeAndClear(); - mpLogarithmicRadioButton.disposeAndClear(); - mpPowerRadioButton.disposeAndClear(); - mpConfidenceLevelField.disposeAndClear(); - mpCalcResidualsCheckBox.disposeAndClear(); - mpNoInterceptCheckBox.disposeAndClear(); - mpErrorMessage.disposeAndClear(); - ScStatisticsTwoVariableDialog::dispose(); + DoClose(ScRegressionDialogWrapper::GetChildWindowId()); } const char* ScRegressionDialog::GetUndoNameId() @@ -188,7 +174,7 @@ ScRange ScRegressionDialog::ApplyOutput(ScDocShell* pDocShell) formula::FormulaGrammar::mergeToGrammar( formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv)); FormulaTemplate aTemplate(mDocument); aTemplate.autoReplaceUses3D(mbUse3DAddresses); - mbCalcIntercept = !mpNoInterceptCheckBox->IsChecked(); + mbCalcIntercept = !mxNoInterceptCheckBox->get_active(); // max col of our output should account for // 1. constant term column, @@ -211,7 +197,7 @@ ScRange ScRegressionDialog::ApplyOutput(ScDocShell* pDocShell) WriteRegressionStatistics(aOutput, aTemplate); WriteRegressionANOVAResults(aOutput, aTemplate); WriteRegressionEstimatesWithCI(aOutput, aTemplate, bTakeLogX); - if (mpCalcResidualsCheckBox->IsChecked()) + if (mxCalcResidualsCheckBox->get_active()) WritePredictionsWithResiduals(aOutput, aTemplate, nRegressionIndex); ScAddress aMaxAddress(aOutput.mMaximumAddress); @@ -223,27 +209,27 @@ bool ScRegressionDialog::InputRangesValid() { if (!mVariable1Range.IsValid()) { - mpErrorMessage->SetText(ScResId(STR_MESSAGE_XINVALID_RANGE)); + mxErrorMessage->set_label(ScResId(STR_MESSAGE_XINVALID_RANGE)); return false; } if (!mVariable2Range.IsValid()) { - mpErrorMessage->SetText(ScResId(STR_MESSAGE_YINVALID_RANGE)); + mxErrorMessage->set_label(ScResId(STR_MESSAGE_YINVALID_RANGE)); return false; } if (!mOutputAddress.IsValid()) { - mpErrorMessage->SetText(ScResId(STR_MESSAGE_INVALID_OUTPUT_ADDR)); + mxErrorMessage->set_label(ScResId(STR_MESSAGE_INVALID_OUTPUT_ADDR)); return false; } { - double fConfidenceLevel = mpConfidenceLevelField->GetValue(); + double fConfidenceLevel = mxConfidenceLevelField->get_value(); if ( fConfidenceLevel <= 0.0 || fConfidenceLevel >= 100.0 ) { - mpErrorMessage->SetText(ScResId(STR_MESSAGE_INVALID_CONFIDENCE_LEVEL)); + mxErrorMessage->set_label(ScResId(STR_MESSAGE_INVALID_CONFIDENCE_LEVEL)); return false; } } @@ -262,13 +248,13 @@ bool ScRegressionDialog::InputRangesValid() if (!bYHasSingleDim) { if (bGroupedByColumn) - mpErrorMessage->SetText(ScResId(STR_MESSAGE_YVARIABLE_MULTI_COLUMN)); + mxErrorMessage->set_label(ScResId(STR_MESSAGE_YVARIABLE_MULTI_COLUMN)); else - mpErrorMessage->SetText(ScResId(STR_MESSAGE_YVARIABLE_MULTI_ROW)); + mxErrorMessage->set_label(ScResId(STR_MESSAGE_YVARIABLE_MULTI_ROW)); return false; } - bool bWithLabels = mpWithLabelsCheckBox->IsChecked(); + bool bWithLabels = mxWithLabelsCheckBox->get_active(); size_t nYObs = lcl_GetNumRowsColsInRange(mVariable2Range, bGroupedByColumn); size_t nNumXVars = lcl_GetNumRowsColsInRange(mVariable1Range, !bGroupedByColumn); @@ -277,9 +263,9 @@ bool ScRegressionDialog::InputRangesValid() if (lcl_GetNumRowsColsInRange(mVariable1Range, bGroupedByColumn) != nYObs) { if (mbUnivariate) - mpErrorMessage->SetText(ScResId(STR_MESSAGE_UNIVARIATE_NUMOBS_MISMATCH)); + mxErrorMessage->set_label(ScResId(STR_MESSAGE_UNIVARIATE_NUMOBS_MISMATCH)); else - mpErrorMessage->SetText(ScResId(STR_MESSAGE_MULTIVARIATE_NUMOBS_MISMATCH)); + mxErrorMessage->set_label(ScResId(STR_MESSAGE_MULTIVARIATE_NUMOBS_MISMATCH)); return false; } @@ -289,23 +275,23 @@ bool ScRegressionDialog::InputRangesValid() mbUse3DAddresses = mVariable1Range.aStart.Tab() != mOutputAddress.Tab() || mVariable2Range.aStart.Tab() != mOutputAddress.Tab(); - mpErrorMessage->SetText(""); + mxErrorMessage->set_label(""); return true; } size_t ScRegressionDialog::GetRegressionTypeIndex() { - if (mpLinearRadioButton->IsChecked()) + if (mxLinearRadioButton->get_active()) return 0; - if (mpLogarithmicRadioButton->IsChecked()) + if (mxLogarithmicRadioButton->get_active()) return 1; return 2; } ScRange ScRegressionDialog::GetDataRange(const ScRange& rRange) { - if (!mpWithLabelsCheckBox->IsChecked()) + if (!mxWithLabelsCheckBox->get_active()) return rRange; ScRange aDataRange(rRange); @@ -322,7 +308,7 @@ OUString ScRegressionDialog::GetVariableNameFormula(bool bXVar, size_t nIndex, b if (bXVar && nIndex == 0) return "=\"" + ScResId(STR_LABEL_INTERCEPT) + "\""; - if (mpWithLabelsCheckBox->IsChecked()) + if (mxWithLabelsCheckBox->get_active()) { ScAddress aAddr(bXVar ? mVariable1Range.aStart : mVariable2Range.aStart); if (mGroupedBy == BY_COLUMN) @@ -512,7 +498,7 @@ void ScRegressionDialog::WriteRegressionANOVAResults(AddressWalkerWriter& rOutpu rOutput.newLine(); rOutput.writeString(ScResId(STR_LABEL_CONFIDENCE_LEVEL)); rOutput.nextColumn(); - rOutput.writeValue(mpConfidenceLevelField->GetValue() / 100.0); + rOutput.writeValue(mxConfidenceLevelField->get_value() / 100.0); rTemplate.autoReplaceAddress("%CONFIDENCE_LEVEL_ADDR%", rOutput.current()); rOutput.newLine(); } @@ -687,12 +673,12 @@ void ScRegressionDialog::WriteTable(const std::function<CellValueGetter>& rCellG } } -IMPL_LINK_NOARG(ScRegressionDialog, CheckBoxHdl, CheckBox&, void) +IMPL_LINK_NOARG(ScRegressionDialog, CheckBoxHdl, weld::ToggleButton&, void) { ValidateDialogInput(); } -IMPL_LINK_NOARG(ScRegressionDialog, NumericFieldHdl, Edit&, void) +IMPL_LINK_NOARG(ScRegressionDialog, NumericFieldHdl, weld::SpinButton&, void) { ValidateDialogInput(); } diff --git a/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx b/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx index 6f0896d3cc9d..1dfce0397f53 100644 --- a/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx @@ -335,4 +335,323 @@ void ScStatisticsTwoVariableDialog::ValidateDialogInput() mpButtonOk->Disable(); } +ScStatisticsTwoVariableDialogController::ScStatisticsTwoVariableDialogController( + SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, + weld::Window* pParent, ScViewData* pViewData, const OUString& rUIXMLDescription, const OString& rID) + : ScAnyRefDlgController(pSfxBindings, pChildWindow, pParent, rUIXMLDescription, rID) + , mxVariable1RangeLabel(m_xBuilder->weld_label("variable1-range-label")) + , mxVariable1RangeEdit(new formula::WeldRefEdit(m_xBuilder->weld_entry("variable1-range-edit"))) + , mxVariable1RangeButton(new formula::WeldRefButton(m_xBuilder->weld_button("variable1-range-button"))) + , mxVariable2RangeLabel(m_xBuilder->weld_label("variable2-range-label")) + , mxVariable2RangeEdit(new formula::WeldRefEdit(m_xBuilder->weld_entry("variable2-range-edit"))) + , mxVariable2RangeButton(new formula::WeldRefButton(m_xBuilder->weld_button("variable2-range-button"))) + , mxOutputRangeLabel(m_xBuilder->weld_label("output-range-label")) + , mxOutputRangeEdit(new formula::WeldRefEdit(m_xBuilder->weld_entry("output-range-edit"))) + , mxOutputRangeButton(new formula::WeldRefButton(m_xBuilder->weld_button("output-range-button"))) + , mViewData(pViewData) + , mDocument(pViewData->GetDocument()) + , mVariable1Range(ScAddress::INITIALIZE_INVALID) + , mVariable2Range(ScAddress::INITIALIZE_INVALID) + , mAddressDetails(mDocument->GetAddressConvention(), 0, 0 ) + , mOutputAddress(ScAddress::INITIALIZE_INVALID) + , mGroupedBy(BY_COLUMN) + , mxButtonOk(m_xBuilder->weld_button("ok")) + , mxGroupByColumnsRadio(m_xBuilder->weld_radio_button("groupedby-columns-radio")) + , mxGroupByRowsRadio(m_xBuilder->weld_radio_button("groupedby-rows-radio")) + , mpActiveEdit(nullptr) + , mCurrentAddress(pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo() ) + , mDialogLostFocus(false) +{ + mxVariable1RangeEdit->SetReferences(this, mxVariable1RangeLabel.get()); + mxVariable1RangeButton->SetReferences(this, mxVariable1RangeEdit.get()); + + mxVariable2RangeEdit->SetReferences(this, mxVariable2RangeLabel.get()); + mxVariable2RangeButton->SetReferences(this, mxVariable2RangeEdit.get()); + + mxOutputRangeEdit->SetReferences(this, mxOutputRangeLabel.get()); + mxOutputRangeButton->SetReferences(this, mxOutputRangeEdit.get()); + + Init(); + GetRangeFromSelection(); +} + +ScStatisticsTwoVariableDialogController::~ScStatisticsTwoVariableDialogController() +{ +} + +void ScStatisticsTwoVariableDialogController::Init() +{ + mxButtonOk->connect_clicked( LINK( this, ScStatisticsTwoVariableDialogController, OkClicked ) ); + mxButtonOk->set_sensitive(false); + + Link<formula::WeldRefEdit&,void> aEditLink = LINK( this, ScStatisticsTwoVariableDialogController, GetEditFocusHandler ); + mxVariable1RangeEdit->SetGetFocusHdl( aEditLink ); + mxVariable2RangeEdit->SetGetFocusHdl( aEditLink ); + mxOutputRangeEdit->SetGetFocusHdl( aEditLink ); + + Link<formula::WeldRefButton&,void> aButtonLink = LINK( this, ScStatisticsTwoVariableDialogController, GetButtonFocusHandler ); + mxVariable1RangeButton->SetGetFocusHdl( aButtonLink ); + mxVariable2RangeButton->SetGetFocusHdl( aButtonLink ); + mxOutputRangeButton->SetGetFocusHdl( aButtonLink ); + + aEditLink = LINK( this, ScStatisticsTwoVariableDialogController, LoseEditFocusHandler ); + mxVariable1RangeEdit->SetLoseFocusHdl( aEditLink ); + mxVariable2RangeEdit->SetLoseFocusHdl( aEditLink ); + mxOutputRangeEdit->SetLoseFocusHdl( aEditLink ); + + aButtonLink = LINK( this, ScStatisticsTwoVariableDialogController, LoseButtonFocusHandler ); + mxVariable1RangeButton->SetLoseFocusHdl( aButtonLink ); + mxVariable2RangeButton->SetLoseFocusHdl( aButtonLink ); + mxOutputRangeButton->SetLoseFocusHdl( aButtonLink ); + + Link<formula::WeldRefEdit&,void> aLink2 = LINK( this, ScStatisticsTwoVariableDialogController, RefInputModifyHandler); + mxVariable1RangeEdit->SetModifyHdl( aLink2); + mxVariable2RangeEdit->SetModifyHdl( aLink2); + mxOutputRangeEdit->SetModifyHdl( aLink2); + + mxOutputRangeEdit->GrabFocus(); + + mxGroupByColumnsRadio->connect_toggled( LINK( this, ScStatisticsTwoVariableDialogController, GroupByChanged ) ); + mxGroupByRowsRadio->connect_toggled( LINK( this, ScStatisticsTwoVariableDialogController, GroupByChanged ) ); + + mxGroupByColumnsRadio->set_active(true); + mxGroupByRowsRadio->set_active(false); +} + +void ScStatisticsTwoVariableDialogController::GetRangeFromSelection() +{ + OUString aCurrentString; + + ScRange aCurrentRange; + mViewData->GetSimpleArea(aCurrentRange); + + if (aCurrentRange.aEnd.Col() - aCurrentRange.aStart.Col() == 1) + { + mVariable1Range = aCurrentRange; + mVariable1Range.aEnd.SetCol(mVariable1Range.aStart.Col()); + aCurrentString = mVariable1Range.Format(ScRefFlags::RANGE_ABS_3D, mDocument, mAddressDetails); + mxVariable1RangeEdit->SetText(aCurrentString); + + mVariable2Range = aCurrentRange; + mVariable2Range.aStart.SetCol(mVariable2Range.aEnd.Col()); + aCurrentString = mVariable2Range.Format(ScRefFlags::RANGE_ABS_3D, mDocument, mAddressDetails); + mxVariable2RangeEdit->SetText(aCurrentString); + } + else + { + mVariable1Range = aCurrentRange; + aCurrentString = mVariable1Range.Format(ScRefFlags::RANGE_ABS_3D, mDocument, mAddressDetails); + mxVariable1RangeEdit->SetText(aCurrentString); + } +} + +void ScStatisticsTwoVariableDialogController::SetActive() +{ + if ( mDialogLostFocus ) + { + mDialogLostFocus = false; + if( mpActiveEdit ) + mpActiveEdit->GrabFocus(); + } + else + { + m_xDialog->grab_focus(); + } + RefInputDone(); +} + +void ScStatisticsTwoVariableDialogController::SetReference( const ScRange& rReferenceRange, ScDocument* pDocument ) +{ + if ( mpActiveEdit != nullptr ) + { + if ( rReferenceRange.aStart != rReferenceRange.aEnd ) + RefInputStart( mpActiveEdit ); + + OUString aReferenceString; + + if ( mpActiveEdit == mxVariable1RangeEdit.get() ) + { + mVariable1Range = rReferenceRange; + aReferenceString = mVariable1Range.Format(ScRefFlags::RANGE_ABS_3D, pDocument, mAddressDetails); + mxVariable1RangeEdit->SetRefString(aReferenceString); + } + else if ( mpActiveEdit == mxVariable2RangeEdit.get() ) + { + mVariable2Range = rReferenceRange; + aReferenceString = mVariable2Range.Format(ScRefFlags::RANGE_ABS_3D, pDocument, mAddressDetails); + mxVariable2RangeEdit->SetRefString(aReferenceString); + } + else if ( mpActiveEdit == mxOutputRangeEdit.get() ) + { + mOutputAddress = rReferenceRange.aStart; + + ScRefFlags nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ? + ScRefFlags::ADDR_ABS : + ScRefFlags::ADDR_ABS_3D; + aReferenceString = mOutputAddress.Format(nFormat, pDocument, pDocument->GetAddressConvention()); + mxOutputRangeEdit->SetRefString( aReferenceString ); + } + } + + ValidateDialogInput(); +} + +IMPL_LINK_NOARG( ScStatisticsTwoVariableDialogController, OkClicked, weld::Button&, void ) +{ + CalculateInputAndWriteToOutput(); + response(RET_OK); +} + +IMPL_LINK(ScStatisticsTwoVariableDialogController, GetEditFocusHandler, formula::WeldRefEdit&, rCtrl, void) +{ + mpActiveEdit = nullptr; + if (&rCtrl == mxVariable1RangeEdit.get()) + { + mpActiveEdit = mxVariable1RangeEdit.get(); + } + else if (&rCtrl == mxVariable2RangeEdit.get()) + { + mpActiveEdit = mxVariable2RangeEdit.get(); + } + else if (&rCtrl == mxOutputRangeEdit.get()) + { + mpActiveEdit = mxOutputRangeEdit.get(); + } + + if( mpActiveEdit ) + mpActiveEdit->SelectAll(); +} + +IMPL_LINK( ScStatisticsTwoVariableDialogController, GetButtonFocusHandler, formula::WeldRefButton&, rCtrl, void ) +{ + mpActiveEdit = nullptr; + if (&rCtrl == mxVariable1RangeButton.get()) + { + mpActiveEdit = mxVariable1RangeEdit.get(); + } + else if (&rCtrl == mxVariable2RangeButton.get()) + { + mpActiveEdit = mxVariable2RangeEdit.get(); + } + else if (&rCtrl == mxOutputRangeButton.get()) + { + mpActiveEdit = mxOutputRangeEdit.get(); + } + + if( mpActiveEdit ) + mpActiveEdit->SelectAll(); +} + +IMPL_LINK_NOARG( ScStatisticsTwoVariableDialogController, LoseEditFocusHandler, formula::WeldRefEdit&, void ) +{ + mDialogLostFocus = !m_xDialog->has_toplevel_focus(); +} + +IMPL_LINK_NOARG( ScStatisticsTwoVariableDialogController, LoseButtonFocusHandler, formula::WeldRefButton&, void ) +{ + mDialogLostFocus = !m_xDialog->has_toplevel_focus(); +} + +IMPL_LINK_NOARG(ScStatisticsTwoVariableDialogController, GroupByChanged, weld::ToggleButton&, void) +{ + if (mxGroupByColumnsRadio->get_active()) + mGroupedBy = BY_COLUMN; + else if (mxGroupByRowsRadio->get_active()) + mGroupedBy = BY_ROW; + + ValidateDialogInput(); +} + +IMPL_LINK_NOARG( ScStatisticsTwoVariableDialogController, RefInputModifyHandler, formula::WeldRefEdit&, void ) +{ + if ( mpActiveEdit ) + { + if (mpActiveEdit == mxVariable1RangeEdit.get()) + { + ScRangeList aRangeList; + bool bValid = ParseWithNames( aRangeList, mxVariable1RangeEdit->GetText(), mDocument); + const ScRange* pRange = (bValid && aRangeList.size() == 1) ? &aRangeList[0] : nullptr; + if (pRange) + { + mVariable1Range = *pRange; + // Highlight the resulting range. + mxVariable1RangeEdit->StartUpdateData(); + } + else + { + mVariable1Range = ScRange( ScAddress::INITIALIZE_INVALID); + } + } + else if ( mpActiveEdit == mxVariable2RangeEdit.get() ) + { + ScRangeList aRangeList; + bool bValid = ParseWithNames( aRangeList, mxVariable2RangeEdit->GetText(), mDocument); + const ScRange* pRange = (bValid && aRangeList.size() == 1) ? &aRangeList[0] : nullptr; + if (pRange) + { + mVariable2Range = *pRange; + // Highlight the resulting range. + mxVariable2RangeEdit->StartUpdateData(); + } + else + { + mVariable2Range = ScRange( ScAddress::INITIALIZE_INVALID); + } + } + else if ( mpActiveEdit == mxOutputRangeEdit.get() ) + { + ScRangeList aRangeList; + bool bValid = ParseWithNames( aRangeList, mxOutputRangeEdit->GetText(), mDocument); + const ScRange* pRange = (bValid && aRangeList.size() == 1) ? &aRangeList[0] : nullptr; + if (pRange) + { + mOutputAddress = pRange->aStart; + + // Crop output range to top left address for Edit field. + if (pRange->aStart != pRange->aEnd) + { + ScRefFlags nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ? + ScRefFlags::ADDR_ABS : + ScRefFlags::ADDR_ABS_3D; + OUString aReferenceString = mOutputAddress.Format(nFormat, mDocument, mDocument->GetAddressConvention()); + mxOutputRangeEdit->SetRefString( aReferenceString ); + } + + // Highlight the resulting range. + mxOutputRangeEdit->StartUpdateData(); + } + else + { + mOutputAddress = ScAddress( ScAddress::INITIALIZE_INVALID); + } + } + } + + ValidateDialogInput(); +} + +void ScStatisticsTwoVariableDialogController::CalculateInputAndWriteToOutput() +{ + OUString aUndo(ScResId(GetUndoNameId())); + ScDocShell* pDocShell = mViewData->GetDocShell(); + SfxUndoManager* pUndoManager = pDocShell->GetUndoManager(); + pUndoManager->EnterListAction( aUndo, aUndo, 0, mViewData->GetViewShell()->GetViewShellId() ); + + ScRange aOutputRange = ApplyOutput(pDocShell); + + pUndoManager->LeaveListAction(); + pDocShell->PostPaint( aOutputRange, PaintPartFlags::Grid ); +} + +bool ScStatisticsTwoVariableDialogController::InputRangesValid() +{ + return mVariable1Range.IsValid() && mVariable2Range.IsValid() && mOutputAddress.IsValid(); +} + +void ScStatisticsTwoVariableDialogController::ValidateDialogInput() +{ + // Enable OK button if all inputs are ok. + mxButtonOk->set_sensitive(InputRangesValid()); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/RegressionDialog.hxx b/sc/source/ui/inc/RegressionDialog.hxx index f02fcb472f21..6f689d80c321 100644 --- a/sc/source/ui/inc/RegressionDialog.hxx +++ b/sc/source/ui/inc/RegressionDialog.hxx @@ -13,34 +13,33 @@ #include "StatisticsTwoVariableDialog.hxx" -class ScRegressionDialog : public ScStatisticsTwoVariableDialog +class ScRegressionDialog : public ScStatisticsTwoVariableDialogController { - VclPtr<CheckBox> mpWithLabelsCheckBox; - VclPtr<RadioButton> mpLinearRadioButton; - VclPtr<RadioButton> mpLogarithmicRadioButton; - VclPtr<RadioButton> mpPowerRadioButton; - VclPtr<FixedText> mpErrorMessage; - VclPtr<NumericField> mpConfidenceLevelField; - VclPtr<CheckBox> mpCalcResidualsCheckBox; - VclPtr<CheckBox> mpNoInterceptCheckBox; - bool mbUnivariate; size_t mnNumIndependentVars; size_t mnNumObservations; bool mbUse3DAddresses; bool mbCalcIntercept; + std::unique_ptr<weld::CheckButton> mxWithLabelsCheckBox; + std::unique_ptr<weld::RadioButton> mxLinearRadioButton; + std::unique_ptr<weld::RadioButton> mxLogarithmicRadioButton; + std::unique_ptr<weld::RadioButton> mxPowerRadioButton; + std::unique_ptr<weld::Label> mxErrorMessage; + std::unique_ptr<weld::SpinButton> mxConfidenceLevelField; + std::unique_ptr<weld::CheckButton> mxCalcResidualsCheckBox; + std::unique_ptr<weld::CheckButton> mxNoInterceptCheckBox; + public: ScRegressionDialog( SfxBindings* pB, SfxChildWindow* pCW, - vcl::Window* pParent, ScViewData* pViewData ); + weld::Window* pParent, ScViewData* pViewData ); virtual ~ScRegressionDialog() override; - virtual bool Close() override; + virtual void Close() override; protected: - void dispose() override; virtual const char* GetUndoNameId() override; virtual ScRange ApplyOutput(ScDocShell* pDocShell) override; virtual bool InputRangesValid() override; @@ -75,8 +74,8 @@ private: size_t nColsInTable, AddressWalkerWriter& rOutput, const std::function<CellWriter>& rFunc); - DECL_LINK( CheckBoxHdl, CheckBox&, void ); - DECL_LINK( NumericFieldHdl, Edit&, void ); + DECL_LINK( CheckBoxHdl, weld::ToggleButton&, void ); + DECL_LINK( NumericFieldHdl, weld::SpinButton&, void ); }; diff --git a/sc/source/ui/inc/StatisticsTwoVariableDialog.hxx b/sc/source/ui/inc/StatisticsTwoVariableDialog.hxx index 967114d9e048..66eb3628862a 100644 --- a/sc/source/ui/inc/StatisticsTwoVariableDialog.hxx +++ b/sc/source/ui/inc/StatisticsTwoVariableDialog.hxx @@ -89,6 +89,79 @@ private: DECL_LINK( RefInputModifyHandler, Edit&, void ); }; +class ScStatisticsTwoVariableDialogController : public ScAnyRefDlgController +{ +public: + enum GroupedBy { + BY_COLUMN, + BY_ROW + }; + + ScStatisticsTwoVariableDialogController( + SfxBindings* pB, SfxChildWindow* pCW, + weld::Window* pParent, ScViewData* pViewData, + const OUString& rUIXMLDescription, const OString& rID); + + virtual ~ScStatisticsTwoVariableDialogController() override; + + virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) override; + virtual void SetActive() override; + +protected: + void CalculateInputAndWriteToOutput(); + + virtual ScRange ApplyOutput(ScDocShell* pDocShell) = 0; + virtual const char* GetUndoNameId() = 0; + virtual bool InputRangesValid(); + void ValidateDialogInput(); + + // Widgets + std::unique_ptr<weld::Label> mxVariable1RangeLabel; + std::unique_ptr<formula::WeldRefEdit> mxVariable1RangeEdit; + std::unique_ptr<formula::WeldRefButton> mxVariable1RangeButton; + + std::unique_ptr<weld::Label> mxVariable2RangeLabel; + std::unique_ptr<formula::WeldRefEdit> mxVariable2RangeEdit; + std::unique_ptr<formula::WeldRefButton> mxVariable2RangeButton; + + std::unique_ptr<weld::Label> mxOutputRangeLabel; + std::unique_ptr<formula::WeldRefEdit> mxOutputRangeEdit; + std::unique_ptr<formula::WeldRefButton> mxOutputRangeButton; + + // Data + ScViewData* const mViewData; + ScDocument* const mDocument; + + ScRange mVariable1Range; + ScRange mVariable2Range; + + ScAddress::Details const mAddressDetails; + ScAddress mOutputAddress; + GroupedBy mGroupedBy; + +private: + // Widgets + std::unique_ptr<weld::Button> mxButtonOk; + + std::unique_ptr<weld::RadioButton> mxGroupByColumnsRadio; + std::unique_ptr<weld::RadioButton> mxGroupByRowsRadio; + + formula::WeldRefEdit* mpActiveEdit; + ScAddress const mCurrentAddress; + bool mDialogLostFocus; + + void Init(); + void GetRangeFromSelection(); + + DECL_LINK( GroupByChanged, weld::ToggleButton&, void ); + DECL_LINK( OkClicked, weld::Button&, void ); + DECL_LINK( GetEditFocusHandler, formula::WeldRefEdit&, void ); + DECL_LINK( GetButtonFocusHandler, formula::WeldRefButton&, void ); + DECL_LINK( LoseEditFocusHandler, formula::WeldRefEdit&, void ); + DECL_LINK( LoseButtonFocusHandler, formula::WeldRefButton&, void ); + DECL_LINK( RefInputModifyHandler, formula::WeldRefEdit&, void ); +}; + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/reffact.hxx b/sc/source/ui/inc/reffact.hxx index 8de5fda75893..76fa455f9f81 100644 --- a/sc/source/ui/inc/reffact.hxx +++ b/sc/source/ui/inc/reffact.hxx @@ -107,7 +107,7 @@ private: }; class ScRegressionDialogWrapper : - public ChildWindowWrapper<SID_REGRESSION_DIALOG> + public ChildControllerWrapper<SID_REGRESSION_DIALOG> { private: ScRegressionDialogWrapper() = delete; diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index 95d10e13e33c..b8f378323b9e 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -330,12 +330,6 @@ VclPtr<SfxModelessDialog> ScTabViewShell::CreateRefDialog( } break; - case SID_REGRESSION_DIALOG: - { - pResult = VclPtr<ScRegressionDialog>::Create( pB, pCW, pParent, &GetViewData() ); - } - break; - case SID_TTEST_DIALOG: { pResult = VclPtr<ScTTestDialog>::Create( pB, pCW, pParent, &GetViewData() ); @@ -532,6 +526,11 @@ std::unique_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont xResult.reset(new ScMovingAverageDialog(pB, pCW, pParent, &GetViewData())); } break; + case SID_REGRESSION_DIALOG: + { + xResult.reset(new ScRegressionDialog(pB, pCW, pParent, &GetViewData())); + } + break; } if (xResult) diff --git a/sc/uiconfig/scalc/ui/regressiondialog.ui b/sc/uiconfig/scalc/ui/regressiondialog.ui index e8162fe4f379..3aafb5b898e3 100644 --- a/sc/uiconfig/scalc/ui/regressiondialog.ui +++ b/sc/uiconfig/scalc/ui/regressiondialog.ui @@ -2,7 +2,6 @@ <!-- Generated with glade 3.22.1 --> <interface domain="sc"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> <object class="GtkAdjustment" id="confidencelevel-adjustment"> <property name="upper">1</property> <property name="value">0.94999999999999996</property> @@ -13,6 +12,8 @@ <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="regressiondialog|RegressionDialog">Regression</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> <child> <placeholder/> @@ -116,11 +117,12 @@ </packing> </child> <child> - <object class="foruilo-RefEdit" id="variable1-range-edit"> + <object class="GtkEntry" id="variable1-range-edit"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="valign">center</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> <property name="width_chars">30</property> </object> <packing> @@ -129,7 +131,7 @@ </packing> </child> <child> - <object class="foruilo-RefButton" id="variable1-range-button"> + <object class="GtkButton" id="variable1-range-button"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -154,11 +156,12 @@ </packing> </child> <child> - <object class="foruilo-RefEdit" id="variable2-range-edit"> + <object class="GtkEntry" id="variable2-range-edit"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="valign">center</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> <property name="width_chars">30</property> </object> <packing> @@ -167,7 +170,7 @@ </packing> </child> <child> - <object class="foruilo-RefButton" id="variable2-range-button"> + <object class="GtkButton" id="variable2-range-button"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -189,6 +192,7 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">2</property> + <property name="width">3</property> </packing> </child> <child> @@ -206,11 +210,12 @@ </packing> </child> <child> - <object class="foruilo-RefEdit" id="output-range-edit"> + <object class="GtkEntry" id="output-range-edit"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="valign">center</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> <property name="width_chars">30</property> </object> <packing> @@ -219,7 +224,7 @@ </packing> </child> <child> - <object class="foruilo-RefButton" id="output-range-button"> + <object class="GtkButton" id="output-range-button"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -229,12 +234,6 @@ <property name="top_attach">3</property> </packing> </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> </object> </child> </object> @@ -472,6 +471,7 @@ <property name="can_focus">True</property> <property name="halign">start</property> <property name="valign">center</property> + <property name="activates_default">True</property> <property name="text" context="regressiondialog|confidencelevel-spin">0,95</property> <property name="adjustment">confidencelevel-adjustment</property> <property name="digits">2</property> @@ -534,6 +534,7 @@ </child> <action-widgets> <action-widget response="-5">ok</action-widget> + <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> </action-widgets> </object> diff --git a/solenv/sanitizers/ui/modules/scalc.suppr b/solenv/sanitizers/ui/modules/scalc.suppr index 9d3847715593..4fbc39b986f2 100644 --- a/solenv/sanitizers/ui/modules/scalc.suppr +++ b/solenv/sanitizers/ui/modules/scalc.suppr @@ -1,6 +1,7 @@ sc/uiconfig/scalc/ui/advancedfilterdialog.ui://foruilo-RefEdit[@id='edfilterarea'] no-labelled-by sc/uiconfig/scalc/ui/advancedfilterdialog.ui://GtkLabel[@id='dbarealabel'] orphan-label sc/uiconfig/scalc/ui/advancedfilterdialog.ui://GtkLabel[@id='dbarea'] orphan-label +sc/uiconfig/scalc/ui/aggregatefunctionentry.ui:GtkGrid[@id='grid']/GtkBox/GtkLabel orphan-label sc/uiconfig/scalc/ui/analysisofvariancedialog.ui://GtkButton[@id='input-range-button'] button-no-label sc/uiconfig/scalc/ui/analysisofvariancedialog.ui://GtkButton[@id='output-range-button'] button-no-label sc/uiconfig/scalc/ui/cellprotectionpage.ui://GtkLabel[@id='label1'] orphan-label @@ -124,12 +125,6 @@ sc/uiconfig/scalc/ui/mergecolumnentry.ui:GtkGrid[@id='grid']/GtkBox/GtkGrid[@id= sc/uiconfig/scalc/ui/mergecolumnentry.ui://GtkEntry[@id='ed_separator'] no-labelled-by sc/uiconfig/scalc/ui/mergecolumnentry.ui:GtkGrid[@id='grid']/GtkBox/GtkGrid[@id='grid_details']/GtkLabel orphan-label sc/uiconfig/scalc/ui/mergecolumnentry.ui://GtkEntry[@id='ed_columns'] no-labelled-by -sc/uiconfig/scalc/ui/movingaveragedialog.ui://GtkButton[@id='input-range-button'] button-no-label -sc/uiconfig/scalc/ui/movingaveragedialog.ui://GtkButton[@id='output-range-button'] button-no-label -sc/uiconfig/scalc/ui/texttransformationentry.ui:GtkGrid[@id='grid']/GtkBox/GtkLabel orphan-label -sc/uiconfig/scalc/ui/sorttransformationentry.ui:GtkGrid[@id='grid']/GtkBox/GtkLabel orphan-label -sc/uiconfig/scalc/ui/aggregatefunctionentry.ui:GtkGrid[@id='grid']/GtkBox/GtkLabel orphan-label -sc/uiconfig/scalc/ui/numbertransformationentry.ui:GtkGrid[@id='grid']/GtkBox/GtkLabel orphan-label sc/uiconfig/scalc/ui/movecopysheet.ui://GtkEntry[@id='newName'] no-labelled-by sc/uiconfig/scalc/ui/movecopysheet.ui://GtkLabel[@id='newNameWarn'] orphan-label sc/uiconfig/scalc/ui/movecopysheet.ui://GtkLabel[@id='warnunused'] orphan-label @@ -137,8 +132,11 @@ sc/uiconfig/scalc/ui/movecopysheet.ui://GtkLabel[@id='warnempty'] orphan-label sc/uiconfig/scalc/ui/movecopysheet.ui://GtkLabel[@id='warninvalid'] orphan-label sc/uiconfig/scalc/ui/movingaveragedialog.ui://GtkLabel[@id='interval-label'] orphan-label sc/uiconfig/scalc/ui/movingaveragedialog.ui://GtkSpinButton[@id='interval-spin'] no-labelled-by +sc/uiconfig/scalc/ui/movingaveragedialog.ui://GtkButton[@id='input-range-button'] button-no-label +sc/uiconfig/scalc/ui/movingaveragedialog.ui://GtkButton[@id='output-range-button'] button-no-label sc/uiconfig/scalc/ui/nosolutiondialog.ui://GtkLabel[@id='label1'] orphan-label sc/uiconfig/scalc/ui/nosolutiondialog.ui://GtkLabel[@id='error'] orphan-label +sc/uiconfig/scalc/ui/numbertransformationentry.ui:GtkGrid[@id='grid']/GtkBox/GtkLabel orphan-label sc/uiconfig/scalc/ui/passfragment.ui://GtkButton[@id='button'] button-no-label sc/uiconfig/scalc/ui/pivotfielddialog.ui://GtkLabel[@id='label2'] orphan-label sc/uiconfig/scalc/ui/pivotfielddialog.ui://GtkLabel[@id='name'] orphan-label @@ -172,10 +170,14 @@ sc/uiconfig/scalc/ui/protectsheetdlg.ui://GtkLabel[@id='insert-rows'] orphan-lab sc/uiconfig/scalc/ui/protectsheetdlg.ui://GtkLabel[@id='delete-columns'] orphan-label sc/uiconfig/scalc/ui/protectsheetdlg.ui://GtkLabel[@id='delete-rows'] orphan-label sc/uiconfig/scalc/ui/regressiondialog.ui://GtkLabel[@id='error-message'] orphan-label +sc/uiconfig/scalc/ui/regressiondialog.ui://GtkButton[@id='variable1-range-button'] button-no-label +sc/uiconfig/scalc/ui/regressiondialog.ui://GtkButton[@id='variable2-range-button'] button-no-label +sc/uiconfig/scalc/ui/regressiondialog.ui://GtkButton[@id='output-range-button'] button-no-label sc/uiconfig/scalc/ui/retypepassdialog.ui://GtkLabel[@id='descLabel'] orphan-label sc/uiconfig/scalc/ui/retypepassdialog.ui://GtkLabel[@id='docStatusLabel'] orphan-label sc/uiconfig/scalc/ui/samplingdialog.ui://GtkButton[@id='input-range-button'] button-no-label sc/uiconfig/scalc/ui/samplingdialog.ui://GtkButton[@id='output-range-button'] button-no-label +sc/uiconfig/scalc/ui/sorttransformationentry.ui:GtkGrid[@id='grid']/GtkBox/GtkLabel orphan-label sc/uiconfig/scalc/ui/standardfilterdialog.ui://GtkComboBoxText[@id='connect1'] missing-label-for sc/uiconfig/scalc/ui/standardfilterdialog.ui://GtkComboBoxText[@id='connect2'] missing-label-for sc/uiconfig/scalc/ui/standardfilterdialog.ui://GtkLabel[@id='label2'] orphan-label @@ -239,6 +241,7 @@ sc/uiconfig/scalc/ui/statisticsinfopage.ui://GtkLabel[@id='nosheets'] orphan-lab sc/uiconfig/scalc/ui/statisticsinfopage.ui://GtkLabel[@id='noformula'] orphan-label sc/uiconfig/scalc/ui/textimportcsv.ui://sclo-ScCsvTableBox[@id='scrolledwindowcolumntype'] no-labelled-by sc/uiconfig/scalc/ui/textimportcsv.ui://GtkLabel[@id='textalttitle'] orphan-label +sc/uiconfig/scalc/ui/texttransformationentry.ui:GtkGrid[@id='grid']/GtkBox/GtkLabel orphan-label sc/uiconfig/scalc/ui/validationcriteriapage.ui://foruilo-RefEdit[@id='min'] no-labelled-by sc/uiconfig/scalc/ui/validationcriteriapage.ui://sclo-ScRefButtonEx[@id='validref'] no-labelled-by sc/uiconfig/scalc/ui/validationcriteriapage.ui://GtkTextView[@id='minlist:border'] no-labelled-by commit e4c4288a4334567c586bc40ece9b3dcf69ccc499 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Apr 10 10:47:35 2019 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Apr 11 09:54:42 2019 +0200 weld ScMovingAverageDialog Change-Id: I5dee3cc19118356d325bc3db9a5ef563945c82ec Reviewed-on: https://gerrit.libreoffice.org/70511 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx b/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx index e1f0d6360ef2..ef05075d2560 100644 --- a/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx @@ -18,28 +18,22 @@ ScMovingAverageDialog::ScMovingAverageDialog( SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, - vcl::Window* pParent, ScViewData* pViewData ) : - ScStatisticsInputOutputDialog( + weld::Window* pParent, ScViewData* pViewData ) + : ScStatisticsInputOutputDialogController( pSfxBindings, pChildWindow, pParent, pViewData, - "MovingAverageDialog", "modules/scalc/ui/movingaveragedialog.ui" ) + "modules/scalc/ui/movingaveragedialog.ui", + "MovingAverageDialog") + , mxIntervalSpin(m_xBuilder->weld_spin_button("interval-spin")) { - get(mpIntervalSpin, "interval-spin"); } ScMovingAverageDialog::~ScMovingAverageDialog() { - disposeOnce(); } -void ScMovingAverageDialog::dispose() +void ScMovingAverageDialog::Close() { - mpIntervalSpin.clear(); - ScStatisticsInputOutputDialog::dispose(); -} - -bool ScMovingAverageDialog::Close() -{ - return DoClose( ScMovingAverageDialogWrapper::GetChildWindowId() ); + DoClose( ScMovingAverageDialogWrapper::GetChildWindowId() ); } const char* ScMovingAverageDialog::GetUndoNameId() @@ -59,7 +53,7 @@ ScRange ScMovingAverageDialog::ApplyOutput(ScDocShell* pDocShell) else pIterator.reset(new DataRangeByRowIterator(mInputRange)); - sal_Int32 aIntervalSize = mpIntervalSpin->GetValue(); + sal_Int32 aIntervalSize = mxIntervalSpin->get_value(); const bool aCentral = true; //to-do add support to change this to the dialog for( ; pIterator->hasNext(); pIterator->next() ) diff --git a/sc/source/ui/inc/MovingAverageDialog.hxx b/sc/source/ui/inc/MovingAverageDialog.hxx index 02cdcca6df7a..bbcf0a2dfa05 100644 --- a/sc/source/ui/inc/MovingAverageDialog.hxx +++ b/sc/source/ui/inc/MovingAverageDialog.hxx @@ -16,20 +16,19 @@ #include "StatisticsInputOutputDialog.hxx" -class ScMovingAverageDialog : public ScStatisticsInputOutputDialog +class ScMovingAverageDialog : public ScStatisticsInputOutputDialogController { private: - VclPtr<NumericField> mpIntervalSpin; + std::unique_ptr<weld::SpinButton> mxIntervalSpin; public: ScMovingAverageDialog( SfxBindings* pB, SfxChildWindow* pCW, - vcl::Window* pParent, ScViewData* pViewData ); + weld::Window* pParent, ScViewData* pViewData ); virtual ~ScMovingAverageDialog() override; - virtual void dispose() override; - virtual bool Close() override; + virtual void Close() override; protected: virtual const char* GetUndoNameId() override; diff --git a/sc/source/ui/inc/reffact.hxx b/sc/source/ui/inc/reffact.hxx index eb4923dc7903..8de5fda75893 100644 --- a/sc/source/ui/inc/reffact.hxx +++ b/sc/source/ui/inc/reffact.hxx @@ -100,7 +100,7 @@ private: }; class ScMovingAverageDialogWrapper : - public ChildWindowWrapper<SID_MOVING_AVERAGE_DIALOG> + public ChildControllerWrapper<SID_MOVING_AVERAGE_DIALOG> { private: ScMovingAverageDialogWrapper() = delete; diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index 5052ab24ec55..95d10e13e33c 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -330,12 +330,6 @@ VclPtr<SfxModelessDialog> ScTabViewShell::CreateRefDialog( } break; - case SID_MOVING_AVERAGE_DIALOG: - { - pResult = VclPtr<ScMovingAverageDialog>::Create( pB, pCW, pParent, &GetViewData() ); - } - break; - case SID_REGRESSION_DIALOG: { pResult = VclPtr<ScRegressionDialog>::Create( pB, pCW, pParent, &GetViewData() ); @@ -533,6 +527,11 @@ std::unique_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont xResult.reset(new ScExponentialSmoothingDialog(pB, pCW, pParent, &GetViewData())); } break; + case SID_MOVING_AVERAGE_DIALOG: + { + xResult.reset(new ScMovingAverageDialog(pB, pCW, pParent, &GetViewData())); + } + break; } if (xResult) diff --git a/sc/uiconfig/scalc/ui/movingaveragedialog.ui b/sc/uiconfig/scalc/ui/movingaveragedialog.ui index df17904eecc1..935cb2a98b5d 100644 --- a/sc/uiconfig/scalc/ui/movingaveragedialog.ui +++ b/sc/uiconfig/scalc/ui/movingaveragedialog.ui @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sc"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> <object class="GtkAdjustment" id="interval-adjustment"> <property name="lower">2</property> <property name="upper">10000</property> @@ -15,12 +14,76 @@ <property name="border_width">6</property> <property name="title" translatable="yes" context="movingaveragedialog|MovingAverageDialog">Moving Average</property> <property name="resizable">False</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> + <child> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="can_focus">False</property> <property name="orientation">vertical</property> <property name="spacing">12</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area1"> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="help"> + <property name="label">gtk-help</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + <property name="secondary">True</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> <child> <object class="GtkFrame" id="frame-data"> <property name="visible">True</property> @@ -45,10 +108,10 @@ <object class="GtkLabel" id="input-range-label"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="movingaveragedialog|input-range-label">Input range:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">input-range-edit</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -56,11 +119,12 @@ </packing> </child> <child> - <object class="foruilo-RefEdit" id="input-range-edit"> + <object class="GtkEntry" id="input-range-edit"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="valign">center</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> <property name="width_chars">30</property> </object> <packing> @@ -69,7 +133,7 @@ </packing> </child> <child> - <object class="foruilo-RefButton" id="input-range-button"> + <object class="GtkButton" id="input-range-button"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -83,10 +147,10 @@ <object class="GtkLabel" id="output-range-label"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="movingaveragedialog|output-range-label">Results to:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">output-range-edit</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -94,11 +158,12 @@ </packing> </child> <child> - <object class="foruilo-RefEdit" id="output-range-edit"> + <object class="GtkEntry" id="output-range-edit"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="valign">center</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> <property name="width_chars">30</property> </object> <packing> @@ -107,7 +172,7 @@ </packing> </child> <child> - <object class="foruilo-RefButton" id="output-range-button"> + <object class="GtkButton" id="output-range-button"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -138,65 +203,6 @@ <property name="position">0</property> </packing> </child> - <child internal-child="action_area"> - <object class="GtkButtonBox" id="dialog-action_area1"> - <property name="can_focus">False</property> - <property name="layout_style">end</property> - <child> - <object class="GtkButton" id="ok"> - <property name="label">gtk-ok</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="receives_default">True</property> - <property name="use_stock">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="cancel"> - <property name="label">gtk-cancel</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="receives_default">True</property> - <property name="use_stock">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkButton" id="help"> - <property name="label">gtk-help</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_stock">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - <property name="secondary">True</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">end</property> - <property name="position">0</property> - </packing> - </child> <child> <object class="GtkFrame" id="frame-group"> <property name="visible">True</property> @@ -294,9 +300,9 @@ <object class="GtkLabel" id="interval-label"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="movingaveragedialog|interval-label">Interval:</property> <property name="use_underline">True</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -307,7 +313,8 @@ <object class="GtkSpinButton" id="interval-spin"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="text" translatable="no">2</property> + <property name="activates_default">True</property> + <property name="text">2</property> <property name="adjustment">interval-adjustment</property> <property name="value">2</property> </object> @@ -341,6 +348,7 @@ </child> <action-widgets> <action-widget response="-5">ok</action-widget> + <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> </action-widgets> </object> diff --git a/solenv/sanitizers/ui/modules/scalc.suppr b/solenv/sanitizers/ui/modules/scalc.suppr index 9b2dc4330814..9d3847715593 100644 --- a/solenv/sanitizers/ui/modules/scalc.suppr +++ b/solenv/sanitizers/ui/modules/scalc.suppr @@ -124,6 +124,8 @@ sc/uiconfig/scalc/ui/mergecolumnentry.ui:GtkGrid[@id='grid']/GtkBox/GtkGrid[@id= sc/uiconfig/scalc/ui/mergecolumnentry.ui://GtkEntry[@id='ed_separator'] no-labelled-by sc/uiconfig/scalc/ui/mergecolumnentry.ui:GtkGrid[@id='grid']/GtkBox/GtkGrid[@id='grid_details']/GtkLabel orphan-label sc/uiconfig/scalc/ui/mergecolumnentry.ui://GtkEntry[@id='ed_columns'] no-labelled-by +sc/uiconfig/scalc/ui/movingaveragedialog.ui://GtkButton[@id='input-range-button'] button-no-label +sc/uiconfig/scalc/ui/movingaveragedialog.ui://GtkButton[@id='output-range-button'] button-no-label sc/uiconfig/scalc/ui/texttransformationentry.ui:GtkGrid[@id='grid']/GtkBox/GtkLabel orphan-label sc/uiconfig/scalc/ui/sorttransformationentry.ui:GtkGrid[@id='grid']/GtkBox/GtkLabel orphan-label sc/uiconfig/scalc/ui/aggregatefunctionentry.ui:GtkGrid[@id='grid']/GtkBox/GtkLabel orphan-label _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits