weld ScSolverValueDialog
Change-Id: I1c55d184052482fc472d66069ea8722cd27d1543 Reviewed-on: https://gerrit.libreoffice.org/54353 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:
@@ -83,15 +83,14 @@ public:
|
|||||||
sal_Int32 GetValue() const;
|
sal_Int32 GetValue() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ScSolverValueDialog : public ModalDialog
|
class ScSolverValueDialog : public weld::GenericDialogController
|
||||||
{
|
{
|
||||||
VclPtr<VclFrame> m_pFrame;
|
std::unique_ptr<weld::Frame> m_xFrame;
|
||||||
VclPtr<Edit> m_pEdValue;
|
std::unique_ptr<weld::Entry> m_xEdValue;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScSolverValueDialog( vcl::Window * pParent );
|
ScSolverValueDialog(weld::Window* pParent);
|
||||||
virtual ~ScSolverValueDialog() override;
|
virtual ~ScSolverValueDialog() override;
|
||||||
virtual void dispose() override;
|
|
||||||
|
|
||||||
void SetOptionName( const OUString& rName );
|
void SetOptionName( const OUString& rName );
|
||||||
void SetValue( double fValue );
|
void SetValue( double fValue );
|
||||||
|
@@ -322,12 +322,12 @@ void ScSolverOptionsDialog::EditOption()
|
|||||||
{
|
{
|
||||||
if ( pStringItem->IsDouble() )
|
if ( pStringItem->IsDouble() )
|
||||||
{
|
{
|
||||||
ScopedVclPtrInstance< ScSolverValueDialog > aValDialog( this );
|
ScSolverValueDialog aValDialog(GetFrameWeld());
|
||||||
aValDialog->SetOptionName( pStringItem->GetText() );
|
aValDialog.SetOptionName( pStringItem->GetText() );
|
||||||
aValDialog->SetValue( pStringItem->GetDoubleValue() );
|
aValDialog.SetValue( pStringItem->GetDoubleValue() );
|
||||||
if ( aValDialog->Execute() == RET_OK )
|
if (aValDialog.run() == RET_OK)
|
||||||
{
|
{
|
||||||
pStringItem->SetDoubleValue( aValDialog->GetValue() );
|
pStringItem->SetDoubleValue( aValDialog.GetValue() );
|
||||||
m_pLbSettings->InvalidateEntry( pEntry );
|
m_pLbSettings->InvalidateEntry( pEntry );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -429,41 +429,32 @@ sal_Int32 ScSolverIntegerDialog::GetValue() const
|
|||||||
return static_cast<sal_Int32>(nValue);
|
return static_cast<sal_Int32>(nValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScSolverValueDialog::ScSolverValueDialog( vcl::Window * pParent )
|
ScSolverValueDialog::ScSolverValueDialog(weld::Window* pParent)
|
||||||
: ModalDialog( pParent, "DoubleDialog",
|
: GenericDialogController(pParent, "modules/scalc/ui/doubledialog.ui", "DoubleDialog")
|
||||||
"modules/scalc/ui/doubledialog.ui" )
|
, m_xFrame(m_xBuilder->weld_frame("frame"))
|
||||||
|
, m_xEdValue(m_xBuilder->weld_entry("value"))
|
||||||
{
|
{
|
||||||
get(m_pFrame, "frame");
|
|
||||||
get(m_pEdValue, "value");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ScSolverValueDialog::~ScSolverValueDialog()
|
ScSolverValueDialog::~ScSolverValueDialog()
|
||||||
{
|
{
|
||||||
disposeOnce();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScSolverValueDialog::dispose()
|
|
||||||
{
|
|
||||||
m_pFrame.clear();
|
|
||||||
m_pEdValue.clear();
|
|
||||||
ModalDialog::dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScSolverValueDialog::SetOptionName( const OUString& rName )
|
void ScSolverValueDialog::SetOptionName( const OUString& rName )
|
||||||
{
|
{
|
||||||
m_pFrame->set_label(rName);
|
m_xFrame->set_label(rName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScSolverValueDialog::SetValue( double fValue )
|
void ScSolverValueDialog::SetValue( double fValue )
|
||||||
{
|
{
|
||||||
m_pEdValue->SetText( rtl::math::doubleToUString( fValue,
|
m_xEdValue->set_text( rtl::math::doubleToUString( fValue,
|
||||||
rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
|
rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
|
||||||
ScGlobal::GetpLocaleData()->getNumDecimalSep()[0], true ) );
|
ScGlobal::GetpLocaleData()->getNumDecimalSep()[0], true ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
double ScSolverValueDialog::GetValue() const
|
double ScSolverValueDialog::GetValue() const
|
||||||
{
|
{
|
||||||
OUString aInput = m_pEdValue->GetText();
|
OUString aInput = m_xEdValue->get_text();
|
||||||
|
|
||||||
rtl_math_ConversionStatus eStatus = rtl_math_ConversionStatus_Ok;
|
rtl_math_ConversionStatus eStatus = rtl_math_ConversionStatus_Ok;
|
||||||
sal_Int32 nParseEnd = 0;
|
sal_Int32 nParseEnd = 0;
|
||||||
|
@@ -1,11 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Generated with glade 3.22.1 -->
|
||||||
<interface domain="sc">
|
<interface domain="sc">
|
||||||
<!-- interface-requires gtk+ 3.0 -->
|
<requires lib="gtk+" version="3.0"/>
|
||||||
<object class="GtkDialog" id="DoubleDialog">
|
<object class="GtkDialog" id="DoubleDialog">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="border_width">6</property>
|
<property name="border_width">6</property>
|
||||||
<property name="title" translatable="yes" context="doubledialog|DoubleDialog">Edit Setting</property>
|
<property name="title" translatable="yes" context="doubledialog|DoubleDialog">Edit Setting</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>
|
||||||
@@ -75,6 +82,7 @@
|
|||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="halign">start</property>
|
<property name="halign">start</property>
|
||||||
<property name="valign">start</property>
|
<property name="valign">start</property>
|
||||||
|
<property name="activates_default">True</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
@@ -83,6 +83,7 @@
|
|||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="halign">start</property>
|
<property name="halign">start</property>
|
||||||
<property name="valign">start</property>
|
<property name="valign">start</property>
|
||||||
|
<property name="activates_default">True</property>
|
||||||
<property name="adjustment">adjustment1</property>
|
<property name="adjustment">adjustment1</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
Reference in New Issue
Block a user