LibreOffice Module comphelper (master) 1
basicio.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
23#include <com/sun/star/awt/FontDescriptor.hpp>
24
25namespace comphelper
26{
27
28
29const css::uno::Reference<css::io::XObjectOutputStream>& operator << (
30 const css::uno::Reference<css::io::XObjectOutputStream>& _rxOutStream,
31 const css::awt::FontDescriptor& _rFont)
32{
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 );
49 return _rxOutStream;
50}
51
52// FontDescriptor
53
54const css::uno::Reference<css::io::XObjectInputStream>& operator >> (
55 const css::uno::Reference<css::io::XObjectInputStream>& _rxInStream,
56 css::awt::FontDescriptor& _rFont)
57{
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();
75 return _rxInStream;
76}
77
78
79const css::uno::Reference<css::io::XObjectInputStream>& operator >> (const css::uno::Reference<css::io::XObjectInputStream>& _rxInStream, bool& _rVal)
80{
81 _rVal = _rxInStream->readBoolean();
82 return _rxInStream;
83}
84
85
86const css::uno::Reference<css::io::XObjectOutputStream>& operator << (const css::uno::Reference<css::io::XObjectOutputStream>& _rxOutStream, bool _bVal)
87{
88 _rxOutStream->writeBoolean(_bVal);
89 return _rxOutStream;
90}
91
92
93const css::uno::Reference<css::io::XObjectInputStream>& operator >> (const css::uno::Reference<css::io::XObjectInputStream>& _rxInStream, OUString& rStr)
94{
95 rStr = _rxInStream->readUTF();
96 return _rxInStream;
97}
98
99
100const css::uno::Reference<css::io::XObjectOutputStream>& operator << (const css::uno::Reference<css::io::XObjectOutputStream>& _rxOutStream, const OUString& rStr)
101{
102 _rxOutStream->writeUTF(rStr);
103 return _rxOutStream;
104}
105
106
107const css::uno::Reference<css::io::XObjectInputStream>& operator >> (const css::uno::Reference<css::io::XObjectInputStream>& _rxInStream, sal_Int16& _rValue)
108{
109 _rValue = _rxInStream->readShort();
110 return _rxInStream;
111}
112
113
114const css::uno::Reference<css::io::XObjectOutputStream>& operator << (const css::uno::Reference<css::io::XObjectOutputStream>& _rxOutStream, sal_Int16 _nValue)
115{
116 _rxOutStream->writeShort(_nValue);
117 return _rxOutStream;
118}
119
120
121const css::uno::Reference<css::io::XObjectInputStream>& operator >> (const css::uno::Reference<css::io::XObjectInputStream>& _rxInStream, sal_uInt16& _rValue)
122{
123 _rValue = _rxInStream->readShort();
124 return _rxInStream;
125}
126
127
128const css::uno::Reference<css::io::XObjectOutputStream>& operator << (const css::uno::Reference<css::io::XObjectOutputStream>& _rxOutStream, sal_uInt16 _nValue)
129{
130 _rxOutStream->writeShort(_nValue);
131 return _rxOutStream;
132}
133
134
135const css::uno::Reference<css::io::XObjectInputStream>& operator >> (const css::uno::Reference<css::io::XObjectInputStream>& _rxInStream, sal_uInt32& _rValue)
136{
137 _rValue = _rxInStream->readLong();
138 return _rxInStream;
139}
140
141
142const css::uno::Reference<css::io::XObjectOutputStream>& operator << (const css::uno::Reference<css::io::XObjectOutputStream>& _rxOutStream, sal_uInt32 _nValue)
143{
144 _rxOutStream->writeLong(_nValue);
145 return _rxOutStream;
146}
147
148
149const css::uno::Reference<css::io::XObjectInputStream>& operator >> (const css::uno::Reference<css::io::XObjectInputStream>& _rxInStream, sal_Int32& _rValue)
150{
151 _rValue = _rxInStream->readLong();
152 return _rxInStream;
153}
154
155
156const css::uno::Reference<css::io::XObjectOutputStream>& operator << (const css::uno::Reference<css::io::XObjectOutputStream>& _rxOutStream, sal_Int32 _nValue)
157{
158 _rxOutStream->writeLong(_nValue);
159 return _rxOutStream;
160}
161
163
164const css::uno::Sequence< sal_Int8 > & ByteReader::getUnoTunnelId()
165{
166 static const comphelper::UnoIdInit implId;
167 return implId.getSeq();
168}
169
171
172const css::uno::Sequence< sal_Int8 > & ByteWriter::getUnoTunnelId()
173{
174 static const comphelper::UnoIdInit implId;
175 return implId.getSeq();
176}
177
178
179} // namespace comphelper
180
181
182/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: basicio.cxx:164
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: basicio.cxx:172
const css::uno::Sequence< sal_Int8 > & getSeq() const
sal_Int32 _nValue
const css::uno::Reference< css::io::XObjectInputStream > & operator>>(const css::uno::Reference< css::io::XObjectInputStream > &_rxInStream, css::awt::FontDescriptor &_rFont)
Definition: basicio.cxx:54
const css::uno::Reference< css::io::XObjectOutputStream > & operator<<(const css::uno::Reference< css::io::XObjectOutputStream > &_rxOutStream, const css::awt::FontDescriptor &_rFont)
Definition: basicio.cxx:29