summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2022-09-03 09:06:41 +0200
committerCaolán McNamara <caolanm@redhat.com>2022-09-03 21:52:16 +0200
commit871f5e60047002238df907f4b9406bf205cf16fa (patch)
tree1b998c8fcd992213f11d6e58799c39801ba625dd /svtools
parent519dae19abddaedaf0d3d109186eeb4a08471a92 (diff)
Simplify by using replaceAll instead of replaceAt in a loop
Change-Id: I019d93a0937be6402c9749b72595354cf4b09b7f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139281 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/dialogs/insdlg.cxx27
1 files changed, 2 insertions, 25 deletions
diff --git a/svtools/source/dialogs/insdlg.cxx b/svtools/source/dialogs/insdlg.cxx
index adaa1b905275..7c8703993e3b 100644
--- a/svtools/source/dialogs/insdlg.cxx
+++ b/svtools/source/dialogs/insdlg.cxx
@@ -127,12 +127,6 @@ void SvObjectServerList::FillInsertObjects()
{
const uno::Sequence< OUString > seqNames= xNameAccess->getElementNames();
- OUString aStringProductName( "%PRODUCTNAME" );
- sal_Int32 nStringProductNameLength = aStringProductName.getLength();
-
- OUString aStringProductVersion( "%PRODUCTVERSION" );
- sal_Int32 nStringProductVersionLength = aStringProductVersion.getLength();
-
for( const auto& rName : seqNames )
{
uno::Reference< container::XNameAccess > xEntry ;
@@ -146,25 +140,8 @@ void SvObjectServerList::FillInsertObjects()
if ( !aUIName.isEmpty() )
{
- // replace %PRODUCTNAME
- sal_Int32 nIndex = aUIName.indexOf( aStringProductName );
- while( nIndex != -1 )
- {
- aUIName = aUIName.replaceAt(
- nIndex, nStringProductNameLength,
- utl::ConfigManager::getProductName() );
- nIndex = aUIName.indexOf( aStringProductName );
- }
-
- // replace %PRODUCTVERSION
- nIndex = aUIName.indexOf( aStringProductVersion );
- while( nIndex != -1 )
- {
- aUIName = aUIName.replaceAt(
- nIndex, nStringProductVersionLength,
- utl::ConfigManager::getProductVersion() );
- nIndex = aUIName.indexOf( aStringProductVersion );
- }
+ aUIName = aUIName.replaceAll("%PRODUCTNAME", utl::ConfigManager::getProductName());
+ aUIName = aUIName.replaceAll("%PRODUCTVERSION", utl::ConfigManager::getProductVersion());
}
SvGlobalName aClassName;