[Libreoffice-commits] core.git: sc/inc sc/source sc/uiconfig sc/UIConfig_scalc.mk

Caolán McNamara caolanm at redhat.com
Sun Dec 29 15:23:12 PST 2013


 sc/UIConfig_scalc.mk                        |    1 
 sc/inc/helpids.h                            |    1 
 sc/inc/sc.hrc                               |    1 
 sc/source/ui/inc/optsolver.hrc              |    3 
 sc/source/ui/inc/optsolver.hxx              |   12 +-
 sc/source/ui/miscdlgs/optsolver.cxx         |   25 +++--
 sc/source/ui/src/optsolver.src              |   50 -----------
 sc/uiconfig/scalc/ui/solversuccessdialog.ui |  119 ++++++++++++++++++++++++++++
 8 files changed, 139 insertions(+), 73 deletions(-)

New commits:
commit eb91348f8dee9ca6f46050a7170ff2bb39c13146
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Dec 29 21:22:27 2013 +0000

    convert solver success dialog to .ui
    
    Change-Id: Ia9062a21afde96510a4953d1b51e7e59e9012fb7

diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index cddbd87..41bcb7c 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -137,6 +137,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
 	sc/uiconfig/scalc/ui/sidebarnumberformat \
 	sc/uiconfig/scalc/ui/sidebarcellappearance \
 	sc/uiconfig/scalc/ui/solverdlg \
+	sc/uiconfig/scalc/ui/solversuccessdialog \
 	sc/uiconfig/scalc/ui/sortcriteriapage \
 	sc/uiconfig/scalc/ui/sortdialog \
 	sc/uiconfig/scalc/ui/sortkey \
diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h
index 22526d6..8d989dd 100644
--- a/sc/inc/helpids.h
+++ b/sc/inc/helpids.h
@@ -163,7 +163,6 @@
 #define HID_SC_SOLVEROPTIONS                                    "SC_HID_SC_SOLVEROPTIONS"
 #define HID_SC_SOLVEROPTIONS_LB                                 "SC_HID_SC_SOLVEROPTIONS_LB"
 #define HID_SC_SOLVER_PROGRESS                                  "SC_HID_SC_SOLVER_PROGRESS"
-#define HID_SC_SOLVER_SUCCESS                                   "SC_HID_SC_SOLVER_SUCCESS"
 
 #define HID_SCDLG_CONFLICTS                                     "SC_HID_SCDLG_CONFLICTS"
 
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index d97cfcf..0b0f398 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -1095,7 +1095,6 @@
 
 #define RID_SCDLG_SOLVEROPTIONS         (SC_DIALOGS_START + 139)
 #define RID_SCDLG_SOLVER_PROGRESS       (SC_DIALOGS_START + 142)
-#define RID_SCDLG_SOLVER_SUCCESS        (SC_DIALOGS_START + 144)
 
 #define RID_SCDLG_CONFLICTS             (SC_DIALOGS_START + 145)
 #define RID_SCDLG_SHAREDOCUMENT         (SC_DIALOGS_START + 146)
diff --git a/sc/source/ui/inc/optsolver.hrc b/sc/source/ui/inc/optsolver.hrc
index f72063e..bbb3bce 100644
--- a/sc/source/ui/inc/optsolver.hrc
+++ b/sc/source/ui/inc/optsolver.hrc
@@ -21,9 +21,6 @@
 
 #define FT_PROGRESS             7
 #define FT_TIMELIMIT            8
-#define FT_SUCCESS              11
-#define FT_RESULT               12
-#define FT_QUESTION             13
 
 #define FL_CONDITIONS           1
 #define FL_BUTTONS              2
diff --git a/sc/source/ui/inc/optsolver.hxx b/sc/source/ui/inc/optsolver.hxx
index aaf756d..1f850d7 100644
--- a/sc/source/ui/inc/optsolver.hxx
+++ b/sc/source/ui/inc/optsolver.hxx
@@ -229,16 +229,14 @@ public:
 
 class ScSolverSuccessDialog : public ModalDialog
 {
-    FixedText       maFtSuccess;
-    FixedText       maFtResult;
-    FixedText       maFtQuestion;
-    FixedLine       maFlButtons;
-    OKButton        maBtnOk;
-    CancelButton    maBtnCancel;
+    FixedText* m_pFtResult;
+    PushButton* m_pBtnOk;
+    PushButton* m_pBtnCancel;
+
+    DECL_LINK(ClickHdl, PushButton*);
 
 public:
     ScSolverSuccessDialog( Window* pParent, const OUString& rSolution );
-    ~ScSolverSuccessDialog();
 };
 
 
diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx
index d0020e2..7648ac2 100644
--- a/sc/source/ui/miscdlgs/optsolver.cxx
+++ b/sc/source/ui/miscdlgs/optsolver.cxx
@@ -88,21 +88,24 @@ ScSolverNoSolutionDialog::ScSolverNoSolutionDialog( Window* pParent, const OUStr
 //----------------------------------------------------------------------------
 
 ScSolverSuccessDialog::ScSolverSuccessDialog( Window* pParent, const OUString& rSolution )
-    : ModalDialog( pParent, ScResId( RID_SCDLG_SOLVER_SUCCESS ) ),
-    maFtSuccess     ( this, ScResId( FT_SUCCESS ) ),
-    maFtResult      ( this, ScResId( FT_RESULT ) ),
-    maFtQuestion    ( this, ScResId( FT_QUESTION ) ),
-    maFlButtons     ( this, ScResId( FL_BUTTONS ) ),
-    maBtnOk         ( this, ScResId( BTN_OK ) ),
-    maBtnCancel     ( this, ScResId( BTN_CANCEL ) )
+    : ModalDialog(pParent, "SolverSuccessDialog", "modules/scalc/ui/solversuccessdialog.ui")
 {
-    OUString aMessage = maFtResult.GetText() + " " + rSolution;
-    maFtResult.SetText( aMessage );
-    FreeResource();
+    get(m_pFtResult, "result");
+    get(m_pBtnOk, "ok");
+    m_pBtnOk->SetClickHdl(LINK(this, ScSolverSuccessDialog, ClickHdl));
+    get(m_pBtnCancel, "cancel");
+    m_pBtnCancel->SetClickHdl(LINK(this, ScSolverSuccessDialog, ClickHdl));
+    OUString aMessage = m_pFtResult->GetText() + " " + rSolution;
+    m_pFtResult->SetText(aMessage);
 }
 
-ScSolverSuccessDialog::~ScSolverSuccessDialog()
+IMPL_LINK( ScSolverSuccessDialog, ClickHdl, PushButton*, pBtn )
 {
+    if (pBtn == m_pBtnOk)
+        EndDialog(true);
+    else
+        EndDialog(false);
+    return 0;
 }
 
 //----------------------------------------------------------------------------
diff --git a/sc/source/ui/src/optsolver.src b/sc/source/ui/src/optsolver.src
index 1de4b5e..9ab6de1 100644
--- a/sc/source/ui/src/optsolver.src
+++ b/sc/source/ui/src/optsolver.src
@@ -56,54 +56,4 @@ ModelessDialog RID_SCDLG_SOLVER_PROGRESS
     Text [ en-US ] = "Solving..." ;
 };
 
-
-ModalDialog RID_SCDLG_SOLVER_SUCCESS
-{
-    OutputSize = TRUE ;
-    HelpId = HID_SC_SOLVER_SUCCESS ;
-    SVLook = TRUE ;
-    Size = MAP_APPFONT ( 138 , 89 ) ;
-    Moveable = TRUE ;
-    FixedText FT_SUCCESS
-    {
-        Pos = MAP_APPFONT ( 6 , 8 ) ;
-        Size = MAP_APPFONT ( 126 , 8 ) ;
-        Text [ en-US ] = "Solving successfully finished." ;
-    };
-    FixedText FT_RESULT
-    {
-        Pos = MAP_APPFONT ( 6 , 22 ) ;
-        Size = MAP_APPFONT ( 126 , 8 ) ;
-        Text [ en-US ] = "Result:" ;
-    };
-    FixedText FT_QUESTION
-    {
-        Pos = MAP_APPFONT ( 6 , 36 ) ;
-        Size = MAP_APPFONT ( 126 , 16 ) ;
-        WordBreak = TRUE ;
-        Text [ en-US ] = "Do you want to keep the result or do you want to restore previous values?" ;
-    };
-    FixedLine FL_BUTTONS
-    {
-        Pos = MAP_APPFONT ( 0 , 58 ) ;
-        Size = MAP_APPFONT ( 138 , 8 ) ;
-    };
-    OKButton BTN_OK
-    {
-        Pos = MAP_APPFONT ( 6 , 69 ) ;
-        Size = MAP_APPFONT ( 60 , 14 ) ;
-        TabStop = TRUE ;
-        DefButton = TRUE ;
-        Text [ en-US ] = "Keep Result" ;
-    };
-    CancelButton BTN_CANCEL
-    {
-        Pos = MAP_APPFONT ( 72 , 69 ) ;
-        Size = MAP_APPFONT ( 60 , 14 ) ;
-        TabStop = TRUE ;
-        Text [ en-US ] = "Restore Previous" ;
-    };
-    Text [ en-US ] = "Solving Result" ;
-};
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/uiconfig/scalc/ui/solversuccessdialog.ui b/sc/uiconfig/scalc/ui/solversuccessdialog.ui
new file mode 100644
index 0000000..c0e4619
--- /dev/null
+++ b/sc/uiconfig/scalc/ui/solversuccessdialog.ui
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkDialog" id="SolverSuccessDialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes">Solving Result</property>
+    <property name="type_hint">dialog</property>
+    <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>
+          <object class="GtkGrid" id="grid1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="row_spacing">24</property>
+            <child>
+              <object class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Do you want to keep the result or do you want to restore previous values?</property>
+                <property name="wrap">True</property>
+                <property name="max_width_chars">52</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">2</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Solving successfully finished.</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="result">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Result:</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <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">Keep Result</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_underline">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">Restore Previous</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">ok</action-widget>
+      <action-widget response="0">cancel</action-widget>
+    </action-widgets>
+  </object>
+</interface>


More information about the Libreoffice-commits mailing list