include/vcl/weld.hxx                       |    4 
 vcl/source/app/salvtables.cxx              |   30 ++
 vcl/uiconfig/ui/printerdevicepage.ui       |  128 ++++++----
 vcl/uiconfig/ui/printerpaperpage.ui        |    2 
 vcl/uiconfig/ui/printerpropertiesdialog.ui |   57 ++++
 vcl/unx/generic/print/genprnpsp.cxx        |    3 
 vcl/unx/generic/print/prtsetup.cxx         |  353 ++++++++++++-----------------
 vcl/unx/generic/print/prtsetup.hxx         |  115 ++++-----
 vcl/unx/gtk3/gtk3gtkinst.cxx               |   30 +-
 9 files changed, 404 insertions(+), 318 deletions(-)

New commits:
commit 0062b0b09b84fa275bbd921d0775eb1ae6d2ba64
Author: Caolán McNamara <caol...@redhat.com>
Date:   Mon Apr 9 08:55:27 2018 +0100

    weld RTSDialog and tab pages
    
    Change-Id: I9bec5f8afe65a9d3b75efd4f860beb47f16ece05
    Reviewed-on: https://gerrit.libreoffice.org/52629
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 1f036c563363..6bb4d6541c1f 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -214,6 +214,8 @@ public:
     void append_text(const OUString& rStr) { insert_text(-1, rStr); }
     virtual void insert(int pos, const OUString& rId, const OUString& rStr) = 
0;
     void append(const OUString& rId, const OUString& rStr) { insert(-1, rId, 
rStr); }
+    using Container::remove;
+    virtual void remove(int pos) = 0;
     virtual int find_text(const OUString& rStr) const = 0;
     virtual int find_id(const OUString& rId) const = 0;
     virtual int get_count() const = 0;
@@ -265,6 +267,7 @@ public:
     using Container::remove;
     virtual void remove(int pos) = 0;
     virtual int find(const OUString& rText) const = 0;
+    virtual int find_id(const OUString& rId) const = 0;
     virtual void set_top_entry(int pos) = 0;
     virtual void clear() = 0;
     virtual OUString get_selected() const = 0;
@@ -286,6 +289,7 @@ public:
     void connect_row_activated(const Link<TreeView&, void>& rLink) { 
m_aRowActivatedHdl = rLink; }
 
     void select(const OUString& rText) { select(find(rText)); }
+    void select_id(const OUString& rId) { select(find_id(rId)); }
 
     void remove(const OUString& rText) { remove(find(rText)); }
 };
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 6a31861bce43..597547b5c8e3 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -759,7 +759,7 @@ public:
 
 IMPL_LINK_NOARG(SalInstanceNotebook, DeactivatePageHdl, TabControl*, bool)
 {
-    return m_aLeavePageHdl.Call(get_current_page_ident());
+    return !m_aLeavePageHdl.IsSet() || 
m_aLeavePageHdl.Call(get_current_page_ident());
 }
 
 IMPL_LINK_NOARG(SalInstanceNotebook, ActivatePageHdl, TabControl*, void)
@@ -1067,6 +1067,20 @@ public:
         return nRet;
     }
 
+    virtual int find_id(const OUString& rId) const override
+    {
+        sal_Int32 nCount = m_xTreeView->GetEntryCount();
+        for (sal_Int32 nPos = 0; nPos < nCount; ++nPos)
+        {
+            OUString* pId = 
static_cast<OUString*>(m_xTreeView->GetEntryData(nPos));
+            if (!pId)
+                continue;
+            if (rId == *pId)
+                return nPos;
+        }
+        return -1;
+    }
+
     virtual void set_top_entry(int pos) override
     {
         m_xTreeView->SetTopEntry(pos);
@@ -1601,6 +1615,13 @@ public:
         return m_xComboBoxText->GetSelectedEntry();
     }
 
+    using SalInstanceContainer::remove;
+
+    virtual void remove(int pos) override
+    {
+        m_xComboBoxText->RemoveEntry(pos);
+    }
+
     virtual void set_entry_error(bool /*bError*/) override
     {
         assert(false);
@@ -1664,6 +1685,13 @@ public:
         return m_xComboBoxText->GetText();
     }
 
+    using SalInstanceContainer::remove;
+
+    virtual void remove(int pos) override
+    {
+        m_xComboBoxText->RemoveEntryAt(pos);
+    }
+
     virtual void set_entry_text(const OUString& rText) override
     {
         m_xComboBoxText->SetText(rText);
diff --git a/vcl/uiconfig/ui/printerdevicepage.ui 
b/vcl/uiconfig/ui/printerdevicepage.ui
index ba2987b66d29..1dc801f78ea9 100644
--- a/vcl/uiconfig/ui/printerdevicepage.ui
+++ b/vcl/uiconfig/ui/printerdevicepage.ui
@@ -1,40 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.20.4 -->
 <interface domain="vcl">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkListStore" id="liststore1">
     <columns>
-      <!-- column-name gchararray1 -->
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <object class="GtkListStore" id="liststore2">
+    <columns>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name id -->
       <column type="gchararray"/>
-      <!-- column-name gint1 -->
-      <column type="gint"/>
     </columns>
-    <data>
-      <row>
-        <col id="0" translatable="yes" 
context="printerdevicepage|liststore1">Automatic : %s</col>
-        <col id="1">0</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes" 
context="printerdevicepage|liststore1">PostScript (Level from driver)</col>
-        <col id="1">1</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes" 
context="printerdevicepage|liststore1">PostScript Level 1</col>
-        <col id="1">2</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes" 
context="printerdevicepage|liststore1">PostScript Level 2</col>
-        <col id="1">3</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes" 
context="printerdevicepage|liststore1">PostScript Level 3</col>
-        <col id="1">4</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes" 
context="printerdevicepage|liststore1">PDF</col>
-        <col id="1">10</col>
-      </row>
-    </data>
   </object>
   <object class="GtkGrid" id="PrinterDevicePage">
     <property name="visible">True</property>
@@ -49,10 +31,10 @@
       <object class="GtkLabel" id="label7">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="xalign">0</property>
         <property name="label" translatable="yes" 
context="printerdevicepage|label7">_Option:</property>
         <property name="use_underline">True</property>
-        <property name="mnemonic_widget">options:border</property>
+        <property name="mnemonic_widget">options</property>
+        <property name="xalign">0</property>
       </object>
       <packing>
         <property name="left_attach">0</property>
@@ -63,10 +45,10 @@
       <object class="GtkLabel" id="label8">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="xalign">0</property>
         <property name="label" translatable="yes" 
context="printerdevicepage|label8">Current _value:</property>
         <property name="use_underline">True</property>
-        <property name="mnemonic_widget">values:border</property>
+        <property name="mnemonic_widget">values</property>
+        <property name="xalign">0</property>
       </object>
       <packing>
         <property name="left_attach">1</property>
@@ -74,13 +56,37 @@
       </packing>
     </child>
     <child>
-      <object class="GtkTreeView" id="options: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="options">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <property name="model">liststore1</property>
+            <property name="headers_visible">False</property>
+            <property name="headers_clickable">False</property>
+            <property name="search_column">0</property>
+            <property name="show_expanders">False</property>
+            <child internal-child="selection">
+              <object class="GtkTreeSelection" id="treeview-selection1"/>
+            </child>
+            <child>
+              <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+                <child>
+                  <object class="GtkCellRendererText" id="cellrenderertext1"/>
+                  <attributes>
+                    <attribute name="text">0</attribute>
+                  </attributes>
+                </child>
+              </object>
+            </child>
+          </object>
         </child>
       </object>
       <packing>
@@ -99,6 +105,7 @@
           <object class="GtkEntry" id="custom">
             <property name="can_focus">True</property>
             <property name="no_show_all">True</property>
+            <property name="activates_default">True</property>
           </object>
           <packing>
             <property name="left_attach">0</property>
@@ -106,13 +113,37 @@
           </packing>
         </child>
         <child>
-          <object class="GtkTreeView" id="values: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-selection"/>
+            <property name="shadow_type">in</property>
+            <child>
+              <object class="GtkTreeView" id="values">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="model">liststore2</property>
+                <property name="headers_visible">False</property>
+                <property name="headers_clickable">False</property>
+                <property name="search_column">0</property>
+                <property name="show_expanders">False</property>
+                <child internal-child="selection">
+                  <object class="GtkTreeSelection" id="treeview-selection2"/>
+                </child>
+                <child>
+                  <object class="GtkTreeViewColumn" id="treeviewcolumn2">
+                    <child>
+                      <object class="GtkCellRendererText" 
id="cellrenderertext2"/>
+                      <attributes>
+                        <attribute name="text">0</attribute>
+                      </attributes>
+                    </child>
+                  </object>
+                </child>
+              </object>
             </child>
           </object>
           <packing>
@@ -136,10 +167,10 @@
           <object class="GtkLabel" id="label11">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">1</property>
             <property name="label" translatable="yes" 
context="printerdevicepage|label11">Color _depth:</property>
             <property name="use_underline">True</property>
             <property name="mnemonic_widget">colordepth</property>
+            <property name="xalign">1</property>
           </object>
           <packing>
             <property name="left_attach">0</property>
@@ -150,10 +181,10 @@
           <object class="GtkLabel" id="label10">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">1</property>
             <property name="label" translatable="yes" 
context="printerdevicepage|label10">Co_lor:</property>
             <property name="use_underline">True</property>
             <property name="mnemonic_widget">colorspace</property>
+            <property name="xalign">1</property>
           </object>
           <packing>
             <property name="left_attach">0</property>
@@ -164,10 +195,10 @@
           <object class="GtkLabel" id="label9">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">1</property>
             <property name="label" translatable="yes" 
context="printerdevicepage|label9">Printer language _type:</property>
             <property name="use_underline">True</property>
             <property name="mnemonic_widget">level</property>
+            <property name="xalign">1</property>
           </object>
           <packing>
             <property name="left_attach">0</property>
@@ -175,11 +206,18 @@
           </packing>
         </child>
         <child>
-          <object class="GtkComboBox" id="level">
+          <object class="GtkComboBoxText" id="level">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="hexpand">True</property>
-            <property name="model">liststore1</property>
+            <items>
+              <item id="0" translatable="yes" 
context="printerdevicepage|liststore1">Automatic : %s</item>
+              <item id="1" translatable="yes" 
context="printerdevicepage|liststore1">PostScript (Level from driver)</item>
+              <item id="2" translatable="yes" 
context="printerdevicepage|liststore1">PostScript Level 1</item>
+              <item id="3" translatable="yes" 
context="printerdevicepage|liststore1">PostScript Level 2</item>
+              <item id="4" translatable="yes" 
context="printerdevicepage|liststore1">PostScript Level 3</item>
+              <item id="10" translatable="yes" 
context="printerdevicepage|liststore1">PDF</item>
+            </items>
           </object>
           <packing>
             <property name="left_attach">1</property>
diff --git a/vcl/uiconfig/ui/printerpaperpage.ui 
b/vcl/uiconfig/ui/printerpaperpage.ui
index 067762d27a74..6ba644163819 100644
--- a/vcl/uiconfig/ui/printerpaperpage.ui
+++ b/vcl/uiconfig/ui/printerpaperpage.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.20.4 -->
 <interface domain="vcl">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkGrid" id="PrinterPaperPage">
diff --git a/vcl/uiconfig/ui/printerpropertiesdialog.ui 
b/vcl/uiconfig/ui/printerpropertiesdialog.ui
index 5df6b116a5fc..bb6e09864435 100644
--- a/vcl/uiconfig/ui/printerpropertiesdialog.ui
+++ b/vcl/uiconfig/ui/printerpropertiesdialog.ui
@@ -1,12 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.20.4 -->
 <interface domain="vcl">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkDialog" id="PrinterPropertiesDialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" 
context="printerpropertiesdialog|PrinterPropertiesDialog">Properties of 
%s</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 internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
@@ -68,6 +70,30 @@
                 <child>
                   <placeholder/>
                 </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
               </object>
             </child>
             <child type="tab">
@@ -88,6 +114,30 @@
                 <child>
                   <placeholder/>
                 </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
               </object>
               <packing>
                 <property name="position">1</property>
@@ -117,5 +167,8 @@
       <action-widget response="-5">ok</action-widget>
       <action-widget response="-6">cancel</action-widget>
     </action-widgets>
+    <child>
+      <placeholder/>
+    </child>
   </object>
 </interface>
diff --git a/vcl/unx/generic/print/genprnpsp.cxx 
b/vcl/unx/generic/print/genprnpsp.cxx
index f8951f4ea160..53f9576b6eac 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -56,6 +56,7 @@
 #include <jobset.h>
 #include <print.h>
 #include "prtsetup.hxx"
+#include <salframe.hxx>
 #include <salptype.hxx>
 
 #include <com/sun/star/beans/PropertyValue.hpp>
@@ -550,7 +551,7 @@ bool PspSalInfoPrinter::Setup( SalFrame* pFrame, 
ImplJobSetup* pJobSetup )
     aInfo.m_bPapersizeFromSetup = pJobSetup->GetPapersizeFromSetup();
     aInfo.meSetupMode = pJobSetup->GetPrinterSetupMode();
 
-    if (SetupPrinterDriver(aInfo))
+    if (SetupPrinterDriver(pFrame->GetFrameWeld(), aInfo))
     {
         aInfo.resolveDefaultBackend();
         rtl_freeMemory( const_cast<sal_uInt8*>(pJobSetup->GetDriverData()) );
diff --git a/vcl/unx/generic/print/prtsetup.cxx 
b/vcl/unx/generic/print/prtsetup.cxx
index 3e75b9907e1e..9fbbdd0617d4 100644
--- a/vcl/unx/generic/print/prtsetup.cxx
+++ b/vcl/unx/generic/print/prtsetup.cxx
@@ -27,185 +27,146 @@
 
 using namespace psp;
 
-void RTSDialog::insertAllPPDValues( ListBox& rBox, const PPDParser* pParser, 
const PPDKey* pKey )
+void RTSDialog::insertAllPPDValues(weld::ComboBoxText& rBox, const PPDParser* 
pParser, const PPDKey* pKey )
 {
     if( ! pKey || ! pParser )
         return;
 
     const PPDValue* pValue = nullptr;
-    sal_Int32 nPos = 0;
     OUString aOptionText;
 
-    for( int i = 0; i < pKey->countValues(); i++ )
+    for (int i = 0; i < pKey->countValues(); ++i)
     {
         pValue = pKey->getValue( i );
         if (pValue->m_bCustomOption)
             continue;
         aOptionText = pParser->translateOption( pKey->getKey(), 
pValue->m_aOption) ;
 
+        OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pValue)));
+        int nCurrentPos = rBox.find_id(sId);
         if( m_aJobData.m_aContext.checkConstraints( pKey, pValue ) )
         {
-            if( rBox.GetEntryPos( static_cast<void const *>(pValue) ) == 
LISTBOX_ENTRY_NOTFOUND )
-            {
-                nPos = rBox.InsertEntry( aOptionText );
-                    rBox.SetEntryData( nPos, const_cast<PPDValue *>(pValue) );
-            }
+            if (nCurrentPos == -1)
+                rBox.insert(-1, sId, aOptionText);
         }
         else
         {
-            if( ( nPos = rBox.GetEntryPos( static_cast<void const *>(pValue) ) 
) != LISTBOX_ENTRY_NOTFOUND )
-                rBox.RemoveEntry( nPos );
+            if (nCurrentPos != -1)
+                rBox.remove(nCurrentPos);
         }
     }
     pValue = m_aJobData.m_aContext.getValue( pKey );
     if (pValue && !pValue->m_bCustomOption)
     {
-        if( ( nPos = rBox.GetEntryPos( static_cast<void const *>(pValue) ) ) 
!= LISTBOX_ENTRY_NOTFOUND )
-            rBox.SelectEntryPos( nPos );
+        OUString sId(OUString::number(reinterpret_cast<sal_IntPtr>(pValue)));
+        int nPos = rBox.find_id(sId);
+        if (nPos != -1)
+            rBox.set_active(nPos);
     }
     else
