diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-06 21:23:13 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-07 19:44:44 +0200 |
commit | cf5a2fbbdaace0cbf0e7cbb39e280ec900a82b08 (patch) | |
tree | 9208cf077e47d832f4975bc2734935ce21685d78 | |
parent | 52f3046842ccb2a81e8eef6c744330567512e55b (diff) |
weld FontworkCharacterSpacingDialog
Change-Id: I847c705ae486f9c83877ff3092ebf904e9332e63
Reviewed-on: https://gerrit.libreoffice.org/61483
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/svx/fontworkgallery.hxx | 20 | ||||
-rw-r--r-- | sd/source/ui/dlg/RemoteDialogClientBox.hxx | 1 | ||||
-rw-r--r-- | svx/source/tbxctrls/fontworkgallery.cxx | 18 | ||||
-rw-r--r-- | svx/source/toolbars/fontworkbar.cxx | 8 | ||||
-rw-r--r-- | svx/uiconfig/ui/fontworkspacingdialog.ui | 73 |
5 files changed, 53 insertions, 67 deletions
diff --git a/include/svx/fontworkgallery.hxx b/include/svx/fontworkgallery.hxx index 58ff23d34698..610b0ad96452 100644 --- a/include/svx/fontworkgallery.hxx +++ b/include/svx/fontworkgallery.hxx @@ -22,40 +22,28 @@ #define INCLUDED_SVX_FONTWORKGALLERY_HXX #include <svx/svxdllapi.h> - -#include <vcl/fixed.hxx> -#include <vcl/button.hxx> -#include <vcl/dialog.hxx> -#include <vcl/field.hxx> -#include <vcl/weld.hxx> - #include <svtools/valueset.hxx> - #include <sfx2/tbxctrl.hxx> - +#include <vcl/weld.hxx> #include <vector> class FmFormModel; class SdrView; -namespace vcl { class Window; } class SdrTextObj; class SdrObject; class SdrModel; - class SfxBindings; - namespace svx { -class SAL_WARN_UNUSED FontworkCharacterSpacingDialog : public ModalDialog +class SAL_WARN_UNUSED FontworkCharacterSpacingDialog : public weld::GenericDialogController { - VclPtr<MetricField> m_pMtrScale; + std::unique_ptr<weld::MetricSpinButton> m_xMtrScale; public: - FontworkCharacterSpacingDialog( vcl::Window* pParent, sal_Int32 nScale ); + FontworkCharacterSpacingDialog(weld::Window* pParent, sal_Int32 nScale); virtual ~FontworkCharacterSpacingDialog() override; - virtual void dispose() override; sal_Int32 getScale() const; }; diff --git a/sd/source/ui/dlg/RemoteDialogClientBox.hxx b/sd/source/ui/dlg/RemoteDialogClientBox.hxx index c839165a79cc..6ab8522d65f3 100644 --- a/sd/source/ui/dlg/RemoteDialogClientBox.hxx +++ b/sd/source/ui/dlg/RemoteDialogClientBox.hxx @@ -24,7 +24,6 @@ #include <vcl/scrbar.hxx> #include <vcl/fixed.hxx> #include <vcl/button.hxx> -#include <vcl/dialog.hxx> #include <vcl/field.hxx> #include <svtools/extensionlistbox.hxx> diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index 65243aad0fc2..700a0c852bc8 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -624,28 +624,20 @@ com_sun_star_comp_svx_FontworkCharacterSpacingControl_get_implementation( return cppu::acquire(new FontworkCharacterSpacingControl(xContext)); } - -FontworkCharacterSpacingDialog::FontworkCharacterSpacingDialog( vcl::Window* pParent, sal_Int32 nScale ) -: ModalDialog( pParent, "FontworkSpacingDialog" , "svx/ui/fontworkspacingdialog.ui" ) +FontworkCharacterSpacingDialog::FontworkCharacterSpacingDialog(weld::Window* pParent, sal_Int32 nScale) + : GenericDialogController(pParent, "svx/ui/fontworkspacingdialog.ui", "FontworkSpacingDialog") + , m_xMtrScale(m_xBuilder->weld_metric_spin_button("entry", FUNIT_PERCENT)) { - get(m_pMtrScale, "entry"); - m_pMtrScale->SetValue( nScale ); + m_xMtrScale->set_value(nScale, FUNIT_PERCENT); } FontworkCharacterSpacingDialog::~FontworkCharacterSpacingDialog() { - disposeOnce(); -} - -void FontworkCharacterSpacingDialog::dispose() -{ - m_pMtrScale.clear(); - ModalDialog::dispose(); } sal_Int32 FontworkCharacterSpacingDialog::getScale() const { - return static_cast<sal_Int32>(m_pMtrScale->GetValue()); + return static_cast<sal_Int32>(m_xMtrScale->get_value(FUNIT_PERCENT)); } } diff --git a/svx/source/toolbars/fontworkbar.cxx b/svx/source/toolbars/fontworkbar.cxx index f5283818191b..90b05316fdc0 100644 --- a/svx/source/toolbars/fontworkbar.cxx +++ b/svx/source/toolbars/fontworkbar.cxx @@ -471,11 +471,11 @@ void FontworkBar::execute( SdrView* pSdrView, SfxRequest const & rReq, SfxBindin if( rReq.GetArgs() && ( rReq.GetArgs()->GetItemState( SID_FONTWORK_CHARACTER_SPACING ) == SfxItemState::SET ) ) { sal_Int32 nCharSpacing = rReq.GetArgs()->GetItem<SfxInt32Item>(SID_FONTWORK_CHARACTER_SPACING)->GetValue(); - ScopedVclPtrInstance< FontworkCharacterSpacingDialog > aDlg( nullptr, nCharSpacing ); - sal_uInt16 nRet = aDlg->Execute(); - if( nRet != 0 ) + FontworkCharacterSpacingDialog aDlg(rReq.GetFrameWeld(), nCharSpacing); + sal_uInt16 nRet = aDlg.run(); + if (nRet != RET_CANCEL) { - SfxInt32Item aItem( SID_FONTWORK_CHARACTER_SPACING, aDlg->getScale() ); + SfxInt32Item aItem(SID_FONTWORK_CHARACTER_SPACING, aDlg.getScale()); SfxPoolItem* aItems[] = { &aItem, nullptr }; rBindings.Execute( SID_FONTWORK_CHARACTER_SPACING, const_cast<const SfxPoolItem**>(aItems) ); } diff --git a/svx/uiconfig/ui/fontworkspacingdialog.ui b/svx/uiconfig/ui/fontworkspacingdialog.ui index d9a2817193de..f3315831a723 100644 --- a/svx/uiconfig/ui/fontworkspacingdialog.ui +++ b/svx/uiconfig/ui/fontworkspacingdialog.ui @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> <interface domain="svx"> - <!-- interface-requires gtk+ 3.0 --> + <requires lib="gtk+" version="3.0"/> <object class="GtkAdjustment" id="adjustment1"> <property name="upper">500</property> <property name="value">100</property> @@ -12,42 +13,51 @@ <property name="border_width">6</property> <property name="title" translatable="yes" context="fontworkspacingdialog|FontworkSpacingDialog">Fontwork Character Spacing</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> <property name="orientation">vertical</property> <property name="spacing">12</property> - <child> - <object class="GtkBox" id="box1"> - <property name="visible">True</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area1"> <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="hexpand">True</property> - <property name="spacing">12</property> + <property name="layout_style">end</property> <child> - <object class="GtkLabel" id="label2"> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="fontworkspacingdialog|label2">_Value:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">entry:0%</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> + <property name="pack_type">end</property> <property name="position">0</property> </packing> </child> <child> - <object class="GtkSpinButton" id="entry:0%"> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="adjustment">adjustment1</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> + <property name="pack_type">end</property> <property name="position">1</property> </packing> </child> @@ -55,42 +65,40 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">0</property> + <property name="pack_type">end</property> + <property name="position">1</property> </packing> </child> - <child internal-child="action_area"> - <object class="GtkButtonBox" id="dialog-action_area1"> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> <property name="can_focus">False</property> - <property name="layout_style">end</property> + <property name="valign">start</property> + <property name="hexpand">True</property> + <property name="spacing">12</property> <child> - <object class="GtkButton" id="ok"> - <property name="label">gtk-ok</property> + <object class="GtkLabel" id="label2"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="receives_default">True</property> - <property name="use_stock">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="fontworkspacingdialog|label2">_Value:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">entry</property> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="pack_type">end</property> <property name="position">0</property> </packing> </child> <child> - <object class="GtkButton" id="cancel"> - <property name="label">gtk-cancel</property> + <object class="GtkSpinButton" id="entry"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_stock">True</property> + <property name="adjustment">adjustment1</property> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="pack_type">end</property> <property name="position">1</property> </packing> </child> @@ -98,8 +106,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="pack_type">end</property> - <property name="position">1</property> + <property name="position">0</property> </packing> </child> </object> |