diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-08-21 01:09:00 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-08-22 09:39:16 +0100 |
commit | 91a418d2137e33b48d9e524b53dd71e08754a06b (patch) | |
tree | c59dacc45b00addbfd95a24221ee5bf49d400a19 | |
parent | dbfa0518af3d398f19d53d39fa72f5f437fd83fc (diff) |
ByteString->rtl::OString
-rw-r--r-- | automation/source/testtool/tcommuni.cxx | 17 | ||||
-rw-r--r-- | basic/source/app/dialogs.cxx | 18 | ||||
-rw-r--r-- | extensions/source/scanner/sanedlg.cxx | 52 | ||||
-rw-r--r-- | padmin/source/adddlg.cxx | 84 | ||||
-rw-r--r-- | sd/source/filter/ppt/pptin.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/bastyp/mieclip.cxx | 22 |
6 files changed, 103 insertions, 98 deletions
diff --git a/automation/source/testtool/tcommuni.cxx b/automation/source/testtool/tcommuni.cxx index 32b97075f77c..82583a414e0a 100644 --- a/automation/source/testtool/tcommuni.cxx +++ b/automation/source/testtool/tcommuni.cxx @@ -117,13 +117,12 @@ sal_Bool CommunicationManagerClientViaSocketTT::KillApplication() #define GETSET(aVar, KeyName, Dafault) \ aVar = aConf.ReadKey(KeyName,"No Entry"); \ - if ( aVar.CompareTo("No Entry") == COMPARE_EQUAL ) \ + if (aVar.equalsL(RTL_CONSTASCII_STRINGPARAM("No Entry"))) \ { \ - aVar = ByteString(Dafault); \ + aVar = Dafault; \ aConf.WriteKey(KeyName, aVar); \ } - String GetHostConfig() { String aHostToTalk; @@ -138,12 +137,12 @@ String GetHostConfig() return Application::GetCommandLineParam( i ).Copy(6); } - ByteString abHostToTalk; + rtl::OString abHostToTalk; Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); aConf.SetGroup("Communication"); GETSET( abHostToTalk, "Host", DEFAULT_HOST ); - return UniString( abHostToTalk, RTL_TEXTENCODING_UTF8 ); + return rtl::OStringToOUString(abHostToTalk, RTL_TEXTENCODING_UTF8); } @@ -164,13 +163,13 @@ sal_uLong GetTTPortConfig() } } - ByteString abPortToTalk; + rtl::OString abPortToTalk; Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); aConf.SetGroup("Communication"); GETSET( abPortToTalk, "TTPort", rtl::OString::valueOf(static_cast<sal_Int32>(TESTTOOL_DEFAULT_PORT)) ); - return (sal_uLong)abPortToTalk.ToInt32(); + return (sal_uLong)abPortToTalk.toInt32(); } @@ -191,13 +190,13 @@ sal_uLong GetUnoPortConfig() } } - ByteString abPortToTalk; + rtl::OString abPortToTalk; Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); aConf.SetGroup("Communication"); GETSET( abPortToTalk, "UnoPort", rtl::OString::valueOf(static_cast<sal_Int32>(UNO_DEFAULT_PORT)) ); - return (sal_uLong)abPortToTalk.ToInt32(); + return (sal_uLong)abPortToTalk.toInt32(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/app/dialogs.cxx b/basic/source/app/dialogs.cxx index 77e1e091d5d3..10096195b340 100644 --- a/basic/source/app/dialogs.cxx +++ b/basic/source/app/dialogs.cxx @@ -515,12 +515,10 @@ CrashreportOptions::CrashreportOptions( Window* pParent, Config &aConfig ) aNFCRPort.SetUseThousandSep( sal_False ); - ByteString aTemp; - aConfig.SetGroup("Crashreporter"); - aTemp = aConfig.ReadKey( "UseProxy", "false" ); - if ( aTemp.EqualsIgnoreCaseAscii( "true" ) || aTemp.Equals( "1" ) ) + rtl::OString aTemp = aConfig.ReadKey( "UseProxy", "false" ); + if ( aTemp.equalsIgnoreAsciiCase("true") || aTemp.equals("1") ) aCBUseProxy.Check(); else aCBUseProxy.Check( sal_False ); @@ -529,13 +527,13 @@ CrashreportOptions::CrashreportOptions( Window* pParent, Config &aConfig ) LINK( this, CrashreportOptions, CheckProxy ).Call( NULL ); // call once to initialize aTemp = aConfig.ReadKey( "ProxyServer" ); - aEDCRHost.SetText( String( aTemp, RTL_TEXTENCODING_UTF8 ) ); + aEDCRHost.SetText(rtl::OStringToOUString(aTemp, RTL_TEXTENCODING_UTF8)); aTemp = aConfig.ReadKey( "ProxyPort", "8080" ); - aNFCRPort.SetValue( aTemp.ToInt32() ); + aNFCRPort.SetValue(aTemp.toInt32()); aTemp = aConfig.ReadKey( "AllowContact", "false" ); - if ( aTemp.EqualsIgnoreCaseAscii( "true" ) || aTemp.Equals( "1" ) ) + if ( aTemp.equalsIgnoreAsciiCase("true") || aTemp.equals("1") ) aCBAllowContact.Check(); else aCBAllowContact.Check( sal_False ); @@ -544,7 +542,7 @@ CrashreportOptions::CrashreportOptions( Window* pParent, Config &aConfig ) LINK( this, CrashreportOptions, CheckResponse ).Call( NULL ); // call once to initialize aTemp = aConfig.ReadKey( "ReturnAddress" ); - aEDEMail.SetText( String( aTemp, RTL_TEXTENCODING_UTF8 ) ); + aEDEMail.SetText(rtl::OStringToOUString(aTemp, RTL_TEXTENCODING_UTF8)); } @@ -659,8 +657,8 @@ void MiscOptions::Save( Config &aConfig ) rtl::OString::valueOf(static_cast<sal_Int32>(aServerTimeout.GetTime().GetTime()))); aConfig.SetGroup("LRU"); - ByteString aTemp = aConfig.ReadKey( "MaxLRU", "4" ); - sal_uInt16 nOldMaxLRU = (sal_uInt16)aTemp.ToInt32(); + rtl::OString aTemp = aConfig.ReadKey( "MaxLRU", "4" ); + sal_uInt16 nOldMaxLRU = (sal_uInt16)aTemp.toInt32(); sal_uInt16 n; for ( n = nOldMaxLRU ; n > aTFMaxLRU.GetValue() ; n-- ) { diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx index a83af7390905..39b88620d5d9 100644 --- a/extensions/source/scanner/sanedlg.cxx +++ b/extensions/source/scanner/sanedlg.cxx @@ -40,6 +40,7 @@ #include <math.h> #include <sal/macros.h> #include <rtl/strbuf.hxx> +#include <comphelper/string.hxx> ResId SaneResId( sal_uInt32 nID ) { @@ -1196,36 +1197,41 @@ sal_Bool SaneDlg::LoadState() if( mrSane.IsOpen() ) { int iMax = aConfig.GetKeyCount(); - for( i = 0; i < iMax; i++ ) + for (i = 0; i < iMax; ++i) { aString = aConfig.GetKeyName( i ); - ByteString aValue = aConfig.ReadKey( i ); + rtl::OString aValue = aConfig.ReadKey( i ); int nOption = mrSane.GetOptionByName( aString.GetBuffer() ); - if( nOption != -1 ) + if( nOption == -1 ) + continue; + + using comphelper::string::matchL; + + if (matchL(aValue, RTL_CONSTASCII_USTRINGPARAM("BOOL="))) { - if( aValue.CompareTo( "BOOL=", 5 ) == COMPARE_EQUAL ) - { - aValue.Erase( 0, 5 ); - sal_Bool aBOOL = (sal_Bool)aValue.ToInt32(); - mrSane.SetOptionValue( nOption, aBOOL ); - } - else if( aValue.CompareTo( "STRING=", 7 ) == COMPARE_EQUAL ) - { - aValue.Erase( 0, 7 ); - mrSane.SetOptionValue( nOption, String( aValue, osl_getThreadTextEncoding() ) ); - } - else if( aValue.CompareTo( "NUMERIC=", 8 ) == COMPARE_EQUAL ) + aValue = aValue.copy(RTL_CONSTASCII_LENGTH("BOOL=")); + sal_Bool aBOOL = (sal_Bool)aValue.toInt32(); + mrSane.SetOptionValue( nOption, aBOOL ); + } + else if (matchL(aValue, RTL_CONSTASCII_USTRINGPARAM("STRING="))) + { + aValue = aValue.copy(RTL_CONSTASCII_LENGTH("STRING=")); + mrSane.SetOptionValue(nOption,rtl::OStringToOUString(aValue, osl_getThreadTextEncoding()) ); + } + else if (matchL(aValue, RTL_CONSTASCII_USTRINGPARAM("NUMERIC="))) + { + aValue = aValue.copy(RTL_CONSTASCII_LENGTH("NUMERIC=")); + + sal_Int32 nIndex = 0; + int n = 0; + do { - aValue.Erase( 0, 8 ); - int nMax = aValue.GetTokenCount( ':' ); + rtl::OString aSub = aValue.getToken(0, ':', nIndex); double fValue=0.0; - for( int n = 0; n < nMax ; n++ ) - { - ByteString aSub = aValue.GetToken( n, ':' ); - sscanf( aSub.GetBuffer(), "%lg", &fValue ); - SetAdjustedNumericalValue( aString.GetBuffer(), fValue, n ); - } + sscanf(aSub.getStr(), "%lg", &fValue); + SetAdjustedNumericalValue(aString.GetBuffer(), fValue, n++); } + while ( nIndex >= 0 ); } } } diff --git a/padmin/source/adddlg.cxx b/padmin/source/adddlg.cxx index 639b871210ec..ec41d0e777ab 100644 --- a/padmin/source/adddlg.cxx +++ b/padmin/source/adddlg.cxx @@ -36,11 +36,11 @@ #include "vcl/msgbox.hxx" #include "vcl/strhelper.hxx" -#include "osl/thread.h" - +#include <osl/thread.h> +#include <rtl/strbuf.hxx> +#include <comphelper/string.hxx> #include <boost/unordered_set.hpp> - using namespace psp; using namespace padmin; using namespace std; @@ -507,29 +507,31 @@ APOldPrinterPage::APOldPrinterPage( AddPrinterDialog* pParent ) ByteString aDefCopies( aConfig.ReadKey( "Copies" ) ); ByteString aDefDPI( aConfig.ReadKey( "DPI" ) ); + using comphelper::string::getToken; + aConfig.SetGroup( "devices" ); int nDevices = aConfig.GetKeyCount(); for( int nKey = 0; nKey < nDevices; nKey++ ) { aConfig.SetGroup( "devices" ); - ByteString aPrinter( aConfig.GetKeyName( nKey ) ); - ByteString aValue( aConfig.ReadKey( aPrinter ) ); - ByteString aPort( aValue.GetToken( 1, ',' ) ); - ByteString aDriver( aValue.GetToken( 0, ' ' ) ); - ByteString aPS( aValue.GetToken( 0, ',' ).GetToken( 1, ' ' ) ); - ByteString aNewDriver( aDriver ); - if( aDriver == "GENERIC" ) - aNewDriver = "SGENPRT"; + rtl::OString aPrinter(aConfig.GetKeyName(nKey)); + rtl::OString aValue(aConfig.ReadKey(aPrinter)); + rtl::OString aPort(getToken(aValue, 1, ',')); + rtl::OString aDriver(getToken(aValue, 0, ' ')); + rtl::OString aPS( getToken(getToken(aValue, 0, ','), 1, ' ') ); + rtl::OString aNewDriver(aDriver); + if( aDriver.equalsL(RTL_CONSTASCII_STRINGPARAM("GENERIC"))) + aNewDriver = rtl::OString(RTL_CONSTASCII_STRINGPARAM("SGENPRT")); if( aPS != "PostScript" ) continue; - const PPDParser* pParser = PPDParser::getParser( String( aNewDriver, aEncoding ) ); + const PPDParser* pParser = PPDParser::getParser(rtl::OStringToOUString(aNewDriver, aEncoding)); if( pParser == NULL ) { String aText( PaResId( RID_TXT_DRIVERDOESNOTEXIST ) ); - aText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s1" ) ), String( aPrinter, aEncoding ) ); - aText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s2" ) ), String( aDriver, aEncoding ) ); + aText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s1" ) ), rtl::OStringToOUString(aPrinter, aEncoding) ); + aText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s2" ) ), rtl::OStringToOUString(aDriver, aEncoding) ); InfoBox aBox( this, aText ); aBox.Execute(); continue; @@ -541,66 +543,66 @@ APOldPrinterPage::APOldPrinterPage( AddPrinterDialog* pParent ) if( ! aCommand.Len() ) { String aText( PaResId( RID_TXT_PRINTERWITHOUTCOMMAND ) ); - aText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), String( aPrinter, aEncoding ) ); + aText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), rtl::OStringToOUString(aPrinter, aEncoding) ); InfoBox aBox( this, aText ); aBox.Execute(); continue; } - String aUPrinter( AddPrinterDialog::uniquePrinterName( String( aPrinter, aEncoding ) ) ); + String aUPrinter( AddPrinterDialog::uniquePrinterName(rtl::OStringToOUString(aPrinter, aEncoding)) ); PrinterInfo aInfo; - aInfo.m_aDriverName = String( aNewDriver, aEncoding ); + aInfo.m_aDriverName = rtl::OStringToOUString(aNewDriver, aEncoding); aInfo.m_pParser = pParser; aInfo.m_aContext.setParser( pParser ); aInfo.m_aPrinterName = aUPrinter; - aInfo.m_aCommand = String( aCommand, aEncoding ); + aInfo.m_aCommand = rtl::OStringToOUString(aCommand, aEncoding); // read the printer settings - ByteString aGroup( aDriver ); - aGroup += ",PostScript,"; - aGroup += aPort; - aConfig.SetGroup( aGroup ); + rtl::OStringBuffer aGroup(aDriver); + aGroup.append(RTL_CONSTASCII_STRINGPARAM(",PostScript,")); + aGroup.append(aPort); + aConfig.SetGroup(aGroup.makeStringAndClear()); aValue = aConfig.ReadKey( "PageSize", aDefPageSize ); int nLeft, nRight, nTop, nBottom; - if( aValue.Len() && - aInfo.m_pParser->getMargins( String( aValue, aEncoding ), + if( aValue.getLength() && + aInfo.m_pParser->getMargins( rtl::OStringToOUString(aValue, aEncoding), nLeft, nRight, nTop, nBottom ) ) { const PPDKey* pKey = aInfo.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) ); - const PPDValue* pValue = pKey ? pKey->getValue( String( aValue, aEncoding ) ) : NULL; + const PPDValue* pValue = pKey ? pKey->getValue( rtl::OStringToOUString(aValue, aEncoding) ) : NULL; if( pKey && pValue ) aInfo.m_aContext.setValue( pKey, pValue ); aValue = aConfig.ReadKey( "MarginLeft", aDefMarginLeft ); - if( aValue.Len() ) - aInfo.m_nLeftMarginAdjust = aValue.ToInt32() - (int)((double)nLeft * 35.27777778 ); + if (!aValue.isEmpty()) + aInfo.m_nLeftMarginAdjust = aValue.toInt32() - (int)((double)nLeft * 35.27777778 ); aValue = aConfig.ReadKey( "MarginRight", aDefMarginRight ); - if( aValue.Len() ) - aInfo.m_nRightMarginAdjust = aValue.ToInt32() - (int)((double)nRight * 35.27777778 ); + if (!aValue.isEmpty()) + aInfo.m_nRightMarginAdjust = aValue.toInt32() - (int)((double)nRight * 35.27777778 ); aValue = aConfig.ReadKey( "MarginTop", aDefMarginTop ); - if( aValue.Len() ) - aInfo.m_nTopMarginAdjust = aValue.ToInt32() - (int)((double)nTop * 35.27777778 ); + if (!aValue.isEmpty()) + aInfo.m_nTopMarginAdjust = aValue.toInt32() - (int)((double)nTop * 35.27777778 ); aValue = aConfig.ReadKey( "MarginBottom", aDefMarginBottom ); - if( aValue.Len() ) - aInfo.m_nBottomMarginAdjust = aValue.ToInt32() - (int)((double)nBottom * 35.27777778 ); + if (!aValue.isEmpty()) + aInfo.m_nBottomMarginAdjust = aValue.toInt32() - (int)((double)nBottom * 35.27777778 ); } aValue = aConfig.ReadKey( "Copies", aDefScale ); - if( aValue.Len() ) - aInfo.m_nCopies = aValue.ToInt32(); + if (!aValue.isEmpty()) + aInfo.m_nCopies = aValue.toInt32(); aValue = aConfig.ReadKey( "Comment" ); - aInfo.m_aComment = String( aValue, aEncoding ); + aInfo.m_aComment = rtl::OStringToOUString(aValue, aEncoding); aValue = aConfig.ReadKey( "Level" ); - if( aValue.Len() ) - aInfo.m_nPSLevel = aValue.ToInt32(); + if (!aValue.isEmpty()) + aInfo.m_nPSLevel = aValue.toInt32(); aValue = aConfig.ReadKey( "Orientation", aDefOrientation ); - if( aValue.Len() ) - aInfo.m_eOrientation = aValue.CompareIgnoreCaseToAscii( "landscape" ) == COMPARE_EQUAL ? orientation::Landscape : orientation::Portrait; + if (!aValue.isEmpty()) + aInfo.m_eOrientation = aValue.equalsIgnoreAsciiCase( "landscape" ) == COMPARE_EQUAL ? orientation::Landscape : orientation::Portrait; int nGroupKeys = aConfig.GetKeyCount(); for( int nPPDKey = 0; nPPDKey < nGroupKeys; nPPDKey++ ) { @@ -617,7 +619,7 @@ APOldPrinterPage::APOldPrinterPage( AddPrinterDialog* pParent ) aValue = aConfig.ReadKey( nPPDKey ); aPPDKey.Erase( 0, 4 ); const PPDKey* pKey = aInfo.m_pParser->getKey( String( aPPDKey, RTL_TEXTENCODING_ISO_8859_1 ) ); - const PPDValue* pValue = pKey ? ( aValue.Equals( "*nil" ) ? NULL : pKey->getValue( String( aValue, RTL_TEXTENCODING_ISO_8859_1 ) ) ) : NULL; + const PPDValue* pValue = pKey ? ( aValue.equalsL(RTL_CONSTASCII_STRINGPARAM("*nil")) ? NULL : pKey->getValue(rtl::OStringToOUString(aValue, RTL_TEXTENCODING_ISO_8859_1)) ) : NULL; if( pKey ) aInfo.m_aContext.setValue( pKey, pValue, true ); } diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index 0e4dab8fab85..5a441b4ef611 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -433,13 +433,13 @@ sal_Bool ImplSdPPTImport::Import() { sal_uInt32 nPageNumber = 0; String aString( pHyperlink->aSubAdress ); - ByteString aStringAry[ 3 ]; + rtl::OString aStringAry[ 3 ]; sal_uInt16 nTokenCount = aString.GetTokenCount( ',' ); if ( nTokenCount > 3 ) nTokenCount = 3; sal_uInt16 nToken; for( nToken = 0; nToken < nTokenCount; nToken++ ) - aStringAry[ nToken ] = ByteString( aString.GetToken( nToken, (sal_Unicode)',' ), RTL_TEXTENCODING_UTF8 ); + aStringAry[nToken] = rtl::OUStringToOString(aString.GetToken( nToken, (sal_Unicode)',' ), RTL_TEXTENCODING_UTF8); sal_Bool bSucceeded = sal_False; @@ -448,7 +448,7 @@ sal_Bool ImplSdPPTImport::Import() { if (comphelper::string::isAsciiDecimalString(aStringAry[nToken])) { - sal_Int32 nNumber = aStringAry[ nToken ].ToInt32(); + sal_Int32 nNumber = aStringAry[ nToken ].toInt32(); if ( nNumber & ~0xff ) { PptSlidePersistList* pPageList = GetPageList( PPT_SLIDEPAGE ); @@ -486,7 +486,7 @@ sal_Bool ImplSdPPTImport::Import() { if (comphelper::string::isAsciiDecimalString(aStringAry[nToken])) { - sal_Int32 nNumber = aStringAry[ nToken ].ToInt32(); + sal_Int32 nNumber = aStringAry[ nToken ].toInt32(); if ( ( nNumber & ~0xff ) == 0 ) { nPageNumber = (sal_uInt32)nNumber - 1; diff --git a/sfx2/source/bastyp/mieclip.cxx b/sfx2/source/bastyp/mieclip.cxx index db1899e23b71..badd2003f3c8 100644 --- a/sfx2/source/bastyp/mieclip.cxx +++ b/sfx2/source/bastyp/mieclip.cxx @@ -48,27 +48,27 @@ SvStream* MSE40HTMLClipFormatObj::IsValid( SvStream& rStream ) if( pStrm ) delete pStrm, pStrm = 0; - ByteString sLine, sVersion; + rtl::OString sLine, sVersion; sal_uIntPtr nStt = 0, nEnd = 0; - sal_uInt16 nIndex = 0; + sal_Int32 nIndex = 0; rStream.Seek(STREAM_SEEK_TO_BEGIN); rStream.ResetError(); if( rStream.ReadLine( sLine ) && - sLine.GetToken( 0, ':', nIndex ) == "Version" ) + sLine.getToken( 0, ':', nIndex ) == "Version" ) { - sVersion = sLine.Copy( nIndex ); + sVersion = sLine.copy( nIndex ); while( rStream.ReadLine( sLine ) ) { nIndex = 0; - ByteString sTmp( sLine.GetToken( 0, ':', nIndex ) ); - if( sTmp == "StartHTML" ) - nStt = (sal_uIntPtr)(sLine.Erase( 0, nIndex ).ToInt32()); - else if( sTmp == "EndHTML" ) - nEnd = (sal_uIntPtr)(sLine.Erase( 0, nIndex ).ToInt32()); - else if( sTmp == "SourceURL" ) - sBaseURL = String(S2U(sLine.Erase( 0, nIndex ))); + rtl::OString sTmp(sLine.getToken(0, ':', nIndex)); + if (sTmp.equalsL(RTL_CONSTASCII_STRINGPARAM("StartHTML"))) + nStt = (sal_uIntPtr)(sLine.copy(nIndex).toInt32()); + else if (sTmp.equalsL(RTL_CONSTASCII_STRINGPARAM("EndHTML"))) + nEnd = (sal_uIntPtr)(sLine.copy(nIndex).toInt32()); + else if (sTmp.equalsL(RTL_CONSTASCII_STRINGPARAM("SourceURL"))) + sBaseURL = S2U(sLine.copy(nIndex)); if( nEnd && nStt && ( sBaseURL.Len() || rStream.Tell() >= nStt )) |