summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2021-05-19 09:37:33 +0200
committerAndreas Heinisch <andreas.heinisch@yahoo.de>2021-08-04 00:37:23 +0200
commit4d5c96be4362902144c83708f40f77766244ca06 (patch)
tree348229f1c67190d2f844183dea4b112ac931a070 /sfx2
parent24d24debef4cda7de702c4b470a3707f1aae3ea3 (diff)
tdf#123919 - Sort custom document properties
Sort custom document properties on opening the dialog under File > Properties > Custom Properties. The sorting order in the document's xml still depends on the generated handle of the document property itself. Change-Id: I12c4f641d22ca0a3db2f4c6ef54f41c113aeeaa5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115780 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 13349d3bf47c..82265a0d7a1d 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -1973,6 +1973,15 @@ void SfxCustomPropertiesPage::Reset( const SfxItemSet* rItemSet )
m_xPropertiesCtrl->ClearAllLines();
const SfxDocumentInfoItem& rInfoItem = rItemSet->Get(SID_DOCINFO);
std::vector< std::unique_ptr<CustomProperty> > aCustomProps = rInfoItem.GetCustomProperties();
+ // tdf#123919 - sort custom document properties
+ auto const sort = comphelper::string::NaturalStringSorter(
+ comphelper::getProcessComponentContext(),
+ Application::GetSettings().GetLanguageTag().getLocale());
+ std::sort(aCustomProps.begin(), aCustomProps.end(),
+ [&sort](const std::unique_ptr<CustomProperty>& rLHS,
+ const std::unique_ptr<CustomProperty>& rRHS) {
+ return sort.compare(rLHS->m_sName, rRHS->m_sName) < 0;
+ });
m_xPropertiesCtrl->SetCustomProperties(std::move(aCustomProps));
}