[Libreoffice-commits] core.git: 5 commits - cui/source include/svtools svtools/source sw/source
Eike Rathke
erack at redhat.com
Thu Apr 17 14:46:21 PDT 2014
cui/source/dialogs/thesdlg.cxx | 2 +-
include/svtools/langtab.hxx | 4 +++-
svtools/source/misc/langtab.cxx | 12 +++++++++---
sw/source/core/uibase/lingu/olmenu.cxx | 18 ++++++++----------
sw/source/core/uibase/shells/langhelper.cxx | 2 +-
5 files changed, 22 insertions(+), 16 deletions(-)
New commits:
commit f3501ee89ff65cd40468e84f4d9fb52f12a67b0f
Author: Eike Rathke <erack at redhat.com>
Date: Thu Apr 17 23:43:22 2014 +0200
now no temporary instance of SvtLanguageTable necessary here anymore
Change-Id: I8154d8d198ba0826f24cb1da65d2de4fc1943517
diff --git a/sw/source/core/uibase/shells/langhelper.cxx b/sw/source/core/uibase/shells/langhelper.cxx
index 53adf42..e3ec901 100644
--- a/sw/source/core/uibase/shells/langhelper.cxx
+++ b/sw/source/core/uibase/shells/langhelper.cxx
@@ -233,7 +233,7 @@ namespace SwLangHelper
void SetLanguage( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, const OUString &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet )
{
- const LanguageType nLang = SvtLanguageTable().GetType( rLangText );
+ const LanguageType nLang = SvtLanguageTable::GetLanguageType( rLangText );
if (nLang != LANGUAGE_DONTKNOW)
{
sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nLang );
commit d7992dbf924c229c8e913913b15b2d5c42012baa
Author: Eike Rathke <erack at redhat.com>
Date: Thu Apr 17 23:40:27 2014 +0200
now no temporary instance of SvtLanguageTable necessary here anymore
Change-Id: I8eaaee1fd45efc71b1acdcf36360bca11b30dbfc
diff --git a/sw/source/core/uibase/lingu/olmenu.cxx b/sw/source/core/uibase/lingu/olmenu.cxx
index 59e9047..682df9a 100644
--- a/sw/source/core/uibase/lingu/olmenu.cxx
+++ b/sw/source/core/uibase/lingu/olmenu.cxx
@@ -122,8 +122,6 @@ void SwSpellPopup::fillLangPopupMenu(
if (!pPopupMenu)
return;
- SvtLanguageTable aLanguageTable;
-
// set of languages to be displayed in the sub menus
std::set< OUString > aLangItems;
@@ -133,7 +131,7 @@ void SwSpellPopup::fillLangPopupMenu(
OUString aGuessedTextLang( aSeq[3] );
if (!aCurLang.isEmpty() &&
- LANGUAGE_DONTKNOW != aLanguageTable.GetType( aCurLang ))
+ LANGUAGE_DONTKNOW != SvtLanguageTable::GetLanguageType( aCurLang ))
aLangItems.insert( aCurLang );
//2--System
@@ -142,7 +140,7 @@ void SwSpellPopup::fillLangPopupMenu(
if (rSystemLanguage != LANGUAGE_DONTKNOW)
{
if (lcl_checkScriptType( nScriptType, rSystemLanguage ))
- aLangItems.insert( aLanguageTable.GetString(rSystemLanguage) );
+ aLangItems.insert( SvtLanguageTable::GetLanguageString(rSystemLanguage) );
}
//3--UI
@@ -150,20 +148,20 @@ void SwSpellPopup::fillLangPopupMenu(
if (rUILanguage != LANGUAGE_DONTKNOW)
{
if (lcl_checkScriptType(nScriptType, rUILanguage ))
- aLangItems.insert( aLanguageTable.GetString(rUILanguage) );
+ aLangItems.insert( SvtLanguageTable::GetLanguageString(rUILanguage) );
}
//4--guessed language
if (!aGuessedTextLang.isEmpty())
{
- if (lcl_checkScriptType(nScriptType, aLanguageTable.GetType(aGuessedTextLang)))
+ if (lcl_checkScriptType(nScriptType, SvtLanguageTable::GetLanguageType(aGuessedTextLang)))
aLangItems.insert( aGuessedTextLang );
}
//5--keyboard language
if (!aKeyboardLang.isEmpty())
{
- if (lcl_checkScriptType(nScriptType, aLanguageTable.GetType(aKeyboardLang)))
+ if (lcl_checkScriptType(nScriptType, SvtLanguageTable::GetLanguageType(aKeyboardLang)))
aLangItems.insert( aKeyboardLang );
}
@@ -189,7 +187,7 @@ void SwSpellPopup::fillLangPopupMenu(
if (aLangItems.size() == (size_t)nMaxCount)
break;
const lang::Locale& rLocale = rLocales[i];
- if (lcl_checkScriptType( nScriptType, aLanguageTable.GetType( rLocale.Language )))
+ if (lcl_checkScriptType( nScriptType, SvtLanguageTable::GetLanguageType( rLocale.Language )))
aLangItems.insert( rLocale.Language );
}
}
@@ -200,7 +198,7 @@ void SwSpellPopup::fillLangPopupMenu(
for (it = aLangItems.begin(); it != aLangItems.end(); ++it)
{
OUString aEntryTxt( *it );
- if (aEntryTxt != OUString( aLanguageTable.GetString( LANGUAGE_NONE ) )&&
+ if (aEntryTxt != OUString( SvtLanguageTable::GetLanguageString( LANGUAGE_NONE ) )&&
aEntryTxt != "*" && // multiple languages in current selection
!aEntryTxt.isEmpty()) // 'no language found' from language guessing
{
@@ -218,7 +216,7 @@ void SwSpellPopup::fillLangPopupMenu(
}
pPopupMenu->InsertItem( nLangItemIdStart + MN_NONE_OFFSET, OUString(SW_RES( STR_LANGSTATUS_NONE )), MIB_RADIOCHECK );
- if ( aLanguageTable.GetString( LANGUAGE_NONE ) == aCurLang )
+ if ( SvtLanguageTable::GetLanguageString( LANGUAGE_NONE ) == aCurLang )
pPopupMenu->CheckItem( nLangItemIdStart + MN_NONE_OFFSET, true );
pPopupMenu->InsertItem( nLangItemIdStart + MN_RESET_OFFSET, OUString(SW_RES( STR_RESET_TO_DEFAULT_LANGUAGE )), 0 );
commit 53f0b42d875373f8dda22eebe2ed0fc80d8e2e57
Author: Eike Rathke <erack at redhat.com>
Date: Thu Apr 17 23:31:26 2014 +0200
no temporary instance of SvtLanguageTable necessary here
Change-Id: I84b20ae5efe882c0440d7f9bf1a24d7a56f05f90
diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx
index 936922e..3e4c0f8 100644
--- a/cui/source/dialogs/thesdlg.cxx
+++ b/cui/source/dialogs/thesdlg.cxx
@@ -344,7 +344,7 @@ IMPL_LINK( SvxThesaurusDialog, LeftBtnHdl_Impl, Button *, pBtn )
IMPL_LINK( SvxThesaurusDialog, LanguageHdl_Impl, ListBox*, pLB )
{
OUString aLangText( pLB->GetSelectEntry() );
- LanguageType nLang = SvtLanguageTable().GetType( aLangText );
+ LanguageType nLang = SvtLanguageTable::GetLanguageType( aLangText );
DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" );
if (xThesaurus->hasLocale( LanguageTag::convertToLocale( nLang ) ))
nLookUpLanguage = nLang;
commit a97c2268a538dc8702ff9621a94958d839428566
Author: Eike Rathke <erack at redhat.com>
Date: Thu Apr 17 23:28:27 2014 +0200
introduce static SvtLanguageTable::GetLanguageType()
Change-Id: I096f8b5a08452df9b1731f2e764d7561dd3e5dd4
diff --git a/include/svtools/langtab.hxx b/include/svtools/langtab.hxx
index 509755d..7521313 100644
--- a/include/svtools/langtab.hxx
+++ b/include/svtools/langtab.hxx
@@ -45,7 +45,9 @@ public:
sal_uInt32 GetEntryCount() const;
LanguageType GetTypeAtIndex( sal_uInt32 nIndex ) const;
- static OUString GetLanguageString( const LanguageType eType );
+
+ static OUString GetLanguageString( const LanguageType eType );
+ static LanguageType GetLanguageType( const OUString& rStr );
};
// Add LRE or RLE embedding characters to the string based on the
diff --git a/svtools/source/misc/langtab.cxx b/svtools/source/misc/langtab.cxx
index 1e8638f..e5c7cc4 100644
--- a/svtools/source/misc/langtab.cxx
+++ b/svtools/source/misc/langtab.cxx
@@ -175,6 +175,11 @@ LanguageType SvtLanguageTable::GetType( const OUString& rStr ) const
return eType;
}
+LanguageType SvtLanguageTable::GetLanguageType( const OUString& rStr )
+{
+ return theLanguageTable::get().GetType( rStr );
+}
+
sal_uInt32 SvtLanguageTable::GetEntryCount() const
commit 709b4e653c29f87caaeef16ebe20237fbf65218f
Author: Eike Rathke <erack at redhat.com>
Date: Thu Apr 17 23:23:40 2014 +0200
have a "better" static
Change-Id: Ib978d24b5188482242101d3a352f29d604b36c90
diff --git a/svtools/source/misc/langtab.cxx b/svtools/source/misc/langtab.cxx
index fe1480b..1e8638f 100644
--- a/svtools/source/misc/langtab.cxx
+++ b/svtools/source/misc/langtab.cxx
@@ -35,7 +35,9 @@
using namespace ::com::sun::star;
-
+namespace {
+struct theLanguageTable : public rtl::Static< SvtLanguageTable, theLanguageTable > {};
+}
SVT_DLLPUBLIC const OUString ApplyLreOrRleEmbedding( const OUString &rText )
{
@@ -152,8 +154,7 @@ const OUString SvtLanguageTable::GetString( const LanguageType eType, bool bUser
OUString SvtLanguageTable::GetLanguageString( const LanguageType eType )
{
- static const SvtLanguageTable aLangTable;
- return aLangTable.GetString( eType );
+ return theLanguageTable::get().GetString( eType );
}
More information about the Libreoffice-commits
mailing list