Kaydet (Commit) cf5a2fbb authored tarafından Caolán McNamara's avatar Caolán McNamara

weld FontworkCharacterSpacingDialog

Change-Id: I847c705ae486f9c83877ff3092ebf904e9332e63
Reviewed-on: https://gerrit.libreoffice.org/61483
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 52f30468
...@@ -22,40 +22,28 @@ ...@@ -22,40 +22,28 @@
#define INCLUDED_SVX_FONTWORKGALLERY_HXX #define INCLUDED_SVX_FONTWORKGALLERY_HXX
#include <svx/svxdllapi.h> #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 <svtools/valueset.hxx>
#include <sfx2/tbxctrl.hxx> #include <sfx2/tbxctrl.hxx>
#include <vcl/weld.hxx>
#include <vector> #include <vector>
class FmFormModel; class FmFormModel;
class SdrView; class SdrView;
namespace vcl { class Window; }
class SdrTextObj; class SdrTextObj;
class SdrObject; class SdrObject;
class SdrModel; class SdrModel;
class SfxBindings; class SfxBindings;
namespace svx 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: public:
FontworkCharacterSpacingDialog( vcl::Window* pParent, sal_Int32 nScale ); FontworkCharacterSpacingDialog(weld::Window* pParent, sal_Int32 nScale);
virtual ~FontworkCharacterSpacingDialog() override; virtual ~FontworkCharacterSpacingDialog() override;
virtual void dispose() override;
sal_Int32 getScale() const; sal_Int32 getScale() const;
}; };
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include <vcl/scrbar.hxx> #include <vcl/scrbar.hxx>
#include <vcl/fixed.hxx> #include <vcl/fixed.hxx>
#include <vcl/button.hxx> #include <vcl/button.hxx>
#include <vcl/dialog.hxx>
#include <vcl/field.hxx> #include <vcl/field.hxx>
#include <svtools/extensionlistbox.hxx> #include <svtools/extensionlistbox.hxx>
......
...@@ -624,28 +624,20 @@ com_sun_star_comp_svx_FontworkCharacterSpacingControl_get_implementation( ...@@ -624,28 +624,20 @@ com_sun_star_comp_svx_FontworkCharacterSpacingControl_get_implementation(
return cppu::acquire(new FontworkCharacterSpacingControl(xContext)); return cppu::acquire(new FontworkCharacterSpacingControl(xContext));
} }
FontworkCharacterSpacingDialog::FontworkCharacterSpacingDialog(weld::Window* pParent, sal_Int32 nScale)
FontworkCharacterSpacingDialog::FontworkCharacterSpacingDialog( vcl::Window* pParent, sal_Int32 nScale ) : GenericDialogController(pParent, "svx/ui/fontworkspacingdialog.ui", "FontworkSpacingDialog")
: ModalDialog( pParent, "FontworkSpacingDialog" , "svx/ui/fontworkspacingdialog.ui" ) , m_xMtrScale(m_xBuilder->weld_metric_spin_button("entry", FUNIT_PERCENT))
{ {
get(m_pMtrScale, "entry"); m_xMtrScale->set_value(nScale, FUNIT_PERCENT);
m_pMtrScale->SetValue( nScale );
} }
FontworkCharacterSpacingDialog::~FontworkCharacterSpacingDialog() FontworkCharacterSpacingDialog::~FontworkCharacterSpacingDialog()
{ {
disposeOnce();
}
void FontworkCharacterSpacingDialog::dispose()
{
m_pMtrScale.clear();
ModalDialog::dispose();
} }
sal_Int32 FontworkCharacterSpacingDialog::getScale() const sal_Int32 FontworkCharacterSpacingDialog::getScale() const
{ {
return static_cast<sal_Int32>(m_pMtrScale->GetValue()); return static_cast<sal_Int32>(m_xMtrScale->get_value(FUNIT_PERCENT));
} }
} }
......
...@@ -471,11 +471,11 @@ void FontworkBar::execute( SdrView* pSdrView, SfxRequest const & rReq, SfxBindin ...@@ -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 ) ) if( rReq.GetArgs() && ( rReq.GetArgs()->GetItemState( SID_FONTWORK_CHARACTER_SPACING ) == SfxItemState::SET ) )
{ {
sal_Int32 nCharSpacing = rReq.GetArgs()->GetItem<SfxInt32Item>(SID_FONTWORK_CHARACTER_SPACING)->GetValue(); sal_Int32 nCharSpacing = rReq.GetArgs()->GetItem<SfxInt32Item>(SID_FONTWORK_CHARACTER_SPACING)->GetValue();
ScopedVclPtrInstance< FontworkCharacterSpacingDialog > aDlg( nullptr, nCharSpacing ); FontworkCharacterSpacingDialog aDlg(rReq.GetFrameWeld(), nCharSpacing);
sal_uInt16 nRet = aDlg->Execute(); sal_uInt16 nRet = aDlg.run();
if( nRet != 0 ) if (nRet != RET_CANCEL)
{ {
SfxInt32Item aItem( SID_FONTWORK_CHARACTER_SPACING, aDlg->getScale() ); SfxInt32Item aItem(SID_FONTWORK_CHARACTER_SPACING, aDlg.getScale());
SfxPoolItem* aItems[] = { &aItem, nullptr }; SfxPoolItem* aItems[] = { &aItem, nullptr };
rBindings.Execute( SID_FONTWORK_CHARACTER_SPACING, const_cast<const SfxPoolItem**>(aItems) ); rBindings.Execute( SID_FONTWORK_CHARACTER_SPACING, const_cast<const SfxPoolItem**>(aItems) );
} }
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface domain="svx"> <interface domain="svx">
<!-- interface-requires gtk+ 3.0 --> <requires lib="gtk+" version="3.0"/>
<object class="GtkAdjustment" id="adjustment1"> <object class="GtkAdjustment" id="adjustment1">
<property name="upper">500</property> <property name="upper">500</property>
<property name="value">100</property> <property name="value">100</property>
...@@ -12,42 +13,51 @@ ...@@ -12,42 +13,51 @@
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="title" translatable="yes" context="fontworkspacingdialog|FontworkSpacingDialog">Fontwork Character Spacing</property> <property name="title" translatable="yes" context="fontworkspacingdialog|FontworkSpacingDialog">Fontwork Character Spacing</property>
<property name="resizable">False</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> <property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1"> <object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">12</property> <property name="spacing">12</property>
<child> <child internal-child="action_area">
<object class="GtkBox" id="box1"> <object class="GtkButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="valign">start</property> <property name="layout_style">end</property>
<property name="hexpand">True</property>
<property name="spacing">12</property>
<child> <child>
<object class="GtkLabel" id="label2"> <object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">True</property>
<property name="label" translatable="yes" context="fontworkspacingdialog|label2">_Value:</property> <property name="can_default">True</property>
<property name="use_underline">True</property> <property name="has_default">True</property>
<property name="mnemonic_widget">entry:0%</property> <property name="receives_default">True</property>
<property name="use_stock">True</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<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="visible">True</property>
<property name="can_focus">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> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
...@@ -55,42 +65,40 @@ ...@@ -55,42 +65,40 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">0</property> <property name="pack_type">end</property>
<property name="position">1</property>
</packing> </packing>
</child> </child>
<child internal-child="action_area"> <child>
<object class="GtkButtonBox" id="dialog-action_area1"> <object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</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> <child>
<object class="GtkButton" id="ok"> <object class="GtkLabel" id="label2">
<property name="label">gtk-ok</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">False</property>
<property name="can_default">True</property> <property name="label" translatable="yes" context="fontworkspacingdialog|label2">_Value:</property>
<property name="has_default">True</property> <property name="use_underline">True</property>
<property name="receives_default">True</property> <property name="mnemonic_widget">entry</property>
<property name="use_stock">True</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="cancel"> <object class="GtkSpinButton" id="entry">
<property name="label">gtk-cancel</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="adjustment">adjustment1</property>
<property name="use_stock">True</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
...@@ -98,8 +106,7 @@ ...@@ -98,8 +106,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="pack_type">end</property> <property name="position">0</property>
<property name="position">1</property>
</packing> </packing>
</child> </child>
</object> </object>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment