sw/inc/swabstdlg.hxx                           |    4 +--
 sw/source/ui/dialog/swdlgfact.cxx              |   16 +++++++------
 sw/source/ui/dialog/swdlgfact.hxx              |   13 ++++++++---
 sw/source/ui/dochdl/selglos.cxx                |   29 +++++++------------------
 sw/source/uibase/dochdl/gloshdl.cxx            |   10 ++++----
 sw/source/uibase/inc/gloshdl.hxx               |    4 +--
 sw/source/uibase/inc/selglos.hxx               |   23 +++++++------------
 sw/source/uibase/shells/textglos.cxx           |    2 -
 sw/uiconfig/swriter/ui/insertautotextdialog.ui |   23 ++++++++++++++++---
 9 files changed, 66 insertions(+), 58 deletions(-)

New commits:
commit 692c4f4d2c5995660baf747f2d15929896f6e992
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sat Oct 6 17:57:35 2018 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sat Oct 6 20:55:30 2018 +0200

    weld SwSelGlossaryDlg
    
    Change-Id: I8d8b4a3b7ed461275eb4af86f3fd7709bab30586
    Reviewed-on: https://gerrit.libreoffice.org/61476
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index 6673fdef64ac..8478b77b990f 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -402,9 +402,9 @@ public:
 
     virtual VclPtr<VclAbstractDialog> CreateSwAutoMarkDialog(vcl::Window 
*pParent, SwWrtShell &rSh) = 0;
 
-    virtual VclPtr<AbstractSwSelGlossaryDlg> CreateSwSelGlossaryDlg(const 
OUString &rShortName) = 0;
+    virtual VclPtr<AbstractSwSelGlossaryDlg> 
CreateSwSelGlossaryDlg(weld::Window *pParent, const OUString &rShortName) = 0;
 
-    virtual VclPtr<VclAbstractDialog> CreateSwSortingDialog(weld::Window * 
pParent, SwWrtShell &rSh) = 0;
+    virtual VclPtr<VclAbstractDialog> CreateSwSortingDialog(weld::Window 
*pParent, SwWrtShell &rSh) = 0;
     virtual VclPtr<VclAbstractDialog> CreateSwTableHeightDialog(weld::Window 
*pParent, SwWrtShell &rSh) = 0;
     virtual VclPtr<VclAbstractDialog> CreateSwColumnDialog(weld::Window 
*pParent, SwWrtShell &rSh) = 0;
     virtual VclPtr<AbstractSplitTableDialog> 
CreateSplitTableDialog(weld::Window* pParent, SwWrtShell &rSh) = 0;
diff --git a/sw/source/ui/dialog/swdlgfact.cxx 
b/sw/source/ui/dialog/swdlgfact.cxx
index 4ad47f91a41b..e8eb7119af93 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -172,7 +172,10 @@ short AbstractSwLabDlg_Impl::Execute()
     return m_xDlg->execute();
 }
 
-IMPL_ABSTDLG_BASE(AbstractSwSelGlossaryDlg_Impl);
+short AbstractSwSelGlossaryDlg_Impl::Execute()
+{
+    return m_xDlg->run();
+}
 
 short AbstractSwAutoFormatDlg_Impl::Execute()
 {
@@ -415,17 +418,17 @@ Printer * AbstractSwLabDlg_Impl::GetPrt()
 
 void AbstractSwSelGlossaryDlg_Impl::InsertGlos(const OUString &rRegion, const 
OUString &rGlosName)
 {
-    pDlg->InsertGlos( rRegion, rGlosName );
+    m_xDlg->InsertGlos( rRegion, rGlosName );
 }
 
 sal_Int32 AbstractSwSelGlossaryDlg_Impl::GetSelectedIdx() const
 {
-    return pDlg->GetSelectedIdx();
+    return m_xDlg->GetSelectedIdx();
 }
 
 void AbstractSwSelGlossaryDlg_Impl::SelectEntryPos(sal_Int32 nIdx)
 {
-    pDlg->SelectEntryPos( nIdx );
+    m_xDlg->SelectEntryPos( nIdx );
 }
 
 SwTableAutoFormat* AbstractSwAutoFormatDlg_Impl::FillAutoFormatOfIndex() const
@@ -889,10 +892,9 @@ VclPtr<AbstractSplitTableDialog> 
SwAbstractDialogFactory_Impl::CreateSplitTableD
     return 
VclPtr<AbstractSplitTableDialog_Impl>::Create(o3tl::make_unique<SwSplitTableDlg>(pParent,
 rSh));
 }
 
-VclPtr<AbstractSwSelGlossaryDlg> 
SwAbstractDialogFactory_Impl::CreateSwSelGlossaryDlg(const OUString &rShortName)
+VclPtr<AbstractSwSelGlossaryDlg> 
SwAbstractDialogFactory_Impl::CreateSwSelGlossaryDlg(weld::Window *pParent, 
const OUString &rShortName)
 {
-    VclPtr<SwSelGlossaryDlg> pDlg = VclPtr<SwSelGlossaryDlg>::Create(nullptr, 
rShortName);
-    return VclPtr<AbstractSwSelGlossaryDlg_Impl>::Create(pDlg);
+    return 
VclPtr<AbstractSwSelGlossaryDlg_Impl>::Create(o3tl::make_unique<SwSelGlossaryDlg>(pParent,
 rShortName));
 }
 
 VclPtr<AbstractSwAutoFormatDlg> 
SwAbstractDialogFactory_Impl::CreateSwAutoFormatDlg(weld::Window* pParent,
diff --git a/sw/source/ui/dialog/swdlgfact.hxx 
b/sw/source/ui/dialog/swdlgfact.hxx
index 208d423fc3c7..6471d1864c4c 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -342,7 +342,14 @@ public:
 
 class AbstractSwSelGlossaryDlg_Impl : public AbstractSwSelGlossaryDlg
 {
-    DECL_ABSTDLG_BASE(AbstractSwSelGlossaryDlg_Impl,SwSelGlossaryDlg)
+protected:
+    std::unique_ptr<SwSelGlossaryDlg> m_xDlg;
+public:
+    explicit AbstractSwSelGlossaryDlg_Impl(std::unique_ptr<SwSelGlossaryDlg> p)
+        : m_xDlg(std::move(p))
+    {
+    }
+    virtual short Execute() override;
     virtual void InsertGlos(const OUString &rRegion, const OUString 
&rGlosName) override;    // inline
     virtual sal_Int32 GetSelectedIdx() const override;  // inline
     virtual void SelectEntryPos(sal_Int32 nIdx) override;   // inline
@@ -609,8 +616,8 @@ public:
                                                     const OString& sDefPage = 
OString()) override;
 
     virtual VclPtr<VclAbstractDialog> CreateSwAutoMarkDialog(vcl::Window 
*pParent, SwWrtShell &rSh) override;
-    virtual VclPtr<AbstractSwSelGlossaryDlg> CreateSwSelGlossaryDlg(const 
OUString &rShortName) override;
-    virtual VclPtr<VclAbstractDialog> CreateSwSortingDialog(weld::Window * 
pParent, SwWrtShell &rSh) override;
+    virtual VclPtr<AbstractSwSelGlossaryDlg> 
CreateSwSelGlossaryDlg(weld::Window *pParent, const OUString &rShortName) 
override;
+    virtual VclPtr<VclAbstractDialog> CreateSwSortingDialog(weld::Window 
*pParent, SwWrtShell &rSh) override;
     virtual VclPtr<VclAbstractDialog> CreateSwTableHeightDialog(weld::Window 
*pParent, SwWrtShell &rSh) override;
     virtual VclPtr<VclAbstractDialog> CreateSwColumnDialog(weld::Window 
*pParent, SwWrtShell &rSh) override;
     virtual VclPtr<AbstractSplitTableDialog> 
CreateSplitTableDialog(weld::Window* pParent, SwWrtShell &rSh) override;
diff --git a/sw/source/ui/dochdl/selglos.cxx b/sw/source/ui/dochdl/selglos.cxx
index 3646e18b7c3c..21f22690bbc2 100644
--- a/sw/source/ui/dochdl/selglos.cxx
+++ b/sw/source/ui/dochdl/selglos.cxx
@@ -18,36 +18,25 @@
  */
 
 #include <swtypes.hxx>
-
 #include <selglos.hxx>
 
-#include <vcl/layout.hxx>
-
-SwSelGlossaryDlg::SwSelGlossaryDlg(vcl::Window * pParent, const OUString 
&rShortName)
-    : ModalDialog(pParent, "InsertAutoTextDialog",
-        "modules/swriter/ui/insertautotextdialog.ui")
+SwSelGlossaryDlg::SwSelGlossaryDlg(weld::Window * pParent, const OUString 
&rShortName)
+    : GenericDialogController(pParent, 
"modules/swriter/ui/insertautotextdialog.ui", "InsertAutoTextDialog")
+    , m_xFrame(m_xBuilder->weld_frame("frame"))
+    , m_xGlosBox(m_xBuilder->weld_tree_view("treeview"))
 {
-    VclFrame *pFrame(get<VclFrame>("frame"));
-    pFrame->set_label(pFrame->get_label() + rShortName);
-    get(m_pGlosBox, "treeview");
-    m_pGlosBox->set_height_request(m_pGlosBox->GetTextHeight() * 10);
-    m_pGlosBox->SetDoubleClickHdl(LINK(this, SwSelGlossaryDlg, 
DoubleClickHdl));
+    m_xFrame->set_label(m_xFrame->get_label() + rShortName);
+    m_xGlosBox->set_size_request(-1, m_xGlosBox->get_height_rows(10));
+    m_xGlosBox->connect_row_activated(LINK(this, SwSelGlossaryDlg, 
DoubleClickHdl));
 }
 
 SwSelGlossaryDlg::~SwSelGlossaryDlg()
 {
-    disposeOnce();
-}
-
-void SwSelGlossaryDlg::dispose()
-{
-    m_pGlosBox.clear();
-    ModalDialog::dispose();
 }
 
-IMPL_LINK_NOARG(SwSelGlossaryDlg, DoubleClickHdl, ListBox&, void)
+IMPL_LINK_NOARG(SwSelGlossaryDlg, DoubleClickHdl, weld::TreeView&, void)
 {
-    EndDialog(RET_OK);
+    m_xDialog->response(RET_OK);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/dochdl/gloshdl.cxx 
b/sw/source/uibase/dochdl/gloshdl.cxx
index 8bf13f421310..115f3e8d959c 100644
--- a/sw/source/uibase/dochdl/gloshdl.cxx
+++ b/sw/source/uibase/dochdl/gloshdl.cxx
@@ -352,7 +352,7 @@ bool SwGlossaryHdl::DelGlossary(const OUString &rShortName)
 }
 
 // expand short name
-bool SwGlossaryHdl::ExpandGlossary()
+bool SwGlossaryHdl::ExpandGlossary(weld::Window* pParent)
 {
     OSL_ENSURE(pWrtShell->CanInsert(), "illegal");
     SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
@@ -383,12 +383,12 @@ bool SwGlossaryHdl::ExpandGlossary()
         if(pWrtShell->IsSelection())
             aShortName = pWrtShell->GetSelText();
     }
-    return pGlossary && Expand( aShortName, &rStatGlossaries, 
std::move(pGlossary) );
+    return pGlossary && Expand(pParent, aShortName, &rStatGlossaries, 
std::move(pGlossary));
 }
 
