Files
libreoffice/comphelper/source/streaming/basicio.cxx

183 lines
7.5 KiB
C++
Raw Normal View History

2000-09-29 10:28:15 +00:00
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-29 10:28:15 +00:00
*
* $RCSfile: basicio.cxx,v $
2000-09-29 10:28:15 +00:00
*
* $Revision: 1.2 $
2000-09-29 10:28:15 +00:00
*
* last change: $Author: rt $ $Date: 2005-09-08 02:59:53 $
2000-09-29 10:28:15 +00:00
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
2000-09-29 10:28:15 +00:00
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
2000-09-29 10:28:15 +00:00
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
2000-09-29 10:28:15 +00:00
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
2000-09-29 10:28:15 +00:00
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
2000-09-29 10:28:15 +00:00
*
************************************************************************/
#ifndef _COMPHELPER_BASIC_IO_HXX_
#include <comphelper/basicio.hxx>
#endif
//.........................................................................
namespace comphelper
{
//.........................................................................
//------------------------------------------------------------------------------
const staruno::Reference<stario::XObjectOutputStream>& operator << (
const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream,
const starawt::FontDescriptor& _rFont)
{
_rxOutStream->writeUTF( _rFont.Name );
_rxOutStream->writeShort( _rFont.Height );
_rxOutStream->writeShort( _rFont.Width );
_rxOutStream->writeUTF( _rFont.StyleName );
_rxOutStream->writeShort( _rFont.Family );
_rxOutStream->writeShort( _rFont.CharSet );
_rxOutStream->writeShort( _rFont.Pitch );
_rxOutStream->writeDouble( _rFont.CharacterWidth );
_rxOutStream->writeDouble( _rFont.Weight );
_rxOutStream->writeShort( _rFont.Slant );
_rxOutStream->writeShort( _rFont.Underline );
_rxOutStream->writeShort( _rFont.Strikeout );
_rxOutStream->writeDouble( _rFont.Orientation );
_rxOutStream->writeBoolean( _rFont.Kerning );
_rxOutStream->writeBoolean( _rFont.WordLineMode );
_rxOutStream->writeShort( _rFont.Type );
return _rxOutStream;
}
// FontDescriptor
//------------------------------------------------------------------------------
const staruno::Reference<stario::XObjectInputStream>& operator >> (
const staruno::Reference<stario::XObjectInputStream>& _rxInStream,
starawt::FontDescriptor& _rFont)
{
// schreiben des Fontdescriptors
_rFont.Name = _rxInStream->readUTF();
_rFont.Height = _rxInStream->readShort();
_rFont.Width = _rxInStream->readShort();
_rFont.StyleName = _rxInStream->readUTF();
_rFont.Family = _rxInStream->readShort();
_rFont.CharSet = _rxInStream->readShort();
_rFont.Pitch = _rxInStream->readShort();
_rFont.CharacterWidth = _rxInStream->readDouble();
_rFont.Weight = _rxInStream->readDouble();
_rFont.Slant = (starawt::FontSlant)_rxInStream->readShort();
_rFont.Underline = _rxInStream->readShort();
_rFont.Strikeout = _rxInStream->readShort();
_rFont.Orientation = _rxInStream->readDouble();
_rFont.Kerning = _rxInStream->readBoolean();
_rFont.WordLineMode = _rxInStream->readBoolean();
_rFont.Type = _rxInStream->readShort();
return _rxInStream;
}
//------------------------------------------------------------------------------
const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_Bool& _rVal)
{
_rVal = _rxInStream->readBoolean();
return _rxInStream;
}
//------------------------------------------------------------------------------
const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_Bool _bVal)
{
_rxOutStream->writeBoolean(_bVal);
return _rxOutStream;
}
//------------------------------------------------------------------------------
const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, ::rtl::OUString& rStr)
{
rStr = _rxInStream->readUTF();
return _rxInStream;
}
//------------------------------------------------------------------------------
const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, const ::rtl::OUString& rStr)
{
_rxOutStream->writeUTF(rStr);
return _rxOutStream;
}
//------------------------------------------------------------------------------
const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_Int16& _rValue)
{
_rValue = _rxInStream->readShort();
return _rxInStream;
}
//------------------------------------------------------------------------------
const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_Int16 _nValue)
{
_rxOutStream->writeShort(_nValue);
return _rxOutStream;
}
//------------------------------------------------------------------------------
const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_uInt16& _rValue)
{
_rValue = _rxInStream->readShort();
return _rxInStream;
}
//------------------------------------------------------------------------------
const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_uInt16 _nValue)
{
_rxOutStream->writeShort(_nValue);
return _rxOutStream;
}
//------------------------------------------------------------------------------
const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_uInt32& _rValue)
{
_rValue = _rxInStream->readLong();
return _rxInStream;
}
//------------------------------------------------------------------------------
const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_uInt32 _nValue)
{
_rxOutStream->writeLong(_nValue);
return _rxOutStream;
}
//------------------------------------------------------------------------------
const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_Int32& _rValue)
{
_rValue = _rxInStream->readLong();
return _rxInStream;
}
//------------------------------------------------------------------------------
const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_Int32 _nValue)
{
_rxOutStream->writeLong(_nValue);
return _rxOutStream;
}
//.........................................................................
} // namespace comphelper
//.........................................................................