[Libreoffice-commits] core.git: cui/source cui/uiconfig include/svx include/vcl sw/source vcl/source vcl/unx

Caolán McNamara caolanm at redhat.com
Fri Mar 2 16:08:43 UTC 2018


 cui/source/dialogs/splitcelldlg.cxx |   87 ++++++++++++++----------------------
 cui/source/factory/dlgfact.cxx      |    2 
 cui/source/factory/dlgfact.hxx      |    2 
 cui/source/inc/splitcelldlg.hxx     |   24 ++++-----
 cui/uiconfig/ui/splitcellsdialog.ui |   16 ++++--
 include/svx/svxdlg.hxx              |    2 
 include/vcl/weld.hxx                |    6 ++
 sw/source/uibase/shells/tabsh.cxx   |    3 -
 vcl/source/app/salvtables.cxx       |   20 ++++++++
 vcl/source/control/fixed.cxx        |    2 
 vcl/unx/gtk3/gtk3gtkinst.cxx        |   28 +++++++++++
 11 files changed, 116 insertions(+), 76 deletions(-)

New commits:
commit d8a3741e0e3aa2fed6e3e16fae8eac095356c8bf
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 1 20:21:12 2018 +0000

    weld split cells dialog
    
    Change-Id: I726c6d84807ab3efba509058eed554fe4c0ffced
    Reviewed-on: https://gerrit.libreoffice.org/50636
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/dialogs/splitcelldlg.cxx b/cui/source/dialogs/splitcelldlg.cxx
index 9386d171196f..a465dafef186 100644
--- a/cui/source/dialogs/splitcelldlg.cxx
+++ b/cui/source/dialogs/splitcelldlg.cxx
@@ -20,90 +20,71 @@
 #include <sfx2/dispatch.hxx>
 #include <svl/intitem.hxx>
 #include <svl/eitem.hxx>
+#include <vcl/svapp.hxx>
 #include <dialmgr.hxx>
 #include <splitcelldlg.hxx>
 
-namespace {
-    class NoApplyDialog : public SvxStandardDialog
-    {
-    public:
-        NoApplyDialog(vcl::Window *pParent, const OUString &rId, const OUString &rXML) :
-            SvxStandardDialog(pParent, rId, rXML) { }
-    protected:
-        virtual void Apply() override {}
-    };
-}
-
-SvxSplitTableDlg::SvxSplitTableDlg( vcl::Window *pParent, bool bIsTableVertical,
-    long nMaxVertical, long nMaxHorizontal )
-    : m_pDialog(VclPtr<NoApplyDialog>::Create(pParent, "SplitCellsDialog", "cui/ui/splitcellsdialog.ui"))
+SvxSplitTableDlg::SvxSplitTableDlg(weld::Window *pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal)
+    : m_xBuilder(Application::CreateBuilder(pParent, "cui/ui/splitcellsdialog.ui"))
+    , m_xDialog(m_xBuilder->weld_dialog("SplitCellsDialog"))
+    , m_xCountEdit(m_xBuilder->weld_spin_button("countnf"))
+    , m_xHorzBox(!bIsTableVertical ? m_xBuilder->weld_radio_button("hori") : m_xBuilder->weld_radio_button("vert"))
+    , m_xVertBox(!bIsTableVertical ? m_xBuilder->weld_radio_button("vert") : m_xBuilder->weld_radio_button("hori"))
+    , m_xPropCB(m_xBuilder->weld_check_button("prop"))
     , mnMaxVertical(nMaxVertical)
     , mnMaxHorizontal(nMaxHorizontal)
 {
-    m_pDialog->get(m_pCountEdit, "countnf");
-    m_pDialog->get(m_pHorzBox, "hori");
-    m_pDialog->get(m_pVertBox, "vert");
-    m_pDialog->get(m_pPropCB, "prop");
-    m_pHorzBox->SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
-    m_pPropCB->SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
-    m_pVertBox->SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl ));
+    m_xHorzBox->connect_clicked(LINK(this, SvxSplitTableDlg, ClickHdl));
+    m_xPropCB->connect_clicked(LINK(this, SvxSplitTableDlg, ClickHdl));
+    m_xVertBox->connect_clicked(LINK(this, SvxSplitTableDlg, ClickHdl));
 
-    if( mnMaxVertical < 2 )
-        m_pVertBox->Enable(false);
+    if (mnMaxVertical < 2)
+    {
+        if (!bIsTableVertical)
+            m_xVertBox->set_sensitive(false);
+        else
+            m_xHorzBox->set_sensitive(false);
+    }
 
     //exchange the meaning of horizontal and vertical for vertical text
