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

Caolán McNamara caolanm at redhat.com
Sat May 19 19:51:45 UTC 2018


 sc/inc/scabstdlg.hxx                |    2 
 sc/source/ui/attrdlg/scdlgfact.cxx  |   11 +-
 sc/source/ui/attrdlg/scdlgfact.hxx  |   11 +-
 sc/source/ui/dbgui/sortdlg.cxx      |   38 +++-----
 sc/source/ui/inc/sortdlg.hxx        |   17 +--
 sc/source/ui/view/cellsh2.cxx       |    2 
 sc/uiconfig/scalc/ui/sortwarning.ui |  168 ++++++++++++++++--------------------
 7 files changed, 118 insertions(+), 131 deletions(-)

New commits:
commit 71f855bd31009b4a4463bcb0826fed6e4a8faaea
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat May 19 16:44:27 2018 +0100

    weld ScSortWarningDlg
    
    Change-Id: I9462906fbe77a8463d7b283942c5280fdd71239e
    Reviewed-on: https://gerrit.libreoffice.org/54565
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index f5b299c8dde8..392e4d60fa2d 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -410,7 +410,7 @@ public:
                                                                 bool bCol,
                                                                 bool bRow) = 0;
 
-    virtual VclPtr<AbstractScSortWarningDlg> CreateScSortWarningDlg(vcl::Window* pParent, const OUString& rExtendText, const OUString& rCurrentText ) = 0;
+    virtual VclPtr<AbstractScSortWarningDlg> CreateScSortWarningDlg(weld::Window* pParent, const OUString& rExtendText, const OUString& rCurrentText ) = 0;
 
     virtual VclPtr<AbstractScCondFormatManagerDlg> CreateScCondFormatMgrDlg(vcl::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList ) = 0;
 
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 89179fed4b6e..a84d7dc9b5dd 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -173,7 +173,11 @@ bool AbstractScShowTabDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContex
     return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
 }
 
-IMPL_ABSTDLG_BASE(AbstractScSortWarningDlg_Impl);
+short AbstractScSortWarningDlg_Impl::Execute()
+{
+    return m_xDlg->run();
+}
+
 IMPL_ABSTDLG_BASE(AbstractScTabBgColorDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScImportOptionsDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScTextImportOptionsDlg_Impl);
@@ -699,10 +703,9 @@ VclPtr<AbstractScColRowLabelDlg>  ScAbstractDialogFactory_Impl::CreateScColRowLa
     return VclPtr<AbstractScColRowLabelDlg_Impl>::Create(new ScColRowLabelDlg(pParent, bCol, bRow));
 }
 
-VclPtr<AbstractScSortWarningDlg> ScAbstractDialogFactory_Impl::CreateScSortWarningDlg( vcl::Window* pParent, const OUString& rExtendText, const OUString& rCurrentText )
+VclPtr<AbstractScSortWarningDlg> ScAbstractDialogFactory_Impl::CreateScSortWarningDlg(weld::Window* pParent, const OUString& rExtendText, const OUString& rCurrentText)
 {
-    VclPtr<ScSortWarningDlg> pDlg = VclPtr<ScSortWarningDlg>::Create(pParent, rExtendText, rCurrentText );
-    return VclPtr<AbstractScSortWarningDlg_Impl>::Create( pDlg );
+    return VclPtr<AbstractScSortWarningDlg_Impl>::Create(new ScSortWarningDlg(pParent, rExtendText, rCurrentText));
 }
 
 VclPtr<AbstractScCondFormatManagerDlg> ScAbstractDialogFactory_Impl::CreateScCondFormatMgrDlg(vcl::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList )
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 184eaddb11c0..27e6513b2904 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -440,7 +440,14 @@ public:
 
 class AbstractScSortWarningDlg_Impl : public AbstractScSortWarningDlg
 {
-    DECL_ABSTDLG_BASE( AbstractScSortWarningDlg_Impl, ScSortWarningDlg )
+protected:
+    std::unique_ptr<ScSortWarningDlg> m_xDlg;
+public:
+    explicit AbstractScSortWarningDlg_Impl(ScSortWarningDlg* p)
+        : m_xDlg(p)
+    {
+    }
+    virtual short Execute() override;
 };
 
 class AbstractScStringInputDlg_Impl :  public AbstractScStringInputDlg
