1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: basicio.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_comphelper.hxx"
33 #include <comphelper/basicio.hxx>
35 //.........................................................................
38 //.........................................................................
40 //------------------------------------------------------------------------------
41 const staruno::Reference
<stario::XObjectOutputStream
>& operator << (
42 const staruno::Reference
<stario::XObjectOutputStream
>& _rxOutStream
,
43 const starawt::FontDescriptor
& _rFont
)
45 _rxOutStream
->writeUTF( _rFont
.Name
);
46 _rxOutStream
->writeShort( _rFont
.Height
);
47 _rxOutStream
->writeShort( _rFont
.Width
);
48 _rxOutStream
->writeUTF( _rFont
.StyleName
);
49 _rxOutStream
->writeShort( _rFont
.Family
);
50 _rxOutStream
->writeShort( _rFont
.CharSet
);
51 _rxOutStream
->writeShort( _rFont
.Pitch
);
52 _rxOutStream
->writeDouble( _rFont
.CharacterWidth
);
53 _rxOutStream
->writeDouble( _rFont
.Weight
);
54 _rxOutStream
->writeShort( static_cast< sal_Int16
>(_rFont
.Slant
) );
55 _rxOutStream
->writeShort( _rFont
.Underline
);
56 _rxOutStream
->writeShort( _rFont
.Strikeout
);
57 _rxOutStream
->writeDouble( _rFont
.Orientation
);
58 _rxOutStream
->writeBoolean( _rFont
.Kerning
);
59 _rxOutStream
->writeBoolean( _rFont
.WordLineMode
);
60 _rxOutStream
->writeShort( _rFont
.Type
);
65 //------------------------------------------------------------------------------
66 const staruno::Reference
<stario::XObjectInputStream
>& operator >> (
67 const staruno::Reference
<stario::XObjectInputStream
>& _rxInStream
,
68 starawt::FontDescriptor
& _rFont
)
70 // schreiben des Fontdescriptors
71 _rFont
.Name
= _rxInStream
->readUTF();
72 _rFont
.Height
= _rxInStream
->readShort();
73 _rFont
.Width
= _rxInStream
->readShort();
74 _rFont
.StyleName
= _rxInStream
->readUTF();
75 _rFont
.Family
= _rxInStream
->readShort();
76 _rFont
.CharSet
= _rxInStream
->readShort();
77 _rFont
.Pitch
= _rxInStream
->readShort();
78 _rFont
.CharacterWidth
= static_cast< float >(_rxInStream
->readDouble());
79 _rFont
.Weight
= static_cast< float >(_rxInStream
->readDouble());
80 _rFont
.Slant
= (starawt::FontSlant
)_rxInStream
->readShort();
81 _rFont
.Underline
= _rxInStream
->readShort();
82 _rFont
.Strikeout
= _rxInStream
->readShort();
83 _rFont
.Orientation
= static_cast< float >(_rxInStream
->readDouble());
84 _rFont
.Kerning
= _rxInStream
->readBoolean();
85 _rFont
.WordLineMode
= _rxInStream
->readBoolean();
86 _rFont
.Type
= _rxInStream
->readShort();
90 //------------------------------------------------------------------------------
91 const staruno::Reference
<stario::XObjectInputStream
>& operator >> (const staruno::Reference
<stario::XObjectInputStream
>& _rxInStream
, sal_Bool
& _rVal
)
93 _rVal
= _rxInStream
->readBoolean();
97 //------------------------------------------------------------------------------
98 const staruno::Reference
<stario::XObjectOutputStream
>& operator << (const staruno::Reference
<stario::XObjectOutputStream
>& _rxOutStream
, sal_Bool _bVal
)
100 _rxOutStream
->writeBoolean(_bVal
);
104 //------------------------------------------------------------------------------
105 const staruno::Reference
<stario::XObjectInputStream
>& operator >> (const staruno::Reference
<stario::XObjectInputStream
>& _rxInStream
, ::rtl::OUString
& rStr
)
107 rStr
= _rxInStream
->readUTF();
111 //------------------------------------------------------------------------------
112 const staruno::Reference
<stario::XObjectOutputStream
>& operator << (const staruno::Reference
<stario::XObjectOutputStream
>& _rxOutStream
, const ::rtl::OUString
& rStr
)
114 _rxOutStream
->writeUTF(rStr
);
118 //------------------------------------------------------------------------------
119 const staruno::Reference
<stario::XObjectInputStream
>& operator >> (const staruno::Reference
<stario::XObjectInputStream
>& _rxInStream
, sal_Int16
& _rValue
)
121 _rValue
= _rxInStream
->readShort();
125 //------------------------------------------------------------------------------
126 const staruno::Reference
<stario::XObjectOutputStream
>& operator << (const staruno::Reference
<stario::XObjectOutputStream
>& _rxOutStream
, sal_Int16 _nValue
)
128 _rxOutStream
->writeShort(_nValue
);
132 //------------------------------------------------------------------------------
133 const staruno::Reference
<stario::XObjectInputStream
>& operator >> (const staruno::Reference
<stario::XObjectInputStream
>& _rxInStream
, sal_uInt16
& _rValue
)
135 _rValue
= _rxInStream
->readShort();
139 //------------------------------------------------------------------------------
140 const staruno::Reference
<stario::XObjectOutputStream
>& operator << (const staruno::Reference
<stario::XObjectOutputStream
>& _rxOutStream
, sal_uInt16 _nValue
)
142 _rxOutStream
->writeShort(_nValue
);
146 //------------------------------------------------------------------------------
147 const staruno::Reference
<stario::XObjectInputStream
>& operator >> (const staruno::Reference
<stario::XObjectInputStream
>& _rxInStream
, sal_uInt32
& _rValue
)
149 _rValue
= _rxInStream
->readLong();
153 //------------------------------------------------------------------------------
154 const staruno::Reference
<stario::XObjectOutputStream
>& operator << (const staruno::Reference
<stario::XObjectOutputStream
>& _rxOutStream
, sal_uInt32 _nValue
)
156 _rxOutStream
->writeLong(_nValue
);
160 //------------------------------------------------------------------------------
161 const staruno::Reference
<stario::XObjectInputStream
>& operator >> (const staruno::Reference
<stario::XObjectInputStream
>& _rxInStream
, sal_Int32
& _rValue
)
163 _rValue
= _rxInStream
->readLong();
167 //------------------------------------------------------------------------------
168 const staruno::Reference
<stario::XObjectOutputStream
>& operator << (const staruno::Reference
<stario::XObjectOutputStream
>& _rxOutStream
, sal_Int32 _nValue
)
170 _rxOutStream
->writeLong(_nValue
);
174 //.........................................................................
175 } // namespace comphelper
176 //.........................................................................