-    if(bIsTableVertical)
+    if (bIsTableVertical)
     {
-        Image aTmpImg(m_pHorzBox->GetModeRadioImage());
-        OUString sTmp(m_pHorzBox->GetText());
-        m_pHorzBox->SetText(m_pVertBox->GetText());
-        m_pHorzBox->SetModeRadioImage(m_pVertBox->GetModeRadioImage());
-        m_pVertBox->SetText(sTmp);
-        m_pVertBox->SetModeRadioImage(aTmpImg);
+        int nHorzTopAttach = m_xHorzBox->get_grid_top_attach();
+        int nVertTopAttach = m_xVertBox->get_grid_top_attach();
+        m_xHorzBox->set_grid_top_attach(nVertTopAttach);
+        m_xVertBox->set_grid_top_attach(nHorzTopAttach);
+        m_xHorzBox->set_active(m_xVertBox->get_active());
     }
 }
 
-SvxSplitTableDlg::~SvxSplitTableDlg()
-{
-    disposeOnce();
-}
-
-void SvxSplitTableDlg::dispose()
-{
-    m_pCountEdit.clear();
-    m_pHorzBox.clear();
-    m_pVertBox.clear();
-    m_pPropCB.clear();
-    m_pDialog.disposeAndClear();
-    SvxAbstractSplittTableDialog::dispose();
-}
-
-IMPL_LINK( SvxSplitTableDlg, ClickHdl, Button *, pButton, void )
+IMPL_LINK(SvxSplitTableDlg, ClickHdl, weld::Button&, rButton, void)
 {
-    const bool bIsVert =  pButton == m_pVertBox ;
+    const bool bIsVert = &rButton == m_xVertBox.get();
     long nMax = bIsVert ? mnMaxVertical : mnMaxHorizontal;
-    m_pPropCB->Enable(!bIsVert);
-    m_pCountEdit->SetMax( nMax );
+    m_xPropCB->set_sensitive(!bIsVert);
+    int nMin, dummy;
+    m_xCountEdit->get_range(nMin, dummy);
+    m_xCountEdit->set_range(nMin, nMax);
 }
 
 bool SvxSplitTableDlg::IsHorizontal() const
 {
-    return m_pHorzBox->IsChecked();
+    return m_xHorzBox->get_active();
 }
 
 bool SvxSplitTableDlg::IsProportional() const
 {
-    return m_pPropCB->IsChecked() && m_pHorzBox->IsChecked();
+    return m_xPropCB->get_active() && m_xHorzBox->get_active();
 }
 
 long SvxSplitTableDlg::GetCount() const
 {
-    return sal::static_int_cast<long>( m_pCountEdit->GetValue() );
+    return m_xCountEdit->get_value();
 }
 
 short SvxSplitTableDlg::Execute()
 {
-    return m_pDialog->Execute();
+    return m_xDialog->run();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 365fd949c9e9..0abacf383412 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -1488,7 +1488,7 @@ VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateSvxFormatCellsDia
     return VclPtr<CuiAbstractTabDialog_Impl>::Create( VclPtr<SvxFormatCellsDialog>::Create( nullptr, pAttr, pModel ) );
 }
 
-VclPtr<SvxAbstractSplittTableDialog> AbstractDialogFactory_Impl::CreateSvxSplittTableDialog( vcl::Window* pParent, bool bIsTableVertical, long nMaxVertical )
+VclPtr<SvxAbstractSplittTableDialog> AbstractDialogFactory_Impl::CreateSvxSplittTableDialog(weld::Window* pParent, bool bIsTableVertical, long nMaxVertical)
 {
     return VclPtr<SvxSplitTableDlg>::Create( pParent, bIsTableVertical, nMaxVertical, 99 );
 }
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index ca7273273d50..8df336439a78 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -617,7 +617,7 @@ public:
 
     virtual VclPtr<SfxAbstractTabDialog> CreateSvxFormatCellsDialog( const SfxItemSet* pAttr, SdrModel* pModel, const SdrObject* pObj ) override;
 
-    virtual VclPtr<SvxAbstractSplittTableDialog> CreateSvxSplittTableDialog( vcl::Window* pParent, bool bIsTableVertical, long nMaxVertical ) override;
+    virtual VclPtr<SvxAbstractSplittTableDialog> CreateSvxSplittTableDialog(weld::Window* pParent, bool bIsTableVertical, long nMaxVertical) override;
 
     virtual VclPtr<SvxAbstractNewTableDialog> CreateSvxNewTableDialog() override ;
 
diff --git a/cui/source/inc/splitcelldlg.hxx b/cui/source/inc/splitcelldlg.hxx
index 6ff4d0c9abc5..868e6b7e72c5 100644
--- a/cui/source/inc/splitcelldlg.hxx
+++ b/cui/source/inc/splitcelldlg.hxx
@@ -19,30 +19,26 @@
 #ifndef INCLUDED_CUI_SOURCE_INC_SPLITCELLDLG_HXX
 #define INCLUDED_CUI_SOURCE_INC_SPLITCELLDLG_HXX
 
-#include <vcl/fixed.hxx>
-#include <vcl/field.hxx>
-#include <vcl/button.hxx>
-
-#include <svx/stddlg.hxx>
 #include <svx/svxdlg.hxx>
+#include <vcl/weld.hxx>
 
 class SvxSplitTableDlg : public SvxAbstractSplittTableDialog
 {
-    VclPtr<SvxStandardDialog> m_pDialog;
-    VclPtr<NumericField> m_pCountEdit;
-    VclPtr<RadioButton>  m_pHorzBox;
-    VclPtr<RadioButton>  m_pVertBox;
-    VclPtr<CheckBox>     m_pPropCB;
+private:
+    std::unique_ptr<weld::Builder> m_xBuilder;
+    std::unique_ptr<weld::Dialog> m_xDialog;
+    std::unique_ptr<weld::SpinButton> m_xCountEdit;
+    std::unique_ptr<weld::RadioButton> m_xHorzBox;
+    std::unique_ptr<weld::RadioButton> m_xVertBox;
+    std::unique_ptr<weld::CheckButton> m_xPropCB;
 
     long                mnMaxVertical;
     long                mnMaxHorizontal;
 
 public:
-    SvxSplitTableDlg(vcl::Window *pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal );
-    virtual ~SvxSplitTableDlg() override;
-    virtual void dispose() override;
+    SvxSplitTableDlg(weld::Window *pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal);
 
-    DECL_LINK( ClickHdl, Button *, void );
+    DECL_LINK(ClickHdl, weld::Button&, void);
 
     virtual bool IsHorizontal() const override;
     virtual bool IsProportional() const override;
diff --git a/cui/uiconfig/ui/splitcellsdialog.ui b/cui/uiconfig/ui/splitcellsdialog.ui
index 4a121d46e6b8..b496b32bb8e3 100644
--- a/cui/uiconfig/ui/splitcellsdialog.ui
+++ b/cui/uiconfig/ui/splitcellsdialog.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.20.2 -->
 <interface domain="cui">
-  <requires lib="gtk+" version="3.0"/>
+  <requires lib="gtk+" version="3.20"/>
   <object class="GtkAdjustment" id="adjustment1">
     <property name="lower">2</property>
     <property name="upper">20</property>
@@ -12,18 +12,21 @@
   <object class="GtkImage" id="image1">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="pixbuf">svx/res/zetlhor2.png</property>
+    <property name="icon_name">svx/res/zetlhor2.png</property>
   </object>
   <object class="GtkImage" id="image2">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="pixbuf">svx/res/zetlver2.png</property>
+    <property name="icon_name">svx/res/zetlver2.png</property>
   </object>
   <object class="GtkDialog" id="SplitCellsDialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="splitcellsdialog|SplitCellsDialog">Split Cells</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">
@@ -182,6 +185,7 @@
                             <property name="image">image1</property>
                             <property name="use_underline">True</property>
                             <property name="xalign">0</property>
+                            <property name="always_show_image">True</property>
                             <property name="active">True</property>
                             <property name="draw_indicator">True</property>
                             <property name="group">vert</property>
@@ -200,6 +204,7 @@
                             <property name="image">image2</property>
                             <property name="use_underline">True</property>
                             <property name="xalign">0</property>
+                            <property name="always_show_image">True</property>
                             <property name="draw_indicator">True</property>
                             <property name="group">hori</property>
                           </object>
@@ -265,5 +270,8 @@
       <action-widget response="-6">cancel</action-widget>
       <action-widget response="-11">help</action-widget>
     </action-widgets>
+    <child>
+      <placeholder/>
+    </child>
   </object>
 </interface>
diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx
index 92e116ff4c8a..14f73131c0e9 100644
--- a/include/svx/svxdlg.hxx
+++ b/include/svx/svxdlg.hxx
@@ -470,7 +470,7 @@ public:
 
     virtual VclPtr<SfxAbstractTabDialog> CreateSvxFormatCellsDialog( const SfxItemSet* pAttr, SdrModel* pModel, const SdrObject* pObj )=0;
 
-    virtual VclPtr<SvxAbstractSplittTableDialog> CreateSvxSplittTableDialog( vcl::Window* pParent, bool bIsTableVertical, long nMaxVertical )=0;
+    virtual VclPtr<SvxAbstractSplittTableDialog> CreateSvxSplittTableDialog(weld::Window* pParent, bool bIsTableVertical, long nMaxVertical) = 0;
 
     virtual VclPtr<SvxAbstractNewTableDialog> CreateSvxNewTableDialog() = 0;
 
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index eaecaf11bd5b..e77936765787 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -47,6 +47,12 @@ public:
     virtual OString get_buildable_name() const = 0;
     virtual void set_help_id(const OString& rName) = 0;
     virtual OString get_help_id() const = 0;
+
+    virtual void set_grid_left_attach(int nAttach) = 0;
+    virtual int get_grid_left_attach() const = 0;
+    virtual void set_grid_top_attach(int nAttach) = 0;
+    virtual int get_grid_top_attach() const = 0;
+
     virtual Container* weld_parent() const = 0;
 
     virtual ~Widget() {}
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index f696bac5717d..5f7e15a2601a 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -990,7 +990,8 @@ void SwTableShell::Execute(SfxRequest &rReq)
                 if( pFact )
                 {
                     const long nMaxVert = rSh.GetAnyCurRect( CurRectType::Frame ).Width() / MINLAY;
-                    ScopedVclPtr<SvxAbstractSplittTableDialog> pDlg(pFact->CreateSvxSplittTableDialog( GetView().GetWindow(), rSh.IsTableVertical(), nMaxVert ));
+                    vcl::Window* pWin =  GetView().GetWindow();
+                    ScopedVclPtr<SvxAbstractSplittTableDialog> pDlg(pFact->CreateSvxSplittTableDialog(pWin ? pWin->GetFrameWeld() : nullptr, rSh.IsTableVertical(), nMaxVert));
                     if( pDlg && (pDlg->Execute() == RET_OK) )
                     {
                         nCount = pDlg->GetCount();
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 8f8be139261a..c1a968db3cc8 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -268,6 +268,26 @@ public:
         return m_xWidget->GetHelpId();
     }
 
+    virtual void set_grid_left_attach(int nAttach) override
+    {
+        m_xWidget->set_grid_left_attach(nAttach);
+    }
+
+    virtual int get_grid_left_attach() const override
+    {
+        return m_xWidget->get_grid_left_attach();
+    }
+
+    virtual void set_grid_top_attach(int nAttach) override
+    {
+        m_xWidget->set_grid_top_attach(nAttach);
+    }
+
+    virtual int get_grid_top_attach() const override
+    {
+        return m_xWidget->get_grid_top_attach();
+    }
+
     virtual weld::Container* weld_parent() const override;
 
     virtual ~SalInstanceWidget() override
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index 4b212fa61912..f998285abc1a 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -972,7 +972,7 @@ Image FixedImage::loadThemeImage(const OUString &rFileName)
 
 bool FixedImage::set_property(const OString &rKey, const OUString &rValue)
 {
-    if (rKey == "pixbuf")
+    if (rKey == "pixbuf" || rKey == "icon-name")
     {
         SetImage(loadThemeImage(rValue));
     }
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 39d68f110c5a..dfe9c89cabea 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1272,6 +1272,34 @@ public:
         return Size(nWidth, nHeight);
     }
 
+    virtual void set_grid_left_attach(int nAttach) override
+    {
+        GtkContainer* pParent = GTK_CONTAINER(gtk_widget_get_parent(m_pWidget));
+        gtk_container_child_set(pParent, m_pWidget, "left-attach", nAttach, nullptr);
+    }
+
+    virtual int get_grid_left_attach() const override
+    {
+        GtkContainer* pParent = GTK_CONTAINER(gtk_widget_get_parent(m_pWidget));
+        gint nAttach(0);
+        gtk_container_child_get(pParent, m_pWidget, "left-attach", &nAttach, nullptr);
+        return nAttach;
+    }
+
+    virtual void set_grid_top_attach(int nAttach) override
+    {
+        GtkContainer* pParent = GTK_CONTAINER(gtk_widget_get_parent(m_pWidget));
+        gtk_container_child_set(pParent, m_pWidget, "top-attach", nAttach, nullptr);
+    }
+
+    virtual int get_grid_top_attach() const override
+    {
+        GtkContainer* pParent = GTK_CONTAINER(gtk_widget_get_parent(m_pWidget));
+        gint nAttach(0);
+        gtk_container_child_get(pParent, m_pWidget, "top-attach", &nAttach, nullptr);
+        return nAttach;
+    }
+
     virtual weld::Container* weld_parent() const override;
 
     virtual OString get_buildable_name() const override


More information about the Libreoffice-commits mailing list