From 5609c512cd4d2899300b432d88d93cff05a05c87 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Fri, 23 Sep 2011 17:31:46 +0100 Subject: move OCX_Control ( and subclasses ) and OCX control export to oox --- oox/source/helper/binaryoutputstream.cxx | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'oox/source/helper') diff --git a/oox/source/helper/binaryoutputstream.cxx b/oox/source/helper/binaryoutputstream.cxx index 76f08ed67ff8..c96eeb95997f 100644 --- a/oox/source/helper/binaryoutputstream.cxx +++ b/oox/source/helper/binaryoutputstream.cxx @@ -40,6 +40,10 @@ namespace oox { using namespace ::com::sun::star::io; using namespace ::com::sun::star::uno; +using ::rtl::OString; +using ::rtl::OUString; +using ::rtl::OUStringToOString; + namespace { const sal_Int32 OUTPUTSTREAM_BUFFERSIZE = 0x8000; @@ -110,6 +114,34 @@ void BinaryXOutputStream::writeMemory( const void* pMem, sal_Int32 nBytes, size_ } } +void +BinaryOutputStream::writeCharArrayUC( const OUString& rString, rtl_TextEncoding eTextEnc, bool bAllowNulChars ) +{ + OString sBuf( OUStringToOString( rString, eTextEnc ) ); + if( !bAllowNulChars ) + sBuf.replace( '\0', '?' ); + writeMemory( static_cast< const void* >( sBuf.getStr() ), sBuf.getLength() ); +} + +void +BinaryOutputStream::writeUnicodeArray( const ::rtl::OUString& rString, bool bAllowNulChars ) +{ + OUString sBuf( rString ); + if( !bAllowNulChars ) + sBuf.replace( '\0', '?' ); + writeArray( sBuf.getStr(), sBuf.getLength() ); +} + +void +BinaryOutputStream::writeCompressedUnicodeArray( const rtl::OUString& rString, bool bCompressed, bool bAllowNulChars ) +{ + if ( bCompressed ) + // ISO-8859-1 maps all byte values 0xHH to the same Unicode code point U+00HH + writeCharArrayUC( rString, RTL_TEXTENCODING_ISO_8859_1, bAllowNulChars ); + else + writeUnicodeArray( rString, bAllowNulChars ); +} + // ============================================================================ SequenceOutputStream::SequenceOutputStream( StreamDataSequence& rData ) : -- cgit v1.2.3