summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-07-26 20:32:10 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-07-27 12:52:26 +0200
commit31bdf49b8c96f408d7b02c9925633eb419f65211 (patch)
treea1ece66983228b497164c96d2f24f13f654196a1
parentac1ae3e055f9104b40a12a8f5b6418817230af0d (diff)
weld SvxAsianLayoutPage
Change-Id: I0bea0026177dcb056edd073cdd9c51e76273d169 Reviewed-on: https://gerrit.libreoffice.org/76456 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--cui/source/inc/optasian.hxx45
-rw-r--r--cui/source/options/optasian.cxx169
-rw-r--r--cui/uiconfig/ui/optasianpage.ui21
3 files changed, 102 insertions, 133 deletions
diff --git a/cui/source/inc/optasian.hxx b/cui/source/inc/optasian.hxx
index c6999c279460..1aaeafa583df 100644
--- a/cui/source/inc/optasian.hxx
+++ b/cui/source/inc/optasian.hxx
@@ -21,41 +21,34 @@
#include <memory>
#include <sfx2/tabdlg.hxx>
-#include <vcl/button.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/lstbox.hxx>
-#include <vcl/edit.hxx>
#include <svx/langbox.hxx>
+
struct SvxAsianLayoutPage_Impl;
class SvxAsianLayoutPage : public SfxTabPage
{
- VclPtr<RadioButton> m_pCharKerningRB;
- VclPtr<RadioButton> m_pCharPunctKerningRB;
-
- VclPtr<RadioButton> m_pNoCompressionRB;
- VclPtr<RadioButton> m_pPunctCompressionRB;
- VclPtr<RadioButton> m_pPunctKanaCompressionRB;
-
- VclPtr<FixedText> m_pLanguageFT;
- VclPtr<SvxLanguageBox> m_pLanguageLB;
- VclPtr<CheckBox> m_pStandardCB;
-
- VclPtr<FixedText> m_pStartFT;
- VclPtr<Edit> m_pStartED;
- VclPtr<FixedText> m_pEndFT;
- VclPtr<Edit> m_pEndED;
- VclPtr<FixedText> m_pHintFT;
-
std::unique_ptr<SvxAsianLayoutPage_Impl> pImpl;
- DECL_LINK(LanguageHdl, ListBox&, void);
- DECL_LINK(ChangeStandardHdl, Button*, void);
- DECL_LINK(ModifyHdl, Edit&, void);
+ std::unique_ptr<weld::RadioButton> m_xCharKerningRB;
+ std::unique_ptr<weld::RadioButton> m_xCharPunctKerningRB;
+ std::unique_ptr<weld::RadioButton> m_xNoCompressionRB;
+ std::unique_ptr<weld::RadioButton> m_xPunctCompressionRB;
+ std::unique_ptr<weld::RadioButton> m_xPunctKanaCompressionRB;
+ std::unique_ptr<weld::Label> m_xLanguageFT;
+ std::unique_ptr<LanguageBox> m_xLanguageLB;
+ std::unique_ptr<weld::CheckButton> m_xStandardCB;
+ std::unique_ptr<weld::Label> m_xStartFT;
+ std::unique_ptr<weld::Entry> m_xStartED;
+ std::unique_ptr<weld::Label> m_xEndFT;
+ std::unique_ptr<weld::Entry> m_xEndED;
+ std::unique_ptr<weld::Label> m_xHintFT;
+
+ DECL_LINK(LanguageHdl, weld::ComboBox&, void);
+ DECL_LINK(ChangeStandardHdl, weld::ToggleButton&, void);
+ DECL_LINK(ModifyHdl, weld::Entry&, void);
public:
- SvxAsianLayoutPage( vcl::Window* pParent, const SfxItemSet& rSet );
+ SvxAsianLayoutPage(TabPageParent pParent, const SfxItemSet& rSet );
virtual ~SvxAsianLayoutPage() override;
- virtual void dispose() override;
static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* rAttrSet );
static const sal_uInt16* GetRanges();
diff --git a/cui/source/options/optasian.cxx b/cui/source/options/optasian.cxx
index 8c4dc9e90e0d..883bcbb984a7 100644
--- a/cui/source/options/optasian.cxx
+++ b/cui/source/options/optasian.cxx
@@ -102,81 +102,60 @@ void SvxAsianLayoutPage_Impl::addForbiddenCharacters(
static LanguageType eLastUsedLanguageTypeForForbiddenCharacters(USHRT_MAX);
-SvxAsianLayoutPage::SvxAsianLayoutPage( vcl::Window* pParent, const SfxItemSet& rSet ) :
- SfxTabPage(pParent, "OptAsianPage", "cui/ui/optasianpage.ui", &rSet),
- pImpl(new SvxAsianLayoutPage_Impl)
+SvxAsianLayoutPage::SvxAsianLayoutPage(TabPageParent pParent, const SfxItemSet& rSet)
+ : SfxTabPage(pParent, "cui/ui/optasianpage.ui", "OptAsianPage", &rSet)
+ , pImpl(new SvxAsianLayoutPage_Impl)
+ , m_xCharKerningRB(m_xBuilder->weld_radio_button("charkerning"))
+ , m_xCharPunctKerningRB(m_xBuilder->weld_radio_button("charpunctkerning"))
+ , m_xNoCompressionRB(m_xBuilder->weld_radio_button("nocompression"))
+ , m_xPunctCompressionRB(m_xBuilder->weld_radio_button("punctcompression"))
+ , m_xPunctKanaCompressionRB(m_xBuilder->weld_radio_button("punctkanacompression"))
+ , m_xLanguageFT(m_xBuilder->weld_label("languageft"))
+ , m_xLanguageLB(new LanguageBox(m_xBuilder->weld_combo_box("language")))
+ , m_xStandardCB(m_xBuilder->weld_check_button("standard"))
+ , m_xStartFT(m_xBuilder->weld_label("startft"))
+ , m_xStartED(m_xBuilder->weld_entry("start"))
+ , m_xEndFT(m_xBuilder->weld_label("endft"))
+ , m_xEndED(m_xBuilder->weld_entry("end"))
+ , m_xHintFT(m_xBuilder->weld_label("hintft"))
{
- get(m_pCharKerningRB, "charkerning");
- get(m_pCharPunctKerningRB, "charpunctkerning");
- get(m_pNoCompressionRB, "nocompression");
- get(m_pPunctCompressionRB, "punctcompression");
- get(m_pPunctKanaCompressionRB, "punctkanacompression");
- get(m_pLanguageFT, "languageft");
- get(m_pLanguageLB, "language");
- get(m_pStandardCB, "standard");
- get(m_pStartFT, "startft");
- get(m_pStartED, "start");
- get(m_pEndFT, "endft");
- get(m_pEndED, "end");
- get(m_pHintFT, "hintft");
+ LanguageHdl(*m_xLanguageLB->get_widget());
+ m_xLanguageLB->connect_changed(LINK(this, SvxAsianLayoutPage, LanguageHdl));
+ m_xStandardCB->connect_toggled(LINK(this, SvxAsianLayoutPage, ChangeStandardHdl));
+ Link<weld::Entry&,void> aLk(LINK(this, SvxAsianLayoutPage, ModifyHdl));
+ m_xStartED->connect_changed(aLk);
+ m_xEndED->connect_changed(aLk);
- LanguageHdl(*m_pLanguageLB);
- m_pLanguageLB->SetSelectHdl(LINK(this, SvxAsianLayoutPage, LanguageHdl));
- m_pStandardCB->SetClickHdl(LINK(this, SvxAsianLayoutPage, ChangeStandardHdl));
- Link<Edit&,void> aLk(LINK(this, SvxAsianLayoutPage, ModifyHdl));
- m_pStartED->SetModifyHdl(aLk);
- m_pEndED->SetModifyHdl(aLk);
-
- m_pLanguageLB->SetLanguageList( SvxLanguageListFlags::FBD_CHARS, false, false );
+ m_xLanguageLB->SetLanguageList( SvxLanguageListFlags::FBD_CHARS, false, false );
}
SvxAsianLayoutPage::~SvxAsianLayoutPage()
{
- disposeOnce();
-}
-
-void SvxAsianLayoutPage::dispose()
-{
- pImpl.reset();
- m_pCharKerningRB.clear();
- m_pCharPunctKerningRB.clear();
- m_pNoCompressionRB.clear();
- m_pPunctCompressionRB.clear();
- m_pPunctKanaCompressionRB.clear();
- m_pLanguageFT.clear();
- m_pLanguageLB.clear();
- m_pStandardCB.clear();
- m_pStartFT.clear();
- m_pStartED.clear();
- m_pEndFT.clear();
- m_pEndED.clear();
- m_pHintFT.clear();
- SfxTabPage::dispose();
}
-VclPtr<SfxTabPage> SvxAsianLayoutPage::Create( TabPageParent pParent, const SfxItemSet* rAttrSet )
+VclPtr<SfxTabPage> SvxAsianLayoutPage::Create(TabPageParent pParent, const SfxItemSet* rAttrSet)
{
- return VclPtr<SvxAsianLayoutPage>::Create(pParent.pParent, *rAttrSet);
+ return VclPtr<SvxAsianLayoutPage>::Create(pParent, *rAttrSet);
}
bool SvxAsianLayoutPage::FillItemSet( SfxItemSet* )
{
- if(m_pCharKerningRB->IsValueChangedFromSaved())
+ if(m_xCharKerningRB->get_state_changed_from_saved())
{
- pImpl->aConfig.SetKerningWesternTextOnly(m_pCharKerningRB->IsChecked());
+ pImpl->aConfig.SetKerningWesternTextOnly(m_xCharKerningRB->get_active());
OUString sPunct(cIsKernAsianPunctuation);
if(pImpl->xPrSetInfo.is() && pImpl->xPrSetInfo->hasPropertyByName(sPunct))
{
- bool bVal = !m_pCharKerningRB->IsChecked();
+ bool bVal = !m_xCharKerningRB->get_active();
pImpl->xPrSet->setPropertyValue(sPunct, Any(bVal));
}
}
- if(m_pNoCompressionRB->IsValueChangedFromSaved() ||
- m_pPunctCompressionRB->IsValueChangedFromSaved())
+ if(m_xNoCompressionRB->get_state_changed_from_saved() ||
+ m_xPunctCompressionRB->get_state_changed_from_saved())
{
- CharCompressType nSet = m_pNoCompressionRB->IsChecked() ? CharCompressType::NONE :
- m_pPunctCompressionRB->IsChecked() ? CharCompressType::PunctuationOnly :
+ CharCompressType nSet = m_xNoCompressionRB->get_active() ? CharCompressType::NONE :
+ m_xPunctCompressionRB->get_active() ? CharCompressType::PunctuationOnly :
CharCompressType::PunctuationAndKana;
pImpl->aConfig.SetCharDistanceCompression(nSet);
OUString sCompress(cCharacterCompressionType);
@@ -204,7 +183,7 @@ bool SvxAsianLayoutPage::FillItemSet( SfxItemSet* )
OSL_FAIL("exception in XForbiddenCharacters");
}
}
- eLastUsedLanguageTypeForForbiddenCharacters = m_pLanguageLB->GetSelectedLanguage();
+ eLastUsedLanguageTypeForForbiddenCharacters = m_xLanguageLB->get_active_id();
return false;
}
@@ -250,31 +229,31 @@ void SvxAsianLayoutPage::Reset( const SfxItemSet* )
}
else
{
- m_pLanguageFT->Enable(false);
- m_pLanguageLB->Enable(false);
- m_pStandardCB->Enable(false);
- m_pStartFT->Enable(false);
- m_pStartED->Enable(false);
- m_pEndFT->Enable(false);
- m_pEndED->Enable(false);
- m_pHintFT->Enable(false);
+ m_xLanguageFT->set_sensitive(false);
+ m_xLanguageLB->set_sensitive(false);
+ m_xStandardCB->set_sensitive(false);
+ m_xStartFT->set_sensitive(false);
+ m_xStartED->set_sensitive(false);
+ m_xEndFT->set_sensitive(false);
+ m_xEndED->set_sensitive(false);
+ m_xHintFT->set_sensitive(false);
}
if(bKernWesternText)
- m_pCharKerningRB->Check();
+ m_xCharKerningRB->set_active(true);
else
- m_pCharPunctKerningRB->Check();
+ m_xCharPunctKerningRB->set_active(true);
switch(nCompress)
{
- case CharCompressType::NONE : m_pNoCompressionRB->Check(); break;
- case CharCompressType::PunctuationOnly : m_pPunctCompressionRB->Check(); break;
- default: m_pPunctKanaCompressionRB->Check();
+ case CharCompressType::NONE : m_xNoCompressionRB->set_active(true); break;
+ case CharCompressType::PunctuationOnly : m_xPunctCompressionRB->set_active(true); break;
+ default: m_xPunctKanaCompressionRB->set_active(true);
}
- m_pCharKerningRB->SaveValue();
- m_pNoCompressionRB->SaveValue();
- m_pPunctCompressionRB->SaveValue();
- m_pPunctKanaCompressionRB->SaveValue();
+ m_xCharKerningRB->save_state();
+ m_xNoCompressionRB->save_state();
+ m_xPunctCompressionRB->save_state();
+ m_xPunctKanaCompressionRB->save_state();
- m_pLanguageLB->SelectEntryPos(0);
+ m_xLanguageLB->set_active(0);
//preselect the system language in the box - if available
if(LanguageType(USHRT_MAX) == eLastUsedLanguageTypeForForbiddenCharacters)
{
@@ -285,14 +264,14 @@ void SvxAsianLayoutPage::Reset( const SfxItemSet* )
else if (MsLangId::isTraditionalChinese(eLastUsedLanguageTypeForForbiddenCharacters))
eLastUsedLanguageTypeForForbiddenCharacters = LANGUAGE_CHINESE_TRADITIONAL;
}
- m_pLanguageLB->SelectLanguage( eLastUsedLanguageTypeForForbiddenCharacters );
- LanguageHdl(*m_pLanguageLB);
+ m_xLanguageLB->set_active_id(eLastUsedLanguageTypeForForbiddenCharacters);
+ LanguageHdl(*m_xLanguageLB->get_widget());
}
-IMPL_LINK_NOARG(SvxAsianLayoutPage, LanguageHdl, ListBox&, void)
+IMPL_LINK_NOARG(SvxAsianLayoutPage, LanguageHdl, weld::ComboBox&, void)
{
//set current value
- LanguageType eSelectLanguage = m_pLanguageLB->GetSelectedLanguage();
+ LanguageType eSelectLanguage = m_xLanguageLB->get_active_id();
LanguageTag aLanguageTag( eSelectLanguage);
const Locale& aLocale( aLanguageTag.getLocale());
@@ -343,33 +322,33 @@ IMPL_LINK_NOARG(SvxAsianLayoutPage, LanguageHdl, ListBox&, void)
sStart = aForbidden.beginLine;
sEnd = aForbidden.endLine;
}
- m_pStandardCB->Check(!bAvail);
- m_pStartED->Enable(bAvail);
- m_pEndED->Enable(bAvail);
- m_pStartFT->Enable(bAvail);
- m_pEndFT->Enable(bAvail);
- m_pStartED->SetText(sStart);
- m_pEndED->SetText(sEnd);
+ m_xStandardCB->set_active(!bAvail);
+ m_xStartED->set_sensitive(bAvail);
+ m_xEndED->set_sensitive(bAvail);
+ m_xStartFT->set_sensitive(bAvail);
+ m_xEndFT->set_sensitive(bAvail);
+ m_xStartED->set_text(sStart);
+ m_xEndED->set_text(sEnd);
}
-IMPL_LINK(SvxAsianLayoutPage, ChangeStandardHdl, Button*, pBox, void)
+IMPL_LINK(SvxAsianLayoutPage, ChangeStandardHdl, weld::ToggleButton&, rBox, void)
{
- bool bCheck = static_cast<CheckBox*>(pBox)->IsChecked();
- m_pStartED->Enable(!bCheck);
- m_pEndED->Enable(!bCheck);
- m_pStartFT->Enable(!bCheck);
- m_pEndFT->Enable(!bCheck);
+ bool bCheck = rBox.get_active();
+ m_xStartED->set_sensitive(!bCheck);
+ m_xEndED->set_sensitive(!bCheck);
+ m_xStartFT->set_sensitive(!bCheck);
+ m_xEndFT->set_sensitive(!bCheck);
- ModifyHdl(*m_pStartED);
+ ModifyHdl(*m_xStartED);
}
-IMPL_LINK(SvxAsianLayoutPage, ModifyHdl, Edit&, rEdit, void)
+IMPL_LINK(SvxAsianLayoutPage, ModifyHdl, weld::Entry&, rEdit, void)
{
- LanguageType eSelectLanguage = m_pLanguageLB->GetSelectedLanguage();
+ LanguageType eSelectLanguage = m_xLanguageLB->get_active_id();
Locale aLocale( LanguageTag::convertToLocale( eSelectLanguage ));
- OUString sStart = m_pStartED->GetText();
- OUString sEnd = m_pEndED->GetText();
- bool bEnable = rEdit.IsEnabled();
+ OUString sStart = m_xStartED->get_text();
+ OUString sEnd = m_xEndED->get_text();
+ bool bEnable = rEdit.get_sensitive();
if(pImpl->xForbidden.is())
{
try
diff --git a/cui/uiconfig/ui/optasianpage.ui b/cui/uiconfig/ui/optasianpage.ui
index 7a063cb5d679..087bfd380d26 100644
--- a/cui/uiconfig/ui/optasianpage.ui
+++ b/cui/uiconfig/ui/optasianpage.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/>
@@ -36,7 +36,6 @@
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
- <property name="group">charpunctkerning</property>
</object>
<packing>
<property name="expand">False</property>
@@ -52,7 +51,6 @@
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
- <property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">charkerning</property>
</object>
@@ -110,7 +108,6 @@
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
- <property name="group">punctcompression</property>
</object>
<packing>
<property name="expand">False</property>
@@ -126,9 +123,8 @@
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
- <property name="active">True</property>
<property name="draw_indicator">True</property>
- <property name="group">punctkanacompression</property>
+ <property name="group">nocompression</property>
</object>
<packing>
<property name="expand">False</property>
@@ -144,7 +140,6 @@
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
- <property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">nocompression</property>
</object>
@@ -210,7 +205,7 @@
<property name="spacing">12</property>
<property name="homogeneous">True</property>
<child>
- <object class="svxcorelo-SvxLanguageBox" id="language">
+ <object class="GtkComboBoxText" id="language">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@@ -247,10 +242,10 @@
<object class="GtkLabel" id="languageft">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="optasianpage|languageft">_Language:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">language</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -261,10 +256,10 @@
<object class="GtkLabel" id="startft">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="optasianpage|startft">Not _at start of line:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">start</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -275,10 +270,10 @@
<object class="GtkLabel" id="endft">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="optasianpage|endft">Not at _end of line:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">end</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -290,6 +285,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
+ <property name="activates_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -301,6 +297,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
+ <property name="activates_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -318,8 +315,8 @@
<object class="GtkLabel" id="hintft">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="optasianpage|hintft">Without user-defined line break symbols</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>