summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2024-04-30 21:56:47 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-05-01 19:29:19 +0200
commit82bf36179ba8369ca026ef3cf400e216255941f1 (patch)
tree099c668816dcc640aacad6a84f23bca4efa3cbea /toolkit
parenta835b40e05462e9be58cb501aa6b938f3dc998b8 (diff)
simplify and reduce OUString allocation in UnoControl
Change-Id: I276d0b8b1d3fde8aab6be15cb2477ce0c6d175c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166957 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/source/controls/unocontrol.cxx41
1 files changed, 13 insertions, 28 deletions
diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx
index 0880455581ea..101e5f75a706 100644
--- a/toolkit/source/controls/unocontrol.cxx
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -55,25 +55,14 @@ using namespace ::com::sun::star::util;
using ::com::sun::star::accessibility::XAccessibleContext;
using ::com::sun::star::accessibility::XAccessible;
-namespace {
-
-struct LanguageDependentProp
-{
- const char* pPropName;
- sal_Int32 nPropNameLength;
-};
-
-}
-
-const LanguageDependentProp aLanguageDependentProp[] =
-{
- { "Text", 4 },
- { "Label", 5 },
- { "Title", 5 },
- { "HelpText", 8 },
- { "CurrencySymbol", 14 },
- { "StringItemList", 14 },
- { nullptr, 0 }
+constexpr OUString aLanguageDependentProp[] =
+{
+ u"Text"_ustr,
+ u"Label"_ustr,
+ u"Title"_ustr,
+ u"HelpText"_ustr,
+ u"CurrencySymbol"_ustr,
+ u"StringItemList"_ustr,
};
static Sequence< OUString> lcl_ImplGetPropertyNames( const Reference< XMultiPropertySet > & rxModel )
@@ -579,14 +568,13 @@ void UnoControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent
// Add language dependent properties into the peer property set.
// Our resource resolver has been changed and we must be sure
// that language dependent props use the new resolver.
- const LanguageDependentProp* pLangDepProp = aLanguageDependentProp;
- while ( pLangDepProp->pPropName != nullptr )
+
+ for (const auto & rLangDepProp : aLanguageDependentProp)
{
bool bMustBeInserted( true );
for (const PropertyValue & i : aPeerPropertiesToSet)
{
- if ( i.Name.equalsAsciiL(
- pLangDepProp->pPropName, pLangDepProp->nPropNameLength ))
+ if ( i.Name == rLangDepProp )
{
bMustBeInserted = false;
break;
@@ -596,14 +584,11 @@ void UnoControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent
if ( bMustBeInserted )
{
// Add language dependent props at the end
- OUString aPropName( OUString::createFromAscii( pLangDepProp->pPropName ));
- if ( xPSI.is() && xPSI->hasPropertyByName( aPropName ) )
+ if ( xPSI.is() && xPSI->hasPropertyByName( rLangDepProp ) )
{
- aPeerPropertiesToSet.emplace_back( aPropName, 0, xPS->getPropertyValue( aPropName ), PropertyState_DIRECT_VALUE );
+ aPeerPropertiesToSet.emplace_back( rLangDepProp, 0, xPS->getPropertyValue( rLangDepProp ), PropertyState_DIRECT_VALUE );
}
}
-
- ++pLangDepProp;
}
}
aGuard.clear();