[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sc/source sc/uiconfig
Rafael Lima (via logerrit)
logerrit at kemper.freedesktop.org
Fri Nov 27 00:10:32 UTC 2020
sc/source/ui/inc/optsolver.hxx | 1
sc/source/ui/miscdlgs/optsolver.cxx | 25 +++++++++++++++++++
sc/uiconfig/scalc/ui/solverdlg.ui | 46 +++++++++++++++++++++++-------------
3 files changed, 56 insertions(+), 16 deletions(-)
New commits:
commit 8795ae5e992e05dbd24cf03560dddb1fee061522
Author: Rafael Lima <rafael.palma.lima at gmail.com>
AuthorDate: Tue Nov 17 17:59:50 2020 -0300
Commit: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Fri Nov 27 01:09:55 2020 +0100
tdf#134528 Add "Reset All" button to Calc Solver dialog
Change-Id: I27a2fb4dddf3da31801bc2283ee58a24a921d7ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106030
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
(cherry picked from commit e1b05b134e43d3186ddc5b8cfbbacb62ee4af483)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106442
Reviewed-by: Rafael Lima <rafael.palma.lima at gmail.com>
Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
diff --git a/sc/source/ui/inc/optsolver.hxx b/sc/source/ui/inc/optsolver.hxx
index ed9860e8b652..410f513375ee 100644
--- a/sc/source/ui/inc/optsolver.hxx
+++ b/sc/source/ui/inc/optsolver.hxx
@@ -177,6 +177,7 @@ private:
std::unique_ptr<weld::Button> m_xBtnOpt;
std::unique_ptr<weld::Button> m_xBtnCancel;
std::unique_ptr<weld::Button> m_xBtnSolve;
+ std::unique_ptr<weld::Button> m_xBtnResetAll;
std::unique_ptr<weld::Label> m_xResultFT;
std::unique_ptr<weld::Widget> m_xContents;
diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx
index e3c6b1d751e9..8fc81893e26c 100644
--- a/sc/source/ui/miscdlgs/optsolver.cxx
+++ b/sc/source/ui/miscdlgs/optsolver.cxx
@@ -202,6 +202,7 @@ ScOptSolverDlg::ScOptSolverDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Windo
, m_xBtnOpt(m_xBuilder->weld_button("options"))
, m_xBtnCancel(m_xBuilder->weld_button("close"))
, m_xBtnSolve(m_xBuilder->weld_button("ok"))
+ , m_xBtnResetAll(m_xBuilder->weld_button("resetall"))
, m_xResultFT(m_xBuilder->weld_label("result"))
, m_xContents(m_xBuilder->weld_widget("grid"))
{
@@ -273,6 +274,7 @@ void ScOptSolverDlg::Init(const ScAddress& rCursorPos)
m_xBtnOpt->connect_clicked( LINK( this, ScOptSolverDlg, BtnHdl ) );
m_xBtnCancel->connect_clicked( LINK( this, ScOptSolverDlg, BtnHdl ) );
m_xBtnSolve->connect_clicked( LINK( this, ScOptSolverDlg, BtnHdl ) );
+ m_xBtnResetAll->connect_clicked( LINK( this, ScOptSolverDlg, BtnHdl ) );
Link<formula::RefEdit&,void> aEditLink = LINK( this, ScOptSolverDlg, GetEditFocusHdl );
Link<formula::RefButton&,void> aButtonLink = LINK( this, ScOptSolverDlg, GetButtonFocusHdl );
@@ -545,6 +547,29 @@ IMPL_LINK(ScOptSolverDlg, BtnHdl, weld::Button&, rBtn, void)
m_xOptDlg.reset();
});
}
+ else if (&rBtn == m_xBtnResetAll.get())
+ {
+ OUString sEmpty;
+ m_xEdObjectiveCell->SetText(sEmpty);
+ m_xEdTargetValue->SetText(sEmpty);
+ m_xEdVariableCells->SetText(sEmpty);
+
+ // Get default property values of solver implementations
+ maEngine = maImplNames[0];
+ maProperties = ScSolverUtil::GetDefaults( maEngine );
+
+ // Clear all conditions (Constraints)
+ maConditions.clear();
+ std::unique_ptr<ScOptSolverSave> pEmpty( new ScOptSolverSave(
+ sEmpty, true, false, false,
+ sEmpty, sEmpty, maConditions, maEngine, maProperties ) );
+ mpDocShell->SetSolverSaveData( std::move(pEmpty) );
+ ShowConditions();
+
+ m_xRbMax->set_active(true);
+ m_xEdObjectiveCell->GrabFocus();
+ mpEdActive = m_xEdObjectiveCell.get();
+ }
}
IMPL_LINK( ScOptSolverDlg, GetEditFocusHdl, formula::RefEdit&, rCtrl, void )
diff --git a/sc/uiconfig/scalc/ui/solverdlg.ui b/sc/uiconfig/scalc/ui/solverdlg.ui
index a4f63ef2b3e8..ccd87c6f54d1 100644
--- a/sc/uiconfig/scalc/ui/solverdlg.ui
+++ b/sc/uiconfig/scalc/ui/solverdlg.ui
@@ -20,37 +20,51 @@
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
- <object class="GtkButton" id="options">
- <property name="label" translatable="yes" context="solverdlg|options">O_ptions...</property>
+ <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_underline">True</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="options-atkobject">
- <property name="AtkObject::accessible-description" translatable="yes" context="solverdlg|extended_tip|options">Opens the Solver Options dialog.</property>
- </object>
- </child>
+ <property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
+ <property name="secondary">True</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="help">
- <property name="label">gtk-help</property>
+ <object class="GtkButton" id="resetall">
+ <property name="label" translatable="yes" context="solverdlg|resetall">_Reset All</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_stock">True</property>
+ <property name="use_underline">True</property>
</object>
<packing>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
- <property name="secondary">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="options">
+ <property name="label" translatable="yes" context="solverdlg|options">O_ptions...</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="options-atkobject">
+ <property name="AtkObject::accessible-description" translatable="yes" context="solverdlg|extended_tip|options">Opens the Solver Options dialog.</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
@@ -66,7 +80,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
<child>
@@ -80,7 +94,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">3</property>
+ <property name="position">4</property>
</packing>
</child>
</object>
@@ -869,8 +883,8 @@
</object>
</child>
<action-widgets>
- <action-widget response="101">options</action-widget>
<action-widget response="-11">help</action-widget>
+ <action-widget response="101">options</action-widget>
<action-widget response="-5">ok</action-widget>
<action-widget response="-7">close</action-widget>
</action-widgets>
More information about the Libreoffice-commits
mailing list