diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-07-13 20:12:42 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-07-14 14:04:03 +0100 |
commit | 82937ce3d7bc2382c4da22365d1245c9f7db178c (patch) | |
tree | dbae8b3a02a1b0f21326ba2d5da41cf946d48962 | |
parent | 46894ec48eb33dc99dab807c9fcaf0caa7c6cd84 (diff) |
String::SearchAndReplaceAllAscii -> OUString::replaceAll
Change-Id: I5091835c9f71c712f15996e5c6263fc5f21f6f96
28 files changed, 138 insertions, 169 deletions
diff --git a/dbaccess/source/ui/control/opendoccontrols.cxx b/dbaccess/source/ui/control/opendoccontrols.cxx index 5723af67c355..b3136fc785d4 100644 --- a/dbaccess/source/ui/control/opendoccontrols.cxx +++ b/dbaccess/source/ui/control/opendoccontrols.cxx @@ -182,10 +182,8 @@ namespace dbaui m_sModule = OUString::createFromAscii( _pAsciiModuleName ); // our label should equal the UI text of the "Open" command - String sLabel( GetCommandText( ".uno:Open", m_sModule ) ); - sLabel.SearchAndReplaceAllAscii( "~", String() ); - sLabel.Insert( (sal_Unicode)' ', 0 ); - SetText( sLabel ); + OUString sLabel(GetCommandText(".uno:Open", m_sModule)); + SetText(OUString(' ') + sLabel.replaceAll("~", OUString())); // Place icon left of text and both centered in the button. SetModeImage( GetCommandIcon( ".uno:Open", m_sModule ) ); diff --git a/dbaccess/source/ui/misc/defaultobjectnamecheck.cxx b/dbaccess/source/ui/misc/defaultobjectnamecheck.cxx index f0d03d973776..59fff79eb534 100644 --- a/dbaccess/source/ui/misc/defaultobjectnamecheck.cxx +++ b/dbaccess/source/ui/misc/defaultobjectnamecheck.cxx @@ -72,12 +72,11 @@ namespace dbaui //==================================================================== namespace { - void lcl_fillNameExistsError( const OUString& _rObjectName, SQLExceptionInfo& _out_rErrorToDisplay ) + void lcl_fillNameExistsError( const OUString& _rObjectName, SQLExceptionInfo& _out_rErrorToDisplay ) { - String sErrorMessage = String( ModuleRes( STR_NAMED_OBJECT_ALREADY_EXISTS ) ); - sErrorMessage.SearchAndReplaceAllAscii( "$#$", _rObjectName ); SQLException aError; - aError.Message = sErrorMessage; + OUString sErrorMessage = ModuleRes(STR_NAMED_OBJECT_ALREADY_EXISTS).toString(); + aError.Message = sErrorMessage.replaceAll("$#$", _rObjectName); _out_rErrorToDisplay = aError; } diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 5c66a3672859..493943555df5 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -573,13 +573,13 @@ ResId DialogHelper::getResId( sal_uInt16 nId ) } //------------------------------------------------------------------------------ -String DialogHelper::getResourceString( sal_uInt16 id ) +OUString DialogHelper::getResourceString(sal_uInt16 id) { const SolarMutexGuard guard; - String ret( ResId( id, *DeploymentGuiResMgr::get() ) ); - if (ret.SearchAscii( "%PRODUCTNAME" ) != STRING_NOTFOUND) { - ret.SearchAndReplaceAllAscii( - "%PRODUCTNAME", utl::ConfigManager::getProductName() ); + OUString ret(ResId(id, *DeploymentGuiResMgr::get()).toString()); + if (ret.indexOf("%PRODUCTNAME" ) != -1) + { + ret = ret.replaceAll("%PRODUCTNAME", utl::ConfigManager::getProductName()); } return ret; } @@ -603,9 +603,9 @@ bool DialogHelper::continueOnSharedExtension( const uno::Reference< deployment:: { const SolarMutexGuard guard; WarningBox aInfoBox( pParent, getResId( nResID ) ); - String aMsgText = aInfoBox.GetMessText(); - aMsgText.SearchAndReplaceAllAscii( - "%PRODUCTNAME", utl::ConfigManager::getProductName() ); + OUString aMsgText = aInfoBox.GetMessText(); + aMsgText = aMsgText.replaceAll( + "%PRODUCTNAME", utl::ConfigManager::getProductName()); aInfoBox.SetMessText( aMsgText ); bHadWarning = true; @@ -649,9 +649,9 @@ bool DialogHelper::installExtensionWarn( const OUString &rExtensionName ) const const SolarMutexGuard guard; WarningBox aInfo( m_pVCLWindow, getResId( RID_WARNINGBOX_INSTALL_EXTENSION ) ); - String sText( aInfo.GetMessText() ); - sText.SearchAndReplaceAllAscii( "%NAME", rExtensionName ); - aInfo.SetMessText( sText ); + OUString sText(aInfo.GetMessText()); + sText = sText.replaceAll("%NAME", rExtensionName); + aInfo.SetMessText(sText); return ( RET_OK == aInfo.Execute() ); } @@ -662,10 +662,10 @@ bool DialogHelper::installForAllUsers( bool &bInstallForAll ) const const SolarMutexGuard guard; QueryBox aQuery( m_pVCLWindow, getResId( RID_QUERYBOX_INSTALL_FOR_ALL ) ); - String sMsgText = aQuery.GetMessText(); - sMsgText.SearchAndReplaceAllAscii( - "%PRODUCTNAME", utl::ConfigManager::getProductName() ); - aQuery.SetMessText( sMsgText ); + OUString sMsgText(aQuery.GetMessText()); + sMsgText = sMsgText.replaceAll( + "%PRODUCTNAME", utl::ConfigManager::getProductName()); + aQuery.SetMessText(sMsgText); sal_uInt16 nYesBtnID = aQuery.GetButtonId( 0 ); sal_uInt16 nNoBtnID = aQuery.GetButtonId( 1 ); @@ -808,9 +808,9 @@ bool ExtMgrDialog::removeExtensionWarn( const OUString &rExtensionName ) const const SolarMutexGuard guard; WarningBox aInfo( const_cast< ExtMgrDialog* >(this), getResId( RID_WARNINGBOX_REMOVE_EXTENSION ) ); - String sText( aInfo.GetMessText() ); - sText.SearchAndReplaceAllAscii( "%NAME", rExtensionName ); - aInfo.SetMessText( sText ); + OUString sText(aInfo.GetMessText()); + sText = sText.replaceAll("%NAME", rExtensionName); + aInfo.SetMessText(sText); return ( RET_OK == aInfo.Execute() ); } @@ -1224,10 +1224,10 @@ UpdateRequiredDialog::UpdateRequiredDialog( Window *pParent, TheExtensionManager m_aCloseBtn.SetClickHdl( LINK( this, UpdateRequiredDialog, HandleCloseBtn ) ); m_aCancelBtn.SetClickHdl( LINK( this, UpdateRequiredDialog, HandleCancelBtn ) ); - String aText = m_aUpdateNeeded.GetText(); - aText.SearchAndReplaceAllAscii( - "%PRODUCTNAME", utl::ConfigManager::getProductName() ); - m_aUpdateNeeded.SetText( aText ); + OUString aText = m_aUpdateNeeded.GetText(); + aText = aText.replaceAll( + "%PRODUCTNAME", utl::ConfigManager::getProductName()); + m_aUpdateNeeded.SetText(aText); // resize update button Size aBtnSize = m_aUpdateBtn.GetSizePixel(); diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index b5a5aa430483..436879b1885f 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -81,7 +81,7 @@ public: virtual void checkEntries() = 0; static ResId getResId( sal_uInt16 nId ); - static String getResourceString( sal_uInt16 id ); + static OUString getResourceString( sal_uInt16 id ); static bool IsSharedPkgMgr( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &); static bool continueOnSharedExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &, Window *pParent, diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index c9bdf06c7844..8b2cd3369248 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -456,7 +456,7 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & { SolarMutexGuard guard; WarningBox box( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, ResId(id, *DeploymentGuiResMgr::get())); - String s; + OUString s; if (bEqualNames) { s = box.GetMessText(); @@ -466,20 +466,20 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & //hypothetical: requires two instances of an extension with the same //version to have different display names. Probably the developer forgot //to change the version. - s = String(ResId(RID_STR_WARNINGBOX_VERSION_EQUAL_DIFFERENT_NAMES, *DeploymentGuiResMgr::get())); + s = ResId(RID_STR_WARNINGBOX_VERSION_EQUAL_DIFFERENT_NAMES, *DeploymentGuiResMgr::get()).toString(); } else if (id == RID_WARNINGBOX_VERSION_LESS) { - s = String(ResId(RID_STR_WARNINGBOX_VERSION_LESS_DIFFERENT_NAMES, *DeploymentGuiResMgr::get())); + s = ResId(RID_STR_WARNINGBOX_VERSION_LESS_DIFFERENT_NAMES, *DeploymentGuiResMgr::get()).toString(); } else if (id == RID_WARNINGBOX_VERSION_GREATER) { - s = String(ResId(RID_STR_WARNINGBOX_VERSION_GREATER_DIFFERENT_NAMES, *DeploymentGuiResMgr::get())); + s = ResId(RID_STR_WARNINGBOX_VERSION_GREATER_DIFFERENT_NAMES, *DeploymentGuiResMgr::get()).toString(); } - s.SearchAndReplaceAllAscii( "$NAME", verExc.NewDisplayName); - s.SearchAndReplaceAllAscii( "$OLDNAME", verExc.Deployed->getDisplayName()); - s.SearchAndReplaceAllAscii( "$NEW", getVersion(verExc.NewVersion) ); - s.SearchAndReplaceAllAscii( "$DEPLOYED", getVersion(verExc.Deployed) ); + s = s.replaceAll("$NAME", verExc.NewDisplayName); + s = s.replaceAll("$OLDNAME", verExc.Deployed->getDisplayName()); + s = s.replaceAll("$NEW", getVersion(verExc.NewVersion)); + s = s.replaceAll("$DEPLOYED", getVersion(verExc.Deployed)); box.SetMessText(s); approve = box.Execute() == RET_OK; abort = !approve; @@ -507,8 +507,8 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & else if (request >>= platExc) { SolarMutexGuard guard; - String sMsg( ResId( RID_STR_UNSUPPORTED_PLATFORM, *DeploymentGuiResMgr::get() ) ); - sMsg.SearchAndReplaceAllAscii( "%Name", platExc.package->getDisplayName() ); + OUString sMsg(ResId(RID_STR_UNSUPPORTED_PLATFORM, *DeploymentGuiResMgr::get()).toString()); + sMsg = sMsg.replaceAll("%Name", platExc.package->getDisplayName()); ErrorBox box( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, WB_OK, sMsg ); box.Execute(); approve = true; diff --git a/desktop/source/deployment/inc/dp_resource.h b/desktop/source/deployment/inc/dp_resource.h index 04dc52c82889..ebd8331ecdcc 100644 --- a/desktop/source/deployment/inc/dp_resource.h +++ b/desktop/source/deployment/inc/dp_resource.h @@ -33,7 +33,7 @@ namespace dp_misc { ResId getResId( sal_uInt16 id ); //============================================================================== -DESKTOP_DEPLOYMENTMISC_DLLPUBLIC String getResourceString( sal_uInt16 id ); +DESKTOP_DEPLOYMENTMISC_DLLPUBLIC OUString getResourceString( sal_uInt16 id ); template <typename Unique, sal_uInt16 id> struct StaticResourceString : diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index 85f0566b326d..7811aabb270a 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -1307,14 +1307,14 @@ sal_Bool ExtensionManager::synchronize( try { ::osl::MutexGuard guard(getMutex()); - String sSynchronizingShared(StrSyncRepository::get()); - sSynchronizingShared.SearchAndReplaceAllAscii( "%NAME", OUString("shared")); + OUString sSynchronizingShared(StrSyncRepository::get()); + sSynchronizingShared = sSynchronizingShared.replaceAll("%NAME", "shared"); dp_misc::ProgressLevel progressShared(xCmdEnv, sSynchronizingShared); sal_Bool bModified = getSharedRepository()->synchronize(xAbortChannel, xCmdEnv); progressShared.update("\n\n"); - String sSynchronizingBundled(StrSyncRepository::get()); - sSynchronizingBundled.SearchAndReplaceAllAscii( "%NAME", OUString("bundled")); + OUString sSynchronizingBundled(StrSyncRepository::get()); + sSynchronizingBundled = sSynchronizingBundled.replaceAll("%NAME", "bundled"); dp_misc::ProgressLevel progressBundled(xCmdEnv, sSynchronizingBundled); bModified |= getBundledRepository()->synchronize(xAbortChannel, xCmdEnv); progressBundled.update("\n\n"); diff --git a/desktop/source/deployment/misc/dp_resource.cxx b/desktop/source/deployment/misc/dp_resource.cxx index 802e37f3d0c4..f8c43d75a3bf 100644 --- a/desktop/source/deployment/misc/dp_resource.cxx +++ b/desktop/source/deployment/misc/dp_resource.cxx @@ -66,13 +66,11 @@ ResId getResId( sal_uInt16 id ) } //============================================================================== -String getResourceString( sal_uInt16 id ) +OUString getResourceString( sal_uInt16 id ) { - const osl::MutexGuard guard( theResourceMutex::get() ); - String ret( ResId( id, *DeploymentResMgr::get() ) ); - ret.SearchAndReplaceAllAscii( - "%PRODUCTNAME", utl::ConfigManager::getProductName() ); - return ret; + const osl::MutexGuard guard(theResourceMutex::get()); + OUString ret(ResId(id, *DeploymentResMgr::get()).toString()); + return ret.replaceAll("%PRODUCTNAME", utl::ConfigManager::getProductName()); } //============================================================================== diff --git a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx index 430401fc3bc6..35ae4ecbc03e 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx @@ -139,16 +139,15 @@ void CommandEnvironmentImpl::printLicense( const OUString & sName, const OUString& sLicense, bool & accept, bool &decline) { ResMgr * pResMgr = DeploymentResMgr::get(); - String s1tmp(ResId(RID_STR_UNOPKG_ACCEPT_LIC_1, *pResMgr)); - s1tmp.SearchAndReplaceAllAscii( "$NAME", sName ); - OUString s1(s1tmp); - OUString s2 = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_2, *pResMgr)); - OUString s3 = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_3, *pResMgr)); - OUString s4 = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_4, *pResMgr)); - OUString sYES = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_YES, *pResMgr)); - OUString sY = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_Y, *pResMgr)); - OUString sNO = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_NO, *pResMgr)); - OUString sN = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_N, *pResMgr)); + OUString s1tmp(ResId(RID_STR_UNOPKG_ACCEPT_LIC_1, *pResMgr).toString()); + OUString s1(s1tmp.replaceAll("$NAME", sName)); + OUString s2 = ResId(RID_STR_UNOPKG_ACCEPT_LIC_2, *pResMgr).toString(); + OUString s3 = ResId(RID_STR_UNOPKG_ACCEPT_LIC_3, *pResMgr).toString(); + OUString s4 = ResId(RID_STR_UNOPKG_ACCEPT_LIC_4, *pResMgr).toString(); + OUString sYES = ResId(RID_STR_UNOPKG_ACCEPT_LIC_YES, *pResMgr).toString(); + OUString sY = ResId(RID_STR_UNOPKG_ACCEPT_LIC_Y, *pResMgr).toString(); + OUString sNO = ResId(RID_STR_UNOPKG_ACCEPT_LIC_NO, *pResMgr).toString(); + OUString sN = ResId(RID_STR_UNOPKG_ACCEPT_LIC_N, *pResMgr).toString(); OUString sNewLine("\n"); @@ -270,8 +269,8 @@ void CommandEnvironmentImpl::handle( } else if (request >>= platExc) { - String sMsg(ResId(RID_STR_UNSUPPORTED_PLATFORM, *dp_gui::DeploymentGuiResMgr::get())); - sMsg.SearchAndReplaceAllAscii("%Name", platExc.package->getDisplayName()); + OUString sMsg(ResId(RID_STR_UNSUPPORTED_PLATFORM, *dp_gui::DeploymentGuiResMgr::get()).toString()); + sMsg = sMsg.replaceAll("%Name", platExc.package->getDisplayName()); dp_misc::writeConsole(OUString("\n") + sMsg + "\n\n"); approve = true; } diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index bdf86f647e0b..b324eda9ad10 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -2425,12 +2425,10 @@ namespace pcr OSL_FAIL( "FormComponentPropertyHandler::impl_ensureRowsetConnection_nothrow: caught an exception during error handling!" ); } // additional info about what happended - String sInfo( PcrRes( RID_STR_UNABLETOCONNECT ) ); INetURLObject aParser( sDataSourceName ); if ( aParser.GetProtocol() != INET_PROT_NOT_VALID ) sDataSourceName = aParser.getBase( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); - sInfo.SearchAndReplaceAllAscii( "$name$", sDataSourceName ); - + OUString sInfo(PcrRes(RID_STR_UNABLETOCONNECT).toString().replaceAll("$name$", sDataSourceName)); SQLContext aContext; aContext.Message = sInfo; aContext.NextException = aError.get(); diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx index f48fb94167ca..c44b3c5b74d5 100644 --- a/framework/source/uielement/uicommanddescription.cxx +++ b/framework/source/uielement/uicommanddescription.cxx @@ -303,12 +303,10 @@ throw ( RuntimeException ) void ConfigurationAccess_UICommand::fillInfoFromResult( CmdToInfoMap& rCmdInfo, const OUString& aLabel ) { - String rStr( aLabel ); - rStr.SearchAndReplaceAllAscii( - "%PRODUCTNAME", utl::ConfigManager::getProductName() ); - rCmdInfo.aLabel = OUString( rStr ); - rStr = comphelper::string::stripEnd(rStr, '.'); // Remove "..." from string - rCmdInfo.aCommandName = OUString( MnemonicGenerator::EraseAllMnemonicChars( rStr )); + OUString aStr(aLabel.replaceAll("%PRODUCTNAME", utl::ConfigManager::getProductName())); + rCmdInfo.aLabel = aStr; + aStr = comphelper::string::stripEnd(aStr, '.'); // Remove "..." from string + rCmdInfo.aCommandName = MnemonicGenerator::EraseAllMnemonicChars(aStr); rCmdInfo.bCommandNameCreated = sal_True; } diff --git a/include/svx/lboxctrl.hxx b/include/svx/lboxctrl.hxx index 2c449b0db745..d717b1e30344 100644 --- a/include/svx/lboxctrl.hxx +++ b/include/svx/lboxctrl.hxx @@ -33,7 +33,7 @@ class SvxPopupWindowListBox; class SvxListBoxControl : public SfxToolBoxControl { protected: - String aActionStr; + OUString aActionStr; SvxPopupWindowListBox * pPopupWin; void Impl_SetInfo( sal_uInt16 nCount ); diff --git a/include/tools/string.hxx b/include/tools/string.hxx index 5efcd3e3d933..33f65223b2d9 100644 --- a/include/tools/string.hxx +++ b/include/tools/string.hxx @@ -270,7 +270,6 @@ public: xub_StrLen nIndex = 0 ); void SearchAndReplaceAll( sal_Unicode c, sal_Unicode cRep ); void SearchAndReplaceAll( const UniString& rStr, const UniString& rRepStr ); - void SearchAndReplaceAllAscii( const sal_Char* pAsciiStr, const UniString& rRepStr ); void SetToken( xub_StrLen nToken, sal_Unicode cTok, const UniString& rStr, xub_StrLen nIndex = 0 ); diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index 05c9520819a5..0785f0e7ab1a 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -2925,8 +2925,8 @@ uno::Reference<frame::XModel> OReportController::executeReport() // our first message says: we caught an exception sdb::SQLContext aFirstMessage; - String sInfo = String( ModuleRes( RID_STR_CAUGHT_FOREIGN_EXCEPTION ) ); - sInfo.SearchAndReplaceAllAscii( "$type$", aCaughtException.getValueTypeName() ); + OUString sInfo(ModuleRes(RID_STR_CAUGHT_FOREIGN_EXCEPTION).toString()); + sInfo = sInfo.replaceAll("$type$", aCaughtException.getValueTypeName()); aFirstMessage.Message = sInfo; // our second message: the message of the exception we caught diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index ca104245b3f7..3c64b816f229 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -633,14 +633,15 @@ static bool lcl_parseExternalName( return true; } -static String lcl_makeExternalNameStr( const String& rFile, const String& rName, +static OUString lcl_makeExternalNameStr(const OUString& rFile, const OUString& rName, const sal_Unicode cSep, bool bODF ) { - String aFile( rFile), aName( rName), aEscQuote( "''"); - aFile.SearchAndReplaceAllAscii( "'", aEscQuote); + OUString aEscQuote("''"); + OUString aFile(rFile.replaceAll("'", aEscQuote)); + OUString aName(rName); if (bODF) - aName.SearchAndReplaceAllAscii( "'", aEscQuote); - OUStringBuffer aBuf( aFile.Len() + aName.Len() + 9); + aName = aName.replaceAll("'", aEscQuote); + OUStringBuffer aBuf(aFile.getLength() + aName.getLength() + 9); if (bODF) aBuf.append( sal_Unicode( '[')); aBuf.append( sal_Unicode( '\'')); @@ -652,7 +653,7 @@ static String lcl_makeExternalNameStr( const String& rFile, const String& rName, aBuf.append( aName); if (bODF) aBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "']")); - return String( aBuf.makeStringAndClear()); + return aBuf.makeStringAndClear(); } static bool lcl_getLastTabName( OUString& rTabName2, const OUString& rTabName1, @@ -879,7 +880,7 @@ struct ConventionOOO_A1 : public Convention_A1 { if (bDisplayTabName) { - String aFile; + OUString aFile; const OUString* p = pRefMgr->getExternalFileName(nFileId); if (p) { @@ -888,10 +889,9 @@ struct ConventionOOO_A1 : public Convention_A1 else aFile = INetURLObject::decode(*p, INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS); } - aFile.SearchAndReplaceAllAscii("'", OUString("''")); rBuffer.append(sal_Unicode('\'')); - rBuffer.append(aFile); + rBuffer.append(aFile.replaceAll("'", "''")); rBuffer.append(sal_Unicode('\'')); rBuffer.append(sal_Unicode('#')); diff --git a/svx/source/dialog/compressgraphicdialog.cxx b/svx/source/dialog/compressgraphicdialog.cxx index 597bd2929db4..efc480ad4d1c 100644 --- a/svx/source/dialog/compressgraphicdialog.cxx +++ b/svx/source/dialog/compressgraphicdialog.cxx @@ -155,24 +155,24 @@ void CompressGraphicsDialog::Update() Size aPixelSize = m_aGraphic.GetSizePixel(); Size aOriginalSize100mm( pDummyVDev->PixelToLogic( m_aGraphic.GetSizePixel(), MAP_100TH_MM ) ); - String aBitmapSizeString = String(SVX_RES(STR_IMAGE_ORIGINAL_SIZE)); + OUString aBitmapSizeString = SVX_RESSTR(STR_IMAGE_ORIGINAL_SIZE); OUString aWidthString = GetUnitString( aOriginalSize100mm.Width(), eFieldUnit, cSeparator ); OUString aHeightString = GetUnitString( aOriginalSize100mm.Height(), eFieldUnit, cSeparator ); - aBitmapSizeString.SearchAndReplaceAllAscii( "$(WIDTH)", aWidthString ); - aBitmapSizeString.SearchAndReplaceAllAscii( "$(HEIGHT)", aHeightString ); - aBitmapSizeString.SearchAndReplaceAllAscii( "$(WIDTH_IN_PX)", OUString::valueOf(aPixelSize.Width()) ); - aBitmapSizeString.SearchAndReplaceAllAscii( "$(HEIGHT_IN_PX)", OUString::valueOf(aPixelSize.Height()) ); + aBitmapSizeString = aBitmapSizeString.replaceAll("$(WIDTH)", aWidthString); + aBitmapSizeString = aBitmapSizeString.replaceAll("$(HEIGHT)", aHeightString); + aBitmapSizeString = aBitmapSizeString.replaceAll("$(WIDTH_IN_PX)", OUString::valueOf(aPixelSize.Width())); + aBitmapSizeString = aBitmapSizeString.replaceAll("$(HEIGHT_IN_PX)", OUString::valueOf(aPixelSize.Height())); m_pFixedText2->SetText(aBitmapSizeString); int aValX = (int) (aPixelSize.Width() / GetViewWidthInch()); - String aViewSizeString = String(SVX_RES(STR_IMAGE_VIEW_SIZE)); + OUString aViewSizeString = SVX_RESSTR(STR_IMAGE_VIEW_SIZE); aWidthString = GetUnitString( m_aViewSize100mm.Width(), eFieldUnit, cSeparator ); aHeightString = GetUnitString( m_aViewSize100mm.Height(), eFieldUnit, cSeparator ); - aViewSizeString.SearchAndReplaceAllAscii( "$(WIDTH)", aWidthString ); - aViewSizeString.SearchAndReplaceAllAscii( "$(HEIGHT)", aHeightString ); - aViewSizeString.SearchAndReplaceAllAscii( "$(DPI)", OUString::number( aValX) ); + aViewSizeString = aViewSizeString.replaceAll("$(WIDTH)", aWidthString); + aViewSizeString = aViewSizeString.replaceAll("$(HEIGHT)", aHeightString); + aViewSizeString = aViewSizeString.replaceAll("$(DPI)", OUString::number(aValX)); m_pFixedText3->SetText(aViewSizeString); SvMemoryStream aMemStream; @@ -181,8 +181,8 @@ void CompressGraphicsDialog::Update() aMemStream.Seek( STREAM_SEEK_TO_END ); sal_Int32 aNativeSize = aMemStream.Tell(); - String aNativeSizeString = String(SVX_RES(STR_IMAGE_CAPACITY)); - aNativeSizeString.SearchAndReplaceAllAscii( "$(CAPACITY)", OUString::valueOf(aNativeSize / 1024) ); + OUString aNativeSizeString = SVX_RESSTR(STR_IMAGE_CAPACITY); + aNativeSizeString = aNativeSizeString.replaceAll("$(CAPACITY)", OUString::valueOf(aNativeSize / 1024)); m_pFixedText5->SetText(aNativeSizeString); m_pFixedText6->SetText(String("??")); @@ -328,8 +328,8 @@ IMPL_LINK_NOARG( CompressGraphicsDialog, CalculateClickHdl ) { OUString aSizeAsString = OUString::valueOf(aSize / 1024); - String aNewSizeString = String(SVX_RES(STR_IMAGE_CAPACITY)); - aNewSizeString.SearchAndReplaceAllAscii( "$(CAPACITY)", aSizeAsString ); + OUString aNewSizeString = SVX_RESSTR(STR_IMAGE_CAPACITY); + aNewSizeString = aNewSizeString.replaceAll("$(CAPACITY)", aSizeAsString); m_pFixedText6->SetText(aNewSizeString); } return 0L; diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index 2bec2867d297..7e6e52e3317f 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -1574,9 +1574,8 @@ bool FmXFormView::createControlLabelPair( OutputDevice& _rOutDev, sal_Int32 _nXO sLabel = sFieldName; xLabelModel->setPropertyValue( FM_PROP_LABEL, makeAny( sLabel + _rFieldPostfix ) ); - String sObjectLabel( SVX_RES( RID_STR_OBJECT_LABEL ) ); - sObjectLabel.SearchAndReplaceAllAscii( "#object#", sFieldName ); - xLabelModel->setPropertyValue( FM_PROP_NAME, makeAny( OUString( sObjectLabel ) ) ); + OUString sObjectLabel(SVX_RESSTR(RID_STR_OBJECT_LABEL).replaceAll("#object#", sFieldName)); + xLabelModel->setPropertyValue(FM_PROP_NAME, makeAny(sObjectLabel)); } pLabel->SetLogicRect( ::Rectangle( diff --git a/svx/source/tbxctrls/lboxctrl.cxx b/svx/source/tbxctrls/lboxctrl.cxx index 758c9bb684eb..34fd302646e9 100644 --- a/svx/source/tbxctrls/lboxctrl.cxx +++ b/svx/source/tbxctrls/lboxctrl.cxx @@ -213,11 +213,10 @@ void SvxListBoxControl::Impl_SetInfo( sal_uInt16 nCount ) else nId = SID_UNDO == GetSlotId() ? RID_SVXSTR_NUM_UNDO_ACTIONS : RID_SVXSTR_NUM_REDO_ACTIONS; - aActionStr = String(SVX_RES(nId)); + aActionStr = SVX_RESSTR(nId); - String aText( aActionStr ); - aText.SearchAndReplaceAllAscii( "$(ARG1)", OUString::number( nCount ) ); - pPopupWin->SetText( aText ); + OUString aText = aActionStr.replaceAll("$(ARG1)", OUString::number(nCount)); + pPopupWin->SetText(aText); } @@ -310,8 +309,8 @@ SfxPopupWindow* SvxUndoRedoControl::CreatePopupWindow() rListBox.InsertEntry( String( aUndoRedoList[n] )); rListBox.SelectEntryPos( 0 ); - aActionStr = String( SVX_RES( SID_UNDO == GetSlotId() ? - RID_SVXSTR_NUM_UNDO_ACTIONS : RID_SVXSTR_NUM_REDO_ACTIONS ) ); + aActionStr = SVX_RESSTR(SID_UNDO == GetSlotId() ? + RID_SVXSTR_NUM_UNDO_ACTIONS : RID_SVXSTR_NUM_REDO_ACTIONS); Impl_SetInfo( rListBox.GetSelectEntryCount() ); // move focus in floating window without diff --git a/sw/inc/shellres.hxx b/sw/inc/shellres.hxx index 253c85de6222..112233406c5b 100644 --- a/sw/inc/shellres.hxx +++ b/sw/inc/shellres.hxx @@ -64,7 +64,7 @@ struct SW_DLLPUBLIC ShellResource : public Resource String aTOXTablesName; String aTOXAuthoritiesName; - String aHyperlinkClick; + OUString aHyperlinkClick; std::vector<String> aDocInfoLst; diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 3004bbb28e97..ba92b6da0916 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -951,13 +951,14 @@ OutlinerParaObject* SwWW8ImplReader::ImportAsOutliner(String &rString, WW8_CP nS //Strip out fields, leaving the result long nDummy(0); lcl_StripFields(rString, nDummy); + OUString aString(rString); //Strip out word's special characters for the simple string - rString = comphelper::string::remove(rString, 0x1); - rString = comphelper::string::remove(rString, 0x5); - rString = comphelper::string::remove(rString, 0x8); - rString.SearchAndReplaceAllAscii("\007\007", OUString("\007\012")); - rString.SearchAndReplaceAll(0x7, ' '); - + aString = comphelper::string::remove(aString, 0x1); + aString = comphelper::string::remove(aString, 0x5); + aString = comphelper::string::remove(aString, 0x8); + aString = aString.replaceAll(OUString("\007\007"), OUString("\007\012")); + aString = aString.replace(0x7, ' '); + rString = aString; } return pRet; diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 61663e2ed495..26e56834082b 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -1535,7 +1535,7 @@ private: String GetFieldResult( WW8FieldDesc* pF ); void MakeTagString( String& rStr, const String& rOrg ); void UpdateFields(); - void ConvertFFileName( String& rName, const String& rRaw ); + OUString ConvertFFileName(const OUString& rRaw); long Read_F_Tag( WW8FieldDesc* pF ); void InsertTagField( const sal_uInt16 nId, const String& rTagText ); long ImportExtSprm(WW8PLCFManResult* pRes); diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index de7cb1b46919..09e957c4915e 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -418,20 +418,22 @@ long SwWW8ImplReader::Read_Book(WW8PLCFManResult*) // ConvertFFileName uebersetzt FeldParameter-Namen u. ae. in den // System-Zeichensatz. // Gleichzeitig werden doppelte Backslashes in einzelne uebersetzt. -void SwWW8ImplReader::ConvertFFileName( String& rName, const String& rOrg ) +OUString SwWW8ImplReader::ConvertFFileName(const OUString& rOrg) { - rName = rOrg; - rName.SearchAndReplaceAllAscii( "\\\\", OUString( '\\' )); - rName.SearchAndReplaceAllAscii( "%20", OUString( ' ' )); + OUString aName = rOrg; + aName = aName.replaceAll("\\\\", OUString('\\')); + aName = aName.replaceAll("%20", OUString(' ')); // ggfs. anhaengende Anfuehrungszeichen entfernen - if( rName.Len() && '"' == rName.GetChar( rName.Len()-1 )) - rName.Erase( rName.Len()-1, 1); + if (!aName.isEmpty() && '"' == aName[aName.getLength()-1]) + aName = aName.copy(0, aName.getLength()-1); - // Need the more sophisticated url converter. cmc - if (rName.Len()) - rName = URIHelper::SmartRel2Abs( - INetURLObject(sBaseURL), rName, Link(), false); + // Need the more sophisticated url converter. + if (!aName.isEmpty()) + aName = URIHelper::SmartRel2Abs( + INetURLObject(sBaseURL), aName, Link(), false); + + return aName; } // ConvertUFNneme uebersetzt FeldParameter-Namen u. ae. in den @@ -2409,7 +2411,7 @@ eF_ResT SwWW8ImplReader::Read_F_IncludePicture( WW8FieldDesc*, String& rStr ) { case -2: if (!aGrfName.Len()) - ConvertFFileName(aGrfName, aReadParam.GetResult()); + aGrfName = ConvertFFileName(aReadParam.GetResult()); break; case 'd': @@ -2485,7 +2487,7 @@ eF_ResT SwWW8ImplReader::Read_F_IncludeText( WW8FieldDesc* /*pF*/, String& rStr break; } } - ConvertFFileName(aPara, aPara); + aPara = ConvertFFileName(aPara); if (aBook.Len() && aBook.GetChar( 0 ) != '\\') { @@ -3540,7 +3542,7 @@ eF_ResT SwWW8ImplReader::Read_F_Hyperlink( WW8FieldDesc* /*pF*/, String& rStr ) { case -2: if (!sURL.Len() && !bOptions) - ConvertFFileName(sURL, aReadParam.GetResult()); + sURL = ConvertFFileName(aReadParam.GetResult()); break; case 'n': diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 4f981d41f1a6..5f1a8f58b1c4 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -809,8 +809,8 @@ void wwSectionManager::CreateSep(const long nTxtPos, bool /*bMustHaveBreak*/) void* pData; WW8_CP nTest; pWkb->Get(nTest, pData); - String sSectionName = mrReader.aLinkStringMap[SVBT16ToShort( ((WW8_WKB*)pData)->nLinkId) ]; - mrReader.ConvertFFileName(sSectionName, sSectionName); + OUString sSectionName = mrReader.aLinkStringMap[SVBT16ToShort( ((WW8_WKB*)pData)->nLinkId) ]; + sSectionName = mrReader.ConvertFFileName(sSectionName); SwSectionData aSection(FILE_LINK_SECTION, sSectionName); aSection.SetLinkFileName( sSectionName ); aSection.SetProtectFlag(true); diff --git a/sw/source/ui/dbui/mmconfigitem.cxx b/sw/source/ui/dbui/mmconfigitem.cxx index 1cc6e6fbddfa..6fd70e59176b 100644 --- a/sw/source/ui/dbui/mmconfigitem.cxx +++ b/sw/source/ui/dbui/mmconfigitem.cxx @@ -390,8 +390,7 @@ static OUString lcl_CreateNodeName(Sequence<OUString>& rAssignments ) static void lcl_ConvertToNumbers(OUString& rBlock, const ResStringArray& rHeaders ) { //convert the strings used for UI to numbers used for the configuration - String sBlock(rBlock); - sBlock.SearchAndReplaceAllAscii("\n", OUString("\\n")); + OUString sBlock(rBlock.replaceAll("\n", OUString("\\n"))); for(sal_uInt16 i = 0; i < rHeaders.Count(); ++i) { String sHeader = rHeaders.GetString( i ); @@ -399,7 +398,7 @@ static void lcl_ConvertToNumbers(OUString& rBlock, const ResStringArray& rHeader sHeader += '>'; String sReplace("<>"); sReplace.Insert('0' + i, 1); - sBlock.SearchAndReplaceAll(sHeader, sReplace); + sBlock = sBlock.replaceAll(sHeader, sReplace); } rBlock = sBlock; } @@ -408,10 +407,9 @@ static void lcl_ConvertFromNumbers(OUString& rBlock, const ResStringArray& rHead { //convert the numbers used for the configuration to strings used for UI to numbers //doesn't use ReplaceAll to prevent expansion of numbers inside of the headers - String sBlock(rBlock); - sBlock.SearchAndReplaceAllAscii("\\n", OUString('\n')); + OUString sBlock(rBlock.replaceAll("\\n", OUString('\n'))); SwAddressIterator aGreetingIter(sBlock); - sBlock.Erase(); + sBlock = OUString(); while(aGreetingIter.HasMore()) { SwMergeAddressItem aNext = aGreetingIter.Next(); @@ -421,11 +419,11 @@ static void lcl_ConvertFromNumbers(OUString& rBlock, const ResStringArray& rHead sal_Unicode cChar = aNext.sText.GetChar(0); if(cChar >= '0' && cChar <= 'c') { - sBlock += '<'; + sBlock += "<"; sal_uInt16 nHeader = cChar - '0'; if(nHeader < rHeaders.Count()) sBlock += rHeaders.GetString( nHeader ); - sBlock += '>'; + sBlock += ">"; } else { diff --git a/sw/source/ui/docvw/edtwin2.cxx b/sw/source/ui/docvw/edtwin2.cxx index eb97eedcda99..644ee08a7531 100644 --- a/sw/source/ui/docvw/edtwin2.cxx +++ b/sw/source/ui/docvw/edtwin2.cxx @@ -224,14 +224,12 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt) } case SwContentAtPos::SW_SMARTTAG: { - sTxt = SW_RESSTR(STR_SMARTTAG_CLICK); - KeyCode aCode( KEY_SPACE ); KeyCode aModifiedCode( KEY_SPACE, KEY_MOD1 ); - String aModStr( aModifiedCode.GetName() ); - aModStr.SearchAndReplace( aCode.GetName(), String() ); - aModStr.SearchAndReplaceAllAscii( "+", String() ); - sTxt.SearchAndReplaceAllAscii( "%s", aModStr ); + OUString aModStr( aModifiedCode.GetName() ); + aModStr = aModStr.replaceFirst(aCode.GetName(), OUString()); + aModStr = aModStr.replaceAll("+", OUString()); + sTxt = SW_RESSTR(STR_SMARTTAG_CLICK).replaceAll("%s", aModStr); } break; diff --git a/sw/source/ui/utlui/initui.cxx b/sw/source/ui/utlui/initui.cxx index dda31eb4b604..42ad626e3413 100644 --- a/sw/source/ui/utlui/initui.cxx +++ b/sw/source/ui/utlui/initui.cxx @@ -146,7 +146,7 @@ ShellResource::ShellResource() aTOXObjectsName( SW_RES(STR_TOX_OBJ)), aTOXTablesName( SW_RES(STR_TOX_TBL)), aTOXAuthoritiesName( SW_RES(STR_TOX_AUTH)), - aHyperlinkClick( SW_RES( STR_HYPERLINK_CLICK)), + aHyperlinkClick(SW_RESSTR(STR_HYPERLINK_CLICK)), pAutoFmtNameLst(0), sPageDescFirstName( SW_RES(STR_PAGEDESC_FIRSTNAME)), sPageDescFollowName( SW_RES(STR_PAGEDESC_FOLLOWNAME)), @@ -156,10 +156,10 @@ ShellResource::ShellResource() KeyCode aCode( KEY_SPACE ); KeyCode aModifiedCode( KEY_SPACE, KEY_MOD1 ); - String aModStr( aModifiedCode.GetName() ); - aModStr.SearchAndReplace( aCode.GetName(), String() ); - aModStr.SearchAndReplaceAllAscii( "+", String() ); - aHyperlinkClick.SearchAndReplaceAllAscii( "%s", aModStr ); + OUString aModStr( aModifiedCode.GetName() ); + aModStr = aModStr.replaceFirst(aCode.GetName(), OUString()); + aModStr = aModStr.replaceAll("+", OUString()); + aHyperlinkClick = aHyperlinkClick.replaceAll("%s", aModStr); for(sal_uInt16 i = 0; i < nCount; ++i) aDocInfoLst.push_back(String(SW_RESSTR(FLD_DOCINFO_BEGIN + i))); diff --git a/tools/source/string/strascii.cxx b/tools/source/string/strascii.cxx index e057c03fc655..fe435427d8fc 100644 --- a/tools/source/string/strascii.cxx +++ b/tools/source/string/strascii.cxx @@ -526,20 +526,4 @@ xub_StrLen UniString::SearchAndReplaceAscii( const sal_Char* pAsciiStr, const Un return nSPos; } -void UniString::SearchAndReplaceAllAscii( const sal_Char* pAsciiStr, const UniString& rRepStr ) -{ - DBG_CHKTHIS( UniString, DbgCheckUniString ); - DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, STRING_LEN ), - "UniString::SearchAndReplaceAllAscii() - pAsciiStr include characters > 127" ); - - xub_StrLen nCharLen = ImplStringLen( pAsciiStr ); - xub_StrLen nSPos = SearchAscii( pAsciiStr, 0 ); - while ( nSPos != STRING_NOTFOUND ) - { - Replace( nSPos, nCharLen, rRepStr ); - nSPos = nSPos + rRepStr.Len(); - nSPos = SearchAscii( pAsciiStr, nSPos ); - } -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/aqua/source/app/salsys.cxx b/vcl/aqua/source/app/salsys.cxx index 9886ecdf35b9..d1c553a65fbe 100644 --- a/vcl/aqua/source/app/salsys.cxx +++ b/vcl/aqua/source/app/salsys.cxx @@ -89,9 +89,8 @@ OUString AquaSalSystem::GetDisplayScreenName( unsigned int nScreen ) ResMgr* pMgr = ImplGetResMgr(); if( pMgr ) { - String aScreenName( ResId( SV_MAC_SCREENNNAME, *pMgr ) ); - aScreenName.SearchAndReplaceAllAscii( "%d", OUString::number( nScreen ) ); - aRet = aScreenName; + OUString aScreenName(ResId(SV_MAC_SCREENNNAME, *pMgr).toString()); + aRet = aScreenName.replaceAll("%d", OUString::number(nScreen)); } } return aRet; |