cui/source/dialogs/cuitbxform.cxx | 28 +--------- cui/source/factory/dlgfact.cxx | 15 +++-- cui/source/factory/dlgfact.hxx | 11 +++- cui/source/inc/cuitbxform.hxx | 17 ++---- cui/uiconfig/ui/recordnumberdialog.ui | 77 +++++++++++++++++------------- include/svx/svxdlg.hxx | 2 svx/inc/extrusiondepthdialog.hxx | 12 +--- svx/source/form/fmshell.cxx | 4 - svx/source/tbxctrls/extrusioncontrols.cxx | 19 +------ svx/source/toolbars/extrusionbar.cxx | 8 +-- svx/uiconfig/ui/extrustiondepthdialog.ui | 19 ++++--- 11 files changed, 101 insertions(+), 111 deletions(-)
New commits: commit 6f2bbb3641f4e8fc26c20181ba790362e7472892 Author: Caolán McNamara <caol...@redhat.com> Date: Mon May 14 11:50:32 2018 +0100 weld ExtrusionDepthDialog Change-Id: I5905fea310a7f29574d94eaf61c80b6ca09a7467 Reviewed-on: https://gerrit.libreoffice.org/54310 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> 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> commit 165e57d6c9b980f22e57fb1c4c70d9a8c4aaf1c8 Author: Caolán McNamara <caol...@redhat.com> Date: Mon May 14 11:37:47 2018 +0100 weld FmInputRecordNoDialog Change-Id: I87f3dc3a576e30fe50871c14a67a5b777c21d3ba Reviewed-on: https://gerrit.libreoffice.org/54308 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/cui/source/dialogs/cuitbxform.cxx b/cui/source/dialogs/cuitbxform.cxx index eaccdc120a04..eb0a768149d5 100644 --- a/cui/source/dialogs/cuitbxform.cxx +++ b/cui/source/dialogs/cuitbxform.cxx @@ -17,37 +17,17 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <string> -#include <svl/intitem.hxx> -#include <svl/eitem.hxx> -#include <svl/stritem.hxx> -#include <sfx2/dispatch.hxx> -#include <vcl/toolbox.hxx> -#include <vcl/fixed.hxx> #include <cuitbxform.hxx> -#include <sfx2/viewfrm.hxx> -#include <sfx2/viewsh.hxx> -FmInputRecordNoDialog::FmInputRecordNoDialog(vcl::Window * pParent) - : ModalDialog( pParent, "RecordNumberDialog", "cui/ui/recordnumberdialog.ui") +FmInputRecordNoDialog::FmInputRecordNoDialog(weld::Window * pParent) + : GenericDialogController(pParent, "cui/ui/recordnumberdialog.ui", "RecordNumberDialog") + , m_xRecordNo(m_xBuilder->weld_spin_button("entry")) { - get(m_pRecordNo, "entry-nospin"); - - m_pRecordNo->SetMin(1); - m_pRecordNo->SetMax(0x7FFFFFFF); - m_pRecordNo->SetStrictFormat(true); - m_pRecordNo->SetDecimalDigits(0); + m_xRecordNo->set_range(1, 0x7FFFFFFF); } FmInputRecordNoDialog::~FmInputRecordNoDialog() { - disposeOnce(); -} - -void FmInputRecordNoDialog::dispose() -{ - m_pRecordNo.clear(); - ModalDialog::dispose(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index a22a64c1f933..0bf6ea154642 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -124,7 +124,11 @@ short AbstractSvxSearchSimilarityDialog_Impl::Execute() IMPL_ABSTDLG_BASE(AbstractSvxTransformTabDialog_Impl); IMPL_ABSTDLG_BASE(AbstractSvxCaptionDialog_Impl); IMPL_ABSTDLG_BASE(AbstractSvxJSearchOptionsDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractFmInputRecordNoDialog_Impl); + +short AbstractFmInputRecordNoDialog_Impl::Execute() +{ + return m_xDlg->run(); +} short AbstractSvxNewDictionaryDialog_Impl::Execute() { @@ -630,12 +634,12 @@ TransliterationFlags AbstractSvxJSearchOptionsDialog_Impl::GetTransliterationFla void AbstractFmInputRecordNoDialog_Impl::SetValue(long nNew) { - pDlg->SetValue(nNew); + m_xDlg->SetValue(nNew); } long AbstractFmInputRecordNoDialog_Impl::GetValue() const { - return pDlg->GetValue(); + return m_xDlg->GetValue(); } ::Reference< css::linguistic2::XDictionary > AbstractSvxNewDictionaryDialog_Impl::GetNewDictionary() @@ -1169,10 +1173,9 @@ VclPtr<AbstractSvxJSearchOptionsDialog> AbstractDialogFactory_Impl::CreateSvxJSe return VclPtr<AbstractSvxJSearchOptionsDialog_Impl>::Create( pDlg ); } -VclPtr<AbstractFmInputRecordNoDialog> AbstractDialogFactory_Impl::CreateFmInputRecordNoDialog( ) +VclPtr<AbstractFmInputRecordNoDialog> AbstractDialogFactory_Impl::CreateFmInputRecordNoDialog(weld::Window* pParent) { - VclPtrInstance<FmInputRecordNoDialog> pDlg( nullptr ); - return VclPtr<AbstractFmInputRecordNoDialog_Impl>::Create( pDlg ); + return VclPtr<AbstractFmInputRecordNoDialog_Impl>::Create(new FmInputRecordNoDialog(pParent)); } VclPtr<AbstractSvxNewDictionaryDialog> AbstractDialogFactory_Impl::CreateSvxNewDictionaryDialog(weld::Window* pParent) diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index b1239c049e00..e5be4de5f999 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -314,7 +314,14 @@ class AbstractSvxCaptionDialog_Impl : public AbstractSvxCaptionDialog class FmInputRecordNoDialog; class AbstractFmInputRecordNoDialog_Impl :public AbstractFmInputRecordNoDialog { - DECL_ABSTDLG_BASE(AbstractFmInputRecordNoDialog_Impl,FmInputRecordNoDialog) +protected: + std::unique_ptr<FmInputRecordNoDialog> m_xDlg; +public: + explicit AbstractFmInputRecordNoDialog_Impl(FmInputRecordNoDialog* p) + : m_xDlg(p) + { + } + virtual short Execute() override; virtual void SetValue(long nNew) override ; virtual long GetValue() const override ; }; @@ -682,7 +689,7 @@ public: virtual VclPtr<AbstractSvxJSearchOptionsDialog> CreateSvxJSearchOptionsDialog( vcl::Window* pParent, const SfxItemSet& rOptionsSet, TransliterationFlags nInitialFlags) override; - virtual VclPtr<AbstractFmInputRecordNoDialog> CreateFmInputRecordNoDialog() override; + virtual VclPtr<AbstractFmInputRecordNoDialog> CreateFmInputRecordNoDialog(weld::Window* pParent) override; virtual VclPtr<AbstractSvxNewDictionaryDialog> CreateSvxNewDictionaryDialog(weld::Window* pParent) override; virtual VclPtr<VclAbstractDialog> CreateSvxEditDictionaryDialog(vcl::Window* pParent, const OUString& rName) override; virtual VclPtr<AbstractSvxNameDialog> CreateSvxNameDialog(weld::Window* pParent, diff --git a/cui/source/inc/cuitbxform.hxx b/cui/source/inc/cuitbxform.hxx index 5eefc5712b61..96d41c09002b 100644 --- a/cui/source/inc/cuitbxform.hxx +++ b/cui/source/inc/cuitbxform.hxx @@ -19,24 +19,19 @@ #ifndef INCLUDED_CUI_SOURCE_INC_CUITBXFORM_HXX #define INCLUDED_CUI_SOURCE_INC_CUITBXFORM_HXX -#include <sfx2/tbxctrl.hxx> -#include <vcl/button.hxx> -#include <vcl/dialog.hxx> -#include <vcl/field.hxx> +#include <vcl/weld.hxx> - -class FmInputRecordNoDialog : public ModalDialog +class FmInputRecordNoDialog : public weld::GenericDialogController { public: - VclPtr<NumericField> m_pRecordNo; + std::unique_ptr<weld::SpinButton> m_xRecordNo; public: - FmInputRecordNoDialog(vcl::Window * pParent); + FmInputRecordNoDialog(weld::Window* pParent); virtual ~FmInputRecordNoDialog() override; - virtual void dispose() override; - void SetValue(long dNew) { m_pRecordNo->SetValue(dNew); } - long GetValue() const { return static_cast<long>(m_pRecordNo->GetValue()); } + void SetValue(int dNew) { m_xRecordNo->set_value(dNew); } + int GetValue() const { return m_xRecordNo->get_value(); } }; #endif diff --git a/cui/uiconfig/ui/recordnumberdialog.ui b/cui/uiconfig/ui/recordnumberdialog.ui index d191d09fb263..fbad4ea3895e 100644 --- a/cui/uiconfig/ui/recordnumberdialog.ui +++ b/cui/uiconfig/ui/recordnumberdialog.ui @@ -1,45 +1,61 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> - <!-- interface-requires gtk+ 3.0 --> + <requires lib="gtk+" version="3.0"/> + <object class="GtkAdjustment" id="adjustment1"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> <object class="GtkDialog" id="RecordNumberDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="recordnumberdialog|RecordNumberDialog">Record Number</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="recordnumberdialog|label2">go to record</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">entry-nospin</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-nospin"> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> <property name="visible">True</property> <property name="can_focus">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">1</property> </packing> </child> @@ -47,42 +63,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="recordnumberdialog|label2">go to record</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> @@ -90,8 +104,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> diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx index 1d8b43f4c7b0..d877eaef4add 100644 --- a/include/svx/svxdlg.hxx +++ b/include/svx/svxdlg.hxx @@ -396,7 +396,7 @@ public: virtual VclPtr<AbstractSvxJSearchOptionsDialog> CreateSvxJSearchOptionsDialog( vcl::Window* pParent, const SfxItemSet& rOptionsSet, TransliterationFlags nInitialFlags )=0; - virtual VclPtr<AbstractFmInputRecordNoDialog> CreateFmInputRecordNoDialog() = 0; + virtual VclPtr<AbstractFmInputRecordNoDialog> CreateFmInputRecordNoDialog(weld::Window* pParent) = 0; virtual VclPtr<AbstractSvxNewDictionaryDialog> CreateSvxNewDictionaryDialog(weld::Window* pParent) = 0; virtual VclPtr<VclAbstractDialog> CreateSvxEditDictionaryDialog( vcl::Window* pParent, const OUString& rName) = 0; diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx index fdd8f4a81085..d23f5f821743 100644 --- a/svx/source/form/fmshell.cxx +++ b/svx/source/form/fmshell.cxx @@ -732,8 +732,8 @@ void FmFormShell::Execute(SfxRequest &rReq) DBG_ASSERT( pFact, "no dialog factory!" ); if ( pFact ) { - ScopedVclPtr< AbstractFmInputRecordNoDialog > dlg( pFact->CreateFmInputRecordNoDialog() ); - DBG_ASSERT( dlg.get(), "Dialog creation failed!" ); + ScopedVclPtr<AbstractFmInputRecordNoDialog> dlg(pFact->CreateFmInputRecordNoDialog(rReq.GetFrameWeld())); + assert(dlg.get() && "Dialog creation failed!"); dlg->SetValue( rController->getCursor()->getRow() ); if ( dlg->Execute() == RET_OK ) nRecord = dlg->GetValue(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits