diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-12-10 11:09:14 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-12-10 14:56:55 +0100 |
commit | aaf7e843900b5fb995a7188f527552bd616baf9e (patch) | |
tree | 88af1d60849646bdc382cfd46f297c1fcb3ff9a2 /svx | |
parent | f4212175fe7c18855c52ef3e1aaa34eece2dccc5 (diff) |
Resolves: tdf#121520 duplicate languages in dropdown
Change-Id: I5bbde305bf06ac1f754f24eb93e89cb3d9cf6058
Reviewed-on: https://gerrit.libreoffice.org/64869
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/dialog/langbox.cxx | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx index 69d1ab3a03af..fedbe1a5c4c1 100644 --- a/svx/source/dialog/langbox.cxx +++ b/svx/source/dialog/langbox.cxx @@ -551,12 +551,15 @@ void LanguageBox::AddLanguages(const std::vector< LanguageType >& rLanguageTypes if (lcl_isScriptTypeRequested( nLang, nLangList)) { int nAt = ImplTypeToPos(nLang); - if (nAt == -1) - { - rEntries.push_back(BuildEntry(nLang)); - if (rEntries.back().sString.isEmpty()) - rEntries.pop_back(); - } + if (nAt != -1) + continue; + weld::ComboBoxEntry aNewEntry(BuildEntry(nLang)); + if (aNewEntry.sString.isEmpty()) + continue; + if (std::find_if(rEntries.begin(), rEntries.end(), + [=](const weld::ComboBoxEntry& rEntry){ return rEntry.sId == aNewEntry.sId; }) != rEntries.end()) + continue; + rEntries.push_back(aNewEntry); } } } |