include/svx/langbox.hxx       |    1 -
 svx/source/dialog/langbox.cxx |   17 ++++++-----------
 2 files changed, 6 insertions(+), 12 deletions(-)

New commits:
commit 496bd45f1e2f4c3dc90448d1adc81c5c29349f58
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Mon Jun 5 14:21:06 2023 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Mon Jun 5 20:26:09 2023 +0200

    Drop duplicating function
    
    Change-Id: I15f6aea604f5bc05ae8e2e13c1e79003512b707f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152613
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/include/svx/langbox.hxx b/include/svx/langbox.hxx
index 7a03c522d98b..3cc724f52c7d 100644
--- a/include/svx/langbox.hxx
+++ b/include/svx/langbox.hxx
@@ -72,7 +72,6 @@ private:
                                      std::vector<weld::ComboBoxEntry>& 
rEntries);
     SVX_DLLPRIVATE void InsertLanguage(const LanguageType nLangType, sal_Int16 
nType);
 
-    SVX_DLLPRIVATE int ImplTypeToPos(LanguageType eType) const;
     DECL_DLLPRIVATE_LINK(ChangeHdl, weld::ComboBox&, void);
 public:
     SvxLanguageBox(std::unique_ptr<weld::ComboBox> pControl);
diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx
index b7623d6f8c0d..4135964daa29 100644
--- a/svx/source/dialog/langbox.cxx
+++ b/svx/source/dialog/langbox.cxx
@@ -154,12 +154,12 @@ void SvxLanguageBox::set_active_id(const LanguageType 
eLangType)
     // a language that is replaced, we need to select the replacement instead.
     LanguageType nLang = MsLangId::getReplacementForObsoleteLanguage( 
eLangType);
 
-    sal_Int32 nAt = ImplTypeToPos( nLang );
+    sal_Int32 nAt = find_id( nLang );
 
     if (nAt == -1)
     {
         InsertLanguage( nLang );      // on-the-fly-ID
-        nAt = ImplTypeToPos( nLang );
+        nAt = find_id( nLang );
     }
 
     if (nAt != -1)
@@ -176,7 +176,7 @@ void SvxLanguageBox::AddLanguages(const std::vector< 
LanguageType >& rLanguageTy
             LanguageType nLang = MsLangId::getReplacementForObsoleteLanguage( 
nLangType );
             if (lcl_isScriptTypeRequested( nLang, nLangList))
             {
-                int nAt = ImplTypeToPos(nLang);
+                int nAt = find_id(nLang);
                 if (nAt != -1)
                     continue;
                 weld::ComboBoxEntry aNewEntry(BuildEntry(nLang));
@@ -305,11 +305,6 @@ void SvxLanguageBox::SetLanguageList(SvxLanguageListFlags 
nLangList, bool bHasLa
     m_xControl->insert_vector(aEntries, true);
 }
 
-int SvxLanguageBox::ImplTypeToPos(LanguageType eType) const
-{
-    return 
m_xControl->find_id(OUString::number(static_cast<sal_uInt16>(eType)));
-}
-
 void SvxLanguageBox::InsertLanguage(const LanguageType nLangType, sal_Int16 
nType)
 {
     weld::ComboBoxEntry aEntry = BuildEntry(nLangType, nType);
@@ -334,7 +329,7 @@ weld::ComboBoxEntry SvxLanguageBox::BuildEntry(const 
LanguageType nLangType, sal
     // string as would be returned by SvtLanguageTable::GetString().
     if (nLang != nLangType)
     {
-        int nAt = ImplTypeToPos( nLang );
+        int nAt = find_id( nLang );
         if (nAt != -1)
             return weld::ComboBoxEntry("");
     }
@@ -478,7 +473,7 @@ SvxLanguageBox* 
SvxLanguageBox::SaveEditedAsEntry(SvxLanguageBox* ppBoxes[3])
         if (!pBox)
             continue;
 
-        const int nPos = pBox->ImplTypeToPos( nLang);
+        const int nPos = pBox->find_id( nLang);
         if (nPos != -1)
         {
             // Already present but with a different string or in another list.
@@ -521,7 +516,7 @@ SvxLanguageBox* 
SvxLanguageBox::SaveEditedAsEntry(SvxLanguageBox* ppBoxes[3])
     pBox->InsertLanguage(nLang);
 
     // Select it.
-    const int nPos = pBox->ImplTypeToPos(nLang);
+    const int nPos = pBox->find_id(nLang);
     if (nPos != -1)
         pBox->m_xControl->set_active(nPos);
 

Reply via email to