summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
Diffstat (limited to 'svx')
-rw-r--r--svx/source/dialog/langbox.cxx34
1 files changed, 30 insertions, 4 deletions
diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx
index a2aed402ac3d..ac837e92f423 100644
--- a/svx/source/dialog/langbox.cxx
+++ b/svx/source/dialog/langbox.cxx
@@ -34,6 +34,11 @@
#include <svx/strings.hrc>
#include <bitmaps.hlst>
+#include <comphelper/string.hxx>
+#include <comphelper/processfactory.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/settings.hxx>
+
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::linguistic2;
using namespace ::com::sun::star::uno;
@@ -185,8 +190,10 @@ void SvxLanguageBox::AddLanguages(const std::vector< LanguageType >& rLanguageTy
}
}
-void SvxLanguageBox::SetLanguageList( SvxLanguageListFlags nLangList,
- bool bHasLangNone, bool bLangNoneIsLangAll, bool bCheckSpellAvail )
+void SvxLanguageBox::SetLanguageList(SvxLanguageListFlags nLangList, bool bHasLangNone,
+ bool bLangNoneIsLangAll, bool bCheckSpellAvail,
+ bool bDefaultLangExist, LanguageType eDefaultLangType,
+ sal_Int16 nDefaultType)
{
m_bHasLangNone = bHasLangNone;
m_bLangNoneIsLangAll = bLangNoneIsLangAll;
@@ -278,10 +285,30 @@ void SvxLanguageBox::SetLanguageList( SvxLanguageListFlags nLangList,
AddLanguages(aThesAvailLang, nLangList, aEntries);
}
+ std::sort(aEntries.begin(), aEntries.end(),
+ [](const weld::ComboBoxEntry e1, const weld::ComboBoxEntry e2) {
+ static const auto aSorter = comphelper::string::NaturalStringSorter(
+ ::comphelper::getProcessComponentContext(),
+ Application::GetSettings().GetLanguageTag().getLocale());
+ return aSorter.compare(e1.sString, e2.sString) < 0;
+ });
+
+ int nSeparatorPosition = 0;
+ if (bDefaultLangExist)
+ {
+ aEntries.insert(aEntries.begin(), BuildEntry(eDefaultLangType, nDefaultType));
+ nSeparatorPosition++;
+ }
+
if (bHasLangNone)
- aEntries.push_back(BuildEntry(LANGUAGE_NONE));
+ {
+ aEntries.insert(aEntries.begin(), BuildEntry(LANGUAGE_NONE));
+ nSeparatorPosition++;
+ }
m_xControl->insert_vector(aEntries, false);
+ if (nSeparatorPosition > 0)
+ m_xControl->insert_separator(nSeparatorPosition, "");
}
int SvxLanguageBox::ImplTypeToPos(LanguageType eType) const
@@ -438,7 +465,6 @@ SvxLanguageBox::SvxLanguageBox(std::unique_ptr<weld::ComboBox> pControl)
, m_bLangNoneIsLangAll(false)
, m_bWithCheckmark(false)
{
- m_xControl->make_sorted();
m_xControl->connect_changed(LINK(this, SvxLanguageBox, ChangeHdl));
}