summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-03-30 17:21:49 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-03-31 20:49:21 +0200
commitc8af8aebd1336e919e9531e39f84296085d91ea7 (patch)
tree4560966b0a00e34667384d7c17fba41b2f1f34ea /cui
parent9d8ea0b8ef6388e763a095e51ce9e8f85f86ad49 (diff)
weld OptionsBreakSet
Change-Id: I2f0f25b3573dabc940a117bb1cb5d3b56a81af0f Reviewed-on: https://gerrit.libreoffice.org/52159 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/options/optlingu.cxx60
-rw-r--r--cui/uiconfig/ui/breaknumberoption.ui13
2 files changed, 32 insertions, 41 deletions
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index 1b4e70de8f7a..6d04a6f4d435 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -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 !
diff --git a/cui/uiconfig/ui/breaknumberoption.ui b/cui/uiconfig/ui/breaknumberoption.ui
index ab99479e0983..0f60f687762d 100644
--- a/cui/uiconfig/ui/breaknumberoption.ui
+++ b/cui/uiconfig/ui/breaknumberoption.ui
@@ -1,5 +1,5 @@
<?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>