diff options
author | Noel Grandin <noel@peralex.com> | 2013-08-12 17:19:48 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-08-15 09:11:33 +0200 |
commit | 33eeb70011b34a3b04a74b2237d1d6fdde030c35 (patch) | |
tree | 02185ff85c69ea96bd8ba744facbb8974c4415a6 | |
parent | 78b2f4be915b7dd9bfabe34162163b362f0a2141 (diff) |
convert include/svtools/svparser.hxx from String to OUString
Change-Id: I4d6196a9a96ad1dd236f8622a523b4702e92d76f
-rw-r--r-- | dbaccess/source/ui/misc/RtfReader.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/eehtml.cxx | 2 | ||||
-rw-r--r-- | editeng/source/rtf/svxrtf.cxx | 18 | ||||
-rw-r--r-- | include/editeng/svxrtf.hxx | 2 | ||||
-rw-r--r-- | include/svtools/parhtml.hxx | 2 | ||||
-rw-r--r-- | include/svtools/svparser.hxx | 30 | ||||
-rw-r--r-- | sfx2/source/bastyp/sfxhtml.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/doc/objmisc.cxx | 4 | ||||
-rw-r--r-- | svtools/source/svhtml/parhtml.cxx | 135 | ||||
-rw-r--r-- | svtools/source/svrtf/parrtf.cxx | 7 | ||||
-rw-r--r-- | svtools/source/svrtf/svparser.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/html/htmlbas.cxx | 24 | ||||
-rw-r--r-- | sw/source/filter/html/htmlform.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/html/htmltab.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/html/swhtml.cxx | 24 |
15 files changed, 137 insertions, 139 deletions
diff --git a/dbaccess/source/ui/misc/RtfReader.cxx b/dbaccess/source/ui/misc/RtfReader.cxx index bd3690aed679..ffd20b447da1 100644 --- a/dbaccess/source/ui/misc/RtfReader.cxx +++ b/dbaccess/source/ui/misc/RtfReader.cxx @@ -134,7 +134,7 @@ void ORTFReader::NextToken( int nToken ) } nTmpToken2 = GetNextToken(); } - while(aToken.GetChar(0) != ';' && eState != SVPAR_ERROR && eState != SVPAR_ACCEPTED); + while(aToken[0] != ';' && eState != SVPAR_ERROR && eState != SVPAR_ACCEPTED); m_vecColor.push_back(aColor.GetRGBColor()); nTmpToken2 = GetNextToken(); } diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx index b7bf858ff0ac..c322bed210f4 100644 --- a/editeng/source/editeng/eehtml.cxx +++ b/editeng/source/editeng/eehtml.cxx @@ -174,7 +174,7 @@ void EditHTMLParser::NextToken( int nToken ) } break; case HTML_RAWDATA: - if (IsReadStyle() && aToken.Len()) + if (IsReadStyle() && !aToken.isEmpty()) { // Each token represents a single line. maStyleSource.append(aToken); diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx index 90bcd84a2305..a62554438f68 100644 --- a/editeng/source/rtf/svxrtf.cxx +++ b/editeng/source/rtf/svxrtf.cxx @@ -425,9 +425,9 @@ void SvxRTFParser::ReadColorTable() case RTF_BLUE: nBlue = sal_uInt8(nTokenValue); break; case RTF_TEXTTOKEN: - if( 1 == aToken.Len() - ? aToken.GetChar( 0 ) != ';' - : STRING_NOTFOUND == aToken.Search( ';' ) ) + if( 1 == aToken.getLength() + ? aToken[ 0 ] != ';' + : -1 == aToken.indexOf( ";" ) ) break; // At least the ';' must be found // else no break !! @@ -557,7 +557,7 @@ void SvxRTFParser::ReadFontTable() break; case RTF_TEXTTOKEN: DelCharAtEnd( aToken, ';' ); - if ( aToken.Len() ) + if ( !aToken.isEmpty() ) { if( bIsAltFntNm ) sAltNm = aToken; @@ -795,14 +795,14 @@ void SvxRTFParser::ClearAttrStack() } } -String& SvxRTFParser::DelCharAtEnd( String& rStr, const sal_Unicode cDel ) +OUString& SvxRTFParser::DelCharAtEnd( OUString& rStr, const sal_Unicode cDel ) { - if( rStr.Len() && ' ' == rStr.GetChar( 0 )) + if( !rStr.isEmpty() && ' ' == rStr[ 0 ]) rStr = comphelper::string::stripStart(rStr, ' '); - if( rStr.Len() && ' ' == rStr.GetChar( rStr.Len()-1 )) + if( !rStr.isEmpty() && ' ' == rStr[ rStr.getLength()-1 ]) rStr = comphelper::string::stripEnd(rStr, ' '); - if( rStr.Len() && cDel == rStr.GetChar( rStr.Len()-1 )) - rStr.Erase( rStr.Len()-1 ); + if( !rStr.isEmpty() && cDel == rStr[ rStr.getLength()-1 ]) + rStr = rStr.copy( 0, rStr.getLength()-1 ); return rStr; } diff --git a/include/editeng/svxrtf.hxx b/include/editeng/svxrtf.hxx index 56a124067179..175a750e6e82 100644 --- a/include/editeng/svxrtf.hxx +++ b/include/editeng/svxrtf.hxx @@ -246,7 +246,7 @@ protected: virtual void InsertPara() = 0; - String& DelCharAtEnd( String& rStr, const sal_Unicode cDel ); + OUString& DelCharAtEnd( OUString& rStr, const sal_Unicode cDel ); // is called for each token that is recognized in CallParser virtual void NextToken( int nToken ); diff --git a/include/svtools/parhtml.hxx b/include/svtools/parhtml.hxx index d82bbaf8eaef..52b11fa09f8a 100644 --- a/include/svtools/parhtml.hxx +++ b/include/svtools/parhtml.hxx @@ -216,7 +216,7 @@ public: // Ermitteln der Optionen. pNoConvertToken ist das optionale Token // einer Option, fuer die CR/LFs nicht aus dem Wert der Option // geloescht werden. - const HTMLOptions& GetOptions( sal_uInt16 *pNoConvertToken=0 ) const; + const HTMLOptions& GetOptions( sal_uInt16 *pNoConvertToken=0 ); // fuers asynchrone lesen aus dem SvStream virtual void Continue( int nToken ); diff --git a/include/svtools/svparser.hxx b/include/svtools/svparser.hxx index bd2ee966469a..ee4688e9f96d 100644 --- a/include/svtools/svparser.hxx +++ b/include/svtools/svparser.hxx @@ -47,15 +47,15 @@ class SVT_DLLPUBLIC SvParser : public SvRefBase DECL_STATIC_LINK( SvParser, NewDataRead, void* ); protected: - SvStream& rInput; - String aToken; // gescanntes Token + SvStream& rInput; + OUString aToken; // gescanntes Token sal_uLong nlLineNr; // akt. Zeilen Nummer sal_uLong nlLinePos; // akt. Spalten Nummer - SvParser_Impl *pImplData; // interne Daten - long nTokenValue; // zusaetzlicher Wert (RTF) + SvParser_Impl *pImplData; // interne Daten + long nTokenValue; // zusaetzlicher Wert (RTF) sal_Bool bTokenHasValue; // indicates whether nTokenValue is valid - SvParserState eState; // Status auch in abgl. Klassen + SvParserState eState; // Status auch in abgl. Klassen rtl_TextEncoding eSrcEnc; // Source encoding @@ -79,10 +79,10 @@ protected: struct TokenStackType { - String sToken; - long nTokenValue; + OUString sToken; + long nTokenValue; sal_Bool bTokenHasValue; - int nTokenId; + int nTokenId; inline TokenStackType() { nTokenId = 0; } inline ~TokenStackType() { } @@ -207,8 +207,8 @@ class SvKeyValue { /** Representation. */ - String m_aKey; - String m_aValue; + OUString m_aKey; + OUString m_aValue; public: /** Construction. @@ -216,7 +216,7 @@ public: SvKeyValue (void) {} - SvKeyValue (const String &rKey, const String &rValue) + SvKeyValue (const OUString &rKey, const OUString &rValue) : m_aKey (rKey), m_aValue (rValue) {} @@ -235,11 +235,11 @@ public: /** Operation. */ - const String& GetKey (void) const { return m_aKey; } - const String& GetValue (void) const { return m_aValue; } + const OUString& GetKey (void) const { return m_aKey; } + const OUString& GetValue (void) const { return m_aValue; } - void SetKey (const String &rKey ) { m_aKey = rKey; } - void SetValue (const String &rValue) { m_aValue = rValue; } + void SetKey (const OUString &rKey ) { m_aKey = rKey; } + void SetValue (const OUString &rValue) { m_aValue = rValue; } }; /*======================================================================== diff --git a/sfx2/source/bastyp/sfxhtml.cxx b/sfx2/source/bastyp/sfxhtml.cxx index 76cb25aaca1e..74079d9cf243 100644 --- a/sfx2/source/bastyp/sfxhtml.cxx +++ b/sfx2/source/bastyp/sfxhtml.cxx @@ -274,10 +274,10 @@ void SfxHTMLParser::GetScriptType_Impl( SvKeyValueIterator *pHTTPHeader ) for( sal_Bool bCont = pHTTPHeader->GetFirst( aKV ); bCont; bCont = pHTTPHeader->GetNext( aKV ) ) { - if( aKV.GetKey().EqualsIgnoreCaseAscii( + if( aKV.GetKey().equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_META_content_script_type ) ) { - if( aKV.GetValue().Len() ) + if( !aKV.GetValue().isEmpty() ) { String aTmp( aKV.GetValue() ); if( aTmp.EqualsIgnoreCaseAscii( sHTML_MIME_text, 0, 5 ) ) diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index efc3efedc9bc..d7b6c0bebcfc 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1626,7 +1626,7 @@ void SfxHeaderAttributes_Impl::SetAttributes() void SfxHeaderAttributes_Impl::SetAttribute( const SvKeyValue& rKV ) { String aValue = rKV.GetValue(); - if( rKV.GetKey().CompareIgnoreCaseToAscii( "refresh" ) == COMPARE_EQUAL && rKV.GetValue().Len() ) + if( rKV.GetKey() == "refresh" && !rKV.GetValue().isEmpty() ) { sal_uInt32 nTime = aValue.GetToken( 0, ';' ).ToInt32() ; String aURL = comphelper::string::strip(aValue.GetToken( 1, ';' ), ' '); @@ -1648,7 +1648,7 @@ void SfxHeaderAttributes_Impl::SetAttribute( const SvKeyValue& rKV ) // ignore } } - else if( rKV.GetKey().CompareIgnoreCaseToAscii( "expires" ) == COMPARE_EQUAL ) + else if( rKV.GetKey().equalsIgnoreAsciiCase( "expires" ) ) { DateTime aDateTime( DateTime::EMPTY ); if( INetRFC822Message::ParseDateField( rKV.GetValue(), aDateTime ) ) diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index 123ca853bcb4..d41f438595a8 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -583,7 +583,7 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) String( sTmpBuffer.makeStringAndClear() ); if( cChar ) { - if( aToken.Len() ) + if( !aToken.isEmpty() ) { // restart with character nNextCh = '&'; @@ -602,13 +602,13 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) // Hack: _GetNextChar shall not read the // next character if( ';' != nNextCh ) - aToken += ' '; + aToken += " "; if( 1U == cChar ) return HTML_NONBREAKSPACE; if( 2U == cChar ) return HTML_SOFTHYPH; } - aToken += (sal_Unicode)'&'; + aToken += "&"; aToken += String(sEntityBuffer.makeStringAndClear()); break; @@ -648,7 +648,7 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) { // Restart with '&', the remainder is returned as // text token. - if( aToken.Len() || !sTmpBuffer.isEmpty() ) + if( !aToken.isEmpty() || !sTmpBuffer.isEmpty() ) { // _GetNextChar() returns the previous text and // during the next execution a new character is read. @@ -766,7 +766,7 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) if( sal_Unicode(EOF) == (nNextCh = GetNextChar()) && rInput.IsEof() ) { - if( aToken.Len() || sTmpBuffer.getLength() > 1L ) + if( !aToken.isEmpty() || sTmpBuffer.getLength() > 1L ) { // Have seen s.th. aside from blanks? aToken += String(sTmpBuffer.makeStringAndClear()); @@ -787,7 +787,7 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) default: bEqSignFound = false; if( (nNextCh==cBreak && !cQuote) || - (sal_uLong(aToken.Len()) + MAX_LEN) > sal_uLong(STRING_MAXLEN & ~1 )) + (sal_uLong(aToken.getLength()) + MAX_LEN) > sal_uLong(STRING_MAXLEN & ~1 )) bContinue = false; else { @@ -797,7 +797,7 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) if( MAX_LEN == sTmpBuffer.getLength() ) { aToken += String(sTmpBuffer.makeStringAndClear()); - if( (sal_uLong(aToken.Len()) + MAX_LEN) > + if( (sal_uLong(aToken.getLength()) + MAX_LEN) > sal_uLong(STRING_MAXLEN & ~1 ) ) { nNextCh = GetNextChar(); @@ -938,7 +938,7 @@ int HTMLParser::_GetNextRawToken() bContinue = false; // nToken==0 means, _GetNextToken continues to read - if( !aToken.Len() && (bReadStyle || bReadScript) ) + if( aToken.isEmpty() && (bReadStyle || bReadScript) ) { // Immediately close environment (or context?) // and parse the end token @@ -967,9 +967,9 @@ int HTMLParser::_GetNextRawToken() else { // remember "</" , everything else we find in the buffer - aToken += (sal_Unicode)'<'; + aToken += "<"; if( bOffState ) - aToken += (sal_Unicode)'/'; + aToken += "/"; bNextCh = false; } @@ -1016,7 +1016,7 @@ int HTMLParser::_GetNextRawToken() if( rInput.IsEof() ) { bContinue = false; - if( aToken.Len() || !sTmpBuffer.isEmpty() ) + if( !aToken.isEmpty() || !sTmpBuffer.isEmpty() ) { bEndTokenFound = true; } @@ -1063,7 +1063,7 @@ int HTMLParser::_GetNextToken() // HTML_<TOKEN>_OFF generated for HTML_<TOKEN>_ON nRet = mnPendingOffToken; mnPendingOffToken = 0; - aToken.Erase(); + aToken = ""; return nRet; } @@ -1135,7 +1135,7 @@ int HTMLParser::_GetNextToken() // Search token in table: sSaveToken = aToken; - aToken.ToUpperAscii(); + aToken = aToken.toAsciiUpperCase(); if( 0 == (nRet = GetHTMLToken( aToken )) ) // Unknown control nRet = HTML_UNKNOWNCONTROL_ON; @@ -1162,7 +1162,7 @@ int HTMLParser::_GetNextToken() // and append a blank. aToken = sSaveToken; if( '>'!=nNextCh ) - aToken += (sal_Unicode)' '; + aToken += " "; sal_uLong nCStreamPos = 0; sal_uLong nCLineNr = 0; sal_uLong nCLinePos = 0; @@ -1177,18 +1177,18 @@ int HTMLParser::_GetNextToken() if( !nCStreamPos ) { nCStreamPos = rInput.Tell(); - nCStrLen = aToken.Len(); + nCStrLen = aToken.getLength(); nCLineNr = GetLineNr(); nCLinePos = GetLinePos(); } - bDone = aToken.Len() >= 2 && - aToken.Copy(aToken.Len()-2,2). - EqualsAscii( "--" ); + bDone = aToken.getLength() >= 2 && + aToken.copy(aToken.getLength()-2,2). + equalsAscii( "--" ); if( !bDone ) - aToken += nNextCh; + aToken += OUString(nNextCh); } else - aToken += nNextCh; + aToken += OUString(nNextCh); if( !bDone ) nNextCh = GetNextChar(); } @@ -1198,14 +1198,14 @@ int HTMLParser::_GetNextToken() SetLineNr( nCLineNr ); SetLinePos( nCLinePos ); ClearTxtConvContext(); - aToken.Erase( nCStrLen ); + aToken = aToken.replaceAt( nCStrLen, 1, "" ); nNextCh = '>'; } } else { // TokenString not needed anymore - aToken.Erase(); + aToken = ""; } // Read until closing '>' @@ -1217,11 +1217,11 @@ int HTMLParser::_GetNextToken() // generate pending HTML_<TOKEN>_OFF for HTML_<TOKEN>_ON // Do not convert this to a single HTML_<TOKEN>_OFF // which lead to fdo#56772. - if ((HTML_TOKEN_ONOFF & nRet) && (aToken.Len() >= 1) && - ('/' == aToken.GetChar(aToken.Len()-1))) + if ((HTML_TOKEN_ONOFF & nRet) && (aToken.getLength() >= 1) && + ('/' == aToken[aToken.getLength()-1])) { mnPendingOffToken = nRet + 1; // HTML_<TOKEN>_ON -> HTML_<TOKEN>_OFF - aToken.Erase( aToken.Len()-1, 1); // remove trailing '/' + aToken = aToken.replaceAt( aToken.getLength()-1, 1, ""); // remove trailing '/' } if( sal_Unicode(EOF) == nNextCh && rInput.IsEof() ) { @@ -1232,7 +1232,7 @@ int HTMLParser::_GetNextToken() SetLinePos( nLinePos ); ClearTxtConvContext(); - aToken = '<'; + aToken = "<"; nRet = HTML_TEXTTOKEN; nNextCh = GetNextChar(); bNextCh = false; @@ -1257,7 +1257,7 @@ int HTMLParser::_GetNextToken() SetLinePos( nLinePos ); ClearTxtConvContext(); - aToken = '<'; + aToken = "<"; nRet = HTML_TEXTTOKEN; nNextCh = GetNextChar(); bNextCh = false; @@ -1265,7 +1265,7 @@ int HTMLParser::_GetNextToken() } if( SVPAR_PENDING == eState ) bReadNextChar = bReadNextCharSave; - aToken.Erase(); + aToken = ""; } else if( '%' == nNextCh ) { @@ -1278,11 +1278,11 @@ int HTMLParser::_GetNextToken() // Read until closing %>. If not found restart at first >. while( !bDone && !rInput.IsEof() && IsParserWorking() ) { - bDone = '>'==nNextCh && aToken.Len() >= 1 && - '%' == aToken.GetChar( aToken.Len()-1 ); + bDone = '>'==nNextCh && aToken.getLength() >= 1 && + '%' == aToken[ aToken.getLength()-1 ]; if( !bDone ) { - aToken += nNextCh; + aToken += OUString(nNextCh); nNextCh = GetNextChar(); } } @@ -1292,19 +1292,19 @@ int HTMLParser::_GetNextToken() SetLineNr( nCLineNr ); SetLinePos( nCLinePos ); ClearTxtConvContext(); - aToken.AssignAscii( "<%", 2 ); + aToken = "<%"; nRet = HTML_TEXTTOKEN; break; } if( IsParserWorking() ) { sSaveToken = aToken; - aToken.Erase(); + aToken = ""; } } else { - aToken = '<'; + aToken = "<"; nRet = HTML_TEXTTOKEN; bNextCh = false; break; @@ -1395,7 +1395,7 @@ int HTMLParser::_GetNextToken() scan_text: // "normal" text to come nRet = ScanText(); - bNextCh = 0 == aToken.Len(); + bNextCh = 0 == aToken.getLength(); // the text should be processed if( !bNextCh && eState == SVPAR_PENDING ) @@ -1430,13 +1430,13 @@ void HTMLParser::UnescapeToken() xub_StrLen nPos=0; bool bEscape = false; - while( nPos < aToken.Len() ) + while( nPos < aToken.getLength() ) { bool bOldEscape = bEscape; bEscape = false; - if( '\\'==aToken.GetChar(nPos) && !bOldEscape ) + if( '\\'==aToken[nPos] && !bOldEscape ) { - aToken.Erase( nPos, 1 ); + aToken = aToken.replaceAt( nPos, 1, "" ); bEscape = true; } else @@ -1446,7 +1446,7 @@ void HTMLParser::UnescapeToken() } } -const HTMLOptions& HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const +const HTMLOptions& HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) { // If the options for the current token have already been returned, // return them once again. @@ -1454,10 +1454,10 @@ const HTMLOptions& HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const return maOptions; xub_StrLen nPos = 0; - while( nPos < aToken.Len() ) + while( nPos < aToken.getLength() ) { // A letter? Option beginning here. - if( HTML_ISALPHA( aToken.GetChar(nPos) ) ) + if( HTML_ISALPHA( aToken[nPos] ) ) { int nToken; String aValue; @@ -1467,15 +1467,14 @@ const HTMLOptions& HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const // Actually only certain characters allowed. // Netscape only looks for "=" and white space (c.f. // Mozilla: PA_FetchRequestedNameValues in lipparse/pa_mdl.c) - while( nPos < aToken.Len() && '=' != (cChar=aToken.GetChar(nPos)) && + while( nPos < aToken.getLength() && '=' != (cChar=aToken[nPos]) && HTML_ISPRINTABLE(cChar) && !HTML_ISSPACE(cChar) ) nPos++; - String sName( aToken.Copy( nStt, nPos-nStt ) ); + OUString sName( aToken.copy( nStt, nPos-nStt ) ); // PlugIns require original token name. Convert to upper case only for searching. - String sNameUpperCase( sName ); - sNameUpperCase.ToUpperAscii(); + OUString sNameUpperCase( sName.toAsciiUpperCase() ); nToken = GetHTMLOption( sNameUpperCase ); // Name is ready DBG_ASSERTWARNING( nToken!=HTML_O_UNKNOWN, @@ -1484,22 +1483,22 @@ const HTMLOptions& HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const nToken >= HTML_OPTION_SCRIPT_END) && (!pNoConvertToken || nToken != *pNoConvertToken); - while( nPos < aToken.Len() && - ( !HTML_ISPRINTABLE( (cChar=aToken.GetChar(nPos)) ) || + while( nPos < aToken.getLength() && + ( !HTML_ISPRINTABLE( (cChar=aToken[nPos]) ) || HTML_ISSPACE(cChar) ) ) nPos++; // Option with value? - if( nPos!=aToken.Len() && '='==cChar ) + if( nPos!=aToken.getLength() && '='==cChar ) { nPos++; - while( nPos < aToken.Len() && - ( !HTML_ISPRINTABLE( (cChar=aToken.GetChar(nPos)) ) || + while( nPos < aToken.getLength() && + ( !HTML_ISPRINTABLE( (cChar=aToken[nPos]) ) || ' '==cChar || '\t'==cChar || '\r'==cChar || '\n'==cChar ) ) nPos++; - if( nPos != aToken.Len() ) + if( nPos != aToken.getLength() ) { xub_StrLen nLen = 0; nStt = nPos; @@ -1509,17 +1508,17 @@ const HTMLOptions& HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const nPos++; nStt++; bool bDone = false; bool bEscape = false; - while( nPos < aToken.Len() && !bDone ) + while( nPos < aToken.getLength() && !bDone ) { bool bOldEscape = bEscape; bEscape = false; - cChar = aToken.GetChar(nPos); + cChar = aToken[nPos]; switch( cChar ) { case '\r': case '\n': if( bStripCRLF ) - ((String &)aToken).Erase( nPos, 1 ); + aToken = aToken.replaceAt( nPos, 1, "" ); else nPos++, nLen++; break; @@ -1530,7 +1529,7 @@ const HTMLOptions& HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const } else { - ((String &)aToken).Erase( nPos, 1 ); + aToken = aToken.replaceAt( nPos, 1, "" ); bEscape = true; } break; @@ -1545,7 +1544,7 @@ const HTMLOptions& HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const break; } } - if( nPos!=aToken.Len() ) + if( nPos!=aToken.getLength() ) nPos++; } else @@ -1553,11 +1552,11 @@ const HTMLOptions& HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const // More liberal than the standard: allow all printable characters bool bEscape = false; bool bDone = false; - while( nPos < aToken.Len() && !bDone ) + while( nPos < aToken.getLength() && !bDone ) { bool bOldEscape = bEscape; bEscape = false; - sal_Unicode c = aToken.GetChar(nPos); + sal_Unicode c = aToken[nPos]; switch( c ) { case ' ': @@ -1579,7 +1578,7 @@ const HTMLOptions& HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const } else { - ((String &)aToken).Erase( nPos, 1 ); + aToken = aToken.replaceAt( nPos, 1, "" ); bEscape = true; } break; @@ -1595,7 +1594,7 @@ const HTMLOptions& HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const } if( nLen ) - aValue = aToken.Copy( nStt, nLen ); + aValue = aToken.copy( nStt, nLen ); } } @@ -1637,8 +1636,8 @@ int HTMLParser::FilterPRE( int nToken ) case HTML_TABCHAR: { sal_Int32 nSpaces = (8 - (nPre_LinePos % 8)); - DBG_ASSERT( !aToken.Len(), "Why is the token not empty?" ); - if (aToken.Len() < nSpaces) + DBG_ASSERT( aToken.isEmpty(), "Why is the token not empty?" ); + if (aToken.getLength() < nSpaces) { using comphelper::string::padToLength; OUStringBuffer aBuf(aToken); @@ -1650,7 +1649,7 @@ int HTMLParser::FilterPRE( int nToken ) break; // Keep those case HTML_TEXTTOKEN: - nPre_LinePos += aToken.Len(); + nPre_LinePos += aToken.getLength(); break; case HTML_SELECT_ON: @@ -1822,15 +1821,15 @@ int HTMLParser::FilterXMP( int nToken ) } else sSaveToken.Insert( '<', 0 ); - if( aToken.Len() ) + if( !aToken.isEmpty() ) { UnescapeToken(); sSaveToken += (sal_Unicode)' '; - aToken.Insert( sSaveToken, 0 ); + aToken = aToken.replaceAt( 0, 0, sSaveToken ); } else aToken = sSaveToken; - aToken += (sal_Unicode)'>'; + aToken += ">"; nToken = HTML_TEXTTOKEN; } break; @@ -2286,9 +2285,9 @@ rtl_TextEncoding HTMLParser::GetEncodingByHttpHeader( SvKeyValueIterator *pHTTPH for( bool bCont = pHTTPHeader->GetFirst( aKV ); bCont; bCont = pHTTPHeader->GetNext( aKV ) ) { - if( aKV.GetKey().EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_content_type ) ) + if( aKV.GetKey().equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_META_content_type ) ) { - if( aKV.GetValue().Len() ) + if( !aKV.GetValue().isEmpty() ) { eRet = HTMLParser::GetEncodingByMIME( aKV.GetValue() ); } diff --git a/svtools/source/svrtf/parrtf.cxx b/svtools/source/svrtf/parrtf.cxx index 807459f92252..801e5c157663 100644 --- a/svtools/source/svrtf/parrtf.cxx +++ b/svtools/source/svrtf/parrtf.cxx @@ -95,7 +95,7 @@ int SvRTFParser::_GetNextToken() default: if( RTF_ISALPHA( nNextCh ) ) { - aToken = '\\'; + aToken = "\\"; { String aStrBuffer; sal_Unicode* pStr = aStrBuffer.AllocBuffer( @@ -106,7 +106,6 @@ int SvRTFParser::_GetNextToken() if( MAX_TOKEN_LEN == nStrLen ) { aToken += aStrBuffer; - aToken.GetBufferAccess(); // make unique string! nStrLen = 0; } nNextCh = GetNextChar(); @@ -164,7 +163,7 @@ int SvRTFParser::_GetNextToken() aParserStates.top(). nUCharOverread = nUCharOverread; } - aToken.Erase(); // #i47831# erase token to prevent the token from beeing treated as text + aToken = ""; // #i47831# erase token to prevent the token from beeing treated as text // read next token nRet = 0; break; @@ -185,7 +184,7 @@ int SvRTFParser::_GetNextToken() if( !bRTF_InTextRead ) { nRet = RTF_TEXTTOKEN; - aToken = (sal_Unicode)nTokenValue; + aToken = OUString( (sal_Unicode)nTokenValue ); // overread the next n "RTF" characters. This // can be also \{, \}, \'88 diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx index f56876efd7c6..2c785cea28a4 100644 --- a/svtools/source/svrtf/svparser.cxx +++ b/svtools/source/svrtf/svparser.cxx @@ -382,7 +382,7 @@ int SvParser::GetNextToken() if( !nTokenStackPos ) { - aToken.Erase(); // Token-Buffer loeschen + aToken = ""; // Token-Buffer loeschen nTokenValue = -1; // Kennzeichen fuer kein Value gelesen bTokenHasValue = false; diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx index ff7debdd4f0c..cf62456ae8db 100644 --- a/sw/source/filter/html/htmlbas.cxx +++ b/sw/source/filter/html/htmlbas.cxx @@ -183,40 +183,40 @@ void SwHTMLParser::EndScript() void SwHTMLParser::AddScriptSource() { // Hier merken wir und nur ein par Strings - if( aToken.Len() > 2 && - (HTML_SL_STARBASIC==eScriptLang && aToken.GetChar( 0 ) == '\'') ) + if( !aToken.isEmpty() > 2 && + (HTML_SL_STARBASIC==eScriptLang && aToken[ 0 ] == '\'') ) { - xub_StrLen nPos = STRING_NOTFOUND; + sal_Int32 nPos = -1; if( aBasicLib.isEmpty() ) { - nPos = aToken.SearchAscii( OOO_STRING_SVTOOLS_HTML_SB_library ); - if( nPos != STRING_NOTFOUND ) + nPos = aToken.indexOf( OOO_STRING_SVTOOLS_HTML_SB_library ); + if( nPos != -1 ) { aBasicLib = - aToken.Copy( nPos + sizeof(OOO_STRING_SVTOOLS_HTML_SB_library) - 1 ); + aToken.copy( nPos + sizeof(OOO_STRING_SVTOOLS_HTML_SB_library) - 1 ); aBasicLib = comphelper::string::strip(aBasicLib, ' '); } } - if( aBasicModule.isEmpty() && nPos==STRING_NOTFOUND ) + if( aBasicModule.isEmpty() && nPos == -1 ) { - nPos = aToken.SearchAscii( OOO_STRING_SVTOOLS_HTML_SB_module ); - if( nPos != STRING_NOTFOUND ) + nPos = aToken.indexOf( OOO_STRING_SVTOOLS_HTML_SB_module ); + if( nPos != -1 ) { aBasicModule = - aToken.Copy( nPos + sizeof(OOO_STRING_SVTOOLS_HTML_SB_module) - 1 ); + aToken.copy( nPos + sizeof(OOO_STRING_SVTOOLS_HTML_SB_module) - 1 ); aBasicModule = comphelper::string::strip(aBasicModule, ' '); } } - if( nPos==STRING_NOTFOUND ) + if( nPos == -1 ) { if( !aScriptSource.isEmpty() ) aScriptSource += "\n"; aScriptSource += aToken; } } - else if( !aScriptSource.isEmpty() || aToken.Len() ) + else if( !aScriptSource.isEmpty() || !aToken.isEmpty() ) { // Leerzeilen am Anfang werden ignoriert if( !aScriptSource.isEmpty() ) diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index 1470596907fa..32c61f588597 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -2233,7 +2233,7 @@ void SwHTMLParser::InsertTextAreaText( sal_uInt16 nToken ) default: rText += "<"; rText += sSaveToken; - if( aToken.Len() ) + if( !aToken.isEmpty() ) { rText += " "; rText += aToken; @@ -2610,13 +2610,13 @@ void SwHTMLParser::InsertSelectText() { OUString& rText = pFormImpl->GetStringList().back(); - if( aToken.Len() && ' '==aToken.GetChar( 0 ) ) + if( !aToken.isEmpty() && ' '==aToken[ 0 ] ) { sal_Int32 nLen = rText.getLength(); if( !nLen || ' '==rText[nLen-1]) - aToken.Erase( 0, 1 ); + aToken = aToken.replaceAt( 0, 1, "" ); } - if( aToken.Len() ) + if( !aToken.isEmpty() ) rText += aToken; } } diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index 0f326185db54..a82386e09bcd 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -4095,8 +4095,8 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, sal_Bool bReadOptions, case HTML_TEXTTOKEN: // keine Section fuer einen leeren String anlegen - if( !pSaveStruct->IsInSection() && 1==aToken.Len() && - ' '==aToken.GetChar(0) ) + if( !pSaveStruct->IsInSection() && 1==aToken.getLength() && + ' '==aToken[0] ) break; default: if( !pSaveStruct->IsInSection() ) @@ -4392,7 +4392,7 @@ void SwHTMLParser::BuildTableRow( HTMLTable *pCurTable, sal_Bool bReadOptions, case HTML_TEXTTOKEN: if( (pCurTable->GetContext() || !pCurTable->HasParentSection()) && - 1==aToken.Len() && ' '==aToken.GetChar(0) ) + 1==aToken.getLength() && ' '==aToken[0] ) break; default: pCurTable->MakeParentContents(); @@ -4553,7 +4553,7 @@ void SwHTMLParser::BuildTableSection( HTMLTable *pCurTable, // Blank-Strings sind Folge von CR+LF und kein Text if( (pCurTable->GetContext() || !pCurTable->HasParentSection()) && - 1==aToken.Len() && ' '==aToken.GetChar(0) ) + 1==aToken.getLength() && ' ' == aToken[0] ) break; default: pCurTable->MakeParentContents(); @@ -4770,7 +4770,7 @@ void SwHTMLParser::BuildTableColGroup( HTMLTable *pCurTable, case HTML_TEXTTOKEN: if( (pCurTable->GetContext() || !pCurTable->HasParentSection()) && - 1==aToken.Len() && ' '==aToken.GetChar(0) ) + 1==aToken.getLength() && ' '==aToken[0] ) break; default: pCurTable->MakeParentContents(); @@ -5342,7 +5342,7 @@ HTMLTable *SwHTMLParser::BuildTable( SvxAdjust eParentAdjust, // Blank-Strings sind u. U. eine Folge von CR+LF und kein Text if( (pCurTable->GetContext() || !pCurTable->HasParentSection()) && - 1==aToken.Len() && ' '==aToken.GetChar(0) ) + 1==aToken.getLength() && ' '==aToken[0] ) break; default: pCurTable->MakeParentContents(); diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index c07a69e73902..c096cf17435d 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -1024,7 +1024,7 @@ void SwHTMLParser::NextToken( int nToken ) if( (HTML_TOKEN_ONOFF & nToken) && (1 & nToken) ) sTitle += "/"; sTitle += sSaveToken; - if( aToken.Len() ) + if( !aToken.isEmpty() ) { sTitle += " "; sTitle += aToken; @@ -1215,7 +1215,7 @@ void SwHTMLParser::NextToken( int nToken ) { // Paste content of unknown tags. // (but surely if we are not in the header section) fdo#36080 fdo#34666 - if (aToken.Len() > 0 && !IsInHeader() ) + if (!aToken.isEmpty() && !IsInHeader() ) { if( !bDocInitalized ) DocumentDetected(); @@ -1448,7 +1448,7 @@ void SwHTMLParser::NextToken( int nToken ) case HTML_TEXTTOKEN: // insert string without spanning attributes at the end. - if( aToken.Len() && ' '==aToken.GetChar(0) && !IsReadPRE() ) + if( !aToken.isEmpty() && ' '==aToken[0] && !IsReadPRE() ) { xub_StrLen nPos = pPam->GetPoint()->nContent.GetIndex(); if( nPos ) @@ -1457,19 +1457,19 @@ void SwHTMLParser::NextToken( int nToken ) pPam->GetPoint()->nNode.GetNode().GetTxtNode()->GetTxt(); sal_Unicode cLast = rText.GetChar(--nPos); if( ' ' == cLast || '\x0a' == cLast) - aToken.Erase(0,1); + aToken = aToken.copy(1); } else - aToken.Erase(0,1); + aToken = aToken.copy(1); - if( !aToken.Len() ) + if( aToken.isEmpty() ) { bUpperSpace = bUpperSpaceSave; break; } } - if( aToken.Len() ) + if( !aToken.isEmpty() ) { if( !bDocInitalized ) DocumentDetected(); @@ -1942,15 +1942,15 @@ void SwHTMLParser::NextToken( int nToken ) break; case HTML_COMMENT: - if( ( aToken.Len() > 5 ) && ( ! bIgnoreHTMLComments ) ) + if( ( aToken.getLength() > 5 ) && ( ! bIgnoreHTMLComments ) ) { // insert as Post-It // If there are no space characters right behind // the <!-- and on front of the -->, leave the comment untouched. - if( ' ' == aToken.GetChar( 3 ) && - ' ' == aToken.GetChar( aToken.Len()-3 ) ) + if( ' ' == aToken[ 3 ] && + ' ' == aToken[ aToken.getLength()-3 ] ) { - String aComment( aToken.Copy( 3, aToken.Len()-5 ) ); + String aComment( aToken.copy( 3, aToken.getLength()-5 ) ); InsertComment(comphelper::string::strip(aComment, ' ')); } else @@ -2028,7 +2028,7 @@ void SwHTMLParser::NextToken( int nToken ) if( (HTML_TOKEN_ONOFF & nToken) != 0 && (1 & nToken) != 0 ) aComment += '/'; aComment += sSaveToken; - if( aToken.Len() ) + if( !aToken.isEmpty() ) { UnescapeToken(); (aComment += ' ') += aToken; |