diff options
author | Mikhail Voytenko <mav@openoffice.org> | 2010-08-13 13:28:45 +0200 |
---|---|---|
committer | Mikhail Voytenko <mav@openoffice.org> | 2010-08-13 13:28:45 +0200 |
commit | 4d949990ef1438fcae98262519c6af2b47e5ccf5 (patch) | |
tree | 5558866d1cf362722da718bfb9e93c6dc93aa94d | |
parent | d2aa21c67466637572b0fbd06cc941c1d60d9dc4 (diff) |
mib18: #163225# support long strings in basic
-rw-r--r-- | basic/inc/basic/sbxvar.hxx | 12 | ||||
-rwxr-xr-x | basic/source/classes/sbunoobj.cxx | 2 | ||||
-rw-r--r-- | basic/source/sbx/sbxbool.cxx | 18 | ||||
-rw-r--r-- | basic/source/sbx/sbxbyte.cxx | 10 | ||||
-rw-r--r-- | basic/source/sbx/sbxchar.cxx | 15 | ||||
-rw-r--r-- | basic/source/sbx/sbxconv.hxx | 16 | ||||
-rw-r--r-- | basic/source/sbx/sbxcurr.cxx | 26 | ||||
-rw-r--r-- | basic/source/sbx/sbxdate.cxx | 12 | ||||
-rw-r--r-- | basic/source/sbx/sbxdbl.cxx | 10 | ||||
-rw-r--r-- | basic/source/sbx/sbxdec.cxx | 20 | ||||
-rw-r--r-- | basic/source/sbx/sbxdec.hxx | 4 | ||||
-rw-r--r-- | basic/source/sbx/sbxint.cxx | 38 | ||||
-rw-r--r-- | basic/source/sbx/sbxlng.cxx | 10 | ||||
-rw-r--r-- | basic/source/sbx/sbxres.cxx | 2 | ||||
-rw-r--r-- | basic/source/sbx/sbxres.hxx | 2 | ||||
-rw-r--r-- | basic/source/sbx/sbxscan.cxx | 37 | ||||
-rw-r--r-- | basic/source/sbx/sbxsng.cxx | 10 | ||||
-rw-r--r-- | basic/source/sbx/sbxstr.cxx | 50 | ||||
-rw-r--r-- | basic/source/sbx/sbxuint.cxx | 10 | ||||
-rw-r--r-- | basic/source/sbx/sbxulng.cxx | 10 | ||||
-rw-r--r-- | basic/source/sbx/sbxvalue.cxx | 105 | ||||
-rw-r--r-- | basic/source/sbx/sbxvar.cxx | 40 |
22 files changed, 235 insertions, 224 deletions
diff --git a/basic/inc/basic/sbxvar.hxx b/basic/inc/basic/sbxvar.hxx index 4d9d19b52a59..0cddcbdf8d17 100644 --- a/basic/inc/basic/sbxvar.hxx +++ b/basic/inc/basic/sbxvar.hxx @@ -178,7 +178,7 @@ struct SbxValues sal_uInt64 uInt64; int nInt; unsigned int nUInt; - String* pString; + ::rtl::OUString* pOUString; SbxDecimal* pDecimal; SbxBase* pObj; @@ -212,7 +212,7 @@ struct SbxValues SbxValues( double _nDouble ): nDouble( _nDouble ), eType(SbxDOUBLE) {} SbxValues( int _nInt ): nInt( _nInt ), eType(SbxINT) {} SbxValues( unsigned int _nUInt ): nUInt( _nUInt ), eType(SbxUINT) {} - SbxValues( const String* _pString ): pString( (String*) _pString ), eType(SbxSTRING) {} + SbxValues( const ::rtl::OUString* _pString ): pOUString( (::rtl::OUString*)_pString ), eType(SbxSTRING) {} SbxValues( SbxBase* _pObj ): pObj( _pObj ), eType(SbxOBJECT) {} SbxValues( sal_Unicode* _pChar ): pChar( _pChar ), eType(SbxLPSTR) {} SbxValues( void* _pData ): pData( _pData ), eType(SbxPOINTER) {} @@ -237,7 +237,8 @@ class SbxValue : public SbxBase SbxValue* TheRealValue() const; protected: SbxValues aData; // Data - String aPic; // Picture-String + ::rtl::OUString aPic; // Picture-String + String aToolString; // tool string copy virtual void Broadcast( ULONG ); // Broadcast-Call virtual ~SbxValue(); @@ -303,6 +304,7 @@ public: UINT16 GetErr() const; const String& GetString() const; const String& GetCoreString() const; + ::rtl::OUString GetOUString() const; SbxDecimal* GetDecimal() const; SbxBase* GetObject() const; BOOL HasObject() const; @@ -325,8 +327,8 @@ public: BOOL PutDate( double ); BOOL PutBool( BOOL ); BOOL PutErr( USHORT ); - BOOL PutStringExt( const String& ); // with extended analysis (International, "TRUE"/"FALSE") - BOOL PutString( const String& ); + BOOL PutStringExt( const ::rtl::OUString& ); // with extended analysis (International, "TRUE"/"FALSE") + BOOL PutString( const ::rtl::OUString& ); BOOL PutString( const sal_Unicode* ); // Type = SbxSTRING BOOL PutpChar( const sal_Unicode* ); // Type = SbxLPSTR BOOL PutDecimal( SbxDecimal* pDecimal ); diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 7de2d0c02320..3e775613198b 100755 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -1461,7 +1461,7 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty aRetVal.setValue( &c , getCharCppuType() ); break; } - case TypeClass_STRING: aRetVal <<= ::rtl::OUString( pVar->GetString() ); break; + case TypeClass_STRING: aRetVal <<= pVar->GetOUString(); break; case TypeClass_FLOAT: aRetVal <<= pVar->GetSingle(); break; case TypeClass_DOUBLE: aRetVal <<= pVar->GetDouble(); break; //case TypeClass_OCTET: break; diff --git a/basic/source/sbx/sbxbool.cxx b/basic/source/sbx/sbxbool.cxx index 728b8e1472b0..3216e401b707 100644 --- a/basic/source/sbx/sbxbool.cxx +++ b/basic/source/sbx/sbxbool.cxx @@ -87,21 +87,20 @@ enum SbxBOOL ImpGetBool( const SbxValues* p ) case SbxSTRING: case SbxLPSTR: nRes = SbxFALSE; - if( p->pString ) + if ( p->pOUString ) { - if( p->pString->EqualsIgnoreCaseAscii( SbxRes( STRING_TRUE ) ) ) + if( p->pOUString->equalsIgnoreAsciiCase( SbxRes( STRING_TRUE ) ) ) nRes = SbxTRUE; - else if( !p->pString->EqualsIgnoreCaseAscii( SbxRes( STRING_FALSE ) ) ) + else if( p->pOUString->equalsIgnoreAsciiCase( SbxRes( STRING_FALSE ) ) ) { // Jetzt kann es noch in eine Zahl konvertierbar sein BOOL bError = TRUE; double n; SbxDataType t; USHORT nLen = 0; - String s( *p->pString ); - if( ImpScan( s, n, t, &nLen ) == SbxERR_OK ) + if( ImpScan( *p->pOUString, n, t, &nLen ) == SbxERR_OK ) { - if( nLen == s.Len() ) + if( nLen == p->pOUString->getLength() ) { bError = FALSE; if( n != 0.0 ) @@ -202,9 +201,10 @@ void ImpPutBool( SbxValues* p, INT16 n ) case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) - p->pString = new XubString; - *p->pString = SbxRes( n ? STRING_TRUE : STRING_FALSE ); + if ( !p->pOUString ) + p->pOUString = new ::rtl::OUString( SbxRes( n ? STRING_TRUE : STRING_FALSE ) ); + else + *p->pOUString = SbxRes( n ? STRING_TRUE : STRING_FALSE ); break; case SbxOBJECT: diff --git a/basic/source/sbx/sbxbyte.cxx b/basic/source/sbx/sbxbyte.cxx index 8485b7105e21..e13c63967fc3 100644 --- a/basic/source/sbx/sbxbyte.cxx +++ b/basic/source/sbx/sbxbyte.cxx @@ -165,13 +165,13 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) + if( !p->pOUString ) nRes = 0; else { double d; SbxDataType t; - if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK ) + if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK ) nRes = 0; else if( d > SbxMAXBYTE ) { @@ -279,9 +279,9 @@ void ImpPutByte( SbxValues* p, BYTE n ) case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) - p->pString = new XubString; - ImpCvtNum( (double) n, 0, *p->pString ); + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; + ImpCvtNum( (double) n, 0, *p->pOUString ); break; case SbxOBJECT: { diff --git a/basic/source/sbx/sbxchar.cxx b/basic/source/sbx/sbxchar.cxx index f9bca67a28d9..bd4ce91f451b 100644 --- a/basic/source/sbx/sbxchar.cxx +++ b/basic/source/sbx/sbxchar.cxx @@ -39,7 +39,7 @@ using namespace rtl; xub_Unicode ImpGetChar( const SbxValues* p ) { SbxValues aTmp; - xub_Unicode nRes; + xub_Unicode nRes = 0; start: switch( +p->eType ) { @@ -156,13 +156,11 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) - nRes = 0; - else + if ( p->pOUString ) { double d; SbxDataType t; - if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK ) + if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK ) nRes = 0; else if( d > SbxMAXCHAR ) { @@ -274,9 +272,10 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) - p->pString = new XubString; - *p->pString = n; + if ( !p->pOUString ) + p->pOUString = new ::rtl::OUString( n ); + else + *p->pOUString = ::rtl::OUString( n ); break; case SbxOBJECT: { diff --git a/basic/source/sbx/sbxconv.hxx b/basic/source/sbx/sbxconv.hxx index c1ada75286ab..16fec542cded 100644 --- a/basic/source/sbx/sbxconv.hxx +++ b/basic/source/sbx/sbxconv.hxx @@ -33,13 +33,13 @@ class SbxArray; // SBXSCAN.CXX -extern void ImpCvtNum( double nNum, short nPrec, String& rRes, BOOL bCoreString=FALSE ); +extern void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString& rRes, BOOL bCoreString=FALSE ); extern SbxError ImpScan - ( const String& rSrc, double& nVal, SbxDataType& rType, USHORT* pLen, + ( const ::rtl::OUString& rSrc, double& nVal, SbxDataType& rType, USHORT* pLen, BOOL bAllowIntntl=FALSE, BOOL bOnlyIntntl=FALSE ); // mit erweiterter Auswertung (International, "TRUE"/"FALSE") -extern BOOL ImpConvStringExt( String& rSrc, SbxDataType eTargetType ); +extern BOOL ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType ); // SBXINT.CXX @@ -116,9 +116,9 @@ void ImpPutDate( SbxValues*, double ); // SBXSTR.CXX -String ImpGetString( const SbxValues* ); -String ImpGetCoreString( const SbxValues* ); -void ImpPutString( SbxValues*, const String* ); +::rtl::OUString ImpGetString( const SbxValues* ); +::rtl::OUString ImpGetCoreString( const SbxValues* ); +void ImpPutString( SbxValues*, const ::rtl::OUString* ); // SBXCHAR.CXX @@ -145,7 +145,7 @@ enum SbxBOOL ImpGetBool( const SbxValues* ); void ImpPutBool( SbxValues*, INT16 ); // ByteArry <--> String -SbxArray* StringToByteArray(const String& rStr); -String ByteArrayToString(SbxArray* pArr); +SbxArray* StringToByteArray(const ::rtl::OUString& rStr); +::rtl::OUString ByteArrayToString(SbxArray* pArr); #endif diff --git a/basic/source/sbx/sbxcurr.cxx b/basic/source/sbx/sbxcurr.cxx index 74380f84a75f..e27b11d5166c 100644 --- a/basic/source/sbx/sbxcurr.cxx +++ b/basic/source/sbx/sbxcurr.cxx @@ -37,8 +37,8 @@ #include <basic/sbxvar.hxx> #include "sbxconv.hxx" -static String ImpCurrencyToString( const SbxINT64& ); -static SbxINT64 ImpStringToCurrency( const String& ); +static ::rtl::OUString ImpCurrencyToString( const SbxINT64& ); +static SbxINT64 ImpStringToCurrency( const ::rtl::OUString& ); SbxINT64 ImpGetCurrency( const SbxValues* p ) { @@ -121,10 +121,10 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) + if( !p->pOUString ) nRes.SetNull(); else - nRes = ImpStringToCurrency( *p->pString ); + nRes = ImpStringToCurrency( *p->pOUString ); break; case SbxOBJECT: { @@ -224,10 +224,10 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) - p->pString = new XubString; + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; - *p->pString = ImpCurrencyToString( r ); + *p->pOUString = ImpCurrencyToString( r ); break; case SbxOBJECT: { @@ -319,7 +319,7 @@ start: // Hilfs-Funktionen zur Wandlung -static String ImpCurrencyToString( const SbxINT64 &r ) +static ::rtl::OUString ImpCurrencyToString( const SbxINT64 &r ) { BigInt a10000 = 10000; @@ -331,20 +331,20 @@ static String ImpCurrencyToString( const SbxINT64 &r ) aFrac %= a10000; aFrac += a10000; - String aString; + ::rtl::OUString aString; if( r.nHigh < 0 ) - aString = '-'; + aString = ::rtl::OUString( (sal_Unicode)'-' ); aString += aInt.GetString(); - aString += '.'; + aString += ::rtl::OUString( (sal_Unicode)'.' ); aString += aFrac.GetString().GetBuffer()+1; return aString; } -static SbxINT64 ImpStringToCurrency( const String &r ) +static SbxINT64 ImpStringToCurrency( const ::rtl::OUString &r ) { int nDec = 4; String aStr; - const sal_Unicode* p = r.GetBuffer(); + const sal_Unicode* p = r.getStr(); if( *p == '-' ) aStr += *p++; diff --git a/basic/source/sbx/sbxdate.cxx b/basic/source/sbx/sbxdate.cxx index ce532fed0482..3a0636e4e7fc 100644 --- a/basic/source/sbx/sbxdate.cxx +++ b/basic/source/sbx/sbxdate.cxx @@ -86,7 +86,7 @@ double ImpGetDate( const SbxValues* p ) case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) + if( !p->pOUString ) nRes = 0; else { @@ -126,7 +126,7 @@ double ImpGetDate( const SbxValues* p ) pFormatter->PutandConvertEntry( aStr, nCheckPos, nType, nIndex, LANGUAGE_GERMAN, eLangType ); - BOOL bSuccess = pFormatter->IsNumberFormat( *p->pString, nIndex, nRes ); + BOOL bSuccess = pFormatter->IsNumberFormat( *p->pOUString, nIndex, nRes ); if ( bSuccess ) { short nType_ = pFormatter->GetType( nIndex ); @@ -248,8 +248,8 @@ start: case SbxLPSTR: #ifndef DOS { - if( !p->pString ) - p->pString = new XubString; + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; Color* pColor; LanguageType eLangType = GetpApp()->GetSettings().GetLanguage(); @@ -299,7 +299,9 @@ start: nIndex, LANGUAGE_GERMAN, eLangType ); - pFormatter->GetOutputString( n, nIndex, *p->pString, &pColor ); + String aTmpString; + pFormatter->GetOutputString( n, nIndex, aTmpString, &pColor ); + *p->pOUString = aTmpString; delete pFormatter; #endif break; diff --git a/basic/source/sbx/sbxdbl.cxx b/basic/source/sbx/sbxdbl.cxx index 460f331c59b8..be55d3409131 100644 --- a/basic/source/sbx/sbxdbl.cxx +++ b/basic/source/sbx/sbxdbl.cxx @@ -76,7 +76,7 @@ double ImpGetDouble( const SbxValues* p ) case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) + if( !p->pOUString ) { nRes = 0; if ( SbiRuntime::isVBAEnabled() )// VBA only behaviour @@ -86,7 +86,7 @@ double ImpGetDouble( const SbxValues* p ) { double d; SbxDataType t; - if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK ) + if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK ) { nRes = 0; if ( SbiRuntime::isVBAEnabled() )// VBA only behaviour @@ -188,9 +188,9 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) - p->pString = new XubString; - ImpCvtNum( (double) n, 14, *p->pString, bCoreString ); + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; + ImpCvtNum( (double) n, 14, *p->pOUString, bCoreString ); break; case SbxOBJECT: { diff --git a/basic/source/sbx/sbxdec.cxx b/basic/source/sbx/sbxdec.cxx index 319b0aac366c..2191d91c8d82 100644 --- a/basic/source/sbx/sbxdec.cxx +++ b/basic/source/sbx/sbxdec.cxx @@ -211,7 +211,7 @@ void SbxDecimal::setUInt( unsigned int val ) // sbxscan.cxx void ImpGetIntntlSep( sal_Unicode& rcDecimalSep, sal_Unicode& rcThousandSep ); -bool SbxDecimal::setString( String* pString ) +bool SbxDecimal::setString( ::rtl::OUString* pOUString ) { static LCID nLANGID = MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US ); @@ -224,11 +224,11 @@ bool SbxDecimal::setString( String* pString ) HRESULT hResult; if( cDecimalSep != '.' || cThousandSep != ',' ) { - int nLen = pString->Len(); + int nLen = pOUString->getLength(); sal_Unicode* pBuffer = new sal_Unicode[nLen + 1]; pBuffer[nLen] = 0; - const sal_Unicode* pSrc = pString->GetBuffer(); + const sal_Unicode* pSrc = pOUString->getStr(); int i; for( i = 0 ; i < nLen ; ++i ) pBuffer[i] = pSrc[i]; @@ -248,7 +248,7 @@ bool SbxDecimal::setString( String* pString ) } else { - hResult = VarDecFromStr( (OLECHAR*)pString->GetBuffer(), nLANGID, 0, &maDec ); + hResult = VarDecFromStr( (OLECHAR*)pOUString->getStr(), nLANGID, 0, &maDec ); } bRet = ( hResult == S_OK ); return bRet; @@ -373,7 +373,7 @@ bool SbxDecimal::setSingle( float val ) { (void)val; return false; } bool SbxDecimal::setDouble( double val ) { (void)val; return false; } void SbxDecimal::setInt( int val ) { (void)val; } void SbxDecimal::setUInt( unsigned int val ) { (void)val; } -bool SbxDecimal::setString( String* pString ) { (void)pString; return false; } +bool SbxDecimal::setString( ::rtl::OUString* pOUString ) { (void)pOUString; return false; } bool SbxDecimal::getChar( sal_Unicode& rVal ) { (void)rVal; return false; } bool SbxDecimal::getByte( BYTE& rVal ) { (void)rVal; return false; } @@ -388,7 +388,7 @@ bool SbxDecimal::getUInt( unsigned int& rVal ) { (void)rVal; return false; } #endif -bool SbxDecimal::getString( String& rString ) +bool SbxDecimal::getString( ::rtl::OUString& rString ) { #ifdef WIN32 static LCID nLANGID = MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US ); @@ -528,7 +528,7 @@ start: case SbxLPSTR: case SbxSTRING: case SbxBYREF | SbxSTRING: - pnDecRes->setString( p->pString ); break; + pnDecRes->setString( p->pOUString ); break; case SbxOBJECT: { SbxValue* pVal = PTR_CAST(SbxValue,p->pObj); @@ -670,10 +670,10 @@ start: case SbxLPSTR: case SbxSTRING: case SbxBYREF | SbxSTRING: - if( !p->pString ) - p->pString = new XubString; + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; // ImpCvtNum( (double) n, 0, *p->pString ); - pDec->getString( *p->pString ); + pDec->getString( *p->pOUString ); break; case SbxOBJECT: { diff --git a/basic/source/sbx/sbxdec.hxx b/basic/source/sbx/sbxdec.hxx index 03f97bec5992..cd80bbad282e 100644 --- a/basic/source/sbx/sbxdec.hxx +++ b/basic/source/sbx/sbxdec.hxx @@ -85,7 +85,7 @@ public: bool setDouble( double val ); void setInt( int val ); void setUInt( unsigned int val ); - bool setString( String* pString ); + bool setString( ::rtl::OUString* pOUString ); void setDecimal( SbxDecimal* pDecimal ) { #ifdef WIN32 @@ -106,7 +106,7 @@ public: bool getDouble( double& rVal ); bool getInt( int& rVal ); bool getUInt( unsigned int& rVal ); - bool getString( String& rString ); + bool getString( ::rtl::OUString& rString ); bool operator -= ( const SbxDecimal &r ); bool operator += ( const SbxDecimal &r ); diff --git a/basic/source/sbx/sbxint.cxx b/basic/source/sbx/sbxint.cxx index 406b8599e568..47c38aecb1c2 100644 --- a/basic/source/sbx/sbxint.cxx +++ b/basic/source/sbx/sbxint.cxx @@ -154,13 +154,13 @@ start: case SbxLPSTR: case SbxSTRING: case SbxBYREF | SbxSTRING: - if( !p->pString ) + if( !p->pOUString ) nRes = 0; else { double d; SbxDataType t; - if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK ) + if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK ) nRes = 0; else if( d > SbxMAXINT ) { @@ -275,9 +275,9 @@ start: case SbxLPSTR: case SbxSTRING: case SbxBYREF | SbxSTRING: - if( !p->pString ) - p->pString = new XubString; - ImpCvtNum( (double) n, 0, *p->pString ); + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; + ImpCvtNum( (double) n, 0, *p->pOUString ); break; case SbxOBJECT: { @@ -456,20 +456,19 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) + if( !p->pOUString ) nRes = 0; else { - ::rtl::OUString aOUStr( *p->pString ); ::rtl::OString aOStr = ::rtl::OUStringToOString - ( aOUStr, RTL_TEXTENCODING_ASCII_US ); + ( *p->pOUString, RTL_TEXTENCODING_ASCII_US ); nRes = aOStr.toInt64(); if( nRes == 0 ) { // Check if really 0 or invalid conversion double d; SbxDataType t; - if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK ) + if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK ) nRes = 0; else nRes = ImpDoubleToSalInt64( d ); @@ -575,13 +574,12 @@ start: case SbxSTRING: case SbxLPSTR: { - if( !p->pString ) - p->pString = new XubString; + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; ::rtl::OString aOStr = ::rtl::OString::valueOf( n ); - ::rtl::OUString aOUStr = ::rtl::OStringToOUString + (*p->pOUString) = ::rtl::OStringToOUString ( aOStr, RTL_TEXTENCODING_ASCII_US ); - (*p->pString) = aOUStr; break; } case SbxOBJECT: @@ -745,20 +743,19 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) + if( !p->pOUString ) nRes = 0; else { - ::rtl::OUString aOUStr( *p->pString ); ::rtl::OString aOStr = ::rtl::OUStringToOString - ( aOUStr, RTL_TEXTENCODING_ASCII_US ); + ( *p->pOUString, RTL_TEXTENCODING_ASCII_US ); sal_Int64 n64 = aOStr.toInt64(); if( n64 == 0 ) { // Check if really 0 or invalid conversion double d; SbxDataType t; - if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK ) + if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK ) nRes = 0; else if( d > SbxMAXSALUINT64 ) { @@ -879,16 +876,15 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) - p->pString = new XubString; + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; if( n > SbxMAXSALINT64 ) SbxBase::SetError( SbxERR_CONVERSION ); else { ::rtl::OString aOStr = ::rtl::OString::valueOf( (sal_Int64)n ); - ::rtl::OUString aOUStr = ::rtl::OStringToOUString + (*p->pOUString) = ::rtl::OStringToOUString ( aOStr, RTL_TEXTENCODING_ASCII_US ); - (*p->pString) = aOUStr; } break; case SbxOBJECT: diff --git a/basic/source/sbx/sbxlng.cxx b/basic/source/sbx/sbxlng.cxx index c84b087dfc33..1cf2d84061f9 100644 --- a/basic/source/sbx/sbxlng.cxx +++ b/basic/source/sbx/sbxlng.cxx @@ -119,13 +119,13 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) + if( !p->pOUString ) nRes = 0; else { double d; SbxDataType t; - if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK ) + if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK ) nRes = 0; else if( d > SbxMAXLNG ) { @@ -240,9 +240,9 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) - p->pString = new XubString; - ImpCvtNum( (double) n, 0, *p->pString ); + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; + ImpCvtNum( (double) n, 0, *p->pOUString ); break; case SbxOBJECT: { diff --git a/basic/source/sbx/sbxres.cxx b/basic/source/sbx/sbxres.cxx index f42c400afd91..369349e72069 100644 --- a/basic/source/sbx/sbxres.cxx +++ b/basic/source/sbx/sbxres.cxx @@ -86,6 +86,6 @@ const char* GetSbxRes( USHORT nId ) } SbxRes::SbxRes( USHORT nId ) - : XubString( String::CreateFromAscii( GetSbxRes( nId ) ) ) + : ::rtl::OUString( ::rtl::OUString::createFromAscii( GetSbxRes( nId ) ) ) {} diff --git a/basic/source/sbx/sbxres.hxx b/basic/source/sbx/sbxres.hxx index 8cd0ad26e951..8ed3c7054278 100644 --- a/basic/source/sbx/sbxres.hxx +++ b/basic/source/sbx/sbxres.hxx @@ -75,7 +75,7 @@ #define SBXRES_MAX 44 -class SbxRes : public String +class SbxRes : public ::rtl::OUString { public: SbxRes( USHORT ); diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx index 3d45818e6401..b8aad9bbf2e4 100644 --- a/basic/source/sbx/sbxscan.cxx +++ b/basic/source/sbx/sbxscan.cxx @@ -71,10 +71,10 @@ void ImpGetIntntlSep( sal_Unicode& rcDecimalSep, sal_Unicode& rcThousandSep ) // Das ganze gibt auch noch einen Konversionsfehler, wenn der Datentyp // Fixed ist und das ganze nicht hineinpasst! -SbxError ImpScan( const XubString& rWSrc, double& nVal, SbxDataType& rType, +SbxError ImpScan( const ::rtl::OUString& rWSrc, double& nVal, SbxDataType& rType, USHORT* pLen, BOOL bAllowIntntl, BOOL bOnlyIntntl ) { - ByteString aBStr( rWSrc, RTL_TEXTENCODING_ASCII_US ); + ::rtl::OString aBStr( ::rtl::OUStringToOString( rWSrc, RTL_TEXTENCODING_ASCII_US ) ); // Bei International Komma besorgen char cIntntlComma, cIntntl1000; @@ -100,7 +100,7 @@ SbxError ImpScan( const XubString& rWSrc, double& nVal, SbxDataType& rType, cIntntl1000 = (char)cThousandSep; } - const char* pStart = aBStr.GetBuffer(); + const char* pStart = aBStr.getStr(); const char* p = pStart; char buf[ 80 ], *q = buf; BOOL bRes = TRUE; @@ -391,7 +391,7 @@ static void myftoa( double nNum, char * pBuf, short nPrec, short nExpWidth, #pragma warning(disable: 4748) // "... because optimizations are disabled ..." #endif -void ImpCvtNum( double nNum, short nPrec, XubString& rRes, BOOL bCoreString ) +void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString& rRes, BOOL bCoreString ) { char *q; char cBuf[ 40 ], *p = cBuf; @@ -415,18 +415,18 @@ void ImpCvtNum( double nNum, short nPrec, XubString& rRes, BOOL bCoreString ) if( *p == cDecimalSep ) p--; while( *q ) *++p = *q++; *++p = 0; - rRes = String::CreateFromAscii( cBuf ); + rRes = ::rtl::OUString::createFromAscii( cBuf ); } #ifdef _MSC_VER #pragma optimize( "", on ) #endif -BOOL ImpConvStringExt( XubString& rSrc, SbxDataType eTargetType ) +BOOL ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType ) { // Merken, ob ueberhaupt was geaendert wurde BOOL bChanged = FALSE; - String aNewString; + ::rtl::OUString aNewString; // Nur Spezial-Flle behandeln, als Default tun wir nichts switch( eTargetType ) @@ -436,7 +436,7 @@ BOOL ImpConvStringExt( XubString& rSrc, SbxDataType eTargetType ) case SbxDOUBLE: case SbxCURRENCY: { - ByteString aBStr( rSrc, RTL_TEXTENCODING_ASCII_US ); + ::rtl::OString aBStr( ::rtl::OUStringToOString( rSrc, RTL_TEXTENCODING_ASCII_US ) ); // Komma besorgen sal_Unicode cDecimalSep, cThousandSep; @@ -446,10 +446,11 @@ BOOL ImpConvStringExt( XubString& rSrc, SbxDataType eTargetType ) // Ersetzen, wenn DecimalSep kein '.' (nur den ersten) if( cDecimalSep != (sal_Unicode)'.' ) { - USHORT nPos = aNewString.Search( cDecimalSep ); - if( nPos != STRING_NOTFOUND ) + sal_Int32 nPos = aNewString.indexOf( cDecimalSep ); + if( nPos != -1 ) { - aNewString.SetChar( nPos, '.' ); + sal_Unicode* pStr = (sal_Unicode*)aNewString.getStr(); + pStr[nPos] = (sal_Unicode)'.'; bChanged = TRUE; } } @@ -459,15 +460,15 @@ BOOL ImpConvStringExt( XubString& rSrc, SbxDataType eTargetType ) // Bei BOOL TRUE und FALSE als String pruefen case SbxBOOL: { - if( rSrc.EqualsIgnoreCaseAscii( "true" ) ) + if( rSrc.equalsIgnoreAsciiCaseAscii( "true" ) ) { - aNewString = String::CreateFromInt32(SbxTRUE); + aNewString = ::rtl::OUString::valueOf( (sal_Int32)SbxTRUE ); bChanged = TRUE; } else - if( rSrc.EqualsIgnoreCaseAscii( "false" ) ) + if( rSrc.equalsIgnoreAsciiCaseAscii( "false" ) ) { - aNewString = String::CreateFromInt32(SbxFALSE); + aNewString = ::rtl::OUString::valueOf( (sal_Int32)SbxFALSE ); bChanged = TRUE; } break; @@ -935,7 +936,11 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const //old: printfmtnum( GetDouble(), rRes, *pFmt ); } else - ImpCvtNum( GetDouble(), nComma, rRes ); + { + ::rtl::OUString aTmpString( rRes ); + ImpCvtNum( GetDouble(), nComma, aTmpString ); + rRes = aTmpString; + } break; case SbxSTRING: if( pFmt ) diff --git a/basic/source/sbx/sbxsng.cxx b/basic/source/sbx/sbxsng.cxx index 82507dbe15e9..70ef1653666b 100644 --- a/basic/source/sbx/sbxsng.cxx +++ b/basic/source/sbx/sbxsng.cxx @@ -112,13 +112,13 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) + if( !p->pOUString ) nRes = 0; else { double d; SbxDataType t; - if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK ) + if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK ) nRes = 0; else if( d > SbxMAXSNG ) { @@ -237,9 +237,9 @@ start: case SbxSTRING: case SbxLPSTR: { - if( !p->pString ) - p->pString = new XubString; - ImpCvtNum( (double) n, 6, *p->pString ); + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; + ImpCvtNum( (double) n, 6, *p->pOUString ); break; } case SbxOBJECT: diff --git a/basic/source/sbx/sbxstr.cxx b/basic/source/sbx/sbxstr.cxx index 6deb2da29ba1..b4156a116ddc 100644 --- a/basic/source/sbx/sbxstr.cxx +++ b/basic/source/sbx/sbxstr.cxx @@ -44,12 +44,12 @@ using namespace rtl; // Die Konversion eines Items auf String wird ueber die Put-Methoden // der einzelnen Datentypen abgewickelt, um doppelten Code zu vermeiden. -XubString ImpGetString( const SbxValues* p ) +::rtl::OUString ImpGetString( const SbxValues* p ) { SbxValues aTmp; - XubString aRes; + ::rtl::OUString aRes; aTmp.eType = SbxSTRING; - aTmp.pString = &aRes; + aTmp.pOUString = &aRes; switch( +p->eType ) { case SbxNULL: @@ -86,8 +86,8 @@ XubString ImpGetString( const SbxValues* p ) case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( p->pString ) - aRes = *p->pString; + if ( p->pOUString ) + *aTmp.pOUString = *p->pOUString; break; case SbxOBJECT: { @@ -109,7 +109,7 @@ XubString ImpGetString( const SbxValues* p ) case SbxERROR: // Hier wird der String "Error n" erzeugt aRes = SbxRes( STRING_ERRORMSG ); - aRes += p->nUShort; break; + aRes += ::rtl::OUString( p->nUShort ); break; case SbxDATE: ImpPutDate( &aTmp, p->nDouble ); break; @@ -145,7 +145,7 @@ XubString ImpGetString( const SbxValues* p ) } // AB 10.4.97, neue Funktion fuer SbxValue::GetCoreString() -XubString ImpGetCoreString( const SbxValues* p ) +::rtl::OUString ImpGetCoreString( const SbxValues* p ) { // Vorerst nur fuer double if( ( p->eType & (~SbxBYREF) ) == SbxDOUBLE ) @@ -153,7 +153,6 @@ XubString ImpGetCoreString( const SbxValues* p ) SbxValues aTmp; XubString aRes; aTmp.eType = SbxSTRING; - aTmp.pString = &aRes; if( p->eType == SbxDOUBLE ) ImpPutDouble( &aTmp, p->nDouble, /*bCoreString=*/TRUE ); else @@ -164,15 +163,15 @@ XubString ImpGetCoreString( const SbxValues* p ) return ImpGetString( p ); } -void ImpPutString( SbxValues* p, const XubString* n ) +void ImpPutString( SbxValues* p, const ::rtl::OUString* n ) { SbxValues aTmp; aTmp.eType = SbxSTRING; - XubString* pTmp = NULL; + ::rtl::OUString* pTmp = NULL; // Sicherheitshalber, falls ein NULL-Ptr kommt if( !n ) - n = pTmp = new XubString; - aTmp.pString = (XubString*) n; + n = pTmp = new ::rtl::OUString; + aTmp.pOUString = (::rtl::OUString*)n; switch( +p->eType ) { case SbxCHAR: @@ -209,14 +208,15 @@ void ImpPutString( SbxValues* p, const XubString* n ) case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( n->Len() ) + if( n->getLength() ) { - if( !p->pString ) - p->pString = new XubString; - *p->pString = *n; + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString( *n ); + else + *p->pOUString = *n; } else - delete p->pString, p->pString = NULL; + delete p->pOUString, p->pOUString = NULL; break; case SbxOBJECT: { @@ -258,18 +258,18 @@ void ImpPutString( SbxValues* p, const XubString* n ) } // Convert string to an array of bytes, preserving unicode (2bytes per character) -SbxArray* StringToByteArray(const String& rStr) +SbxArray* StringToByteArray(const ::rtl::OUString& rStr) { - USHORT nArraySize = rStr.Len() * 2; - const sal_Unicode* pSrc = rStr.GetBuffer(); + sal_Int32 nArraySize = rStr.getLength() * 2; + const sal_Unicode* pSrc = rStr.getStr(); SbxDimArray* pArray = new SbxDimArray(SbxBYTE); bool bIncIndex = ( IsBaseIndexOne() && SbiRuntime::isVBAEnabled() ); if( nArraySize ) { if( bIncIndex ) - pArray->AddDim( 1, nArraySize ); + pArray->AddDim32( 1, nArraySize ); else - pArray->AddDim( 0, nArraySize-1 ); + pArray->AddDim32( 0, nArraySize-1 ); } else { @@ -290,7 +290,7 @@ SbxArray* StringToByteArray(const String& rStr) } // Convert an array of bytes to string (2bytes per character) -String ByteArrayToString(SbxArray* pArr) +::rtl::OUString ByteArrayToString(SbxArray* pArr) { USHORT nCount = pArr->Count(); OUStringBuffer aStrBuf; @@ -315,7 +315,5 @@ String ByteArrayToString(SbxArray* pArr) aStrBuf.append(aChar); } - String aStr(aStrBuf.makeStringAndClear()); - - return aStr; + return aStrBuf.makeStringAndClear(); } diff --git a/basic/source/sbx/sbxuint.cxx b/basic/source/sbx/sbxuint.cxx index ce0aea70b062..5b75a24d6d26 100644 --- a/basic/source/sbx/sbxuint.cxx +++ b/basic/source/sbx/sbxuint.cxx @@ -151,13 +151,13 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) + if( !p->pOUString ) nRes = 0; else { double d; SbxDataType t; - if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK ) + if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK ) nRes = 0; else if( d > SbxMAXUINT ) { @@ -272,9 +272,9 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) - p->pString = new XubString; - ImpCvtNum( (double) n, 0, *p->pString ); + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; + ImpCvtNum( (double) n, 0, *p->pOUString ); break; case SbxOBJECT: { diff --git a/basic/source/sbx/sbxulng.cxx b/basic/source/sbx/sbxulng.cxx index 3dd81b8c616d..e0f6f3fa421d 100644 --- a/basic/source/sbx/sbxulng.cxx +++ b/basic/source/sbx/sbxulng.cxx @@ -127,13 +127,13 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) + if( !p->pOUString ) nRes = 0; else { double d; SbxDataType t; - if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK ) + if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK ) nRes = 0; else if( d > SbxMAXULNG ) { @@ -246,9 +246,9 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) - p->pString = new XubString; - ImpCvtNum( (double) n, 0, *p->pString ); + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; + ImpCvtNum( (double) n, 0, *p->pOUString ); break; case SbxOBJECT: { diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index 7ee31af70556..4ea4836b701b 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -236,7 +236,7 @@ SbxValue::SbxValue( SbxDataType t, void* p ) : SbxBase() case SbxSINGLE: n |= SbxBYREF; aData.pSingle = (float*) p; break; case SbxDATE: case SbxDOUBLE: n |= SbxBYREF; aData.pDouble = (double*) p; break; - case SbxSTRING: n |= SbxBYREF; aData.pString = (XubString*) p; break; + case SbxSTRING: n |= SbxBYREF; aData.pOUString = (::rtl::OUString*) p; break; case SbxERROR: case SbxUSHORT: case SbxBOOL: n |= SbxBYREF; aData.pUShort = (UINT16*) p; break; @@ -280,8 +280,8 @@ SbxValue::SbxValue( const SbxValue& r ) switch( aData.eType ) { case SbxSTRING: - if( aData.pString ) - aData.pString = new XubString( *aData.pString ); + if( aData.pOUString ) + aData.pOUString = new ::rtl::OUString( *aData.pOUString ); break; case SbxOBJECT: if( aData.pObj ) @@ -309,7 +309,7 @@ SbxValue& SbxValue::operator=( const SbxValue& r ) && aData.pObj && ( aData.pObj->GetType() == (SbxARRAY | SbxBYTE) ) && (r.aData.eType == SbxSTRING) ) { - String aStr = r.GetString(); + ::rtl::OUString aStr = r.GetString(); SbxArray* pArr = StringToByteArray(aStr); PutObject(pArr); return *this; @@ -323,7 +323,7 @@ SbxValue& SbxValue::operator=( const SbxValue& r ) SbxArray* pArr = PTR_CAST(SbxArray, pObj); if( pArr ) { - String aStr = ByteArrayToString( pArr ); + ::rtl::OUString aStr = ByteArrayToString( pArr ); PutString(aStr); return *this; } @@ -385,7 +385,7 @@ void SbxValue::Clear() case SbxVOID: break; case SbxSTRING: - delete aData.pString; aData.pString = NULL; + delete aData.pOUString; aData.pOUString = NULL; break; case SbxOBJECT: if( aData.pObj ) @@ -551,9 +551,9 @@ BOOL SbxValue::Get( SbxValues& rRes ) const case SbxULONG: rRes.nULong = ImpGetULong( &p->aData ); break; case SbxLPSTR: case SbxSTRING: p->aPic = ImpGetString( &p->aData ); - rRes.pString = &p->aPic; break; + rRes.pOUString = &p->aPic; break; case SbxCoreSTRING: p->aPic = ImpGetCoreString( &p->aData ); - rRes.pString = &p->aPic; break; + rRes.pOUString = &p->aPic; break; case SbxINT: #if SAL_TYPES_SIZEOFINT == 2 rRes.nInt = (int) ImpGetInteger( &p->aData ); @@ -618,13 +618,11 @@ const XubString& SbxValue::GetString() const SbxValues aRes; aRes.eType = SbxSTRING; if( Get( aRes ) ) - // Geht in Ordnung, da Ptr eine Kopie ist - return *aRes.pString; + ((SbxValue*) this)->aToolString = *aRes.pOUString; else - { - ((SbxValue*) this)->aPic.Erase(); - return aPic; - } + ((SbxValue*) this)->aToolString.Erase(); + + return aToolString; } const XubString& SbxValue::GetCoreString() const @@ -632,13 +630,22 @@ const XubString& SbxValue::GetCoreString() const SbxValues aRes; aRes.eType = SbxCoreSTRING; if( Get( aRes ) ) - // Geht in Ordnung, da Ptr eine Kopie ist - return *aRes.pString; + ((SbxValue*) this)->aToolString = *aRes.pOUString; else - { - ((SbxValue*) this)->aPic.Erase(); - return aPic; - } + ((SbxValue*) this)->aToolString.Erase(); + + return aToolString; +} + +::rtl::OUString SbxValue::GetOUString() const +{ + ::rtl::OUString aResult; + SbxValues aRes; + aRes.eType = SbxSTRING; + if( Get( aRes ) ) + aResult = *aRes.pOUString; + + return aResult; } BOOL SbxValue::HasObject() const @@ -727,7 +734,7 @@ BOOL SbxValue::Put( const SbxValues& rVal ) case SbxUSHORT: ImpPutUShort( &p->aData, rVal.nUShort ); break; case SbxULONG: ImpPutULong( &p->aData, rVal.nULong ); break; case SbxLPSTR: - case SbxSTRING: ImpPutString( &p->aData, rVal.pString ); break; + case SbxSTRING: ImpPutString( &p->aData, rVal.pOUString ); break; case SbxINT: #if SAL_TYPES_SIZEOFINT == 2 ImpPutInteger( &p->aData, (INT16) rVal.nInt ); @@ -803,10 +810,10 @@ BOOL SbxValue::Put( const SbxValues& rVal ) // werden koennen, wenn Floats mit ',' als Dezimaltrenner oder BOOLs // explizit mit "TRUE" oder "FALSE" angegeben werden. // Implementierung in ImpConvStringExt (SBXSCAN.CXX) -BOOL SbxValue::PutStringExt( const XubString& r ) +BOOL SbxValue::PutStringExt( const ::rtl::OUString& r ) { // Kopieren, bei Unicode gleich konvertieren - String aStr( r ); + ::rtl::OUString aStr( r ); // Eigenen Typ bestimmen (nicht wie in Put() mit TheRealValue(), // Objekte werden sowieso nicht behandelt) @@ -820,9 +827,9 @@ BOOL SbxValue::PutStringExt( const XubString& r ) // sonst Original (Unicode bleibt erhalten) BOOL bRet; if( ImpConvStringExt( aStr, eTargetType ) ) - aRes.pString = (XubString*)&aStr; + aRes.pOUString = (::rtl::OUString*)&aStr; else - aRes.pString = (XubString*)&r; + aRes.pOUString = (::rtl::OUString*)&r; // #34939: Bei Strings. die eine Zahl enthalten und wenn this einen // Num-Typ hat, Fixed-Flag setzen, damit der Typ nicht veraendert wird @@ -851,10 +858,10 @@ BOOL SbxValue::PutStringExt( const XubString& r ) BOOL SbxValue::PutString( const xub_Unicode* p ) { - XubString aVal( p ); + ::rtl::OUString aVal( p ); SbxValues aRes; aRes.eType = SbxSTRING; - aRes.pString = &aVal; + aRes.pOUString = &aVal; Put( aRes ); return BOOL( !IsError() ); } @@ -909,19 +916,19 @@ BOOL SbxValue::fillAutomationDecimal BOOL SbxValue::PutpChar( const xub_Unicode* p ) { - XubString aVal( p ); + ::rtl::OUString aVal( p ); SbxValues aRes; aRes.eType = SbxLPSTR; - aRes.pString = &aVal; + aRes.pOUString = &aVal; Put( aRes ); return BOOL( !IsError() ); } -BOOL SbxValue::PutString( const XubString& r ) +BOOL SbxValue::PutString( const ::rtl::OUString& r ) { SbxValues aRes; aRes.eType = SbxSTRING; - aRes.pString = (XubString*) &r; + aRes.pOUString = (::rtl::OUString*) &r; Put( aRes ); return BOOL( !IsError() ); } @@ -986,14 +993,14 @@ BOOL SbxValue::ImpIsNumeric( BOOL bOnlyIntntl ) const SbxDataType t = GetType(); if( t == SbxSTRING ) { - if( aData.pString ) + if( aData.pOUString ) { - XubString s( *aData.pString ); + ::rtl::OUString s( *aData.pOUString ); double n; SbxDataType t2; USHORT nLen = 0; if( ImpScan( s, n, t2, &nLen, /*bAllowIntntl*/FALSE, bOnlyIntntl ) == SbxERR_OK ) - return BOOL( nLen == s.Len() ); + return BOOL( nLen == s.getLength() ); } return FALSE; } @@ -1046,7 +1053,7 @@ BOOL SbxValue::SetType( SbxDataType t ) switch( aData.eType ) { case SbxSTRING: - delete aData.pString; + delete aData.pOUString; break; case SbxOBJECT: if( aData.pObj && aData.pObj != this ) @@ -1163,14 +1170,14 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp ) Get( aL ); // #30576: Erstmal testen, ob Wandlung geklappt hat - if( aL.pString != NULL && aR.pString != NULL ) + if( aL.pOUString != NULL && aR.pOUString != NULL ) { - *aL.pString += *aR.pString; + *aL.pOUString += *aR.pOUString; } // Nicht einmal Left OK? - else if( aL.pString == NULL ) + else if( aL.pOUString == NULL ) { - aL.pString = new String(); + aL.pOUString = new ::rtl::OUString(); } Put( aL ); } @@ -1493,17 +1500,17 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const if( Get( aL ) && rOp.Get( aR ) ) switch( eOp ) { case SbxEQ: - bRes = BOOL( *aL.pString == *aR.pString ); break; + bRes = BOOL( *aL.pOUString == *aR.pOUString ); break; case SbxNE: - bRes = BOOL( *aL.pString != *aR.pString ); break; + bRes = BOOL( *aL.pOUString != *aR.pOUString ); break; case SbxLT: - bRes = BOOL( *aL.pString < *aR.pString ); break; + bRes = BOOL( *aL.pOUString < *aR.pOUString ); break; case SbxGT: - bRes = BOOL( *aL.pString > *aR.pString ); break; + bRes = BOOL( *aL.pOUString > *aR.pOUString ); break; case SbxLE: - bRes = BOOL( *aL.pString <= *aR.pString ); break; + bRes = BOOL( *aL.pOUString <= *aR.pOUString ); break; case SbxGE: - bRes = BOOL( *aL.pString >= *aR.pString ); break; + bRes = BOOL( *aL.pOUString >= *aR.pOUString ); break; default: SetError( SbxERR_NOTIMP ); } @@ -1668,9 +1675,9 @@ BOOL SbxValue::LoadData( SvStream& r, USHORT ) XubString aVal; r.ReadByteString( aVal, RTL_TEXTENCODING_ASCII_US ); if( aVal.Len() ) - aData.pString = new XubString( aVal ); + aData.pOUString = new ::rtl::OUString( aVal ); else - aData.pString = NULL; // JSM 22.09.1995 + aData.pOUString = NULL; // JSM 22.09.1995 break; } case SbxERROR: @@ -1781,9 +1788,9 @@ BOOL SbxValue::StoreData( SvStream& r ) const break; } case SbxSTRING: - if( aData.pString ) + if( aData.pOUString ) { - r.WriteByteString( *aData.pString, RTL_TEXTENCODING_ASCII_US ); + r.WriteByteString( *aData.pOUString, RTL_TEXTENCODING_ASCII_US ); } else { diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx index 20060f1f7493..58e3c1ae92c2 100644 --- a/basic/source/sbx/sbxvar.cxx +++ b/basic/source/sbx/sbxvar.cxx @@ -239,9 +239,9 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const if( i ) aTmp += ','; if( q->nFlags & SBX_OPTIONAL ) - aTmp += SbxRes( STRING_OPTIONAL ); + aTmp += String( SbxRes( STRING_OPTIONAL ) ); if( q->eType & SbxBYREF ) - aTmp += SbxRes( STRING_BYREF ); + aTmp += String( SbxRes( STRING_BYREF ) ); aTmp += q->aName; cType = ' '; // Kurzer Typ? Dann holen, evtl. ist dieser 0. @@ -263,12 +263,12 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const // langer Typ? if( t != SbxNAME_SHORT ) { - aTmp += SbxRes( STRING_AS ); + aTmp += String( SbxRes( STRING_AS ) ); if( nt < 32 ) - aTmp += SbxRes( - sal::static_int_cast< USHORT >( STRING_TYPES + nt ) ); + aTmp += String( SbxRes( + sal::static_int_cast< USHORT >( STRING_TYPES + nt ) ) ); else - aTmp += SbxRes( STRING_ANY ); + aTmp += String( SbxRes( STRING_ANY ) ); } } } @@ -276,15 +276,15 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const // Langer Typ? Dann holen if( t == SbxNAME_LONG_TYPES && et != SbxEMPTY ) { - aTmp += SbxRes( STRING_AS ); + aTmp += String( SbxRes( STRING_AS ) ); if( et < 32 ) - aTmp += SbxRes( - sal::static_int_cast< USHORT >( STRING_TYPES + et ) ); + aTmp += String( SbxRes( + sal::static_int_cast< USHORT >( STRING_TYPES + et ) ) ); else - aTmp += SbxRes( STRING_ANY ); + aTmp += String( SbxRes( STRING_ANY ) ); } - ((SbxVariable*) this)->aPic = aTmp; - return aPic; + ((SbxVariable*) this)->aToolString = aTmp; + return aToolString; } // Einen simplen Hashcode erzeugen: Es werden die ersten 6 Zeichen gewertet. @@ -431,9 +431,10 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer ) if( nType == SbxNULL && GetClass() == SbxCLASS_METHOD ) nType = SbxEMPTY; SbxValues aTmp; - XubString aVal; + String aTmpString; + ::rtl::OUString aVal; aTmp.eType = aData.eType = (SbxDataType) nType; - aTmp.pString = &aVal; + aTmp.pOUString = &aVal; switch( nType ) { case SbxBOOL: @@ -445,10 +446,10 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer ) case SbxSINGLE: { // Floats als ASCII - rStrm.ReadByteString( aVal, RTL_TEXTENCODING_ASCII_US ); + rStrm.ReadByteString( aTmpString, RTL_TEXTENCODING_ASCII_US ); double d; SbxDataType t; - if( ImpScan( aVal, d, t, NULL ) != SbxERR_OK || t == SbxDOUBLE ) + if( ImpScan( aTmpString, d, t, NULL ) != SbxERR_OK || t == SbxDOUBLE ) { aTmp.nSingle = 0; return FALSE; @@ -460,9 +461,9 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer ) case SbxDOUBLE: { // Floats als ASCII - rStrm.ReadByteString( aVal, RTL_TEXTENCODING_ASCII_US ); + rStrm.ReadByteString( aTmpString, RTL_TEXTENCODING_ASCII_US ); SbxDataType t; - if( ImpScan( aVal, aTmp.nDouble, t, NULL ) != SbxERR_OK ) + if( ImpScan( aTmpString, aTmp.nDouble, t, NULL ) != SbxERR_OK ) { aTmp.nDouble = 0; return FALSE; @@ -470,7 +471,8 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer ) break; } case SbxSTRING: - rStrm.ReadByteString( aVal, RTL_TEXTENCODING_ASCII_US ); + rStrm.ReadByteString( aTmpString, RTL_TEXTENCODING_ASCII_US ); + aVal = aTmpString; break; case SbxEMPTY: case SbxNULL: |