diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-05-14 11:37:47 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-05-14 14:06:53 +0200 |
commit | 165e57d6c9b980f22e57fb1c4c70d9a8c4aaf1c8 (patch) | |
tree | b1db42500f85273d481f701b4fe0a387ca354868 | |
parent | c7ac8480c9df601a58bad892c472dcf7c5e9dc01 (diff) |
weld FmInputRecordNoDialog
Change-Id: I87f3dc3a576e30fe50871c14a67a5b777c21d3ba
Reviewed-on: https://gerrit.libreoffice.org/54308
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | cui/source/dialogs/cuitbxform.cxx | 28 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.cxx | 15 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.hxx | 11 | ||||
-rw-r--r-- | cui/source/inc/cuitbxform.hxx | 17 | ||||
-rw-r--r-- | cui/uiconfig/ui/recordnumberdialog.ui | 77 | ||||
-rw-r--r-- | include/svx/svxdlg.hxx | 2 | ||||
-rw-r--r-- | svx/source/form/fmshell.cxx | 4 |
7 files changed, 76 insertions, 78 deletions
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(); |