-        rBox.SelectEntry( m_aInvalidString );
+        rBox.set_active(m_aInvalidString);
 }
 
 /*
  * RTSDialog
  */
 
-RTSDialog::RTSDialog(const PrinterInfo& rJobData, vcl::Window* pParent)
-    : TabDialog(pParent, "PrinterPropertiesDialog", 
"vcl/ui/printerpropertiesdialog.ui")
+RTSDialog::RTSDialog(const PrinterInfo& rJobData, weld::Window* pParent)
+    : GenericDialogController(pParent, "vcl/ui/printerpropertiesdialog.ui", 
"PrinterPropertiesDialog")
     , m_aJobData(rJobData)
-    , m_pPaperPage(nullptr)
-    , m_pDevicePage(nullptr)
     , m_aInvalidString(VclResId(SV_PRINT_INVALID_TXT))
-    , mbDataModified(false)
+    , m_bDataModified(false)
+    , m_xTabControl(m_xBuilder->weld_notebook("notebook"))
+    , m_xOKButton(m_xBuilder->weld_button("ok"))
+    , m_xCancelButton(m_xBuilder->weld_button("cancel"))
+    , m_xPaperPage(new RTSPaperPage(m_xTabControl->get_page("paper"), this))
+    , m_xDevicePage(new RTSDevicePage(m_xTabControl->get_page("device"), this))
 {
-    get(m_pOKButton, "ok");
-    get(m_pCancelButton, "cancel");
-    get(m_pTabControl, "notebook");
-
-    m_pPaperPage = VclPtr<RTSPaperPage>::Create( this );
-    m_pDevicePage = VclPtr<RTSDevicePage>::Create( this );
-    m_pTabControl->SetTabPage(m_pTabControl->GetPageId("paper"), m_pPaperPage);
-    m_pTabControl->SetTabPage(m_pTabControl->GetPageId("device"), 
m_pDevicePage);
-
-    OUString aTitle(GetText());
-    SetText(aTitle.replaceAll("%s", m_aJobData.m_aPrinterName));
-
-    m_pTabControl->SetActivatePageHdl( LINK( this, RTSDialog, ActivatePage ) );
-    m_pOKButton->SetClickHdl( LINK( this, RTSDialog, ClickButton ) );
-    m_pCancelButton->SetClickHdl( LINK( this, RTSDialog, ClickButton ) );
-    ActivatePage(m_pTabControl);
-}
+    OUString aTitle(m_xDialog->get_title());
+    m_xDialog->set_title(aTitle.replaceAll("%s", m_aJobData.m_aPrinterName));
 
-RTSDialog::~RTSDialog()
-{
-    disposeOnce();
+    m_xTabControl->connect_enter_page( LINK( this, RTSDialog, ActivatePage ) );
+    m_xOKButton->connect_clicked( LINK( this, RTSDialog, ClickButton ) );
+    m_xCancelButton->connect_clicked( LINK( this, RTSDialog, ClickButton ) );
+    ActivatePage(m_xTabControl->get_current_page_ident());
 }
 
-void RTSDialog::dispose()
+RTSDialog::~RTSDialog()
 {
-    m_pTabControl.clear();
-    m_pOKButton.clear();
-    m_pCancelButton.clear();
-    m_pPaperPage.disposeAndClear();
-    m_pDevicePage.disposeAndClear();
-    TabDialog::dispose();
 }
 
-IMPL_LINK_NOARG(RTSDialog, ActivatePage, TabControl*, void)
+IMPL_LINK(RTSDialog, ActivatePage, const OString&, rPage, void)
 {
-    sal_uInt16 nId = m_pTabControl->GetCurPageId();
-    OString sPage = m_pTabControl->GetPageName(nId);
-    if (sPage == "paper")
-        m_pPaperPage->update();
+    if (rPage == "paper")
+        m_xPaperPage->update();
 }
 
-IMPL_LINK( RTSDialog, ClickButton, Button*, pButton, void )
+IMPL_LINK( RTSDialog, ClickButton, weld::Button&, rButton, void )
 {
-    if( pButton == m_pOKButton )
+    if (&rButton == m_xOKButton.get())
     {
         // refresh the changed values
-        if( m_pPaperPage )
+        if (m_xPaperPage)
         {
             // orientation
-            m_aJobData.m_eOrientation = m_pPaperPage->getOrientation() == 0 ?
+            m_aJobData.m_eOrientation = m_xPaperPage->getOrientation() == 0 ?
                 orientation::Portrait : orientation::Landscape;
             // assume use of paper size from printer setup if the user
             // got here via File > Printer Settings ...
             if ( m_aJobData.meSetupMode == PrinterSetupMode::DocumentGlobal )
                m_aJobData.m_bPapersizeFromSetup = true;
         }
-        if( m_pDevicePage )
+        if( m_xDevicePage )
         {
-            m_aJobData.m_nColorDepth    = m_pDevicePage->getDepth();
-            m_aJobData.m_nColorDevice   = m_pDevicePage->getColorDevice();
-            m_aJobData.m_nPSLevel       = m_pDevicePage->getLevel();
-            m_aJobData.m_nPDFDevice     = m_pDevicePage->getPDFDevice();
+            m_aJobData.m_nColorDepth    = m_xDevicePage->getDepth();
+            m_aJobData.m_nColorDevice   = m_xDevicePage->getColorDevice();
+            m_aJobData.m_nPSLevel       = m_xDevicePage->getLevel();
+            m_aJobData.m_nPDFDevice     = m_xDevicePage->getPDFDevice();
         }
-        EndDialog( 1 );
+        m_xDialog->response(RET_OK);
     }
-    else if( pButton == m_pCancelButton )
-        EndDialog();
+    else if (&rButton == m_xCancelButton.get())
+        m_xDialog->response(RET_CANCEL);
 }
 
 /*
  * RTSPaperPage
  */
 
