merged tag ooo/OOO330_m14
[LibreOffice.git] / comphelper / source / streaming / basicio.cxx
blobeef5c6b844fab78a60c51be7d2e265ef3e0026a5
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_comphelper.hxx"
30 #include <comphelper/basicio.hxx>
32 //.........................................................................
33 namespace comphelper
35 //.........................................................................
37 //------------------------------------------------------------------------------
38 const staruno::Reference<stario::XObjectOutputStream>& operator << (
39 const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream,
40 const starawt::FontDescriptor& _rFont)
42 _rxOutStream->writeUTF( _rFont.Name );
43 _rxOutStream->writeShort( _rFont.Height );
44 _rxOutStream->writeShort( _rFont.Width );
45 _rxOutStream->writeUTF( _rFont.StyleName );
46 _rxOutStream->writeShort( _rFont.Family );
47 _rxOutStream->writeShort( _rFont.CharSet );
48 _rxOutStream->writeShort( _rFont.Pitch );
49 _rxOutStream->writeDouble( _rFont.CharacterWidth );
50 _rxOutStream->writeDouble( _rFont.Weight );
51 _rxOutStream->writeShort( static_cast< sal_Int16 >(_rFont.Slant) );
52 _rxOutStream->writeShort( _rFont.Underline );
53 _rxOutStream->writeShort( _rFont.Strikeout );
54 _rxOutStream->writeDouble( _rFont.Orientation );
55 _rxOutStream->writeBoolean( _rFont.Kerning );
56 _rxOutStream->writeBoolean( _rFont.WordLineMode );
57 _rxOutStream->writeShort( _rFont.Type );
58 return _rxOutStream;
61 // FontDescriptor
62 //------------------------------------------------------------------------------
63 const staruno::Reference<stario::XObjectInputStream>& operator >> (
64 const staruno::Reference<stario::XObjectInputStream>& _rxInStream,
65 starawt::FontDescriptor& _rFont)
67 // schreiben des Fontdescriptors
68 _rFont.Name = _rxInStream->readUTF();
69 _rFont.Height = _rxInStream->readShort();
70 _rFont.Width = _rxInStream->readShort();
71 _rFont.StyleName = _rxInStream->readUTF();
72 _rFont.Family = _rxInStream->readShort();
73 _rFont.CharSet = _rxInStream->readShort();
74 _rFont.Pitch = _rxInStream->readShort();
75 _rFont.CharacterWidth = static_cast< float >(_rxInStream->readDouble());
76 _rFont.Weight = static_cast< float >(_rxInStream->readDouble());
77 _rFont.Slant = (starawt::FontSlant)_rxInStream->readShort();
78 _rFont.Underline = _rxInStream->readShort();
79 _rFont.Strikeout = _rxInStream->readShort();
80 _rFont.Orientation = static_cast< float >(_rxInStream->readDouble());
81 _rFont.Kerning = _rxInStream->readBoolean();
82 _rFont.WordLineMode = _rxInStream->readBoolean();
83 _rFont.Type = _rxInStream->readShort();
84 return _rxInStream;
87 //------------------------------------------------------------------------------
88 const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_Bool& _rVal)
90 _rVal = _rxInStream->readBoolean();
91 return _rxInStream;
94 //------------------------------------------------------------------------------
95 const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_Bool _bVal)
97 _rxOutStream->writeBoolean(_bVal);
98 return _rxOutStream;
101 //------------------------------------------------------------------------------
102 const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, ::rtl::OUString& rStr)
104 rStr = _rxInStream->readUTF();
105 return _rxInStream;
108 //------------------------------------------------------------------------------
109 const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, const ::rtl::OUString& rStr)
111 _rxOutStream->writeUTF(rStr);
112 return _rxOutStream;
115 //------------------------------------------------------------------------------
116 const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_Int16& _rValue)
118 _rValue = _rxInStream->readShort();
119 return _rxInStream;
122 //------------------------------------------------------------------------------
123 const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_Int16 _nValue)
125 _rxOutStream->writeShort(_nValue);
126 return _rxOutStream;
129 //------------------------------------------------------------------------------
130 const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_uInt16& _rValue)
132 _rValue = _rxInStream->readShort();
133 return _rxInStream;
136 //------------------------------------------------------------------------------
137 const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_uInt16 _nValue)
139 _rxOutStream->writeShort(_nValue);
140 return _rxOutStream;
143 //------------------------------------------------------------------------------
144 const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_uInt32& _rValue)
146 _rValue = _rxInStream->readLong();
147 return _rxInStream;
150 //------------------------------------------------------------------------------
151 const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_uInt32 _nValue)
153 _rxOutStream->writeLong(_nValue);
154 return _rxOutStream;
157 //------------------------------------------------------------------------------
158 const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_Int32& _rValue)
160 _rValue = _rxInStream->readLong();
161 return _rxInStream;
164 //------------------------------------------------------------------------------
165 const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_Int32 _nValue)
167 _rxOutStream->writeLong(_nValue);
168 return _rxOutStream;
171 //.........................................................................
172 } // namespace comphelper
173 //.........................................................................