From 6708977331c933b3483b9fe5f66d981b51fd8d49 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 21 Dec 2011 10:30:10 +0000 Subject: needs more work first This reverts commit 92f396733ebc518bcb7a9eae2dd3169d333b82b9. --- svx/source/gallery2/gallery1.cxx | 51 +++++++++++++++++++++++++--------------- svx/source/gallery2/galobj.cxx | 36 +++++++++++++++++++--------- svx/source/gallery2/galtheme.cxx | 19 ++++++++------- 3 files changed, 68 insertions(+), 38 deletions(-) (limited to 'svx/source/gallery2') diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx index 9b7cfe2739e6..4c10186cac9b 100644 --- a/svx/source/gallery2/gallery1.cxx +++ b/svx/source/gallery2/gallery1.cxx @@ -78,7 +78,7 @@ GalleryThemeEntry::GalleryThemeEntry( const INetURLObject& rBaseURL, const Strin if( nId && bThemeNameFromResource ) aName = String( GAL_RESID( RID_GALLERYSTR_THEME_START + (sal_uInt16) nId ) ); - if( !aName.getLength() ) + if( !aName.Len() ) aName = rName; } @@ -107,7 +107,7 @@ INetURLObject GalleryThemeEntry::ImplGetURLIgnoreCase( const INetURLObject& rURL // ----------------------------------------------------------------------------- -void GalleryThemeEntry::SetName( const rtl::OUString& rNewName ) +void GalleryThemeEntry::SetName( const String& rNewName ) { if( aName != rNewName ) { @@ -132,12 +132,16 @@ void GalleryThemeEntry::SetId( sal_uInt32 nNewId, sal_Bool bResetThemeName ) SvStream& operator<<( SvStream& rOut, const GalleryImportThemeEntry& rEntry ) { - write_lenPrefixed_uInt8s_FromOUString(rOut, rEntry.aThemeName, RTL_TEXTENCODING_UTF8); - write_lenPrefixed_uInt8s_FromOUString(rOut, rEntry.aUIName, RTL_TEXTENCODING_UTF8); - write_lenPrefixed_uInt8s_FromOUString(rOut, (rEntry.aURL.GetMainURL( INetURLObject::NO_DECODE )), RTL_TEXTENCODING_UTF8); - write_lenPrefixed_uInt8s_FromOUString(rOut, rEntry.aImportName, RTL_TEXTENCODING_UTF8); + rOut.WriteByteString(rtl::OUStringToOString(rEntry.aThemeName, RTL_TEXTENCODING_UTF8)); + + rOut.WriteByteString(rtl::OUStringToOString(rEntry.aUIName, RTL_TEXTENCODING_UTF8)); + + rOut.WriteByteString(rtl::OUStringToOString(String(rEntry.aURL.GetMainURL( INetURLObject::NO_DECODE )), RTL_TEXTENCODING_UTF8)); + + rOut.WriteByteString(rtl::OUStringToOString(rEntry.aImportName, RTL_TEXTENCODING_UTF8)); + + rOut.WriteByteString(rtl::OUString()); - write_lenPrefixed_uInt8s_FromOString(rOut, rtl::OString()); return rOut; } @@ -145,11 +149,22 @@ SvStream& operator<<( SvStream& rOut, const GalleryImportThemeEntry& rEntry ) SvStream& operator>>( SvStream& rIn, GalleryImportThemeEntry& rEntry ) { - rEntry.aThemeName = read_lenPrefixed_uInt8s_ToOUString(rIn, RTL_TEXTENCODING_UTF8); - rEntry.aUIName = read_lenPrefixed_uInt8s_ToOUString(rIn, RTL_TEXTENCODING_UTF8); - rEntry.aURL = read_lenPrefixed_uInt8s_ToOUString(rIn, RTL_TEXTENCODING_UTF8); - rEntry.aImportName = read_lenPrefixed_uInt8s_ToOUString(rIn, RTL_TEXTENCODING_UTF8); - read_lenPrefixed_uInt8s_ToOString(rIn); + ByteString aTmpStr; + + rIn.ReadByteString(aTmpStr); + rEntry.aThemeName = String( aTmpStr, RTL_TEXTENCODING_UTF8 ); + + rIn.ReadByteString(aTmpStr); + rEntry.aUIName = String( aTmpStr, RTL_TEXTENCODING_UTF8 ); + + rIn.ReadByteString(aTmpStr); + rEntry.aURL = INetURLObject( String( aTmpStr, RTL_TEXTENCODING_UTF8 ) ); + + rIn.ReadByteString(aTmpStr); + rEntry.aImportName = String( aTmpStr, RTL_TEXTENCODING_UTF8 ); + + rIn.ReadByteString(aTmpStr); + return rIn; } @@ -532,23 +547,21 @@ void Gallery::ImplWriteImportList() // ------------------------------------------------------------------------ -GalleryThemeEntry* Gallery::ImplGetThemeEntry( const rtl::OUString& rThemeName ) +GalleryThemeEntry* Gallery::ImplGetThemeEntry( const String& rThemeName ) { GalleryThemeEntry* pFound = NULL; - if( rThemeName.getLength() ) - { + if( rThemeName.Len() ) for ( size_t i = 0, n = aThemeList.size(); i < n && !pFound; ++i ) if( rThemeName == aThemeList[ i ]->GetThemeName() ) pFound = aThemeList[ i ]; - } return pFound; } // ------------------------------------------------------------------------ -GalleryImportThemeEntry* Gallery::ImplGetImportThemeEntry( const rtl::OUString& rImportName ) +GalleryImportThemeEntry* Gallery::ImplGetImportThemeEntry( const String& rImportName ) { for ( size_t i = 0, n = aImportList.size(); i < n; ++i ) if ( rImportName == aImportList[ i ]->aUIName ) @@ -558,7 +571,7 @@ GalleryImportThemeEntry* Gallery::ImplGetImportThemeEntry( const rtl::OUString& // ------------------------------------------------------------------------ -rtl::OUString Gallery::GetThemeName( sal_uIntPtr nThemeId ) const +String Gallery::GetThemeName( sal_uIntPtr nThemeId ) const { GalleryThemeEntry* pFound = NULL; @@ -593,7 +606,7 @@ rtl::OUString Gallery::GetThemeName( sal_uIntPtr nThemeId ) const pFound = ( (Gallery*) this )->ImplGetThemeEntry( String::CreateFromAscii( aFallback.GetBuffer() ) ); } - return( pFound ? pFound->GetThemeName() : rtl::OUString() ); + return( pFound ? pFound->GetThemeName() : String() ); } // ------------------------------------------------------------------------ diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx index ddf56cbd7c01..1f03f1397b43 100644 --- a/svx/source/gallery2/galobj.cxx +++ b/svx/source/gallery2/galobj.cxx @@ -168,7 +168,7 @@ void SgaObject::WriteData( SvStream& rOut, const String& rDestDir ) const String aURLWithoutDestDir = String(aURL.GetMainURL( INetURLObject::NO_DECODE )); aURLWithoutDestDir.SearchAndReplace(rDestDir, String()); - write_lenPrefixed_uInt8s_FromOUString(rOut, aURLWithoutDestDir, RTL_TEXTENCODING_UTF8); + rOut.WriteByteString(rtl::OUStringToOString(aURLWithoutDestDir, RTL_TEXTENCODING_UTF8)); } // ------------------------------------------------------------------------ @@ -185,8 +185,9 @@ void SgaObject::ReadData(SvStream& rIn, sal_uInt16& rReadVersion ) else rIn >> aThumbMtf; - rtl::OUString aTmpStr = read_lenPrefixed_uInt8s_ToOUString(rIn, RTL_TEXTENCODING_UTF8); - aURL = INetURLObject(aTmpStr); + ByteString aTmpStr; + rIn.ReadByteString(aTmpStr); + aURL = INetURLObject(rtl::OStringToOUString(aTmpStr,RTL_TEXTENCODING_UTF8)); } // ------------------------------------------------------------------------ @@ -293,8 +294,9 @@ void SgaObjectBmp::WriteData( SvStream& rOut, const String& rDestDir ) const SgaObject::WriteData( rOut, rDestDir ); char aDummy[ 10 ]; rOut.Write( aDummy, 10 ); - write_lenPrefixed_uInt8s_FromOString(rOut, rtl::OString()); //dummy - write_lenPrefixed_uInt8s_FromOUString(rOut, aTitle, RTL_TEXTENCODING_UTF8); + String aDummyStr; + rOut.WriteByteString(rtl::OUStringToOString(aDummyStr, RTL_TEXTENCODING_UTF8)); + rOut.WriteByteString(rtl::OUStringToOString(aTitle, RTL_TEXTENCODING_UTF8)); } // ------------------------------------------------------------------------ @@ -304,10 +306,14 @@ void SgaObjectBmp::ReadData( SvStream& rIn, sal_uInt16& rReadVersion ) SgaObject::ReadData( rIn, rReadVersion ); rIn.SeekRel( 10 ); // 16, 16, 32, 16 - read_lenPrefixed_uInt8s_ToOString(rIn); //dummy + ByteString aTmpStr; + rIn.ReadByteString(aTmpStr); // dummy if( rReadVersion >= 5 ) - aTitle = read_lenPrefixed_uInt8s_ToOUString(rIn, RTL_TEXTENCODING_UTF8); + { + rIn.ReadByteString(aTmpStr); + aTitle = rtl::OStringToOUString(aTmpStr, RTL_TEXTENCODING_UTF8); + } } // ------------------ @@ -374,7 +380,7 @@ void SgaObjectSound::WriteData( SvStream& rOut, const String& rDestDir ) const { SgaObject::WriteData( rOut, rDestDir ); rOut << (sal_uInt16) eSoundType; - write_lenPrefixed_uInt8s_FromOUString(rOut, aTitle, RTL_TEXTENCODING_UTF8); + rOut.WriteByteString(rtl::OUStringToOString(aTitle, RTL_TEXTENCODING_UTF8)); } // ------------------------------------------------------------------------ @@ -390,7 +396,11 @@ void SgaObjectSound::ReadData( SvStream& rIn, sal_uInt16& rReadVersion ) rIn >> nTmp16; eSoundType = (GalSoundType) nTmp16; if( rReadVersion >= 6 ) - aTitle = read_lenPrefixed_uInt8s_ToOUString(rIn, RTL_TEXTENCODING_UTF8); + { + ByteString aTmpStr; + rIn.ReadByteString(aTmpStr); + aTitle = rtl::OStringToOUString(aTmpStr, RTL_TEXTENCODING_UTF8); + } } } @@ -581,7 +591,7 @@ sal_Bool SgaObjectSvDraw::DrawCentered( OutputDevice* pOut, const FmFormModel& r void SgaObjectSvDraw::WriteData( SvStream& rOut, const String& rDestDir ) const { SgaObject::WriteData( rOut, rDestDir ); - write_lenPrefixed_uInt8s_FromOUString(rOut, aTitle, RTL_TEXTENCODING_UTF8); + rOut.WriteByteString(rtl::OUStringToOString(aTitle, RTL_TEXTENCODING_UTF8)); } // ------------------------------------------------------------------------ @@ -591,7 +601,11 @@ void SgaObjectSvDraw::ReadData( SvStream& rIn, sal_uInt16& rReadVersion ) SgaObject::ReadData( rIn, rReadVersion ); if( rReadVersion >= 5 ) - aTitle = read_lenPrefixed_uInt8s_ToOUString(rIn, RTL_TEXTENCODING_UTF8); + { + ByteString aTmpStr; + rIn.ReadByteString(aTmpStr); + aTitle = rtl::OStringToOUString(aTmpStr, RTL_TEXTENCODING_UTF8); + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index 4a34a85ee611..12f1e6d257ab 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -733,7 +733,8 @@ GalleryThemeEntry* GalleryTheme::CreateThemeEntry( const INetURLObject& rURL, sa { sal_uInt32 nThemeId = 0; - rtl::OString aTmpStr = read_lenPrefixed_uInt8s_ToOString(*pIStm); + ByteString aTmpStr; + pIStm->ReadByteString(aTmpStr); aThemeName = rtl::OStringToOUString(aTmpStr, RTL_TEXTENCODING_UTF8); // Charakterkonvertierung durchfuehren @@ -1354,7 +1355,7 @@ SvStream& GalleryTheme::WriteData( SvStream& rOStm ) const sal_Bool bRel; rOStm << (sal_uInt16) 0x0004; - write_lenPrefixed_uInt8s_FromOUString(rOStm, GetRealName(), RTL_TEXTENCODING_UTF8); + rOStm.WriteByteString(rtl::OUStringToOString(GetRealName(), RTL_TEXTENCODING_UTF8)); rOStm << nCount << (sal_uInt16) osl_getThreadTextEncoding(); for( sal_uInt32 i = 0; i < nCount; i++ ) @@ -1394,7 +1395,7 @@ SvStream& GalleryTheme::WriteData( SvStream& rOStm ) const aPath.SearchAndReplace(m_aDestDir, String()); rOStm << bRel; - write_lenPrefixed_uInt8s_FromOUString(rOStm, aPath, RTL_TEXTENCODING_UTF8); + rOStm.WriteByteString(rtl::OUStringToOString(aPath, RTL_TEXTENCODING_UTF8)); rOStm << pObj->nOffset << (sal_uInt16) pObj->eObjKind; } @@ -1432,9 +1433,10 @@ SvStream& GalleryTheme::ReadData( SvStream& rIStm ) String aThemeName; rtl_TextEncoding nTextEncoding; - aImportName = rtl::OUString(); + aImportName = String(); rIStm >> nVersion; - rtl::OString aTmpStr = read_lenPrefixed_uInt8s_ToOString(rIStm); + ByteString aTmpStr; + rIStm.ReadByteString(aTmpStr); rIStm >> nCount; if( nVersion >= 0x0004 ) @@ -1469,12 +1471,13 @@ SvStream& GalleryTheme::ReadData( SvStream& rIStm ) { pObj = new GalleryObject; + ByteString aTempFileName; String aFileName; String aPath; sal_uInt16 nTemp; rIStm >> bRel; - rtl::OString aTempFileName = read_lenPrefixed_uInt8s_ToOString(rIStm); + rIStm.ReadByteString(aTempFileName); rIStm >> pObj->nOffset; rIStm >> nTemp; pObj->eObjKind = (SgaObjKind) nTemp; @@ -1580,7 +1583,7 @@ SvStream& operator>>( SvStream& rIn, GalleryTheme& rTheme ) void GalleryTheme::ImplSetModified( sal_Bool bModified ) { pThm->SetModified( bModified ); } -const rtl::OUString& GalleryTheme::GetRealName() const { return pThm->GetThemeName(); } +const String& GalleryTheme::GetRealName() const { return pThm->GetThemeName(); } const INetURLObject& GalleryTheme::GetThmURL() const { return pThm->GetThmURL(); } const INetURLObject& GalleryTheme::GetSdgURL() const { return pThm->GetSdgURL(); } const INetURLObject& GalleryTheme::GetSdvURL() const { return pThm->GetSdvURL(); } @@ -1591,7 +1594,7 @@ sal_Bool GalleryTheme::IsImported() const { return pThm->IsImported(); } sal_Bool GalleryTheme::IsReadOnly() const { return pThm->IsReadOnly(); } sal_Bool GalleryTheme::IsDefault() const { return pThm->IsDefault(); } sal_Bool GalleryTheme::IsModified() const { return pThm->IsModified(); } -const rtl::OUString& GalleryTheme::GetName() const { return IsImported() ? aImportName : pThm->GetThemeName(); } +const String& GalleryTheme::GetName() const { return IsImported() ? aImportName : pThm->GetThemeName(); } void GalleryTheme::InsertAllThemes( ListBox& rListBox ) { -- cgit