-RTSPaperPage::RTSPaperPage(RTSDialog* pParent)
-    : TabPage(pParent->m_pTabControl, "PrinterPaperPage", 
"vcl/ui/printerpaperpage.ui")
-    , m_pParent( pParent )
+RTSPaperPage::RTSPaperPage(weld::Widget* pPage, RTSDialog* pDialog)
+    : m_xBuilder(Application::CreateBuilder(pPage, 
"vcl/ui/printerpaperpage.ui"))
+    , m_pParent(pDialog)
+    , m_xContainer(m_xBuilder->weld_widget("PrinterPaperPage"))
+    , m_xCbFromSetup(m_xBuilder->weld_check_button("papersizefromsetup"))
+    , m_xPaperText(m_xBuilder->weld_label("paperft"))
+    , m_xPaperBox(m_xBuilder->weld_combo_box_text("paperlb"))
+    , m_xOrientText(m_xBuilder->weld_label("orientft"))
+    , m_xOrientBox(m_xBuilder->weld_combo_box_text("orientlb"))
+    , m_xDuplexText(m_xBuilder->weld_label("duplexft"))
+    , m_xDuplexBox(m_xBuilder->weld_combo_box_text("duplexlb"))
+    , m_xSlotText(m_xBuilder->weld_label("slotft"))
+    , m_xSlotBox(m_xBuilder->weld_combo_box_text("slotlb"))
 {
-    get(m_pCbFromSetup, "papersizefromsetup");
-    get(m_pPaperText, "paperft");
-    get(m_pPaperBox, "paperlb");
-    get(m_pOrientText, "orientft");
-    get(m_pOrientBox, "orientlb");
-    get(m_pDuplexText, "duplexft");
-    get(m_pDuplexBox, "duplexlb");
-    get(m_pSlotText, "slotft");
-    get(m_pSlotBox, "slotlb");
-
-    m_pPaperBox->SetSelectHdl( LINK( this, RTSPaperPage, SelectHdl ) );
-    m_pOrientBox->SetSelectHdl( LINK( this, RTSPaperPage, SelectHdl ) );
-    m_pDuplexBox->SetSelectHdl( LINK( this, RTSPaperPage, SelectHdl ) );
-    m_pSlotBox->SetSelectHdl( LINK( this, RTSPaperPage, SelectHdl ) );
-    m_pCbFromSetup->SetToggleHdl( LINK( this, RTSPaperPage, CheckBoxHdl ) );
-
-
-    sal_Int32 nPos = 0;
+    //PrinterPaperPage
+    m_xPaperBox->connect_changed( LINK( this, RTSPaperPage, SelectHdl ) );
+    m_xOrientBox->connect_changed( LINK( this, RTSPaperPage, SelectHdl ) );
+    m_xDuplexBox->connect_changed( LINK( this, RTSPaperPage, SelectHdl ) );
+    m_xSlotBox->connect_changed( LINK( this, RTSPaperPage, SelectHdl ) );
+    m_xCbFromSetup->connect_toggled( LINK( this, RTSPaperPage, CheckBoxHdl ) );
 
     // duplex
-    nPos = m_pDuplexBox->InsertEntry( m_pParent->m_aInvalidString );
-    m_pDuplexBox->SetEntryData( nPos, nullptr );
+    m_xDuplexBox->append_text(m_pParent->m_aInvalidString);
 
     // paper does not have an invalid entry
 
     // input slots
-    nPos = m_pSlotBox->InsertEntry( m_pParent->m_aInvalidString );
-    m_pSlotBox->SetEntryData( nPos, nullptr );
+    m_xSlotBox->append_text(m_pParent->m_aInvalidString);
 
     update();
 }
 
 RTSPaperPage::~RTSPaperPage()
 {
-    disposeOnce();
-}
-
-void RTSPaperPage::dispose()
-{
-    m_pParent.clear();
-    m_pCbFromSetup.clear();
-    m_pPaperText.clear();
-    m_pPaperBox.clear();
-    m_pOrientText.clear();
-    m_pOrientBox.clear();
-    m_pDuplexText.clear();
-    m_pDuplexBox.clear();
-    m_pSlotText.clear();
-    m_pSlotBox.clear();
-    TabPage::dispose();
 }
 
 void RTSPaperPage::update()
@@ -213,88 +174,87 @@ void RTSPaperPage::update()
     const PPDKey* pKey      = nullptr;
 
     // orientation
-    m_pOrientBox->SelectEntryPos(
-        m_pParent->m_aJobData.m_eOrientation == orientation::Portrait ? 0 : 1);
+    m_xOrientBox->set_active(m_pParent->m_aJobData.m_eOrientation == 
orientation::Portrait ? 0 : 1);
 
     // duplex
     if( m_pParent->m_aJobData.m_pParser &&
         (pKey = m_pParent->m_aJobData.m_pParser->getKey( OUString( "Duplex" ) 
)) )
     {
-        m_pParent->insertAllPPDValues( *m_pDuplexBox, 
m_pParent->m_aJobData.m_pParser, pKey );
+        m_pParent->insertAllPPDValues( *m_xDuplexBox, 
m_pParent->m_aJobData.m_pParser, pKey );
     }
     else
     {
-        m_pDuplexText->Enable( false );
-        m_pDuplexBox->Enable( false );
+        m_xDuplexText->set_sensitive( false );
+        m_xDuplexBox->set_sensitive( false );
     }
 
     // paper
     if( m_pParent->m_aJobData.m_pParser &&
         (pKey = m_pParent->m_aJobData.m_pParser->getKey( OUString( "PageSize" 
) )) )
     {
-        m_pParent->insertAllPPDValues( *m_pPaperBox, 
m_pParent->m_aJobData.m_pParser, pKey );
+        m_pParent->insertAllPPDValues( *m_xPaperBox, 
m_pParent->m_aJobData.m_pParser, pKey );
     }
     else
     {
-        m_pPaperText->Enable( false );
-        m_pPaperBox->Enable( false );
+        m_xPaperText->set_sensitive( false );
+        m_xPaperBox->set_sensitive( false );
     }
 
     // input slots
     if( m_pParent->m_aJobData.m_pParser &&
         (pKey = m_pParent->m_aJobData.m_pParser->getKey( OUString("InputSlot") 
)) )
     {
-        m_pParent->insertAllPPDValues( *m_pSlotBox, 
m_pParent->m_aJobData.m_pParser, pKey );
+        m_pParent->insertAllPPDValues( *m_xSlotBox, 
m_pParent->m_aJobData.m_pParser, pKey );
     }
     else
     {
-        m_pSlotText->Enable( false );
-        m_pSlotBox->Enable( false );
+        m_xSlotText->set_sensitive( false );
+        m_xSlotBox->set_sensitive( false );
     }
 
     if ( m_pParent->m_aJobData.meSetupMode == PrinterSetupMode::SingleJob )
     {
-        m_pCbFromSetup->Show();
+        m_xCbFromSetup->show();
 
         if ( m_pParent->m_aJobData.m_bPapersizeFromSetup )
-            m_pCbFromSetup->Check( m_pParent->m_aJobData.m_bPapersizeFromSetup 
);
+            
m_xCbFromSetup->set_active(m_pParent->m_aJobData.m_bPapersizeFromSetup);
         // disable those, unless user wants to use papersize from printer prefs
         // as they have no influence on what's going to be printed anyway
         else
         {
-            m_pPaperText->Enable( false );
-            m_pPaperBox->Enable( false );
-            m_pOrientText->Enable( false );
-            m_pOrientBox->Enable( false );
+            m_xPaperText->set_sensitive( false );
+            m_xPaperBox->set_sensitive( false );
+            m_xOrientText->set_sensitive( false );
+            m_xOrientBox->set_sensitive( false );
         }
     }
 }
 
