make ReadUniOrByteString return a string

This commit is contained in:
Caolán McNamara 2012-01-06 08:50:03 +00:00
parent 0100280a5c
commit 2d3203b2db
28 changed files with 83 additions and 101 deletions

View File

@ -643,18 +643,15 @@ BasicLibInfo* BasicLibInfo::Create( SotStorageStream& rSStream )
pInfo->bDoLoad = bDoLoad; pInfo->bDoLoad = bDoLoad;
// The name of the lib... // The name of the lib...
String aName; String aName = rSStream.ReadUniOrByteString(rSStream.GetStreamCharSet());
rSStream.ReadUniOrByteString(aName, rSStream.GetStreamCharSet());
pInfo->SetLibName( aName ); pInfo->SetLibName( aName );
// Absolute path... // Absolute path...
String aStorageName; String aStorageName = rSStream.ReadUniOrByteString(rSStream.GetStreamCharSet());
rSStream.ReadUniOrByteString(aStorageName, rSStream.GetStreamCharSet());
pInfo->SetStorageName( aStorageName ); pInfo->SetStorageName( aStorageName );
// Relative path... // Relative path...
String aRelStorageName; String aRelStorageName = rSStream.ReadUniOrByteString(rSStream.GetStreamCharSet());
rSStream.ReadUniOrByteString(aRelStorageName, rSStream.GetStreamCharSet());
pInfo->SetRelStorageName( aRelStorageName ); pInfo->SetRelStorageName( aRelStorageName );
if ( nVer >= 2 ) if ( nVer >= 2 )
@ -1041,8 +1038,7 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage )
// and it proceeds ... // and it proceeds ...
} }
xManagerStream->Seek( nBasicEndOff+1 ); // +1: 0x00 as separator xManagerStream->Seek( nBasicEndOff+1 ); // +1: 0x00 as separator
String aLibs; String aLibs = xManagerStream->ReadUniOrByteString(xManagerStream->GetStreamCharSet());
xManagerStream->ReadUniOrByteString(aLibs, xManagerStream->GetStreamCharSet());
xManagerStream->SetBufferSize( 0 ); xManagerStream->SetBufferSize( 0 );
xManagerStream.Clear(); // Close stream xManagerStream.Clear(); // Close stream
@ -1235,8 +1231,7 @@ sal_Bool BasicManager::ImpLoadLibary( BasicLibInfo* pLibInfo, SotStorage* pCurSt
*xBasicStream >> nPasswordMarker; *xBasicStream >> nPasswordMarker;
if ( ( nPasswordMarker == PASSWORD_MARKER ) && !xBasicStream->IsEof() ) if ( ( nPasswordMarker == PASSWORD_MARKER ) && !xBasicStream->IsEof() )
{ {
String aPassword; String aPassword = xBasicStream->ReadUniOrByteString(
xBasicStream->ReadUniOrByteString(aPassword,
xBasicStream->GetStreamCharSet()); xBasicStream->GetStreamCharSet());
pLibInfo->SetPassword( aPassword ); pLibInfo->SetPassword( aPassword );
} }

View File

@ -147,24 +147,21 @@ sal_Bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion )
switch( nSign ) switch( nSign )
{ {
case B_NAME: case B_NAME:
r.ReadUniOrByteString( aName, eCharSet ); aName = r.ReadUniOrByteString(eCharSet);
break; break;
case B_COMMENT: case B_COMMENT:
r.ReadUniOrByteString( aComment, eCharSet ); aComment = r.ReadUniOrByteString(eCharSet );
break; break;
case B_SOURCE: case B_SOURCE:
{ {
String aTmp; aOUSource = r.ReadUniOrByteString(eCharSet);
r.ReadUniOrByteString( aTmp, eCharSet );
aOUSource = aTmp;
break; break;
} }
case B_EXTSOURCE: case B_EXTSOURCE:
{ {
for( sal_uInt16 j = 0 ; j < nCount ; j++ ) for( sal_uInt16 j = 0 ; j < nCount ; j++ )
{ {
String aTmp; String aTmp = r.ReadUniOrByteString(eCharSet);
r.ReadUniOrByteString( aTmp, eCharSet );
aOUSource += aTmp; aOUSource += aTmp;
} }
break; break;

View File

@ -2001,9 +2001,7 @@ sal_Bool SbJScriptModule::LoadData( SvStream& rStrm, sal_uInt16 nVer )
return sal_False; return sal_False;
// Get the source string // Get the source string
String aTmp; aOUSource = rStrm.ReadUniOrByteString( osl_getThreadTextEncoding() );
rStrm.ReadUniOrByteString( aTmp, osl_getThreadTextEncoding() );
aOUSource = aTmp;
return sal_True; return sal_True;
} }

View File

@ -1106,8 +1106,7 @@ sal_Bool lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm,
case SbxSTRING: case SbxSTRING:
case SbxLPSTR: case SbxLPSTR:
{ {
String aStr; String aStr = pStrm->ReadUniOrByteString(osl_getThreadTextEncoding());
pStrm->ReadUniOrByteString( aStr, osl_getThreadTextEncoding() );
rVar.PutString( aStr ); rVar.PutString( aStr );
} }
break; break;

View File

@ -169,13 +169,12 @@ namespace dbaui
{ {
OFieldDescription* pFieldDesc = new OFieldDescription(); OFieldDescription* pFieldDesc = new OFieldDescription();
_rRow.m_pActFieldDescr = pFieldDesc; _rRow.m_pActFieldDescr = pFieldDesc;
String sValue; String sValue = _rStr.ReadUniOrByteString(_rStr.GetStreamCharSet());
_rStr.ReadUniOrByteString(sValue, _rStr.GetStreamCharSet());
pFieldDesc->SetName(sValue); pFieldDesc->SetName(sValue);
_rStr.ReadUniOrByteString(sValue, _rStr.GetStreamCharSet()); sValue = _rStr.ReadUniOrByteString(_rStr.GetStreamCharSet());
pFieldDesc->SetDescription(sValue); pFieldDesc->SetDescription(sValue);
_rStr.ReadUniOrByteString(sValue, _rStr.GetStreamCharSet()); sValue = _rStr.ReadUniOrByteString(_rStr.GetStreamCharSet());
pFieldDesc->SetHelpText(sValue); pFieldDesc->SetHelpText(sValue);
_rStr >> nValue; _rStr >> nValue;
@ -190,7 +189,7 @@ namespace dbaui
break; break;
} }
case 2: case 2:
_rStr.ReadUniOrByteString(sValue, _rStr.GetStreamCharSet()); sValue = _rStr.ReadUniOrByteString(_rStr.GetStreamCharSet());
aControlDefault <<= ::rtl::OUString(sValue); aControlDefault <<= ::rtl::OUString(sValue);
break; break;
} }

