From 2bccb7e67b637c6312a0df610f870c8621eb296f Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 15 Jun 2021 09:02:59 +0200 Subject: remove some unnecessary LanguageType copies Change-Id: Iec4374627c931ccecf05a712682ed18ef90bf359 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117208 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../uiconfiguration/uicategorydescription.cxx | 8 +++---- .../source/uielement/uicommanddescription.cxx | 26 +++++++++++----------- 2 files changed, 17 insertions(+), 17 deletions(-) (limited to 'framework') 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 { -- cgit