summaryrefslogtreecommitdiffstats
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-12-21 10:45:54 +0000
committerCaolán McNamara <caolanm@redhat.com>2011-12-21 13:44:52 +0000
commit5c24789ca33d7b2b0c39626208cf0708fb470d95 (patch)
treea58015a4f6cafb9d567ca24831a442a4e976d972 /sc
parentconvert ReadByteString/WriteByteString from ByteString to OString (diff)
downloadcore-5c24789ca33d7b2b0c39626208cf0708fb470d95.tar.gz
core-5c24789ca33d7b2b0c39626208cf0708fb470d95.zip
disentangle Read/WriteByteString OUString variants
The ones which use a definite 8-bit encoding read/write pascal-style strings with a 16bit length prefix. The ones which use a definite 16-bit encoding read/write pascal-style UTF-16 strings with a 32bit length prefix, i.e. not ByteStrings at all The "I dunno" ones might be UTF-16 strings or 8-bit strings, depending on the charset. Rename to ReadUniOrByteString like the other similar horrors to flag this misery
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/patattr.cxx8
-rw-r--r--sc/source/core/tool/autoform.cxx14
-rw-r--r--sc/source/core/tool/ddelink.cxx12
-rw-r--r--sc/source/core/tool/zforauto.cxx4
4 files changed, 22 insertions, 16 deletions
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index fbd982db364a..93adcfeea75e 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -172,7 +172,7 @@ SfxPoolItem* ScPatternAttr::Create( SvStream& rStream, sal_uInt16 /* nVersion */
{
short eFamDummy;
pStr = new String;
- rStream.ReadByteString( *pStr, rStream.GetStreamCharSet() );
+ rStream.ReadUniOrByteString( *pStr, rStream.GetStreamCharSet() );
rStream >> eFamDummy; // wg. altem Dateiformat
}
else
@@ -194,11 +194,11 @@ SvStream& ScPatternAttr::Store(SvStream& rStream, sal_uInt16 /* nItemVersion */)
rStream << (sal_Bool)sal_True;
if ( pStyle )
- rStream.WriteByteString( pStyle->GetName(), rStream.GetStreamCharSet() );
+ rStream.WriteUniOrByteString( pStyle->GetName(), rStream.GetStreamCharSet() );
else if ( pName ) // wenn Style geloescht ist/war
- rStream.WriteByteString( *pName, rStream.GetStreamCharSet() );
+ rStream.WriteUniOrByteString( *pName, rStream.GetStreamCharSet() );
else
- rStream.WriteByteString( ScGlobal::GetRscString(STR_STYLENAME_STANDARD),
+ rStream.WriteUniOrByteString( ScGlobal::GetRscString(STR_STYLENAME_STANDARD),
rStream.GetStreamCharSet() );
rStream << (short)SFX_STYLE_FAMILY_PARA; // wg. altem Dateiformat
diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx
index fa7836bc604a..61b8355826f8 100644
--- a/sc/source/core/tool/autoform.cxx
+++ b/sc/source/core/tool/autoform.cxx
@@ -797,8 +797,14 @@ sal_Bool ScAutoFormatData::Load( SvStream& rStream, const ScAfVersions& rVersion
(AUTOFORMAT_DATA_ID_504 <= nVer && nVer <= AUTOFORMAT_DATA_ID)) )
{
// --- from 680/dr25 on: store strings as UTF-8
- CharSet eCharSet = (nVer >= AUTOFORMAT_ID_680DR25) ? RTL_TEXTENCODING_UTF8 : rStream.GetStreamCharSet();
- rStream.ReadByteString( aName, eCharSet );
+ if (nVer >= AUTOFORMAT_ID_680DR25)
+ {
+ aName = read_lenPrefixed_uInt8s_ToOUString(rStream,
+ RTL_TEXTENCODING_UTF8);
+ }
+ else
+ rStream.ReadUniOrByteString( aName, rStream.GetStreamCharSet() );
+
if( AUTOFORMAT_DATA_ID_552 <= nVer )
{
rStream >> nStrResId;
@@ -838,7 +844,7 @@ sal_Bool ScAutoFormatData::LoadOld( SvStream& rStream, const ScAfVersions& rVers
bRet = (rStream.GetError() == 0);
if (bRet && (nVal == AUTOFORMAT_OLD_DATA_ID))
{
- rStream.ReadByteString( aName, rStream.GetStreamCharSet() );
+ rStream.ReadUniOrByteString( aName, rStream.GetStreamCharSet() );
sal_Bool b;
rStream >> b; bIncludeFont = b;
rStream >> b; bIncludeJustify = b;
@@ -863,7 +869,7 @@ sal_Bool ScAutoFormatData::Save(SvStream& rStream)
sal_Bool b;
rStream << nVal;
// --- from 680/dr25 on: store strings as UTF-8
- rStream.WriteByteString( aName, RTL_TEXTENCODING_UTF8 );
+ write_lenPrefixed_uInt8s_FromOUString(rStream, aName, RTL_TEXTENCODING_UTF8);
rStream << nStrResId;
rStream << ( b = bIncludeFont );
diff --git a/sc/source/core/tool/ddelink.cxx b/sc/source/core/tool/ddelink.cxx
index 7fbb58b0ea4f..ca956813697b 100644
--- a/sc/source/core/tool/ddelink.cxx
+++ b/sc/source/core/tool/ddelink.cxx
@@ -92,9 +92,9 @@ ScDdeLink::ScDdeLink( ScDocument* pD, SvStream& rStream, ScMultipleReadHeader& r
rHdr.StartEntry();
rtl_TextEncoding eCharSet = rStream.GetStreamCharSet();
- rStream.ReadByteString( aAppl, eCharSet );
- rStream.ReadByteString( aTopic, eCharSet );
- rStream.ReadByteString( aItem, eCharSet );
+ rStream.ReadUniOrByteString( aAppl, eCharSet );
+ rStream.ReadUniOrByteString( aTopic, eCharSet );
+ rStream.ReadUniOrByteString( aItem, eCharSet );
sal_Bool bHasValue;
rStream >> bHasValue;
@@ -114,9 +114,9 @@ void ScDdeLink::Store( SvStream& rStream, ScMultipleWriteHeader& rHdr ) const
rHdr.StartEntry();
rtl_TextEncoding eCharSet = rStream.GetStreamCharSet();
- rStream.WriteByteString( aAppl, eCharSet );
- rStream.WriteByteString( aTopic, eCharSet );
- rStream.WriteByteString( aItem, eCharSet );
+ rStream.WriteUniOrByteString( aAppl, eCharSet );
+ rStream.WriteUniOrByteString( aTopic, eCharSet );
+ rStream.WriteUniOrByteString( aItem, eCharSet );
sal_Bool bHasValue = ( pResult != NULL );
rStream << bHasValue;
diff --git a/sc/source/core/tool/zforauto.cxx b/sc/source/core/tool/zforauto.cxx
index 4ebbee3551c0..048c981df3bf 100644
--- a/sc/source/core/tool/zforauto.cxx
+++ b/sc/source/core/tool/zforauto.cxx
@@ -61,7 +61,7 @@ ScNumFormatAbbrev::ScNumFormatAbbrev(sal_uLong nFormat,
void ScNumFormatAbbrev::Load( SvStream& rStream, CharSet eByteStrSet )
{
sal_uInt16 nSysLang, nLang;
- rStream.ReadByteString( sFormatstring, eByteStrSet );
+ rStream.ReadUniOrByteString( sFormatstring, eByteStrSet );
rStream >> nSysLang >> nLang;
eLnge = (LanguageType) nLang;
eSysLnge = (LanguageType) nSysLang;
@@ -71,7 +71,7 @@ void ScNumFormatAbbrev::Load( SvStream& rStream, CharSet eByteStrSet )
void ScNumFormatAbbrev::Save( SvStream& rStream, CharSet eByteStrSet ) const
{
- rStream.WriteByteString( sFormatstring, eByteStrSet );
+ rStream.WriteUniOrByteString( sFormatstring, eByteStrSet );
rStream << (sal_uInt16) eSysLnge << (sal_uInt16) eLnge;
}