View File

@ -1230,7 +1230,7 @@ void BinTextObject::CreateData( SvStream& rIStream )
pC->GetText() = rtl::OStringToOUString(aByteString, eSrcEncoding); pC->GetText() = rtl::OStringToOUString(aByteString, eSrcEncoding);
// StyleName and Family... // StyleName and Family...
rIStream.ReadUniOrByteString( pC->GetStyle(), eSrcEncoding ); pC->GetStyle() = rIStream.ReadUniOrByteString(eSrcEncoding);
sal_uInt16 nStyleFamily; sal_uInt16 nStyleFamily;
rIStream >> nStyleFamily; rIStream >> nStyleFamily;
pC->GetFamily() = (SfxStyleFamily)nStyleFamily; pC->GetFamily() = (SfxStyleFamily)nStyleFamily;
@ -1522,10 +1522,10 @@ void BinTextObject::CreateData300( SvStream& rIStream )
ContentInfo* pC = CreateAndInsertContent(); ContentInfo* pC = CreateAndInsertContent();
// The Text... // The Text...
rIStream.ReadUniOrByteString( pC->GetText(), rIStream.GetStreamCharSet() ); pC->GetText() = rIStream.ReadUniOrByteString(rIStream.GetStreamCharSet());
// StyleName and Family... // StyleName and Family...
rIStream.ReadUniOrByteString( pC->GetStyle(), rIStream.GetStreamCharSet() ); pC->GetStyle() = rIStream.ReadUniOrByteString(rIStream.GetStreamCharSet());
sal_uInt16 nStyleFamily; sal_uInt16 nStyleFamily;
rIStream >> nStyleFamily; rIStream >> nStyleFamily;
pC->GetFamily() = (SfxStyleFamily)nStyleFamily; pC->GetFamily() = (SfxStyleFamily)nStyleFamily;

View File

@ -93,8 +93,7 @@ Font SvxBulletItem::CreateFont( SvStream& rStream, sal_uInt16 nVer )
rStream >> nTemp; aFont.SetItalic((FontItalic)nTemp); rStream >> nTemp; aFont.SetItalic((FontItalic)nTemp);
// UNICODE: rStream >> aName; aFont.SetName( aName ); // UNICODE: rStream >> aName; aFont.SetName( aName );
String aName; String aName = rStream.ReadUniOrByteString(rStream.GetStreamCharSet());
rStream.ReadUniOrByteString(aName, rStream.GetStreamCharSet());
aFont.SetName( aName ); aFont.SetName( aName );
if( nVer == 1 ) if( nVer == 1 )
@ -166,10 +165,10 @@ SvxBulletItem::SvxBulletItem( SvStream& rStrm, sal_uInt16 _nWhich ) :
rStrm >> nScale; rStrm >> nScale;
// UNICODE: rStrm >> aPrevText; // UNICODE: rStrm >> aPrevText;
rStrm.ReadUniOrByteString(aPrevText, rStrm.GetStreamCharSet()); aPrevText = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
// UNICODE: rStrm >> aFollowText; // UNICODE: rStrm >> aFollowText;
rStrm.ReadUniOrByteString(aFollowText, rStrm.GetStreamCharSet()); aFollowText = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
nValidMask = 0xFFFF; nValidMask = 0xFFFF;
} }

View File

@ -735,7 +735,7 @@ void SvxExtFileField::Load( SvPersistStream & rStm )
sal_uInt16 nType, nFormat; sal_uInt16 nType, nFormat;
// UNICODE: rStm >> aFile; // UNICODE: rStm >> aFile;
rStm.ReadUniOrByteString(aFile, rStm.GetStreamCharSet()); aFile = rStm.ReadUniOrByteString(rStm.GetStreamCharSet());
rStm >> nType; rStm >> nType;
rStm >> nFormat; rStm >> nFormat;

