summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-12-03 15:31:02 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-12-04 09:54:13 +0100
commitbf1932fe2133e5954441be6299e6788c17e1d1b9 (patch)
tree77995bbb032b9a56b33e42ee5bdd46bafe29e681 /cui
parenta5784b7fd63cee073d85b669f745f7f6271ab040 (diff)
weld OfaAutocorrOptionsPage
Change-Id: I4bf626f61c0d1eb404f99bae4d1e3bf521e4878f Reviewed-on: https://gerrit.libreoffice.org/64473 Tested-by: Jenkins 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/inc/autocdlg.hxx9
-rw-r--r--cui/source/tabpages/autocdlg.cxx94
-rw-r--r--cui/uiconfig/ui/acoroptionspage.ui58
3 files changed, 108 insertions, 53 deletions
diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx
index 21ef480794ef..cc8b5383b7af 100644
--- a/cui/source/inc/autocdlg.hxx
+++ b/cui/source/inc/autocdlg.hxx
@@ -95,8 +95,6 @@ class OfaAutocorrOptionsPage : public SfxTabPage
using TabPage::ActivatePage;
private:
- VclPtr<SvxCheckListBox> m_pCheckLB;
-
OUString m_sInput;
OUString m_sDoubleCaps;
OUString m_sStartCap;
@@ -106,10 +104,13 @@ private:
OUString m_sDash;
OUString m_sAccidentalCaps;
+ std::unique_ptr<weld::TreeView> m_xCheckLB;
+
+ void InsertEntry(const OUString& rTxt);
+
public:
- OfaAutocorrOptionsPage(vcl::Window* pParent, const SfxItemSet& rSet);
+ OfaAutocorrOptionsPage(TabPageParent pParent, const SfxItemSet& rSet);
virtual ~OfaAutocorrOptionsPage() override;
- virtual void dispose() override;
static VclPtr<SfxTabPage> Create( TabPageParent pParent,
const SfxItemSet* rAttrSet);
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 1af32103593a..fa8825bd3f5a 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -188,8 +188,8 @@ IMPL_LINK(OfaAutoCorrDlg, SelectLanguageHdl, ListBox&, rBox, void)
}
}
-OfaAutocorrOptionsPage::OfaAutocorrOptionsPage(vcl::Window* pParent, const SfxItemSet& rSet)
- : SfxTabPage(pParent, "AutocorrectOptionsPage", "cui/ui/acoroptionspage.ui", &rSet)
+OfaAutocorrOptionsPage::OfaAutocorrOptionsPage(TabPageParent pParent, const SfxItemSet& rSet)
+ : SfxTabPage(pParent, "cui/ui/acoroptionspage.ui", "AutocorrectOptionsPage", &rSet)
, m_sInput(CuiResId(RID_SVXSTR_USE_REPLACE))
, m_sDoubleCaps(CuiResId(RID_SVXSTR_CPTL_STT_WORD))
, m_sStartCap(CuiResId(RID_SVXSTR_CPTL_STT_SENT))
@@ -198,8 +198,11 @@ OfaAutocorrOptionsPage::OfaAutocorrOptionsPage(vcl::Window* pParent, const SfxIt
, m_sNoDblSpaces(CuiResId(RID_SVXSTR_NO_DBL_SPACES))
, m_sDash(CuiResId(RID_SVXSTR_DASH))
, m_sAccidentalCaps(CuiResId(RID_SVXSTR_CORRECT_ACCIDENTAL_CAPS_LOCK))
+ , m_xCheckLB(m_xBuilder->weld_tree_view("checklist"))
{
- get(m_pCheckLB, "checklist");
+ std::vector<int> aWidths;
+ aWidths.push_back(m_xCheckLB->get_approximate_digit_width() * 3 + 6);
+ m_xCheckLB->set_column_fixed_widths(aWidths);
}
OfaAutocorrOptionsPage::~OfaAutocorrOptionsPage()
@@ -207,16 +210,10 @@ OfaAutocorrOptionsPage::~OfaAutocorrOptionsPage()
disposeOnce();
}
-void OfaAutocorrOptionsPage::dispose()
-{
- m_pCheckLB.clear();
- SfxTabPage::dispose();
-}
-
-VclPtr<SfxTabPage> OfaAutocorrOptionsPage::Create( TabPageParent pParent,
- const SfxItemSet* rSet)
+VclPtr<SfxTabPage> OfaAutocorrOptionsPage::Create(TabPageParent pParent,
+ const SfxItemSet* rSet)
{
- return VclPtr<OfaAutocorrOptionsPage>::Create(pParent.pParent, *rSet);
+ return VclPtr<OfaAutocorrOptionsPage>::Create(pParent, *rSet);
}
bool OfaAutocorrOptionsPage::FillItemSet( SfxItemSet* )
@@ -224,15 +221,15 @@ bool OfaAutocorrOptionsPage::FillItemSet( SfxItemSet* )
SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
ACFlags nFlags = pAutoCorrect->GetFlags();
- sal_uLong nPos = 0;
- pAutoCorrect->SetAutoCorrFlag(ACFlags::Autocorrect, m_pCheckLB->IsChecked(nPos++));
- pAutoCorrect->SetAutoCorrFlag(ACFlags::CapitalStartWord, m_pCheckLB->IsChecked(nPos++));
- pAutoCorrect->SetAutoCorrFlag(ACFlags::CapitalStartSentence, m_pCheckLB->IsChecked(nPos++));
- pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgWeightUnderl, m_pCheckLB->IsChecked(nPos++));
- pAutoCorrect->SetAutoCorrFlag(ACFlags::SetINetAttr, m_pCheckLB->IsChecked(nPos++));
- pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgToEnEmDash, m_pCheckLB->IsChecked(nPos++));
- pAutoCorrect->SetAutoCorrFlag(ACFlags::IgnoreDoubleSpace, m_pCheckLB->IsChecked(nPos++));
- pAutoCorrect->SetAutoCorrFlag(ACFlags::CorrectCapsLock, m_pCheckLB->IsChecked(nPos++));
+ int nPos = 0;
+ pAutoCorrect->SetAutoCorrFlag(ACFlags::Autocorrect, m_xCheckLB->get_toggle(nPos++));
+ pAutoCorrect->SetAutoCorrFlag(ACFlags::CapitalStartWord, m_xCheckLB->get_toggle(nPos++));
+ pAutoCorrect->SetAutoCorrFlag(ACFlags::CapitalStartSentence, m_xCheckLB->get_toggle(nPos++));
+ pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgWeightUnderl, m_xCheckLB->get_toggle(nPos++));
+ pAutoCorrect->SetAutoCorrFlag(ACFlags::SetINetAttr, m_xCheckLB->get_toggle(nPos++));
+ pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgToEnEmDash, m_xCheckLB->get_toggle(nPos++));
+ pAutoCorrect->SetAutoCorrFlag(ACFlags::IgnoreDoubleSpace, m_xCheckLB->get_toggle(nPos++));
+ pAutoCorrect->SetAutoCorrFlag(ACFlags::CorrectCapsLock, m_xCheckLB->get_toggle(nPos++));
bool bReturn = nFlags != pAutoCorrect->GetFlags();
if(bReturn )
@@ -249,34 +246,43 @@ void OfaAutocorrOptionsPage::ActivatePage( const SfxItemSet& )
static_cast<OfaAutoCorrDlg*>(GetTabDialog())->EnableLanguage(false);
}
+void OfaAutocorrOptionsPage::InsertEntry(const OUString& rTxt)
+{
+ m_xCheckLB->insert(nullptr, -1, nullptr, nullptr, nullptr,
+ nullptr, nullptr, false);
+ const int nRow = m_xCheckLB->n_children() - 1;
+ m_xCheckLB->set_toggle(nRow, false, 0);
+ m_xCheckLB->set_text(nRow, rTxt, 1);
+}
+
void OfaAutocorrOptionsPage::Reset( const SfxItemSet* )
{
SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
const ACFlags nFlags = pAutoCorrect->GetFlags();
- m_pCheckLB->SetUpdateMode(false);
- m_pCheckLB->Clear();
-
- m_pCheckLB->InsertEntry(m_sInput);
- m_pCheckLB->InsertEntry(m_sDoubleCaps);
- m_pCheckLB->InsertEntry(m_sStartCap);
- m_pCheckLB->InsertEntry(m_sBoldUnderline);
- m_pCheckLB->InsertEntry(m_sURL);
- m_pCheckLB->InsertEntry(m_sDash);
- m_pCheckLB->InsertEntry(m_sNoDblSpaces);
- m_pCheckLB->InsertEntry(m_sAccidentalCaps);
-
- sal_uLong nPos = 0;
- m_pCheckLB->CheckEntryPos( nPos++, bool(nFlags & ACFlags::Autocorrect) );
- m_pCheckLB->CheckEntryPos( nPos++, bool(nFlags & ACFlags::CapitalStartWord) );
- m_pCheckLB->CheckEntryPos( nPos++, bool(nFlags & ACFlags::CapitalStartSentence) );
- m_pCheckLB->CheckEntryPos( nPos++, bool(nFlags & ACFlags::ChgWeightUnderl) );
- m_pCheckLB->CheckEntryPos( nPos++, bool(nFlags & ACFlags::SetINetAttr) );
- m_pCheckLB->CheckEntryPos( nPos++, bool(nFlags & ACFlags::ChgToEnEmDash) );
- m_pCheckLB->CheckEntryPos( nPos++, bool(nFlags & ACFlags::IgnoreDoubleSpace) );
- m_pCheckLB->CheckEntryPos( nPos++, bool(nFlags & ACFlags::CorrectCapsLock) );
-
- m_pCheckLB->SetUpdateMode(true);
+ m_xCheckLB->freeze();
+ m_xCheckLB->clear();
+
+ InsertEntry(m_sInput);
+ InsertEntry(m_sDoubleCaps);
+ InsertEntry(m_sStartCap);
+ InsertEntry(m_sBoldUnderline);
+ InsertEntry(m_sURL);
+ InsertEntry(m_sDash);
+ InsertEntry(m_sNoDblSpaces);
+ InsertEntry(m_sAccidentalCaps);
+
+ int nPos = 0;
+ m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::Autocorrect) );
+ m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::CapitalStartWord) );
+ m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::CapitalStartSentence) );
+ m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::ChgWeightUnderl) );
+ m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::SetINetAttr) );
+ m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::ChgToEnEmDash) );
+ m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::IgnoreDoubleSpace) );
+ m_xCheckLB->set_toggle( nPos++, bool(nFlags & ACFlags::CorrectCapsLock) );
+
+ m_xCheckLB->thaw();
}
/*********************************************************************/
diff --git a/cui/uiconfig/ui/acoroptionspage.ui b/cui/uiconfig/ui/acoroptionspage.ui
index c939941a02e3..f1da95498d94 100644
--- a/cui/uiconfig/ui/acoroptionspage.ui
+++ b/cui/uiconfig/ui/acoroptionspage.ui
@@ -1,7 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
- <requires lib="LibreOffice" version="1.0"/>
+ <object class="GtkTreeStore" id="liststore2">
+ <columns>
+ <!-- column-name check1 -->
+ <column type="gboolean"/>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkBox" id="AutocorrectOptionsPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -10,13 +19,52 @@
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<child>
- <object class="svxcorelo-SvxCheckListBox" id="checklist:border">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="Check List Box-selection1"/>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="checklist">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="model">liststore2</property>
+ <property name="headers_visible">False</property>
+ <property name="search_column">0</property>
+ <property name="show_expanders">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="Macro Library List-selection2"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn4">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="alignment">0.5</property>
+ <child>
+ <object class="GtkCellRendererToggle" id="cellrenderer5"/>
+ <attributes>
+ <attribute name="active">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn5">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer4"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
</child>
</object>
<packing>