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

Caolán McNamara caolanm at redhat.com
Thu Apr 12 16:53:32 UTC 2018


 cui/source/tabpages/autocdlg.cxx |   24 +++++++++++-------------
 cui/uiconfig/ui/percentdialog.ui |   12 ++++++++++--
 2 files changed, 21 insertions(+), 15 deletions(-)

New commits:
commit 7b39e82291a9cc2403a26c966394aa20597ddce6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Apr 12 10:20:47 2018 +0100

    weld OfaAutoFmtPrcntSet
    
    Change-Id: Ib7c63c75e6b7b8cef0405d22d81658483dc9778b
    Reviewed-on: https://gerrit.libreoffice.org/52769
    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/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 6e4ca0f34290..299a2c3789d6 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -302,21 +302,19 @@ struct ImpUserData
 /*                                                                   */
 /*********************************************************************/
 
-class OfaAutoFmtPrcntSet : public ModalDialog
+class OfaAutoFmtPrcntSet : public weld::GenericDialogController
 {
-    VclPtr<MetricField> m_pPrcntMF;
+    std::unique_ptr<weld::MetricSpinButton> m_xPrcntMF;
 public:
-    explicit OfaAutoFmtPrcntSet(vcl::Window* pParent)
-        : ModalDialog(pParent, "PercentDialog","cui/ui/percentdialog.ui")
+    explicit OfaAutoFmtPrcntSet(weld::Window* pParent)
+        : GenericDialogController(pParent, "cui/ui/percentdialog.ui", "PercentDialog")
+        , m_xPrcntMF(m_xBuilder->weld_metric_spin_button("margin", FUNIT_PERCENT))
     {
-        get(m_pPrcntMF, "margin");
     }
-    virtual ~OfaAutoFmtPrcntSet() override { disposeOnce(); }
-    virtual void dispose() override { m_pPrcntMF.clear(); ModalDialog::dispose(); }
 
-    MetricField& GetPrcntFld()
+    weld::MetricSpinButton& GetPrcntFld()
     {
-        return *m_pPrcntMF;
+        return *m_xPrcntMF;
     }
 };
 
@@ -744,11 +742,11 @@ IMPL_LINK_NOARG(OfaSwAutoFmtOptionsPage, EditHdl, Button*, void)
     else if( MERGE_SINGLE_LINE_PARA == nSelEntryPos )
     {
         // dialog for per cent settings
-        ScopedVclPtrInstance< OfaAutoFmtPrcntSet > aDlg(this);
-        aDlg->GetPrcntFld().SetValue(nPercent);
-        if(RET_OK == aDlg->Execute())
+        OfaAutoFmtPrcntSet aDlg(GetFrameWeld());
+        aDlg.GetPrcntFld().set_value(nPercent, FUNIT_PERCENT);
+        if (aDlg.run() == RET_OK)
         {
-            nPercent = static_cast<sal_uInt16>(aDlg->GetPrcntFld().GetValue());
+            nPercent = static_cast<sal_uInt16>(aDlg.GetPrcntFld().get_value(FUNIT_PERCENT));
             sMargin = " " +
                 unicode::formatPercent(nPercent, Application::GetSettings().GetUILanguageTag());
         }
diff --git a/cui/uiconfig/ui/percentdialog.ui b/cui/uiconfig/ui/percentdialog.ui
index cdc4816e8ba7..efab1b1d90d7 100644
--- a/cui/uiconfig/ui/percentdialog.ui
+++ b/cui/uiconfig/ui/percentdialog.ui
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.4 -->
 <interface domain="cui">
-  <!-- interface-requires gtk+ 3.0 -->
+  <requires lib="gtk+" version="3.0"/>
   <object class="GtkAdjustment" id="adjustment1">
     <property name="upper">100</property>
     <property name="value">77</property>
@@ -11,6 +12,9 @@
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="percentdialog|PercentDialog">Combine</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 internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
@@ -76,11 +80,12 @@
                 <property name="top_padding">6</property>
                 <property name="left_padding">12</property>
                 <child>
-                  <object class="GtkSpinButton" id="margin:0%">
+                  <object class="GtkSpinButton" id="margin">
                     <property name="visible">True</property>
                     <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>
@@ -109,5 +114,8 @@
       <action-widget response="-5">ok</action-widget>
       <action-widget response="-6">cancel</action-widget>
     </action-widgets>
+    <child>
+      <placeholder/>
+    </child>
   </object>
 </interface>


More information about the Libreoffice-commits mailing list