-IMPL_LINK( RTSPaperPage, SelectHdl, ListBox&, rBox, void )
+IMPL_LINK( RTSPaperPage, SelectHdl, weld::ComboBoxText&, rBox, void )
 {
     const PPDKey* pKey = nullptr;
-    if( &rBox == m_pPaperBox )
+    if( &rBox == m_xPaperBox.get() )
     {
         if( m_pParent->m_aJobData.m_pParser )
             pKey = m_pParent->m_aJobData.m_pParser->getKey( OUString( 
"PageSize" ) );
     }
-    else if( &rBox == m_pDuplexBox )
+    else if( &rBox == m_xDuplexBox.get() )
     {
         if( m_pParent->m_aJobData.m_pParser )
             pKey = m_pParent->m_aJobData.m_pParser->getKey( OUString( "Duplex" 
) );
     }
-    else if( &rBox == m_pSlotBox )
+    else if( &rBox == m_xSlotBox.get() )
     {
         if( m_pParent->m_aJobData.m_pParser )
             pKey = m_pParent->m_aJobData.m_pParser->getKey( OUString( 
"InputSlot" ) );
     }
-    else if( &rBox == m_pOrientBox )
+    else if( &rBox == m_xOrientBox.get() )
     {
-        m_pParent->m_aJobData.m_eOrientation = 
m_pOrientBox->GetSelectedEntryPos() == 0 ? orientation::Portrait : 
orientation::Landscape;
+        m_pParent->m_aJobData.m_eOrientation = m_xOrientBox->get_active() == 0 
? orientation::Portrait : orientation::Landscape;
     }
     if( pKey )
     {
-        PPDValue* pValue = static_cast<PPDValue*>(rBox.GetSelectedEntryData());
+        PPDValue* pValue = 
reinterpret_cast<PPDValue*>(rBox.get_active_id().toInt64());
         m_pParent->m_aJobData.m_aContext.setValue( pKey, pValue );
         update();
     }
@@ -302,49 +262,54 @@ IMPL_LINK( RTSPaperPage, SelectHdl, ListBox&, rBox, void )
     m_pParent->SetDataModified( true );
 }
 
-IMPL_LINK( RTSPaperPage, CheckBoxHdl, CheckBox&, /*cBox*/, void )
+IMPL_LINK( RTSPaperPage, CheckBoxHdl, weld::ToggleButton&, /*cBox*/, void )
 {
-    bool bFromSetup = m_pCbFromSetup->IsChecked();
+    bool bFromSetup = m_xCbFromSetup->get_active();
     m_pParent->m_aJobData.m_bPapersizeFromSetup = bFromSetup;
-    m_pPaperText->Enable( bFromSetup );
-    m_pPaperBox->Enable( bFromSetup );
-    m_pOrientText->Enable( bFromSetup );
-    m_pOrientBox->Enable( bFromSetup );
-    m_pParent->SetDataModified( true );
+    m_xPaperText->set_sensitive(bFromSetup);
+    m_xPaperBox->set_sensitive(bFromSetup);
+    m_xOrientText->set_sensitive(bFromSetup);
+    m_xOrientBox->set_sensitive(bFromSetup);
+    m_pParent->SetDataModified(true);
 }
 /*
  * RTSDevicePage
  */
 
-RTSDevicePage::RTSDevicePage( RTSDialog* pParent )
-    : TabPage(pParent->m_pTabControl, "PrinterDevicePage", 
"vcl/ui/printerdevicepage.ui")
-    , m_pParent(pParent)
+RTSDevicePage::RTSDevicePage(weld::Widget* pPage, RTSDialog* pParent)
+    : m_xBuilder(Application::CreateBuilder(pPage, 
"vcl/ui/printerdevicepage.ui"))
     , m_pCustomValue(nullptr)
+    , m_pParent(pParent)
+    , m_xContainer(m_xBuilder->weld_widget("PrinterDevicePage"))
+    , m_xPPDKeyBox(m_xBuilder->weld_tree_view("options"))
+    , m_xPPDValueBox(m_xBuilder->weld_tree_view("values"))
+    , m_xCustomEdit(m_xBuilder->weld_entry("custom"))
+    , m_xLevelBox(m_xBuilder->weld_combo_box_text("level"))
+    , m_xSpaceBox(m_xBuilder->weld_combo_box_text("colorspace"))
+    , m_xDepthBox(m_xBuilder->weld_combo_box_text("colordepth"))
 {
-    get(m_pPPDKeyBox, "options");
-    get(m_pPPDValueBox, "values");
-
-    m_pPPDKeyBox->SetDropDownLineCount(12);
-    m_pPPDValueBox->SetDropDownLineCount(12);
+    m_xPPDKeyBox->set_size_request(m_xPPDKeyBox->get_approximate_digit_width() 
* 32,
+                                   m_xPPDKeyBox->get_height_rows(12));
 
-    get(m_pCustomEdit, "custom");
-    m_pCustomEdit->SetModifyHdl(LINK(this, RTSDevicePage, ModifyHdl));
+    m_xCustomEdit->connect_changed(LINK(this, RTSDevicePage, ModifyHdl));
 
-    get(m_pLevelBox, "level");
-    get(m_pSpaceBox, "colorspace");
-    get(m_pDepthBox, "colordepth");
-
-    m_pPPDKeyBox->SetSelectHdl( LINK( this, RTSDevicePage, SelectHdl ) );
-    m_pPPDValueBox->SetSelectHdl( LINK( this, RTSDevicePage, SelectHdl ) );
+    m_xPPDKeyBox->connect_changed( LINK( this, RTSDevicePage, SelectHdl ) );
+    m_xPPDValueBox->connect_changed( LINK( this, RTSDevicePage, SelectHdl ) );
 
     switch( m_pParent->m_aJobData.m_nColorDevice )
     {
-        case  0: m_pSpaceBox->SelectEntryPos(0);break;
-        case  1: m_pSpaceBox->SelectEntryPos(1);break;
-        case -1: m_pSpaceBox->SelectEntryPos(2);break;
+        case 0:
+            m_xSpaceBox->set_active(0);
+            break;
+        case 1:
+            m_xSpaceBox->set_active(1);
+            break;
+        case -1:
+            m_xSpaceBox->set_active(2);
+            break;
     }
 
-    sal_uLong nLevelEntryData = 0; //automatic
+    sal_Int32 nLevelEntryData = 0; //automatic
     if( m_pParent->m_aJobData.m_nPDFDevice == 2 ) //explicit PDF
         nLevelEntryData = 10;
     else if (m_pParent->m_aJobData.m_nPSLevel > 0) //explicit PS Level
@@ -360,24 +325,23 @@ RTSDevicePage::RTSDevicePage( RTSDialog* pParent )
             || "Generic Printer" == m_pParent->m_aJobData.m_aPrinterName
             || int(bAutoIsPDF) == m_pParent->m_aJobData.m_nPDFDevice);
 
-    OUString sStr = m_pLevelBox->GetEntry(0);
-    m_pLevelBox->InsertEntry(sStr.replaceAll("%s", bAutoIsPDF ? 
m_pLevelBox->GetEntry(5) : m_pLevelBox->GetEntry(1)), 0);
-    m_pLevelBox->SetEntryData(0, m_pLevelBox->GetEntryData(1));
-    m_pLevelBox->RemoveEntry(1);
+    OUString sStr = m_xLevelBox->get_text(0);
+    m_xLevelBox->insert(0, m_xLevelBox->get_id(0), sStr.replaceAll("%s", 
bAutoIsPDF ? m_xLevelBox->get_text(5) : m_xLevelBox->get_text(1)));
+    m_xLevelBox->remove(1);
 
-    for( sal_Int32 i = 0; i < m_pLevelBox->GetEntryCount(); i++ )
+    for (int i = 0; i < m_xLevelBox->get_count(); ++i)
     {
-        if( reinterpret_cast<sal_uLong>(m_pLevelBox->GetEntryData( i )) == 
nLevelEntryData )
+        if (m_xLevelBox->get_id(i).toInt32() == nLevelEntryData)
         {
-            m_pLevelBox->SelectEntryPos( i );
+            m_xLevelBox->set_active(i);
             break;
         }
     }
 
     if (m_pParent->m_aJobData.m_nColorDepth == 8)
-        m_pDepthBox->SelectEntryPos(0);
+        m_xDepthBox->set_active(0);
     else if (m_pParent->m_aJobData.m_nColorDepth == 24)
-        m_pDepthBox->SelectEntryPos(1);
+        m_xDepthBox->set_active(1);
 
     // fill ppd boxes
     if( m_pParent->m_aJobData.m_pParser )
@@ -400,8 +364,7 @@ RTSDevicePage::RTSDevicePage( RTSDialog* pParent )
                 pKey->getGroup() != "InstallableOptions")
             {
                 OUString aEntry( 
m_pParent->m_aJobData.m_pParser->translateKey( pKey->getKey() ) );
-                sal_uInt16 nPos = m_pPPDKeyBox->InsertEntry( aEntry );
-                m_pPPDKeyBox->SetEntryData( nPos, const_cast<PPDKey *>(pKey) );
+                
m_xPPDKeyBox->append(OUString::number(reinterpret_cast<sal_Int64>(pKey)), 
aEntry, "");
             }
         }
     }
@@ -409,24 +372,11 @@ RTSDevicePage::RTSDevicePage( RTSDialog* pParent )
 
 RTSDevicePage::~RTSDevicePage()
 {
-    disposeOnce();
-}
-
-void RTSDevicePage::dispose()
-{
-    m_pParent.clear();
-    m_pPPDKeyBox.clear();
-    m_pPPDValueBox.clear();
-    m_pCustomEdit.clear();
-    m_pLevelBox.clear();
-    m_pSpaceBox.clear();
-    m_pDepthBox.clear();
-    TabPage::dispose();
 }
 
 sal_uLong RTSDevicePage::getDepth()
 {
-    sal_uInt16 nSelectPos = m_pDepthBox->GetSelectedEntryPos();
+    sal_uInt16 nSelectPos = m_xDepthBox->get_active();
     if (nSelectPos == 0)
         return 8;
     else
@@ -435,7 +385,7 @@ sal_uLong RTSDevicePage::getDepth()
 
 sal_uLong RTSDevicePage::getColorDevice()
 {
-    sal_uInt16 nSelectPos = m_pSpaceBox->GetSelectedEntryPos();
+    sal_uInt16 nSelectPos = m_xSpaceBox->get_active();
     switch (nSelectPos)
     {
         case 0:
@@ -450,7 +400,7 @@ sal_uLong RTSDevicePage::getColorDevice()
 
 sal_uLong RTSDevicePage::getLevel()
 {
-    sal_uLong nLevel = 
reinterpret_cast<sal_uLong>(m_pLevelBox->GetSelectedEntryData());
+    auto nLevel = m_xLevelBox->get_active_id().toInt32();
     if (nLevel == 0)
         return 0;   //automatic
     return nLevel < 10 ? nLevel-1 : 0;
@@ -458,7 +408,7 @@ sal_uLong RTSDevicePage::getLevel()
 
 sal_uLong RTSDevicePage::getPDFDevice()
 {
-    sal_uLong nLevel = 
reinterpret_cast<sal_uLong>(m_pLevelBox->GetSelectedEntryData());
+    auto nLevel = m_xLevelBox->get_active_id().toInt32();
     if (nLevel > 9)
         return 2;   //explicitly PDF
     else if (nLevel == 0)
@@ -466,25 +416,25 @@ sal_uLong RTSDevicePage::getPDFDevice()
     return -1;      //explicitly PS
 }
 
-IMPL_LINK(RTSDevicePage, ModifyHdl, Edit&, rEdit, void)
+IMPL_LINK(RTSDevicePage, ModifyHdl, weld::Entry&, rEdit, void)
 {
     if (m_pCustomValue)
     {
-        m_pCustomValue->m_aCustomOption = rEdit.GetText();
+        m_pCustomValue->m_aCustomOption = rEdit.get_text();
     }
 }
 
-IMPL_LINK( RTSDevicePage, SelectHdl, ListBox&, rBox, void )
+IMPL_LINK( RTSDevicePage, SelectHdl, weld::TreeView&, rBox, void )
 {
-    if( &rBox == m_pPPDKeyBox )
+    if (&rBox == m_xPPDKeyBox.get())
     {
-        const PPDKey* pKey = 
static_cast<PPDKey*>(m_pPPDKeyBox->GetSelectedEntryData());
+        const PPDKey* pKey = 
reinterpret_cast<PPDKey*>(m_xPPDKeyBox->get_selected_id().toInt64());
         FillValueBox( pKey );
     }
-    else if( &rBox == m_pPPDValueBox )
+    else if (&rBox == m_xPPDValueBox.get())
     {
-        const PPDKey* pKey = 
static_cast<PPDKey*>(m_pPPDKeyBox->GetSelectedEntryData());
-        const PPDValue* pValue = 
static_cast<PPDValue*>(m_pPPDValueBox->GetSelectedEntryData());
+        const PPDKey* pKey = 
reinterpret_cast<PPDKey*>(m_xPPDKeyBox->get_selected_id().toInt64());
+        const PPDValue* pValue = 
reinterpret_cast<PPDValue*>(m_xPPDValueBox->get_selected_id().toInt64());
         if (pKey && pValue)
         {
             m_pParent->m_aJobData.m_aContext.setValue( pKey, pValue );
@@ -496,8 +446,8 @@ IMPL_LINK( RTSDevicePage, SelectHdl, ListBox&, rBox, void )
 
 void RTSDevicePage::FillValueBox( const PPDKey* pKey )
 {
-    m_pPPDValueBox->Clear();
-    m_pCustomEdit->Hide();
+    m_xPPDValueBox->clear();
+    m_xCustomEdit->hide();
 
     if( ! pKey )
         return;
@@ -514,32 +464,31 @@ void RTSDevicePage::FillValueBox( const PPDKey* pKey )
                 aEntry = VclResId(SV_PRINT_CUSTOM_TXT);
             else
                 aEntry = m_pParent->m_aJobData.m_pParser->translateOption( 
pKey->getKey(), pValue->m_aOption);
-            sal_uInt16 nPos = m_pPPDValueBox->InsertEntry( aEntry );
-            m_pPPDValueBox->SetEntryData( nPos, const_cast<PPDValue *>(pValue) 
);
+            
m_xPPDValueBox->append(OUString::number(reinterpret_cast<sal_Int64>(pValue)), 
aEntry, "");
         }
     }
     pValue = m_pParent->m_aJobData.m_aContext.getValue( pKey );
-    m_pPPDValueBox->SelectEntryPos( m_pPPDValueBox->GetEntryPos( 
static_cast<void const *>(pValue) ) );
+    
m_xPPDValueBox->select_id(OUString::number(reinterpret_cast<sal_Int64>(pValue)));
     if (pValue->m_bCustomOption)
     {
         m_pCustomValue = pValue;
         m_pParent->m_aJobData.m_aContext.setValue(pKey, pValue);
-        m_pCustomEdit->SetText(m_pCustomValue->m_aCustomOption);
-        m_pCustomEdit->Show();
+        m_xCustomEdit->set_text(m_pCustomValue->m_aCustomOption);
+        m_xCustomEdit->show();
     }
 }
 
-int SetupPrinterDriver(::psp::PrinterInfo& rJobData)
+int SetupPrinterDriver(weld::Window* pParent, ::psp::PrinterInfo& rJobData)
 {
     int nRet = 0;
-    ScopedVclPtrInstance< RTSDialog > aDialog(  rJobData, nullptr  );
+    RTSDialog aDialog(rJobData, pParent);
 
     // return 0 if cancel was pressed or if the data
     // weren't modified, 1 otherwise
-    if( aDialog->Execute() )
+    if (aDialog.run() != RET_CANCEL)
     {
-        rJobData = aDialog->getSetup();
-        nRet = aDialog->GetDataModified() ? 1 : 0;
+        rJobData = aDialog.getSetup();
+        nRet = aDialog.GetDataModified() ? 1 : 0;
     }
 
     return nRet;
diff --git a/vcl/unx/generic/print/prtsetup.hxx 
b/vcl/unx/generic/print/prtsetup.hxx
index 3d6ae8d792d6..8162150447a9 100644
--- a/vcl/unx/generic/print/prtsetup.hxx
+++ b/vcl/unx/generic/print/prtsetup.hxx
@@ -20,111 +20,106 @@
 #ifndef INCLUDED_VCL_GENERIC_PRINT_PRTSETUP_HXX
 #define INCLUDED_VCL_GENERIC_PRINT_PRTSETUP_HXX
 
-#include <tools/link.hxx>
-
-#include <vcl/tabdlg.hxx>
-#include <vcl/tabpage.hxx>
-#include <vcl/tabctrl.hxx>
-#include <vcl/button.hxx>
-#include <vcl/edit.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/lstbox.hxx>
-#include <vcl/field.hxx>
-#include <vcl/combobox.hxx>
 #include <vcl/ppdparser.hxx>
+#include <vcl/weld.hxx>
 #include <printerinfomanager.hxx>
 
 class RTSPaperPage;
 class RTSDevicePage;
 
-class RTSDialog : public TabDialog
+class RTSDialog : public weld::GenericDialogController
 {
     friend class RTSPaperPage;
     friend class RTSDevicePage;
 
     ::psp::PrinterInfo      m_aJobData;
 
-    // controls
-    VclPtr<TabControl>      m_pTabControl;
-    VclPtr<OKButton>        m_pOKButton;
-    VclPtr<CancelButton>    m_pCancelButton;
-
-    // pages
-    VclPtr<RTSPaperPage>    m_pPaperPage;
-    VclPtr<RTSDevicePage>   m_pDevicePage;
-
     // some resources
     OUString                m_aInvalidString;
+    bool m_bDataModified;
+
+    // controls
+    std::unique_ptr<weld::Notebook> m_xTabControl;
+    std::unique_ptr<weld::Button> m_xOKButton;
+    std::unique_ptr<weld::Button> m_xCancelButton;
 
-    bool mbDataModified;
+    // pages
+    std::unique_ptr<RTSPaperPage>  m_xPaperPage;
+    std::unique_ptr<RTSDevicePage> m_xDevicePage;
 
-    DECL_LINK( ActivatePage, TabControl*, void );
-    DECL_LINK( ClickButton, Button*, void );
+    DECL_LINK(ActivatePage, const OString&, void );
+    DECL_LINK(ClickButton, weld::Button&, void );
 
     // helper functions
-    void insertAllPPDValues( ListBox&, const psp::PPDParser*, const 
psp::PPDKey* );
+    void insertAllPPDValues(weld::ComboBoxText&, const psp::PPDParser*, const 
psp::PPDKey*);
 public:
-    RTSDialog(const ::psp::PrinterInfo& rJobData, vcl::Window* pParent);
+    RTSDialog(const ::psp::PrinterInfo& rJobData, weld::Window* pParent);
     virtual ~RTSDialog() override;
-    virtual void dispose() override;
 
     const ::psp::PrinterInfo& getSetup() const { return m_aJobData; }
 
-    void SetDataModified( bool bModified ) { mbDataModified = bModified; }
-    bool GetDataModified() const { return mbDataModified; }
+    void SetDataModified( bool bModified ) { m_bDataModified = bModified; }
+    bool GetDataModified() const { return m_bDataModified; }
 };
 
-class RTSPaperPage : public TabPage
+class RTSPaperPage
 {
-    VclPtr<RTSDialog>          m_pParent;
+private:
+    std::unique_ptr<weld::Builder> m_xBuilder;
+
+    RTSDialog*                 m_pParent;
 
-    VclPtr<CheckBox>           m_pCbFromSetup;
+    std::unique_ptr<weld::Widget> m_xContainer;
 
-    VclPtr<FixedText>          m_pPaperText;
-    VclPtr<ListBox>            m_pPaperBox;
+    std::unique_ptr<weld::CheckButton> m_xCbFromSetup;
 
-    VclPtr<FixedText>          m_pOrientText;
-    VclPtr<ListBox>            m_pOrientBox;
+    std::unique_ptr<weld::Label> m_xPaperText;
+    std::unique_ptr<weld::ComboBoxText> m_xPaperBox;
 
-    VclPtr<FixedText>          m_pDuplexText;
-    VclPtr<ListBox>            m_pDuplexBox;
+    std::unique_ptr<weld::Label> m_xOrientText;
+    std::unique_ptr<weld::ComboBoxText> m_xOrientBox;
 
-    VclPtr<FixedText>          m_pSlotText;
-    VclPtr<ListBox>            m_pSlotBox;
+    std::unique_ptr<weld::Label> m_xDuplexText;
+    std::unique_ptr<weld::ComboBoxText> m_xDuplexBox;
 
-    DECL_LINK( SelectHdl, ListBox&, void );
-    DECL_LINK( CheckBoxHdl, CheckBox&, void );
+    std::unique_ptr<weld::Label> m_xSlotText;
+    std::unique_ptr<weld::ComboBoxText> m_xSlotBox;
+
+    DECL_LINK(SelectHdl, weld::ComboBoxText&, void);
+    DECL_LINK(CheckBoxHdl, weld::ToggleButton&, void);
 public:
-    explicit RTSPaperPage( RTSDialog* );
-    virtual ~RTSPaperPage() override;
-    virtual void dispose() override;
+    RTSPaperPage(weld::Widget* pPage, RTSDialog* pDialog);
+    ~RTSPaperPage();
 
     void update();
 
-    sal_Int32 getOrientation() const { return 
m_pOrientBox->GetSelectedEntryPos(); }
+    sal_Int32 getOrientation() const { return m_xOrientBox->get_active(); }
 };
 
-class RTSDevicePage : public TabPage
+class RTSDevicePage
 {
-    VclPtr<RTSDialog>          m_pParent;
+private:
+    std::unique_ptr<weld::Builder> m_xBuilder;
 
-    VclPtr<ListBox>            m_pPPDKeyBox;
-    VclPtr<ListBox>            m_pPPDValueBox;
     const psp::PPDValue* m_pCustomValue;
-    VclPtr<Edit>               m_pCustomEdit;
+    RTSDialog*                 m_pParent;
+
+    std::unique_ptr<weld::Widget> m_xContainer;
+    std::unique_ptr<weld::TreeView> m_xPPDKeyBox;
+    std::unique_ptr<weld::TreeView> m_xPPDValueBox;
+    std::unique_ptr<weld::Entry> m_xCustomEdit;
 
-    VclPtr<ListBox>            m_pLevelBox;
-    VclPtr<ListBox>            m_pSpaceBox;
-    VclPtr<ListBox>            m_pDepthBox;
+    std::unique_ptr<weld::ComboBoxText> m_xLevelBox;
+    std::unique_ptr<weld::ComboBoxText> m_xSpaceBox;
+    std::unique_ptr<weld::ComboBoxText> m_xDepthBox;
 
     void FillValueBox( const ::psp::PPDKey* );
 
-    DECL_LINK( SelectHdl, ListBox&, void );
-    DECL_LINK( ModifyHdl, Edit&, void );
+    DECL_LINK(SelectHdl, weld::TreeView&, void);
+    DECL_LINK(ModifyHdl, weld::Entry&, void);
 public:
-    explicit RTSDevicePage( RTSDialog* );
-    virtual ~RTSDevicePage() override;
-    virtual void dispose() override;
+    RTSDevicePage(weld::Widget* pPage, RTSDialog* pDialog);
+    ~RTSDevicePage();
 
     sal_uLong getLevel();
     sal_uLong getPDFDevice();
@@ -132,7 +127,7 @@ public:
     sal_uLong getColorDevice();
 };
 
-int SetupPrinterDriver(::psp::PrinterInfo& rJobData);
+int SetupPrinterDriver(weld::Window* pParent, ::psp::PrinterInfo& rJobData);
 
 #endif // _PAD_PRTSETUP_HXX
 
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index ebb5dfdde8a3..f646b70d7d2a 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2198,7 +2198,7 @@ private:
 
     void signal_switch_page(guint nNewPage)
     {
-        bool bAllow = m_aLeavePageHdl.Call(get_current_page_ident());
+        bool bAllow = !m_aLeavePageHdl.IsSet() || 
m_aLeavePageHdl.Call(get_current_page_ident());
         if (!bAllow)
         {
             g_signal_stop_emission_by_name(m_pNotebook, "switch-page");
@@ -2564,10 +2564,12 @@ namespace
     struct Search
     {
         OString str;
-        int index = -1;
-        Search(const OUString& rText)
+        int index;
+        int col;
+        Search(const OUString& rText, int nCol)
             : str(OUStringToOString(rText, RTL_TEXTENCODING_UTF8))
             , index(-1)
+            , col(nCol)
         {
         }
     };
@@ -2576,7 +2578,7 @@ namespace
     {
         Search* search = static_cast<Search*>(data);
         gchar *pStr = nullptr;
-        gtk_tree_model_get(model, iter, 0, &pStr, -1);
+        gtk_tree_model_get(model, iter, search->col, &pStr, -1);
         bool found = strcmp(pStr, search->str.getStr()) == 0;
         if (found)
             search->index = gtk_tree_path_get_indices(path)[0];
@@ -2680,7 +2682,14 @@ public:
 
     virtual int find(const OUString& rText) const override
     {
-        Search aSearch(rText);
+        Search aSearch(rText, 0);
+        gtk_tree_model_foreach(GTK_TREE_MODEL(m_pListStore), foreach_find, 
&aSearch);
+        return aSearch.index;
+    }
+
+    virtual int find_id(const OUString& rId) const override
+    {
+        Search aSearch(rId, 1);
         gtk_tree_model_foreach(GTK_TREE_MODEL(m_pListStore), foreach_find, 
&aSearch);
         return aSearch.index;
     }
@@ -3441,7 +3450,7 @@ private:
         {
             gchar* pStr;
             gtk_tree_model_get(pModel, &iter, col, &pStr, -1);
-            const bool bEqual = strcmp(pStr, aStr.getStr()) == 0;
+            const bool bEqual = g_strcmp0(pStr, aStr.getStr()) == 0;
             g_free(pStr);
             if (bEqual)
                 return nRet;
@@ -3542,6 +3551,15 @@ public:
         enable_notify_events();
     }
 
+    using GtkInstanceContainer::remove;
+
+    virtual void remove(int pos) override
+    {
+        disable_notify_events();
+        gtk_combo_box_text_remove(m_pComboBoxText, pos);
+        enable_notify_events();
+    }
+
     virtual void insert(int pos, const OUString& rId, const OUString& rStr) 
override
     {
         disable_notify_events();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to