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