@@ -508,7 +515,7 @@ public:
                                                                 bool bCol,
                                                                 bool bRow) override;
 
-    virtual VclPtr<AbstractScSortWarningDlg> CreateScSortWarningDlg(vcl::Window* pParent, const OUString& rExtendText, const OUString& rCurrentText ) override;
+    virtual VclPtr<AbstractScSortWarningDlg> CreateScSortWarningDlg(weld::Window* pParent, const OUString& rExtendText, const OUString& rCurrentText ) override;
 
     virtual VclPtr<AbstractScCondFormatManagerDlg> CreateScCondFormatMgrDlg(vcl::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList ) override;
 
diff --git a/sc/source/ui/dbgui/sortdlg.cxx b/sc/source/ui/dbgui/sortdlg.cxx
index d192885ac773..53feb2d16c4d 100644
--- a/sc/source/ui/dbgui/sortdlg.cxx
+++ b/sc/source/ui/dbgui/sortdlg.cxx
@@ -31,45 +31,35 @@ ScSortDlg::ScSortDlg(vcl::Window* pParent, const SfxItemSet* pArgSet)
     AddTabPage("options", ScTabPageSortOptions::Create, nullptr);
 }
 
-ScSortWarningDlg::ScSortWarningDlg(vcl::Window* pParent,
+ScSortWarningDlg::ScSortWarningDlg(weld::Window* pParent,
     const OUString& rExtendText, const OUString& rCurrentText)
-    : ModalDialog(pParent, "SortWarning", "modules/scalc/ui/sortwarning.ui")
+    : GenericDialogController(pParent, "modules/scalc/ui/sortwarning.ui", "SortWarning")
+    , m_xFtText(m_xBuilder->weld_label("sorttext"))
+    , m_xBtnExtSort(m_xBuilder->weld_button("extend"))
+    , m_xBtnCurSort(m_xBuilder->weld_button("current"))
 {
-    get( aFtText, "sorttext" );
-    get( aBtnExtSort, "extend" );
-    get( aBtnCurSort, "current" );
-
-    OUString sTextName = aFtText->GetText();
+    OUString sTextName = m_xFtText->get_label();
     sTextName = sTextName.replaceFirst("%1", rExtendText);
     sTextName = sTextName.replaceFirst("%2", rCurrentText);
-    aFtText->SetText( sTextName );
+    m_xFtText->set_label(sTextName);
 
-    aBtnExtSort->SetClickHdl( LINK( this, ScSortWarningDlg, BtnHdl ) );
-    aBtnCurSort->SetClickHdl( LINK( this, ScSortWarningDlg, BtnHdl ) );
+    m_xBtnExtSort->connect_clicked( LINK( this, ScSortWarningDlg, BtnHdl ) );
+    m_xBtnCurSort->connect_clicked( LINK( this, ScSortWarningDlg, BtnHdl ) );
 }
 
 ScSortWarningDlg::~ScSortWarningDlg()
 {
-    disposeOnce();
-}
-
-void ScSortWarningDlg::dispose()
-{
-    aFtText.clear();
-    aBtnExtSort.clear();
-    aBtnCurSort.clear();
-    ModalDialog::dispose();
 }
 
-IMPL_LINK( ScSortWarningDlg, BtnHdl, Button*, pBtn, void )
+IMPL_LINK(ScSortWarningDlg, BtnHdl, weld::Button&, rBtn, void)
 {
-    if ( pBtn == aBtnExtSort )
+    if (&rBtn == m_xBtnExtSort.get())
     {
-        EndDialog( BTN_EXTEND_RANGE );
+        m_xDialog->response(BTN_EXTEND_RANGE);
     }
-    else if( pBtn == aBtnCurSort )
+    else if(&rBtn == m_xBtnCurSort.get())
     {
-        EndDialog( BTN_CURRENT_SELECTION );
+        m_xDialog->response(BTN_CURRENT_SELECTION);
     }
 }
 
diff --git a/sc/source/ui/inc/sortdlg.hxx b/sc/source/ui/inc/sortdlg.hxx
index 85b24b5de216..6b790aa3965b 100644
--- a/sc/source/ui/inc/sortdlg.hxx
+++ b/sc/source/ui/inc/sortdlg.hxx
@@ -21,9 +21,7 @@
 #define INCLUDED_SC_SOURCE_UI_INC_SORTDLG_HXX
 
 #include <sfx2/tabdlg.hxx>
-#include <vcl/button.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/fixed.hxx>
+#include <vcl/weld.hxx>
 #include "scui_def.hxx"
 
 class ScSortDlg : public SfxTabDialog
@@ -41,17 +39,16 @@ private:
     bool    bIsByRows;
 };
 
