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 <comphelper/bytereader.hxx>
22 #include <comphelper/servicehelper.hxx>
23 #include <com/sun/star/awt/FontDescriptor.hpp>
29 const css::uno::Reference
<css::io::XObjectOutputStream
>& operator << (
30 const css::uno::Reference
<css::io::XObjectOutputStream
>& _rxOutStream
,
31 const css::awt::FontDescriptor
& _rFont
)
33 _rxOutStream
->writeUTF( _rFont
.Name
);
34 _rxOutStream
->writeShort( _rFont
.Height
);
35 _rxOutStream
->writeShort( _rFont
.Width
);
36 _rxOutStream
->writeUTF( _rFont
.StyleName
);
37 _rxOutStream
->writeShort( _rFont
.Family
);
38 _rxOutStream
->writeShort( _rFont
.CharSet
);
39 _rxOutStream
->writeShort( _rFont
.Pitch
);
40 _rxOutStream
->writeDouble( _rFont
.CharacterWidth
);
41 _rxOutStream
->writeDouble( _rFont
.Weight
);
42 _rxOutStream
->writeShort( static_cast< sal_Int16
>(_rFont
.Slant
) );
43 _rxOutStream
->writeShort( _rFont
.Underline
);
44 _rxOutStream
->writeShort( _rFont
.Strikeout
);
45 _rxOutStream
->writeDouble( _rFont
.Orientation
);
46 _rxOutStream
->writeBoolean( _rFont
.Kerning
);
47 _rxOutStream
->writeBoolean( _rFont
.WordLineMode
);
48 _rxOutStream
->writeShort( _rFont
.Type
);
54 const css::uno::Reference
<css::io::XObjectInputStream
>& operator >> (
55 const css::uno::Reference
<css::io::XObjectInputStream
>& _rxInStream
,
56 css::awt::FontDescriptor
& _rFont
)
58 // writing the FontDescriptor
59 _rFont
.Name
= _rxInStream
->readUTF();
60 _rFont
.Height
= _rxInStream
->readShort();
61 _rFont
.Width
= _rxInStream
->readShort();
62 _rFont
.StyleName
= _rxInStream
->readUTF();
63 _rFont
.Family
= _rxInStream
->readShort();
64 _rFont
.CharSet
= _rxInStream
->readShort();
65 _rFont
.Pitch
= _rxInStream
->readShort();
66 _rFont
.CharacterWidth
= static_cast< float >(_rxInStream
->readDouble());
67 _rFont
.Weight
= static_cast< float >(_rxInStream
->readDouble());
68 _rFont
.Slant
= static_cast<css::awt::FontSlant
>(_rxInStream
->readShort());
69 _rFont
.Underline
= _rxInStream
->readShort();
70 _rFont
.Strikeout
= _rxInStream
->readShort();
71 _rFont
.Orientation
= static_cast< float >(_rxInStream
->readDouble());
72 _rFont
.Kerning
= _rxInStream
->readBoolean() != 0;
73 _rFont
.WordLineMode
= _rxInStream
->readBoolean() != 0;
74 _rFont
.Type
= _rxInStream
->readShort();
79 const css::uno::Reference
<css::io::XObjectInputStream
>& operator >> (const css::uno::Reference
<css::io::XObjectInputStream
>& _rxInStream
, bool& _rVal
)
81 _rVal
= _rxInStream
->readBoolean();
86 const css::uno::Reference
<css::io::XObjectOutputStream
>& operator << (const css::uno::Reference
<css::io::XObjectOutputStream
>& _rxOutStream
, bool _bVal
)
88 _rxOutStream
->writeBoolean(_bVal
);
93 const css::uno::Reference
<css::io::XObjectInputStream
>& operator >> (const css::uno::Reference
<css::io::XObjectInputStream
>& _rxInStream
, OUString
& rStr
)
95 rStr
= _rxInStream
->readUTF();
100 const css::uno::Reference
<css::io::XObjectOutputStream
>& operator << (const css::uno::Reference
<css::io::XObjectOutputStream
>& _rxOutStream
, const OUString
& rStr
)
102 _rxOutStream
->writeUTF(rStr
);
107 const css::uno::Reference
<css::io::XObjectInputStream
>& operator >> (const css::uno::Reference
<css::io::XObjectInputStream
>& _rxInStream
, sal_Int16
& _rValue
)
109 _rValue
= _rxInStream
->readShort();
114 const css::uno::Reference
<css::io::XObjectOutputStream
>& operator << (const css::uno::Reference
<css::io::XObjectOutputStream
>& _rxOutStream
, sal_Int16 _nValue
)
116 _rxOutStream
->writeShort(_nValue
);
121 const css::uno::Reference
<css::io::XObjectInputStream
>& operator >> (const css::uno::Reference
<css::io::XObjectInputStream
>& _rxInStream
, sal_uInt16
& _rValue
)
123 _rValue
= _rxInStream
->readShort();
128 const css::uno::Reference
<css::io::XObjectOutputStream
>& operator << (const css::uno::Reference
<css::io::XObjectOutputStream
>& _rxOutStream
, sal_uInt16 _nValue
)
130 _rxOutStream
->writeShort(_nValue
);
135 const css::uno::Reference
<css::io::XObjectInputStream
>& operator >> (const css::uno::Reference
<css::io::XObjectInputStream
>& _rxInStream
, sal_uInt32
& _rValue
)
137 _rValue
= _rxInStream
->readLong();
142 const css::uno::Reference
<css::io::XObjectOutputStream
>& operator << (const css::uno::Reference
<css::io::XObjectOutputStream
>& _rxOutStream
, sal_uInt32 _nValue
)
144 _rxOutStream
->writeLong(_nValue
);
149 const css::uno::Reference
<css::io::XObjectInputStream
>& operator >> (const css::uno::Reference
<css::io::XObjectInputStream
>& _rxInStream
, sal_Int32
& _rValue
)
151 _rValue
= _rxInStream
->readLong();
156 const css::uno::Reference
<css::io::XObjectOutputStream
>& operator << (const css::uno::Reference
<css::io::XObjectOutputStream
>& _rxOutStream
, sal_Int32 _nValue
)
158 _rxOutStream
->writeLong(_nValue
);
162 ByteReader::~ByteReader() {}
164 ByteWriter::~ByteWriter() {}
166 } // namespace comphelper
169 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */