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

Caolán McNamara caolanm at redhat.com
Tue May 15 10:46:35 UTC 2018


 sc/source/ui/inc/solveroptions.hxx      |    9 +++-----
 sc/source/ui/miscdlgs/solveroptions.cxx |   33 +++++++++++---------------------
 sc/uiconfig/scalc/ui/doubledialog.ui    |   10 ++++++++-
 sc/uiconfig/scalc/ui/integerdialog.ui   |    1 
 4 files changed, 26 insertions(+), 27 deletions(-)

New commits:
commit d735ffde2df79e5ccc4010077ff358ca63e879e9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue May 15 09:08:18 2018 +0100

    weld ScSolverValueDialog
    
    Change-Id: I1c55d184052482fc472d66069ea8722cd27d1543
    Reviewed-on: https://gerrit.libreoffice.org/54353
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/ui/inc/solveroptions.hxx b/sc/source/ui/inc/solveroptions.hxx
index f160ff5e9b6b..4d999ad76b95 100644
--- a/sc/source/ui/inc/solveroptions.hxx
+++ b/sc/source/ui/inc/solveroptions.hxx
@@ -83,15 +83,14 @@ public:
     sal_Int32   GetValue() const;
 };
 
-class ScSolverValueDialog : public ModalDialog
+class ScSolverValueDialog : public weld::GenericDialogController
 {
-    VclPtr<VclFrame>   m_pFrame;
-    VclPtr<Edit>       m_pEdValue;
+    std::unique_ptr<weld::Frame> m_xFrame;
+    std::unique_ptr<weld::Entry> m_xEdValue;
 
 public:
-    ScSolverValueDialog( vcl::Window * pParent );
+    ScSolverValueDialog(weld::Window* pParent);
     virtual ~ScSolverValueDialog() override;
-    virtual void dispose() override;
 
     void        SetOptionName( const OUString& rName );
     void        SetValue( double fValue );
diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx
index cc26a8ce849f..9d0e8b043a73 100644
--- a/sc/source/ui/miscdlgs/solveroptions.cxx
+++ b/sc/source/ui/miscdlgs/solveroptions.cxx
@@ -322,12 +322,12 @@ void ScSolverOptionsDialog::EditOption()
             {
                 if ( pStringItem->IsDouble() )
                 {
-                    ScopedVclPtrInstance< ScSolverValueDialog > aValDialog( this );
-                    aValDialog->SetOptionName( pStringItem->GetText() );
-                    aValDialog->SetValue( pStringItem->GetDoubleValue() );
-                    if ( aValDialog->Execute() == RET_OK )
+                    ScSolverValueDialog aValDialog(GetFrameWeld());
+                    aValDialog.SetOptionName( pStringItem->GetText() );
+                    aValDialog.SetValue( pStringItem->GetDoubleValue() );
+                    if (aValDialog.run() == RET_OK)
                     {
-                        pStringItem->SetDoubleValue( aValDialog->GetValue() );
+                        pStringItem->SetDoubleValue( aValDialog.GetValue() );
                         m_pLbSettings->InvalidateEntry( pEntry );
                     }
                 }
@@ -429,41 +429,32 @@ sal_Int32 ScSolverIntegerDialog::GetValue() const
     return static_cast<sal_Int32>(nValue);
 }
 
-ScSolverValueDialog::ScSolverValueDialog( vcl::Window * pParent )
-    : ModalDialog( pParent, "DoubleDialog",
-        "modules/scalc/ui/doubledialog.ui" )
+ScSolverValueDialog::ScSolverValueDialog(weld::Window* pParent)
+    : GenericDialogController(pParent, "modules/scalc/ui/doubledialog.ui", "DoubleDialog")
+    , m_xFrame(m_xBuilder->weld_frame("frame"))
+    , m_xEdValue(m_xBuilder->weld_entry("value"))
 {
-    get(m_pFrame, "frame");
-    get(m_pEdValue, "value");
 }
 
 ScSolverValueDialog::~ScSolverValueDialog()
 {
-    disposeOnce();
-}
-
-void ScSolverValueDialog::dispose()
-{
-    m_pFrame.clear();
-    m_pEdValue.clear();
-    ModalDialog::dispose();
 }
 
 void ScSolverValueDialog::SetOptionName( const OUString& rName )
 {
-    m_pFrame->set_label(rName);
+    m_xFrame->set_label(rName);
 }
 
 void ScSolverValueDialog::SetValue( double fValue )
 {
-    m_pEdValue->SetText( rtl::math::doubleToUString( fValue,
+    m_xEdValue->set_text( rtl::math::doubleToUString( fValue,
             rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
             ScGlobal::GetpLocaleData()->getNumDecimalSep()[0], true ) );
 }
 
 double ScSolverValueDialog::GetValue() const
 {
-    OUString aInput = m_pEdValue->GetText();
+    OUString aInput = m_xEdValue->get_text();
 
     rtl_math_ConversionStatus eStatus = rtl_math_ConversionStatus_Ok;
     sal_Int32 nParseEnd = 0;
diff --git a/sc/uiconfig/scalc/ui/doubledialog.ui b/sc/uiconfig/scalc/ui/doubledialog.ui
index 76389b50e01f..db09046c7ff7 100644
--- a/sc/uiconfig/scalc/ui/doubledialog.ui
+++ b/sc/uiconfig/scalc/ui/doubledialog.ui
@@ -1,11 +1,18 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
 <interface domain="sc">
-  <!-- interface-requires gtk+ 3.0 -->
+  <requires lib="gtk+" version="3.0"/>
   <object class="GtkDialog" id="DoubleDialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="doubledialog|DoubleDialog">Edit Setting</property>
+    <property name="modal">True</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>
@@ -75,6 +82,7 @@
                     <property name="can_focus">True</property>
                     <property name="halign">start</property>
                     <property name="valign">start</property>
+                    <property name="activates_default">True</property>
                   </object>
                 </child>
               </object>
diff --git a/sc/uiconfig/scalc/ui/integerdialog.ui b/sc/uiconfig/scalc/ui/integerdialog.ui
index 1cae3ac77854..09f383b26afc 100644
--- a/sc/uiconfig/scalc/ui/integerdialog.ui
+++ b/sc/uiconfig/scalc/ui/integerdialog.ui
@@ -83,6 +83,7 @@
                     <property name="can_focus">True</property>
                     <property name="halign">start</property>
                     <property name="valign">start</property>
+                    <property name="activates_default">True</property>
                     <property name="adjustment">adjustment1</property>
                   </object>
                 </child>


More information about the Libreoffice-commits mailing list