-bool SwGlossaryHdl::Expand( const OUString& rShortName,
+bool SwGlossaryHdl::Expand(weld::Window* pParent, const OUString& rShortName,
                             SwGlossaries *pGlossaries,
-                            std::unique_ptr<SwTextBlocks> pGlossary  )
+                            std::unique_ptr<SwTextBlocks> pGlossary)
 {
     std::vector<TextBlockInfo_Impl> aFoundArr;
     OUString aShortName( rShortName );
@@ -436,7 +436,7 @@ bool SwGlossaryHdl::Expand( const OUString& rShortName,
             else
             {
                 SwAbstractDialogFactory* pFact = 
SwAbstractDialogFactory::Create();
-                ScopedVclPtr<AbstractSwSelGlossaryDlg> 
pDlg(pFact->CreateSwSelGlossaryDlg(aShortName));
+                ScopedVclPtr<AbstractSwSelGlossaryDlg> 
pDlg(pFact->CreateSwSelGlossaryDlg(pParent, aShortName));
                 for(TextBlockInfo_Impl & i : aFoundArr)
                 {
                     pDlg->InsertGlos(i.sTitle, i.sLongName);
diff --git a/sw/source/uibase/inc/gloshdl.hxx b/sw/source/uibase/inc/gloshdl.hxx
index 34bd0f719c65..d065aa9302a5 100644
--- a/sw/source/uibase/inc/gloshdl.hxx
+++ b/sw/source/uibase/inc/gloshdl.hxx
@@ -39,7 +39,7 @@ class SW_DLLPUBLIC SwGlossaryHdl
     std::unique_ptr<SwTextBlocks>
                     pCurGrp;
 
-    SAL_DLLPRIVATE bool  Expand( const OUString& rShortName,
+    SAL_DLLPRIVATE bool  Expand(weld::Window* pParent, const OUString& 
rShortName,
                     SwGlossaries* pGlossaries,
                     std::unique_ptr<SwTextBlocks> pGlossary );
 
@@ -70,7 +70,7 @@ public:
     bool    DelGlossary(const OUString&);
     bool    CopyToClipboard(SwWrtShell& rSh, const OUString& rShortName);
 
-    bool    ExpandGlossary();
+    bool    ExpandGlossary(weld::Window* pParent);
     bool    InsertGlossary(const OUString &rName);
 
     void    SetMacros(const OUString& rName,
diff --git a/sw/source/uibase/inc/selglos.hxx b/sw/source/uibase/inc/selglos.hxx
index a8a0f00c7ff2..28a7821e3c96 100644
--- a/sw/source/uibase/inc/selglos.hxx
+++ b/sw/source/uibase/inc/selglos.hxx
@@ -19,35 +19,30 @@
 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_SELGLOS_HXX
 #define INCLUDED_SW_SOURCE_UIBASE_INC_SELGLOS_HXX
 
-#include <vcl/dialog.hxx>
+#include <vcl/weld.hxx>
 
-#include <vcl/lstbox.hxx>
-#include <vcl/fixed.hxx>
-
-#include <vcl/button.hxx>
-
-class SwSelGlossaryDlg final : public ModalDialog
+class SwSelGlossaryDlg final : public weld::GenericDialogController
 {
-    VclPtr<ListBox>  m_pGlosBox;
+    std::unique_ptr<weld::Frame> m_xFrame;
+    std::unique_ptr<weld::TreeView> m_xGlosBox;
 
-    DECL_LINK(DoubleClickHdl, ListBox&, void);
+    DECL_LINK(DoubleClickHdl, weld::TreeView&, void);
 public:
-    SwSelGlossaryDlg(vcl::Window * pParent, const OUString &rShortName);
+    SwSelGlossaryDlg(weld::Window * pParent, const OUString &rShortName);
     virtual ~SwSelGlossaryDlg() override;
-    virtual void dispose() override;
 
     void InsertGlos(const OUString &rRegion, const OUString &rGlosName)
     {
         const OUString aTmp = rRegion + ":" + rGlosName;
-        m_pGlosBox->InsertEntry(aTmp);
+        m_xGlosBox->append_text(aTmp);
     }
     sal_Int32 GetSelectedIdx() const
     {
-        return m_pGlosBox->GetSelectedEntryPos();
+        return m_xGlosBox->get_selected_index();
     }
     void SelectEntryPos(sal_Int32 nIdx)
     {
-        m_pGlosBox->SelectEntryPos(nIdx);
+        m_xGlosBox->select(nIdx);
     }
 };
 
diff --git a/sw/source/uibase/shells/textglos.cxx 
b/sw/source/uibase/shells/textglos.cxx
index af486517671b..b6aee47f7c55 100644
--- a/sw/source/uibase/shells/textglos.cxx
+++ b/sw/source/uibase/shells/textglos.cxx
@@ -54,7 +54,7 @@ void SwTextShell::ExecGlossary(SfxRequest &rReq)
         case FN_EXPAND_GLOSSARY:
         {
             bool bReturn;
-            bReturn = pGlosHdl->ExpandGlossary();
+            bReturn = pGlosHdl->ExpandGlossary(rReq.GetFrameWeld());
             rReq.SetReturnValue( SfxBoolItem( nSlot, bReturn ) );
             rReq.Done();
         }
diff --git a/sw/uiconfig/swriter/ui/insertautotextdialog.ui 
b/sw/uiconfig/swriter/ui/insertautotextdialog.ui
index b3df8b94a83d..78441586690e 100644
--- a/sw/uiconfig/swriter/ui/insertautotextdialog.ui
+++ b/sw/uiconfig/swriter/ui/insertautotextdialog.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="sw">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkDialog" id="InsertAutoTextDialog">
@@ -7,7 +7,13 @@
     <property name="border_width">6</property>
     <property name="title" translatable="yes" 
context="insertautotextdialog|InsertAutoTextDialog">Insert AutoText</property>
     <property name="resizable">False</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>
@@ -85,13 +91,22 @@
                 <property name="top_padding">6</property>
                 <property name="left_padding">12</property>
                 <child>
-                  <object class="GtkTreeView" id="treeview:border">
+                  <object class="GtkScrolledWindow">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="hexpand">True</property>
                     <property name="vexpand">True</property>
-                    <child internal-child="selection">
-                      <object class="GtkTreeSelection" 
id="treeview-selection1"/>
+                    <property name="shadow_type">in</property>
+                    <child>
+                      <object class="GtkTreeView" id="treeview">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="hexpand">True</property>
+                        <property name="vexpand">True</property>
+                        <child internal-child="selection">
+                          <object class="GtkTreeSelection" 
id="treeview-selection1"/>
+                        </child>
+                      </object>
                     </child>
                   </object>
                 </child>
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to