-class ScSortWarningDlg : public ModalDialog
+class ScSortWarningDlg : public weld::GenericDialogController
 {
 public:
-    ScSortWarningDlg( vcl::Window* pParent, const OUString& rExtendText,const OUString& rCurrentText );
+    ScSortWarningDlg(weld::Window* pParent, const OUString& rExtendText,const OUString& rCurrentText);
     virtual ~ScSortWarningDlg() override;
-    virtual void dispose() override;
-    DECL_LINK( BtnHdl, Button*, void );
+    DECL_LINK(BtnHdl, weld::Button&, void);
 private:
-    VclPtr<FixedText>       aFtText;
-    VclPtr<PushButton>      aBtnExtSort;
-    VclPtr<PushButton>      aBtnCurSort;
+    std::unique_ptr<weld::Label> m_xFtText;
+    std::unique_ptr<weld::Button> m_xBtnExtSort;
+    std::unique_ptr<weld::Button> m_xBtnCurSort;
 };
 
 #endif // INCLUDED_SC_SOURCE_UI_INC_SORTDLG_HXX
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 72f9f405c994..f97c52cef116 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -181,7 +181,7 @@ static bool lcl_GetSortParam( const ScViewData* pData, const ScSortParam& rSortP
         ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
         OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
 
-        ScopedVclPtr<AbstractScSortWarningDlg> pWarningDlg(pFact->CreateScSortWarningDlg( pTabViewShell->GetDialogParent(), aExtendStr, aCurrentStr ));
+        ScopedVclPtr<AbstractScSortWarningDlg> pWarningDlg(pFact->CreateScSortWarningDlg(pTabViewShell->GetFrameWeld(), aExtendStr, aCurrentStr));
         OSL_ENSURE(pWarningDlg, "Dialog create fail!");
         short bResult = pWarningDlg->Execute();
         if( bResult == BTN_EXTEND_RANGE || bResult == BTN_CURRENT_SELECTION )
diff --git a/sc/uiconfig/scalc/ui/sortwarning.ui b/sc/uiconfig/scalc/ui/sortwarning.ui
index b81bc9a34ed6..22aea2ab14a2 100644
--- a/sc/uiconfig/scalc/ui/sortwarning.ui
+++ b/sc/uiconfig/scalc/ui/sortwarning.ui
@@ -1,41 +1,36 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.0 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="sc">
   <requires lib="gtk+" version="3.18"/>
-  <object class="GtkWindow" id="SortWarning">
+  <object class="GtkDialog" id="SortWarning">
     <property name="can_focus">False</property>
-    <property name="valign">start</property>
+    <property name="border_width">6</property>
     <property name="title" translatable="yes" context="sortwarning|SortWarning">Sort Range</property>
-    <property name="default_height">200</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>
-      <object class="GtkAlignment" id="alignment1">
-        <property name="visible">True</property>
+      <placeholder/>
+    </child>
+    <child internal-child="vbox">
+      <object class="GtkBox">
         <property name="can_focus">False</property>
-        <property name="left_padding">6</property>
-        <property name="right_padding">6</property>
-        <child>
-          <object class="GtkBox" id="box1">
-            <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox">
             <property name="can_focus">False</property>
-            <property name="halign">start</property>
-            <property name="valign">start</property>
-            <property name="orientation">vertical</property>
+            <property name="layout_style">end</property>
             <child>
-              <object class="GtkLabel" id="sorttext">
+              <object class="GtkButton" id="extend">
+                <property name="label" translatable="yes" context="sortwarning|extend">_Extend selection</property>
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="halign">start</property>
-                <property name="valign">start</property>
-                <property name="margin_left">6</property>
-                <property name="margin_right">6</property>
-                <property name="margin_top">6</property>
-                <property name="margin_bottom">6</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes" context="sortwarning|sorttext">The cells next to the current selection also contain data. Do you want to extend the sort range to %1, or sort the currently selected range, %2?</property>
-                <property name="wrap">True</property>
-                <property name="wrap_mode">word-char</property>
-                <property name="max_width_chars">72</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>
@@ -44,78 +39,25 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButtonBox" id="buttonbox1">
+              <object class="GtkButton" id="current">
+                <property name="label" translatable="yes" context="sortwarning|current">Current selection</property>
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="halign">center</property>
-                <property name="spacing">12</property>
-                <property name="layout_style">start</property>
-                <child>
-                  <object class="GtkButton" id="extend">
-                    <property name="label" translatable="yes" context="sortwarning|extend">_Extend selection</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="current">
-                    <property name="label" translatable="yes" context="sortwarning|current">Current selection</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">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="cancel">
-                    <property name="label">gtk-cancel</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>
-                  </packing>
-                </child>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="padding">6</property>
                 <property name="position">1</property>
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="sorttip">
+              <object class="GtkButton" id="cancel">
+                <property name="label">gtk-cancel</property>
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="halign">start</property>
-                <property name="valign">start</property>
-                <property name="margin_left">6</property>
-                <property name="margin_right">6</property>
-                <property name="margin_top">6</property>
-                <property name="margin_bottom">6</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes" context="sortwarning|sorttip">Tip: The sort range can be detected automatically. Place the cell cursor inside a list and execute sort. The whole range of neighboring non-empty cells will then be sorted.</property>
-                <property name="wrap">True</property>
-                <property name="wrap_mode">word-char</property>
-                <property name="max_width_chars">72</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>
@@ -124,8 +66,56 @@
               </packing>
             </child>
           </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="sorttext">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">start</property>
+            <property name="valign">start</property>
+            <property name="margin_top">6</property>
+            <property name="margin_bottom">6</property>
+            <property name="label" translatable="yes" context="sortwarning|sorttext">The cells next to the current selection also contain data. Do you want to extend the sort range to %1, or sort the currently selected range, %2?</property>
+            <property name="wrap">True</property>
+            <property name="wrap_mode">word-char</property>
+            <property name="max_width_chars">72</property>
+            <property name="xalign">0</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="sorttip">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">start</property>
+            <property name="valign">start</property>
+            <property name="margin_top">6</property>
+            <property name="margin_bottom">6</property>
+            <property name="label" translatable="yes" context="sortwarning|sorttip">Tip: The sort range can be detected automatically. Place the cell cursor inside a list and execute sort. The whole range of neighboring non-empty cells will then be sorted.</property>
+            <property name="wrap">True</property>
+            <property name="wrap_mode">word-char</property>
+            <property name="max_width_chars">72</property>
+            <property name="xalign">0</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
         </child>
       </object>
     </child>
+    <action-widgets>
+      <action-widget response="-6">cancel</action-widget>
+    </action-widgets>
   </object>
 </interface>


More information about the Libreoffice-commits mailing list