diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2012-03-08 00:49:32 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-03-12 13:35:57 +0100 |
commit | 3f765e5bb2955683fc2db10f630365a4c35416d3 (patch) | |
tree | 005cbfefc4547529d7a1e416b657d44c6e1e8308 | |
parent | 56e4153e2cbee8d66659e0c59690ef8911ad090a (diff) |
replace usage of OUString::replace*AsciiL() with string literal overloads
-rw-r--r-- | basctl/source/basicide/baside3.cxx | 3 | ||||
-rw-r--r-- | basctl/source/basicide/basides1.cxx | 4 | ||||
-rw-r--r-- | basctl/source/basicide/bastypes.cxx | 6 | ||||
-rw-r--r-- | basctl/source/basicide/brkdlg.cxx | 3 | ||||
-rw-r--r-- | basctl/source/basicide/moduldl2.cxx | 12 | ||||
-rw-r--r-- | basctl/source/dlged/managelang.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/datasource.cxx | 3 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/documentcontainer.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/ext/macromigration/migrationengine.cxx | 21 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppController.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/uno/copytablewizard.cxx | 3 | ||||
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx | 15 | ||||
-rw-r--r-- | desktop/source/deployment/misc/dp_dependencies.cxx | 3 | ||||
-rw-r--r-- | framework/source/services/autorecovery.cxx | 3 | ||||
-rw-r--r-- | sal/qa/rtl/strings/test_strings_replace.cxx | 199 | ||||
-rw-r--r-- | starmath/source/ooxmlimport.cxx | 6 | ||||
-rw-r--r-- | vcl/generic/print/genprnpsp.cxx | 6 | ||||
-rw-r--r-- | vcl/unx/gtk/app/gtksys.cxx | 5 |
18 files changed, 121 insertions, 183 deletions
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index 67c8b006ce93..d6ce0def323f 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -1063,8 +1063,7 @@ sal_Bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const { ::rtl::OUString aQueryBoxTitle(ResId::toString(IDEResId(RID_STR_DLGIMP_CLASH_TITLE))); ::rtl::OUString aQueryBoxText(ResId::toString(IDEResId(RID_STR_DLGIMP_CLASH_TEXT))); - aQueryBoxText = aQueryBoxText.replaceAllAsciiL( - RTL_CONSTASCII_STRINGPARAM("$(ARG1)"), aXmlDlgName); + aQueryBoxText = aQueryBoxText.replaceAll("$(ARG1)", aXmlDlgName); NameClashQueryBox aQueryBox( pWin, aQueryBoxTitle, aQueryBoxText ); sal_uInt16 nRet = aQueryBox.Execute(); diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index 96f662ba0c56..d78f43a6863f 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -177,9 +177,7 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq ) nFound = ((ModulWindow*)pCurWin)->StartSearchAndReplace( (const SvxSearchItem&)rItem ); ::rtl::OUString aReplStr(ResId::toString(IDEResId(RID_STR_SEARCHREPLACES))); - aReplStr = aReplStr.replaceAllAsciiL( - RTL_CONSTASCII_STRINGPARAM("XX"), - rtl::OUString::valueOf(nFound)); + aReplStr = aReplStr.replaceAll("XX", rtl::OUString::valueOf(nFound)); InfoBox( pCurWin, aReplStr ).Execute(); } else diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx index f7221f43f40d..3ea2668c6942 100644 --- a/basctl/source/basicide/bastypes.cxx +++ b/basctl/source/basicide/bastypes.cxx @@ -762,8 +762,7 @@ bool QueryDel( const ::rtl::OUString& rName, const ResId& rId, Window* pParent ) ::rtl::OUStringBuffer aNameBuf( rName ); aNameBuf.append('\''); aNameBuf.insert(sal_Int32(0), sal_Unicode('\'')); - aQuery = aQuery.replaceAllAsciiL( - RTL_CONSTASCII_STRINGPARAM("XX"), aNameBuf.makeStringAndClear()); + aQuery = aQuery.replaceAll("XX", aNameBuf.makeStringAndClear()); QueryBox aQueryBox( pParent, WB_YES_NO | WB_DEF_YES, aQuery ); return ( aQueryBox.Execute() == RET_YES ); } @@ -808,8 +807,7 @@ bool QueryPassword( const Reference< script::XLibraryContainer >& xLibContainer, if ( bNewTitle ) { ::rtl::OUString aTitle(ResId::toString(IDEResId(RID_STR_ENTERPASSWORD))); - aTitle = aTitle.replaceAllAsciiL( - RTL_CONSTASCII_STRINGPARAM("XX"), rLibName); + aTitle = aTitle.replaceAll("XX", rLibName); pDlg->SetText( aTitle ); } diff --git a/basctl/source/basicide/brkdlg.cxx b/basctl/source/basicide/brkdlg.cxx index 917a95f6c55a..0df53c46eb28 100644 --- a/basctl/source/basicide/brkdlg.cxx +++ b/basctl/source/basicide/brkdlg.cxx @@ -50,8 +50,7 @@ bool lcl_ParseText(rtl::OUString const &rText, size_t& rLineNr ) // number n. (Maybe it would be better to ignore all whitespace instead // of just spaces.) rtl::OUString aText( - rText.replaceAllAsciiL( - RTL_CONSTASCII_STRINGPARAM(" "), rtl::OUString())); + rText.replaceAll(" ", rtl::OUString())); sal_Unicode cFirst = aText[0]; if (cFirst != '#' && !(cFirst >= '0' && cFirst <= '9')) return false; diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index ebb113765fc7..96545f649d51 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -962,9 +962,7 @@ void LibPage::InsertLib() ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) && xDlgLibContainer->isLibraryReadOnly( aLibName ) && !xDlgLibContainer->isLibraryLink( aLibName ) ) ) { ::rtl::OUString aErrStr( ResId::toString( IDEResId( RID_STR_REPLACELIB ) ) ); - aErrStr = aErrStr.replaceAllAsciiL( - RTL_CONSTASCII_STRINGPARAM("XX"), - aLibName); + aErrStr = aErrStr.replaceAll("XX", aLibName); aErrStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); aErrStr += ResId::toString( IDEResId( RID_STR_LIBISREADONLY ) ); ErrorBox( this, WB_OK | WB_DEF_OK, aErrStr ).Execute(); @@ -981,9 +979,7 @@ void LibPage::InsertLib() aErrStr = ResId::toString( IDEResId( RID_STR_REFNOTPOSSIBLE ) ); else aErrStr = ResId::toString( IDEResId( RID_STR_IMPORTNOTPOSSIBLE ) ); - aErrStr = aErrStr.replaceAllAsciiL( - RTL_CONSTASCII_STRINGPARAM("XX"), - aLibName); + aErrStr = aErrStr.replaceAll("XX", aLibName); aErrStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); aErrStr += ResId::toString( IDEResId( RID_STR_SBXNAMEALLREADYUSED ) ); ErrorBox( this, WB_OK | WB_DEF_OK, aErrStr ).Execute(); @@ -1004,9 +1000,7 @@ void LibPage::InsertLib() if ( !bOK ) { ::rtl::OUString aErrStr( ResId::toString( IDEResId( RID_STR_NOIMPORT ) ) ); - aErrStr = aErrStr.replaceAllAsciiL( - RTL_CONSTASCII_STRINGPARAM("XX"), - aLibName); + aErrStr = aErrStr.replaceAll("XX", aLibName); ErrorBox( this, WB_OK | WB_DEF_OK, aErrStr ).Execute(); continue; } diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx index 01935d5d1046..856d523154d3 100644 --- a/basctl/source/dlged/managelang.cxx +++ b/basctl/source/dlged/managelang.cxx @@ -121,7 +121,7 @@ void ManageLanguageDialog::Init() ::rtl::OUString sLibName = pIDEShell->GetCurLibName(); // set dialog title with library name ::rtl::OUString sText = GetText(); - sText = sText.replaceAllAsciiL(RTL_CONSTASCII_STRINGPARAM("$1"), sLibName); + sText = sText.replaceAll("$1", sLibName); SetText( sText ); // set handler m_aAddPB.SetClickHdl( LINK( this, ManageLanguageDialog, AddHdl ) ); diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx index ae8971729bb2..dc0e767f1896 100644 --- a/dbaccess/source/core/dataaccess/datasource.cxx +++ b/dbaccess/source/core/dataaccess/datasource.cxx @@ -747,8 +747,7 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const ::rtl::O SQLContext aContext; aContext.Message = DBACORE_RESSTRING(RID_STR_CONNECTION_REQUEST). - replaceFirstAsciiL( - RTL_CONSTASCII_STRINGPARAM("$name$"), m_pImpl->m_sConnectURL); + replaceFirst("$name$", m_pImpl->m_sConnectURL); throwGenericSQLException( sMessage, static_cast< XDataSource* >( this ), makeAny( aContext ) ); } diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx index 082a6f315f96..8b2481a2be7b 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.cxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx @@ -542,8 +542,7 @@ Reference< XComponent > SAL_CALL ODocumentContainer::loadComponentFromURL( const if ( !lcl_queryContent(_sURL,xNameContainer,aContent,sName) ) { ::rtl::OUString sMessage( - DBA_RES(RID_STR_NAME_NOT_FOUND).replaceFirstAsciiL( - RTL_CONSTASCII_STRINGPARAM("$name$"), _sURL)); + DBA_RES(RID_STR_NAME_NOT_FOUND).replaceFirst("$name$", _sURL)); throw IllegalArgumentException( sMessage, *this, 1 ); } @@ -613,8 +612,7 @@ void SAL_CALL ODocumentContainer::insertByHierarchicalName( const ::rtl::OUStrin { sal_Int32 index = sName.getLength(); ::rtl::OUString sMessage( - DBA_RES(RID_STR_NO_SUB_FOLDER).replaceFirstAsciiL( - RTL_CONSTASCII_STRINGPARAM("$folder$"), + DBA_RES(RID_STR_NO_SUB_FOLDER).replaceFirst("$folder$", _sName.getToken(0,'/',index))); throw IllegalArgumentException( sMessage, *this, 1 ); } diff --git a/dbaccess/source/ext/macromigration/migrationengine.cxx b/dbaccess/source/ext/macromigration/migrationengine.cxx index 5bdde99a1407..5da4555fd2aa 100644 --- a/dbaccess/source/ext/macromigration/migrationengine.cxx +++ b/dbaccess/source/ext/macromigration/migrationengine.cxx @@ -257,9 +257,7 @@ namespace dbmm ResId::toString( MacroMigrationResId( _rDocument.eType == eForm ? STR_FORM : STR_REPORT)). - replaceFirstAsciiL( - RTL_CONSTASCII_STRINGPARAM("$name$"), - _rDocument.sHierarchicalName)); + replaceFirst("$name$", _rDocument.sHierarchicalName)); return sObjectName; } @@ -1031,9 +1029,7 @@ namespace dbmm sal_Int32 nOverallRange( m_aSubDocs.size() ); rtl::OUString sProgressSkeleton( ResId::toString(MacroMigrationResId( STR_OVERALL_PROGRESS)). - replaceFirstAsciiL( - RTL_CONSTASCII_STRINGPARAM("$overall$"), - rtl::OUString::valueOf(nOverallRange))); + replaceFirst("$overall$", rtl::OUString::valueOf(nOverallRange))); m_rProgress.start( nOverallRange ); @@ -1045,8 +1041,7 @@ namespace dbmm sal_Int32 nOverallProgressValue( doc - m_aSubDocs.begin() + 1 ); // update overall progress text ::rtl::OUString sOverallProgress( - sProgressSkeleton.replaceFirstAsciiL( - RTL_CONSTASCII_STRINGPARAM("$current$"), + sProgressSkeleton.replaceFirst("$current$", ::rtl::OUString::valueOf(nOverallProgressValue))); m_rProgress.setOverallProgressText( sOverallProgress ); @@ -1938,14 +1933,12 @@ namespace dbmm // a human-readable description of the affected library ::rtl::OUString sLibraryDescription( ResId::toString(MacroMigrationResId(STR_LIBRARY_TYPE_AND_NAME)). - replaceFirstAsciiL( - RTL_CONSTASCII_STRINGPARAM("$type$"), + replaceFirst("$type$", getScriptTypeDisplayName(_eScriptType)). - replaceFirstAsciiL( - RTL_CONSTASCII_STRINGPARAM("$library$"), _rLibraryName)); - //TODO: probably broken if first replaceFirstAsciiL can produce + replaceFirst("$library$", _rLibraryName)); + //TODO: probably broken if first replaceFirst can produce // fresh instance of "$library$" in subject string of second - // replaceFirstAsciiL + // replaceFirst InteractionHandler aHandler( m_aContext, m_xDocumentModel ); ::rtl::OUString sPassword; diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 1ee3d1b77dd1..d5f2b6698309 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -2966,9 +2966,7 @@ void SAL_CALL OApplicationController::removeSelectionChangeListener( const Refer ::rtl::OUString sMessage( rtl::OUString( String(ModuleRes(RID_STR_UNSUPPORTED_OBJECT_TYPE))). - replaceFirstAsciiL( - RTL_CONSTASCII_STRINGPARAM("$type$"), - ::rtl::OUString::valueOf(sal_Int32(pObject->Type)))); + replaceFirst("$type$", ::rtl::OUString::valueOf(sal_Int32(pObject->Type)))); throw IllegalArgumentException(sMessage, *this, sal_Int16( pObject - aSelectedObjects.getConstArray() )); } } diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index cfcadfcf2e26..5af49b91f0d6 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -763,8 +763,7 @@ void CopyTableWizard::impl_checkForUnsupportedSettings_throw( const Reference< X { ::rtl::OUString sMessage( rtl::OUString(String(ModuleRes(STR_CTW_ERROR_UNSUPPORTED_SETTING))). - replaceFirstAsciiL( - RTL_CONSTASCII_STRINGPARAM("$name$"), sUnsupportedSetting)); + replaceFirst("$name$", sUnsupportedSetting)); throw IllegalArgumentException( sMessage, *const_cast< CopyTableWizard* >( this ), diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index ae37a1d5cb4f..29ded177175a 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -893,8 +893,7 @@ void ExtensionCmdQueue::Thread::_addExtension( ::rtl::Reference< ProgressCmdEnv uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager(); uno::Reference< task::XAbortChannel > xAbortChannel( xExtMgr->createAbortChannel() ); OUString sTitle( - m_sAddingPackages.replaceAllAsciiL( - RTL_CONSTASCII_STRINGPARAM("%EXTENSION_NAME"), sName)); + m_sAddingPackages.replaceAll("%EXTENSION_NAME", sName)); rCmdEnv->progressSection( sTitle, xAbortChannel ); try @@ -922,8 +921,7 @@ void ExtensionCmdQueue::Thread::_removeExtension( ::rtl::Reference< ProgressCmdE uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager(); uno::Reference< task::XAbortChannel > xAbortChannel( xExtMgr->createAbortChannel() ); OUString sTitle( - m_sRemovingPackages.replaceAllAsciiL( - RTL_CONSTASCII_STRINGPARAM("%EXTENSION_NAME"), + m_sRemovingPackages.replaceAll("%EXTENSION_NAME", xPackage->getDisplayName())); rCmdEnv->progressSection( sTitle, xAbortChannel ); @@ -1008,8 +1006,7 @@ void ExtensionCmdQueue::Thread::_enableExtension( ::rtl::Reference< ProgressCmdE uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager(); uno::Reference< task::XAbortChannel > xAbortChannel( xExtMgr->createAbortChannel() ); OUString sTitle( - m_sEnablingPackages.replaceAllAsciiL( - RTL_CONSTASCII_STRINGPARAM("%EXTENSION_NAME"), + m_sEnablingPackages.replaceAll("%EXTENSION_NAME", xPackage->getDisplayName())); rCmdEnv->progressSection( sTitle, xAbortChannel ); @@ -1033,8 +1030,7 @@ void ExtensionCmdQueue::Thread::_disableExtension( ::rtl::Reference< ProgressCmd uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager(); uno::Reference< task::XAbortChannel > xAbortChannel( xExtMgr->createAbortChannel() ); OUString sTitle( - m_sDisablingPackages.replaceAllAsciiL( - RTL_CONSTASCII_STRINGPARAM("%EXTENSION_NAME"), + m_sDisablingPackages.replaceAll("%EXTENSION_NAME", xPackage->getDisplayName())); rCmdEnv->progressSection( sTitle, xAbortChannel ); @@ -1058,8 +1054,7 @@ void ExtensionCmdQueue::Thread::_acceptLicense( ::rtl::Reference< ProgressCmdEnv uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager(); uno::Reference< task::XAbortChannel > xAbortChannel( xExtMgr->createAbortChannel() ); OUString sTitle( - m_sAcceptLicense.replaceAllAsciiL( - RTL_CONSTASCII_STRINGPARAM("%EXTENSION_NAME"), + m_sAcceptLicense.replaceAll("%EXTENSION_NAME", xPackage->getDisplayName())); rCmdEnv->progressSection( sTitle, xAbortChannel ); diff --git a/desktop/source/deployment/misc/dp_dependencies.cxx b/desktop/source/deployment/misc/dp_dependencies.cxx index e24873f7c017..710eea88adf9 100644 --- a/desktop/source/deployment/misc/dp_dependencies.cxx +++ b/desktop/source/deployment/misc/dp_dependencies.cxx @@ -93,8 +93,7 @@ bool satisfiesMaximalVersion( rtl::OUString produceErrorText( rtl::OUString const & reason, rtl::OUString const & version) { - return reason.replaceFirstAsciiL( - RTL_CONSTASCII_STRINGPARAM("%VERSION"), + return reason.replaceFirst("%VERSION", (version.isEmpty() ? ResId::toString( dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_UNKNOWN)) diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index eb534842cf15..9edec64f4b63 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -3510,8 +3510,7 @@ void AutoRecovery::impl_showFullDiscError() ErrorBox dlgError( 0, WB_OK, - sMsg.replaceAllAsciiL( - RTL_CONSTASCII_STRINGPARAM("%PATH"), sBackupPath)); + sMsg.replaceAll("%PATH", sBackupPath)); dlgError.SetButtonText(dlgError.GetButtonId(0), sBtn); dlgError.Execute(); } diff --git a/sal/qa/rtl/strings/test_strings_replace.cxx b/sal/qa/rtl/strings/test_strings_replace.cxx index 33638899a4ab..b2b54b581482 100644 --- a/sal/qa/rtl/strings/test_strings_replace.cxx +++ b/sal/qa/rtl/strings/test_strings_replace.cxx @@ -134,212 +134,189 @@ void Test::stringReplaceAll() { void Test::ustringReplaceFirst() { CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("otherbarfoo")), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")).replaceFirst( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foo")), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("other")))); + rtl::OUString("otherbarfoo"), + rtl::OUString("foobarfoo").replaceFirst( + rtl::OUString("foo"), + rtl::OUString("other"))); CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")).replaceFirst( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bars")), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("other")))); + rtl::OUString("foobarfoo"), + rtl::OUString("foobarfoo").replaceFirst( + rtl::OUString("bars"), + rtl::OUString("other"))); { sal_Int32 n = 0; CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("otherbarfoo")), - (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")). + rtl::OUString("otherbarfoo"), + (rtl::OUString("foobarfoo"). replaceFirst( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foo")), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("other")), &n))); + rtl::OUString("foo"), + rtl::OUString("other"), &n))); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), n); } { sal_Int32 n = 1; CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarother")), - (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")). + rtl::OUString("foobarother"), + (rtl::OUString("foobarfoo"). replaceFirst( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foo")), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("other")), &n))); + rtl::OUString("foo"), + rtl::OUString("other"), &n))); CPPUNIT_ASSERT_EQUAL(sal_Int32(6), n); } { sal_Int32 n = 4; CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")), - (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")). + rtl::OUString("foobarfoo"), + (rtl::OUString("foobarfoo"). replaceFirst( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bar")), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("other")), &n))); + rtl::OUString("bar"), + rtl::OUString("other"), &n))); CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), n); } } void Test::ustringReplaceFirstAsciiL() { CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("otherbarfoo")), - (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")). - replaceFirstAsciiL( - RTL_CONSTASCII_STRINGPARAM("foo"), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("other"))))); + rtl::OUString("otherbarfoo"), + (rtl::OUString("foobarfoo"). + replaceFirst("foo", + rtl::OUString("other")))); CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")), - (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")). - replaceFirstAsciiL( - RTL_CONSTASCII_STRINGPARAM("bars"), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("other"))))); + rtl::OUString("foobarfoo"), + (rtl::OUString("foobarfoo"). + replaceFirst("bars", + rtl::OUString("other")))); { sal_Int32 n = 0; CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("otherbarfoo")), - (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")). - replaceFirstAsciiL( - RTL_CONSTASCII_STRINGPARAM("foo"), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("other")), &n))); + rtl::OUString("otherbarfoo"), + (rtl::OUString("foobarfoo"). + replaceFirst("foo", + rtl::OUString("other"), &n))); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), n); } { sal_Int32 n = 1; CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarother")), - (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")). - replaceFirstAsciiL( - RTL_CONSTASCII_STRINGPARAM("foo"), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("other")), &n))); + rtl::OUString("foobarother"), + (rtl::OUString("foobarfoo"). + replaceFirst("foo", + rtl::OUString("other"), &n))); CPPUNIT_ASSERT_EQUAL(sal_Int32(6), n); } { sal_Int32 n = 4; CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")), - (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")). - replaceFirstAsciiL( - RTL_CONSTASCII_STRINGPARAM("bar"), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("other")), &n))); + rtl::OUString("foobarfoo"), + (rtl::OUString("foobarfoo"). + replaceFirst("bar", + rtl::OUString("other"), &n))); CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), n); } } void Test::ustringReplaceFirstAsciiLAsciiL() { CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("otherbarfoo")), - (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")). - replaceFirstAsciiLAsciiL( - RTL_CONSTASCII_STRINGPARAM("foo"), - RTL_CONSTASCII_STRINGPARAM("other")))); + rtl::OUString("otherbarfoo"), + (rtl::OUString("foobarfoo"). + replaceFirst("foo", "other"))); CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")), - (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")). - replaceFirstAsciiLAsciiL( - RTL_CONSTASCII_STRINGPARAM("bars"), - RTL_CONSTASCII_STRINGPARAM("other")))); + rtl::OUString("foobarfoo"), + (rtl::OUString("foobarfoo"). + replaceFirst("bars", "other"))); { sal_Int32 n = 0; CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("otherbarfoo")), - (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")). - replaceFirstAsciiLAsciiL( - RTL_CONSTASCII_STRINGPARAM("foo"), - RTL_CONSTASCII_STRINGPARAM("other"), &n))); + rtl::OUString("otherbarfoo"), + (rtl::OUString("foobarfoo"). + replaceFirst("foo", "other", &n))); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), n); } { sal_Int32 n = 1; CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarother")), - (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")). - replaceFirstAsciiLAsciiL( - RTL_CONSTASCII_STRINGPARAM("foo"), - RTL_CONSTASCII_STRINGPARAM("other"), &n))); + rtl::OUString("foobarother"), + (rtl::OUString("foobarfoo"). + replaceFirst("foo", "other", &n))); CPPUNIT_ASSERT_EQUAL(sal_Int32(6), n); } { sal_Int32 n = 4; CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")), - (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")). - replaceFirstAsciiLAsciiL( - RTL_CONSTASCII_STRINGPARAM("bar"), - RTL_CONSTASCII_STRINGPARAM("other"), &n))); + rtl::OUString("foobarfoo"), + (rtl::OUString("foobarfoo"). + replaceFirst("bar", "other", &n))); CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), n); } } void Test::ustringReplaceAll() { CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("otherbarother")), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")).replaceAll( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foo")), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("other")))); + rtl::OUString("otherbarother"), + rtl::OUString("foobarfoo").replaceAll( + rtl::OUString("foo"), + rtl::OUString("other"))); CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")).replaceAll( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bars")), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("other")))); + rtl::OUString("foobarfoo"), + rtl::OUString("foobarfoo").replaceAll( + rtl::OUString("bars"), + rtl::OUString("other"))); CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("xxa")), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("xaa")).replaceAll( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("xa")), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("xx")))); + rtl::OUString("xxa"), + rtl::OUString("xaa").replaceAll( + rtl::OUString("xa"), + rtl::OUString("xx"))); } void Test::ustringReplaceAllAsciiL() { CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("otherbarother")), - (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")). - replaceAllAsciiL( - RTL_CONSTASCII_STRINGPARAM("foo"), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("other"))))); + rtl::OUString("otherbarother"), + (rtl::OUString("foobarfoo"). + replaceAll("foo", + rtl::OUString("other")))); CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")), - (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")). - replaceAllAsciiL( - RTL_CONSTASCII_STRINGPARAM("bars"), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("other"))))); + rtl::OUString("foobarfoo"), + (rtl::OUString("foobarfoo"). + replaceAll("bars", + rtl::OUString("other")))); CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("xxa")), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("xaa")).replaceAllAsciiL( - RTL_CONSTASCII_STRINGPARAM("xa"), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("xx")))); + rtl::OUString("xxa"), + rtl::OUString("xaa").replaceAll( + "xa", + rtl::OUString("xx"))); } void Test::ustringReplaceAllAsciiLAsciiL() { CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("otherbarother")), - (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")). - replaceAllAsciiLAsciiL( - RTL_CONSTASCII_STRINGPARAM("foo"), - RTL_CONSTASCII_STRINGPARAM("other")))); + rtl::OUString("otherbarother"), + (rtl::OUString("foobarfoo"). + replaceAll("foo", "other"))); CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")), - (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobarfoo")). - replaceAllAsciiLAsciiL( - RTL_CONSTASCII_STRINGPARAM("bars"), - RTL_CONSTASCII_STRINGPARAM("other")))); + rtl::OUString("foobarfoo"), + (rtl::OUString("foobarfoo"). + replaceAll("bars", "other"))); CPPUNIT_ASSERT_EQUAL( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("xxa")), - (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("xaa")). - replaceAllAsciiLAsciiL( - RTL_CONSTASCII_STRINGPARAM("xa"), - RTL_CONSTASCII_STRINGPARAM("xx")))); + rtl::OUString("xxa"), + (rtl::OUString("xaa"). + replaceAll("xa", "xx"))); } } diff --git a/starmath/source/ooxmlimport.cxx b/starmath/source/ooxmlimport.cxx index 141a114bc952..904d44f96897 100644 --- a/starmath/source/ooxmlimport.cxx +++ b/starmath/source/ooxmlimport.cxx @@ -84,12 +84,10 @@ OUString SmOoxmlImport::handleStream() stream.ensureClosingTag( M_TOKEN( oMath )); // Placeholders are written out as nothing (i.e. nothing inside e.g. the <e> element), // which will result in "{}" in the formula text. Fix this up. - ret = ret.replaceAllAsciiLAsciiL( - RTL_CONSTASCII_STRINGPARAM("{}"), RTL_CONSTASCII_STRINGPARAM("<?>")); + ret = ret.replaceAll( "{}", "<?>" ); // And as a result, empty parts of the formula that are not placeholders are written out // as a single space, so fix that up too. - ret = ret.replaceAllAsciiLAsciiL( - RTL_CONSTASCII_STRINGPARAM("{ }"), RTL_CONSTASCII_STRINGPARAM("{}")); + ret = ret.replaceAll( "{ }", "{}" ); SAL_INFO( "starmath.ooxml", "Formula: " << ret ); return ret; } diff --git a/vcl/generic/print/genprnpsp.cxx b/vcl/generic/print/genprnpsp.cxx index a456517a9df5..54cb87c1823b 100644 --- a/vcl/generic/print/genprnpsp.cxx +++ b/vcl/generic/print/genprnpsp.cxx @@ -359,8 +359,7 @@ static bool sendAFax( const OUString& rFaxNumber, const OUString& rFileName, con OUString aFaxNumber( aFaxNumbers.front() ); aFaxNumbers.pop_front(); OUString aCmdLine( - rCommand.replaceAllAsciiL( - RTL_CONSTASCII_STRINGPARAM("(PHONE)"), aFaxNumber)); + rCommand.replaceAll("(PHONE)", aFaxNumber)); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "sending fax to \"%s\"\n", OUStringToOString( aFaxNumber, osl_getThreadTextEncoding() ).getStr() ); #endif @@ -384,8 +383,7 @@ static bool createPdf( const OUString& rToFile, const OUString& rFromFile, const { #if defined( UNX ) OUString aCommandLine( - rCommandLine.replaceAllAsciiL( - RTL_CONSTASCII_STRINGPARAM("(OUTFILE)"), rToFile)); + rCommandLine.replaceAll("(OUTFILE)", rToFile)); return passFileToCommandLine( rFromFile, aCommandLine ); #else diff --git a/vcl/unx/gtk/app/gtksys.cxx b/vcl/unx/gtk/app/gtksys.cxx index 7c3b3f0e0cc1..bf3fba737de8 100644 --- a/vcl/unx/gtk/app/gtksys.cxx +++ b/vcl/unx/gtk/app/gtksys.cxx @@ -240,10 +240,7 @@ rtl::OUString GtkSalSystem::GetDisplayScreenName(unsigned int nScreen) // convert ~ to indicate mnemonic to '_' static rtl::OString MapToGtkAccelerator(const rtl::OUString &rStr) { - const rtl::OUString aRep(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "_" ))); - return rtl::OUStringToOString( - rStr.replaceFirstAsciiL(RTL_CONSTASCII_STRINGPARAM( "~" ), aRep), - RTL_TEXTENCODING_UTF8); + return rtl::OUStringToOString(rStr.replaceFirst("~", "_"), RTL_TEXTENCODING_UTF8); } int GtkSalSystem::ShowNativeDialog (const rtl::OUString& rTitle, const rtl::OUString& rMessage, |