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

weld ExtrusionDepthDialog

Change-Id: I5905fea310a7f29574d94eaf61c80b6ca09a7467
Reviewed-on: https://gerrit.libreoffice.org/54310Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 165e57d6
......@@ -22,21 +22,17 @@
#include <svx/svxdllapi.h>
#include <vcl/fixed.hxx>
#include <vcl/dialog.hxx>
#include <vcl/button.hxx>
#include <vcl/field.hxx>
#include <vcl/weld.hxx>
namespace svx {
class ExtrusionDepthDialog : public ModalDialog
class ExtrusionDepthDialog : public weld::GenericDialogController
{
VclPtr<MetricField> m_pMtrDepth;
std::unique_ptr<weld::MetricSpinButton> m_xMtrDepth;
public:
ExtrusionDepthDialog( vcl::Window* pParent, double fDepth, FieldUnit eDefaultUnit );
ExtrusionDepthDialog(weld::Window* pParent, double fDepth, FieldUnit eDefaultUnit);
virtual ~ExtrusionDepthDialog() override;
virtual void dispose() override;
double getDepth() const;
};
......
......@@ -346,34 +346,25 @@ OUString SAL_CALL ExtrusionDirectionControl::getImplementationName( )
return ExtrusionDirectionControl_getImplementationName();
}
Sequence< OUString > SAL_CALL ExtrusionDirectionControl::getSupportedServiceNames( )
{
return ExtrusionDirectionControl_getSupportedServiceNames();
}
ExtrusionDepthDialog::ExtrusionDepthDialog( vcl::Window* pParent, double fDepth, FieldUnit eDefaultUnit )
: ModalDialog( pParent, "ExtrustionDepthDialog", "svx/ui/extrustiondepthdialog.ui" )
ExtrusionDepthDialog::ExtrusionDepthDialog(weld::Window* pParent, double fDepth, FieldUnit eDefaultUnit)
: GenericDialogController(pParent, "svx/ui/extrustiondepthdialog.ui", "ExtrustionDepthDialog")
, m_xMtrDepth(m_xBuilder->weld_metric_spin_button("depth", eDefaultUnit))
{
get(m_pMtrDepth, "depth");
m_pMtrDepth->SetUnit( eDefaultUnit );
m_pMtrDepth->SetValue( static_cast<int>(fDepth) * 100, FUNIT_100TH_MM );
m_xMtrDepth->set_value(static_cast<int>(fDepth) * 100, FUNIT_100TH_MM);
}
ExtrusionDepthDialog::~ExtrusionDepthDialog()
{
disposeOnce();
}
void ExtrusionDepthDialog::dispose()
{
m_pMtrDepth.clear();
ModalDialog::dispose();
}
double ExtrusionDepthDialog::getDepth() const
{
return static_cast<double>( m_pMtrDepth->GetValue( FUNIT_100TH_MM ) ) / 100.0;
return static_cast<double>(m_xMtrDepth->get_value(FUNIT_100TH_MM)) / 100.0;
}
double const aDepthListInch[] = { 0, 1270,2540,5080,10160 };
......
......@@ -570,11 +570,11 @@ void ExtrusionBar::execute( SdrView* pSdrView, SfxRequest const & rReq, SfxBindi
double fDepth = rReq.GetArgs()->GetItem<SvxDoubleItem>(SID_EXTRUSION_DEPTH)->GetValue();
FieldUnit eUnit = static_cast<FieldUnit>(rReq.GetArgs()->GetItem<SfxUInt16Item>(SID_ATTR_METRIC)->GetValue());
ScopedVclPtrInstance< ExtrusionDepthDialog > aDlg(nullptr, fDepth, eUnit);
sal_uInt16 nRet = aDlg->Execute();
if( nRet != 0 )
ExtrusionDepthDialog aDlg(rReq.GetFrameWeld(), fDepth, eUnit);
sal_uInt16 nRet = aDlg.run();
if (nRet == RET_OK)
{
fDepth = aDlg->getDepth();
fDepth = aDlg.getDepth();
SvxDoubleItem aItem( fDepth, SID_EXTRUSION_DEPTH );
SfxPoolItem* aItems[] = { &aItem, nullptr };
......
<?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.18"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">338.666</property>
<property name="step_increment">0.10000000000000001</property>
......@@ -10,7 +11,13 @@
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="extrustiondepthdialog|ExtrustionDepthDialog">Extrusion Depth</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>
......@@ -62,6 +69,7 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="secondary">True</property>
</packing>
</child>
</object>
......@@ -95,17 +103,16 @@
<property name="hexpand">True</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkSpinButton" id="depth:0.00cm">
<object class="GtkSpinButton" id="depth">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activates_default">True</property>
<property name="adjustment">adjustment1</property>
<property name="digits">2</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
......@@ -114,13 +121,11 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="extrustiondepthdialog|label1">_Value</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">depth:0.00cm</property>
<property name="mnemonic_widget">depth</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</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