summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-05-14 11:50:32 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-05-14 14:07:06 +0200
commit6f2bbb3641f4e8fc26c20181ba790362e7472892 (patch)
tree2c27320700a527399ab1b0049661ef54f7c77b4f
parentweld FmInputRecordNoDialog (diff)
downloadcore-6f2bbb3641f4e8fc26c20181ba790362e7472892.tar.gz
core-6f2bbb3641f4e8fc26c20181ba790362e7472892.zip
weld ExtrusionDepthDialog
Change-Id: I5905fea310a7f29574d94eaf61c80b6ca09a7467 Reviewed-on: https://gerrit.libreoffice.org/54310 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--svx/inc/extrusiondepthdialog.hxx12
-rw-r--r--svx/source/tbxctrls/extrusioncontrols.cxx19
-rw-r--r--svx/source/toolbars/extrusionbar.cxx8
-rw-r--r--svx/uiconfig/ui/extrustiondepthdialog.ui19
4 files changed, 25 insertions, 33 deletions
diff --git a/svx/inc/extrusiondepthdialog.hxx b/svx/inc/extrusiondepthdialog.hxx
index fb306b992c5b..0e06add86b9e 100644
--- a/svx/inc/extrusiondepthdialog.hxx
+++ b/svx/inc/extrusiondepthdialog.hxx
@@ -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;
};
diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx
index 2b8ddd842639..71e4a56eec34 100644
--- a/svx/source/tbxctrls/extrusioncontrols.cxx
+++ b/svx/source/tbxctrls/extrusioncontrols.cxx
@@ -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 };
diff --git a/svx/source/toolbars/extrusionbar.cxx b/svx/source/toolbars/extrusionbar.cxx
index f3e0b30bea98..c7fc165671bb 100644
--- a/svx/source/toolbars/extrusionbar.cxx
+++ b/svx/source/toolbars/extrusionbar.cxx
@@ -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 };
diff --git a/svx/uiconfig/ui/extrustiondepthdialog.ui b/svx/uiconfig/ui/extrustiondepthdialog.ui
index a1f357c39947..ad07eb7040f8 100644
--- a/svx/uiconfig/ui/extrustiondepthdialog.ui
+++ b/svx/uiconfig/ui/extrustiondepthdialog.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.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>