1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_comphelper.hxx"
26 #include <comphelper/basicio.hxx>
27
28 //.........................................................................
29 namespace comphelper
30 {
31 //.........................................................................
32
33 //------------------------------------------------------------------------------
operator <<(const staruno::Reference<stario::XObjectOutputStream> & _rxOutStream,const starawt::FontDescriptor & _rFont)34 const staruno::Reference<stario::XObjectOutputStream>& operator << (
35 const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream,
36 const starawt::FontDescriptor& _rFont)
37 {
38 _rxOutStream->writeUTF( _rFont.Name );
39 _rxOutStream->writeShort( _rFont.Height );
40 _rxOutStream->writeShort( _rFont.Width );
41 _rxOutStream->writeUTF( _rFont.StyleName );
42 _rxOutStream->writeShort( _rFont.Family );
43 _rxOutStream->writeShort( _rFont.CharSet );
44 _rxOutStream->writeShort( _rFont.Pitch );
45 _rxOutStream->writeDouble( _rFont.CharacterWidth );
46 _rxOutStream->writeDouble( _rFont.Weight );
47 _rxOutStream->writeShort( static_cast< sal_Int16 >(_rFont.Slant) );
48 _rxOutStream->writeShort( _rFont.Underline );
49 _rxOutStream->writeShort( _rFont.Strikeout );
50 _rxOutStream->writeDouble( _rFont.Orientation );
51 _rxOutStream->writeBoolean( _rFont.Kerning );
52 _rxOutStream->writeBoolean( _rFont.WordLineMode );
53 _rxOutStream->writeShort( _rFont.Type );
54 return _rxOutStream;
55 }
56
57 // FontDescriptor
58 //------------------------------------------------------------------------------
operator >>(const staruno::Reference<stario::XObjectInputStream> & _rxInStream,starawt::FontDescriptor & _rFont)59 const staruno::Reference<stario::XObjectInputStream>& operator >> (
60 const staruno::Reference<stario::XObjectInputStream>& _rxInStream,
61 starawt::FontDescriptor& _rFont)
62 {
63 // schreiben des Fontdescriptors
64 _rFont.Name = _rxInStream->readUTF();
65 _rFont.Height = _rxInStream->readShort();
66 _rFont.Width = _rxInStream->readShort();
67 _rFont.StyleName = _rxInStream->readUTF();
68 _rFont.Family = _rxInStream->readShort();
69 _rFont.CharSet = _rxInStream->readShort();
70 _rFont.Pitch = _rxInStream->readShort();
71 _rFont.CharacterWidth = static_cast< float >(_rxInStream->readDouble());
72 _rFont.Weight = static_cast< float >(_rxInStream->readDouble());
73 _rFont.Slant = (starawt::FontSlant)_rxInStream->readShort();
74 _rFont.Underline = _rxInStream->readShort();
75 _rFont.Strikeout = _rxInStream->readShort();
76 _rFont.Orientation = static_cast< float >(_rxInStream->readDouble());
77 _rFont.Kerning = _rxInStream->readBoolean();
78 _rFont.WordLineMode = _rxInStream->readBoolean();
79 _rFont.Type = _rxInStream->readShort();
80 return _rxInStream;
81 }
82
83 //------------------------------------------------------------------------------
operator >>(const staruno::Reference<stario::XObjectInputStream> & _rxInStream,sal_Bool & _rVal)84 const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_Bool& _rVal)
85 {
86 _rVal = _rxInStream->readBoolean();
87 return _rxInStream;
88 }
89
90 //------------------------------------------------------------------------------
operator <<(const staruno::Reference<stario::XObjectOutputStream> & _rxOutStream,sal_Bool _bVal)91 const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_Bool _bVal)
92 {
93 _rxOutStream->writeBoolean(_bVal);
94 return _rxOutStream;
95 }
96
97 //------------------------------------------------------------------------------
operator >>(const staruno::Reference<stario::XObjectInputStream> & _rxInStream,::rtl::OUString & rStr)98 const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, ::rtl::OUString& rStr)
99 {
100 rStr = _rxInStream->readUTF();
101 return _rxInStream;
102 }
103
104 //------------------------------------------------------------------------------
operator <<(const staruno::Reference<stario::XObjectOutputStream> & _rxOutStream,const::rtl::OUString & rStr)105 const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, const ::rtl::OUString& rStr)
106 {
107 _rxOutStream->writeUTF(rStr);
108 return _rxOutStream;
109 }
110
111 //------------------------------------------------------------------------------
operator >>(const staruno::Reference<stario::XObjectInputStream> & _rxInStream,sal_Int16 & _rValue)112 const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_Int16& _rValue)
113 {
114 _rValue = _rxInStream->readShort();
115 return _rxInStream;
116 }
117
118 //------------------------------------------------------------------------------
operator <<(const staruno::Reference<stario::XObjectOutputStream> & _rxOutStream,sal_Int16 _nValue)119 const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_Int16 _nValue)
120 {
121 _rxOutStream->writeShort(_nValue);
122 return _rxOutStream;
123 }
124
125 //------------------------------------------------------------------------------
operator >>(const staruno::Reference<stario::XObjectInputStream> & _rxInStream,sal_uInt16 & _rValue)126 const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_uInt16& _rValue)
127 {
128 _rValue = _rxInStream->readShort();
129 return _rxInStream;
130 }
131
132 //------------------------------------------------------------------------------
operator <<(const staruno::Reference<stario::XObjectOutputStream> & _rxOutStream,sal_uInt16 _nValue)133 const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_uInt16 _nValue)
134 {
135 _rxOutStream->writeShort(_nValue);
136 return _rxOutStream;
137 }
138
139 //------------------------------------------------------------------------------
operator >>(const staruno::Reference<stario::XObjectInputStream> & _rxInStream,sal_uInt32 & _rValue)140 const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_uInt32& _rValue)
141 {
142 _rValue = _rxInStream->readLong();
143 return _rxInStream;
144 }
145
146 //------------------------------------------------------------------------------
operator <<(const staruno::Reference<stario::XObjectOutputStream> & _rxOutStream,sal_uInt32 _nValue)147 const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_uInt32 _nValue)
148 {
149 _rxOutStream->writeLong(_nValue);
150 return _rxOutStream;
151 }
152
153 //------------------------------------------------------------------------------
operator >>(const staruno::Reference<stario::XObjectInputStream> & _rxInStream,sal_Int32 & _rValue)154 const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_Int32& _rValue)
155 {
156 _rValue = _rxInStream->readLong();
157 return _rxInStream;
158 }
159
160 //------------------------------------------------------------------------------
operator <<(const staruno::Reference<stario::XObjectOutputStream> & _rxOutStream,sal_Int32 _nValue)161 const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_Int32 _nValue)
162 {
163 _rxOutStream->writeLong(_nValue);
164 return _rxOutStream;
165 }
166
167 //.........................................................................
168 } // namespace comphelper
169 //.........................................................................
170
171