Related: fdo#38838 remove UniString::SearchBackward

Change-Id: Ia474ee07b1bd411eae8cd1ddd55c4fa83dbd5f47
This commit is contained in:
Caolán McNamara 2013-09-26 11:27:22 +02:00
parent b3c860acf3
commit b3a8056a49
20 changed files with 93 additions and 116 deletions

View File

@ -467,16 +467,15 @@ void SvxHyperlinkInternetTp::RefreshMarkWindow()
void SvxHyperlinkInternetTp::SetMarkStr ( const String& aStrMark ) void SvxHyperlinkInternetTp::SetMarkStr ( const String& aStrMark )
{ {
String aStrURL ( maCbbTarget.GetText() ); OUString aStrURL ( maCbbTarget.GetText() );
const sal_Unicode sUHash = '#'; const sal_Unicode sUHash = '#';
xub_StrLen nPos = aStrURL.SearchBackward( sUHash ); sal_Int32 nPos = aStrURL.lastIndexOf( sUHash );
if( nPos != STRING_NOTFOUND ) if( nPos != -1 )
aStrURL.Erase ( nPos ); aStrURL = aStrURL.copy(0, nPos);
aStrURL += sUHash; aStrURL += OUString(sUHash) + aStrMark;
aStrURL += aStrMark;
maCbbTarget.SetText ( aStrURL ); maCbbTarget.SetText ( aStrURL );
} }

View File

