LibreOffice Module svl (master) 1
cintitem.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
20#include <com/sun/star/uno/Any.hxx>
21#include <svl/cintitem.hxx>
22#include <sal/log.hxx>
23
24
25// virtual
26bool CntByteItem::operator ==(const SfxPoolItem & rItem) const
27{
28 assert(SfxPoolItem::operator==(rItem));
29 return m_nValue == static_cast< const CntByteItem * >(&rItem)->m_nValue;
30}
31
32// virtual
34 OUString & rText,
35 const IntlWrapper&) const
36{
37 rText = OUString::number( m_nValue );
38 return true;
39}
40
41// virtual
42bool CntByteItem::QueryValue(css::uno::Any& rVal, sal_uInt8) const
43{
45 rVal <<= nValue;
46 return true;
47}
48
49// virtual
50bool CntByteItem::PutValue(const css::uno::Any& rVal, sal_uInt8)
51{
53 if (rVal >>= nValue)
54 {
56 return true;
57 }
58
59 SAL_WARN("svl.items", "CntByteItem::PutValue - Wrong type!");
60 return false;
61}
62
63// virtual
65{
66 return new CntByteItem(*this);
67}
68
69// virtual
70bool CntUInt16Item::operator ==(const SfxPoolItem & rItem) const
71{
72 assert(SfxPoolItem::operator==(rItem));
73 return m_nValue == static_cast<const CntUInt16Item *>(&rItem)->m_nValue;
74}
75
76// virtual
79 OUString & rText,
80 const IntlWrapper&)
81 const
82{
83 rText = OUString::number( m_nValue );
84 return true;
85}
86
87// virtual
88bool CntUInt16Item::QueryValue(css::uno::Any& rVal, sal_uInt8) const
89{
90 sal_Int32 nValue = m_nValue;
91 rVal <<= nValue;
92 return true;
93}
94
95// virtual
96bool CntUInt16Item::PutValue(const css::uno::Any& rVal, sal_uInt8)
97{
98 sal_Int32 nValue = 0;
99 if (rVal >>= nValue)
100 {
101 SAL_WARN_IF(nValue < 0 || nValue > SAL_MAX_UINT16, "svl.items", "Overflow in UInt16 value!");
102 m_nValue = static_cast<sal_uInt16>(nValue);
103 return true;
104 }
105
106 SAL_WARN("svl.items", "CntUInt16Item::PutValue - Wrong type!");
107 return false;
108}
109
110// virtual
112{
113 return new CntUInt16Item(*this);
114}
115
116// virtual
117bool CntInt32Item::operator ==(const SfxPoolItem & rItem) const
118{
119 assert(SfxPoolItem::operator==(rItem));
120 return m_nValue == static_cast<const CntInt32Item *>(&rItem)->m_nValue;
121}
122
123// virtual
126 OUString & rText,
127 const IntlWrapper&) const
128{
129 rText = OUString::number( m_nValue );
130 return true;
131}
132
133// virtual
134bool CntInt32Item::QueryValue(css::uno::Any& rVal, sal_uInt8) const
135{
136 sal_Int32 nValue = m_nValue;
137 rVal <<= nValue;
138 return true;
139}
140
141// virtual
142bool CntInt32Item::PutValue(const css::uno::Any& rVal, sal_uInt8)
143{
144 sal_Int32 nValue = 0;
145 if (rVal >>= nValue)
146 {
148 return true;
149 }
150
151 SAL_WARN("svl.items", "CntInt32Item::PutValue - Wrong type!");
152 return false;
153}
154
155// virtual
157{
158 return new CntInt32Item(*this);
159}
160
161// virtual
163{
164 assert(SfxPoolItem::operator==(rItem));
165 return m_nValue == static_cast<const CntUInt32Item *>(&rItem)->m_nValue;
166}
167
168// virtual
171 OUString & rText,
172 const IntlWrapper&)
173 const
174{
175 rText = OUString::number(m_nValue);
176 return true;
177}
178
179// virtual
180bool CntUInt32Item::QueryValue(css::uno::Any& rVal, sal_uInt8) const
181{
182 sal_Int32 nValue = m_nValue;
183 SAL_WARN_IF(nValue < 0, "svl.items", "Overflow in UInt32 value!");
184 rVal <<= nValue;
185 return true;
186}
187
188// virtual
189bool CntUInt32Item::PutValue(const css::uno::Any& rVal, sal_uInt8)
190{
191 sal_Int32 nValue = 0;
192 if (rVal >>= nValue)
193 {
194 SAL_WARN_IF(nValue < 0, "svl.items", "Overflow in UInt32 value!");
196 return true;
197 }
198
199 SAL_WARN("svl.items", "CntUInt32Item::PutValue - Wrong type!");
200 return false;
201}
202
203// virtual
205{
206 return new CntUInt32Item(*this);
207}
208
209/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt8 m_nValue
Definition: cintitem.hxx:29
CntByteItem(sal_uInt16 which, sal_uInt8 nTheValue)
Definition: cintitem.hxx:33
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: cintitem.cxx:50
virtual CntByteItem * Clone(SfxItemPool *=nullptr) const override
Definition: cintitem.cxx:64
virtual bool GetPresentation(SfxItemPresentation, MapUnit, MapUnit, OUString &rText, const IntlWrapper &) const override
This virtual method allows to get a textual representation of the value for the SfxPoolItem subclasse...
Definition: cintitem.cxx:33
virtual bool operator==(const SfxPoolItem &rItem) const override
Definition: cintitem.cxx:26
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: cintitem.cxx:42
sal_Int32 m_nValue
Definition: cintitem.hxx:102
virtual bool GetPresentation(SfxItemPresentation, MapUnit, MapUnit, OUString &rText, const IntlWrapper &) const override
This virtual method allows to get a textual representation of the value for the SfxPoolItem subclasse...
Definition: cintitem.cxx:124
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: cintitem.cxx:134
CntInt32Item(sal_uInt16 which, sal_Int32 nTheValue)
Definition: cintitem.hxx:106
virtual CntInt32Item * Clone(SfxItemPool *=nullptr) const override
Definition: cintitem.cxx:156
virtual bool operator==(const SfxPoolItem &rItem) const override
Definition: cintitem.cxx:117
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: cintitem.cxx:142
virtual CntUInt16Item * Clone(SfxItemPool *=nullptr) const override
Definition: cintitem.cxx:111
virtual bool GetPresentation(SfxItemPresentation, MapUnit, MapUnit, OUString &rText, const IntlWrapper &) const override
This virtual method allows to get a textual representation of the value for the SfxPoolItem subclasse...
Definition: cintitem.cxx:77
CntUInt16Item(sal_uInt16 which, sal_uInt16 nTheValue)
Definition: cintitem.hxx:69
sal_uInt16 m_nValue
Definition: cintitem.hxx:65
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: cintitem.cxx:88
virtual bool operator==(const SfxPoolItem &rItem) const override
Definition: cintitem.cxx:70
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: cintitem.cxx:96
virtual CntUInt32Item * Clone(SfxItemPool *=nullptr) const override
Definition: cintitem.cxx:204
virtual bool operator==(const SfxPoolItem &rItem) const override
Definition: cintitem.cxx:162
sal_uInt32 m_nValue
Definition: cintitem.hxx:139
virtual bool GetPresentation(SfxItemPresentation, MapUnit, MapUnit, OUString &rText, const IntlWrapper &) const override
This virtual method allows to get a textual representation of the value for the SfxPoolItem subclasse...
Definition: cintitem.cxx:169
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: cintitem.cxx:189
CntUInt32Item(sal_uInt16 which, sal_uInt32 nTheValue)
Definition: cintitem.hxx:143
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: cintitem.cxx:180
Base class for providers of defaults of SfxPoolItems.
Definition: itempool.hxx:51
sal_Int16 nValue
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
MapUnit
SfxItemPresentation
Definition: poolitem.hxx:72
unsigned char sal_uInt8
#define SAL_MAX_UINT16
signed char sal_Int8