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 @@
#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;
};
......
......@@ -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>
......
......@@ -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));
}
}
......
......@@ -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) );
}
......
<?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>
......
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