From 9daa4f31944e1b9510b092ab9fdd433984c85d10 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 29 Aug 2013 13:20:28 +0200 Subject: convert sfx2/source/appl/* from String to OUString Change-Id: I59901bdc3c953bf883c0b543bd1e0b5d6a96e80a --- sfx2/source/appl/app.cxx | 3 +- sfx2/source/appl/appdde.cxx | 22 +++--- sfx2/source/appl/appopen.cxx | 28 ++++---- sfx2/source/appl/appserv.cxx | 6 +- sfx2/source/appl/appuno.cxx | 90 +++++++++++------------ sfx2/source/appl/childwin.cxx | 32 ++++----- sfx2/source/appl/fileobj.cxx | 20 +++--- sfx2/source/appl/helpdispatch.cxx | 6 +- sfx2/source/appl/helpinterceptor.cxx | 6 +- sfx2/source/appl/imagemgr.cxx | 2 +- sfx2/source/appl/impldde.cxx | 10 +-- sfx2/source/appl/linkmgr2.cxx | 30 ++++---- sfx2/source/appl/linksrc.cxx | 24 +++---- sfx2/source/appl/lnkbase2.cxx | 30 ++++---- sfx2/source/appl/newhelp.cxx | 128 ++++++++++++++++----------------- sfx2/source/appl/opengrf.cxx | 4 +- sfx2/source/appl/openuriexternally.cxx | 4 +- sfx2/source/appl/sfxpicklist.cxx | 10 +-- sfx2/source/appl/shutdownicon.cxx | 2 +- sfx2/source/dialog/filedlghelper.cxx | 2 +- 20 files changed, 224 insertions(+), 235 deletions(-) (limited to 'sfx2/source') diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index 4e5c46dea401..c66884246d9c 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -302,8 +302,7 @@ void SfxApplication::SetLastDir_Impl void SfxApplication::ResetLastDir() { - String aEmpty; - pAppData_Impl->aLastDir = aEmpty; + pAppData_Impl->aLastDir = ""; } //-------------------------------------------------------------------- diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx index c8765de6c6aa..cf9a7394aa58 100644 --- a/sfx2/source/appl/appdde.cxx +++ b/sfx2/source/appl/appdde.cxx @@ -77,7 +77,7 @@ public: //-------------------------------------------------------------------- namespace { - sal_Bool lcl_IsDocument( const String& rContent ) + sal_Bool lcl_IsDocument( const OUString& rContent ) { using namespace com::sun::star; @@ -122,14 +122,14 @@ bool ImplDdeService::MakeTopic( const OUString& rNm ) // First only loop over the ObjectShells to find those // with the specific name: sal_Bool bRet = sal_False; - String sNm( rNm ); - sNm.ToLowerAscii(); + OUString sNm( rNm ); + sNm = sNm.toAsciiLowerCase(); TypeId aType( TYPE(SfxObjectShell) ); SfxObjectShell* pShell = SfxObjectShell::GetFirst( &aType ); while( pShell ) { - String sTmp( pShell->GetTitle(SFX_TITLE_FULLNAME) ); - sTmp.ToLowerAscii(); + OUString sTmp( pShell->GetTitle(SFX_TITLE_FULLNAME) ); + sTmp = sTmp.toAsciiLowerCase(); if( sTmp == sNm ) { SFX_APP()->AddDdeTopic( pShell ); @@ -531,7 +531,7 @@ void SfxApplication::AddDdeTopic( SfxObjectShell* pSh ) return; // prevent double submit - String sShellNm; + OUString sShellNm; sal_Bool bFnd = sal_False; for (size_t n = pAppData_Impl->pDocTopics->size(); n;) { @@ -541,10 +541,10 @@ void SfxApplication::AddDdeTopic( SfxObjectShell* pSh ) if( !bFnd ) { bFnd = sal_True; - (sShellNm = pSh->GetTitle(SFX_TITLE_FULLNAME)).ToLowerAscii(); + sShellNm = pSh->GetTitle(SFX_TITLE_FULLNAME).toAsciiLowerCase(); } - String sNm( (*pAppData_Impl->pDocTopics)[ n ]->GetName() ); - if( sShellNm == sNm.ToLowerAscii() ) + OUString sNm( (*pAppData_Impl->pDocTopics)[ n ]->GetName() ); + if( sShellNm == sNm.toAsciiLowerCase() ) return ; } } @@ -594,7 +594,7 @@ bool SfxDdeTriggerTopic_Impl::Execute( const OUString* ) //-------------------------------------------------------------------- DdeData* SfxDdeDocTopic_Impl::Get( sal_uIntPtr nFormat ) { - String sMimeType( SotExchange::GetFormatMimeType( nFormat )); + OUString sMimeType( SotExchange::GetFormatMimeType( nFormat )); ::com::sun::star::uno::Any aValue; long nRet = pSh->DdeGetData( GetCurItem(), sMimeType, aValue ); if( nRet && aValue.hasValue() && ( aValue >>= aSeq ) ) @@ -615,7 +615,7 @@ bool SfxDdeDocTopic_Impl::Put( const DdeData* pData ) { ::com::sun::star::uno::Any aValue; aValue <<= aSeq; - String sMimeType( SotExchange::GetFormatMimeType( pData->GetFormat() )); + OUString sMimeType( SotExchange::GetFormatMimeType( pData->GetFormat() )); bRet = 0 != pSh->DdeSetData( GetCurItem(), sMimeType, aValue ); } else diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 67a4831687fb..b61c9594f30a 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -398,7 +398,7 @@ sal_uIntPtr SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const OUStri xDoc->GetStorage()->copyToStorage( xTempStorage ); - if ( !xDoc->DoSaveCompleted( new SfxMedium( xTempStorage, String() ) ) ) + if ( !xDoc->DoSaveCompleted( new SfxMedium( xTempStorage, OUString() ) ) ) throw uno::RuntimeException(); } catch( uno::Exception& ) @@ -410,10 +410,10 @@ sal_uIntPtr SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const OUStri return ERRCODE_SFX_GENERAL; } - SetTemplate_Impl( rFileName, String(), xDoc ); + SetTemplate_Impl( rFileName, OUString(), xDoc ); } else - SetTemplate_Impl( rFileName, String(), xDoc ); + SetTemplate_Impl( rFileName, OUString(), xDoc ); xDoc->SetNoName(); xDoc->InvalidateName(); @@ -444,7 +444,7 @@ sal_uIntPtr SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const OUStri void SfxApplication::NewDocDirectExec_Impl( SfxRequest& rReq ) { SFX_REQUEST_ARG( rReq, pFactoryItem, SfxStringItem, SID_NEWDOCDIRECT, sal_False); - String aFactName; + OUString aFactName; if ( pFactoryItem ) aFactName = pFactoryItem->GetValue(); else @@ -452,7 +452,7 @@ void SfxApplication::NewDocDirectExec_Impl( SfxRequest& rReq ) SfxRequest aReq( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, GetPool() ); - String aFact = OUString("private:factory/"); + OUString aFact("private:factory/"); aFact += aFactName; aReq.AppendItem( SfxStringItem( SID_FILE_NAME, aFact ) ); aReq.AppendItem( SfxFrameItem( SID_DOCFRAME, GetFrame() ) ); @@ -614,7 +614,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) SFX_REQUEST_ARG( rReq, pFileNameItem, SfxStringItem, SID_FILE_NAME, sal_False ); if ( pFileNameItem ) { - String aCommand( pFileNameItem->GetValue() ); + OUString aCommand( pFileNameItem->GetValue() ); const SfxSlot* pSlot = GetInterface()->GetSlot( aCommand ); if ( pSlot ) { @@ -622,10 +622,10 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) } else { - sal_Int32 nIndex = aCommand.SearchAscii("slot:"); - if ( !nIndex ) + sal_Int32 nIndex = aCommand.indexOf("slot:"); + if ( nIndex == 0 ) { - sal_uInt16 nSlotId = (sal_uInt16) String( aCommand, 5, aCommand.Len()-5 ).ToInt32(); + sal_uInt16 nSlotId = (sal_uInt16) aCommand.copy(5).toInt32(); if ( nSlotId == SID_OPENDOC ) pFileNameItem = NULL; } @@ -654,7 +654,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) if ( pSystemDialogItem ) nDialog = pSystemDialogItem->GetValue() ? SFX2_IMPL_DIALOG_SYSTEM : SFX2_IMPL_DIALOG_OOO; - String sStandardDir; + OUString sStandardDir; SFX_REQUEST_ARG( rReq, pStandardDirItem, SfxStringItem, SID_STANDARD_DIR, sal_False ); if ( pStandardDirItem ) @@ -797,7 +797,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) } SFX_REQUEST_ARG( rReq, pFileName, SfxStringItem, SID_FILE_NAME, sal_False ); - String aFileName = pFileName->GetValue(); + OUString aFileName = pFileName->GetValue(); OUString aReferer; SFX_REQUEST_ARG( rReq, pRefererItem, SfxStringItem, SID_REFERER, sal_False ); @@ -837,7 +837,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) } // Mark without URL cannot be handled by hyperlink code - if ( bHyperlinkUsed && aFileName.Len() && aFileName.GetChar(0) != '#' ) + if ( bHyperlinkUsed && !aFileName.isEmpty() && aFileName[0] != '#' ) { Reference< ::com::sun::star::document::XTypeDetection > xTypeDetection( ::comphelper::getProcessServiceFactory()->createInstance( @@ -1064,12 +1064,12 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) // make URL ready SFX_REQUEST_ARG( rReq, pURLItem, SfxStringItem, SID_FILE_NAME, sal_False ); aFileName = pURLItem->GetValue(); - if( aFileName.Len() && aFileName.GetChar(0) == '#' ) // Mark without URL + if( !aFileName.isEmpty() && aFileName[0] == '#' ) // Mark without URL { SfxViewFrame *pView = pTargetFrame ? pTargetFrame->GetCurrentViewFrame() : 0; if ( !pView ) pView = SfxViewFrame::Current(); - pView->GetViewShell()->JumpToMark( aFileName.Copy(1) ); + pView->GetViewShell()->JumpToMark( aFileName.copy(1) ); rReq.SetReturnValue( SfxViewFrameItem( 0, pView ) ); return; } diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index e4c77c185f8e..fcaf89bd9e1c 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -1004,7 +1004,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) { case SID_OPTIONS_TREEDIALOG: { - String sPageURL; + OUString sPageURL; SFX_REQUEST_ARG( rReq, pURLItem, SfxStringItem, SID_OPTIONS_PAGEURL, sal_False ); if ( pURLItem ) sPageURL = pURLItem->GetValue(); @@ -1113,7 +1113,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) pView = lcl_getBasicIDEViewFrame( pBasicIDE ); if ( pView ) - pView->SetName( String( RTL_CONSTASCII_USTRINGPARAM( "BASIC:1" ) ) ); + pView->SetName( OUString( "BASIC:1" ) ); } if ( pView ) @@ -1240,7 +1240,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) OSL_TRACE("SfxApplication::OfaExec_Impl: case ScriptOrg"); const SfxItemSet* pArgs = rReq.GetArgs(); const SfxPoolItem* pItem; - String aLanguage; + OUString aLanguage; if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_SCRIPTORGANIZER, sal_False, &pItem) ) { aLanguage = ((SfxScriptOrganizerItem*)pItem)->getLanguage(); diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 089946aeddfb..2f25eec9f03b 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -243,8 +243,7 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence(nSlotId)); OSL_FAIL(aStr.getStr()); #endif @@ -257,8 +256,8 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::SequencenAttribs; const beans::PropertyValue& rProp = pPropsVal[0]; - String aName = rProp.Name; - if ( nCount == 1 && aName.CompareToAscii( pSlot->pUnoName ) == COMPARE_EQUAL ) + OUString aName = rProp.Name; + if ( nCount == 1 && aName == OUString( pSlot->pUnoName, strlen( pSlot->pUnoName ), RTL_TEXTENCODING_UTF8 ) ) { // there is only one parameter and its name matches the name of the property, // so it's either a simple property or a complex property in one single UNO struct @@ -268,7 +267,7 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::SequencepUnoName); OSL_FAIL( aStr.getStr() ); } @@ -278,8 +277,8 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence(nSlotId)); DBG_WARNING(aStr.getStr()); } @@ -382,8 +380,8 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::SequencepUnoName ) ) + OUString sSlotName( "OptionsTreeDialog" ); + OUString sPropName( "OptionsPageURL" ); + if ( sSlotName == OUString( pSlot->pUnoName, strlen(pSlot->pUnoName), RTL_TEXTENCODING_UTF8 ) ) { for ( sal_uInt16 n = 0; n < nCount; ++n ) { const PropertyValue& rProp = pPropsVal[n]; - String sName( rProp.Name ); + OUString sName( rProp.Name ); if ( sName == sPropName ) { OUString sURL; @@ -955,7 +953,7 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::SequencepUnoName); DBG_WARNING( aStr.getStr() ); } @@ -1353,18 +1351,16 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::SequenceaAttrib[n-1].nAID ) <= 127, "Member ID out of range" ); - String aName( OUString::createFromAscii( pSlot->pUnoName ) ) ; - aName += '.'; + OUString aName( OUString::createFromAscii( pSlot->pUnoName ) ) ; + aName += "."; aName += OUString::createFromAscii( pType->aAttrib[n-1].pName ) ; pValue[nActProp].Name = aName; if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) ) { - OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM( - "Sub item ")); + OStringBuffer aStr("Sub item "); aStr.append(static_cast( pType->aAttrib[n-1].nAID)); - aStr.append(RTL_CONSTASCII_STRINGPARAM( - " not convertible in slot: ")); + aStr.append(" not convertible in slot: "); aStr.append(static_cast(nSlotId)); OSL_FAIL( aStr.getStr() ); } @@ -1408,18 +1404,16 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::SequenceaAttrib[n-1].nAID) <= 127, "Member ID out of range" ); - String aName( OUString::createFromAscii( rArg.pName ) ) ; - aName += '.'; + OUString aName( OUString::createFromAscii( rArg.pName ) ) ; + aName += "."; aName += OUString::createFromAscii( rArg.pType->aAttrib[n-1].pName ) ; pValue[nActProp].Name = aName; if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) ) { - OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM( - "Sub item ")); + OStringBuffer aStr("Sub item "); aStr.append(static_cast( rArg.pType->aAttrib[n-1].nAID)); - aStr.append(RTL_CONSTASCII_STRINGPARAM( - " not convertible in slot: ")); + aStr.append(" not convertible in slot: "); aStr.append(static_cast(rArg.nSlotId)); OSL_FAIL(aStr.getStr()); } @@ -1855,22 +1849,22 @@ ErrCode SfxMacroLoader::loadMacro( const OUString& rURL, com::sun::star::uno::An // 'macro:///lib.mod.proc(args)' => macro of App-BASIC // 'macro://[docname|.]/lib.mod.proc(args)' => macro of current or qualified document // 'macro://obj.method(args)' => direct API call, execute it via App-BASIC - String aMacro( rURL ); - sal_uInt16 nHashPos = aMacro.Search( '/', 8 ); - sal_uInt16 nArgsPos = aMacro.Search( '(' ); + OUString aMacro( rURL ); + sal_Int32 nHashPos = aMacro.indexOf( '/', 8 ); + sal_Int32 nArgsPos = aMacro.indexOf( '(' ); BasicManager *pAppMgr = SFX_APP()->GetBasicManager(); BasicManager *pBasMgr = 0; ErrCode nErr = ERRCODE_NONE; // should a macro function be executed ( no direct API call)? - if ( STRING_NOTFOUND != nHashPos && nHashPos < nArgsPos ) + if ( -1 != nHashPos && nHashPos < nArgsPos ) { // find BasicManager SfxObjectShell* pDoc = NULL; - String aBasMgrName( INetURLObject::decode(aMacro.Copy( 8, nHashPos-8 ), INET_HEX_ESCAPE, INetURLObject::DECODE_WITH_CHARSET) ); - if ( !aBasMgrName.Len() ) + OUString aBasMgrName( INetURLObject::decode(aMacro.copy( 8, nHashPos-8 ), INET_HEX_ESCAPE, INetURLObject::DECODE_WITH_CHARSET) ); + if ( aBasMgrName.isEmpty() ) pBasMgr = pAppMgr; - else if ( aBasMgrName.EqualsAscii(".") ) + else if ( aBasMgrName == "." ) { // current/actual document pDoc = pCurrent; @@ -1898,13 +1892,13 @@ ErrCode SfxMacroLoader::loadMacro( const OUString& rURL, com::sun::star::uno::An if ( pDoc ) { // security check for macros from document basic if an SFX doc is given - if ( !pDoc->AdjustMacroMode( String() ) ) + if ( !pDoc->AdjustMacroMode( OUString() ) ) // check forbids execution return ERRCODE_IO_ACCESSDENIED; } else if ( pDoc && pDoc->GetMedium() ) { - pDoc->AdjustMacroMode( String() ); + pDoc->AdjustMacroMode( OUString() ); SFX_ITEMSET_ARG( pDoc->GetMedium()->GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False); SFX_ITEMSET_ARG( pDoc->GetMedium()->GetItemSet(), pMacroExecModeItem, SfxUInt16Item, SID_MACROEXECMODE, sal_False); if ( pUpdateDocItem && pMacroExecModeItem @@ -1914,16 +1908,16 @@ ErrCode SfxMacroLoader::loadMacro( const OUString& rURL, com::sun::star::uno::An } // find BASIC method - String aQualifiedMethod( INetURLObject::decode(aMacro.Copy( nHashPos+1 ), INET_HEX_ESCAPE, INetURLObject::DECODE_WITH_CHARSET) ); - String aArgs; - if ( STRING_NOTFOUND != nArgsPos ) + OUString aQualifiedMethod( INetURLObject::decode(aMacro.copy( nHashPos+1 ), INET_HEX_ESCAPE, INetURLObject::DECODE_WITH_CHARSET) ); + OUString aArgs; + if ( -1 != nArgsPos ) { // remove arguments from macro name - aArgs = aQualifiedMethod.Copy( nArgsPos - nHashPos - 1 ); - aQualifiedMethod.Erase( nArgsPos - nHashPos - 1 ); + aArgs = aQualifiedMethod.copy( nArgsPos - nHashPos - 1 ); + aQualifiedMethod = aQualifiedMethod.copy( 0, nArgsPos - nHashPos - 1 ); } - if ( pBasMgr->HasMacro( OUString(aQualifiedMethod) ) ) + if ( pBasMgr->HasMacro( aQualifiedMethod ) ) { Any aOldThisComponent; const bool bSetDocMacroMode = ( pDoc != NULL ) && bIsDocBasic; @@ -1977,7 +1971,7 @@ ErrCode SfxMacroLoader::loadMacro( const OUString& rURL, com::sun::star::uno::An { // direct API call on a specified object OUStringBuffer aCall; - aCall.append('[').append(INetURLObject::decode(aMacro.Copy(6), INET_HEX_ESCAPE, + aCall.append('[').append(INetURLObject::decode(aMacro.copy(6), INET_HEX_ESCAPE, INetURLObject::DECODE_WITH_CHARSET)); aCall.append(']'); pAppMgr->GetLib(0)->Execute(aCall.makeStringAndClear()); diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index dc36dd847cbf..e43205631e9a 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -361,45 +361,45 @@ void SfxChildWindow::InitializeChildWinFactory_Impl( sal_uInt16 nId, SfxChildWin if ( aSeq.getLength() ) aSeq[0].Value >>= aTmp; - String aWinData( aTmp ); + OUString aWinData( aTmp ); rInfo.aWinState = OUStringToOString(aWinOpt.GetWindowState(), RTL_TEXTENCODING_UTF8); - if ( aWinData.Len() ) + if ( !aWinData.isEmpty() ) { // Search for version ID - if ( aWinData.GetChar((sal_uInt16)0) != 0x0056 ) // 'V' = 56h + if ( aWinData[0] != 0x0056 ) // 'V' = 56h // A version ID, so do not use return; // Delete 'V' - aWinData.Erase(0,1); + aWinData = aWinData.copy(1); // Read version char cToken = ','; - sal_uInt16 nPos = aWinData.Search( cToken ); - sal_uInt16 nActVersion = (sal_uInt16)aWinData.Copy( 0, nPos + 1 ).ToInt32(); + sal_Int32 nPos = aWinData.indexOf( cToken ); + sal_uInt16 nActVersion = (sal_uInt16)aWinData.copy( 0, nPos + 1 ).toInt32(); if ( nActVersion != nVersion ) return; - aWinData.Erase(0,nPos+1); + aWinData = aWinData.copy(nPos+1); // Load Visibility: is coded as a char - rInfo.bVisible = (aWinData.GetChar(0) == 0x0056); // 'V' = 56h - aWinData.Erase(0,1); - nPos = aWinData.Search( cToken ); - if (nPos != STRING_NOTFOUND) + rInfo.bVisible = (aWinData[0] == 0x0056); // 'V' = 56h + aWinData = aWinData.copy(1); + nPos = aWinData.indexOf( cToken ); + if (nPos != -1) { - sal_uInt16 nNextPos = aWinData.Search( cToken, 2 ); - if ( nNextPos != STRING_NOTFOUND ) + sal_Int32 nNextPos = aWinData.indexOf( cToken, 2 ); + if ( nNextPos != -1 ) { // there is extra information - rInfo.nFlags = (sal_uInt16)aWinData.Copy( nPos+1, nNextPos - nPos - 1 ).ToInt32(); - aWinData.Erase( nPos, nNextPos-nPos+1 ); + rInfo.nFlags = (sal_uInt16)aWinData.copy( nPos+1, nNextPos - nPos - 1 ).toInt32(); + aWinData = aWinData.replaceAt( nPos, nNextPos-nPos+1, "" ); rInfo.aExtraString = aWinData; } else - rInfo.nFlags = (sal_uInt16)aWinData.Copy( nPos+1 ).ToInt32(); + rInfo.nFlags = (sal_uInt16)aWinData.copy( nPos+1 ).toInt32(); } } } diff --git a/sfx2/source/appl/fileobj.cxx b/sfx2/source/appl/fileobj.cxx index a974726cd818..97e3504f43b8 100644 --- a/sfx2/source/appl/fileobj.cxx +++ b/sfx2/source/appl/fileobj.cxx @@ -309,7 +309,7 @@ sal_Bool SvFileObject::GetGraphic_Impl( Graphic& rGrf, SvStream* pStream ) ? rGF.GetImportFormatNumber( sFilter ) : GRFILTER_FORMAT_DONTKNOW; - String aEmptyStr; + OUString aEmptyStr; int nRes; // To avoid that a native link is created @@ -378,10 +378,10 @@ sal_Bool SvFileObject::GetGraphic_Impl( Graphic& rGrf, SvStream* pStream ) If the URL doesn't denote a valid (existent and accessible) file, the request is silently dropped. */ -String impl_getFilter( const String& _rURL ) +OUString impl_getFilter( const OUString& _rURL ) { - String sFilter; - if ( _rURL.Len() == 0 ) + OUString sFilter; + if ( _rURL.isEmpty() ) return sFilter; try @@ -458,7 +458,7 @@ void SvFileObject::Edit( Window* pParent, sfx2::SvBaseLink* pLink, const Link& r Application::SetDefDialogParent( pParent ); ::sfx2::FileDialogHelper & rFileDlg = - pLink->GetInsertFileDialog( String() ); + pLink->GetInsertFileDialog( OUString() ); rFileDlg.StartExecuteModal( LINK( this, SvFileObject, DialogClosedHdl ) ); } @@ -470,7 +470,7 @@ void SvFileObject::Edit( Window* pParent, sfx2::SvBaseLink* pLink, const Link& r pOldParent = Application::GetDefDialogParent(); Application::SetDefDialogParent( pParent ); - String sFactory; + OUString sFactory; SfxObjectShell* pShell = pLink->GetLinkManager()->GetPersist(); if ( pShell ) sFactory = pShell->GetFactory().GetFactoryName(); @@ -533,17 +533,17 @@ IMPL_STATIC_LINK( SvFileObject, DelMedium_Impl, SfxMediumRef*, pDelMed ) IMPL_LINK( SvFileObject, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg ) { - String sFile; + OUString sFile; Application::SetDefDialogParent( pOldParent ); if ( FILETYPE_TEXT == nType || FILETYPE_OBJECT == nType ) { if ( _pFileDlg && _pFileDlg->GetError() == ERRCODE_NONE ) { - String sURL( _pFileDlg->GetPath() ); + OUString sURL( _pFileDlg->GetPath() ); sFile = sURL; - sFile += ::sfx2::cTokenSeparator; - sFile += ::sfx2::cTokenSeparator; + sFile += OUString(::sfx2::cTokenSeparator); + sFile += OUString(::sfx2::cTokenSeparator); sFile += impl_getFilter( sURL ); } } diff --git a/sfx2/source/appl/helpdispatch.cxx b/sfx2/source/appl/helpdispatch.cxx index 3073e896d366..5ce49523ee0c 100644 --- a/sfx2/source/appl/helpdispatch.cxx +++ b/sfx2/source/appl/helpdispatch.cxx @@ -59,7 +59,7 @@ void SAL_CALL HelpDispatch_Impl::dispatch( // search for a keyword (dispatch from the basic ide) sal_Bool bHasKeyword = sal_False; - String sKeyword; + OUString sKeyword; const PropertyValue* pBegin = aArgs.getConstArray(); const PropertyValue* pEnd = pBegin + aArgs.getLength(); for ( ; pBegin != pEnd; ++pBegin ) @@ -69,8 +69,8 @@ void SAL_CALL HelpDispatch_Impl::dispatch( OUString sHelpKeyword; if ( ( ( *pBegin ).Value >>= sHelpKeyword ) && !sHelpKeyword.isEmpty() ) { - sKeyword = String( sHelpKeyword ); - bHasKeyword = ( sKeyword.Len() > 0 ); + sKeyword = sHelpKeyword; + bHasKeyword = !sKeyword.isEmpty(); break; } } diff --git a/sfx2/source/appl/helpinterceptor.cxx b/sfx2/source/appl/helpinterceptor.cxx index 327c4f415c70..40044ab99f19 100644 --- a/sfx2/source/appl/helpinterceptor.cxx +++ b/sfx2/source/appl/helpinterceptor.cxx @@ -36,7 +36,7 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::util; using namespace ::com::sun::star::lang; -extern void AppendConfigToken_Impl( String& rURL, sal_Bool bQuestionMark ); // sfxhelp.cxx +extern void AppendConfigToken_Impl( OUString& rURL, sal_Bool bQuestionMark ); // sfxhelp.cxx // class HelpInterceptor_Impl -------------------------------------------- @@ -235,8 +235,8 @@ Sequence< OUString > SAL_CALL HelpInterceptor_Impl::getInterceptedURLs() void SAL_CALL HelpInterceptor_Impl::dispatch( const URL& aURL, const Sequence< ::com::sun::star::beans::PropertyValue >& ) throw( RuntimeException ) { - sal_Bool bBack = ( String( ".uno:Backward" ) == String( aURL.Complete ) ); - if ( bBack || String( ".uno:Forward" ) == String( aURL.Complete ) ) + sal_Bool bBack = ( OUString( ".uno:Backward" ) == OUString( aURL.Complete ) ); + if ( bBack || OUString( ".uno:Forward" ) == OUString( aURL.Complete ) ) { if ( m_pHistory ) { diff --git a/sfx2/source/appl/imagemgr.cxx b/sfx2/source/appl/imagemgr.cxx index a19e7bc34828..b25cbf3d0ba6 100644 --- a/sfx2/source/appl/imagemgr.cxx +++ b/sfx2/source/appl/imagemgr.cxx @@ -78,7 +78,7 @@ Image SAL_CALL GetImage( OUString aCommandURL( aURL ); if ( nProtocol == INET_PROT_SLOT ) { - sal_uInt16 nId = ( sal_uInt16 ) String(aURL).Copy(5).ToInt32(); + sal_uInt16 nId = ( sal_uInt16 ) aURL.copy(5).toInt32(); const SfxSlot* pSlot = 0; if ( xModel.is() ) { diff --git a/sfx2/source/appl/impldde.cxx b/sfx2/source/appl/impldde.cxx index b036cfcb5f0f..15cab80d7333 100644 --- a/sfx2/source/appl/impldde.cxx +++ b/sfx2/source/appl/impldde.cxx @@ -68,7 +68,7 @@ class SvDDELinkEditDialog : public ModalDialog DECL_STATIC_LINK( SvDDELinkEditDialog, EditHdl_Impl, Edit* ); public: SvDDELinkEditDialog( Window* pParent, SvBaseLink* ); - String GetCmd() const; + OUString GetCmd() const; }; SvDDELinkEditDialog::SvDDELinkEditDialog( Window* pParent, SvBaseLink* pLink ) @@ -99,7 +99,7 @@ SvDDELinkEditDialog::SvDDELinkEditDialog( Window* pParent, SvBaseLink* pLink ) aOKButton1.Enable( !sServer.isEmpty() && !sTopic.isEmpty() && !sItem.isEmpty() ); } -String SvDDELinkEditDialog::GetCmd() const +OUString SvDDELinkEditDialog::GetCmd() const { OUString sCmd( aEdDdeApp.GetText() ), sRet; ::sfx2::MakeLnkName( sRet, &sCmd, aEdDdeTopic.GetText(), aEdDdeItem.GetText() ); @@ -138,8 +138,8 @@ sal_Bool SvDDEObject::GetData( ::com::sun::star::uno::Any & rData /*out param*/, if( pConnection->GetError() ) // then we try once more { - String sServer( pConnection->GetServiceName() ); - String sTopic( pConnection->GetTopicName() ); + OUString sServer( pConnection->GetServiceName() ); + OUString sTopic( pConnection->GetTopicName() ); delete pConnection; pConnection = new DdeConnection( sServer, sTopic ); @@ -309,7 +309,7 @@ void SvDDEObject::Edit( Window* pParent, sfx2::SvBaseLink* pBaseLink, const Link SvDDELinkEditDialog aDlg( pParent, pBaseLink ); if ( RET_OK == aDlg.Execute() && rEndEditHdl.IsSet() ) { - String sCommand = aDlg.GetCmd(); + OUString sCommand = aDlg.GetCmd(); rEndEditHdl.Call( &sCommand ); } } diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx index 16b85df5317b..0faf85372adc 100644 --- a/sfx2/source/appl/linkmgr2.cxx +++ b/sfx2/source/appl/linkmgr2.cxx @@ -228,8 +228,8 @@ bool LinkManager::GetDisplayNames( const SvBaseLink * pLink, OUString* pFilter ) const { bool bRet = false; - const String sLNm( pLink->GetLinkSourceName() ); - if( sLNm.Len() ) + const OUString sLNm( pLink->GetLinkSourceName() ); + if( !sLNm.isEmpty() ) { switch( pLink->GetObjType() ) { @@ -238,15 +238,15 @@ bool LinkManager::GetDisplayNames( const SvBaseLink * pLink, case OBJECT_CLIENT_OLE: { sal_Int32 nPos = 0; - String sFile( sLNm.GetToken( 0, ::sfx2::cTokenSeparator, nPos ) ); - String sRange( sLNm.GetToken( 0, ::sfx2::cTokenSeparator, nPos ) ); + OUString sFile( sLNm.getToken( 0, ::sfx2::cTokenSeparator, nPos ) ); + OUString sRange( sLNm.getToken( 0, ::sfx2::cTokenSeparator, nPos ) ); if( pFile ) *pFile = sFile; if( pLinkStr ) *pLinkStr = sRange; if( pFilter ) - *pFilter = sLNm.Copy( nPos ); + *pFilter = sLNm.copy( nPos ); if( pType ) { @@ -262,16 +262,16 @@ bool LinkManager::GetDisplayNames( const SvBaseLink * pLink, case OBJECT_CLIENT_DDE: { sal_Int32 nTmp = 0; - String sCmd( sLNm ); - String sServer( sCmd.GetToken( 0, cTokenSeparator, nTmp ) ); - String sTopic( sCmd.GetToken( 0, cTokenSeparator, nTmp ) ); + OUString sCmd( sLNm ); + OUString sServer( sCmd.getToken( 0, cTokenSeparator, nTmp ) ); + OUString sTopic( sCmd.getToken( 0, cTokenSeparator, nTmp ) ); if( pType ) *pType = sServer; if( pFile ) *pFile = sTopic; if( pLinkStr ) - *pLinkStr = sCmd.Copy( nTmp ); + *pLinkStr = sCmd.copy( nTmp ); bRet = true; } break; @@ -547,7 +547,7 @@ sal_Bool LinkManager::GetGraphicFromAny( const OUString& rMimeType, // ---------------------------------------------------------------------- -String lcl_DDE_RelToAbs( const OUString& rTopic, const OUString& rBaseURL ) +OUString lcl_DDE_RelToAbs( const OUString& rTopic, const OUString& rBaseURL ) { OUString sRet; INetURLObject aURL( rTopic ); @@ -555,7 +555,7 @@ String lcl_DDE_RelToAbs( const OUString& rTopic, const OUString& rBaseURL ) utl::LocalFileHelper::ConvertSystemPathToURL( rTopic, rBaseURL, sRet ); if( sRet.isEmpty() ) sRet = URIHelper::SmartRel2Abs( INetURLObject(rBaseURL), rTopic, URIHelper::GetMaybeFileHdl(), true ); - return String(sRet); + return sRet; } sal_Bool SvxInternalLink::Connect( sfx2::SvBaseLink* pLink ) @@ -582,7 +582,7 @@ sal_Bool SvxInternalLink::Connect( sfx2::SvBaseLink* pLink ) nUpdateMode = pItem->GetValue(); } - String sNmURL(aCC.lowercase(lcl_DDE_RelToAbs(sTopic, sReferer))); + OUString sNmURL(aCC.lowercase(lcl_DDE_RelToAbs(sTopic, sReferer))); if ( !pShell ) { @@ -590,10 +590,10 @@ sal_Bool SvxInternalLink::Connect( sfx2::SvBaseLink* pLink ) pShell = SfxObjectShell::GetFirst( &aType, sal_False ); } - String sTmp; + OUString sTmp; while( pShell ) { - if( !sTmp.Len() ) + if( sTmp.isEmpty() ) { sTmp = pShell->GetTitle( SFX_TITLE_FULLNAME ); sTmp = lcl_DDE_RelToAbs(sTmp, sReferer ); @@ -615,7 +615,7 @@ sal_Bool SvxInternalLink::Connect( sfx2::SvBaseLink* pLink ) else pShell = SfxObjectShell::GetNext( *pShell, &aType, sal_False ); - sTmp.Erase(); + sTmp = ""; } } diff --git a/sfx2/source/appl/linksrc.cxx b/sfx2/source/appl/linksrc.cxx index 9bc5c9c0d3f5..7b29f37e0f73 100644 --- a/sfx2/source/appl/linksrc.cxx +++ b/sfx2/source/appl/linksrc.cxx @@ -70,11 +70,11 @@ static void StartTimer( SvLinkSourceTimer ** ppTimer, SvLinkSource * pOwner, struct SvLinkSource_Entry_Impl { SvBaseLinkRef xSink; - String aDataMimeType; - sal_uInt16 nAdviseModes; - sal_Bool bIsDataSink; + OUString aDataMimeType; + sal_uInt16 nAdviseModes; + sal_Bool bIsDataSink; - SvLinkSource_Entry_Impl( SvBaseLink* pLink, const String& rMimeType, + SvLinkSource_Entry_Impl( SvBaseLink* pLink, const OUString& rMimeType, sal_uInt16 nAdvMode ) : xSink( pLink ), aDataMimeType( rMimeType ), nAdviseModes( nAdvMode ), bIsDataSink( sal_True ) @@ -171,12 +171,12 @@ SvLinkSource_Entry_Impl* SvLinkSource_EntryIter_Impl::Next() struct SvLinkSource_Impl { SvLinkSource_Array_Impl aArr; - String aDataMimeType; - SvLinkSourceTimer * pTimer; + OUString aDataMimeType; + SvLinkSourceTimer * pTimer; sal_uIntPtr nTimeout; - com::sun::star::uno::Reference - m_xInputStreamToLoadFrom; - sal_Bool m_bIsReadOnly; + css::uno::Reference + m_xInputStreamToLoadFrom; + sal_Bool m_bIsReadOnly; SvLinkSource_Impl() : pTimer( 0 ), nTimeout( 3000 ) {} ~SvLinkSource_Impl(); @@ -246,8 +246,8 @@ void SvLinkSource::SendDataChanged() { if( p->bIsDataSink ) { - String sDataMimeType( pImpl->aDataMimeType ); - if( !sDataMimeType.Len() ) + OUString sDataMimeType( pImpl->aDataMimeType ); + if( sDataMimeType.isEmpty() ) sDataMimeType = p->aDataMimeType; Any aVal; @@ -272,7 +272,7 @@ void SvLinkSource::SendDataChanged() delete pImpl->pTimer; pImpl->pTimer = NULL; } - pImpl->aDataMimeType.Erase(); + pImpl->aDataMimeType = ""; } void SvLinkSource::NotifyDataChanged() diff --git a/sfx2/source/appl/lnkbase2.cxx b/sfx2/source/appl/lnkbase2.cxx index 6bf55d5127ed..c3adc2699523 100644 --- a/sfx2/source/appl/lnkbase2.cxx +++ b/sfx2/source/appl/lnkbase2.cxx @@ -40,7 +40,7 @@ namespace sfx2 TYPEINIT0( SvBaseLink ) -static DdeTopic* FindTopic( const String &, sal_uInt16* = 0 ); +static DdeTopic* FindTopic( const OUString &, sal_uInt16* = 0 ); class ImplDdeItem; @@ -102,7 +102,7 @@ class ImplDdeItem : public DdeGetPutItem sal_Bool bIsValidData : 1; sal_Bool bIsInDTOR : 1; public: - ImplDdeItem( SvBaseLink& rLink, const String& rStr ) + ImplDdeItem( SvBaseLink& rLink, const OUString& rStr ) : DdeGetPutItem( rStr ), pLink( &rLink ), bIsValidData( sal_False ), bIsInDTOR( sal_False ) {} @@ -173,8 +173,8 @@ SvBaseLink::SvBaseLink( const OUString& rLinkName, sal_uInt16 nObjectType, SvLin { // then we have it all together // MM_TODO how do I get the name - String aStr = aLinkName; // xLinkName->GetDisplayName(); - aStr = aStr.Copy( nItemStt ); + OUString aStr = aLinkName; // xLinkName->GetDisplayName(); + aStr = aStr.copy( nItemStt ); pImplData->DDEType.pItem = new ImplDdeItem( *this, aStr ); pTopic->InsertItem( pImplData->DDEType.pItem ); @@ -206,12 +206,12 @@ SvBaseLink::~SvBaseLink() IMPL_LINK( SvBaseLink, EndEditHdl, OUString*, _pNewName ) { - String sNewName; + OUString sNewName; if ( _pNewName ) sNewName = *_pNewName; if ( !ExecuteEdit( sNewName ) ) - sNewName.Erase(); - bWasLastEditOK = ( sNewName.Len() > 0 ); + sNewName = ""; + bWasLastEditOK = !sNewName.isEmpty(); if ( pImpl->m_aEndEditLink.IsSet() ) pImpl->m_aEndEditLink.Call( this ); return 0; @@ -308,7 +308,7 @@ sal_Bool SvBaseLink::Update() if( xObj.Is() ) { xObj->setStreamToLoadFrom(m_xInputStreamToLoadFrom,m_bIsReadOnly); - String sMimeType( SotExchange::GetFormatMimeType( + OUString sMimeType( SotExchange::GetFormatMimeType( pImplData->ClientType.nCntntType )); Any aData; @@ -467,7 +467,7 @@ void SvBaseLink::Edit( Window* pParent, const Link& rEndEditHdl ) if ( !bAsync ) { - ExecuteEdit( String() ); + ExecuteEdit( OUString() ); bWasLastEditOK = sal_False; if ( pImpl->m_aEndEditLink.IsSet() ) pImpl->m_aEndEditLink.Call( this ); @@ -546,7 +546,7 @@ DdeData* ImplDdeItem::Get( sal_uIntPtr nFormat ) return &aData; Any aValue; - String sMimeType( SotExchange::GetFormatMimeType( nFormat )); + OUString sMimeType( SotExchange::GetFormatMimeType( nFormat )); if( pLink->GetObj()->GetData( aValue, sMimeType ) ) { if( aValue >>= aSeq ) @@ -596,14 +596,14 @@ void ImplDdeItem::AdviseLoop( bool bOpen ) } -static DdeTopic* FindTopic( const String & rLinkName, sal_uInt16* pItemStt ) +static DdeTopic* FindTopic( const OUString & rLinkName, sal_uInt16* pItemStt ) { - if( 0 == rLinkName.Len() ) + if( rLinkName.isEmpty() ) return 0; - String sNm( rLinkName ); + OUString sNm( rLinkName ); sal_Int32 nTokenPos = 0; - OUString sService( sNm.GetToken( 0, cTokenSeparator, nTokenPos ) ); + OUString sService( sNm.getToken( 0, cTokenSeparator, nTokenPos ) ); DdeServices& rSvc = DdeService::GetServices(); for (DdeServices::iterator aI = rSvc.begin(); aI != rSvc.end(); ++aI) @@ -612,7 +612,7 @@ static DdeTopic* FindTopic( const String & rLinkName, sal_uInt16* pItemStt ) if( pService->GetName() == sService ) { // then we search for the Topic - OUString sTopic( sNm.GetToken( 0, cTokenSeparator, nTokenPos ) ); + OUString sTopic( sNm.getToken( 0, cTokenSeparator, nTokenPos ) ); if( pItemStt ) *pItemStt = nTokenPos; diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 84cd29dd4225..5b09cdbb3353 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -201,10 +201,10 @@ namespace sfx2 "text*" | "text*" | "text" "text menu" | "text* menu*" | "text|menu" */ - String PrepareSearchString( const String& rSearchString, + OUString PrepareSearchString( const OUString& rSearchString, Reference< XBreakIterator > xBreak, bool bForSearch ) { - String sSearchStr; + OUString sSearchStr; sal_Int32 nStartPos = 0; const Locale aLocale = Application::GetSettings().GetUILanguageTag().getLocale(); Boundary aBoundary = xBreak->getWordBoundary( @@ -213,22 +213,22 @@ namespace sfx2 while ( aBoundary.startPos != aBoundary.endPos ) { nStartPos = aBoundary.endPos; - String sSearchToken( rSearchString.Copy( + OUString sSearchToken( rSearchString.copy( (sal_uInt16)aBoundary.startPos, (sal_uInt16)aBoundary.endPos - (sal_uInt16)aBoundary.startPos ) ); - if ( sSearchToken.Len() > 0 && ( sSearchToken.Len() > 1 || sSearchToken.GetChar(0) != '.' ) ) + if ( !sSearchToken.isEmpty() && ( sSearchToken.getLength() > 1 || sSearchToken[0] != '.' ) ) { - if ( bForSearch && sSearchToken.GetChar( sSearchToken.Len() - 1 ) != '*' ) - sSearchToken += '*'; + if ( bForSearch && sSearchToken[ sSearchToken.getLength() - 1 ] != '*' ) + sSearchToken += "*"; - if ( sSearchToken.Len() > 1 || - ( sSearchToken.Len() > 0 && sSearchToken.GetChar( 0 ) != '*' ) ) + if ( sSearchToken.getLength() > 1 || + ( sSearchToken.getLength() > 0 && sSearchToken[ 0 ] != '*' ) ) { - if ( sSearchStr.Len() > 0 ) + if ( !sSearchStr.isEmpty() ) { if ( bForSearch ) - sSearchStr += ' '; + sSearchStr += " "; else - sSearchStr += '|'; + sSearchStr += "|"; } sSearchStr += sSearchToken; } @@ -249,23 +249,20 @@ namespace sfx2 struct IndexEntry_Impl { sal_Bool m_bSubEntry; - String m_aURL; + OUString m_aURL; - IndexEntry_Impl( const String& rURL, sal_Bool bSubEntry ) : + IndexEntry_Impl( const OUString& rURL, sal_Bool bSubEntry ) : m_bSubEntry( bSubEntry ), m_aURL( rURL ) {} }; -#define NEW_ENTRY( url, bool ) \ - (void*)(sal_uIntPtr)( new IndexEntry_Impl( url, bool ) ) - // struct ContentEntry_Impl ---------------------------------------------- struct ContentEntry_Impl { - String aURL; + OUString aURL; sal_Bool bIsFolder; - ContentEntry_Impl( const String& rURL, sal_Bool bFolder ) : + ContentEntry_Impl( const OUString& rURL, sal_Bool bFolder ) : aURL( rURL ), bIsFolder( bFolder ) {} }; @@ -352,7 +349,7 @@ void ContentListBox_Impl::RequestingChildren( SvTreeListEntry* pParent ) { if ( pParent->GetUserData() ) { - String aTmpURL( ( (ContentEntry_Impl*)pParent->GetUserData() )->aURL ); + OUString aTmpURL( ( (ContentEntry_Impl*)pParent->GetUserData() )->aURL ); std::vector aList = SfxContentHelper::GetHelpTreeViewContents( aTmpURL ); @@ -373,7 +370,7 @@ void ContentListBox_Impl::RequestingChildren( SvTreeListEntry* pParent ) else { pEntry = InsertEntry( aTitle, aDocumentImage, aDocumentImage, pParent ); - Any aAny( ::utl::UCBContentHelper::GetProperty( aURL, String("TargetURL" ) ) ); + Any aAny( ::utl::UCBContentHelper::GetProperty( aURL, OUString("TargetURL" ) ) ); OUString aTargetURL; if ( aAny >>= aTargetURL ) pEntry->SetUserData( new ContentEntry_Impl( aTargetURL, sal_False ) ); @@ -407,7 +404,7 @@ long ContentListBox_Impl::Notify( NotifyEvent& rNEvt ) OUString ContentListBox_Impl::GetSelectEntry() const { - String aRet; + OUString aRet; SvTreeListEntry* pEntry = FirstSelected(); if ( pEntry && !( (ContentEntry_Impl*)pEntry->GetUserData() )->bIsFolder ) aRet = ( (ContentEntry_Impl*)pEntry->GetUserData() )->aURL; @@ -487,9 +484,9 @@ void IndexBox_Impl::UserDraw( const UserDrawEvent& rUDEvt ) Point aPos( rUDEvt.GetRect().TopLeft() ); aPos.X() += 8; aPos.Y() += ( rUDEvt.GetRect().GetHeight() - rUDEvt.GetDevice()->GetTextHeight() ) / 2; - String aEntry( GetEntry( rUDEvt.GetItemId() ) ); - sal_uInt16 nPos = aEntry.Search( ';' ); - rUDEvt.GetDevice()->DrawText( aPos, ( nPos != STRING_NOTFOUND ) ? aEntry.Copy( nPos + 1 ) : aEntry ); + OUString aEntry( GetEntry( rUDEvt.GetItemId() ) ); + sal_Int32 nPos = aEntry.indexOf( ';' ); + rUDEvt.GetDevice()->DrawText( aPos, ( nPos !=-1 ) ? aEntry.copy( nPos + 1 ) : aEntry ); } else DrawEntry( rUDEvt, sal_False, sal_True, sal_True ); @@ -518,10 +515,10 @@ void IndexBox_Impl::SelectExecutableEntry() if ( nPos != COMBOBOX_ENTRY_NOTFOUND ) { sal_uInt16 nOldPos = nPos; - String aEntryText; + OUString aEntryText; IndexEntry_Impl* pEntry = (IndexEntry_Impl*)(sal_uIntPtr)GetEntryData( nPos ); sal_uInt16 nCount = GetEntryCount(); - while ( nPos < nCount && ( !pEntry || pEntry->m_aURL.Len() == 0 ) ) + while ( nPos < nCount && ( !pEntry || pEntry->m_aURL.isEmpty() ) ) { pEntry = (IndexEntry_Impl*)(sal_uIntPtr)GetEntryData( ++nPos ); aEntryText = GetEntry( nPos ); @@ -588,11 +585,13 @@ namespace sfx2 { typedef ::boost::unordered_map< OUString, int, hashOUString, equalOUString > KeywordInfo; } +#define NEW_ENTRY( url, bool ) \ + (void*)(sal_uIntPtr)( new IndexEntry_Impl( url, bool ) ) + #define UNIFY_AND_INSERT_TOKEN( aToken ) \ - it = \ - aInfo.insert( sfx2::KeywordInfo::value_type( aToken, 0 ) ).first; \ + it = aInfo.insert( sfx2::KeywordInfo::value_type( aToken, 0 ) ).first; \ if ( ( tmp = it->second++ ) != 0 ) \ - nPos = aIndexCB.InsertEntry( aToken + OUString( append, tmp ) ); \ + nPos = aIndexCB.InsertEntry( aToken + OUString( append, tmp ) ); \ else \ nPos = aIndexCB.InsertEntry( aToken ) @@ -837,7 +836,7 @@ void IndexTabPage_Impl::SetFactory( const OUString& rFactory ) OUString IndexTabPage_Impl::GetSelectEntry() const { - String aRet; + OUString aRet; IndexEntry_Impl* pEntry = (IndexEntry_Impl*)(sal_uIntPtr)aIndexCB.GetEntryData( aIndexCB.GetEntryPos( aIndexCB.GetText() ) ); if ( pEntry ) aRet = pEntry->m_aURL; @@ -878,7 +877,7 @@ sal_Bool IndexTabPage_Impl::HasKeywordIgnoreCase() if ( !sKeyword.isEmpty() ) { sal_uInt16 nEntries = aIndexCB.GetEntryCount(); - String sIndexItem; + OUString sIndexItem; const vcl::I18nHelper& rI18nHelper = GetSettings().GetLocaleI18nHelper(); for ( sal_uInt16 n = 0; n < nEntries; n++) { @@ -974,20 +973,18 @@ SearchTabPage_Impl::SearchTabPage_Impl( Window* pParent, SfxHelpIndexWindow_Impl SvtViewOptions aViewOpt( E_TABPAGE, CONFIGNAME_SEARCHPAGE ); if ( aViewOpt.Exists() ) { - String aUserData; + OUString aUserData; Any aUserItem = aViewOpt.GetUserItem( USERITEM_NAME ); - OUString aTemp; - if ( aUserItem >>= aTemp ) + if ( aUserItem >>= aUserData ) { - aUserData = String( aTemp ); - sal_Bool bChecked = ( 1 == aUserData.GetToken(0).ToInt32() ) ? sal_True : sal_False; + sal_Bool bChecked = ( 1 == aUserData.getToken(0, ';').toInt32() ) ? sal_True : sal_False; aFullWordsCB.Check( bChecked ); - bChecked = ( 1 == aUserData.GetToken(1).ToInt32() ) ? sal_True : sal_False; + bChecked = ( 1 == aUserData.getToken(1, ';').toInt32() ) ? sal_True : sal_False; aScopeCB.Check( bChecked ); for ( sal_uInt16 i = 2; i < comphelper::string::getTokenCount(aUserData, ';'); ++i ) { - String aToken = aUserData.GetToken(i, ';'); + OUString aToken = aUserData.getToken(i, ';'); aSearchED.InsertEntry( INetURLObject::decode( aToken, '%', INetURLObject::DECODE_WITH_CHARSET ) ); } @@ -1003,20 +1000,20 @@ SearchTabPage_Impl::~SearchTabPage_Impl() { SvtViewOptions aViewOpt( E_TABPAGE, CONFIGNAME_SEARCHPAGE ); sal_Int32 nChecked = aFullWordsCB.IsChecked() ? 1 : 0; - String aUserData = OUString::number( nChecked ); - aUserData += ';'; + OUString aUserData = OUString::number( nChecked ); + aUserData += ";"; nChecked = aScopeCB.IsChecked() ? 1 : 0; aUserData += OUString::number( nChecked ); - aUserData += ';'; + aUserData += ";"; sal_uInt16 nCount = std::min( aSearchED.GetEntryCount(), (sal_uInt16)10 ); // save only 10 entries for ( sal_uInt16 i = 0; i < nCount; ++i ) { OUString aText = aSearchED.GetEntry(i); - aUserData += String(INetURLObject::encode( + aUserData += INetURLObject::encode( aText, INetURLObject::PART_UNO_PARAM_VALUE, '%', - INetURLObject::ENCODE_ALL )); - aUserData += ';'; + INetURLObject::ENCODE_ALL ); + aUserData += ";"; } aUserData = comphelper::string::stripEnd(aUserData, ';'); @@ -1030,7 +1027,7 @@ void SearchTabPage_Impl::ClearSearchResults() { sal_uInt16 nCount = aResultsLB.GetEntryCount(); for ( sal_uInt16 i = 0; i < nCount; ++i ) - delete (String*)(sal_uIntPtr)aResultsLB.GetEntryData(i); + delete (OUString*)(sal_uIntPtr)aResultsLB.GetEntryData(i); aResultsLB.Clear(); aResultsLB.Update(); } @@ -1055,8 +1052,8 @@ void SearchTabPage_Impl::RememberSearchText( const OUString& rSearchText ) IMPL_LINK_NOARG(SearchTabPage_Impl, SearchHdl) { - String aSearchText = comphelper::string::strip(aSearchED.GetText(), ' '); - if ( aSearchText.Len() > 0 ) + OUString aSearchText = comphelper::string::strip(aSearchED.GetText(), ' '); + if ( !aSearchText.isEmpty() ) { EnterWait(); ClearSearchResults(); @@ -1077,7 +1074,7 @@ IMPL_LINK_NOARG(SearchTabPage_Impl, SearchHdl) sal_Int32 nIdx = 0; OUString aTitle = rRow.getToken( 0, '\t', nIdx ); nIdx = 0; - String* pURL = new String( rRow.getToken( 2, '\t', nIdx ) ); + OUString* pURL = new OUString( rRow.getToken( 2, '\t', nIdx ) ); sal_uInt16 nPos = aResultsLB.InsertEntry( aTitle ); aResultsLB.SetEntryData( nPos, (void*)(sal_uIntPtr)pURL ); } @@ -1105,8 +1102,8 @@ IMPL_LINK_NOARG(SearchTabPage_Impl, OpenHdl) IMPL_LINK_NOARG(SearchTabPage_Impl, ModifyHdl) { - String aSearchText = comphelper::string::strip(aSearchED.GetText(), ' '); - aSearchBtn.Enable( aSearchText.Len() > 0 ); + OUString aSearchText = comphelper::string::strip(aSearchED.GetText(), ' '); + aSearchBtn.Enable( !aSearchText.isEmpty() ); return 0; } @@ -1179,10 +1176,10 @@ void SearchTabPage_Impl::SetDoubleClickHdl( const Link& rLink ) OUString SearchTabPage_Impl::GetSelectEntry() const { - String aRet; - String* pData = (String*)(sal_uIntPtr)aResultsLB.GetEntryData( aResultsLB.GetSelectEntryPos() ); + OUString aRet; + OUString* pData = (OUString*)(sal_uIntPtr)aResultsLB.GetEntryData( aResultsLB.GetSelectEntryPos() ); if ( pData ) - aRet = String( *pData ); + aRet = *pData; return aRet; } @@ -1251,8 +1248,8 @@ BookmarksBox_Impl::~BookmarksBox_Impl() sal_uInt16 nCount = GetEntryCount(); for ( sal_uInt16 i = 0; i < nCount; ++i ) { - String aTitle = GetEntry(i); - String* pURL = (String*)(sal_uIntPtr)GetEntryData(i); + OUString aTitle = GetEntry(i); + OUString* pURL = (OUString*)(sal_uIntPtr)GetEntryData(i); aHistOpt.AppendItem( eHELPBOOKMARKS, OUString( *pURL ), sEmpty, OUString( aTitle ), sEmpty ); delete pURL; } @@ -1277,12 +1274,12 @@ void BookmarksBox_Impl::DoAction( sal_uInt16 nAction ) aDlg.SetTitle( GetEntry( nPos ) ); if ( aDlg.Execute() == RET_OK ) { - String* pURL = (String*)(sal_uIntPtr)GetEntryData( nPos ); + OUString* pURL = (OUString*)(sal_uIntPtr)GetEntryData( nPos ); RemoveEntry( nPos ); OUString aImageURL = IMAGE_URL; aImageURL += INetURLObject( *pURL ).GetHost(); nPos = InsertEntry( aDlg.GetTitle(), SvFileInformationManager::GetImage( aImageURL, false ) ); - SetEntryData( nPos, (void*)(sal_uIntPtr)( new String( *pURL ) ) ); + SetEntryData( nPos, (void*)(sal_uIntPtr)( new OUString( *pURL ) ) ); SelectEntryPos( nPos ); delete pURL; } @@ -1442,7 +1439,7 @@ void BookmarksTabPage_Impl::SetDoubleClickHdl( const Link& rLink ) OUString BookmarksTabPage_Impl::GetSelectEntry() const { OUString aRet; - String* pData = (String*)(sal_uIntPtr)aBookmarksBox.GetEntryData( aBookmarksBox.GetSelectEntryPos() ); + OUString* pData = (OUString*)(sal_uIntPtr)aBookmarksBox.GetEntryData( aBookmarksBox.GetSelectEntryPos() ); if ( pData ) aRet = *pData; return aRet; @@ -1455,7 +1452,7 @@ void BookmarksTabPage_Impl::AddBookmarks( const OUString& rTitle, const OUString OUString aImageURL = IMAGE_URL; aImageURL += INetURLObject( rURL ).GetHost(); sal_uInt16 nPos = aBookmarksBox.InsertEntry( rTitle, SvFileInformationManager::GetImage( aImageURL, false ) ); - aBookmarksBox.SetEntryData( nPos, (void*)(sal_uIntPtr)( new String( rURL ) ) ); + aBookmarksBox.SetEntryData( nPos, (void*)(sal_uIntPtr)( new OUString( rURL ) ) ); } OUString SfxHelpWindow_Impl::buildHelpURL(const OUString& sFactory , @@ -1574,7 +1571,7 @@ SfxHelpIndexWindow_Impl::~SfxHelpIndexWindow_Impl() DELETEZ( pBPage ); for ( sal_uInt16 i = 0; i < aActiveLB.GetEntryCount(); ++i ) - delete (String*)(sal_uIntPtr)aActiveLB.GetEntryData(i); + delete (OUString*)(sal_uIntPtr)aActiveLB.GetEntryData(i); SvtViewOptions aViewOpt( E_TABDIALOG, CONFIGNAME_INDEXWIN ); aViewOpt.SetPageID( (sal_Int32)aTabCtrl.GetCurPageId() ); @@ -1594,7 +1591,7 @@ void SfxHelpIndexWindow_Impl::Initialize() OUString aTitle = rRow.getToken( 0, '\t', nIdx ); nIdx = 0; OUString aURL = rRow.getToken( 2, '\t', nIdx ); - String* pFactory = new String( INetURLObject( aURL ).GetHost() ); + OUString* pFactory = new OUString( INetURLObject( aURL ).GetHost() ); sal_uInt16 nPos = aActiveLB.InsertEntry( aTitle ); aActiveLB.SetEntryData( nPos, (void*)(sal_uIntPtr)pFactory ); } @@ -1617,9 +1614,8 @@ void SfxHelpIndexWindow_Impl::SetActiveFactory() for ( sal_uInt16 i = 0; i < aActiveLB.GetEntryCount(); ++i ) { - String* pFactory = (String*)(sal_uIntPtr)aActiveLB.GetEntryData(i); - pFactory->ToLowerAscii(); - if ( *pFactory == pIPage->GetFactory() ) + OUString* pFactory = (OUString*)(sal_uIntPtr)aActiveLB.GetEntryData(i); + if ( pFactory->toAsciiLowerCase() == pIPage->GetFactory() ) { if ( aActiveLB.GetSelectEntryPos() != i ) { @@ -1706,7 +1702,7 @@ IMPL_LINK_NOARG(SfxHelpIndexWindow_Impl, InitHdl) IMPL_LINK_NOARG(SfxHelpIndexWindow_Impl, SelectFactoryHdl) { - String* pFactory = (String*)(sal_uIntPtr)aActiveLB.GetEntryData( aActiveLB.GetSelectEntryPos() ); + OUString* pFactory = (OUString*)(sal_uIntPtr)aActiveLB.GetEntryData( aActiveLB.GetSelectEntryPos() ); if ( pFactory ) { String aFactory( *pFactory ); @@ -1903,7 +1899,7 @@ bool SfxHelpIndexWindow_Impl::IsValidFactory( const OUString& _rFactory ) bool bValid = false; for ( sal_uInt16 i = 0; i < aActiveLB.GetEntryCount(); ++i ) { - String* pFactory = (String*)(sal_uIntPtr)aActiveLB.GetEntryData(i); + OUString* pFactory = (OUString*)(sal_uIntPtr)aActiveLB.GetEntryData(i); if ( *pFactory == _rFactory ) { bValid = true; diff --git a/sfx2/source/appl/opengrf.cxx b/sfx2/source/appl/opengrf.cxx index 16982774a35a..d2785b9686db 100644 --- a/sfx2/source/appl/opengrf.cxx +++ b/sfx2/source/appl/opengrf.cxx @@ -121,7 +121,7 @@ short SvxOpenGraphicDialog::Execute() INetURLObject aObj( GetPath() ); // check whether we can load the graphic - String aCurFilter( GetCurrentFilter() ); + OUString aCurFilter( GetCurrentFilter() ); sal_uInt16 nFormatNum = rFilter.GetImportFormatNumber( aCurFilter ); sal_uInt16 nRetFormat = 0; sal_uInt16 nFound = USHRT_MAX; @@ -167,7 +167,7 @@ short SvxOpenGraphicDialog::Execute() // setup appropriate filter (so next time, it will work) if( rFilter.GetImportFormatCount() ) { - String aFormatName(rFilter.GetImportFormatName(nFound)); + OUString aFormatName(rFilter.GetImportFormatName(nFound)); SetCurrentFilter(aFormatName); } diff --git a/sfx2/source/appl/openuriexternally.cxx b/sfx2/source/appl/openuriexternally.cxx index 1e9347a4e55c..c6e4f3a26ae3 100644 --- a/sfx2/source/appl/openuriexternally.cxx +++ b/sfx2/source/appl/openuriexternally.cxx @@ -50,8 +50,8 @@ bool sfx2::openUriExternally( SolarMutexGuard g; ErrorBox eb( SfxGetpApp()->GetTopWindow(), SfxResId(MSG_ERR_NO_ABS_URI_REF)); - String msg(eb.GetMessText()); - msg.SearchAndReplaceAscii("$(ARG1)", uri); + OUString msg(eb.GetMessText()); + msg = msg.replaceFirst("$(ARG1)", uri); eb.SetMessText(msg); eb.Execute(); } catch (css::system::SystemShellExecuteException &) { diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx index 8e146cbd2481..faaf6a60167d 100644 --- a/sfx2/source/appl/sfxpicklist.cxx +++ b/sfx2/source/appl/sfxpicklist.cxx @@ -312,14 +312,14 @@ void SfxPickList::ExecuteEntry( sal_uInt32 nIndex ) aReq.AppendItem( SfxStringItem( SID_FILE_NAME, pPick->aName )); aReq.AppendItem( SfxStringItem( SID_REFERER, SFX_REFERER_USER ) ); aReq.AppendItem( SfxStringItem( SID_TARGETNAME, "_default" ) ); - String aFilter( pPick->aFilter ); + OUString aFilter( pPick->aFilter ); aGuard.clear(); - sal_uInt16 nPos=aFilter.Search('|'); - if( nPos != STRING_NOTFOUND ) + sal_Int32 nPos = aFilter.indexOf('|'); + if( nPos != -1 ) { - OUString aOptions(aFilter.Copy(nPos).GetBuffer()+1); - aFilter.Erase( nPos ); + OUString aOptions(aFilter.copy(nPos+1)); + aFilter = aFilter.copy( 0, nPos ); aReq.AppendItem( SfxStringItem(SID_FILE_FILTEROPTIONS, aOptions)); } diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index 581404b7b489..d0948c164ec1 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -411,7 +411,7 @@ void ShutdownIcon::StartFileDialog() if ( !m_pFileDlg ) m_pFileDlg = new FileDialogHelper( ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION, - SFXWB_MULTISELECTION, String() ); + SFXWB_MULTISELECTION, OUString() ); m_pFileDlg->StartExecuteModal( STATIC_LINK( this, ShutdownIcon, DialogClosedHdl_Impl ) ); } diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 6daab91625b7..a1ea3a2fbdb4 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -1920,7 +1920,7 @@ void FileDialogHelper_Impl::addGraphicFilter() } #if defined(WNT) - if ( aExtensions.getLength() > 240 ) + if ( aExtensions.Len() > 240 ) aExtensions = FILEDIALOG_FILTER_ALL; #endif sal_Bool bIsInOpenMode = isInOpenMode(); -- cgit