1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
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.
14  *
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).
20  *
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.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_comphelper.hxx"
30 #include <comphelper/basicio.hxx>
31 
32 //.........................................................................
33 namespace comphelper
34 {
35 //.........................................................................
36 
37 //------------------------------------------------------------------------------
38 const staruno::Reference<stario::XObjectOutputStream>& operator << (
39 		const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream,
40 		const starawt::FontDescriptor& _rFont)
41 {
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;
59 }
60 
61 // FontDescriptor
62 //------------------------------------------------------------------------------
63 const staruno::Reference<stario::XObjectInputStream>& operator >> (
64 		const staruno::Reference<stario::XObjectInputStream>& _rxInStream,
65 		starawt::FontDescriptor& _rFont)
66 {
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;
85 }
86 
87 //------------------------------------------------------------------------------
88 const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_Bool& _rVal)
89 {
90 	_rVal = _rxInStream->readBoolean();
91 	return _rxInStream;
92 }
93 
94 //------------------------------------------------------------------------------
95 const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_Bool _bVal)
96 {
97 	_rxOutStream->writeBoolean(_bVal);
98 	return _rxOutStream;
99 }
100 
101 //------------------------------------------------------------------------------
102 const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, ::rtl::OUString& rStr)
103 {
104 	rStr = _rxInStream->readUTF();
105 	return _rxInStream;
106 }
107 
108 //------------------------------------------------------------------------------
109 const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, const ::rtl::OUString& rStr)
110 {
111 	_rxOutStream->writeUTF(rStr);
112 	return _rxOutStream;
113 }
114 
115 //------------------------------------------------------------------------------
116 const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_Int16& _rValue)
117 {
118 	_rValue = _rxInStream->readShort();
119 	return _rxInStream;
120 }
121 
122 //------------------------------------------------------------------------------
123 const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_Int16 _nValue)
124 {
125 	_rxOutStream->writeShort(_nValue);
126 	return _rxOutStream;
127 }
128 
129 //------------------------------------------------------------------------------
130 const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_uInt16& _rValue)
131 {
132 	_rValue = _rxInStream->readShort();
133 	return _rxInStream;
134 }
135 
136 //------------------------------------------------------------------------------
137 const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_uInt16 _nValue)
138 {
139 	_rxOutStream->writeShort(_nValue);
140 	return _rxOutStream;
141 }
142 
143 //------------------------------------------------------------------------------
144 const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_uInt32& _rValue)
145 {
146 	_rValue = _rxInStream->readLong();
147 	return _rxInStream;
148 }
149 
150 //------------------------------------------------------------------------------
151 const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_uInt32 _nValue)
152 {
153 	_rxOutStream->writeLong(_nValue);
154 	return _rxOutStream;
155 }
156 
157 //------------------------------------------------------------------------------
158 const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_Int32& _rValue)
159 {
160 	_rValue = _rxInStream->readLong();
161 	return _rxInStream;
162 }
163 
164 //------------------------------------------------------------------------------
165 const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_Int32 _nValue)
166 {
167 	_rxOutStream->writeLong(_nValue);
168 	return _rxOutStream;
169 }
170 
171 //.........................................................................
172 }	// namespace comphelper
173 //.........................................................................
174 
175