diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-03 21:18:31 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-04 09:56:42 +0200 |
commit | fd5e9b1eb383e380d7eef4d168f2f5f85d2ab819 (patch) | |
tree | e94e18d99d07cc1eb97d93cd2c0cc5c63d98897d /dbaccess | |
parent | 7e86cfab8ee1f7fdcb42f37e2b0b7a5ab5d862c1 (diff) |
weld DlgSize
Change-Id: I5e27d2a27810af98bd0cf59f9e9cbe1cf75d7f1b
Reviewed-on: https://gerrit.libreoffice.org/61329
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/ui/browser/sbagrid.cxx | 12 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/dlgsize.cxx | 56 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/dlgsize.hxx | 19 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/UITools.cxx | 6 | ||||
-rw-r--r-- | dbaccess/uiconfig/ui/colwidthdialog.ui | 15 | ||||
-rw-r--r-- | dbaccess/uiconfig/ui/rowheightdialog.ui | 15 |
6 files changed, 58 insertions, 65 deletions
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx index 18ede36a635a..e1680295683d 100644 --- a/dbaccess/source/ui/browser/sbagrid.cxx +++ b/dbaccess/source/ui/browser/sbagrid.cxx @@ -790,10 +790,10 @@ void SbaGridControl::SetColWidth(sal_uInt16 nColId) Any aWidth = xAffectedCol->getPropertyValue(PROPERTY_WIDTH); sal_Int32 nCurWidth = aWidth.hasValue() ? ::comphelper::getINT32(aWidth) : -1; - ScopedVclPtrInstance< DlgSize > aDlgColWidth(this, nCurWidth, false); - if (aDlgColWidth->Execute()) + DlgSize aDlgColWidth(GetFrameWeld(), nCurWidth, false); + if (aDlgColWidth.run() == RET_OK) { - sal_Int32 nValue = aDlgColWidth->GetValue(); + sal_Int32 nValue = aDlgColWidth.GetValue(); Any aNewWidth; if (-1 == nValue) { // set to default @@ -819,10 +819,10 @@ void SbaGridControl::SetRowHeight() Any aHeight = xCols->getPropertyValue(PROPERTY_ROW_HEIGHT); sal_Int32 nCurHeight = aHeight.hasValue() ? ::comphelper::getINT32(aHeight) : -1; - ScopedVclPtrInstance< DlgSize > aDlgRowHeight(this, nCurHeight, true); - if (aDlgRowHeight->Execute()) + DlgSize aDlgRowHeight(GetFrameWeld(), nCurHeight, true); + if (aDlgRowHeight.run() == RET_OK) { - sal_Int32 nValue = aDlgRowHeight->GetValue(); + sal_Int32 nValue = aDlgRowHeight.GetValue(); Any aNewHeight; if (sal_Int16(-1) == nValue) { // set to default diff --git a/dbaccess/source/ui/dlg/dlgsize.cxx b/dbaccess/source/ui/dlg/dlgsize.cxx index d2932323be1e..e5d95c4b5624 100644 --- a/dbaccess/source/ui/dlg/dlgsize.cxx +++ b/dbaccess/source/ui/dlg/dlgsize.cxx @@ -26,70 +26,56 @@ namespace dbaui #define DEF_ROW_HEIGHT 45 #define DEF_COL_WIDTH 227 -DlgSize::DlgSize( vcl::Window* pParent, sal_Int32 nVal, bool bRow, sal_Int32 _nAlternativeStandard ) - : ModalDialog(pParent, bRow ? OUString("RowHeightDialog") : OUString("ColWidthDialog"), - bRow ? OUString("dbaccess/ui/rowheightdialog.ui") : OUString("dbaccess/ui/colwidthdialog.ui")) +DlgSize::DlgSize(weld::Window* pParent, sal_Int32 nVal, bool bRow, sal_Int32 _nAlternativeStandard ) + : GenericDialogController(pParent, bRow ? OUString("dbaccess/ui/rowheightdialog.ui") : OUString("dbaccess/ui/colwidthdialog.ui"), + bRow ? OString("RowHeightDialog") : OString("ColWidthDialog")) , m_nPrevValue(nVal) , m_nStandard(bRow ? DEF_ROW_HEIGHT : DEF_COL_WIDTH) + , m_xMF_VALUE(m_xBuilder->weld_metric_spin_button("value", FUNIT_CM)) + , m_xCB_STANDARD(m_xBuilder->weld_check_button("automatic")) { - get(m_pMF_VALUE, "value"); - get(m_pCB_STANDARD, "automatic"); - if ( _nAlternativeStandard > 0 ) m_nStandard = _nAlternativeStandard; - m_pCB_STANDARD->SetClickHdl(LINK(this,DlgSize,CbClickHdl)); + m_xCB_STANDARD->connect_toggled(LINK(this,DlgSize,CbClickHdl)); - m_pMF_VALUE->EnableEmptyFieldValue(true); bool bDefault = -1 == nVal; - m_pCB_STANDARD->Check(bDefault); + m_xCB_STANDARD->set_active(bDefault); if (bDefault) { SetValue(m_nStandard); m_nPrevValue = m_nStandard; } - LINK(this,DlgSize,CbClickHdl).Call(m_pCB_STANDARD); + CbClickHdl(*m_xCB_STANDARD); } DlgSize::~DlgSize() { - disposeOnce(); -} - -void DlgSize::dispose() -{ - m_pMF_VALUE.clear(); - m_pCB_STANDARD.clear(); - ModalDialog::dispose(); } - void DlgSize::SetValue( sal_Int32 nVal ) { - m_pMF_VALUE->SetValue(nVal, FUNIT_CM ); + m_xMF_VALUE->set_value(nVal, FUNIT_CM ); } sal_Int32 DlgSize::GetValue() { - if (m_pCB_STANDARD->IsChecked()) + if (m_xCB_STANDARD->get_active()) return -1; - return static_cast<sal_Int32>(m_pMF_VALUE->GetValue( FUNIT_CM )); + return static_cast<sal_Int32>(m_xMF_VALUE->get_value( FUNIT_CM )); } -IMPL_LINK( DlgSize, CbClickHdl, Button *, pButton, void ) +IMPL_LINK_NOARG(DlgSize, CbClickHdl, weld::ToggleButton&, void) { - if( pButton == m_pCB_STANDARD ) + m_xMF_VALUE->set_sensitive(m_xCB_STANDARD->get_active()); + if (!m_xCB_STANDARD->get_active()) + { + // don't use getValue as this will use m_xCB_STANDARD->to determine if we're standard + m_nPrevValue = static_cast<sal_Int32>(m_xMF_VALUE->get_value(FUNIT_CM)); + m_xMF_VALUE->set_text(""); + } + else { - m_pMF_VALUE->Enable(!m_pCB_STANDARD->IsChecked()); - if (m_pCB_STANDARD->IsChecked()) - { - m_nPrevValue = static_cast<sal_Int32>(m_pMF_VALUE->GetValue(FUNIT_CM)); - // don't use getValue as this will use m_pCB_STANDARD->to determine if we're standard - m_pMF_VALUE->SetEmptyFieldValue(); - } - else - { - SetValue( m_nPrevValue ); - } + SetValue(m_nPrevValue); } } diff --git a/dbaccess/source/ui/inc/dlgsize.hxx b/dbaccess/source/ui/inc/dlgsize.hxx index f7c4b1db0cd8..6e72490945fb 100644 --- a/dbaccess/source/ui/inc/dlgsize.hxx +++ b/dbaccess/source/ui/inc/dlgsize.hxx @@ -19,32 +19,25 @@ #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_DLGSIZE_HXX #define INCLUDED_DBACCESS_SOURCE_UI_INC_DLGSIZE_HXX -#include <vcl/dialog.hxx> - -#include <vcl/field.hxx> - -#include <vcl/button.hxx> - -#include <vcl/fixed.hxx> +#include <vcl/weld.hxx> namespace dbaui { - class DlgSize final : public ModalDialog + class DlgSize final : public weld::GenericDialogController { private: sal_Int32 m_nPrevValue, m_nStandard; void SetValue( sal_Int32 nVal ); - DECL_LINK( CbClickHdl, Button *, void ); + DECL_LINK(CbClickHdl, weld::ToggleButton&, void); - VclPtr<MetricField> m_pMF_VALUE; - VclPtr<CheckBox> m_pCB_STANDARD; + std::unique_ptr<weld::MetricSpinButton> m_xMF_VALUE; + std::unique_ptr<weld::CheckButton> m_xCB_STANDARD; public: - DlgSize( vcl::Window * pParent, sal_Int32 nVal, bool bRow, sal_Int32 _nAlternativeStandard = -1 ); + DlgSize(weld::Window * pParent, sal_Int32 nVal, bool bRow, sal_Int32 _nAlternativeStandard = -1); virtual ~DlgSize() override; - virtual void dispose() override; sal_Int32 GetValue(); }; } // namespace dbaui diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index 6643ca7a3dea..d66fa16ebfc9 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -987,10 +987,10 @@ void adjustBrowseBoxColumnWidth( ::svt::EditBrowseBox* _pBox, sal_uInt16 _nColId Size aDefaultMM = _pBox->PixelToLogic( Size( nDefaultWidth, 0 ), MapMode( MapUnit::MapMM ) ); - ScopedVclPtrInstance< DlgSize > aColumnSizeDlg( _pBox, nColSize, false, aDefaultMM.Width() * 10 ); - if ( aColumnSizeDlg->Execute() ) + DlgSize aColumnSizeDlg(_pBox->GetFrameWeld(), nColSize, false, aDefaultMM.Width() * 10); + if (aColumnSizeDlg.run() == RET_OK) { - sal_Int32 nValue = aColumnSizeDlg->GetValue(); + sal_Int32 nValue = aColumnSizeDlg.GetValue(); if ( -1 == nValue ) { // default width nValue = _pBox->GetDefaultColumnWidth( _pBox->GetColumnTitle( _nColId ) ); diff --git a/dbaccess/uiconfig/ui/colwidthdialog.ui b/dbaccess/uiconfig/ui/colwidthdialog.ui index 8ed91d6a8766..28b5492ff745 100644 --- a/dbaccess/uiconfig/ui/colwidthdialog.ui +++ b/dbaccess/uiconfig/ui/colwidthdialog.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="dba"> <requires lib="gtk+" version="3.18"/> <object class="GtkAdjustment" id="adjustment1"> @@ -14,7 +14,13 @@ <property name="border_width">6</property> <property name="title" translatable="yes" context="colwidthdialog|ColWidthDialog">Column Width</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> @@ -90,10 +96,10 @@ <object class="GtkLabel" id="label1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="colwidthdialog|label1">_Width:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">value:0.00cm</property> + <property name="mnemonic_widget">value</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -101,10 +107,11 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="value:0.00cm"> + <object class="GtkSpinButton" id="value"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> <property name="adjustment">adjustment1</property> <property name="digits">2</property> </object> diff --git a/dbaccess/uiconfig/ui/rowheightdialog.ui b/dbaccess/uiconfig/ui/rowheightdialog.ui index 82a701573aaf..a22542014686 100644 --- a/dbaccess/uiconfig/ui/rowheightdialog.ui +++ b/dbaccess/uiconfig/ui/rowheightdialog.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="dba"> <requires lib="gtk+" version="3.18"/> <object class="GtkAdjustment" id="adjustment1"> @@ -14,7 +14,13 @@ <property name="border_width">6</property> <property name="title" translatable="yes" context="rowheightdialog|RowHeightDialog">Row Height</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> @@ -90,10 +96,10 @@ <object class="GtkLabel" id="label1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="rowheightdialog|label1">_Height:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">value:0.00cm</property> + <property name="mnemonic_widget">value</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -101,10 +107,11 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="value:0.00cm"> + <object class="GtkSpinButton" id="value"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> <property name="adjustment">adjustment1</property> <property name="digits">2</property> </object> |