1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <comphelper/basicio.hxx>
21 #include <com/sun/star/awt/FontDescriptor.hpp>
27 const css::uno::Reference
<css::io::XObjectOutputStream
>& operator << (
28 const css::uno::Reference
<css::io::XObjectOutputStream
>& _rxOutStream
,
29 const css::awt::FontDescriptor
& _rFont
)
31 _rxOutStream
->writeUTF( _rFont
.Name
);
32 _rxOutStream
->writeShort( _rFont
.Height
);
33 _rxOutStream
->writeShort( _rFont
.Width
);
34 _rxOutStream
->writeUTF( _rFont
.StyleName
);
35 _rxOutStream
->writeShort( _rFont
.Family
);
36 _rxOutStream
->writeShort( _rFont
.CharSet
);
37 _rxOutStream
->writeShort( _rFont
.Pitch
);
38 _rxOutStream
->writeDouble( _rFont
.CharacterWidth
);
39 _rxOutStream
->writeDouble( _rFont
.Weight
);
40 _rxOutStream
->writeShort( static_cast< sal_Int16
>(_rFont
.Slant
) );
41 _rxOutStream
->writeShort( _rFont
.Underline
);
42 _rxOutStream
->writeShort( _rFont
.Strikeout
);
43 _rxOutStream
->writeDouble( _rFont
.Orientation
);
44 _rxOutStream
->writeBoolean( _rFont
.Kerning
);
45 _rxOutStream
->writeBoolean( _rFont
.WordLineMode
);
46 _rxOutStream
->writeShort( _rFont
.Type
);
52 const css::uno::Reference
<css::io::XObjectInputStream
>& operator >> (
53 const css::uno::Reference
<css::io::XObjectInputStream
>& _rxInStream
,
54 css::awt::FontDescriptor
& _rFont
)
56 // writing the FontDescriptor
57 _rFont
.Name
= _rxInStream
->readUTF();
58 _rFont
.Height
= _rxInStream
->readShort();
59 _rFont
.Width
= _rxInStream
->readShort();
60 _rFont
.StyleName
= _rxInStream
->readUTF();
61 _rFont
.Family
= _rxInStream
->readShort();
62 _rFont
.CharSet
= _rxInStream
->readShort();
63 _rFont
.Pitch
= _rxInStream
->readShort();
64 _rFont
.CharacterWidth
= static_cast< float >(_rxInStream
->readDouble());
65 _rFont
.Weight
= static_cast< float >(_rxInStream
->readDouble());
66 _rFont
.Slant
= static_cast<css::awt::FontSlant
>(_rxInStream
->readShort());
67 _rFont
.Underline
= _rxInStream
->readShort();
68 _rFont
.Strikeout
= _rxInStream
->readShort();
69 _rFont
.Orientation
= static_cast< float >(_rxInStream
->readDouble());
70 _rFont
.Kerning
= _rxInStream
->readBoolean() != 0;
71 _rFont
.WordLineMode
= _rxInStream
->readBoolean() != 0;
72 _rFont
.Type
= _rxInStream
->readShort();
77 const css::uno::Reference
<css::io::XObjectInputStream
>& operator >> (const css::uno::Reference
<css::io::XObjectInputStream
>& _rxInStream
, bool& _rVal
)
79 _rVal
= _rxInStream
->readBoolean();
84 const css::uno::Reference
<css::io::XObjectOutputStream
>& operator << (const css::uno::Reference
<css::io::XObjectOutputStream
>& _rxOutStream
, bool _bVal
)
86 _rxOutStream
->writeBoolean(_bVal
);
91 const css::uno::Reference
<css::io::XObjectInputStream
>& operator >> (const css::uno::Reference
<css::io::XObjectInputStream
>& _rxInStream
, OUString
& rStr
)
93 rStr
= _rxInStream
->readUTF();
98 const css::uno::Reference
<css::io::XObjectOutputStream
>& operator << (const css::uno::Reference
<css::io::XObjectOutputStream
>& _rxOutStream
, const OUString
& rStr
)
100 _rxOutStream
->writeUTF(rStr
);
105 const css::uno::Reference
<css::io::XObjectInputStream
>& operator >> (const css::uno::Reference
<css::io::XObjectInputStream
>& _rxInStream
, sal_Int16
& _rValue
)
107 _rValue
= _rxInStream
->readShort();
112 const css::uno::Reference
<css::io::XObjectOutputStream
>& operator << (const css::uno::Reference
<css::io::XObjectOutputStream
>& _rxOutStream
, sal_Int16 _nValue
)
114 _rxOutStream
->writeShort(_nValue
);
119 const css::uno::Reference
<css::io::XObjectInputStream
>& operator >> (const css::uno::Reference
<css::io::XObjectInputStream
>& _rxInStream
, sal_uInt16
& _rValue
)
121 _rValue
= _rxInStream
->readShort();
126 const css::uno::Reference
<css::io::XObjectOutputStream
>& operator << (const css::uno::Reference
<css::io::XObjectOutputStream
>& _rxOutStream
, sal_uInt16 _nValue
)
128 _rxOutStream
->writeShort(_nValue
);
133 const css::uno::Reference
<css::io::XObjectInputStream
>& operator >> (const css::uno::Reference
<css::io::XObjectInputStream
>& _rxInStream
, sal_uInt32
& _rValue
)
135 _rValue
= _rxInStream
->readLong();
140 const css::uno::Reference
<css::io::XObjectOutputStream
>& operator << (const css::uno::Reference
<css::io::XObjectOutputStream
>& _rxOutStream
, sal_uInt32 _nValue
)
142 _rxOutStream
->writeLong(_nValue
);
147 const css::uno::Reference
<css::io::XObjectInputStream
>& operator >> (const css::uno::Reference
<css::io::XObjectInputStream
>& _rxInStream
, sal_Int32
& _rValue
)
149 _rValue
= _rxInStream
->readLong();
154 const css::uno::Reference
<css::io::XObjectOutputStream
>& operator << (const css::uno::Reference
<css::io::XObjectOutputStream
>& _rxOutStream
, sal_Int32 _nValue
)
156 _rxOutStream
->writeLong(_nValue
);
161 } // namespace comphelper
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */