framework/source/uielement/toolbarmanager.cxx | 32 +++++++------------------- vcl/source/image/ImplImageTree.cxx | 22 ++++++++--------- 2 files changed, 20 insertions(+), 34 deletions(-)
New commits: commit 37bbac7f8b8649c8c3a759d4ae225ead7af2d69c Author: Noel Grandin <[email protected]> AuthorDate: Fri May 13 12:11:16 2022 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sat May 14 17:31:40 2022 +0200 simplify initialisation in ToolBarManager::CreateControllers Change-Id: I2e876f0bff180e569394e2fe3c102b658a55d170 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134309 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 4213271f2cf1..f12cbc62fd26 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -1196,30 +1196,16 @@ void ToolBarManager::CreateControllers() { if ( bInit ) { - PropertyValue aPropValue; - std::vector< Any > aPropertyVector; - - aPropValue.Name = "Frame"; - aPropValue.Value <<= m_xFrame; - aPropertyVector.push_back( Any( aPropValue )); - aPropValue.Name = "CommandURL"; - aPropValue.Value <<= aCommandURL; - aPropertyVector.push_back( Any( aPropValue )); - aPropValue.Name = "ServiceManager"; Reference<XMultiServiceFactory> xMSF(m_xContext->getServiceManager(), UNO_QUERY_THROW); - aPropValue.Value <<= xMSF; - aPropertyVector.push_back( Any( aPropValue )); - aPropValue.Name = "ParentWindow"; - aPropValue.Value <<= xToolbarWindow; - aPropertyVector.push_back( Any( aPropValue )); - aPropValue.Name = "ModuleIdentifier"; - aPropValue.Value <<= m_aModuleIdentifier; - aPropertyVector.push_back( Any( aPropValue )); - aPropValue.Name = "Identifier"; - aPropValue.Value <<= sal_uInt16(nId); - aPropertyVector.push_back( uno::Any( aPropValue ) ); - - Sequence< Any > aArgs( comphelper::containerToSequence( aPropertyVector )); + Sequence< Any > aArgs { + Any( comphelper::makePropertyValue("Frame", m_xFrame) ), + Any( comphelper::makePropertyValue("CommandURL", aCommandURL) ), + Any( comphelper::makePropertyValue("ServiceManager", xMSF) ), + Any( comphelper::makePropertyValue("ParentWindow", xToolbarWindow) ), + Any( comphelper::makePropertyValue("ModuleIdentifier", m_aModuleIdentifier) ), + Any( comphelper::makePropertyValue("Identifier", sal_uInt16(nId)) ), + }; + xInit->initialize( aArgs ); if (pController) commit d4f2b8eb74f430f5fc3622d668b33df1f99a0c1d Author: Noel Grandin <[email protected]> AuthorDate: Fri May 13 12:12:13 2022 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sat May 14 17:31:16 2022 +0200 use more string_view in getNameNoExtension to avoid some allocation Change-Id: Ic8d42af03a4ffd15414e3458b5b08e04ded43114 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134313 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/vcl/source/image/ImplImageTree.cxx b/vcl/source/image/ImplImageTree.cxx index 5f2d1e94af6a..ae9baacd55ca 100644 --- a/vcl/source/image/ImplImageTree.cxx +++ b/vcl/source/image/ImplImageTree.cxx @@ -134,10 +134,10 @@ bool urlExists(OUString const & sUrl) return osl::FileBase::E_None == eRC; } -OUString getNameNoExtension(std::u16string_view sName) +std::u16string_view getNameNoExtension(std::u16string_view sName) { size_t nDotPosition = sName.rfind('.'); - return OUString(sName.substr(0, nDotPosition)); + return sName.substr(0, nDotPosition); } std::shared_ptr<SvMemoryStream> wrapStream(uno::Reference<io::XInputStream> const & rInputStream) @@ -222,15 +222,15 @@ std::vector<OUString> ImplImageTree::getPaths(OUString const & name, LanguageTag { for (const OUString& rFallback : rLanguageTag.getFallbackStrings(true)) { - OUString aFallbackName = getNameNoExtension(getRealImageName(createPath(name, pos, rFallback))); - sPaths.emplace_back(aFallbackName + ".png"); - sPaths.emplace_back(aFallbackName + ".svg"); + std::u16string_view aFallbackName = getNameNoExtension(getRealImageName(createPath(name, pos, rFallback))); + sPaths.emplace_back(OUString::Concat(aFallbackName) + ".png"); + sPaths.emplace_back(OUString::Concat(aFallbackName) + ".svg"); } } - OUString aRealName = getNameNoExtension(getRealImageName(name)); - sPaths.emplace_back(aRealName + ".png"); - sPaths.emplace_back(aRealName + ".svg"); + std::u16string_view aRealName = getNameNoExtension(getRealImageName(name)); + sPaths.emplace_back(OUString::Concat(aRealName) + ".png"); + sPaths.emplace_back(OUString::Concat(aRealName) + ".svg"); return sPaths; } @@ -624,15 +624,15 @@ OUString const & ImplImageTree::getRealImageName(OUString const & rIconName) { IconLinkHash & rLinkHash = maIconSets[maCurrentStyle].maLinkHash; - OUString sNameWithNoExtension = getNameNoExtension(rIconName); + std::u16string_view sNameWithNoExtension = getNameNoExtension(rIconName); // PNG is priority - auto it = rLinkHash.find(sNameWithNoExtension + ".png"); + auto it = rLinkHash.find(OUString::Concat(sNameWithNoExtension) + ".png"); if (it != rLinkHash.end()) return it->second; // also check SVG name - it = rLinkHash.find(sNameWithNoExtension + ".svg"); + it = rLinkHash.find(OUString::Concat(sNameWithNoExtension) + ".svg"); if (it != rLinkHash.end()) return it->second;
