Kaydet (Commit) 165e57d6 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld FmInputRecordNoDialog

Change-Id: I87f3dc3a576e30fe50871c14a67a5b777c21d3ba
Reviewed-on: https://gerrit.libreoffice.org/54308Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst c7ac8480
......@@ -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: */
......@@ -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)
......
......@@ -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,
......
......@@ -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
......
<?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>
......
......@@ -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;
......
......@@ -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();
......
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