summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-03-01 20:21:12 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-03-02 17:08:16 +0100
commitd8a3741e0e3aa2fed6e3e16fae8eac095356c8bf (patch)
treeb3fc743a22d8adc46773914d83acf45f463cb4f2 /cui
parentdab9a2b60a63530638905bd26162946a9494f93b (diff)
weld split cells dialog
Change-Id: I726c6d84807ab3efba509058eed554fe4c0ffced Reviewed-on: https://gerrit.libreoffice.org/50636 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/dialogs/splitcelldlg.cxx87
-rw-r--r--cui/source/factory/dlgfact.cxx2
-rw-r--r--cui/source/factory/dlgfact.hxx2
-rw-r--r--cui/source/inc/splitcelldlg.hxx24
-rw-r--r--cui/uiconfig/ui/splitcellsdialog.ui16
5 files changed, 58 insertions, 73 deletions
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>