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

weld OptionsBreakSet

Change-Id: I2f0f25b3573dabc940a117bb1cb5d3b56a81af0f
Reviewed-on: https://gerrit.libreoffice.org/52159Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 9d8ea0b8
......@@ -292,56 +292,42 @@ static inline OUString lcl_GetPropertyName( EID_OPTIONS eEntryId )
return OUString::createFromAscii( aEidToPropName[ static_cast<int>(eEntryId) ] );
}
class OptionsBreakSet : public ModalDialog
class OptionsBreakSet : public weld::GenericDialogController
{
VclPtr<VclFrame> m_pBeforeFrame;
VclPtr<VclFrame> m_pAfterFrame;
VclPtr<VclFrame> m_pMinimalFrame;
VclPtr<NumericField> m_pBreakNF;
std::unique_ptr<weld::Widget> m_xBeforeFrame;
std::unique_ptr<weld::Widget> m_xAfterFrame;
std::unique_ptr<weld::Widget> m_xMinimalFrame;
std::unique_ptr<weld::SpinButton> m_xBreakNF;
public:
OptionsBreakSet(vcl::Window* pParent, sal_uInt16 nRID)
: ModalDialog(pParent, "BreakNumberOption",
"cui/ui/breaknumberoption.ui")
, m_pBreakNF(nullptr)
OptionsBreakSet(weld::Window* pParent, sal_uInt16 nRID)
: GenericDialogController(pParent, "cui/ui/breaknumberoption.ui", "BreakNumberOption")
, m_xBeforeFrame(m_xBuilder->weld_widget("beforeframe"))
, m_xAfterFrame(m_xBuilder->weld_widget("afterframe"))
, m_xMinimalFrame(m_xBuilder->weld_widget("miniframe"))
{
get(m_pBeforeFrame, "beforeframe");
get(m_pAfterFrame, "afterframe");
get(m_pMinimalFrame, "miniframe");
assert(EID_NUM_PRE_BREAK == nRID ||
EID_NUM_POST_BREAK == nRID ||
EID_NUM_MIN_WORDLEN == nRID); //unexpected ID
assert(EID_NUM_PRE_BREAK == nRID || EID_NUM_POST_BREAK == nRID || EID_NUM_MIN_WORDLEN == nRID); //unexpected ID
if (nRID == EID_NUM_PRE_BREAK)
{
m_pBeforeFrame->Show();
get(m_pBreakNF, "beforebreak");
m_xBeforeFrame->show();
m_xBreakNF.reset(m_xBuilder->weld_spin_button("beforebreak"));
}
else if(nRID == EID_NUM_POST_BREAK)
{
m_pAfterFrame->Show();
get(m_pBreakNF, "afterbreak");
m_xAfterFrame->show();
m_xBreakNF.reset(m_xBuilder->weld_spin_button("afterbreak"));
}
else if(nRID == EID_NUM_MIN_WORDLEN)
{
m_pMinimalFrame->Show();
get(m_pBreakNF, "wordlength");
m_xMinimalFrame->show();
m_xBreakNF.reset(m_xBuilder->weld_spin_button("wordlength"));
}
}
virtual ~OptionsBreakSet() override { disposeOnce(); }
virtual void dispose() override
{
m_pBeforeFrame.clear();
m_pAfterFrame.clear();
m_pMinimalFrame.clear();
m_pBreakNF.clear();
ModalDialog::dispose();
}
NumericField& GetNumericFld()
weld::SpinButton& GetNumericFld()
{
return *m_pBreakNF;
return *m_xBreakNF;
}
};
......@@ -1623,11 +1609,11 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, Button *, pBtn, void )
if(aData.HasNumericValue())
{
sal_uInt16 nRID = aData.GetEntryId();
ScopedVclPtrInstance< OptionsBreakSet > aDlg(this, nRID);
aDlg->GetNumericFld().SetValue( aData.GetNumericValue() );
if (RET_OK == aDlg->Execute() )
OptionsBreakSet aDlg(GetFrameWeld(), nRID);
aDlg.GetNumericFld().set_value(aData.GetNumericValue());
if (RET_OK == aDlg.run())
{
long nVal = static_cast<long>(aDlg->GetNumericFld().GetValue());
long nVal = static_cast<long>(aDlg.GetNumericFld().get_value());
if (-1 != nVal && aData.GetNumericValue() != nVal)
{
aData.SetNumericValue( static_cast<sal_uInt8>(nVal) ); //! sets IsModified !
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.20.4 -->
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
<object class="GtkAdjustment" id="adjustment1">
......@@ -14,6 +14,8 @@
<property name="border_width">6</property>
<property name="title" translatable="yes" context="breaknumberoption|BreakNumberOption">Hyphenation</property>
<property name="resizable">False</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
......@@ -84,7 +86,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">start</property>
<property name="invisible_char"></property>
<property name="activates_default">True</property>
<property name="adjustment">adjustment1</property>
</object>
</child>
......@@ -123,7 +125,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">start</property>
<property name="invisible_char"></property>
<property name="activates_default">True</property>
<property name="adjustment">adjustment1</property>
</object>
</child>
......@@ -162,7 +164,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">start</property>
<property name="invisible_char"></property>
<property name="activates_default">True</property>
<property name="adjustment">adjustment1</property>
</object>
</child>
......@@ -197,5 +199,8 @@
<action-widget response="-5">ok</action-widget>
<action-widget response="-6">cancel</action-widget>
</action-widgets>
<child>
<placeholder/>
</child>
</object>
</interface>
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