[Libreoffice-commits] core.git: framework/source sfx2/source sw/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jun 15 08:22:51 UTC 2021
framework/source/uiconfiguration/uicategorydescription.cxx | 8 -
framework/source/uielement/uicommanddescription.cxx | 26 +--
sfx2/source/appl/sfxhelp.cxx | 4
sw/source/core/doc/DocumentStylePoolManager.cxx | 96 ++++++-------
sw/source/core/doc/SwStyleNameMapper.cxx | 8 -
5 files changed, 71 insertions(+), 71 deletions(-)
New commits:
commit 2bccb7e67b637c6312a0df610f870c8621eb296f
Author: Noel Grandin <noel at peralex.com>
AuthorDate: Tue Jun 15 09:02:59 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jun 15 10:21:58 2021 +0200
remove some unnecessary LanguageType copies
Change-Id: Iec4374627c931ccecf05a712682ed18ef90bf359
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117208
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/framework/source/uiconfiguration/uicategorydescription.cxx b/framework/source/uiconfiguration/uicategorydescription.cxx
index 218032c5238e..1e747fa13255 100644
--- a/framework/source/uiconfiguration/uicategorydescription.cxx
+++ b/framework/source/uiconfiguration/uicategorydescription.cxx
@@ -365,18 +365,18 @@ public:
UICategoryDescription::UICategoryDescription( const Reference< XComponentContext >& rxContext ) :
UICommandDescription(rxContext,true)
{
- LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
+ const LanguageTag& rCurrentLanguage = SvtSysLocale().GetUILanguageTag();
Reference< XNameAccess > xEmpty;
OUString aGenericCategories( "GenericCategories" );
- m_xGenericUICommands[aCurrentLanguage] = new ConfigurationAccess_UICategory( aGenericCategories, xEmpty, rxContext );
+ m_xGenericUICommands[rCurrentLanguage] = new ConfigurationAccess_UICategory( aGenericCategories, xEmpty, rxContext );
// insert generic categories mappings
m_aModuleToCommandFileMap.emplace( OUString("generic"), aGenericCategories );
- auto& rMap = m_aUICommandsHashMap[aCurrentLanguage];
+ auto& rMap = m_aUICommandsHashMap[rCurrentLanguage];
UICommandsHashMap::iterator pCatIter = rMap.find( aGenericCategories );
if ( pCatIter != rMap.end() )
- pCatIter->second = m_xGenericUICommands[aCurrentLanguage];
+ pCatIter->second = m_xGenericUICommands[rCurrentLanguage];
impl_fillElements("ooSetupFactoryCmdCategoryConfigRef");
}
diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx
index 4d9fccf5af41..ca9d929435f8 100644
--- a/framework/source/uielement/uicommanddescription.cxx
+++ b/framework/source/uielement/uicommanddescription.cxx
@@ -574,17 +574,17 @@ UICommandDescription::UICommandDescription(const Reference< XComponentContext >&
, m_aPrivateResourceURL(PRIVATE_RESOURCE_URL)
, m_xContext(rxContext)
{
- LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
+ const LanguageTag& rCurrentLanguage = SvtSysLocale().GetUILanguageTag();
- ensureGenericUICommandsForLanguage(aCurrentLanguage);
+ ensureGenericUICommandsForLanguage(rCurrentLanguage);
impl_fillElements("ooSetupFactoryCommandConfigRef");
// insert generic commands
- auto& rMap = m_aUICommandsHashMap[aCurrentLanguage];
+ auto& rMap = m_aUICommandsHashMap[rCurrentLanguage];
UICommandsHashMap::iterator pIter = rMap.find( "GenericCommands" );
if ( pIter != rMap.end() )
- pIter->second = m_xGenericUICommands[aCurrentLanguage];
+ pIter->second = m_xGenericUICommands[rCurrentLanguage];
}
UICommandDescription::UICommandDescription(const Reference< XComponentContext >& rxContext, bool)
@@ -624,8 +624,8 @@ void UICommandDescription::impl_fillElements(const char* _pName)
m_aModuleToCommandFileMap.emplace( aModuleIdentifier, aCommandStr );
// Create second mapping Command File ==> commands instance
- LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
- auto& rMap = m_aUICommandsHashMap[aCurrentLanguage];
+ const LanguageTag& rCurrentLanguage = SvtSysLocale().GetUILanguageTag();
+ auto& rMap = m_aUICommandsHashMap[rCurrentLanguage];
UICommandsHashMap::iterator pIter = rMap.find( aCommandStr );
if ( pIter == rMap.end() )
rMap.emplace( aCommandStr, Reference< XNameAccess >() );
@@ -635,7 +635,7 @@ void UICommandDescription::impl_fillElements(const char* _pName)
Any SAL_CALL UICommandDescription::getByName( const OUString& aName )
{
- LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
+ const LanguageTag& rCurrentLanguage = SvtSysLocale().GetUILanguageTag();
Any a;
osl::MutexGuard g(rBHelper.rMutex);
@@ -644,11 +644,11 @@ Any SAL_CALL UICommandDescription::getByName( const OUString& aName )
if ( pM2CIter != m_aModuleToCommandFileMap.end() )
{
OUString aCommandFile( pM2CIter->second );
- auto pMapIter = m_aUICommandsHashMap.find( aCurrentLanguage );
+ auto pMapIter = m_aUICommandsHashMap.find( rCurrentLanguage );
if ( pMapIter == m_aUICommandsHashMap.end() )
impl_fillElements("ooSetupFactoryCommandConfigRef");
- auto& rMap = m_aUICommandsHashMap[aCurrentLanguage];
+ auto& rMap = m_aUICommandsHashMap[rCurrentLanguage];
UICommandsHashMap::iterator pIter = rMap.find( aCommandFile );
if ( pIter != rMap.end() )
{
@@ -656,10 +656,10 @@ Any SAL_CALL UICommandDescription::getByName( const OUString& aName )
a <<= pIter->second;
else
{
- ensureGenericUICommandsForLanguage(aCurrentLanguage);
+ ensureGenericUICommandsForLanguage(rCurrentLanguage);
Reference< XNameAccess > xUICommands = new ConfigurationAccess_UICommand( aCommandFile,
- m_xGenericUICommands[aCurrentLanguage],
+ m_xGenericUICommands[rCurrentLanguage],
m_xContext );
pIter->second = xUICommands;
a <<= xUICommands;
@@ -668,10 +668,10 @@ Any SAL_CALL UICommandDescription::getByName( const OUString& aName )
}
else if ( !m_aPrivateResourceURL.isEmpty() && aName.startsWith( m_aPrivateResourceURL ) )
{
- ensureGenericUICommandsForLanguage(aCurrentLanguage);
+ ensureGenericUICommandsForLanguage(rCurrentLanguage);
// special keys to retrieve information about a set of commands
- return m_xGenericUICommands[aCurrentLanguage]->getByName( aName );
+ return m_xGenericUICommands[rCurrentLanguage]->getByName( aName );
}
else
{
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index eee01d48f056..2a1d4f6e8072 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -1020,8 +1020,8 @@ public:
: MessageDialogController(pParent, "sfx/ui/helpmanual.ui", "onlinehelpmanual", "hidedialog")
, m_xHideOfflineHelpCB(m_xBuilder->weld_check_button("hidedialog"))
{
- LanguageTag aLangTag = Application::GetSettings().GetUILanguageTag();
- OUString sLocaleString = SvtLanguageTable::GetLanguageString(aLangTag.getLanguageType());
+ LanguageType aLangType = Application::GetSettings().GetUILanguageTag().getLanguageType();
+ OUString sLocaleString = SvtLanguageTable::GetLanguageString(aLangType);
OUString sPrimText = get_primary_text();
set_primary_text(sPrimText.replaceAll("$UILOCALE", sLocaleString));
}
diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx
index ff0657aaff48..9b538d1783b8 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -2582,171 +2582,171 @@ lcl_NewUINameArray(const char** pIds, const size_t nLen, const size_t nSvxIds =
const std::vector<OUString>& SwStyleNameMapper::GetTextUINameArray()
{
- LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
+ const LanguageTag& rCurrentLanguage = SvtSysLocale().GetUILanguageTag();
static std::map<LanguageTag, std::vector<OUString>> s_aTextUINameArray;
- auto aFound = s_aTextUINameArray.find(aCurrentLanguage);
+ auto aFound = s_aTextUINameArray.find(rCurrentLanguage);
if (aFound == s_aTextUINameArray.end()) {
- s_aTextUINameArray[aCurrentLanguage] =
+ s_aTextUINameArray[rCurrentLanguage] =
lcl_NewUINameArray(STR_POOLCOLL_TEXT_ARY, SAL_N_ELEMENTS(STR_POOLCOLL_TEXT_ARY));
}
- return s_aTextUINameArray[aCurrentLanguage];
+ return s_aTextUINameArray[rCurrentLanguage];
}
const std::vector<OUString>& SwStyleNameMapper::GetListsUINameArray()
{
- LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
+ const LanguageTag& rCurrentLanguage = SvtSysLocale().GetUILanguageTag();
static std::map<LanguageTag, std::vector<OUString>> s_aListsUINameArray;
- auto aFound = s_aListsUINameArray.find(aCurrentLanguage);
+ auto aFound = s_aListsUINameArray.find(rCurrentLanguage);
if (aFound == s_aListsUINameArray.end()) {
- s_aListsUINameArray[aCurrentLanguage] =
+ s_aListsUINameArray[rCurrentLanguage] =
lcl_NewUINameArray(STR_POOLCOLL_LISTS_ARY, SAL_N_ELEMENTS(STR_POOLCOLL_LISTS_ARY));
}
- return s_aListsUINameArray[aCurrentLanguage];
+ return s_aListsUINameArray[rCurrentLanguage];
}
const std::vector<OUString>& SwStyleNameMapper::GetExtraUINameArray()
{
- LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
+ const LanguageTag& rCurrentLanguage = SvtSysLocale().GetUILanguageTag();
static std::map<LanguageTag, std::vector<OUString>> s_aExtraUINameArray;
- auto aFound = s_aExtraUINameArray.find(aCurrentLanguage);
+ auto aFound = s_aExtraUINameArray.find(rCurrentLanguage);
if (aFound == s_aExtraUINameArray.end()) {
- s_aExtraUINameArray[aCurrentLanguage] =
+ s_aExtraUINameArray[rCurrentLanguage] =
lcl_NewUINameArray(STR_POOLCOLL_EXTRA_ARY, SAL_N_ELEMENTS(STR_POOLCOLL_EXTRA_ARY));
}
- return s_aExtraUINameArray[aCurrentLanguage];
+ return s_aExtraUINameArray[rCurrentLanguage];
}
const std::vector<OUString>& SwStyleNameMapper::GetRegisterUINameArray()
{
- LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
+ const LanguageTag& rCurrentLanguage = SvtSysLocale().GetUILanguageTag();
static std::map<LanguageTag, std::vector<OUString>> s_aRegisterUINameArray;
- auto aFound = s_aRegisterUINameArray.find(aCurrentLanguage);
+ auto aFound = s_aRegisterUINameArray.find(rCurrentLanguage);
if (aFound == s_aRegisterUINameArray.end()) {
- s_aRegisterUINameArray[aCurrentLanguage] =
+ s_aRegisterUINameArray[rCurrentLanguage] =
lcl_NewUINameArray(STR_POOLCOLL_REGISTER_ARY, SAL_N_ELEMENTS(STR_POOLCOLL_REGISTER_ARY));
}
- return s_aRegisterUINameArray[aCurrentLanguage];
+ return s_aRegisterUINameArray[rCurrentLanguage];
}
const std::vector<OUString>& SwStyleNameMapper::GetDocUINameArray()
{
- LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
+ const LanguageTag& rCurrentLanguage = SvtSysLocale().GetUILanguageTag();
static std::map<LanguageTag, std::vector<OUString>> s_aDocUINameArray;
- auto aFound = s_aDocUINameArray.find(aCurrentLanguage);
+ auto aFound = s_aDocUINameArray.find(rCurrentLanguage);
if (aFound == s_aDocUINameArray.end())
- s_aDocUINameArray[aCurrentLanguage] =
+ s_aDocUINameArray[rCurrentLanguage] =
lcl_NewUINameArray(STR_POOLCOLL_DOC_ARY, SAL_N_ELEMENTS(STR_POOLCOLL_DOC_ARY));
- return s_aDocUINameArray[aCurrentLanguage];
+ return s_aDocUINameArray[rCurrentLanguage];
}
const std::vector<OUString>& SwStyleNameMapper::GetHTMLUINameArray()
{
- LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
+ const LanguageTag& rCurrentLanguage = SvtSysLocale().GetUILanguageTag();
static std::map<LanguageTag, std::vector<OUString>> s_aHTMLUINameArray;
- auto aFound = s_aHTMLUINameArray.find(aCurrentLanguage);
+ auto aFound = s_aHTMLUINameArray.find(rCurrentLanguage);
if (aFound == s_aHTMLUINameArray.end()) {
- s_aHTMLUINameArray[aCurrentLanguage] =
+ s_aHTMLUINameArray[rCurrentLanguage] =
lcl_NewUINameArray(STR_POOLCOLL_HTML_ARY, SAL_N_ELEMENTS(STR_POOLCOLL_HTML_ARY));
}
- return s_aHTMLUINameArray[aCurrentLanguage];
+ return s_aHTMLUINameArray[rCurrentLanguage];
}
const std::vector<OUString>& SwStyleNameMapper::GetFrameFormatUINameArray()
{
- LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
+ const LanguageTag& rCurrentLanguage = SvtSysLocale().GetUILanguageTag();
static std::map<LanguageTag, std::vector<OUString>> s_aFrameFormatUINameArray;
- auto aFound = s_aFrameFormatUINameArray.find(aCurrentLanguage);
+ auto aFound = s_aFrameFormatUINameArray.find(rCurrentLanguage);
if (aFound == s_aFrameFormatUINameArray.end()) {
- s_aFrameFormatUINameArray[aCurrentLanguage] =
+ s_aFrameFormatUINameArray[rCurrentLanguage] =
lcl_NewUINameArray(STR_POOLFRM_ARY, SAL_N_ELEMENTS(STR_POOLFRM_ARY));
}
- return s_aFrameFormatUINameArray[aCurrentLanguage];
+ return s_aFrameFormatUINameArray[rCurrentLanguage];
}
const std::vector<OUString>& SwStyleNameMapper::GetChrFormatUINameArray()
{
- LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
+ const LanguageTag& rCurrentLanguage = SvtSysLocale().GetUILanguageTag();
static std::map<LanguageTag, std::vector<OUString>> s_aChrFormatUINameArray;
- auto aFound = s_aChrFormatUINameArray.find(aCurrentLanguage);
+ auto aFound = s_aChrFormatUINameArray.find(rCurrentLanguage);
if (aFound == s_aChrFormatUINameArray.end()) {
- s_aChrFormatUINameArray[aCurrentLanguage] =
+ s_aChrFormatUINameArray[rCurrentLanguage] =
lcl_NewUINameArray(STR_POOLCHR_ARY, SAL_N_ELEMENTS(STR_POOLCHR_ARY));
}
- return s_aChrFormatUINameArray[aCurrentLanguage];
+ return s_aChrFormatUINameArray[rCurrentLanguage];
}
const std::vector<OUString>& SwStyleNameMapper::GetHTMLChrFormatUINameArray()
{
- LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
+ const LanguageTag& rCurrentLanguage = SvtSysLocale().GetUILanguageTag();
static std::map<LanguageTag, std::vector<OUString>> s_aHTMLChrFormatUINameArray;
- auto aFound = s_aHTMLChrFormatUINameArray.find(aCurrentLanguage);
+ auto aFound = s_aHTMLChrFormatUINameArray.find(rCurrentLanguage);
if (aFound == s_aHTMLChrFormatUINameArray.end()) {
- s_aHTMLChrFormatUINameArray[aCurrentLanguage] =
+ s_aHTMLChrFormatUINameArray[rCurrentLanguage] =
lcl_NewUINameArray(STR_POOLCHR_HTML_ARY, SAL_N_ELEMENTS(STR_POOLCHR_HTML_ARY));
}
- return s_aHTMLChrFormatUINameArray[aCurrentLanguage];
+ return s_aHTMLChrFormatUINameArray[rCurrentLanguage];
}
const std::vector<OUString>& SwStyleNameMapper::GetPageDescUINameArray()
{
- LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
+ const LanguageTag& rCurrentLanguage = SvtSysLocale().GetUILanguageTag();
static std::map<LanguageTag, std::vector<OUString>> s_aPageDescUINameArray;
- auto aFound = s_aPageDescUINameArray.find(aCurrentLanguage);
+ auto aFound = s_aPageDescUINameArray.find(rCurrentLanguage);
if (aFound == s_aPageDescUINameArray.end()) {
- s_aPageDescUINameArray[aCurrentLanguage] =
+ s_aPageDescUINameArray[rCurrentLanguage] =
lcl_NewUINameArray(STR_POOLPAGE_ARY, SAL_N_ELEMENTS(STR_POOLPAGE_ARY));
}
- return s_aPageDescUINameArray[aCurrentLanguage];
+ return s_aPageDescUINameArray[rCurrentLanguage];
}
const std::vector<OUString>& SwStyleNameMapper::GetNumRuleUINameArray()
{
- LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
+ const LanguageTag& rCurrentLanguage = SvtSysLocale().GetUILanguageTag();
static std::map<LanguageTag, std::vector<OUString>> s_aNumRuleUINameArray;
- auto aFound = s_aNumRuleUINameArray.find(aCurrentLanguage);
+ auto aFound = s_aNumRuleUINameArray.find(rCurrentLanguage);
if (aFound == s_aNumRuleUINameArray.end()) {
- s_aNumRuleUINameArray[aCurrentLanguage] =
+ s_aNumRuleUINameArray[rCurrentLanguage] =
lcl_NewUINameArray(STR_POOLNUMRULE_NUM_ARY, SAL_N_ELEMENTS(STR_POOLNUMRULE_NUM_ARY));
}
- return s_aNumRuleUINameArray[aCurrentLanguage];
+ return s_aNumRuleUINameArray[rCurrentLanguage];
}
const std::vector<OUString>& SwStyleNameMapper::GetTableStyleUINameArray()
{
- LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
+ const LanguageTag& rCurrentLanguage = SvtSysLocale().GetUILanguageTag();
static std::map<LanguageTag, std::vector<OUString>> s_aTableStyleUINameArray;
- auto aFound = s_aTableStyleUINameArray.find(aCurrentLanguage);
+ auto aFound = s_aTableStyleUINameArray.find(rCurrentLanguage);
if (aFound == s_aTableStyleUINameArray.end()) {
- s_aTableStyleUINameArray[aCurrentLanguage] =
+ s_aTableStyleUINameArray[rCurrentLanguage] =
// 1 Writer resource string (XXX if this ever changes rather use offset math)
lcl_NewUINameArray(STR_TABSTYLE_ARY, SAL_N_ELEMENTS(STR_TABSTYLE_ARY),
static_cast<size_t>(SAL_N_ELEMENTS(STR_TABSTYLE_ARY) - 1));
}
- return s_aTableStyleUINameArray[aCurrentLanguage];
+ return s_aTableStyleUINameArray[rCurrentLanguage];
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/SwStyleNameMapper.cxx b/sw/source/core/doc/SwStyleNameMapper.cxx
index 7635a9771e8c..d0d602aa048f 100644
--- a/sw/source/core/doc/SwStyleNameMapper.cxx
+++ b/sw/source/core/doc/SwStyleNameMapper.cxx
@@ -108,14 +108,14 @@ template <auto initFunc> struct TablePair
return s_aProgMap;
}
- LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
+ const LanguageTag& rCurrentLanguage = SvtSysLocale().GetUILanguageTag();
static std::map<LanguageTag, NameToIdHash> s_aUIMap;
- auto aFound = s_aUIMap.find(aCurrentLanguage);
+ auto aFound = s_aUIMap.find(rCurrentLanguage);
if (aFound == s_aUIMap.end())
- s_aUIMap[aCurrentLanguage] = initFunc(false);
+ s_aUIMap[rCurrentLanguage] = initFunc(false);
- return s_aUIMap[aCurrentLanguage];
+ return s_aUIMap[rCurrentLanguage];
}
};
More information about the Libreoffice-commits
mailing list