weld ScSolverIntegerDialog
Change-Id: I4d7196ead0dd60fe4b40af72a1c7ec64c5a2315a Reviewed-on: https://gerrit.libreoffice.org/54352 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
#include <vcl/fixed.hxx>
|
#include <vcl/fixed.hxx>
|
||||||
#include <vcl/layout.hxx>
|
#include <vcl/layout.hxx>
|
||||||
#include <vcl/lstbox.hxx>
|
#include <vcl/lstbox.hxx>
|
||||||
|
#include <vcl/weld.hxx>
|
||||||
#include <svx/checklbx.hxx>
|
#include <svx/checklbx.hxx>
|
||||||
#include <com/sun/star/uno/Sequence.hxx>
|
#include <com/sun/star/uno/Sequence.hxx>
|
||||||
|
|
||||||
@@ -68,15 +69,14 @@ public:
|
|||||||
const css::uno::Sequence<css::beans::PropertyValue>& GetProperties();
|
const css::uno::Sequence<css::beans::PropertyValue>& GetProperties();
|
||||||
};
|
};
|
||||||
|
|
||||||
class ScSolverIntegerDialog : public ModalDialog
|
class ScSolverIntegerDialog : public weld::GenericDialogController
|
||||||
{
|
{
|
||||||
VclPtr<VclFrame> m_pFrame;
|
std::unique_ptr<weld::Frame> m_xFrame;
|
||||||
VclPtr<NumericField> m_pNfValue;
|
std::unique_ptr<weld::SpinButton> m_xNfValue;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScSolverIntegerDialog( vcl::Window * pParent );
|
ScSolverIntegerDialog(weld::Window* pParent);
|
||||||
virtual ~ScSolverIntegerDialog() override;
|
virtual ~ScSolverIntegerDialog() override;
|
||||||
virtual void dispose() override;
|
|
||||||
|
|
||||||
void SetOptionName( const OUString& rName );
|
void SetOptionName( const OUString& rName );
|
||||||
void SetValue( sal_Int32 nValue );
|
void SetValue( sal_Int32 nValue );
|
||||||
|
@@ -333,12 +333,12 @@ void ScSolverOptionsDialog::EditOption()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ScopedVclPtrInstance< ScSolverIntegerDialog > aIntDialog( this );
|
ScSolverIntegerDialog aIntDialog(GetFrameWeld());
|
||||||
aIntDialog->SetOptionName( pStringItem->GetText() );
|
aIntDialog.SetOptionName( pStringItem->GetText() );
|
||||||
aIntDialog->SetValue( pStringItem->GetIntValue() );
|
aIntDialog.SetValue( pStringItem->GetIntValue() );
|
||||||
if ( aIntDialog->Execute() == RET_OK )
|
if (aIntDialog.run() == RET_OK)
|
||||||
{
|
{
|
||||||
pStringItem->SetIntValue( aIntDialog->GetValue() );
|
pStringItem->SetIntValue(aIntDialog.GetValue());
|
||||||
m_pLbSettings->InvalidateEntry( pEntry );
|
m_pLbSettings->InvalidateEntry( pEntry );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -389,44 +389,30 @@ IMPL_LINK_NOARG(ScSolverOptionsDialog, SettingsSelHdl, SvTreeListBox*, void)
|
|||||||
m_pBtnEdit->Enable( !bCheckbox );
|
m_pBtnEdit->Enable( !bCheckbox );
|
||||||
}
|
}
|
||||||
|
|
||||||
ScSolverIntegerDialog::ScSolverIntegerDialog(vcl::Window * pParent)
|
ScSolverIntegerDialog::ScSolverIntegerDialog(weld::Window * pParent)
|
||||||
: ModalDialog( pParent, "IntegerDialog",
|
: GenericDialogController(pParent, "modules/scalc/ui/integerdialog.ui", "IntegerDialog")
|
||||||
"modules/scalc/ui/integerdialog.ui" )
|
, m_xFrame(m_xBuilder->weld_frame("frame"))
|
||||||
|
, m_xNfValue(m_xBuilder->weld_spin_button("value"))
|
||||||
{
|
{
|
||||||
get(m_pFrame, "frame");
|
|
||||||
get(m_pNfValue, "value");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ScSolverIntegerDialog::~ScSolverIntegerDialog()
|
ScSolverIntegerDialog::~ScSolverIntegerDialog()
|
||||||
{
|
{
|
||||||
disposeOnce();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScSolverIntegerDialog::dispose()
|
|
||||||
{
|
|
||||||
m_pFrame.clear();
|
|
||||||
m_pNfValue.clear();
|
|
||||||
ModalDialog::dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScSolverIntegerDialog::SetOptionName( const OUString& rName )
|
void ScSolverIntegerDialog::SetOptionName( const OUString& rName )
|
||||||
{
|
{
|
||||||
m_pFrame->set_label(rName);
|
m_xFrame->set_label(rName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScSolverIntegerDialog::SetValue( sal_Int32 nValue )
|
void ScSolverIntegerDialog::SetValue( sal_Int32 nValue )
|
||||||
{
|
{
|
||||||
m_pNfValue->SetValue( nValue );
|
m_xNfValue->set_value( nValue );
|
||||||
}
|
}
|
||||||
|
|
||||||
sal_Int32 ScSolverIntegerDialog::GetValue() const
|
sal_Int32 ScSolverIntegerDialog::GetValue() const
|
||||||
{
|
{
|
||||||
sal_Int64 nValue = m_pNfValue->GetValue();
|
return m_xNfValue->get_value();
|
||||||
if ( nValue < SAL_MIN_INT32 )
|
|
||||||
return SAL_MIN_INT32;
|
|
||||||
if ( nValue > SAL_MAX_INT32 )
|
|
||||||
return SAL_MAX_INT32;
|
|
||||||
return static_cast<sal_Int32>(nValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ScSolverValueDialog::ScSolverValueDialog(weld::Window* pParent)
|
ScSolverValueDialog::ScSolverValueDialog(weld::Window* pParent)
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Generated with glade 3.18.3 -->
|
<!-- Generated with glade 3.22.1 -->
|
||||||
<interface domain="sc">
|
<interface domain="sc">
|
||||||
<requires lib="gtk+" version="3.18"/>
|
<requires lib="gtk+" version="3.18"/>
|
||||||
<object class="GtkAdjustment" id="adjustment1">
|
<object class="GtkAdjustment" id="adjustment1">
|
||||||
@@ -13,7 +13,13 @@
|
|||||||
<property name="border_width">6</property>
|
<property name="border_width">6</property>
|
||||||
<property name="title" translatable="yes" context="integerdialog|IntegerDialog">Edit Setting</property>
|
<property name="title" translatable="yes" context="integerdialog|IntegerDialog">Edit Setting</property>
|
||||||
<property name="resizable">False</property>
|
<property name="resizable">False</property>
|
||||||
|
<property name="modal">True</property>
|
||||||
|
<property name="default_width">0</property>
|
||||||
|
<property name="default_height">0</property>
|
||||||
<property name="type_hint">dialog</property>
|
<property name="type_hint">dialog</property>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
<child internal-child="vbox">
|
<child internal-child="vbox">
|
||||||
<object class="GtkBox" id="dialog-vbox1">
|
<object class="GtkBox" id="dialog-vbox1">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
Reference in New Issue
Block a user