@ -151,7 +151,7 @@ String SvxHyphenWordDialog::EraseUnusableHyphens_Impl(
// find position nIdx after which all hyphen positions are unusable // find position nIdx after which all hyphen positions are unusable
xub_StrLen nIdx = STRING_NOTFOUND; xub_StrLen nIdx = STRING_NOTFOUND;
xub_StrLen nPos = 0, nPos1 = 0, nPos2 = 0; xub_StrLen nPos = 0, nPos1 = 0;
if (nLen) if (nLen)
{ {
xub_StrLen nStart = 0; xub_StrLen nStart = 0;
@ -185,11 +185,11 @@ String SvxHyphenWordDialog::EraseUnusableHyphens_Impl(
nPos = aTxt.SearchAndReplace( aTmp, aEmpty, nPos + 1 ); nPos = aTxt.SearchAndReplace( aTmp, aEmpty, nPos + 1 );
// 2) remove all hyphenation positions from the start that are not considered by the core // 2) remove all hyphenation positions from the start that are not considered by the core
const String aSearchRange( aTxt.Copy( 0, nPos1 ) ); const OUString aSearchRange( aTxt.Copy( 0, nPos1 ) );
nPos2 = aSearchRange.SearchBackward( '-' ); // the '-' position the core will use by default sal_Int32 nPos2 = aSearchRange.lastIndexOf( '-' ); // the '-' position the core will use by default
if (nPos2 != STRING_NOTFOUND) if (nPos2 != -1 )
{ {
String aLeft( aSearchRange.Copy( 0, nPos2 ) ); String aLeft( aSearchRange.copy( 0, nPos2 ) );
nPos = 0; nPos = 0;
while (nPos != STRING_NOTFOUND) while (nPos != STRING_NOTFOUND)
{ {

View File

@ -2349,10 +2349,10 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl()
{ {
try try
{ {
String sMain(aDest.GetMainURL( INetURLObject::DECODE_TO_IURI )); OUString sMain(aDest.GetMainURL( INetURLObject::DECODE_TO_IURI ));
sal_Unicode cSlash = '/'; sal_Unicode cSlash = '/';
xub_StrLen nSlashPos = sMain.SearchBackward(cSlash); sal_Int32 nSlashPos = sMain.lastIndexOf(cSlash);
sMain.Erase(nSlashPos); sMain = sMain.copy(0, nSlashPos);
::ucbhelper::Content aNewContent( sMain, uno::Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() ); ::ucbhelper::Content aNewContent( sMain, uno::Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
Any aAny; Any aAny;
TransferInfo aInfo; TransferInfo aInfo;

View File

@ -837,13 +837,13 @@ sal_Bool SvtFileDialog::createNewUserFilter( const String& _rNewFilter, sal_Bool
// if the former is not allowed (_bAllowUserDefExt = <FALSE/>), we have to use the ext of the current filter // if the former is not allowed (_bAllowUserDefExt = <FALSE/>), we have to use the ext of the current filter
// (if possible) // (if possible)
sal_Bool bUseCurFilterExt = sal_True; sal_Bool bUseCurFilterExt = sal_True;
String sUserFilter = _pImp->_pUserFilter->GetType(); OUString sUserFilter = _pImp->_pUserFilter->GetType();
xub_StrLen nSepPos = sUserFilter.SearchBackward( '.' ); sal_Int32 nSepPos = sUserFilter.lastIndexOf( '.' );
if ( STRING_NOTFOUND != nSepPos ) if ( nSepPos != -1 )
{ {
String sUserExt = sUserFilter.Copy( nSepPos + 1 ); OUString sUserExt = sUserFilter.copy( nSepPos + 1 );
if ( ( STRING_NOTFOUND == sUserExt.Search( '*' ) ) if ( ( -1 == sUserExt.indexOf( '*' ) )
&& ( STRING_NOTFOUND == sUserExt.Search( '?' ) ) && ( -1 == sUserExt.indexOf( '?' ) )
) )
bUseCurFilterExt = sal_False; bUseCurFilterExt = sal_False;
} }

View File

@ -240,7 +240,6 @@ public:
xub_StrLen Search( sal_Unicode c, xub_StrLen nIndex = 0 ) const; xub_StrLen Search( sal_Unicode c, xub_StrLen nIndex = 0 ) const;
xub_StrLen Search( const UniString& rStr, xub_StrLen nIndex = 0 ) const; xub_StrLen Search( const UniString& rStr, xub_StrLen nIndex = 0 ) const;
xub_StrLen SearchAscii( const sal_Char* pAsciiStr, xub_StrLen nIndex = 0 ) const; xub_StrLen SearchAscii( const sal_Char* pAsciiStr, xub_StrLen nIndex = 0 ) const;
xub_StrLen SearchBackward( sal_Unicode c, xub_StrLen nIndex = STRING_LEN ) const;
xub_StrLen SearchAndReplace( sal_Unicode c, sal_Unicode cRep, xub_StrLen SearchAndReplace( sal_Unicode c, sal_Unicode cRep,
xub_StrLen nIndex = 0 ); xub_StrLen nIndex = 0 );

View File

@ -265,8 +265,8 @@ IMPL_LINK( APChooseDriverPage, ClickBtnHdl, PushButton*, pButton )
std::list< OUString >::iterator dir; std::list< OUString >::iterator dir;
for( dir = aDirs.begin(); dir != aDirs.end(); ++dir ) for( dir = aDirs.begin(); dir != aDirs.end(); ++dir )
{ {
::std::list< String > aFiles; ::std::list< OUString > aFiles;
::std::list< String >::iterator file; ::std::list< OUString >::iterator file;
OUStringBuffer aDir( *dir ); OUStringBuffer aDir( *dir );
aDir.append( sal_Unicode( '/' ) ); aDir.append( sal_Unicode( '/' ) );
aDir.appendAscii( PRINTER_PPDDIR ); aDir.appendAscii( PRINTER_PPDDIR );
@ -279,8 +279,9 @@ IMPL_LINK( APChooseDriverPage, ClickBtnHdl, PushButton*, pButton )
aFile += "/"; aFile += "/";
aFile += *file; aFile += *file;
int nPos = file->SearchBackward( '.' ); sal_Int32 nPos = file->lastIndexOf( '.' );
if( file->Copy( 0, nPos ) == String( aPPD ) ) OUString sCopy = nPos == -1 ? *file : file->copy(0, nPos);
if( sCopy == aPPD )
{ {
OString aSysPath(OUStringToOString(aFile, aEncoding)); OString aSysPath(OUStringToOString(aFile, aEncoding));
if (unlink(aSysPath.getStr())) if (unlink(aSysPath.getStr()))

View File

@ -79,7 +79,7 @@ ResId padmin::PaResId( sal_uInt32 nId )
* FindFiles * FindFiles
*/ */
void padmin::FindFiles( const OUString& rDirectory, ::std::list< String >& rResult, const OUString& rSuffixes, bool bRecursive ) void padmin::FindFiles( const OUString& rDirectory, ::std::list< OUString >& rResult, const OUString& rSuffixes, bool bRecursive )
{ {
rResult.clear(); rResult.clear();
@ -121,9 +121,9 @@ void padmin::FindFiles( const OUString& rDirectory, ::std::list< String >& rResu
OUStringBuffer aSubDir( rDirectory ); OUStringBuffer aSubDir( rDirectory );
aSubDir.appendAscii( "/", 1 ); aSubDir.appendAscii( "/", 1 );
aSubDir.append( aStatus.getFileName() ); aSubDir.append( aStatus.getFileName() );
std::list< String > subfiles; std::list< OUString > subfiles;
FindFiles( aSubDir.makeStringAndClear(), subfiles, rSuffixes, bRecursive ); FindFiles( aSubDir.makeStringAndClear(), subfiles, rSuffixes, bRecursive );
for( std::list< String >::const_iterator it = subfiles.begin(); it != subfiles.end(); ++it ) for( std::list< OUString >::const_iterator it = subfiles.begin(); it != subfiles.end(); ++it )
{ {
OUStringBuffer aSubFile( aStatus.getFileName() ); OUStringBuffer aSubFile( aStatus.getFileName() );
aSubFile.appendAscii( "/", 1 ); aSubFile.appendAscii( "/", 1 );

View File

@ -103,7 +103,7 @@ sal_Bool AreYouSure( Window*, int nRid = -1 );
ResId PaResId( sal_uInt32 nId ); ResId PaResId( sal_uInt32 nId );
void FindFiles( const OUString& rDirectory, ::std::list< String >& rResult, const OUString& rSuffixes, bool bRecursive = false ); void FindFiles( const OUString& rDirectory, ::std::list< OUString >& rResult, const OUString& rSuffixes, bool bRecursive = false );
Config& getPadminRC(); Config& getPadminRC();
void freePadminRC(); void freePadminRC();

View File

@ -122,7 +122,7 @@ void PPDImportDialog::Import()
ProgressDialog aProgress( Application::GetFocusWindow() ); ProgressDialog aProgress( Application::GetFocusWindow() );
aProgress.startOperation( m_aLoadingPPD ); aProgress.startOperation( m_aLoadingPPD );
::std::list< String > aFiles; ::std::list< OUString > aFiles;
FindFiles( aImportPath, aFiles, OUString( "PS;PPD;PS.GZ;PPD.GZ" ), true ); FindFiles( aImportPath, aFiles, OUString( "PS;PPD;PS.GZ;PPD.GZ" ), true );
int i = 0; int i = 0;

View File

@ -1056,8 +1056,8 @@ lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDoc, ScAddress& rAdd
{ {
// Specified table name is not found in this document. Assume this is an external document. // Specified table name is not found in this document. Assume this is an external document.
aDocName = aTab; aDocName = aTab;
xub_StrLen n = aTab.SearchBackward('.'); sal_Int32 n = aDocName.lastIndexOf('.');
if (n != STRING_NOTFOUND && n > 0) if (n != -1 && n > 0)
{ {
// Extension found. Strip it. // Extension found. Strip it.
aTab.Erase(n); aTab.Erase(n);

View File

@ -130,7 +130,7 @@ XclRootData::XclRootData( XclBiff eBiff, SfxMedium& rMedium,
if( const SfxItemSet* pItemSet = mrMedium.GetItemSet() ) if( const SfxItemSet* pItemSet = mrMedium.GetItemSet() )
if( const SfxStringItem* pItem = static_cast< const SfxStringItem* >( pItemSet->GetItem( SID_FILE_NAME ) ) ) if( const SfxStringItem* pItem = static_cast< const SfxStringItem* >( pItemSet->GetItem( SID_FILE_NAME ) ) )
maDocUrl = pItem->GetValue(); maDocUrl = pItem->GetValue();
maBasePath = maDocUrl.Copy( 0, maDocUrl.SearchBackward( '/' ) + 1 ); maBasePath = maDocUrl.copy( 0, maDocUrl.lastIndexOf( '/' ) + 1 );
// extended document options - always own object, try to copy existing data from document // extended document options - always own object, try to copy existing data from document
if( const ScExtDocOptions* pOldDocOpt = mrDoc.GetExtDocOptions() ) if( const ScExtDocOptions* pOldDocOpt = mrDoc.GetExtDocOptions() )

View File

@ -82,7 +82,7 @@ struct XclRootData
SfxMedium& mrMedium; /// The medium to import from. SfxMedium& mrMedium; /// The medium to import from.
SotStorageRef mxRootStrg; /// The root OLE storage of imported/exported file. SotStorageRef mxRootStrg; /// The root OLE storage of imported/exported file.
ScDocument& mrDoc; /// The source or destination document. ScDocument& mrDoc; /// The source or destination document.
String maDocUrl; /// Document URL of imported/exported file. OUString maDocUrl; /// Document URL of imported/exported file.
String maBasePath; /// Base path of imported/exported file (path of maDocUrl). String maBasePath; /// Base path of imported/exported file (path of maDocUrl).
String maUserName; /// Current user name. String maUserName; /// Current user name.
const String maDefPassword; /// The default password used for stream encryption. const String maDefPassword; /// The default password used for stream encryption.
@ -178,7 +178,7 @@ public:
/** Returns the medium to import from. */ /** Returns the medium to import from. */
inline SfxMedium& GetMedium() const { return mrData.mrMedium; } inline SfxMedium& GetMedium() const { return mrData.mrMedium; }
/** Returns the document URL of the imported/exported file. */ /** Returns the document URL of the imported/exported file. */
inline const String& GetDocUrl() const { return mrData.maDocUrl; } inline const OUString& GetDocUrl() const { return mrData.maDocUrl; }
/** Returns the base path of the imported/exported file. */ /** Returns the base path of the imported/exported file. */
inline const String& GetBasePath() const { return mrData.maBasePath; } inline const String& GetBasePath() const { return mrData.maBasePath; }
/** Returns the current user name. */ /** Returns the current user name. */

View File

@ -1116,13 +1116,13 @@ ANCHOR_SETEVENT:
// wir hier ganz rigoros raus. // wir hier ganz rigoros raus.
if( aName.Len() ) if( aName.Len() )
{ {
String sDecoded( INetURLObject::decode( aName, INET_HEX_ESCAPE, OUString sDecoded( INetURLObject::decode( aName, INET_HEX_ESCAPE,
INetURLObject::DECODE_UNAMBIGUOUS, INetURLObject::DECODE_UNAMBIGUOUS,
RTL_TEXTENCODING_UTF8 )); RTL_TEXTENCODING_UTF8 ));
xub_StrLen nPos = sDecoded.SearchBackward( cMarkSeparator ); sal_Int32 nPos = sDecoded.lastIndexOf( cMarkSeparator );
if( STRING_NOTFOUND != nPos ) if( nPos != -1 )
{ {
OUString sCmp(comphelper::string::remove(sDecoded.Copy(nPos+1), ' ')); OUString sCmp(comphelper::string::remove(sDecoded.copy(nPos+1), ' '));
if( !sCmp.isEmpty() ) if( !sCmp.isEmpty() )
{ {
sCmp = sCmp.toAsciiLowerCase(); sCmp = sCmp.toAsciiLowerCase();

View File

@ -64,8 +64,8 @@ using namespace ::com::sun::star;
void SwHTMLParser::NewDivision( int nToken ) void SwHTMLParser::NewDivision( int nToken )
{ {
OUString aId; OUString aId, aHRef;
String aHRef, aStyle, aLang, aDir; String aStyle, aLang, aDir;
OUString aClass; OUString aClass;
SvxAdjust eAdjust = HTML_CENTER_ON==nToken ? SVX_ADJUST_CENTER SvxAdjust eAdjust = HTML_CENTER_ON==nToken ? SVX_ADJUST_CENTER
: SVX_ADJUST_END; : SVX_ADJUST_END;
@ -114,7 +114,7 @@ void SwHTMLParser::NewDivision( int nToken )
sal_Bool bAppended = sal_False; sal_Bool bAppended = sal_False;
if( pPam->GetPoint()->nContent.GetIndex() ) if( pPam->GetPoint()->nContent.GetIndex() )
{ {
AppendTxtNode( bHeader||bFooter||!aId.isEmpty()||aHRef.Len() ? AM_NORMAL AppendTxtNode( bHeader||bFooter||!aId.isEmpty()|| !aHRef.isEmpty() ? AM_NORMAL
: AM_NOSPACE ); : AM_NOSPACE );
bAppended = sal_True; bAppended = sal_True;
} }
@ -242,7 +242,7 @@ void SwHTMLParser::NewDivision( int nToken )
} }
// Bereiche fuegen wir in Rahmen nur dann ein, wenn der Bereich gelinkt ist. // Bereiche fuegen wir in Rahmen nur dann ein, wenn der Bereich gelinkt ist.
if( (!aId.isEmpty() && !bPositioned) || aHRef.Len() ) if( (!aId.isEmpty() && !bPositioned) || !aHRef.isEmpty() )
{ {
// Bereich einfuegen (muss vor dem Setzten von Attributen erfolgen, // Bereich einfuegen (muss vor dem Setzten von Attributen erfolgen,
// weil die Section vor der PaM-Position eingefuegt. // weil die Section vor der PaM-Position eingefuegt.
@ -266,49 +266,49 @@ void SwHTMLParser::NewDivision( int nToken )
// Namen der Section eindeutig machen // Namen der Section eindeutig machen
const OUString aName( pDoc->GetUniqueSectionName( !aId.isEmpty() ? &aId : 0 ) ); const OUString aName( pDoc->GetUniqueSectionName( !aId.isEmpty() ? &aId : 0 ) );
if( aHRef.Len() ) if( !aHRef.isEmpty() )
{ {
sal_Unicode cDelim = 255U; sal_Unicode cDelim = 255U;
String aURL; sal_Int32 nPos = aHRef.lastIndexOf( cDelim );
xub_StrLen nPos = aHRef.SearchBackward( cDelim ); sal_Int32 nPos2 = -1;
xub_StrLen nPos2 = STRING_NOTFOUND; if( nPos != -1 )
if( STRING_NOTFOUND != nPos )
{ {
nPos2 = aHRef.SearchBackward( cDelim, nPos ); nPos2 = aHRef.lastIndexOf( cDelim, nPos );
if( STRING_NOTFOUND != nPos2 ) if( nPos2 != -1 )
{ {
xub_StrLen nTmp = nPos; sal_Int32 nTmp = nPos;
nPos = nPos2; nPos = nPos2;
nPos2 = nTmp; nPos2 = nTmp;
} }
} }
if( STRING_NOTFOUND == nPos ) OUString aURL;
if( nPos == -1 )
{ {
aURL = URIHelper::SmartRel2Abs(INetURLObject( sBaseURL ), aHRef, Link(), false); aURL = URIHelper::SmartRel2Abs(INetURLObject( sBaseURL ), aHRef, Link(), false);
} }
else else
{ {
aURL = URIHelper::SmartRel2Abs(INetURLObject( sBaseURL ), aHRef.Copy( 0, nPos ), Link(), false ); aURL = URIHelper::SmartRel2Abs(INetURLObject( sBaseURL ), aHRef.copy( 0, nPos ), Link(), false );
aURL += sfx2::cTokenSeparator; aURL += OUString(sfx2::cTokenSeparator);
if( STRING_NOTFOUND == nPos2 ) if( nPos2 == -1 )
{ {
aURL += aHRef.Copy( nPos+1 ); aURL += aHRef.copy( nPos+1 );
} }
else else
{ {
aURL += aHRef.Copy( nPos+1, nPos2 - (nPos+1) ); aURL += aHRef.copy( nPos+1, nPos2 - (nPos+1) );
aURL += sfx2::cTokenSeparator; aURL += OUString(sfx2::cTokenSeparator);
aURL += String(rtl::Uri::decode( aHRef.Copy( nPos2+1 ), aURL += rtl::Uri::decode( aHRef.copy( nPos2+1 ),
rtl_UriDecodeWithCharset, rtl_UriDecodeWithCharset,
RTL_TEXTENCODING_ISO_8859_1 )); RTL_TEXTENCODING_ISO_8859_1 );
} }
} }
aHRef = aURL; aHRef = aURL;
} }
SwSectionData aSection( (aHRef.Len()) ? FILE_LINK_SECTION SwSectionData aSection( (!aHRef.isEmpty()) ? FILE_LINK_SECTION
: CONTENT_SECTION, aName ); : CONTENT_SECTION, aName );
if( aHRef.Len() ) if( !aHRef.isEmpty() )
{ {
aSection.SetLinkFileName( aHRef ); aSection.SetLinkFileName( aHRef );
aSection.SetProtectFlag(true); aSection.SetProtectFlag(true);

View File

@ -1085,11 +1085,11 @@ void SwHTMLWriter::OutImplicitMark( const String& rMark,
void SwHTMLWriter::OutHyperlinkHRefValue( const String& rURL ) void SwHTMLWriter::OutHyperlinkHRefValue( const String& rURL )
{ {
String sURL( rURL ); OUString sURL( rURL );
xub_StrLen nPos = sURL.SearchBackward( cMarkSeparator ); sal_Int32 nPos = sURL.lastIndexOf( cMarkSeparator );
if( STRING_NOTFOUND != nPos ) if( nPos != -1 )
{ {
OUString sCmp(comphelper::string::remove(sURL.Copy(nPos+1), ' ')); OUString sCmp(comphelper::string::remove(sURL.copy(nPos+1), ' '));
if( !sCmp.isEmpty() ) if( !sCmp.isEmpty() )
{ {
sCmp = sCmp.toAsciiLowerCase(); sCmp = sCmp.toAsciiLowerCase();
@ -1101,7 +1101,7 @@ void SwHTMLWriter::OutHyperlinkHRefValue( const String& rURL )
sCmp == "outline" || sCmp == "outline" ||
sCmp == "text" ) sCmp == "text" )
{ {
sURL.SearchAndReplaceAll( '?', '_' ); // '?' causes problems in IE/Netscape 5 sURL = sURL.replace( '?', '_' ); // '?' causes problems in IE/Netscape 5
} }
} }
} }

View File

@ -2854,13 +2854,13 @@ void MSWordExportBase::AddLinkTarget(const String& rURL)
if( !rURL.Len() || rURL.GetChar(0) != INET_MARK_TOKEN ) if( !rURL.Len() || rURL.GetChar(0) != INET_MARK_TOKEN )
return; return;
String aURL( BookmarkToWriter( rURL.Copy( 1 ) ) ); OUString aURL( BookmarkToWriter( rURL.Copy( 1 ) ) );
xub_StrLen nPos = aURL.SearchBackward( cMarkSeparator ); sal_Int32 nPos = aURL.lastIndexOf( cMarkSeparator );
if( nPos < 2 ) if( nPos < 2 )
return; return;
OUString sCmp(comphelper::string::remove(aURL.Copy(nPos+1), ' ')); OUString sCmp(comphelper::string::remove(aURL.copy(nPos+1), ' '));
if( sCmp.isEmpty() ) if( sCmp.isEmpty() )
return; return;
@ -2869,7 +2869,7 @@ void MSWordExportBase::AddLinkTarget(const String& rURL)
if( sCmp == "outline" ) if( sCmp == "outline" )
{ {
SwPosition aPos( *pCurPam->GetPoint() ); SwPosition aPos( *pCurPam->GetPoint() );
String aOutline( BookmarkToWriter(aURL.Copy( 0, nPos )) ); String aOutline( BookmarkToWriter(aURL.copy( 0, nPos )) );
// If we can find the outline this bookmark refers to // If we can find the outline this bookmark refers to
// save the name of the bookmark and the // save the name of the bookmark and the
// node index number of where it points to // node index number of where it points to

View File

@ -2483,27 +2483,26 @@ void SwWW8ImplReader::Read_SubF_Ruby( WW8ReadFieldParams& rReadParam)
{ {
if (-2 == rReadParam.SkipToNextToken()) if (-2 == rReadParam.SkipToNextToken())
{ {
String sPart = rReadParam.GetResult(); OUString sPart = rReadParam.GetResult();
xub_StrLen nBegin = sPart.Search('('); sal_Int32 nBegin = sPart.indexOf('(');
//Word disallows brackets in this field, //Word disallows brackets in this field,
xub_StrLen nEnd = sPart.Search(')'); sal_Int32 nEnd = sPart.indexOf(')');
if ((nBegin != STRING_NOTFOUND) && if ((nBegin != -1) &&
(nEnd != STRING_NOTFOUND)) (nEnd != -1))
{ {
sRuby = sPart.Copy(nBegin+1,nEnd-nBegin-1); sRuby = sPart.copy(nBegin+1,nEnd-nBegin-1);
} }
if (STRING_NOTFOUND == if (-1 ==
(nBegin = sPart.Search(',',nEnd))) (nBegin = sPart.indexOf(',',nEnd)))
{ {
nBegin = sPart.Search(';',nEnd); nBegin = sPart.indexOf(';',nEnd);
} }
nEnd = sPart.SearchBackward(')'); nEnd = sPart.lastIndexOf(')');
if ((nBegin != STRING_NOTFOUND) && if ((nBegin != -1) && (nEnd != -1))
(nEnd != STRING_NOTFOUND))
{ {
sText = sPart.Copy(nBegin+1,nEnd-nBegin-1); sText = sPart.copy(nBegin+1,nEnd-nBegin-1);
} }
} }
} }

View File

@ -1484,12 +1484,12 @@ void AddressMultiLineEdit::MoveCurrentItem(sal_uInt16 nMove)
{ {
//go left to find a predecessor or simple text //go left to find a predecessor or simple text
--nIndex; --nIndex;
String sPara = pTextEngine->GetText( nPara ); OUString sPara = pTextEngine->GetText( nPara );
xub_StrLen nSearchIndex = sPara.SearchBackward( '>', nIndex+1 ); sal_Int32 nSearchIndex = sPara.lastIndexOf( '>', nIndex+1 );
if( nSearchIndex != STRING_NOTFOUND && nSearchIndex == nIndex ) if( nSearchIndex != -1 && nSearchIndex == nIndex )
{ {
nSearchIndex = sPara.SearchBackward( '<', nIndex ); nSearchIndex = sPara.lastIndexOf( '<', nIndex );
if( nSearchIndex != STRING_NOTFOUND ) if( nSearchIndex != -1 )
nIndex = nSearchIndex; nIndex = nSearchIndex;
} }
} }

View File

@ -235,27 +235,6 @@ xub_StrLen STRING::Match( const STRING& rStr ) const
return STRING_MATCH; return STRING_MATCH;
} }
xub_StrLen STRING::SearchBackward( STRCODE c, xub_StrLen nIndex ) const
{
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
if ( nIndex > mpData->mnLen )
nIndex = (xub_StrLen)mpData->mnLen;
const STRCODE* pStr = mpData->maStr;
pStr += nIndex;
while ( nIndex )
{
nIndex--;
pStr--;
if ( *pStr == c )
return nIndex;
}
return STRING_NOTFOUND;
}
void STRING::SearchAndReplaceAll( const STRING& rStr, const STRING& rRepStr ) void STRING::SearchAndReplaceAll( const STRING& rStr, const STRING& rRepStr )
{ {
DBG_CHKTHIS( STRING, DBGCHECKSTRING ); DBG_CHKTHIS( STRING, DBGCHECKSTRING );

View File

@ -676,19 +676,19 @@ void AquaSalMenu::SetItemText( unsigned /*i_nPos*/, SalMenuItem* i_pSalMenuItem,
AquaSalMenuItem *pAquaSalMenuItem = (AquaSalMenuItem *) i_pSalMenuItem; AquaSalMenuItem *pAquaSalMenuItem = (AquaSalMenuItem *) i_pSalMenuItem;
// Delete mnemonics // Delete mnemonics
String aText( comphelper::string::remove(i_rText, '~') ); OUString aText( comphelper::string::remove(i_rText, '~') );
/* #i90015# until there is a correct solution /* #i90015# until there is a correct solution
strip out any appended (.*) in menubar entries strip out any appended (.*) in menubar entries
*/ */
if( mbMenuBar ) if( mbMenuBar )
{ {
xub_StrLen nPos = aText.SearchBackward( sal_Unicode( '(' ) ); sal_Int32 nPos = aText.lastIndexOf( sal_Unicode( '(' ) );
if( nPos != STRING_NOTFOUND ) if( nPos != -1 )
{ {
xub_StrLen nPos2 = aText.Search( sal_Unicode( ')' ) ); sal_Int32 nPos2 = aText.indexOf( sal_Unicode( ')' ) );
if( nPos2 != STRING_NOTFOUND ) if( nPos2 != -1 )
aText.Erase( nPos, nPos2-nPos+1 ); aText = aText.replaceAt( nPos, nPos2-nPos+1, "" );
} }
} }