View File

@ -3441,9 +3441,8 @@ SvxBrushItem::SvxBrushItem( SvStream& rStream, sal_uInt16 nVersion,
if ( nDoLoad & LOAD_LINK ) if ( nDoLoad & LOAD_LINK )
{ {
String aRel;
// UNICODE: rStream >> aRel; // UNICODE: rStream >> aRel;
rStream.ReadUniOrByteString(aRel, rStream.GetStreamCharSet()); String aRel = rStream.ReadUniOrByteString(rStream.GetStreamCharSet());
// TODO/MBA: how can we get a BaseURL here?! // TODO/MBA: how can we get a BaseURL here?!
OSL_FAIL("No BaseURL!"); OSL_FAIL("No BaseURL!");
@ -3456,7 +3455,7 @@ SvxBrushItem::SvxBrushItem( SvStream& rStream, sal_uInt16 nVersion,
{ {
pStrFilter = new String; pStrFilter = new String;
// UNICODE: rStream >> *pStrFilter; // UNICODE: rStream >> *pStrFilter;
rStream.ReadUniOrByteString(*pStrFilter, rStream.GetStreamCharSet()); *pStrFilter = rStream.ReadUniOrByteString(rStream.GetStreamCharSet());
} }
rStream >> nPos; rStream >> nPos;

View File

@ -424,10 +424,10 @@ SfxPoolItem* SvxFontItem::Create(SvStream& rStrm, sal_uInt16) const
rStrm >> eFontTextEncoding; rStrm >> eFontTextEncoding;
// UNICODE: rStrm >> aName; // UNICODE: rStrm >> aName;
rStrm.ReadUniOrByteString(aName, rStrm.GetStreamCharSet()); aName = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
// UNICODE: rStrm >> aStyle; // UNICODE: rStrm >> aStyle;
rStrm.ReadUniOrByteString(aStyle, rStrm.GetStreamCharSet()); aStyle = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
// Set the "correct" textencoding // Set the "correct" textencoding
eFontTextEncoding = (sal_uInt8)GetSOLoadTextEncoding( eFontTextEncoding, (sal_uInt16)rStrm.GetVersion() ); eFontTextEncoding = (sal_uInt8)GetSOLoadTextEncoding( eFontTextEncoding, (sal_uInt16)rStrm.GetVersion() );
@ -442,8 +442,8 @@ SfxPoolItem* SvxFontItem::Create(SvStream& rStrm, sal_uInt16) const
rStrm >> nMagic; rStrm >> nMagic;
if ( nMagic == STORE_UNICODE_MAGIC_MARKER ) if ( nMagic == STORE_UNICODE_MAGIC_MARKER )
{ {
rStrm.ReadUniOrByteString( aName, RTL_TEXTENCODING_UNICODE ); aName = rStrm.ReadUniOrByteString( RTL_TEXTENCODING_UNICODE );
rStrm.ReadUniOrByteString( aStyle, RTL_TEXTENCODING_UNICODE ); aStyle = rStrm.ReadUniOrByteString( RTL_TEXTENCODING_UNICODE );
} }
else else
{ {

View File

@ -65,7 +65,7 @@ void SvMetaModule::Load( SvPersistStream & rStm )
rStm >> aTypeList; rStm >> aTypeList;
rStm >> aAttrList; rStm >> aAttrList;
// browser // browser
rStm.ReadUniOrByteString( aIdlFileName, rStm.GetStreamCharSet() ); aIdlFileName = rStm.ReadUniOrByteString( rStm.GetStreamCharSet() );
aHelpFileName.setString(read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(rStm)); aHelpFileName.setString(read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(rStm));
aSlotIdFile.setString(read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(rStm)); aSlotIdFile.setString(read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(rStm));
aModulePrefix.setString(read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(rStm)); aModulePrefix.setString(read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(rStm));

View File

@ -172,7 +172,7 @@ SfxPoolItem* ScPatternAttr::Create( SvStream& rStream, sal_uInt16 /* nVersion */
{ {
short eFamDummy; short eFamDummy;
pStr = new String; pStr = new String;
rStream.ReadUniOrByteString( *pStr, rStream.GetStreamCharSet() ); *pStr = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
rStream >> eFamDummy; // wg. altem Dateiformat rStream >> eFamDummy; // wg. altem Dateiformat
} }
else else

View File

@ -803,7 +803,7 @@ sal_Bool ScAutoFormatData::Load( SvStream& rStream, const ScAfVersions& rVersion
RTL_TEXTENCODING_UTF8); RTL_TEXTENCODING_UTF8);
} }
else else
rStream.ReadUniOrByteString( aName, rStream.GetStreamCharSet() ); aName = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
if( AUTOFORMAT_DATA_ID_552 <= nVer ) if( AUTOFORMAT_DATA_ID_552 <= nVer )
{ {
@ -844,7 +844,7 @@ sal_Bool ScAutoFormatData::LoadOld( SvStream& rStream, const ScAfVersions& rVers
bRet = (rStream.GetError() == 0); bRet = (rStream.GetError() == 0);
if (bRet && (nVal == AUTOFORMAT_OLD_DATA_ID)) if (bRet && (nVal == AUTOFORMAT_OLD_DATA_ID))
{ {
rStream.ReadUniOrByteString( aName, rStream.GetStreamCharSet() ); aName = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
sal_Bool b; sal_Bool b;
rStream >> b; bIncludeFont = b; rStream >> b; bIncludeFont = b;
rStream >> b; bIncludeJustify = b; rStream >> b; bIncludeJustify = b;

View File

@ -93,9 +93,9 @@ ScDdeLink::ScDdeLink( ScDocument* pD, SvStream& rStream, ScMultipleReadHeader& r
rHdr.StartEntry(); rHdr.StartEntry();
rtl_TextEncoding eCharSet = rStream.GetStreamCharSet(); rtl_TextEncoding eCharSet = rStream.GetStreamCharSet();
rStream.ReadUniOrByteString( aAppl, eCharSet ); aAppl = rStream.ReadUniOrByteString( eCharSet );
rStream.ReadUniOrByteString( aTopic, eCharSet ); aTopic = rStream.ReadUniOrByteString( eCharSet );
rStream.ReadUniOrByteString( aItem, eCharSet ); aItem = rStream.ReadUniOrByteString( eCharSet );
sal_Bool bHasValue; sal_Bool bHasValue;
rStream >> bHasValue; rStream >> bHasValue;

View File

@ -61,7 +61,7 @@ ScNumFormatAbbrev::ScNumFormatAbbrev(sal_uLong nFormat,
void ScNumFormatAbbrev::Load( SvStream& rStream, CharSet eByteStrSet ) void ScNumFormatAbbrev::Load( SvStream& rStream, CharSet eByteStrSet )
{ {
sal_uInt16 nSysLang, nLang; sal_uInt16 nSysLang, nLang;
rStream.ReadUniOrByteString( sFormatstring, eByteStrSet ); sFormatstring = rStream.ReadUniOrByteString( eByteStrSet );
rStream >> nSysLang >> nLang; rStream >> nSysLang >> nLang;
eLnge = (LanguageType) nLang; eLnge = (LanguageType) nLang;
eSysLnge = (LanguageType) nSysLang; eSysLnge = (LanguageType) nSysLang;

View File

@ -190,8 +190,7 @@ std::vector<sal_uInt16>* SfxApplication::GetDisabledSlotList_Impl()
if( bSlots && bSlotsEnabled ) if( bSlots && bSlotsEnabled )
{ {
// Read Slot file // Read Slot file
String aTitle; String aTitle = pStream->ReadUniOrByteString(pStream->GetStreamCharSet());
pStream->ReadUniOrByteString(aTitle, pStream->GetStreamCharSet());
if ( aTitle.CompareToAscii("SfxSlotFile" ) == COMPARE_EQUAL ) if ( aTitle.CompareToAscii("SfxSlotFile" ) == COMPARE_EQUAL )
{ {
sal_uInt16 nCount; sal_uInt16 nCount;
@ -206,7 +205,7 @@ std::vector<sal_uInt16>* SfxApplication::GetDisabledSlotList_Impl()
pList->push_back( nSlot ); pList->push_back( nSlot );
} }
pStream->ReadUniOrByteString(aTitle, pStream->GetStreamCharSet()); aTitle = pStream->ReadUniOrByteString(pStream->GetStreamCharSet());
if ( aTitle.CompareToAscii("END" ) != COMPARE_EQUAL || pStream->GetError() ) if ( aTitle.CompareToAscii("END" ) != COMPARE_EQUAL || pStream->GetError() )
{ {
// Read failed // Read failed

View File

@ -187,7 +187,7 @@ SvStream& SfxPoolItem::Store(SvStream &rStream, sal_uInt16 ) const
// static // static
bool SfxPoolItem::readByteString(SvStream & rStream, UniString & rString) bool SfxPoolItem::readByteString(SvStream & rStream, UniString & rString)
{ {
rStream.ReadUniOrByteString(rString, rStream.GetStreamCharSet()); rString = rStream.ReadUniOrByteString(rStream.GetStreamCharSet());
return rStream.GetError() == ERRCODE_NONE; return rStream.GetError() == ERRCODE_NONE;
} }
@ -204,8 +204,7 @@ void SfxPoolItem::writeByteString(SvStream & rStream,
bool SfxPoolItem::readUnicodeString(SvStream & rStream, UniString & rString, bool SfxPoolItem::readUnicodeString(SvStream & rStream, UniString & rString,
bool bUnicode) bool bUnicode)
{ {
rStream.ReadUniOrByteString(rString, rString = rStream.ReadUniOrByteString(bUnicode ? RTL_TEXTENCODING_UCS2 :
bUnicode ? RTL_TEXTENCODING_UCS2 :
rStream.GetStreamCharSet()); rStream.GetStreamCharSet());
return rStream.GetError() == ERRCODE_NONE; return rStream.GetError() == ERRCODE_NONE;
} }

View File

@ -402,7 +402,7 @@ void ImpSvNumFor::Load(SvStream& rStream, ImpSvNumberformatScan& rSc,
rStream >> nAnz; //! noch nicht direkt nAnzStrings wg. Enlarge rStream >> nAnz; //! noch nicht direkt nAnzStrings wg. Enlarge
Enlarge( nAnz ); Enlarge( nAnz );
aI.Load( rStream, nAnz ); aI.Load( rStream, nAnz );
rStream.ReadUniOrByteString( sColorName, rStream.GetStreamCharSet() ); sColorName = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
rLoadedColorName = sColorName; rLoadedColorName = sColorName;
pColor = rSc.GetColor(sColorName); pColor = rSc.GetColor(sColorName);
} }

View File

@ -417,8 +417,7 @@ namespace svt
// initialize them with their (local) names // initialize them with their (local) names
while ( nChildren-- ) while ( nChildren-- )
{ {
String sURL; String sURL = m_rStorage.ReadUniOrByteString(m_rStorage.GetStreamCharSet());
m_rStorage.ReadUniOrByteString( sURL, m_rStorage.GetStreamCharSet() );
sURL = m_xOfficeInstDirs->makeAbsoluteURL( sURL ); sURL = m_xOfficeInstDirs->makeAbsoluteURL( sURL );
INetURLObject aChildURL( sURL ); INetURLObject aChildURL( sURL );
rChildren.push_back( new TemplateContent( aChildURL ) ); rChildren.push_back( new TemplateContent( aChildURL ) );
@ -735,8 +734,7 @@ namespace svt
m_aPreviousState.reserve( nRootDirectories ); m_aPreviousState.reserve( nRootDirectories );
while ( nRootDirectories-- ) while ( nRootDirectories-- )
{ {
String sURL; String sURL = m_pCacheStream->ReadUniOrByteString(m_pCacheStream->GetStreamCharSet());
m_pCacheStream->ReadUniOrByteString( sURL, m_pCacheStream->GetStreamCharSet() );
// #116281# Keep office installtion relocatable. Never store // #116281# Keep office installtion relocatable. Never store
// any direct references to office installation directory. // any direct references to office installation directory.
sURL = getOfficeInstDirs()->makeAbsoluteURL( sURL ); sURL = getOfficeInstDirs()->makeAbsoluteURL( sURL );

View File

@ -96,8 +96,8 @@ SvStream& operator>>( SvStream& rIStm, TransferableObjectDescriptor& rObjDesc )
rIStm >> rObjDesc.maSize.Height(); rIStm >> rObjDesc.maSize.Height();
rIStm >> rObjDesc.maDragStartPos.X(); rIStm >> rObjDesc.maDragStartPos.X();
rIStm >> rObjDesc.maDragStartPos.Y(); rIStm >> rObjDesc.maDragStartPos.Y();
rIStm.ReadUniOrByteString( rObjDesc.maTypeName, osl_getThreadTextEncoding() ); rObjDesc.maTypeName = rIStm.ReadUniOrByteString(osl_getThreadTextEncoding());
rIStm.ReadUniOrByteString( rObjDesc.maDisplayName, osl_getThreadTextEncoding() ); rObjDesc.maDisplayName = rIStm.ReadUniOrByteString(osl_getThreadTextEncoding());
rIStm >> nSig1 >> nSig2; rIStm >> nSig1 >> nSig2;
rObjDesc.mnViewAspect = static_cast< sal_uInt16 >( nViewAspect ); rObjDesc.mnViewAspect = static_cast< sal_uInt16 >( nViewAspect );

View File

@ -131,13 +131,13 @@ SfxPoolItem* SvxHyperlinkItem::Create( SvStream &rStrm, sal_uInt16 /*nItemVer
// simple data-types // simple data-types
// UNICODE: rStrm >> pNew->sName; // UNICODE: rStrm >> pNew->sName;
rStrm.ReadUniOrByteString(pNew->sName, rStrm.GetStreamCharSet()); pNew->sName = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
// UNICODE: rStrm >> pNew->sURL; // UNICODE: rStrm >> pNew->sURL;
rStrm.ReadUniOrByteString(pNew->sURL, rStrm.GetStreamCharSet()); pNew->sURL = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
// UNICODE: rStrm >> pNew->sTarget; // UNICODE: rStrm >> pNew->sTarget;
rStrm.ReadUniOrByteString(pNew->sTarget, rStrm.GetStreamCharSet()); pNew->sTarget = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
rStrm >> nType; rStrm >> nType;
pNew->eType = (SvxLinkInsertMode) nType; pNew->eType = (SvxLinkInsertMode) nType;
@ -149,7 +149,7 @@ SfxPoolItem* SvxHyperlinkItem::Create( SvStream &rStrm, sal_uInt16 /*nItemVer
{ {
// new data // new data
// UNICODE: rStrm >> pNew->sIntName; // UNICODE: rStrm >> pNew->sIntName;
rStrm.ReadUniOrByteString(pNew->sIntName, rStrm.GetStreamCharSet()); pNew->sIntName = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
// macro-events // macro-events
rStrm >> pNew->nMacroEvents; rStrm >> pNew->nMacroEvents;
@ -164,10 +164,10 @@ SfxPoolItem* SvxHyperlinkItem::Create( SvStream &rStrm, sal_uInt16 /*nItemVer
rStrm >> nCurKey; rStrm >> nCurKey;
// UNICODE: rStrm >> aLibName; // UNICODE: rStrm >> aLibName;
rStrm.ReadUniOrByteString(aLibName, rStrm.GetStreamCharSet()); aLibName = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
// UNICODE: rStrm >> aMacName; // UNICODE: rStrm >> aMacName;
rStrm.ReadUniOrByteString(aMacName, rStrm.GetStreamCharSet()); aMacName = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
pNew->SetMacro( nCurKey, SvxMacro( aMacName, aLibName, STARBASIC ) ); pNew->SetMacro( nCurKey, SvxMacro( aMacName, aLibName, STARBASIC ) );
} }
@ -181,10 +181,10 @@ SfxPoolItem* SvxHyperlinkItem::Create( SvStream &rStrm, sal_uInt16 /*nItemVer
rStrm >> nCurKey; rStrm >> nCurKey;
// UNICODE: rStrm >> aLibName; // UNICODE: rStrm >> aLibName;
rStrm.ReadUniOrByteString(aLibName, rStrm.GetStreamCharSet()); aLibName = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
// UNICODE: rStrm >> aMacName; // UNICODE: rStrm >> aMacName;
rStrm.ReadUniOrByteString(aMacName, rStrm.GetStreamCharSet()); aMacName = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
rStrm >> nScriptType; rStrm >> nScriptType;

View File

@ -245,13 +245,12 @@ bool SvxPageItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
SfxPoolItem* SvxPageItem::Create( SvStream& rStream, sal_uInt16 ) const SfxPoolItem* SvxPageItem::Create( SvStream& rStream, sal_uInt16 ) const
{ {
XubString sStr;
sal_uInt8 eType; sal_uInt8 eType;
sal_Bool bLand; sal_Bool bLand;
sal_uInt16 nUse; sal_uInt16 nUse;
// UNICODE: rStream >> sStr; // UNICODE: rStream >> sStr;
rStream.ReadUniOrByteString( sStr, rStream.GetStreamCharSet() ); XubString sStr = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
rStream >> eType; rStream >> eType;
rStream >> bLand; rStream >> bLand;

View File

@ -401,8 +401,8 @@ sal_Bool SwBoxAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions, s
sal_uInt16 eSys, eLge; sal_uInt16 eSys, eLge;
// --- from 680/dr25 on: store strings as UTF-8 // --- from 680/dr25 on: store strings as UTF-8
CharSet eCharSet = (nVer >= AUTOFORMAT_ID_680DR25) ? RTL_TEXTENCODING_UTF8 : rStream.GetStreamCharSet(); CharSet eCharSet = (nVer >= AUTOFORMAT_ID_680DR25) ? RTL_TEXTENCODING_UTF8 : rStream.GetStreamCharSet();
rStream.ReadUniOrByteString( sNumFmtString, eCharSet ) sNumFmtString = rStream.ReadUniOrByteString( eCharSet );
>> eSys >> eLge; rStream >> eSys >> eLge;
eSysLanguage = (LanguageType) eSys; eSysLanguage = (LanguageType) eSys;
eNumFmtLanguage = (LanguageType) eLge; eNumFmtLanguage = (LanguageType) eLge;
if ( eSysLanguage == LANGUAGE_SYSTEM ) // von alten Versionen (Calc) if ( eSysLanguage == LANGUAGE_SYSTEM ) // von alten Versionen (Calc)
@ -780,7 +780,7 @@ sal_Bool SwTableAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions
sal_Bool b; sal_Bool b;
// --- from 680/dr25 on: store strings as UTF-8 // --- from 680/dr25 on: store strings as UTF-8
CharSet eCharSet = (nVal >= AUTOFORMAT_ID_680DR25) ? RTL_TEXTENCODING_UTF8 : rStream.GetStreamCharSet(); CharSet eCharSet = (nVal >= AUTOFORMAT_ID_680DR25) ? RTL_TEXTENCODING_UTF8 : rStream.GetStreamCharSet();
rStream.ReadUniOrByteString( aName, eCharSet ); aName = rStream.ReadUniOrByteString( eCharSet );
if( AUTOFORMAT_DATA_ID_552 <= nVal ) if( AUTOFORMAT_DATA_ID_552 <= nVal )
{ {
rStream >> nStrResId; rStream >> nStrResId;
@ -830,7 +830,7 @@ sal_Bool SwTableAutoFmt::LoadOld( SvStream& rStream, sal_uInt16 aLoadVer[] )
if( bRet && ( AUTOFORMAT_OLD_DATA_ID == nVal )) if( bRet && ( AUTOFORMAT_OLD_DATA_ID == nVal ))
{ {
sal_Bool b; sal_Bool b;
rStream.ReadUniOrByteString( aName, rStream.GetStreamCharSet() ); aName = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
rStream >> b; bInclFont = b; rStream >> b; bInclFont = b;
rStream >> b; bInclJustify = b; rStream >> b; bInclJustify = b;
rStream >> b; bInclFrame = b; rStream >> b; bInclFrame = b;

View File

@ -235,7 +235,7 @@ const SwNumRulesWithName& SwNumRulesWithName::operator=(const SwNumRulesWithName
SwNumRulesWithName::SwNumRulesWithName( SvStream &rStream, sal_uInt16 nVersion ) SwNumRulesWithName::SwNumRulesWithName( SvStream &rStream, sal_uInt16 nVersion )
{ {
CharSet eEncoding = osl_getThreadTextEncoding(); CharSet eEncoding = osl_getThreadTextEncoding();
rStream.ReadUniOrByteString(aName, eEncoding); aName = rStream.ReadUniOrByteString(eEncoding);
char c; char c;
for(sal_uInt16 n = 0; n < MAXLEVEL; ++n ) for(sal_uInt16 n = 0; n < MAXLEVEL; ++n )
@ -354,9 +354,9 @@ SwNumRulesWithName::_SwNumFmtGlobal::_SwNumFmtGlobal( SvStream& rStream,
long nL; long nL;
rStream >> cChar; aFmt.SetStart( (sal_uInt16)cChar ); rStream >> cChar; aFmt.SetStart( (sal_uInt16)cChar );
rStream.ReadUniOrByteString(sStr, eEncoding); sStr = rStream.ReadUniOrByteString(eEncoding);
aFmt.SetPrefix( sStr ); aFmt.SetPrefix( sStr );
rStream.ReadUniOrByteString(sStr, eEncoding); sStr = rStream.ReadUniOrByteString(eEncoding);
aFmt.SetSuffix( sStr ); aFmt.SetSuffix( sStr );
rStream >> nUS; aFmt.SetNumAdjust( SvxAdjust( nUS ) ); rStream >> nUS; aFmt.SetNumAdjust( SvxAdjust( nUS ) );
rStream >> nL; aFmt.SetLSpace( lNumIndent ); rStream >> nL; aFmt.SetLSpace( lNumIndent );
@ -366,9 +366,9 @@ SwNumRulesWithName::_SwNumFmtGlobal::_SwNumFmtGlobal( SvStream& rStream,
{ {
short nShort; short nShort;
rStream >> nUS; aFmt.SetStart( nUS ); rStream >> nUS; aFmt.SetStart( nUS );
rStream.ReadUniOrByteString(sStr, eEncoding); sStr = rStream.ReadUniOrByteString(eEncoding);
aFmt.SetPrefix( sStr ); aFmt.SetPrefix( sStr );
rStream.ReadUniOrByteString(sStr, eEncoding); sStr = rStream.ReadUniOrByteString(eEncoding);
aFmt.SetSuffix( sStr ); aFmt.SetSuffix( sStr );
rStream >> nUS; aFmt.SetNumAdjust( SvxAdjust( nUS ) ); rStream >> nUS; aFmt.SetNumAdjust( SvxAdjust( nUS ) );
rStream >> nUS; aFmt.SetAbsLSpace( nUS ); rStream >> nUS; aFmt.SetAbsLSpace( nUS );
@ -385,7 +385,7 @@ SwNumRulesWithName::_SwNumFmtGlobal::_SwNumFmtGlobal( SvStream& rStream,
sal_uInt16 nPitch; sal_uInt16 nPitch;
String aName; String aName;
rStream.ReadUniOrByteString(aName, eEncoding); aName = rStream.ReadUniOrByteString(eEncoding);
rStream >> nFamily >> nCharSet >> nWidth >> nHeight >> nPitch; rStream >> nFamily >> nCharSet >> nWidth >> nHeight >> nPitch;
if( aName.Len() ) if( aName.Len() )
@ -411,7 +411,7 @@ SwNumRulesWithName::_SwNumFmtGlobal::_SwNumFmtGlobal( SvStream& rStream,
{ {
sal_uInt16 nItemCount; sal_uInt16 nItemCount;
rStream >> nCharPoolId; rStream >> nCharPoolId;
rStream.ReadUniOrByteString(sCharFmtName, eEncoding); sCharFmtName = rStream.ReadUniOrByteString(eEncoding);
rStream >> nItemCount; rStream >> nItemCount;
while( nItemCount-- ) while( nItemCount-- )

View File

@ -409,7 +409,7 @@ public:
sal_Bool ReadUniStringLine( String& rStr ); sal_Bool ReadUniStringLine( String& rStr );
/// Read a 32bit length prefixed sequence of utf-16 if eSrcCharSet==RTL_TEXTENCODING_UNICODE, /// Read a 32bit length prefixed sequence of utf-16 if eSrcCharSet==RTL_TEXTENCODING_UNICODE,
/// otherwise read a 16bit length prefixed sequence of bytes and convert from eSrcCharSet /// otherwise read a 16bit length prefixed sequence of bytes and convert from eSrcCharSet
SvStream& ReadUniOrByteString( UniString& rStr, rtl_TextEncoding eSrcCharSet ); String ReadUniOrByteString(rtl_TextEncoding eSrcCharSet);
/// Write a 32bit length prefixed sequence of utf-16 if eSrcCharSet==RTL_TEXTENCODING_UNICODE, /// Write a 32bit length prefixed sequence of utf-16 if eSrcCharSet==RTL_TEXTENCODING_UNICODE,
/// otherwise convert to eSrcCharSet and write a 16bit length prefixed sequence of bytes /// otherwise convert to eSrcCharSet and write a 16bit length prefixed sequence of bytes
SvStream& WriteUniOrByteString( const UniString& rStr, rtl_TextEncoding eDestCharSet ); SvStream& WriteUniOrByteString( const UniString& rStr, rtl_TextEncoding eDestCharSet );

View File

@ -1489,36 +1489,37 @@ SvStream& SvStream::operator<< ( SvStream& rStream )
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
SvStream& SvStream::ReadUniOrByteString( UniString& rStr, rtl_TextEncoding eSrcCharSet ) String SvStream::ReadUniOrByteString( rtl_TextEncoding eSrcCharSet )
{ {
// read UTF-16 string directly from stream ? // read UTF-16 string directly from stream ?
if (eSrcCharSet == RTL_TEXTENCODING_UNICODE) if (eSrcCharSet == RTL_TEXTENCODING_UNICODE)
{ {
sal_uInt32 nLen; String aStr;
sal_uInt32 nLen(0);
operator>> (nLen); operator>> (nLen);
if (nLen) if (nLen)
{ {
if (nLen > STRING_MAXLEN) { if (nLen > STRING_MAXLEN)
{
SetError(SVSTREAM_GENERALERROR); SetError(SVSTREAM_GENERALERROR);
return *this; return aStr;
} }
sal_Unicode *pStr = rStr.AllocBuffer( sal_Unicode *pStr = aStr.AllocBuffer(
static_cast< xub_StrLen >(nLen)); static_cast< xub_StrLen >(nLen));
BOOST_STATIC_ASSERT(STRING_MAXLEN <= SAL_MAX_SIZE / 2); BOOST_STATIC_ASSERT(STRING_MAXLEN <= SAL_MAX_SIZE / 2);
Read( pStr, nLen << 1 ); Read( pStr, nLen << 1 );
if (bSwap) if (bSwap)
{
for (sal_Unicode *pEnd = pStr + nLen; pStr < pEnd; pStr++) for (sal_Unicode *pEnd = pStr + nLen; pStr < pEnd; pStr++)
SwapUShort(*pStr); SwapUShort(*pStr);
}
} }
else
rStr.Erase();
return *this; return aStr;
} }
rStr = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(*this, eSrcCharSet); return read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(*this, eSrcCharSet);
return *this;
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------

View File

@ -780,8 +780,8 @@ SvStream& operator>>( SvStream& rIStm, Impl_Font& rImpl_Font )
sal_Bool bTmp; sal_Bool bTmp;
sal_uInt8 nTmp8; sal_uInt8 nTmp8;
rIStm.ReadUniOrByteString( rImpl_Font.maFamilyName, rIStm.GetStreamCharSet() ); rImpl_Font.maFamilyName = rIStm.ReadUniOrByteString(rIStm.GetStreamCharSet());
rIStm.ReadUniOrByteString( rImpl_Font.maStyleName, rIStm.GetStreamCharSet() ); rImpl_Font.maStyleName = rIStm.ReadUniOrByteString(rIStm.GetStreamCharSet());
rIStm >> rImpl_Font.maSize; rIStm >> rImpl_Font.maSize;
rIStm >> nTmp16; rImpl_Font.meCharSet = (rtl_TextEncoding) nTmp16; rIStm >> nTmp16; rImpl_Font.meCharSet = (rtl_TextEncoding) nTmp16;

View File

@ -1278,7 +1278,7 @@ void MetaTextAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
{ {
COMPAT( rIStm ); COMPAT( rIStm );
rIStm >> maPt; rIStm >> maPt;
rIStm.ReadUniOrByteString( maStr, pData->meActualCharSet ); maStr = rIStm.ReadUniOrByteString(pData->meActualCharSet);
rIStm >> mnIndex; rIStm >> mnIndex;
rIStm >> mnLen; rIStm >> mnLen;
@ -1435,7 +1435,7 @@ void MetaTextArrayAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
COMPAT( rIStm ); COMPAT( rIStm );
rIStm >> maStartPt; rIStm >> maStartPt;
rIStm.ReadUniOrByteString( maStr, pData->meActualCharSet ); maStr = rIStm.ReadUniOrByteString(pData->meActualCharSet);
rIStm >> mnIndex; rIStm >> mnIndex;
rIStm >> mnLen; rIStm >> mnLen;
rIStm >> nAryLen; rIStm >> nAryLen;
@ -1575,7 +1575,7 @@ void MetaStretchTextAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
{ {
COMPAT( rIStm ); COMPAT( rIStm );
rIStm >> maPt; rIStm >> maPt;
rIStm.ReadUniOrByteString( maStr, pData->meActualCharSet ); maStr = rIStm.ReadUniOrByteString(pData->meActualCharSet);
rIStm >> mnWidth; rIStm >> mnWidth;
rIStm >> mnIndex; rIStm >> mnIndex;
rIStm >> mnLen; rIStm >> mnLen;
@ -1668,7 +1668,7 @@ void MetaTextRectAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
{ {
COMPAT( rIStm ); COMPAT( rIStm );
rIStm >> maRect; rIStm >> maRect;
rIStm.ReadUniOrByteString( maStr, pData->meActualCharSet ); maStr = rIStm.ReadUniOrByteString(pData->meActualCharSet);
rIStm >> mnStyle; rIStm >> mnStyle;
if ( aCompat.GetVersion() >= 2 ) // Version 2 if ( aCompat.GetVersion() >= 2 ) // Version 2