summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basctl/source/basicide/bastype2.cxx2
-rw-r--r--basctl/source/basicide/moduldl2.cxx3
-rw-r--r--basctl/source/dlged/managelang.cxx3
-rw-r--r--cui/source/customize/cfgutil.cxx8
-rw-r--r--cui/source/dialogs/hangulhanjadlg.cxx5
-rw-r--r--cui/source/dialogs/linkdlg.cxx6
-rw-r--r--cui/source/dialogs/multipat.cxx3
-rw-r--r--cui/source/dialogs/srchxtra.cxx3
-rw-r--r--cui/source/inc/cfgutil.hxx2
-rw-r--r--cui/source/options/certpath.cxx6
-rw-r--r--cui/source/tabpages/autocdlg.cxx12
-rw-r--r--cui/uiconfig/ui/hangulhanjaoptdialog.ui8
-rw-r--r--extensions/source/propctrlr/selectlabeldialog.cxx6
-rw-r--r--include/vcl/treelistbox.hxx2
-rw-r--r--include/vcl/weld.hxx31
-rw-r--r--sc/source/ui/dbgui/dpgroupdlg.cxx2
-rw-r--r--sc/source/ui/dbgui/pvfundlg.cxx3
-rw-r--r--sc/source/ui/miscdlgs/protectiondlg.cxx3
-rw-r--r--sc/source/ui/miscdlgs/solveroptions.cxx3
-rw-r--r--sc/source/ui/namedlg/namemgrtable.cxx2
-rw-r--r--sd/source/ui/dlg/sdtreelb.cxx10
-rw-r--r--sd/source/ui/inc/sdtreelb.hxx2
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx550
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx112
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx48
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx2
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx89
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx31
-rw-r--r--svx/uiconfig/ui/chineseconversiondialog.ui9
-rw-r--r--svx/uiconfig/ui/chinesedictionary.ui313
-rw-r--r--sw/source/ui/config/optload.cxx10
-rw-r--r--sw/source/ui/index/cnttab.cxx4
-rw-r--r--vcl/source/app/salvtables.cxx129
-rw-r--r--vcl/source/treelist/treelistbox.cxx13
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx132
-rw-r--r--xmlsecurity/source/dialogs/certificatechooser.cxx3
-rw-r--r--xmlsecurity/source/dialogs/certificateviewer.cxx2
-rw-r--r--xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx2
38 files changed, 852 insertions, 722 deletions
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>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <object class="svtlo-SvSimpleTableContainer" id="simpletotradview:border">
+ <object class="GtkScrolledWindow">
<property name="can_focus">True</property>
<property name="no_show_all">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="Simple Table Container-selection1"/>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="simpletotradview">
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="no_show_all">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="model">liststore2</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="treeviewcolumn33">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="title" translatable="yes" context="chinesedictionary|termft">Term</property>
+ <property name="reorderable">True</property>
+ <property name="sort_indicator">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer11"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn44">
+ <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="cellrenderer22"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn55">
+ <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="cellrenderer33"/>
+ <attributes>
+ <attribute name="text">2</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
</child>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
@@ -354,13 +473,6 @@
<action-widget response="-11">help</action-widget>
</action-widgets>
</object>
- <object class="GtkSizeGroup" id="sizegroup1">
- <property name="mode">both</property>
- <widgets>
- <widget name="tradtosimpleview:border"/>
- <widget name="simpletotradview:border"/>
- </widgets>
- </object>
<object class="GtkSizeGroup" id="sizegroup2">
<widgets>
<widget name="termft"/>
@@ -379,4 +491,35 @@
<widget name="property"/>
</widgets>
</object>
+ <object class="GtkTreeStore" id="liststore2">
+ <columns>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name text2 -->
+ <column type="gchararray"/>
+ <!-- column-name text3 -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
+ <object class="GtkTreeStore" id="liststore3">
+ <columns>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name text2 -->
+ <column type="gchararray"/>
+ <!-- column-name text3 -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
+ <object class="GtkSizeGroup" id="sizegroup1">
+ <property name="mode">both</property>
+ <widgets>
+ <widget name="tradtosimpleview"/>
+ <widget name="simpletotradview"/>
+ </widgets>
+ </object>
</interface>
diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index ee185cbeac53..7844dc95b3aa 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -616,16 +616,16 @@ void SwCaptionOptPage::Reset( const SfxItemSet* rSet)
m_xCheckLB->clear(); // remove all entries
// Writer objects
- sal_uLong nPos = 0;
- m_xCheckLB->insert(nullptr, -1, nullptr, nullptr, nullptr, nullptr, nullptr, false);
+ int nPos = 0;
+ m_xCheckLB->append();
m_xCheckLB->set_toggle(nPos, false, 0);
m_xCheckLB->set_text(nPos, m_sSWTable, 1);
SetOptions(nPos++, TABLE_CAP);
- m_xCheckLB->insert(nullptr, -1, nullptr, nullptr, nullptr, nullptr, nullptr, false);
+ m_xCheckLB->append();
m_xCheckLB->set_toggle(nPos, false, 0);
m_xCheckLB->set_text(nPos, m_sSWFrame, 1);
SetOptions(nPos++, FRAME_CAP);
- m_xCheckLB->insert(nullptr, -1, nullptr, nullptr, nullptr, nullptr, nullptr, false);
+ m_xCheckLB->append();
m_xCheckLB->set_toggle(nPos, false, 0);
m_xCheckLB->set_text(nPos, m_sSWGraphic, 1);
SetOptions(nPos++, GRAPHIC_CAP);
@@ -650,7 +650,7 @@ void SwCaptionOptPage::Reset( const SfxItemSet* rSet)
sClass = aObjS[i].GetHumanName();
// don't show product version
sClass = sClass.replaceFirst( sComplete, sWithoutVersion );
- m_xCheckLB->insert(nullptr, -1, nullptr, nullptr, nullptr, nullptr, nullptr, false);
+ m_xCheckLB->append();
m_xCheckLB->set_toggle(nPos, false, 0);
m_xCheckLB->set_text(nPos, sClass, 1);
SetOptions( nPos++, OLE_CAP, &rOleId );
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index ce4ca2867a05..df1374c1a20f 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -787,10 +787,10 @@ SwTOXSelectTabPage::SwTOXSelectTabPage(TabPageParent pParent, const SfxItemSet&
for (size_t i = 0; i < SAL_N_ELEMENTS(RES_SRCTYPES); ++i)
{
OUString sId(OUString::number(static_cast<sal_uInt32>(RES_SRCTYPES[i].second)));
- m_xFromObjCLB->insert(nullptr, -1, nullptr, &sId,
- nullptr, nullptr, nullptr, false);
+ m_xFromObjCLB->append();
m_xFromObjCLB->set_toggle(i, false, 0);
m_xFromObjCLB->set_text(i, SwResId(RES_SRCTYPES[i].first), 1);
+ m_xFromObjCLB->set_id(i, sId);
}
SetExchangeSupport();
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index df7de9561743..827256ca41d7 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -2087,6 +2087,7 @@ private:
VclPtr<SvTabListBox> m_xTreeView;
SvLBoxButtonData m_aCheckButtonData;
SvLBoxButtonData m_aRadioButtonData;
+ int m_nSortColumn;
DECL_LINK(SelectHdl, SvTreeListBox*, void);
DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool);
@@ -2095,12 +2096,14 @@ private:
DECL_LINK(HeaderBarClickedHdl, HeaderBar*, void);
DECL_LINK(ToggleHdl, SvLBoxButtonData*, void);
DECL_LINK(VisibleRangeChangedHdl, SvTreeListBox*, void);
+ DECL_LINK(CompareHdl, const SvSortData&, sal_Int32);
public:
SalInstanceTreeView(SvTabListBox* pTreeView, SalInstanceBuilder* pBuilder, bool bTakeOwnership)
: SalInstanceContainer(pTreeView, pBuilder, bTakeOwnership)
, m_xTreeView(pTreeView)
, m_aCheckButtonData(pTreeView, false)
, m_aRadioButtonData(pTreeView, true)
+ , m_nSortColumn(-1)
{
m_xTreeView->SetNodeDefaultImages();
m_xTreeView->SetSelectHdl(LINK(this, SalInstanceTreeView, SelectHdl));
@@ -2186,8 +2189,8 @@ 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) override
+ const OUString* pIconName, VirtualDevice* pImageSurface,
+ const OUString* pExpanderName, bool bChildrenOnDemand, weld::TreeIter* pRet) override
{
SalInstanceTreeIter* pVclIter = static_cast<SalInstanceTreeIter*>(pParent);
SvTreeListEntry* iter = pVclIter ? pVclIter->iter : nullptr;
@@ -2224,6 +2227,12 @@ public:
m_xTreeView->SetCollapsedEntryBmp(pEntry, aImage);
}
+ if (pRet)
+ {
+ SalInstanceTreeIter* pVclRetIter = static_cast<SalInstanceTreeIter*>(pRet);
+ pVclRetIter->iter = pEntry;
+ }
+
if (bChildrenOnDemand)
{
m_xTreeView->InsertEntry("<dummy>", pEntry, false, 0, nullptr);
@@ -2455,13 +2464,18 @@ public:
return *pRet;
}
- virtual void set_id(int pos, const OUString& rId) override
+ void set_id(SvTreeListEntry* pEntry, const OUString& rId)
{
- SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
m_aUserData.emplace_back(std::make_unique<OUString>(rId));
pEntry->SetUserData(m_aUserData.back().get());
}
+ virtual void set_id(int pos, const OUString& rId) override
+ {
+ SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
+ set_id(pEntry, rId);
+ }
+
virtual int get_selected_index() const override
{
assert(m_xTreeView->IsUpdateMode() && "don't request selection when frozen");
@@ -2644,6 +2658,12 @@ public:
return OUString();
}
+ virtual void set_id(weld::TreeIter& rIter, const OUString& rId) override
+ {
+ SalInstanceTreeIter& rVclIter = static_cast<SalInstanceTreeIter&>(rIter);
+ set_id(rVclIter.iter, rId);
+ }
+
virtual void set_expander_image(const weld::TreeIter& rIter, const OUString& rImage) override
{
const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
@@ -2704,36 +2724,76 @@ public:
virtual void make_sorted() override
{
m_xTreeView->SetStyle(m_xTreeView->GetStyle() | WB_SORT);
+ m_xTreeView->GetModel()->SetCompareHdl(LINK(this, SalInstanceTreeView, CompareHdl));
set_sort_order(true);
}
virtual void set_sort_order(bool bAscending) override
{
+ SvTreeList* pListModel = m_xTreeView->GetModel();
+ pListModel->SetSortMode(bAscending ? SortAscending : SortDescending);
+ pListModel->Resort();
+ }
+
+ virtual bool get_sort_order() const override
+ {
+ return m_xTreeView->GetModel()->GetSortMode() == SortAscending;
+ }
+
+ virtual void set_sort_indicator(TriState eState, int col) override
+ {
+ if (col == -1)
+ col = 0;
+
SvHeaderTabListBox* pHeaderBox = dynamic_cast<SvHeaderTabListBox*>(m_xTreeView.get());
if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
{
- sal_uInt16 nTextId = pHeaderBar->GetItemId(0);
+ sal_uInt16 nTextId = pHeaderBar->GetItemId(col);
HeaderBarItemBits nBits = pHeaderBar->GetItemBits(nTextId);
- if (nBits & HeaderBarItemBits::CLICKABLE)
+ nBits &= ~HeaderBarItemBits::UPARROW;
+ nBits &= ~HeaderBarItemBits::DOWNARROW;
+ if (eState != TRISTATE_INDET)
{
- nBits &= ~HeaderBarItemBits::UPARROW;
- nBits &= ~HeaderBarItemBits::DOWNARROW;
- if (bAscending)
+ if (eState == TRISTATE_TRUE)
nBits |= HeaderBarItemBits::DOWNARROW;
else
nBits |= HeaderBarItemBits::UPARROW;
- pHeaderBar->SetItemBits(nTextId, nBits);
}
+ pHeaderBar->SetItemBits(nTextId, nBits);
}
+ }
- SvTreeList* pListModel = m_xTreeView->GetModel();
- pListModel->SetSortMode(bAscending ? SortAscending : SortDescending);
- pListModel->Resort();
+ virtual TriState get_sort_indicator(int col) const override
+ {
+ if (col == -1)
+ col = 0;
+
+ SvHeaderTabListBox* pHeaderBox = dynamic_cast<SvHeaderTabListBox*>(m_xTreeView.get());
+ if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
+ {
+ sal_uInt16 nTextId = pHeaderBar->GetItemId(col);
+ HeaderBarItemBits nBits = pHeaderBar->GetItemBits(nTextId);
+ if (nBits & HeaderBarItemBits::DOWNARROW)
+ return TRISTATE_TRUE;
+ if (nBits & HeaderBarItemBits::UPARROW)
+ return TRISTATE_FALSE;
+ }
+
+ return TRISTATE_INDET;
}
- virtual bool get_sort_order() const override
+ virtual int get_sort_column() const override
{
- return m_xTreeView->GetModel()->GetSortMode() == SortAscending;
+ return m_nSortColumn;
+ }
+
+ virtual void set_sort_column(int nColumn) override
+ {
+ if (nColumn != m_nSortColumn)
+ {
+ m_nSortColumn = nColumn;
+ m_xTreeView->GetModel()->Resort();
+ }
}
SvTabListBox& getTreeView()
@@ -2756,6 +2816,45 @@ public:
}
};
+IMPL_LINK(SalInstanceTreeView, CompareHdl, const SvSortData&, rSortData, sal_Int32)
+{
+ const SvTreeListEntry* pLHS = rSortData.pLeft;
+ const SvTreeListEntry* pRHS = rSortData.pRight;
+ assert(pLHS && pRHS);
+
+ const SvLBoxString* pLeftTextItem;
+ const SvLBoxString* pRightTextItem;
+
+ if (m_nSortColumn != -1)
+ {
+ size_t col = m_nSortColumn;
+
+ ++col; //skip dummy/expander column
+
+ if (col < pLHS->ItemCount())
+ {
+ const SvLBoxString& rLeftTextItem = static_cast<const SvLBoxString&>(pLHS->GetItem(col));
+ pLeftTextItem = &rLeftTextItem;
+ }
+ else
+ pLeftTextItem = nullptr;
+ if (col < pRHS->ItemCount())
+ {
+ const SvLBoxString& rRightTextItem = static_cast<const SvLBoxString&>(pRHS->GetItem(col));
+ pRightTextItem = &rRightTextItem;
+ }
+ else
+ pRightTextItem = nullptr;
+ }
+ else
+ {
+ pLeftTextItem = static_cast<const SvLBoxString*>(pLHS->GetFirstItem(SvLBoxItemType::String));
+ pRightTextItem = static_cast<const SvLBoxString*>(pRHS->GetFirstItem(SvLBoxItemType::String));
+ }
+
+ return m_xTreeView->DefaultCompare(pLeftTextItem, pRightTextItem);
+}
+
IMPL_LINK_NOARG(SalInstanceTreeView, VisibleRangeChangedHdl, SvTreeListBox*, void)
{
signal_visible_range_changed();
diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx
index e306d7df0e47..6c45fc325ebe 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -3312,16 +3312,21 @@ void SvTreeListBox::RequestHelp( const HelpEvent& rHEvt )
Control::RequestHelp( rHEvt );
}
+sal_Int32 SvTreeListBox::DefaultCompare(const SvLBoxString* pLeftText, const SvLBoxString* pRightText)
+{
+ OUString aLeft = pLeftText ? pLeftText->GetText() : OUString();
+ OUString aRight = pRightText ? pRightText->GetText() : OUString();
+ pImpl->UpdateStringSorter();
+ return pImpl->m_pStringSorter->compare(aLeft, aRight);
+}
+
IMPL_LINK( SvTreeListBox, DefaultCompare, const SvSortData&, rData, sal_Int32 )
{
const SvTreeListEntry* pLeft = rData.pLeft;
const SvTreeListEntry* pRight = rData.pRight;
const SvLBoxString* pLeftText = static_cast<const SvLBoxString*>(pLeft->GetFirstItem(SvLBoxItemType::String));
const SvLBoxString* pRightText = static_cast<const SvLBoxString*>(pRight->GetFirstItem(SvLBoxItemType::String));
- OUString aLeft = pLeftText ? pLeftText->GetText() : OUString();
- OUString aRight = pRightText ? pRightText->GetText() : OUString();
- pImpl->UpdateStringSorter();
- return pImpl->m_pStringSorter->compare(aLeft, aRight);
+ return DefaultCompare(pLeftText, pRightText);
}
void SvTreeListBox::ModelNotification( SvListAction nActionId, SvTreeListEntry* pEntry1,
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 84295d62f64d..51b52a6626a6 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -5155,8 +5155,11 @@ private:
std::vector<gulong> m_aColumnSignalIds;
// map from toggle column to toggle visibility column
std::map<int, int> m_aToggleVisMap;
+ std::vector<GtkSortType> m_aSavedSortTypes;
+ std::vector<int> m_aSavedSortColumns;
+ std::vector<int> m_aViewColToModelCol;
+ std::vector<int> m_aModelColToViewCol;
gint m_nTextCol;
- gint m_nTextColHeader;
gint m_nImageCol;
gint m_nExpanderImageCol;
gint m_nIdCol;
@@ -5164,7 +5167,6 @@ private:
gulong m_nRowActivatedSignalId;
gulong m_nTestExpandRowSignalId;
gulong m_nVAdjustmentChangedSignalId;
- GtkSortType m_eSortType;
DECL_LINK(async_signal_changed, void*, void);
@@ -5379,13 +5381,22 @@ private:
pThis->signal_visible_range_changed();
}
+ int get_model_col(int viewcol) const
+ {
+ return m_aViewColToModelCol[viewcol];
+ }
+
+ int get_view_col(int modelcol) const
+ {
+ return m_aModelColToViewCol[modelcol];
+ }
+
public:
GtkInstanceTreeView(GtkTreeView* pTreeView, GtkInstanceBuilder* pBuilder, bool bTakeOwnership)
: GtkInstanceContainer(GTK_CONTAINER(pTreeView), pBuilder, bTakeOwnership)
, m_pTreeView(pTreeView)
, m_pTreeStore(GTK_TREE_STORE(gtk_tree_view_get_model(m_pTreeView)))
, m_nTextCol(-1)
- , m_nTextColHeader(-1)
, m_nImageCol(-1)
, m_nExpanderImageCol(-1)
, m_nChangedSignalId(g_signal_connect(gtk_tree_view_get_selection(pTreeView), "changed",
@@ -5393,10 +5404,9 @@ public:
, m_nRowActivatedSignalId(g_signal_connect(pTreeView, "row-activated", G_CALLBACK(signalRowActivated), this))
, m_nTestExpandRowSignalId(g_signal_connect(pTreeView, "test-expand-row", G_CALLBACK(signalTestExpandRow), this))
, m_nVAdjustmentChangedSignalId(0)
- , m_eSortType(GTK_SORT_ASCENDING)
{
m_pColumns = gtk_tree_view_get_columns(m_pTreeView);
- int nIndex(0), nHeader(0);
+ int nIndex(0);
for (GList* pEntry = g_list_first(m_pColumns); pEntry; pEntry = g_list_next(pEntry))
{
GtkTreeViewColumn* pColumn = GTK_TREE_VIEW_COLUMN(pEntry->data);
@@ -5408,7 +5418,6 @@ public:
if (m_nTextCol == -1 && GTK_IS_CELL_RENDERER_TEXT(pCellRenderer))
{
m_nTextCol = nIndex;
- m_nTextColHeader = nHeader;
}
else if (GTK_IS_CELL_RENDERER_TOGGLE(pCellRenderer))
{
@@ -5424,10 +5433,11 @@ public:
else if (m_nImageCol == -1)
m_nImageCol = nIndex;
}
+ m_aModelColToViewCol.push_back(m_aViewColToModelCol.size());
++nIndex;
}
g_list_free(pRenderers);
- ++nHeader;
+ m_aViewColToModelCol.push_back(nIndex - 1);
}
m_nIdCol = nIndex++;
for (auto& a : m_aToggleVisMap)
@@ -5472,7 +5482,8 @@ public:
}
virtual void insert(weld::TreeIter* pParent, int pos, const OUString* pText, const OUString* pId, const OUString* pIconName,
- VirtualDevice* pImageSurface, const OUString* pExpanderName, bool bChildrenOnDemand) override
+ VirtualDevice* pImageSurface, const OUString* pExpanderName,
+ bool bChildrenOnDemand, weld::TreeIter* pRet) override
{
disable_notify_events();
GtkTreeIter iter;
@@ -5484,6 +5495,11 @@ public:
OUString sDummy("<dummy>");
insert_row(subiter, &iter, -1, nullptr, &sDummy, nullptr, nullptr, nullptr);
}
+ if (pRet)
+ {
+ GtkInstanceTreeIter* pGtkRetIter = static_cast<GtkInstanceTreeIter*>(pRet);
+ pGtkRetIter->iter = iter;
+ }
enable_notify_events();
}
@@ -5560,18 +5576,66 @@ public:
virtual void set_sort_order(bool bAscending) override
{
- m_eSortType = bAscending ? GTK_SORT_ASCENDING : GTK_SORT_DESCENDING;
+ GtkSortType eSortType = bAscending ? GTK_SORT_ASCENDING : GTK_SORT_DESCENDING;
+
+ gint sort_column_id(0);
GtkTreeSortable* pSortable = GTK_TREE_SORTABLE(m_pTreeStore);
- gtk_tree_sortable_set_sort_column_id(pSortable, m_nTextCol, m_eSortType);
- GtkTreeViewColumn* pColumn = GTK_TREE_VIEW_COLUMN(g_list_nth_data(m_pColumns, m_nTextColHeader));
- assert(pColumn && "wrong count");
- if (gtk_tree_view_column_get_sort_indicator(pColumn))
- gtk_tree_view_column_set_sort_order(pColumn, m_eSortType);
+ gtk_tree_sortable_get_sort_column_id(pSortable, &sort_column_id, nullptr);
+ gtk_tree_sortable_set_sort_column_id(pSortable, sort_column_id, eSortType);
}
virtual bool get_sort_order() const override
{
- return m_eSortType == GTK_SORT_ASCENDING;
+ GtkSortType eSortType;
+
+ GtkTreeSortable* pSortable = GTK_TREE_SORTABLE(m_pTreeStore);
+ gtk_tree_sortable_get_sort_column_id(pSortable, nullptr, &eSortType);
+ return eSortType == GTK_SORT_ASCENDING;
+ }
+
+ virtual void set_sort_indicator(TriState eState, int col) override
+ {
+ if (col == -1)
+ col = get_view_col(m_nTextCol);
+
+ GtkTreeViewColumn* pColumn = GTK_TREE_VIEW_COLUMN(g_list_nth_data(m_pColumns, col));
+ assert(pColumn && "wrong count");
+ if (eState == TRISTATE_INDET)
+ gtk_tree_view_column_set_sort_indicator(pColumn, false);
+ else
+ {
+ gtk_tree_view_column_set_sort_indicator(pColumn, true);
+ GtkSortType eSortType = eState == TRISTATE_TRUE ? GTK_SORT_ASCENDING : GTK_SORT_DESCENDING;
+ gtk_tree_view_column_set_sort_order(pColumn, eSortType);
+ }
+ }
+
+ virtual TriState get_sort_indicator(int col) const override
+ {
+ if (col == -1)
+ col = get_view_col(m_nTextCol);
+
+ GtkTreeViewColumn* pColumn = GTK_TREE_VIEW_COLUMN(g_list_nth_data(m_pColumns, col));
+ if (!gtk_tree_view_column_get_sort_indicator(pColumn))
+ return TRISTATE_INDET;
+ return gtk_tree_view_column_get_sort_order(pColumn) == GTK_SORT_ASCENDING ? TRISTATE_TRUE : TRISTATE_FALSE;
+ }
+
+ virtual int get_sort_column() const override
+ {
+ GtkTreeSortable* pSortable = GTK_TREE_SORTABLE(m_pTreeStore);
+ gint sort_column_id(0);
+ if (!gtk_tree_sortable_get_sort_column_id(pSortable, &sort_column_id, nullptr))
+ return -1;
+ return get_view_col(sort_column_id);
+ }
+
+ virtual void set_sort_column(int nColumn) override
+ {
+ GtkSortType eSortType;
+ GtkTreeSortable* pSortable = GTK_TREE_SORTABLE(m_pTreeStore);
+ gtk_tree_sortable_get_sort_column_id(pSortable, nullptr, &eSortType);
+ gtk_tree_sortable_set_sort_column_id(pSortable, get_model_col(nColumn), eSortType);
}
virtual int n_children() const override
@@ -5707,23 +5771,26 @@ public:
{
if (col == -1)
return get(pos, m_nTextCol);
- return get(pos, col);
+ return get(pos, get_model_col(col));
}
virtual void set_text(int pos, const OUString& rText, int col) override
{
if (col == -1)
col = m_nTextCol;
+ else
+ col = get_model_col(col);
return set(pos, col, rText);
}
virtual bool get_toggle(int pos, int col) const override
{
- return get_bool(pos, col);
+ return get_bool(pos, get_model_col(col));
}
virtual void set_toggle(int pos, bool bOn, int col) override
{
+ col = get_model_col(col);
// checkbuttons are invisible until toggled on or off
set(pos, m_aToggleVisMap[col], true);
return set(pos, col, bOn);
@@ -5959,6 +6026,8 @@ public:
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
if (col == -1)
col = m_nTextCol;
+ else
+ col = get_model_col(col);
return get(rGtkIter.iter, col);
}
@@ -5967,18 +6036,21 @@ public:
GtkInstanceTreeIter& rGtkIter = static_cast<GtkInstanceTreeIter&>(rIter);
if (col == -1)
col = m_nTextCol;
+ else
+ col = get_model_col(col);
set(rGtkIter.iter, col, rText);
}
virtual OUString get_id(const weld::TreeIter& rIter) const override
{
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
- GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
- gchar* pStr;
- gtk_tree_model_get(pModel, const_cast<GtkTreeIter*>(&rGtkIter.iter), m_nIdCol, &pStr, -1);
- OUString sRet(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8);
- g_free(pStr);
- return sRet;
+ return get(rGtkIter.iter, m_nIdCol);
+ }
+
+ virtual void set_id(weld::TreeIter& rIter, const OUString& rId) override
+ {
+ GtkInstanceTreeIter& rGtkIter = static_cast<GtkInstanceTreeIter&>(rIter);
+ set(rGtkIter.iter, m_nIdCol, rId);
}
virtual void set_expander_image(const weld::TreeIter& rIter, const OUString& rExpanderName) override
@@ -6000,8 +6072,14 @@ public:
gtk_tree_view_set_model(m_pTreeView, nullptr);
if (m_xSorter)
{
+ int nSortColumn;
+ GtkSortType eSortType;
GtkTreeSortable* pSortable = GTK_TREE_SORTABLE(m_pTreeStore);
- gtk_tree_sortable_set_sort_column_id(pSortable, GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID, m_eSortType);
+ gtk_tree_sortable_get_sort_column_id(pSortable, &nSortColumn, &eSortType);
+ gtk_tree_sortable_set_sort_column_id(pSortable, GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID, eSortType);
+
+ m_aSavedSortColumns.push_back(nSortColumn);
+ m_aSavedSortTypes.push_back(eSortType);
}
enable_notify_events();
}
@@ -6012,7 +6090,9 @@ public:
if (m_xSorter)
{
GtkTreeSortable* pSortable = GTK_TREE_SORTABLE(m_pTreeStore);
- gtk_tree_sortable_set_sort_column_id(pSortable, m_nTextCol, m_eSortType);
+ gtk_tree_sortable_set_sort_column_id(pSortable, m_aSavedSortColumns.back(), m_aSavedSortTypes.back());
+ m_aSavedSortTypes.pop_back();
+ m_aSavedSortColumns.pop_back();
}
gtk_tree_view_set_model(m_pTreeView, GTK_TREE_MODEL(m_pTreeStore));
GtkInstanceContainer::thaw();
@@ -6119,7 +6199,7 @@ public:
int starts_with(const OUString& rStr, int col, int nStartRow)
{
- return ::starts_with(GTK_TREE_MODEL(m_pTreeStore), rStr, col, nStartRow);
+ return ::starts_with(GTK_TREE_MODEL(m_pTreeStore), rStr, get_model_col(col), nStartRow);
}
virtual void disable_notify_events() override
diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx
index 4f04f0dcea23..d6a552b7e105 100644
--- a/xmlsecurity/source/dialogs/certificatechooser.cxx
+++ b/xmlsecurity/source/dialogs/certificatechooser.cxx
@@ -210,8 +210,7 @@ void CertificateChooser::ImplInitialize()
OUString sIssuer = xmlsec::GetContentPart( xCerts[ nC ]->getIssuerName() );
- m_xCertLB->insert(nullptr, -1, nullptr, nullptr,
- nullptr, nullptr, nullptr, false);
+ m_xCertLB->append();
int nRow = m_xCertLB->n_children() - 1;
m_xCertLB->set_text(nRow, xmlsec::GetContentPart(xCerts[nC]->getSubjectName()), 0);
m_xCertLB->set_text(nRow, sIssuer, 1);
diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx
index 9f880ce7709d..f48591b7f74a 100644
--- a/xmlsecurity/source/dialogs/certificateviewer.cxx
+++ b/xmlsecurity/source/dialogs/certificateviewer.cxx
@@ -374,7 +374,7 @@ void CertificateViewerCertPathTP::InsertCert(weld::TreeIter* pParent, const OUSt
OUString sImage = bValid ? OUStringLiteral(BMP_CERT_OK) : OUStringLiteral(BMP_CERT_NOT_OK);
maUserData.emplace_back(std::make_unique<CertPath_UserData>(rxCert, bValid));
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(maUserData.back().get())));
- mxCertPathLB->insert(pParent, -1, &rName, &sId, nullptr, nullptr, &sImage, false);
+ mxCertPathLB->insert(pParent, -1, &rName, &sId, nullptr, nullptr, &sImage, false, nullptr);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index 4cde7de2e3e3..9a3f8bf17de9 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -619,7 +619,7 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox()
}
m_xSignaturesLB->insert(nullptr, n, nullptr, nullptr,
- &sImage, nullptr, nullptr, false);
+ &sImage, nullptr, nullptr, false, nullptr);
m_xSignaturesLB->set_text(n, aSubject, 1);
m_xSignaturesLB->set_text(n, aIssuer, 2);
m_xSignaturesLB->set_text(n, aDateTimeStr, 3);