[Libreoffice-commits] core.git: basctl/source cui/source cui/uiconfig extensions/source include/vcl sc/source sd/source svx/source svx/uiconfig sw/source vcl/source vcl/unx xmlsecurity/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Feb 19 21:18:47 UTC 2019
basctl/source/basicide/bastype2.cxx | 2
basctl/source/basicide/moduldl2.cxx | 3
basctl/source/dlged/managelang.cxx | 3
cui/source/customize/cfgutil.cxx | 8
cui/source/dialogs/hangulhanjadlg.cxx | 5
cui/source/dialogs/linkdlg.cxx | 6
cui/source/dialogs/multipat.cxx | 3
cui/source/dialogs/srchxtra.cxx | 3
cui/source/inc/cfgutil.hxx | 2
cui/source/options/certpath.cxx | 6
cui/source/tabpages/autocdlg.cxx | 12
cui/uiconfig/ui/hangulhanjaoptdialog.ui | 8
extensions/source/propctrlr/selectlabeldialog.cxx | 6
include/vcl/treelistbox.hxx | 2
include/vcl/weld.hxx | 31
sc/source/ui/dbgui/dpgroupdlg.cxx | 2
sc/source/ui/dbgui/pvfundlg.cxx | 3
sc/source/ui/miscdlgs/protectiondlg.cxx | 3
sc/source/ui/miscdlgs/solveroptions.cxx | 3
sc/source/ui/namedlg/namemgrtable.cxx | 2
sd/source/ui/dlg/sdtreelb.cxx | 10
sd/source/ui/inc/sdtreelb.hxx | 2
svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx | 550 +++-------
svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx | 112 +-
svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx | 48
svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx | 2
svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx | 89 -
svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx | 31
svx/uiconfig/ui/chineseconversiondialog.ui | 9
svx/uiconfig/ui/chinesedictionary.ui | 313 ++++-
sw/source/ui/config/optload.cxx | 10
sw/source/ui/index/cnttab.cxx | 4
vcl/source/app/salvtables.cxx | 129 ++
vcl/source/treelist/treelistbox.cxx | 13
vcl/unx/gtk3/gtk3gtkinst.cxx | 132 +-
xmlsecurity/source/dialogs/certificatechooser.cxx | 3
xmlsecurity/source/dialogs/certificateviewer.cxx | 2
xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx | 2
38 files changed, 852 insertions(+), 722 deletions(-)
New commits:
commit 12a59a1f2948274c6a845ab4a0963bab8aff45b8
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Feb 18 12:11:08 2019 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Feb 19 22:18:10 2019 +0100
weld ChineseDictionaryDialog
and ChineseTranslationDialog
Change-Id: I3b754c405c8379fc0c5fa94437cc0464a1dea999
Reviewed-on: https://gerrit.libreoffice.org/67991
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
index 11beb68d110a..a5b0057803ed 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -1352,7 +1352,7 @@ void SbTreeListBox::AddEntry(
std::unique_ptr<Entry>&& rUserData)
{
OUString sId(OUString::number(reinterpret_cast<sal_uInt64>(rUserData.release())));
- m_xControl->insert(pParent, -1, &rText, &sId, nullptr, nullptr, &rImage, bChildrenOnDemand);
+ m_xControl->insert(pParent, -1, &rText, &sId, nullptr, nullptr, &rImage, bChildrenOnDemand, nullptr);
}
void SbTreeListBox::SetEntryBitmaps(const weld::TreeIter& rIter, const OUString& rImage)
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index dec80d59d2c0..2a5b729c2822 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -808,8 +808,7 @@ void LibPage::InsertLib()
( xDlgLibContImport.is() && xDlgLibContImport->hasByName( aLibName ) && xDlgLibContImport->isLibraryLink( aLibName ) ) ) )
{
weld::TreeView& rView = xLibDlg->GetLibBox();
- rView.insert(nullptr, -1, nullptr, nullptr, nullptr,
- nullptr, nullptr, false);
+ rView.append();
const int nRow = rView.n_children() - 1;
rView.set_toggle(nRow, true, 0);
rView.set_text(nRow, aLibName, 1);
diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx
index 6813a96904c4..85797a55f869 100644
--- a/basctl/source/dlged/managelang.cxx
+++ b/basctl/source/dlged/managelang.cxx
@@ -272,8 +272,7 @@ void SetDefaultLanguageDialog::FillLanguageBox()
for (sal_Int32 j = 0; j < nCountLang; ++j)
{
LanguageType eLang = m_xLanguageCB->get_id(j);
- m_xCheckLangLB->insert(nullptr, -1, nullptr, nullptr, nullptr,
- nullptr, nullptr, false);
+ m_xCheckLangLB->append();
const int nRow = m_xCheckLangLB->n_children() - 1;
m_xCheckLangLB->set_toggle(nRow, false, 0);
m_xCheckLangLB->set_text(nRow, m_xLanguageCB->get_text(j), 1);
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index 14367102b237..012b46818e55 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -1383,7 +1383,7 @@ void CuiConfigGroupListBox::FillScriptList(const css::uno::Reference< css::scrip
0, static_cast<void *>( theChild.get())));
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())));
- m_xTreeView->insert(pParentEntry, -1, &uiName, &sId, nullptr, nullptr, &aImage, bChildOnDemand);
+ m_xTreeView->insert(pParentEntry, -1, &uiName, &sId, nullptr, nullptr, &aImage, bChildOnDemand, nullptr);
}
}
}
@@ -1453,7 +1453,7 @@ void CuiConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent
static_cast<void *>(rootNode.get())));
OUString aTitle(xImp->m_sDlgMacros);
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())));
- m_xTreeView->insert(nullptr, -1, &aTitle, &sId, nullptr, nullptr, nullptr, true);
+ m_xTreeView->insert(nullptr, -1, &aTitle, &sId, nullptr, nullptr, nullptr, true, nullptr);
}
else
{
@@ -1469,7 +1469,7 @@ void CuiConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent
aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_STYLES, 0, nullptr ) ); // TODO last parameter should contain user data
OUString sStyle(xImp->m_aStrGroupStyles);
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())));
- m_xTreeView->insert(nullptr, -1, &sStyle, &sId, nullptr, nullptr, nullptr, true);
+ m_xTreeView->insert(nullptr, -1, &sStyle, &sId, nullptr, nullptr, nullptr, true, nullptr);
}
m_xTreeView->thaw();
@@ -1761,7 +1761,7 @@ IMPL_LINK(CuiConfigGroupListBox, ExpandingHdl, weld::TreeIter&, rIter, bool)
SfxStyleInfo_Impl* pFamily = new SfxStyleInfo_Impl(lStyleFamily);
aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_STYLES, 0, pFamily ));
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())));
- m_xTreeView->insert(&rIter, -1, &pFamily->sLabel, &sId, nullptr, nullptr, nullptr, false);
+ m_xTreeView->insert(&rIter, -1, &pFamily->sLabel, &sId, nullptr, nullptr, nullptr, false, nullptr);
}
}
break;
diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx
index 74f46d3d3647..01cc5ad80ecf 100644
--- a/cui/source/dialogs/hangulhanjadlg.cxx
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -960,6 +960,8 @@ namespace svx
}
}
}
+ if (m_xDictsLB->n_children())
+ m_xDictsLB->select(0);
}
IMPL_LINK_NOARG(HangulHanjaOptionsDialog, OkHdl, weld::Button&, void)
@@ -1142,8 +1144,7 @@ namespace svx
void HangulHanjaOptionsDialog::AddDict(const OUString& rName, bool bChecked)
{
- m_xDictsLB->insert(nullptr, -1, nullptr, nullptr,
- nullptr, nullptr, nullptr, false);
+ m_xDictsLB->append();
int nRow = m_xDictsLB->n_children() - 1;
m_xDictsLB->set_toggle(nRow, bChecked, 0);
m_xDictsLB->set_text(nRow, rName, 1);
diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx
index b4b7410909df..7e4f0439e0e8 100644
--- a/cui/source/dialogs/linkdlg.cxx
+++ b/cui/source/dialogs/linkdlg.cxx
@@ -575,11 +575,9 @@ void SvBaseLinksDlg::InsertEntry(const SvBaseLink& rLink, int nPos, bool bSelect
if (nPos == -1)
nPos = m_xTbLinks->n_children();
- m_xTbLinks->insert(nullptr, nPos, nullptr, nullptr, nullptr,
- nullptr, nullptr, false);
-
- m_xTbLinks->set_id(nPos, OUString::number(reinterpret_cast<sal_Int64>(&rLink)));
+ m_xTbLinks->insert(nPos);
m_xTbLinks->set_text(nPos, aTxt, 0);
+ m_xTbLinks->set_id(nPos, OUString::number(reinterpret_cast<sal_Int64>(&rLink)));
if( OBJECT_CLIENT_GRF == rLink.GetObjType() )
m_xTbLinks->set_text(nPos, sFilter, 1);
else
diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx
index b6e409e5d011..6adbb9464a84 100644
--- a/cui/source/dialogs/multipat.cxx
+++ b/cui/source/dialogs/multipat.cxx
@@ -80,8 +80,7 @@ IMPL_LINK(SvxMultiPathDialog, CheckHdl_Impl, const row_col&, rRowCol, void)
void SvxMultiPathDialog::AppendEntry(const OUString& rText, const OUString& rId)
{
- m_xRadioLB->insert(nullptr, -1, nullptr, nullptr, nullptr,
- nullptr, nullptr, false);
+ m_xRadioLB->append();
const int nRow = m_xRadioLB->n_children() - 1;
m_xRadioLB->set_toggle(nRow, false, 0);
m_xRadioLB->set_text(nRow, rText, 1);
diff --git a/cui/source/dialogs/srchxtra.cxx b/cui/source/dialogs/srchxtra.cxx
index 39161e40765a..e1f0a869096d 100644
--- a/cui/source/dialogs/srchxtra.cxx
+++ b/cui/source/dialogs/srchxtra.cxx
@@ -146,8 +146,7 @@ SvxSearchAttributeDialog::SvxSearchAttributeDialog(weld::Window* pParent,
sal_uInt32 nId = SvxAttrNameTable::FindIndex(nSlot);
if (RESARRAY_INDEX_NOTFOUND != nId)
{
- m_xAttrLB->insert(nullptr, -1, nullptr, nullptr, nullptr,
- nullptr, nullptr, false);
+ m_xAttrLB->append();
const int nRow = m_xAttrLB->n_children() - 1;
m_xAttrLB->set_toggle(nRow, bChecked, 0);
m_xAttrLB->set_text(nRow, SvxAttrNameTable::GetString(nId), 1);
diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx
index ff9f4aa6f1b2..7557a30073a4 100644
--- a/cui/source/inc/cfgutil.hxx
+++ b/cui/source/inc/cfgutil.hxx
@@ -140,7 +140,7 @@ public:
void append(const OUString& rId, const OUString& rStr) { m_xTreeView->append(rId, rStr); }
void append(const OUString& rId, const OUString& rStr, const OUString& rImage)
{
- m_xTreeView->insert(nullptr, -1, &rStr, &rId, nullptr, nullptr, &rImage, false);
+ m_xTreeView->insert(nullptr, -1, &rStr, &rId, nullptr, nullptr, &rImage, false, nullptr);
}
int n_children() const { return m_xTreeView->n_children(); }
void select(int pos) { m_xTreeView->select(pos); }
diff --git a/cui/source/options/certpath.cxx b/cui/source/options/certpath.cxx
index 37eeadc07641..2eff6841eb60 100644
--- a/cui/source/options/certpath.cxx
+++ b/cui/source/options/certpath.cxx
@@ -69,8 +69,7 @@ CertPathDialog::CertPathDialog(weld::Window* pParent)
if (!profile.isEmpty())
{
- m_xCertPathList->insert(nullptr, -1, nullptr, nullptr, nullptr,
- nullptr, nullptr, false);
+ m_xCertPathList->append();
const int nRow = m_xCertPathList->n_children() - 1;
m_xCertPathList->set_toggle(nRow, false, 0);
OUString sEntry = OUString::createFromAscii(productNames[i]) + ":" + profile;
@@ -174,8 +173,7 @@ void CertPathDialog::AddCertPath(const OUString &rProfile, const OUString &rPath
}
}
- m_xCertPathList->insert(nullptr, -1, nullptr, nullptr, nullptr,
- nullptr, nullptr, false);
+ m_xCertPathList->append();
const int nRow = m_xCertPathList->n_children() - 1;
m_xCertPathList->set_toggle(nRow, true, 0);
m_xCertPathList->set_text(nRow, rProfile, 1);
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 3ca962d882ff..678b29bc503f 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -241,8 +241,7 @@ void OfaAutocorrOptionsPage::ActivatePage( const SfxItemSet& )
void OfaAutocorrOptionsPage::InsertEntry(const OUString& rTxt)
{
- m_xCheckLB->insert(nullptr, -1, nullptr, nullptr, nullptr,
- nullptr, nullptr, false);
+ m_xCheckLB->append();
const int nRow = m_xCheckLB->n_children() - 1;
m_xCheckLB->set_toggle(nRow, false, CBCOL_FIRST);
m_xCheckLB->set_text(nRow, rTxt, 1);
@@ -382,8 +381,7 @@ OfaSwAutoFmtOptionsPage::OfaSwAutoFmtOptionsPage(TabPageParent pParent,
void OfaSwAutoFmtOptionsPage::CreateEntry(const OUString& rTxt, sal_uInt16 nCol)
{
- m_xCheckLB->insert(nullptr, -1, nullptr, nullptr, nullptr,
- nullptr, nullptr, false);
+ m_xCheckLB->append();
const int nRow = m_xCheckLB->n_children() - 1;
if (nCol == CBCOL_FIRST || nCol == CBCOL_BOTH)
m_xCheckLB->set_toggle(nRow, false, CBCOL_FIRST);
@@ -1530,8 +1528,7 @@ enum OfaQuoteOptions
void OfaQuoteTabPage::CreateEntry(weld::TreeView& rCheckLB, const OUString& rTxt, sal_uInt16 nCol, sal_uInt16 nTextCol)
{
- rCheckLB.insert(nullptr, -1, nullptr, nullptr, nullptr,
- nullptr, nullptr, false);
+ rCheckLB.append();
const int nRow = rCheckLB.n_children() - 1;
if (nCol == CBCOL_FIRST || nCol == CBCOL_BOTH)
rCheckLB.set_toggle(nRow, false, CBCOL_FIRST);
@@ -2207,8 +2204,7 @@ void OfaSmartTagOptionsTabPage::FillListBox( const SmartTagMgr& rSmartTagMgr )
const OUString aLBEntry = aSmartTagCaption + " (" + aName + ")";
- m_xSmartTagTypesLB->insert(nullptr, -1, nullptr, nullptr, nullptr,
- nullptr, nullptr, false);
+ m_xSmartTagTypesLB->append();
const int nRow = m_xSmartTagTypesLB->n_children() - 1;
const bool bCheck = rSmartTagMgr.IsSmartTagTypeEnabled( aSmartTagType );
m_xSmartTagTypesLB->set_toggle(nRow, bCheck, CBCOL_FIRST);
diff --git a/cui/uiconfig/ui/hangulhanjaoptdialog.ui b/cui/uiconfig/ui/hangulhanjaoptdialog.ui
index 0464ba462567..1fef474a30c1 100644
--- a/cui/uiconfig/ui/hangulhanjaoptdialog.ui
+++ b/cui/uiconfig/ui/hangulhanjaoptdialog.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"/>
<object class="GtkTreeStore" id="liststore2">
@@ -18,7 +18,13 @@
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="hangulhanjaoptdialog|HangulHanjaOptDialog">Hangul/Hanja Options</property>
+ <property name="modal">True</property>
+ <property name="default_width">0</property>
+ <property name="default_height">0</property>
<property name="type_hint">dialog</property>
+ <child>
+ <placeholder/>
+ </child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
diff --git a/extensions/source/propctrlr/selectlabeldialog.cxx b/extensions/source/propctrlr/selectlabeldialog.cxx
index c1a356abf187..aeb72b28c670 100644
--- a/extensions/source/propctrlr/selectlabeldialog.cxx
+++ b/extensions/source/propctrlr/selectlabeldialog.cxx
@@ -104,7 +104,7 @@ namespace pcr
OUString sRootName(PcrRes(RID_STR_FORMS));
OUString aFormImage(RID_EXTBMP_FORMS);
m_xControlTree->insert(nullptr, -1, &sRootName, nullptr,
- nullptr, nullptr, &aFormImage, false);
+ nullptr, nullptr, &aFormImage, false, nullptr);
// build the tree
m_xInitialSelection.reset();
@@ -179,7 +179,7 @@ namespace pcr
OUString aFormImage(RID_EXTBMP_FORM);
m_xControlTree->insert(&rContainerEntry, -1, &sName, nullptr,
- nullptr, nullptr, &aFormImage, false);
+ nullptr, nullptr, &aFormImage, false, nullptr);
auto xIter = m_xControlTree->make_iterator(&rContainerEntry);
m_xControlTree->iter_nth_child(*xIter, nChildren);
sal_Int32 nContChildren = InsertEntries(xCont, *xIter);
@@ -208,7 +208,7 @@ namespace pcr
// all requirements met -> insert
m_xUserData.emplace_back(new Reference<XPropertySet>(xAsSet));
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(m_xUserData.back().get())));
- m_xControlTree->insert(&rContainerEntry, -1, &sDisplayName, &sId, nullptr, nullptr, &m_aRequiredControlImage, false);
+ m_xControlTree->insert(&rContainerEntry, -1, &sDisplayName, &sId, nullptr, nullptr, &m_aRequiredControlImage, false, nullptr);
if (m_xInitialLabelControl == xAsSet)
{
diff --git a/include/vcl/treelistbox.hxx b/include/vcl/treelistbox.hxx
index 1e3351153ca1..adf35cb63a85 100644
--- a/include/vcl/treelistbox.hxx
+++ b/include/vcl/treelistbox.hxx
@@ -713,6 +713,8 @@ public:
// A Parent's Children are turned into Children of the Parent which comes next in hierarchy
void RemoveParentKeepChildren( SvTreeListEntry* pParent );
+ sal_Int32 DefaultCompare(const SvLBoxString* pLeftText, const SvLBoxString* pRightText);
+
DECL_LINK( DefaultCompare, const SvSortData&, sal_Int32 );
virtual void ModelNotification( SvListAction nActionId, SvTreeListEntry* pEntry1,
SvTreeListEntry* pEntry2, sal_uLong nPos ) override;
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 962ca72fe30c..d3e0b09ba6b3 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -489,40 +489,47 @@ protected:
public:
virtual void insert(weld::TreeIter* pParent, int pos, const OUString* pStr, const OUString* pId,
const OUString* pIconName, VirtualDevice* pImageSurface,
- const OUString* pExpanderName, bool bChildrenOnDemand)
+ const OUString* pExpanderName, bool bChildrenOnDemand, TreeIter* pRet)
= 0;
+ void insert(int nRow, TreeIter* pRet = nullptr)
+ {
+ insert(nullptr, nRow, nullptr, nullptr, nullptr, nullptr, nullptr, false, pRet);
+ }
+
+ void append(TreeIter* pRet = nullptr) { insert(-1, pRet); }
+
virtual void set_expander_image(const weld::TreeIter& rIter, const OUString& rExpanderName) = 0;
void insert(int pos, const OUString& rStr, const OUString* pId, const OUString* pIconName,
VirtualDevice* pImageSurface)
{
- insert(nullptr, pos, &rStr, pId, pIconName, pImageSurface, nullptr, false);
+ insert(nullptr, pos, &rStr, pId, pIconName, pImageSurface, nullptr, false, nullptr);
}
void insert_text(int pos, const OUString& rStr)
{
- insert(nullptr, pos, &rStr, nullptr, nullptr, nullptr, nullptr, false);
+ insert(nullptr, pos, &rStr, nullptr, nullptr, nullptr, nullptr, false, nullptr);
}
void append_text(const OUString& rStr)
{
- insert(nullptr, -1, &rStr, nullptr, nullptr, nullptr, nullptr, false);
+ insert(nullptr, -1, &rStr, nullptr, nullptr, nullptr, nullptr, false, nullptr);
}
void append(const OUString& rId, const OUString& rStr)
{
- insert(nullptr, -1, &rStr, &rId, nullptr, nullptr, nullptr, false);
+ insert(nullptr, -1, &rStr, &rId, nullptr, nullptr, nullptr, false, nullptr);
}
void append(const OUString& rId, const OUString& rStr, const OUString& rImage)
{
- insert(nullptr, -1, &rStr, &rId, &rImage, nullptr, nullptr, false);
+ insert(nullptr, -1, &rStr, &rId, &rImage, nullptr, nullptr, false, nullptr);
}
void append(weld::TreeIter* pParent, const OUString& rId, const OUString& rStr,
const OUString& rImage)
{
- insert(pParent, -1, &rStr, &rId, &rImage, nullptr, nullptr, false);
+ insert(pParent, -1, &rStr, &rId, &rImage, nullptr, nullptr, false, nullptr);
}
void append(const OUString& rId, const OUString& rStr, VirtualDevice& rImage)
{
- insert(nullptr, -1, &rStr, &rId, nullptr, &rImage, nullptr, false);
+ insert(nullptr, -1, &rStr, &rId, nullptr, &rImage, nullptr, false, nullptr);
}
void connect_changed(const Link<TreeView&, void>& rLink) { m_aChangeHdl = rLink; }
@@ -606,6 +613,7 @@ public:
virtual void collapse_row(TreeIter& rIter) = 0;
virtual void set_text(TreeIter& rIter, const OUString& rStr, int col = -1) = 0;
virtual OUString get_text(const TreeIter& rIter, int col = -1) const = 0;
+ virtual void set_id(TreeIter& rIter, const OUString& rId) = 0;
virtual OUString get_id(const TreeIter& rIter) const = 0;
virtual void scroll_to_row(const TreeIter& rIter) = 0;
virtual bool is_selected(const TreeIter& rIter) const = 0;
@@ -626,9 +634,16 @@ public:
void unselect_all() { select(-1); }
virtual int n_children() const = 0;
+
virtual void make_sorted() = 0;
virtual bool get_sort_order() const = 0;
virtual void set_sort_order(bool bAscending) = 0;
+ // TRUE ascending, FALSE, descending, INDET, neither (off)
+ virtual void set_sort_indicator(TriState eState, int nColumn = -1) = 0;
+ virtual TriState get_sort_indicator(int nColumn = -1) const = 0;
+ virtual int get_sort_column() const = 0;
+ virtual void set_sort_column(int nColumn) = 0;
+
virtual void clear() = 0;
virtual int get_height_rows(int nRows) const = 0;
diff --git a/sc/source/ui/dbgui/dpgroupdlg.cxx b/sc/source/ui/dbgui/dpgroupdlg.cxx
index a7ba75b12eb7..9355d4e28b16 100644
--- a/sc/source/ui/dbgui/dpgroupdlg.cxx
+++ b/sc/source/ui/dbgui/dpgroupdlg.cxx
@@ -223,7 +223,7 @@ ScDPDateGroupDlg::ScDPDateGroupDlg(weld::Window* pParent,
nDatePart = css::sheet::DataPilotFieldGroupBy::MONTHS;
for (size_t nIdx = 0; nIdx < SAL_N_ELEMENTS(aDatePartResIds); ++nIdx)
{
- mxLbUnits->insert(nullptr, -1, nullptr, nullptr, nullptr, nullptr, nullptr, false);
+ mxLbUnits->append();
mxLbUnits->set_toggle(nIdx, (nDatePart & spnDateParts[ nIdx ]) != 0, 0);
mxLbUnits->set_text(nIdx, ScResId(aDatePartResIds[nIdx]), 1);
}
diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx
index 9b77bbe28472..f2d357119d8f 100644
--- a/sc/source/ui/dbgui/pvfundlg.cxx
+++ b/sc/source/ui/dbgui/pvfundlg.cxx
@@ -95,8 +95,7 @@ bool lclFillListBox(weld::TreeView& rLBox, const vector<ScDPLabelData::Member>&
bool bEmpty = false;
for (const auto& rMember : rMembers)
{
- rLBox.insert(nullptr, -1, nullptr, nullptr,
- nullptr, nullptr, nullptr, false);
+ rLBox.append();
int pos = rLBox.n_children() - 1;
rLBox.set_toggle(pos, false, 0);
OUString aName = rMember.getDisplayName();
diff --git a/sc/source/ui/miscdlgs/protectiondlg.cxx b/sc/source/ui/miscdlgs/protectiondlg.cxx
index f363f412a423..61fe3de16211 100644
--- a/sc/source/ui/miscdlgs/protectiondlg.cxx
+++ b/sc/source/ui/miscdlgs/protectiondlg.cxx
@@ -91,8 +91,7 @@ void ScTableProtectionDlg::WriteData(ScTableProtection& rData) const
void ScTableProtectionDlg::InsertEntry(const OUString& rTxt)
{
- m_xOptionsListBox->insert(nullptr, -1, nullptr, nullptr, nullptr,
- nullptr, nullptr, false);
+ m_xOptionsListBox->append();
const int nRow = m_xOptionsListBox->n_children() - 1;
m_xOptionsListBox->set_toggle(nRow, false, 0);
m_xOptionsListBox->set_text(nRow, rTxt, 1);
diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx
index 77ad31bc86e9..5830a207f3fa 100644
--- a/sc/source/ui/miscdlgs/solveroptions.cxx
+++ b/sc/source/ui/miscdlgs/solveroptions.cxx
@@ -183,8 +183,7 @@ void ScSolverOptionsDialog::FillListBox()
uno::Any aValue = maProperties[nPos].Value;
uno::TypeClass eClass = aValue.getValueTypeClass();
- m_xLbSettings->insert(nullptr, -1, nullptr, nullptr,
- nullptr, nullptr, nullptr, false);
+ m_xLbSettings->append();
if ( eClass == uno::TypeClass_BOOLEAN )
{
diff --git a/sc/source/ui/namedlg/namemgrtable.cxx b/sc/source/ui/namedlg/namemgrtable.cxx
index 8f93788269c3..246f213fd1dd 100644
--- a/sc/source/ui/namedlg/namemgrtable.cxx
+++ b/sc/source/ui/namedlg/namemgrtable.cxx
@@ -369,7 +369,7 @@ IMPL_LINK_NOARG(RangeManagerTable, SizeAllocHdl, const Size&, void)
void RangeManagerTable::addEntry(const ScRangeNameLine& rLine, bool bSetCurEntry)
{
int nRow = m_xTreeView->n_children();
- m_xTreeView->insert(nullptr, -1, nullptr, nullptr, nullptr, nullptr, nullptr, false);
+ m_xTreeView->append();
m_xTreeView->set_text(nRow, rLine.aName, 0);
m_xTreeView->set_text(nRow, rLine.aExpression, 1);
m_xTreeView->set_text(nRow, rLine.aScope, 2);
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index 16cd303ae927..450e28360b46 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -1563,7 +1563,7 @@ IMPL_LINK(SdPageObjsTLV, RequestingChildrenHdl, weld::TreeIter&, rFileEntry, boo
{
OUString sId(OUString::number(1));
m_xTreeView->insert(&rFileEntry, -1, &pPage->GetName(), &sId,
- nullptr, nullptr, &sImgPage, false);
+ nullptr, nullptr, &sImgPage, false, nullptr);
if (!xPageEntry)
{
@@ -1584,17 +1584,17 @@ IMPL_LINK(SdPageObjsTLV, RequestingChildrenHdl, weld::TreeIter&, rFileEntry, boo
if( pObj->GetObjInventor() == SdrInventor::Default && pObj->GetObjIdentifier() == OBJ_OLE2 )
{
m_xTreeView->insert(xPageEntry.get(), -1, &aStr, nullptr,
- nullptr, nullptr, &sImgOle, false);
+ nullptr, nullptr, &sImgOle, false, nullptr);
}
else if( pObj->GetObjInventor() == SdrInventor::Default && pObj->GetObjIdentifier() == OBJ_GRAF )
{
m_xTreeView->insert(xPageEntry.get(), -1, &aStr, nullptr,
- nullptr, nullptr, &sImgGraphic, false);
+ nullptr, nullptr, &sImgGraphic, false, nullptr);
}
else
{
m_xTreeView->insert(xPageEntry.get(), -1, &aStr, nullptr,
- nullptr, nullptr, &sImgObjects, false);
+ nullptr, nullptr, &sImgObjects, false, nullptr);
}
}
}
@@ -1666,7 +1666,7 @@ void SdPageObjsTLV::Fill( const SdDrawDocument* pInDoc, SfxMedium* pInMedium,
OUString sId(OUString::number(1));
// insert document name
- m_xTreeView->insert(nullptr, -1, &m_aDocName, &sId, nullptr, nullptr, &sImgDoc, true);
+ m_xTreeView->insert(nullptr, -1, &m_aDocName, &sId, nullptr, nullptr, &sImgDoc, true, nullptr);
}
SdPageObjsTLV::~SdPageObjsTLV()
diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx
index 00e30ac7cf8b..bedeb526b44e 100644
--- a/sd/source/ui/inc/sdtreelb.hxx
+++ b/sd/source/ui/inc/sdtreelb.hxx
@@ -398,7 +398,7 @@ public:
void InsertEntry(const OUString &rName, const OUString &rExpander)
{
- m_xTreeView->insert(nullptr, -1, &rName, nullptr, nullptr, nullptr, &rExpander, false);
+ m_xTreeView->insert(nullptr, -1, &rName, nullptr, nullptr, nullptr, &rExpander, false, nullptr);
}
};
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
index e820fe660d22..0cc102fd8030 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
@@ -37,63 +37,38 @@
#include <vcl/svapp.hxx>
#include <osl/diagnose.h>
-
namespace textconversiondlgs
{
-
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
-#define HEADER_BAR_BITS ( HeaderBarItemBits::LEFT | HeaderBarItemBits::CLICKABLE | HeaderBarItemBits::FIXED | HeaderBarItemBits::FIXEDPOS )
-
-DictionaryList::DictionaryList(SvSimpleTableContainer& rParent, WinBits nBits)
- : SvSimpleTable(rParent, nBits)
+DictionaryList::DictionaryList(std::unique_ptr<weld::TreeView> xControl)
+ : m_xControl(std::move(xControl))
+ , m_xIter(m_xControl->make_iterator())
, m_pED_Term(nullptr)
, m_pED_Mapping(nullptr)
, m_pLB_Property(nullptr)
, m_aToBeDeleted()
, m_nSortColumnIndex(0)
{
-}
-
-DictionaryList::~DictionaryList()
-{
- disposeOnce();
-}
-
-void DictionaryList::dispose()
-{
- m_pED_Term.clear();
- m_pED_Mapping.clear();
- m_pLB_Property.clear();
- SvSimpleTable::dispose();
+ m_xControl->make_sorted();
}
OUString DictionaryList::getPropertyTypeName( sal_Int16 nConversionPropertyType ) const
{
- if(!m_pLB_Property || !m_pLB_Property->GetEntryCount())
+ if (!m_pLB_Property || !m_pLB_Property->get_count())
return OUString();
sal_uInt16 nPos = static_cast<sal_uInt16>( nConversionPropertyType )-1;
- if(nPos<m_pLB_Property->GetEntryCount())
- return m_pLB_Property->GetEntry(nPos);
- return m_pLB_Property->GetEntry(0);
-}
-
-OUString DictionaryList::makeTabString( const DictionaryEntry& rEntry ) const
-{
- OUString aStr( rEntry.m_aTerm );
- aStr += "\t";
- aStr += rEntry.m_aMapping;
- aStr += "\t";
- aStr += getPropertyTypeName( rEntry.m_nConversionPropertyType );
- return aStr;
+ if (nPos < m_pLB_Property->get_count())
+ return m_pLB_Property->get_text(nPos);
+ return m_pLB_Property->get_text(0);
}
void DictionaryList::save()
{
- if( !m_xDictionary.is() )
+ if (!m_xDictionary.is())
return;
Reference< linguistic2::XConversionPropertyType > xPropertyType( m_xDictionary, uno::UNO_QUERY );
@@ -106,7 +81,8 @@ void DictionaryList::save()
pE = m_aToBeDeleted[nN];
m_xDictionary->removeEntry( pE->m_aTerm, pE->m_aMapping );
}
- for( nN = GetRowCount(); nN--; )
+ int nRowCount = m_xControl->n_children();
+ for( nN = nRowCount; nN--; )
{
pE = getEntryOnPos( nN );
if(pE->m_bNewEntry)
@@ -130,7 +106,8 @@ void DictionaryList::save()
void DictionaryList::deleteAll()
{
sal_Int32 nN;
- for( nN = GetRowCount(); nN--; )
+ int nRowCount = m_xControl->n_children();
+ for( nN = nRowCount; nN--; )
deleteEntryOnPos( nN );
for( nN = m_aToBeDeleted.size(); nN--; )
{
@@ -174,40 +151,34 @@ void DictionaryList::refillFromDictionary( sal_Int32 nTextConversionOptions )
nConversionPropertyType = xPropertyType->getPropertyType(aLeft, aRight);
DictionaryEntry* pEntry = new DictionaryEntry( aLeft, aRight, nConversionPropertyType );
- SvTreeListEntry* pLBEntry = InsertEntry( makeTabString( *pEntry ) );
- pLBEntry->SetUserData( pEntry );
- }
- if( GetEntryCount() > 0 )
- SelectRow( 0 );
+ m_xControl->append(m_xIter.get());
+ m_xControl->set_text(*m_xIter, pEntry->m_aTerm, 0);
+ m_xControl->set_text(*m_xIter, pEntry->m_aMapping, 1);
+ m_xControl->set_text(*m_xIter, getPropertyTypeName(pEntry->m_nConversionPropertyType), 2);
+ m_xControl->set_id(*m_xIter, OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
+ }
}
DictionaryEntry* DictionaryList::getFirstSelectedEntry() const
{
DictionaryEntry* pRet=nullptr;
- for( sal_Int32 nN=GetRowCount(); nN--; )
- {
- if( IsRowSelected( nN ) )
- {
- pRet = getEntryOnPos( nN );
- break;
- }
- }
+ int nN = m_xControl->get_selected_index();
+ if (nN != -1)
+ pRet = getEntryOnPos( nN );
return pRet;
}
-DictionaryEntry* DictionaryList::getEntryOnPos( sal_Int32 nPos ) const
+DictionaryEntry* DictionaryList::getEntryOnPos(sal_Int32 nPos) const
{
- DictionaryEntry* pEntry=nullptr;
- SvTreeListEntry* pLBEntry = GetEntryOnPos( nPos );
- if(pLBEntry)
- pEntry = static_cast<DictionaryEntry*>(pLBEntry->GetUserData());
- return pEntry;
+ OUString sLBEntry = m_xControl->get_id(nPos);
+ return reinterpret_cast<DictionaryEntry*>(sLBEntry.toInt64());
}
DictionaryEntry* DictionaryList::getTermEntry( const OUString& rTerm ) const
{
- for( sal_Int32 nN=GetRowCount(); nN--; )
+ int nRowCount = m_xControl->n_children();
+ for( sal_Int32 nN = nRowCount; nN--; )
{
DictionaryEntry* pE = getEntryOnPos( nN );
if( pE && rTerm == pE->m_aTerm )
@@ -221,25 +192,26 @@ bool DictionaryList::hasTerm( const OUString& rTerm ) const
return getTermEntry(rTerm) !=nullptr ;
}
-void DictionaryList::addEntry( const OUString& rTerm, const OUString& rMapping
- , sal_Int16 nConversionPropertyType, sal_uIntPtr nPos )
+void DictionaryList::addEntry(const OUString& rTerm, const OUString& rMapping,
+ sal_Int16 nConversionPropertyType, int nPos)
{
if( hasTerm( rTerm ) )
return;
DictionaryEntry* pEntry = new DictionaryEntry( rTerm, rMapping, nConversionPropertyType, true );
- SvTreeListEntry* pLBEntry = InsertEntryToColumn( makeTabString( *pEntry ), nPos );
- pLBEntry->SetUserData( pEntry );
- SelectRow( GetEntryPos( pLBEntry ) );
+ m_xControl->insert(nPos, m_xIter.get());
+ m_xControl->set_text(*m_xIter, pEntry->m_aTerm, 0);
+ m_xControl->set_text(*m_xIter, pEntry->m_aMapping, 1);
+ m_xControl->set_text(*m_xIter, getPropertyTypeName(pEntry->m_nConversionPropertyType), 2);
+ m_xControl->set_id(*m_xIter, OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
+ m_xControl->select(*m_xIter);
}
void DictionaryList::deleteEntryOnPos( sal_Int32 nPos )
{
- SvTreeListEntry* pLBEntry = GetEntryOnPos( nPos );
DictionaryEntry* pEntry = getEntryOnPos( nPos );
- if( pLBEntry )
- RemoveParentKeepChildren( pLBEntry );
- if( pEntry )
+ m_xControl->remove(nPos);
+ if (pEntry)
{
if( pEntry->m_bNewEntry )
delete pEntry;
@@ -248,17 +220,17 @@ void DictionaryList::deleteEntryOnPos( sal_Int32 nPos )
}
}
-sal_uIntPtr DictionaryList::deleteEntries( const OUString& rTerm )
+int DictionaryList::deleteEntries( const OUString& rTerm )
{
- sal_uIntPtr nPos = TREELIST_APPEND;
- for( sal_Int32 nN=GetRowCount(); nN--; )
+ int nPos = -1;
+ int nRowCount = m_xControl->n_children();
+ for (sal_Int32 nN = nRowCount; nN--;)
{
DictionaryEntry* pCurEntry = getEntryOnPos( nN );
if( rTerm == pCurEntry->m_aTerm )
{
nPos = nN;
- SvTreeListEntry* pCurLBEntry = GetEntryOnPos( nN );
- RemoveParentKeepChildren( pCurLBEntry );
+ m_xControl->remove(nN);
if( pCurEntry->m_bNewEntry )
delete pCurEntry;
else
@@ -268,75 +240,6 @@ sal_uIntPtr DictionaryList::deleteEntries( const OUString& rTerm )
return nPos;
}
-void DictionaryList::sortByColumn( sal_uInt16 nSortColumnIndex, bool bSortAtoZ )
-{
- m_nSortColumnIndex=nSortColumnIndex;
- if( nSortColumnIndex<3 )
- {
- if(bSortAtoZ)
- GetModel()->SetSortMode(SortAscending);
- else
- GetModel()->SetSortMode(SortDescending);
-
- GetModel()->SetCompareHdl( LINK( this, DictionaryList, CompareHdl));
- GetModel()->Resort();
- }
- else
- GetModel()->SetSortMode(SortNone);
-}
-
-
-IMPL_LINK( DictionaryList, CompareHdl, const SvSortData&, rData, sal_Int32 )
-{
- SvTreeListEntry* pLeft = const_cast<SvTreeListEntry*>(rData.pLeft);
- SvTreeListEntry* pRight = const_cast<SvTreeListEntry*>(rData.pRight);
- return ColumnCompare(pLeft,pRight);
-}
-
-sal_Int32 DictionaryList::ColumnCompare( SvTreeListEntry* pLeft, SvTreeListEntry* pRight )
-{
- sal_Int32 nCompare = 0;
-
- SvLBoxItem* pLeftItem = getItemAtColumn( pLeft, m_nSortColumnIndex );
- SvLBoxItem* pRightItem = getItemAtColumn( pRight, m_nSortColumnIndex );
-
- if(pLeftItem != nullptr && pRightItem != nullptr)
- {
- SvLBoxItemType nLeftKind = pLeftItem->GetType();
- SvLBoxItemType nRightKind = pRightItem->GetType();
-
- if (nRightKind == SvLBoxItemType::String &&
- nLeftKind == SvLBoxItemType::String)
- {
- IntlWrapper aIntlWrapper(SvtSysLocale().GetUILanguageTag());
- const CollatorWrapper* pCollator = aIntlWrapper.getCaseCollator();
-
- nCompare = pCollator->compareString( static_cast<SvLBoxString*>(pLeftItem)->GetText(),
- static_cast<SvLBoxString*>(pRightItem)->GetText());
-
- if (nCompare == 0)
- nCompare = -1;
- }
- }
- return nCompare;
-}
-
-SvLBoxItem* DictionaryList::getItemAtColumn( SvTreeListEntry* pEntry, sal_uInt16 nColumn ) const
-{
- SvLBoxItem* pItem = nullptr;
- if( pEntry )
- {
- sal_uInt16 nCount = pEntry->ItemCount();
- nColumn++;
- if( nTreeFlags & SvTreeFlags::CHKBTN )
- nColumn++;
- if( nColumn < nCount )
- pItem = &pEntry->GetItem( nColumn );
- }
- return pItem;
-}
-
-
DictionaryEntry::DictionaryEntry( const OUString& rTerm, const OUString& rMapping
, sal_Int16 nConversionPropertyType
, bool bNewEntry )
@@ -353,39 +256,26 @@ DictionaryEntry::~DictionaryEntry()
{
}
-void DictionaryList::setColSizes()
+IMPL_LINK_NOARG(ChineseDictionaryDialog, SizeAllocHdl, const Size&, void)
{
- HeaderBar &rBar = GetTheHeaderBar();
- if (rBar.GetItemCount() < 3)
+ DictionaryList* pControl = m_xCT_DictionaryToTraditional->get_visible() ?
+ m_xCT_DictionaryToTraditional.get() :
+ m_xCT_DictionaryToSimplified.get();
+ std::vector<int> aWidths;
+ int x1, x2, y, width, height;
+ if (!m_xED_Mapping->get_extents_relative_to(pControl->get_widget(), x1, y, width, height))
return;
-
- long nWidth1 = m_pED_Term->get_preferred_size().Width();
- long nWidth2 = m_pED_Mapping->get_preferred_size().Width();
- long nWidth3 = m_pLB_Property->get_preferred_size().Width();
-
- long nWidth = GetSizePixel().Width();
- long nPos3 = nWidth - nWidth3;
- long nRemainder = nWidth - (nWidth1 + nWidth2 + nWidth3);
-
- long aTabPositions[] = { 0, nWidth1 + (nRemainder/2), nPos3 };
- SvSimpleTable::SetTabs(SAL_N_ELEMENTS(aTabPositions), aTabPositions, MapUnit::MapPixel);
-}
-
-void DictionaryList::Resize()
-{
- SvSimpleTable::Resize();
- setColSizes();
+ aWidths.push_back(x1);
+ if (!m_xLB_Property->get_extents_relative_to(pControl->get_widget(), x2, y, width, height))
+ return;
+ aWidths.push_back(x2 - x1);
+ m_xCT_DictionaryToTraditional->get_widget().set_column_fixed_widths(aWidths);
+ m_xCT_DictionaryToSimplified->get_widget().set_column_fixed_widths(aWidths);
}
void DictionaryList::init(const Reference< linguistic2::XConversionDictionary>& xDictionary,
- vcl::Window *pED_Term, vcl::Window *pED_Mapping, ListBox *pLB_Property,
- vcl::Window const *pFT_Term, vcl::Window const *pFT_Mapping, vcl::Window const *pFT_Property)
+ weld::Entry *pED_Term, weld::Entry *pED_Mapping, weld::ComboBox *pLB_Property)
{
- SetStyle( WB_VSCROLL | WB_TABSTOP );
- SetSelectionMode( SelectionMode::Single );
- SetBorderStyle( WindowBorderStyle::MONO );
- SetHighlightRange();
-
if (m_xDictionary.is())
return;
@@ -395,72 +285,51 @@ void DictionaryList::init(const Reference< linguistic2::XConversionDictionary>&
m_pED_Mapping = pED_Mapping;
m_pLB_Property = pLB_Property;
- HeaderBar& rHeaderBar = GetTheHeaderBar();
-
- OUString aColumn1( OutputDevice::GetNonMnemonicString( pFT_Term->GetText() ) );
- OUString aColumn2( OutputDevice::GetNonMnemonicString( pFT_Mapping->GetText() ) );
- OUString aColumn3( OutputDevice::GetNonMnemonicString( pFT_Property->GetText() ) );
-
- long nWidth1 = m_pED_Term->get_preferred_size().Width();
- long nWidth2 = m_pED_Mapping->get_preferred_size().Width();
- long nWidth3 = m_pLB_Property->get_preferred_size().Width();
+ m_xControl->set_sort_column(0);
+ m_xControl->set_sort_indicator(TRISTATE_TRUE, 0);
- HeaderBarItemBits nBits = HEADER_BAR_BITS;
- rHeaderBar.InsertItem( 1, aColumn1, nWidth1, nBits | HeaderBarItemBits::UPARROW );
- rHeaderBar.InsertItem( 2, aColumn2, nWidth2, nBits );
- rHeaderBar.InsertItem( 3, aColumn3, nWidth3, nBits );
-
- long aTabPositions[] = { 0, nWidth1, nWidth1 + nWidth2 };
- SetTabs( SAL_N_ELEMENTS(aTabPositions), aTabPositions, MapUnit::MapPixel );
+ std::vector<int> aWidths;
+ aWidths.push_back(m_pED_Term->get_preferred_size().Width());
+ aWidths.push_back(m_pED_Mapping->get_preferred_size().Width());
+ m_xControl->set_column_fixed_widths(aWidths);
}
void ChineseDictionaryDialog::initDictionaryControl(DictionaryList *pList,
const Reference< linguistic2::XConversionDictionary>& xDictionary)
{
- //init HeaderBar and set tabs
- HeaderBar& rHeaderBar = pList->GetTheHeaderBar();
- //set hdl
- rHeaderBar.SetSelectHdl( LINK( this, ChineseDictionaryDialog, HeaderBarClick ) );
//set widgets to track the width of for columns
pList->init(xDictionary,
- m_pED_Term, m_pED_Mapping, m_pLB_Property,
- m_pFT_Term, m_pFT_Mapping, m_pFT_Property);
+ m_xED_Term.get(), m_xED_Mapping.get(), m_xLB_Property.get());
}
-ChineseDictionaryDialog::ChineseDictionaryDialog( vcl::Window* pParent )
- : ModalDialog(pParent, "ChineseDictionaryDialog",
- "svx/ui/chinesedictionary.ui")
+ChineseDictionaryDialog::ChineseDictionaryDialog(weld::Window* pParent)
+ : GenericDialogController(pParent, "svx/ui/chinesedictionary.ui", "ChineseDictionaryDialog")
, m_nTextConversionOptions(i18n::TextConversionOption::NONE)
-{
- get(m_pRB_To_Simplified, "tradtosimple");
- get(m_pRB_To_Traditional, "simpletotrad");
- get(m_pCB_Reverse, "reverse");
- get(m_pFT_Term, "termft");
- get(m_pED_Term, "term");
- get(m_pFT_Mapping, "mappingft");
- get(m_pED_Mapping, "mapping");
- get(m_pFT_Property, "propertyft");
- get(m_pLB_Property, "property");
-
- get(m_pPB_Add, "add");
- get(m_pPB_Modify, "modify");
- get(m_pPB_Delete, "delete");
-
- get(mpToSimplifiedContainer, "tradtosimpleview");
- mpToSimplifiedContainer->set_height_request(mpToSimplifiedContainer->GetTextHeight() * 8);
- m_pCT_DictionaryToSimplified = VclPtr<DictionaryList>::Create(*mpToSimplifiedContainer, 0);
- get(mpToTraditionalContainer, "simpletotradview");
- mpToTraditionalContainer->set_height_request(mpToTraditionalContainer->GetTextHeight() * 8);
- m_pCT_DictionaryToTraditional = VclPtr<DictionaryList>::Create(*mpToTraditionalContainer, 0);
+ , m_xRB_To_Simplified(m_xBuilder->weld_radio_button("tradtosimple"))
+ , m_xRB_To_Traditional(m_xBuilder->weld_radio_button("simpletotrad"))
+ , m_xCB_Reverse(m_xBuilder->weld_check_button("reverse"))
+ , m_xFT_Term(m_xBuilder->weld_label("termft"))
+ , m_xED_Term(m_xBuilder->weld_entry("term"))
+ , m_xFT_Mapping(m_xBuilder->weld_label("mappingft"))
+ , m_xED_Mapping(m_xBuilder->weld_entry("mapping"))
+ , m_xFT_Property(m_xBuilder->weld_label("propertyft"))
+ , m_xLB_Property(m_xBuilder->weld_combo_box("property"))
+ , m_xCT_DictionaryToSimplified(new DictionaryList(m_xBuilder->weld_tree_view("tradtosimpleview")))
+ , m_xCT_DictionaryToTraditional(new DictionaryList(m_xBuilder->weld_tree_view("simpletotradview")))
+ , m_xPB_Add(m_xBuilder->weld_button("add"))
+ , m_xPB_Modify(m_xBuilder->weld_button("modify"))
+ , m_xPB_Delete(m_xBuilder->weld_button("delete"))
+{
+ m_xCT_DictionaryToSimplified->set_size_request(-1, m_xCT_DictionaryToSimplified->get_height_rows(8));
+ m_xCT_DictionaryToTraditional->set_size_request(-1, m_xCT_DictionaryToTraditional->get_height_rows(8));
SvtLinguConfig aLngCfg;
bool bValue;
Any aAny( aLngCfg.GetProperty( OUString( UPN_IS_REVERSE_MAPPING ) ) );
if( aAny >>= bValue )
- m_pCB_Reverse->Check( bValue );
+ m_xCB_Reverse->set_active( bValue );
- m_pLB_Property->SetDropDownLineCount( m_pLB_Property->GetEntryCount() );
- m_pLB_Property->SelectEntryPos(0);
+ m_xLB_Property->set_active(0);
Reference< linguistic2::XConversionDictionary > xDictionary_To_Simplified;
Reference< linguistic2::XConversionDictionary > xDictionary_To_Traditional;
@@ -519,69 +388,53 @@ ChineseDictionaryDialog::ChineseDictionaryDialog( vcl::Window* pParent )
}
//init dictionary controls
- initDictionaryControl(m_pCT_DictionaryToSimplified, xDictionary_To_Simplified);
- initDictionaryControl(m_pCT_DictionaryToTraditional, xDictionary_To_Traditional);
+ initDictionaryControl(m_xCT_DictionaryToSimplified.get(), xDictionary_To_Simplified);
+ initDictionaryControl(m_xCT_DictionaryToTraditional.get(), xDictionary_To_Traditional);
+
+ //set hdl
+ m_xCT_DictionaryToSimplified->connect_column_clicked(LINK(this, ChineseDictionaryDialog, ToSimplifiedHeaderBarClick));
+ m_xCT_DictionaryToTraditional->connect_column_clicked(LINK(this, ChineseDictionaryDialog, ToTraditionalHeaderBarClick));
updateAfterDirectionChange();
- m_pED_Term->SetModifyHdl( LINK( this, ChineseDictionaryDialog, EditFieldsHdl ) );
- m_pED_Mapping->SetModifyHdl( LINK( this, ChineseDictionaryDialog, EditFieldsHdl ) );
- m_pLB_Property->SetSelectHdl( LINK( this, ChineseDictionaryDialog, EditFieldsListBoxHdl ) );
+ m_xED_Term->connect_changed( LINK( this, ChineseDictionaryDialog, EditFieldsHdl ) );
+ m_xED_Mapping->connect_changed( LINK( this, ChineseDictionaryDialog, EditFieldsHdl ) );
+ m_xLB_Property->connect_changed( LINK( this, ChineseDictionaryDialog, EditFieldsListBoxHdl ) );
- m_pRB_To_Simplified->SetClickHdl( LINK( this, ChineseDictionaryDialog, DirectionHdl ) );
- m_pRB_To_Traditional->SetClickHdl( LINK( this, ChineseDictionaryDialog, DirectionHdl ) );
+ m_xRB_To_Simplified->connect_clicked( LINK( this, ChineseDictionaryDialog, DirectionHdl ) );
+ m_xRB_To_Traditional->connect_clicked( LINK( this, ChineseDictionaryDialog, DirectionHdl ) );
- m_pCT_DictionaryToSimplified->SetSelectHdl( LINK( this, ChineseDictionaryDialog, MappingSelectHdl ));
- m_pCT_DictionaryToTraditional->SetSelectHdl( LINK( this, ChineseDictionaryDialog, MappingSelectHdl ));
+ m_xCT_DictionaryToSimplified->connect_changed( LINK( this, ChineseDictionaryDialog, MappingSelectHdl ));
+ m_xCT_DictionaryToTraditional->connect_changed( LINK( this, ChineseDictionaryDialog, MappingSelectHdl ));
- m_pPB_Add->SetClickHdl( LINK( this, ChineseDictionaryDialog, AddHdl ) );
- m_pPB_Modify->SetClickHdl( LINK( this, ChineseDictionaryDialog, ModifyHdl ) );
- m_pPB_Delete->SetClickHdl( LINK( this, ChineseDictionaryDialog, DeleteHdl ) );
-}
+ m_xPB_Add->connect_clicked( LINK( this, ChineseDictionaryDialog, AddHdl ) );
+ m_xPB_Modify->connect_clicked( LINK( this, ChineseDictionaryDialog, ModifyHdl ) );
+ m_xPB_Delete->connect_clicked( LINK( this, ChineseDictionaryDialog, DeleteHdl ) );
-ChineseDictionaryDialog::~ChineseDictionaryDialog()
-{
- disposeOnce();
+ m_xED_Mapping->connect_size_allocate(LINK(this, ChineseDictionaryDialog, SizeAllocHdl));
+ m_xLB_Property->connect_size_allocate(LINK(this, ChineseDictionaryDialog, SizeAllocHdl));
}
-void ChineseDictionaryDialog::dispose()
+ChineseDictionaryDialog::~ChineseDictionaryDialog()
{
- m_xContext=nullptr;
- m_pCT_DictionaryToSimplified.disposeAndClear();
- m_pCT_DictionaryToTraditional.disposeAndClear();
- m_pRB_To_Simplified.clear();
- m_pRB_To_Traditional.clear();
- m_pCB_Reverse.clear();
- m_pFT_Term.clear();
- m_pED_Term.clear();
- m_pFT_Mapping.clear();
- m_pED_Mapping.clear();
- m_pFT_Property.clear();
- m_pLB_Property.clear();
- mpToSimplifiedContainer.clear();
- mpToTraditionalContainer.clear();
- m_pPB_Add.clear();
- m_pPB_Modify.clear();
- m_pPB_Delete.clear();
- ModalDialog::dispose();
}
void ChineseDictionaryDialog::setDirectionAndTextConversionOptions( bool bDirectionToSimplified, sal_Int32 nTextConversionOptions /*i18n::TextConversionOption*/ )
{
- if( bDirectionToSimplified == m_pRB_To_Simplified->IsChecked()
+ if( bDirectionToSimplified == m_xRB_To_Simplified->get_active()
&& nTextConversionOptions == m_nTextConversionOptions )
return;
m_nTextConversionOptions = nTextConversionOptions;
- if( bDirectionToSimplified )
- m_pRB_To_Simplified->Check();
+ if (bDirectionToSimplified)
+ m_xRB_To_Simplified->set_active(true);
else
- m_pRB_To_Traditional->Check();
+ m_xRB_To_Traditional->set_active(true);
updateAfterDirectionChange();
}
-IMPL_LINK_NOARG(ChineseDictionaryDialog, DirectionHdl, Button*, void)
+IMPL_LINK_NOARG(ChineseDictionaryDialog, DirectionHdl, weld::Button&, void)
{
updateAfterDirectionChange();
}
@@ -590,42 +443,44 @@ void ChineseDictionaryDialog::updateAfterDirectionChange()
{
Reference< linguistic2::XConversionDictionary > xDictionary;
- if( m_pRB_To_Simplified->IsChecked() )
+ if (m_xRB_To_Simplified->get_active())
{
- mpToTraditionalContainer->Hide();
- mpToSimplifiedContainer->Show();
- xDictionary = m_pCT_DictionaryToSimplified->m_xDictionary;
+ m_xCT_DictionaryToTraditional->hide();
+ m_xCT_DictionaryToSimplified->show();
+ xDictionary = m_xCT_DictionaryToSimplified->m_xDictionary;
}
else
{
- mpToSimplifiedContainer->Hide();
- mpToTraditionalContainer->Show();
- xDictionary = m_pCT_DictionaryToTraditional->m_xDictionary;
+ m_xCT_DictionaryToSimplified->hide();
+ m_xCT_DictionaryToTraditional->show();
+ xDictionary = m_xCT_DictionaryToTraditional->m_xDictionary;
}
updateButtons();
}
-IMPL_LINK_NOARG(ChineseDictionaryDialog, EditFieldsListBoxHdl, ListBox&, void)
+IMPL_LINK_NOARG(ChineseDictionaryDialog, EditFieldsListBoxHdl, weld::ComboBox&, void)
{
updateButtons();
}
-IMPL_LINK_NOARG(ChineseDictionaryDialog, EditFieldsHdl, Edit&, void)
+
+IMPL_LINK_NOARG(ChineseDictionaryDialog, EditFieldsHdl, weld::Entry&, void)
{
updateButtons();
}
-IMPL_LINK_NOARG(ChineseDictionaryDialog, MappingSelectHdl, SvTreeListBox*, void)
+
+IMPL_LINK_NOARG(ChineseDictionaryDialog, MappingSelectHdl, weld::TreeView&, void)
{
DictionaryEntry* pE = getActiveDictionary().getFirstSelectedEntry();
- if(pE)
+ if (pE)
{
- m_pED_Term->SetText( pE->m_aTerm );
- m_pED_Mapping->SetText( pE->m_aMapping );
+ m_xED_Term->set_text( pE->m_aTerm );
+ m_xED_Mapping->set_text( pE->m_aMapping );
sal_Int16 nPos = pE->m_nConversionPropertyType-1;
- if( nPos<0 || nPos>=m_pLB_Property->GetEntryCount() )
+ if (nPos<0 || nPos>=m_xLB_Property->get_count())
nPos=0;
- if( m_pLB_Property->GetEntryCount() )
- m_pLB_Property->SelectEntryPos(nPos);
+ if (m_xLB_Property->get_count())
+ m_xLB_Property->set_active(nPos);
}
updateButtons();
@@ -633,7 +488,7 @@ IMPL_LINK_NOARG(ChineseDictionaryDialog, MappingSelectHdl, SvTreeListBox*, void)
bool ChineseDictionaryDialog::isEditFieldsHaveContent() const
{
- return !m_pED_Term->GetText().isEmpty() && !m_pED_Mapping->GetText().isEmpty();
+ return !m_xED_Term->get_text().isEmpty() && !m_xED_Mapping->get_text().isEmpty();
}
bool ChineseDictionaryDialog::isEditFieldsContentEqualsSelectedListContent() const
@@ -641,11 +496,11 @@ bool ChineseDictionaryDialog::isEditFieldsContentEqualsSelectedListContent() con
DictionaryEntry* pE = getActiveDictionary().getFirstSelectedEntry();
if( pE )
{
- if( pE->m_aTerm != m_pED_Term->GetText() )
+ if (pE->m_aTerm != m_xED_Term->get_text())
return false;
- if( pE->m_aMapping != m_pED_Mapping->GetText() )
+ if (pE->m_aMapping != m_xED_Mapping->get_text())
return false;
- if( pE->m_nConversionPropertyType != m_pLB_Property->GetSelectedEntryPos()+1 )
+ if (pE->m_nConversionPropertyType != m_xLB_Property->get_active() + 1)
return false;
return true;
}
@@ -654,75 +509,72 @@ bool ChineseDictionaryDialog::isEditFieldsContentEqualsSelectedListContent() con
const DictionaryList& ChineseDictionaryDialog::getActiveDictionary() const
{
- if( m_pRB_To_Traditional->IsChecked() )
- return *m_pCT_DictionaryToTraditional;
- return *m_pCT_DictionaryToSimplified;
+ if( m_xRB_To_Traditional->get_active() )
+ return *m_xCT_DictionaryToTraditional;
+ return *m_xCT_DictionaryToSimplified;
}
DictionaryList& ChineseDictionaryDialog::getActiveDictionary()
{
- if( m_pRB_To_Traditional->IsChecked() )
- return *m_pCT_DictionaryToTraditional;
- return *m_pCT_DictionaryToSimplified;
+ if( m_xRB_To_Traditional->get_active() )
+ return *m_xCT_DictionaryToTraditional;
+ return *m_xCT_DictionaryToSimplified;
}
const DictionaryList& ChineseDictionaryDialog::getReverseDictionary() const
{
- if( m_pRB_To_Traditional->IsChecked() )
- return *m_pCT_DictionaryToSimplified;
- return *m_pCT_DictionaryToTraditional;
+ if( m_xRB_To_Traditional->get_active() )
+ return *m_xCT_DictionaryToSimplified;
+ return *m_xCT_DictionaryToTraditional;
}
DictionaryList& ChineseDictionaryDialog::getReverseDictionary()
{
- if( m_pRB_To_Traditional->IsChecked() )
- return *m_pCT_DictionaryToSimplified;
- return *m_pCT_DictionaryToTraditional;
+ if( m_xRB_To_Traditional->get_active() )
+ return *m_xCT_DictionaryToSimplified;
+ return *m_xCT_DictionaryToTraditional;
}
void ChineseDictionaryDialog::updateButtons()
{
- bool bAdd = isEditFieldsHaveContent() && !getActiveDictionary().hasTerm( m_pED_Term->GetText() );
- m_pPB_Add->Enable( bAdd );
+ bool bAdd = isEditFieldsHaveContent() && !getActiveDictionary().hasTerm(m_xED_Term->get_text());
+ m_xPB_Add->set_sensitive( bAdd );
- m_pPB_Delete->Enable( !bAdd && getActiveDictionary().GetSelectedRowCount()>0 );
-
-// DictionaryEntry* pFirstSelectedEntry = getActiveDictionary().getFirstSelectedEntry();
+ m_xPB_Delete->set_sensitive(!bAdd && getActiveDictionary().get_selected_index() != -1);
bool bModify = false;
{
DictionaryEntry* pFirstSelectedEntry = getActiveDictionary().getFirstSelectedEntry();
- bModify = !bAdd && getActiveDictionary().GetSelectedRowCount()==1
- && pFirstSelectedEntry && pFirstSelectedEntry->m_aTerm == m_pED_Term->GetText();
+ bModify = !bAdd && pFirstSelectedEntry && pFirstSelectedEntry->m_aTerm == m_xED_Term->get_text();
if( bModify && isEditFieldsContentEqualsSelectedListContent() )
bModify = false;
}
- m_pPB_Modify->Enable( bModify );
+ m_xPB_Modify->set_sensitive( bModify );
}
-IMPL_LINK_NOARG(ChineseDictionaryDialog, AddHdl, Button*, void)
+IMPL_LINK_NOARG(ChineseDictionaryDialog, AddHdl, weld::Button&, void)
{
if( !isEditFieldsHaveContent() )
return;
- sal_Int16 nConversionPropertyType = m_pLB_Property->GetSelectedEntryPos()+1;
+ sal_Int16 nConversionPropertyType = m_xLB_Property->get_active() + 1;
- getActiveDictionary().addEntry( m_pED_Term->GetText(), m_pED_Mapping->GetText(), nConversionPropertyType );
+ getActiveDictionary().addEntry( m_xED_Term->get_text(), m_xED_Mapping->get_text(), nConversionPropertyType );
- if( m_pCB_Reverse->IsChecked() )
+ if( m_xCB_Reverse->get_active() )
{
- getReverseDictionary().deleteEntries( m_pED_Mapping->GetText() );
- getReverseDictionary().addEntry( m_pED_Mapping->GetText(), m_pED_Term->GetText(), nConversionPropertyType );
+ getReverseDictionary().deleteEntries( m_xED_Mapping->get_text() );
+ getReverseDictionary().addEntry( m_xED_Mapping->get_text(), m_xED_Term->get_text(), nConversionPropertyType );
}
updateButtons();
}
-IMPL_LINK_NOARG(ChineseDictionaryDialog, ModifyHdl, Button*, void)
+IMPL_LINK_NOARG(ChineseDictionaryDialog, ModifyHdl, weld::Button&, void)
{
- OUString aTerm( m_pED_Term->GetText() );
- OUString aMapping( m_pED_Mapping->GetText() );
- sal_Int16 nConversionPropertyType = m_pLB_Property->GetSelectedEntryPos()+1;
+ OUString aTerm( m_xED_Term->get_text() );
+ OUString aMapping( m_xED_Mapping->get_text() );
+ sal_Int16 nConversionPropertyType = m_xLB_Property->get_active() + 1;
DictionaryList& rActive = getActiveDictionary();
DictionaryList& rReverse = getReverseDictionary();
@@ -735,7 +587,7 @@ IMPL_LINK_NOARG(ChineseDictionaryDialog, ModifyHdl, Button*, void)
{
if( pE->m_aMapping != aMapping || pE->m_nConversionPropertyType != nConversionPropertyType )
{
- if( m_pCB_Reverse->IsChecked() )
+ if( m_xCB_Reverse->get_active() )
{
rReverse.deleteEntries( pE->m_aMapping );
sal_uIntPtr nPos = rReverse.deleteEntries( aMapping );
@@ -750,86 +602,84 @@ IMPL_LINK_NOARG(ChineseDictionaryDialog, ModifyHdl, Button*, void)
updateButtons();
}
-IMPL_LINK_NOARG(ChineseDictionaryDialog, DeleteHdl, Button*, void)
+IMPL_LINK_NOARG(ChineseDictionaryDialog, DeleteHdl, weld::Button&, void)
{
DictionaryList& rActive = getActiveDictionary();
DictionaryList& rReverse = getReverseDictionary();
- if( rActive.GetSelectedRowCount()>0)
+ int nEntry = rActive.get_selected_index();
+ if (nEntry != -1)
{
- DictionaryEntry* pEntry;
-
- OUString aMapping;
- for( sal_Int32 nN=rActive.GetRowCount(); nN--; )
+ DictionaryEntry* pEntry = rActive.getEntryOnPos(nEntry);
+ if (pEntry)
{
- if( rActive.IsRowSelected( nN ) )
- {
- pEntry = rActive.getEntryOnPos( nN );
- if(pEntry)
- {
- aMapping = pEntry->m_aMapping;
- rActive.deleteEntryOnPos( nN );
- if( m_pCB_Reverse->IsChecked() )
- rReverse.deleteEntries( aMapping );
- }
- break;
- }
+ OUString aMapping = pEntry->m_aMapping;
+ rActive.deleteEntryOnPos(nEntry);
+ if (m_xCB_Reverse->get_active())
+ rReverse.deleteEntries(aMapping);
}
}
updateButtons();
}
-short ChineseDictionaryDialog::Execute()
+short ChineseDictionaryDialog::run()
{
sal_Int32 nTextConversionOptions = m_nTextConversionOptions;
if(m_nTextConversionOptions & i18n::TextConversionOption::USE_CHARACTER_VARIANTS )
nTextConversionOptions = nTextConversionOptions^i18n::TextConversionOption::USE_CHARACTER_VARIANTS ;
- m_pCT_DictionaryToSimplified->refillFromDictionary( nTextConversionOptions );
- m_pCT_DictionaryToTraditional->refillFromDictionary( m_nTextConversionOptions );
+ m_xCT_DictionaryToSimplified->refillFromDictionary( nTextConversionOptions );
+ m_xCT_DictionaryToTraditional->refillFromDictionary( m_nTextConversionOptions );
- short nRet = ModalDialog::Execute();
+ short nRet = GenericDialogController::run();
if( nRet == RET_OK )
{
//save settings to configuration
SvtLinguConfig aLngCfg;
- aLngCfg.SetProperty( OUString( UPN_IS_REVERSE_MAPPING ), uno::Any(m_pCB_Reverse->IsChecked()) );
+ aLngCfg.SetProperty( OUString( UPN_IS_REVERSE_MAPPING ), uno::Any(m_xCB_Reverse->get_active()) );
- m_pCT_DictionaryToSimplified->save();
- m_pCT_DictionaryToTraditional->save();
+ m_xCT_DictionaryToSimplified->save();
+ m_xCT_DictionaryToTraditional->save();
}
- m_pCT_DictionaryToSimplified->deleteAll();
- m_pCT_DictionaryToTraditional->deleteAll();
+ m_xCT_DictionaryToSimplified->deleteAll();
+ m_xCT_DictionaryToTraditional->deleteAll();
return nRet;
}
-IMPL_LINK(ChineseDictionaryDialog, HeaderBarClick, HeaderBar*, pHeaderBar, void)
+void ChineseDictionaryDialog::HeaderBarClick(DictionaryList& rList, int nColumn)
{
- sal_uInt16 nId = pHeaderBar->GetCurItemId();
- HeaderBarItemBits nBits = pHeaderBar->GetItemBits(nId);
- if( nBits & HeaderBarItemBits::CLICKABLE )
- {
- //set new arrow positions in headerbar
- pHeaderBar->SetItemBits( getActiveDictionary().getSortColumn()+1, HEADER_BAR_BITS );
- if( nBits & HeaderBarItemBits::UPARROW )
- pHeaderBar->SetItemBits( nId, HEADER_BAR_BITS | HeaderBarItemBits::DOWNARROW );
- else
- pHeaderBar->SetItemBits( nId, HEADER_BAR_BITS | HeaderBarItemBits::UPARROW );
+ bool bSortAtoZ = rList.get_sort_order();
- //sort lists
- nBits = pHeaderBar->GetItemBits(nId);
- bool bSortAtoZ = bool(nBits & HeaderBarItemBits::UPARROW);
- getActiveDictionary().sortByColumn(nId-1,bSortAtoZ);
- getReverseDictionary().sortByColumn(nId-1,bSortAtoZ);
+ //set new arrow positions in headerbar
+ if (nColumn == rList.get_sort_column())
+ {
+ bSortAtoZ = !bSortAtoZ;
+ rList.set_sort_order(bSortAtoZ);
+ }
+ else
+ {
+ rList.set_sort_indicator(TRISTATE_INDET, rList.get_sort_column());
+ rList.set_sort_column(nColumn);
}
+
+ //sort lists
+ rList.set_sort_indicator(bSortAtoZ ? TRISTATE_TRUE : TRISTATE_FALSE, nColumn);
}
+IMPL_LINK(ChineseDictionaryDialog, ToSimplifiedHeaderBarClick, int, nColumn, void)
+{
+ HeaderBarClick(*m_xCT_DictionaryToSimplified, nColumn);
+}
-} //end namespace
+IMPL_LINK(ChineseDictionaryDialog, ToTraditionalHeaderBarClick, int, nColumn, void)
+{
+ HeaderBarClick(*m_xCT_DictionaryToTraditional, nColumn);
+}
+} //end namespace
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx
index 8904626fc024..fd4fe0b143ad 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx
@@ -20,22 +20,15 @@
#ifndef INCLUDED_SVX_SOURCE_UNODIALOGS_TEXTCONVERSIONDLGS_CHINESE_DICTIONARYDIALOG_HXX
#define INCLUDED_SVX_SOURCE_UNODIALOGS_TEXTCONVERSIONDLGS_CHINESE_DICTIONARYDIALOG_HXX
-#include <vcl/dialog.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/button.hxx>
-#include <vcl/edit.hxx>
-#include <vcl/lstbox.hxx>
-#include <svtools/simptabl.hxx>
+#include <vcl/weld.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/linguistic2/XConversionDictionary.hpp>
#include <vector>
-
namespace textconversiondlgs
{
-
struct DictionaryEntry final
{
DictionaryEntry( const OUString& rTerm, const OUString& rMapping
@@ -51,16 +44,13 @@ struct DictionaryEntry final
bool const m_bNewEntry;
};
-class DictionaryList : public SvSimpleTable
+class DictionaryList
{
public:
- DictionaryList(SvSimpleTableContainer& rParent, WinBits nBits);
- virtual ~DictionaryList() override;
- virtual void dispose() override;
+ DictionaryList(std::unique_ptr<weld::TreeView> xTreeView);
void init(const css::uno::Reference< css::linguistic2::XConversionDictionary>& xDictionary,
- vcl::Window *pED_Term, vcl::Window *pED_Mapping, ListBox *pLB_Property,
- vcl::Window const *pFT_Term, vcl::Window const *pFT_Mapping, vcl::Window const *pFT_Property);
+ weld::Entry *pED_Term, weld::Entry *pED_Mapping, weld::ComboBox *pLB_Property);
void deleteAll();
void refillFromDictionary( sal_Int32 nTextConversionOptions /*i18n::TextConversionOption*/ );
@@ -70,8 +60,8 @@ public:
bool hasTerm( const OUString& rTerm ) const;
void addEntry( const OUString& rTerm, const OUString& rMapping
- , sal_Int16 nConversionPropertyType /*linguistic2::ConversionPropertyType*/, sal_uIntPtr nPos = TREELIST_APPEND );
- sal_uIntPtr deleteEntries( const OUString& rTerm ); //return lowest position of deleted entries or LIST_APPEND if no entry was deleted
+ , sal_Int16 nConversionPropertyType /*linguistic2::ConversionPropertyType*/, int nPos = -1);
+ int deleteEntries( const OUString& rTerm ); //return lowest position of deleted entries or -1 if no entry was deleted
void deleteEntryOnPos( sal_Int32 nPos );
DictionaryEntry* getEntryOnPos( sal_Int32 nPos ) const;
DictionaryEntry* getFirstSelectedEntry() const;
@@ -79,52 +69,64 @@ public:
void sortByColumn( sal_uInt16 nSortColumnIndex, bool bSortAtoZ );
sal_uInt16 getSortColumn() const { return m_nSortColumnIndex;}
+ void set_size_request(int nWidth, int nHeight) { m_xControl->set_size_request(nWidth, nHeight); }
+ void hide() { m_xControl->hide(); }
+ void show() { m_xControl->show(); }
+ void connect_changed(const Link<weld::TreeView&, void>& rLink) { m_xControl->connect_changed(rLink); }
+ void connect_column_clicked(const Link<int, void>& rLink) { m_xControl->connect_column_clicked(rLink); }
+ bool get_sort_order() const { return m_xControl->get_sort_order(); }
+ void set_sort_order(bool bAscending) { return m_xControl->set_sort_order(bAscending); }
+ void set_sort_column(int nColumn) { return m_xControl->set_sort_column(nColumn); }
+ int get_sort_column() const { return m_xControl->get_sort_column(); }
+ int get_selected_index() const { return m_xControl->get_selected_index(); }
+ int get_height_rows(int nRows) const { return m_xControl->get_height_rows(nRows); }
+ bool get_visible() const { return m_xControl->get_visible(); }
+ void set_sort_indicator(TriState eState, int nColumn) { m_xControl->set_sort_indicator(eState, nColumn); }
+ weld::TreeView& get_widget() const { return *m_xControl; }
+
private:
OUString getPropertyTypeName( sal_Int16 nConversionPropertyType /*linguistic2::ConversionPropertyType*/ ) const;
- OUString makeTabString( const DictionaryEntry& rEntry ) const;
-
- DECL_LINK( CompareHdl, const SvSortData&, sal_Int32 );
- sal_Int32 ColumnCompare( SvTreeListEntry* pLeft, SvTreeListEntry* pRight );
- SvLBoxItem* getItemAtColumn( SvTreeListEntry* pEntry, sal_uInt16 nColumn ) const;
- void setColSizes();
-
- virtual void Resize() override;
+ DECL_LINK(ResizeHdl, const Size&, void);
public:
css::uno::Reference<css::linguistic2::XConversionDictionary> m_xDictionary;
private:
- VclPtr<vcl::Window> m_pED_Term;
- VclPtr<vcl::Window> m_pED_Mapping;
- VclPtr<ListBox> m_pLB_Property;
+ std::unique_ptr<weld::TreeView> m_xControl;
+ std::unique_ptr<weld::TreeIter> m_xIter;
+ weld::Entry* m_pED_Term;
+ weld::Entry* m_pED_Mapping;
+ weld::ComboBox* m_pLB_Property;
std::vector< DictionaryEntry* > m_aToBeDeleted;
sal_uInt16 m_nSortColumnIndex;
};
-class ChineseDictionaryDialog : public ModalDialog
+class ChineseDictionaryDialog : public weld::GenericDialogController
{
public:
- explicit ChineseDictionaryDialog( vcl::Window* pParent );
+ explicit ChineseDictionaryDialog(weld::Window* pParent);
virtual ~ChineseDictionaryDialog() override;
- virtual void dispose() override;
//this method should be called once before calling execute
void setDirectionAndTextConversionOptions( bool bDirectionToSimplified, sal_Int32 nTextConversionOptions /*i18n::TextConversionOption*/ );
- virtual short Execute() override;
+ virtual short run() override;
private:
- DECL_LINK( DirectionHdl, Button*, void );
- DECL_LINK( EditFieldsHdl, Edit&, void );
- DECL_LINK( EditFieldsListBoxHdl, ListBox&, void );
- DECL_LINK( MappingSelectHdl, SvTreeListBox*, void );
- DECL_LINK( AddHdl, Button*, void );
- DECL_LINK( ModifyHdl, Button*, void );
- DECL_LINK( DeleteHdl, Button*, void );
- DECL_LINK( HeaderBarClick, HeaderBar*, void );
+ DECL_LINK( DirectionHdl, weld::Button&, void );
+ DECL_LINK( EditFieldsHdl, weld::Entry&, void );
+ DECL_LINK( EditFieldsListBoxHdl, weld::ComboBox&, void );
+ DECL_LINK( MappingSelectHdl, weld::TreeView&, void );
+ DECL_LINK( AddHdl, weld::Button&, void );
+ DECL_LINK( ModifyHdl, weld::Button&, void );
+ DECL_LINK( DeleteHdl, weld::Button&, void );
+ static void HeaderBarClick(DictionaryList& rList, int nColumn);
+ DECL_LINK(ToSimplifiedHeaderBarClick, int, void);
+ DECL_LINK(ToTraditionalHeaderBarClick, int, void);
+ DECL_LINK(SizeAllocHdl, const Size&, void);
void initDictionaryControl(DictionaryList *pList,
const css::uno::Reference< css::linguistic2::XConversionDictionary>& xDictionary);
@@ -144,30 +146,28 @@ private:
private:
sal_Int32 m_nTextConversionOptions; //i18n::TextConversionOption
- VclPtr<RadioButton> m_pRB_To_Simplified;
- VclPtr<RadioButton> m_pRB_To_Traditional;
+ css::uno::Reference<css::uno::XComponentContext> m_xContext;
- VclPtr<CheckBox> m_pCB_Reverse;
+ std::unique_ptr<weld::RadioButton> m_xRB_To_Simplified;
+ std::unique_ptr<weld::RadioButton> m_xRB_To_Traditional;
- VclPtr<FixedText> m_pFT_Term;
- VclPtr<Edit> m_pED_Term;
+ std::unique_ptr<weld::CheckButton> m_xCB_Reverse;
- VclPtr<FixedText> m_pFT_Mapping;
- VclPtr<Edit> m_pED_Mapping;
+ std::unique_ptr<weld::Label> m_xFT_Term;
+ std::unique_ptr<weld::Entry> m_xED_Term;
- VclPtr<FixedText> m_pFT_Property;
- VclPtr<ListBox> m_pLB_Property;
+ std::unique_ptr<weld::Label> m_xFT_Mapping;
+ std::unique_ptr<weld::Entry> m_xED_Mapping;
- VclPtr<SvSimpleTableContainer> mpToSimplifiedContainer;
- VclPtr<DictionaryList> m_pCT_DictionaryToSimplified;
- VclPtr<SvSimpleTableContainer> mpToTraditionalContainer;
- VclPtr<DictionaryList> m_pCT_DictionaryToTraditional;
+ std::unique_ptr<weld::Label> m_xFT_Property;
+ std::unique_ptr<weld::ComboBox> m_xLB_Property;
- VclPtr<PushButton> m_pPB_Add;
- VclPtr<PushButton> m_pPB_Modify;
- VclPtr<PushButton> m_pPB_Delete;
+ std::unique_ptr<DictionaryList> m_xCT_DictionaryToSimplified;
+ std::unique_ptr<DictionaryList> m_xCT_DictionaryToTraditional;
- css::uno::Reference<css::uno::XComponentContext> m_xContext;
+ std::unique_ptr<weld::Button> m_xPB_Add;
+ std::unique_ptr<weld::Button> m_xPB_Modify;
+ std::unique_ptr<weld::Button> m_xPB_Delete;
};
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
index 048b840b9a1f..004f5957f9d4 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
@@ -32,8 +32,7 @@ namespace textconversiondlgs
using namespace ::com::sun::star;
ChineseTranslation_UnoDialog::ChineseTranslation_UnoDialog()
- : m_pDialog( nullptr )
- , m_bDisposed(false)
+ : m_bDisposed(false)
, m_bInDispose(false)
, m_aContainerMutex()
, m_aDisposeEventListeners(m_aContainerMutex)
@@ -48,11 +47,10 @@ ChineseTranslation_UnoDialog::~ChineseTranslation_UnoDialog()
void ChineseTranslation_UnoDialog::impl_DeleteDialog()
{
- if( m_pDialog )
+ if (m_xDialog)
{
- if(m_pDialog->IsInExecute())
- m_pDialog->EndDialog();
- m_pDialog.disposeAndClear();
+ m_xDialog->response(RET_CANCEL);
+ m_xDialog.reset();
}
}
@@ -110,39 +108,23 @@ void SAL_CALL ChineseTranslation_UnoDialog::initialize( const uno::Sequence< uno
}
}
-
sal_Int16 SAL_CALL ChineseTranslation_UnoDialog::execute()
{
sal_Int16 nRet = ui::dialogs::ExecutableDialogResults::CANCEL;
{
SolarMutexGuard aSolarGuard;
- if( m_bDisposed || m_bInDispose )
+ if (m_bDisposed || m_bInDispose)
return nRet;
-
- if( !m_pDialog )
- {
- vcl::Window* pParent = nullptr;
- if( m_xParentWindow.is() )
- {
- VCLXWindow* pImplementation = VCLXWindow::GetImplementation(m_xParentWindow);
- if (pImplementation)
- pParent = pImplementation->GetWindow().get();
- }
- uno::Reference< XComponent > xComp( this );
- m_pDialog = VclPtr<ChineseTranslationDialog>::Create( pParent );
- }
- if( !m_pDialog )
- return nRet;
- nRet = m_pDialog->Execute();
- if(nRet==RET_OK)
+ if (!m_xDialog)
+ m_xDialog.reset(new ChineseTranslationDialog(Application::GetFrameWeld(m_xParentWindow)));
+ nRet = m_xDialog->run();
+ if (nRet == RET_OK)
nRet=ui::dialogs::ExecutableDialogResults::OK;
}
return nRet;
}
-
// lang::XComponent
-
void SAL_CALL ChineseTranslation_UnoDialog::dispose()
{
lang::EventObject aEvt;
@@ -185,11 +167,13 @@ uno::Reference< beans::XPropertySetInfo > SAL_CALL ChineseTranslation_UnoDialog:
{
return nullptr;
}
+
void SAL_CALL ChineseTranslation_UnoDialog::setPropertyValue( const OUString&, const uno::Any& )
{
//only read only properties
throw beans::PropertyVetoException();
}
+
uno::Any SAL_CALL ChineseTranslation_UnoDialog::getPropertyValue( const OUString& rPropertyName )
{
uno::Any aRet;
@@ -199,9 +183,9 @@ uno::Any SAL_CALL ChineseTranslation_UnoDialog::getPropertyValue( const OUString
{
SolarMutexGuard aSolarGuard;
- if( m_bDisposed || m_bInDispose || !m_pDialog )
+ if (m_bDisposed || m_bInDispose || !m_xDialog)
return aRet;
- m_pDialog->getSettings( bDirectionToSimplified, bTranslateCommonTerms );
+ m_xDialog->getSettings(bDirectionToSimplified, bTranslateCommonTerms);
}
if( rPropertyName == "IsDirectionToSimplified" )
@@ -223,25 +207,27 @@ uno::Any SAL_CALL ChineseTranslation_UnoDialog::getPropertyValue( const OUString
return aRet;
}
+
void SAL_CALL ChineseTranslation_UnoDialog::addPropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& )
{
//only not bound properties -> ignore listener
}
+
void SAL_CALL ChineseTranslation_UnoDialog::removePropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& )
{
//only not bound properties -> ignore listener
}
+
void SAL_CALL ChineseTranslation_UnoDialog::addVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& )
{
//only not bound properties -> ignore listener
}
+
void SAL_CALL ChineseTranslation_UnoDialog::removeVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& )
{
//only not bound properties -> ignore listener
}
-
} //end namespace
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx
index cd73f0912ff8..ab7d204b03b4 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx
@@ -114,7 +114,7 @@ private:
css::uno::Reference<
css::awt::XWindow > m_xParentWindow;
- VclPtr<ChineseTranslationDialog> m_pDialog;
+ std::unique_ptr<ChineseTranslationDialog> m_xDialog;
bool m_bDisposed; ///Dispose call ready.
bool m_bInDispose;///In dispose call
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx
index a6ac160ebf2a..517570408f40 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx
@@ -24,107 +24,70 @@
#include <unotools/lingucfg.hxx>
#include <unotools/linguprops.hxx>
-
namespace textconversiondlgs
{
-
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
-ChineseTranslationDialog::ChineseTranslationDialog( vcl::Window* pParent )
- : ModalDialog(pParent, "ChineseConversionDialog", "svx/ui/chineseconversiondialog.ui")
- , m_pDictionaryDialog(nullptr)
+ChineseTranslationDialog::ChineseTranslationDialog(weld::Window* pParent)
+ : GenericDialogController(pParent, "svx/ui/chineseconversiondialog.ui", "ChineseConversionDialog")
+ , m_xBP_OK(m_xBuilder->weld_button("ok"))
+ , m_xPB_Editterms(m_xBuilder->weld_button("editterms"))
+ , m_xRB_To_Simplified(m_xBuilder->weld_radio_button("tosimplified"))
+ , m_xRB_To_Traditional(m_xBuilder->weld_radio_button("totraditional"))
+ , m_xCB_Translate_Commonterms(m_xBuilder->weld_check_button("commonterms"))
{
- get(m_pBP_OK, "ok");
- get(m_pPB_Editterms, "editterms");
- get(m_pRB_To_Simplified, "tosimplified");
- get(m_pRB_To_Traditional, "totraditional");
- get(m_pCB_Translate_Commonterms, "commonterms");
-
SvtLinguConfig aLngCfg;
bool bValue = false;
Any aAny( aLngCfg.GetProperty( OUString( UPN_IS_DIRECTION_TO_SIMPLIFIED ) ) );
aAny >>= bValue;
if( bValue )
- m_pRB_To_Simplified->Check();
+ m_xRB_To_Simplified->set_active(true);
else
- m_pRB_To_Traditional->Check();
+ m_xRB_To_Traditional->set_active(true);
aAny = aLngCfg.GetProperty( OUString( UPN_IS_TRANSLATE_COMMON_TERMS ) );
if( aAny >>= bValue )
- m_pCB_Translate_Commonterms->Check( bValue );
+ m_xCB_Translate_Commonterms->set_active( bValue );
- m_pPB_Editterms->SetClickHdl( LINK( this, ChineseTranslationDialog, DictionaryHdl ) );
- m_pBP_OK->SetClickHdl( LINK( this, ChineseTranslationDialog, OkHdl ) );
+ m_xPB_Editterms->connect_clicked( LINK( this, ChineseTranslationDialog, DictionaryHdl ) );
+ m_xBP_OK->connect_clicked( LINK( this, ChineseTranslationDialog, OkHdl ) );
}
ChineseTranslationDialog::~ChineseTranslationDialog()
{
- disposeOnce();
-}
-
-void ChineseTranslationDialog::dispose()
-{
- if(m_pDictionaryDialog)
- {
- if(m_pDictionaryDialog->IsInExecute())
- m_pDictionaryDialog->EndDialog();
- }
- m_pDictionaryDialog.disposeAndClear();
- m_pRB_To_Simplified.clear();
- m_pRB_To_Traditional.clear();
- m_pCB_Translate_Commonterms.clear();
- m_pPB_Editterms.clear();
- m_pBP_OK.clear();
- ModalDialog::dispose();
}
void ChineseTranslationDialog::getSettings( bool& rbDirectionToSimplified
, bool& rbTranslateCommonTerms ) const
{
- rbDirectionToSimplified = m_pRB_To_Simplified->IsChecked();
- rbTranslateCommonTerms = m_pCB_Translate_Commonterms->IsChecked();
+ rbDirectionToSimplified = m_xRB_To_Simplified->get_active();
+ rbTranslateCommonTerms = m_xCB_Translate_Commonterms->get_active();
}
-IMPL_LINK_NOARG(ChineseTranslationDialog, OkHdl, Button*, void)
+IMPL_LINK_NOARG(ChineseTranslationDialog, OkHdl, weld::Button&, void)
{
//save settings to configuration
SvtLinguConfig aLngCfg;
Any aAny;
- aAny <<= m_pRB_To_Simplified->IsChecked();
+ aAny <<= m_xRB_To_Simplified->get_active();
aLngCfg.SetProperty( OUString( UPN_IS_DIRECTION_TO_SIMPLIFIED ), aAny );
- aAny <<= m_pCB_Translate_Commonterms->IsChecked();
+ aAny <<= m_xCB_Translate_Commonterms->get_active();
aLngCfg.SetProperty( OUString( UPN_IS_TRANSLATE_COMMON_TERMS ), aAny );
- EndDialog( RET_OK );
+ m_xDialog->response(RET_OK);
}
-IMPL_LINK_NOARG(ChineseTranslationDialog, DictionaryHdl, Button*, void)
+IMPL_LINK_NOARG(ChineseTranslationDialog, DictionaryHdl, weld::Button&, void)
{
- if( !m_pDictionaryDialog )
- {
- m_pDictionaryDialog = VclPtr<ChineseDictionaryDialog>::Create(this);
- }
- if( m_pDictionaryDialog )
- {
- if( m_pDictionaryDialog->IsInExecute() )
- {
- if( !m_pDictionaryDialog->IsReallyVisible() )
- {
- m_pDictionaryDialog->ToTop();
- m_pDictionaryDialog->GrabFocusToFirstControl();
- }
- }
- else
- {
- sal_Int32 nTextConversionOptions = i18n::TextConversionOption::NONE;
- if( !m_pCB_Translate_Commonterms->IsChecked() )
- nTextConversionOptions = nTextConversionOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
- m_pDictionaryDialog->setDirectionAndTextConversionOptions( m_pRB_To_Simplified->IsChecked(), nTextConversionOptions );
- m_pDictionaryDialog->Execute();
- }
- }
+ if( !m_xDictionaryDialog )
+ m_xDictionaryDialog.reset(new ChineseDictionaryDialog(m_xDialog.get()));
+ sal_Int32 nTextConversionOptions = i18n::TextConversionOption::NONE;
+ if (!m_xCB_Translate_Commonterms->get_active())
+ nTextConversionOptions = nTextConversionOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
+ m_xDictionaryDialog->setDirectionAndTextConversionOptions(m_xRB_To_Simplified->get_active(), nTextConversionOptions);
+ m_xDictionaryDialog->run();
}
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx
index 4fb45c93ee20..7d0d0180022a 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx
@@ -20,44 +20,35 @@
#ifndef INCLUDED_SVX_SOURCE_UNODIALOGS_TEXTCONVERSIONDLGS_CHINESE_TRANSLATIONDIALOG_HXX
#define INCLUDED_SVX_SOURCE_UNODIALOGS_TEXTCONVERSIONDLGS_CHINESE_TRANSLATIONDIALOG_HXX
-#include <vcl/dialog.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/button.hxx>
-
+#include <vcl/weld.hxx>
namespace textconversiondlgs
{
-
class ChineseDictionaryDialog;
-class ChineseTranslationDialog : public ModalDialog
+class ChineseTranslationDialog : public weld::GenericDialogController
{
public:
- explicit ChineseTranslationDialog( vcl::Window* pParent );
+ explicit ChineseTranslationDialog(weld::Window* pParent);
virtual ~ChineseTranslationDialog() override;
- virtual void dispose() override;
void getSettings( bool& rbDirectionToSimplified
, bool& rbTranslateCommonTerms ) const;
private:
- DECL_LINK( DictionaryHdl, Button*, void );
- DECL_LINK( OkHdl, Button*, void );
+ DECL_LINK( DictionaryHdl, weld::Button&, void );
+ DECL_LINK( OkHdl, weld::Button&, void );
private:
- VclPtr<RadioButton> m_pRB_To_Simplified;
- VclPtr<RadioButton> m_pRB_To_Traditional;
-
- VclPtr<CheckBox> m_pCB_Translate_Commonterms;
- VclPtr<PushButton> m_pPB_Editterms;
-
- VclPtr<OKButton> m_pBP_OK;
-
- VclPtr<ChineseDictionaryDialog> m_pDictionaryDialog;
+ std::unique_ptr<weld::Button> m_xBP_OK;
+ std::unique_ptr<weld::Button> m_xPB_Editterms;
+ std::unique_ptr<weld::RadioButton> m_xRB_To_Simplified;
+ std::unique_ptr<weld::RadioButton> m_xRB_To_Traditional;
+ std::unique_ptr<weld::CheckButton> m_xCB_Translate_Commonterms;
+ std::unique_ptr<ChineseDictionaryDialog> m_xDictionaryDialog;
};
-
} //end namespace
#endif
diff --git a/svx/uiconfig/ui/chineseconversiondialog.ui b/svx/uiconfig/ui/chineseconversiondialog.ui
index 8bafe7203111..9e05a4414fab 100644
--- a/svx/uiconfig/ui/chineseconversiondialog.ui
+++ b/svx/uiconfig/ui/chineseconversiondialog.ui
@@ -1,12 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="svx">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="ChineseConversionDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="chineseconversiondialog|ChineseConversionDialog">Chinese Conversion</property>
+ <property name="modal">True</property>
+ <property name="default_width">0</property>
+ <property name="default_height">0</property>
<property name="type_hint">dialog</property>
+ <child>
+ <placeholder/>
+ </child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
@@ -108,7 +114,6 @@
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
- <property name="group">totraditional</property>
</object>
<packing>
<property name="left_attach">0</property>
diff --git a/svx/uiconfig/ui/chinesedictionary.ui b/svx/uiconfig/ui/chinesedictionary.ui
index 39015bcc0343..47cc1c454b55 100644
--- a/svx/uiconfig/ui/chinesedictionary.ui
+++ b/svx/uiconfig/ui/chinesedictionary.ui
@@ -1,13 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="svx">
<requires lib="gtk+" version="3.18"/>
- <requires lib="LibreOffice" version="1.0"/>
<object class="GtkDialog" id="ChineseDictionaryDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="chinesedictionary|ChineseDictionaryDialog">Edit Dictionary</property>
+ <property name="modal">True</property>
+ <property name="default_width">0</property>
+ <property name="default_height">0</property>
<property name="type_hint">dialog</property>
+ <child>
+ <placeholder/>
+ </child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
@@ -148,9 +153,9 @@
<object class="GtkLabel" id="termft">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="chinesedictionary|termft">Term</property>
<property name="use_underline">True</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -158,81 +163,19 @@
</packing>
</child>
<child>
- <object class="GtkEntry" id="term">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hexpand">True</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
<object class="GtkLabel" id="mappingft">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="chinesedictionary|mappingft">Mapping</property>
<property name="use_underline">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="mapping">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hexpand">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="propertyft">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes" context="chinesedictionary|propertyft">Property</property>
- <property name="use_underline">True</property>
</object>
<packing>
- <property name="left_attach">2</property>
+ <property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
- <object class="GtkComboBoxText" id="property">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <items>
- <item translatable="yes" context="chinesedictionary|property">Other</item>
- <item translatable="yes" context="chinesedictionary|property">Foreign</item>
- <item translatable="yes" context="chinesedictionary|property">First name</item>
- <item translatable="yes" context="chinesedictionary|property">Last name</item>
- <item translatable="yes" context="chinesedictionary|property">Title</item>
- <item translatable="yes" context="chinesedictionary|property">Status</item>
- <item translatable="yes" context="chinesedictionary|property">Place name</item>
- <item translatable="yes" context="chinesedictionary|property">Business</item>
- <item translatable="yes" context="chinesedictionary|property">Adjective</item>
- <item translatable="yes" context="chinesedictionary|property">Idiom</item>
- <item translatable="yes" context="chinesedictionary|property">Abbreviation</item>
- <item translatable="yes" context="chinesedictionary|property">Numerical</item>
- <item translatable="yes" context="chinesedictionary|property">Noun</item>
- <item translatable="yes" context="chinesedictionary|property">Verb</item>
- <item translatable="yes" context="chinesedictionary|property">Brand name</item>
- </items>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
<object class="GtkButtonBox" id="buttonbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -289,38 +232,214 @@
</packing>
</child>
<child>
- <object class="GtkGrid" id="grid3">
+ <object class="GtkLabel" id="propertyft">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="chinesedictionary|propertyft">Property</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="property">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <items>
+ <item translatable="yes" context="chinesedictionary|property">Other</item>
+ <item translatable="yes" context="chinesedictionary|property">Foreign</item>
+ <item translatable="yes" context="chinesedictionary|property">First name</item>
+ <item translatable="yes" context="chinesedictionary|property">Last name</item>
+ <item translatable="yes" context="chinesedictionary|property">Title</item>
+ <item translatable="yes" context="chinesedictionary|property">Status</item>
+ <item translatable="yes" context="chinesedictionary|property">Place name</item>
+ <item translatable="yes" context="chinesedictionary|property">Business</item>
+ <item translatable="yes" context="chinesedictionary|property">Adjective</item>
+ <item translatable="yes" context="chinesedictionary|property">Idiom</item>
+ <item translatable="yes" context="chinesedictionary|property">Abbreviation</item>
+ <item translatable="yes" context="chinesedictionary|property">Numerical</item>
+ <item translatable="yes" context="chinesedictionary|property">Noun</item>
+ <item translatable="yes" context="chinesedictionary|property">Verb</item>
+ <item translatable="yes" context="chinesedictionary|property">Brand name</item>
+ </items>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="mapping">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="term">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="vexpand">True</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="svtlo-SvSimpleTableContainer" id="tradtosimpleview:border">
+ <object class="GtkScrolledWindow">
<property name="visible">True</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="Simple Table Container-selection"/>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="tradtosimpleview">
+ <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">liststore3</property>
+ <property name="search_column">0</property>
+ <property name="show_expanders">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn3">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="title" translatable="yes" context="chinesedictionary|termft">Term</property>
+ <property name="clickable">True</property>
+ <property name="sort_indicator">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer1"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn4">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="title" translatable="yes" context="chinesedictionary|mappingft">Mapping</property>
+ <property name="clickable">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer2"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn5">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="title" translatable="yes" context="chinesedictionary|propertyft">Property</property>
+ <property name="clickable">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer3"/>
+ <attributes>
+ <attribute name="text">2</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
</child>
</object>
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list