1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 #ifndef _SVTOOLS_CINTITEM_HXX
25 #define _SVTOOLS_CINTITEM_HXX
26
27 #include "svl/svldllapi.h"
28 #include <tools/debug.hxx>
29 #include <svl/poolitem.hxx>
30
31 //============================================================================
32 DBG_NAMEEX_VISIBILITY(CntByteItem, SVL_DLLPUBLIC)
33
34 class SVL_DLLPUBLIC CntByteItem: public SfxPoolItem
35 {
36 sal_uInt8 m_nValue;
37
38 public:
39 TYPEINFO();
40
CntByteItem(sal_uInt16 which=0,sal_uInt8 nTheValue=0)41 CntByteItem(sal_uInt16 which = 0, sal_uInt8 nTheValue = 0):
42 SfxPoolItem(which), m_nValue(nTheValue) { DBG_CTOR(CntByteItem, 0); }
43
44 CntByteItem(sal_uInt16 which, SvStream & rStream);
45
CntByteItem(const CntByteItem & rItem)46 CntByteItem(const CntByteItem & rItem):
47 SfxPoolItem(rItem), m_nValue(rItem.m_nValue)
48 { DBG_CTOR(CntByteItem, 0); }
49
~CntByteItem()50 virtual ~CntByteItem() { DBG_DTOR(CntByteItem, 0); }
51
52 virtual int operator ==(const SfxPoolItem & rItem) const;
53
54 using SfxPoolItem::Compare;
55 virtual int Compare(const SfxPoolItem & rWith) const;
56
57 virtual SfxItemPresentation GetPresentation(SfxItemPresentation,
58 SfxMapUnit, SfxMapUnit,
59 XubString & rText,
60 const IntlWrapper * = 0)
61 const;
62
63 virtual sal_Bool QueryValue(com::sun::star::uno::Any& rVal,
64 sal_uInt8 nMemberId = 0) const;
65
66 virtual sal_Bool PutValue(const com::sun::star::uno::Any& rVal,
67 sal_uInt8 nMemberId = 0);
68
69 virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const;
70
71 virtual SvStream & Store(SvStream & rStream, sal_uInt16) const;
72
73 virtual SfxPoolItem * Clone(SfxItemPool * = 0) const;
74
75 virtual sal_uInt8 GetMin() const;
76
77 virtual sal_uInt8 GetMax() const;
78
79 virtual SfxFieldUnit GetUnit() const;
80
GetValue() const81 sal_uInt8 GetValue() const { return m_nValue; }
82
83 inline void SetValue(sal_uInt8 nTheValue);
84 };
85
SetValue(sal_uInt8 nTheValue)86 inline void CntByteItem::SetValue(sal_uInt8 nTheValue)
87 {
88 DBG_ASSERT(GetRefCount() == 0, "CntByteItem::SetValue(): Pooled item");
89 m_nValue = nTheValue;
90 }
91
92 //============================================================================
93 DBG_NAMEEX_VISIBILITY(CntUInt16Item, SVL_DLLPUBLIC)
94
95 class SVL_DLLPUBLIC CntUInt16Item: public SfxPoolItem
96 {
97 sal_uInt16 m_nValue;
98
99 public:
100 TYPEINFO();
101
CntUInt16Item(sal_uInt16 which=0,sal_uInt16 nTheValue=0)102 CntUInt16Item(sal_uInt16 which = 0, sal_uInt16 nTheValue = 0):
103 SfxPoolItem(which), m_nValue(nTheValue)
104 { DBG_CTOR(CntUInt16Item, 0); }
105
106 CntUInt16Item(sal_uInt16 which, SvStream & rStream);
107
CntUInt16Item(const CntUInt16Item & rItem)108 CntUInt16Item(const CntUInt16Item & rItem):
109 SfxPoolItem(rItem), m_nValue(rItem.m_nValue)
110 { DBG_CTOR(CntUInt16Item, 0); }
111
~CntUInt16Item()112 virtual ~CntUInt16Item() { DBG_DTOR(CntUInt16Item, 0); }
113
114 virtual int operator ==(const SfxPoolItem & rItem) const;
115
116 using SfxPoolItem::Compare;
117 virtual int Compare(const SfxPoolItem & rWith) const;
118
119 virtual SfxItemPresentation GetPresentation(SfxItemPresentation,
120 SfxMapUnit, SfxMapUnit,
121 XubString & rText,
122 const IntlWrapper * = 0)
123 const;
124
125 virtual sal_Bool QueryValue(com::sun::star::uno::Any& rVal,
126 sal_uInt8 nMemberId = 0) const;
127
128 virtual sal_Bool PutValue(const com::sun::star::uno::Any& rVal,
129 sal_uInt8 nMemberId = 0);
130
131 virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const;
132
133 virtual SvStream & Store(SvStream & rStream, sal_uInt16) const;
134
135 virtual SfxPoolItem * Clone(SfxItemPool * = 0) const;
136
137 virtual sal_uInt16 GetMin() const;
138
139 virtual sal_uInt16 GetMax() const;
140
141 virtual SfxFieldUnit GetUnit() const;
142
GetValue() const143 sal_Int16 GetValue() const { return m_nValue; }
144
145 inline void SetValue(sal_uInt16 nTheValue);
146 };
147
SetValue(sal_uInt16 nTheValue)148 inline void CntUInt16Item::SetValue(sal_uInt16 nTheValue)
149 {
150 DBG_ASSERT(GetRefCount() == 0, "CntUInt16Item::SetValue(): Pooled item");
151 m_nValue = nTheValue;
152 }
153
154 //============================================================================
155 DBG_NAMEEX_VISIBILITY(CntInt32Item, SVL_DLLPUBLIC)
156
157 class SVL_DLLPUBLIC CntInt32Item: public SfxPoolItem
158 {
159 sal_Int32 m_nValue;
160
161 public:
162 TYPEINFO();
163
CntInt32Item(sal_uInt16 which=0,sal_Int32 nTheValue=0)164 CntInt32Item(sal_uInt16 which = 0, sal_Int32 nTheValue = 0):
165 SfxPoolItem(which), m_nValue(nTheValue)
166 { DBG_CTOR(CntInt32Item, 0); }
167
168 CntInt32Item(sal_uInt16 which, SvStream & rStream);
169
CntInt32Item(const CntInt32Item & rItem)170 CntInt32Item(const CntInt32Item & rItem):
171 SfxPoolItem(rItem), m_nValue(rItem.m_nValue)
172 { DBG_CTOR(CntInt32Item, 0); }
173
~CntInt32Item()174 virtual ~CntInt32Item() { DBG_DTOR(CntInt32Item, 0); }
175
176 virtual int operator ==(const SfxPoolItem & rItem) const;
177
178 using SfxPoolItem::Compare;
179 virtual int Compare(const SfxPoolItem & rWith) const;
180
181 virtual SfxItemPresentation GetPresentation(SfxItemPresentation,
182 SfxMapUnit, SfxMapUnit,
183 XubString & rText,
184 const IntlWrapper * = 0)
185 const;
186
187 virtual sal_Bool QueryValue(com::sun::star::uno::Any& rVal,
188 sal_uInt8 nMemberId = 0) const;
189
190 virtual sal_Bool PutValue(const com::sun::star::uno::Any& rVal,
191 sal_uInt8 nMemberId = 0);
192
193 virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const;
194
195 virtual SvStream & Store(SvStream &, sal_uInt16) const;
196
197 virtual SfxPoolItem * Clone(SfxItemPool * = 0) const;
198
199 virtual sal_Int32 GetMin() const;
200
201 virtual sal_Int32 GetMax() const;
202
203 virtual SfxFieldUnit GetUnit() const;
204
GetValue() const205 sal_Int32 GetValue() const { return m_nValue; }
206
207 inline void SetValue(sal_Int32 nTheValue);
208 };
209
SetValue(sal_Int32 nTheValue)210 inline void CntInt32Item::SetValue(sal_Int32 nTheValue)
211 {
212 DBG_ASSERT(GetRefCount() == 0, "CntInt32Item::SetValue(): Pooled item");
213 m_nValue = nTheValue;
214 }
215
216 //============================================================================
217 DBG_NAMEEX_VISIBILITY(CntUInt32Item, SVL_DLLPUBLIC)
218
219 class SVL_DLLPUBLIC CntUInt32Item: public SfxPoolItem
220 {
221 sal_uInt32 m_nValue;
222
223 public:
224 TYPEINFO();
225
CntUInt32Item(sal_uInt16 which=0,sal_uInt32 nTheValue=0)226 CntUInt32Item(sal_uInt16 which = 0, sal_uInt32 nTheValue = 0):
227 SfxPoolItem(which), m_nValue(nTheValue)
228 { DBG_CTOR(CntUInt32Item, 0); }
229
230 CntUInt32Item(sal_uInt16 nWhich, SvStream & rStream);
231
CntUInt32Item(const CntUInt32Item & rItem)232 CntUInt32Item(const CntUInt32Item & rItem):
233 SfxPoolItem(rItem), m_nValue(rItem.m_nValue)
234 { DBG_CTOR(CntUInt32Item, 0); }
235
~CntUInt32Item()236 virtual ~CntUInt32Item() { DBG_DTOR(CntUInt32Item, 0); }
237
238 virtual int operator ==(const SfxPoolItem & rItem) const;
239
240 using SfxPoolItem::Compare;
241 virtual int Compare(const SfxPoolItem & rWith) const;
242
243 virtual SfxItemPresentation GetPresentation(SfxItemPresentation,
244 SfxMapUnit, SfxMapUnit,
245 XubString & rText,
246 const IntlWrapper * = 0)
247 const;
248
249 virtual sal_Bool QueryValue(com::sun::star::uno::Any& rVal,
250 sal_uInt8 nMemberId = 0) const;
251
252 virtual sal_Bool PutValue(const com::sun::star::uno::Any& rVal,
253 sal_uInt8 nMemberId = 0);
254
255 virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const;
256
257 virtual SvStream & Store(SvStream & rStream, sal_uInt16) const;
258
259 virtual SfxPoolItem * Clone(SfxItemPool * = 0) const;
260
261 virtual sal_uInt32 GetMin() const;
262
263 virtual sal_uInt32 GetMax() const;
264
265 virtual SfxFieldUnit GetUnit() const;
266
GetValue() const267 sal_uInt32 GetValue() const { return m_nValue; }
268
269 inline void SetValue(sal_uInt32 nTheValue);
270 };
271
SetValue(sal_uInt32 nTheValue)272 inline void CntUInt32Item::SetValue(sal_uInt32 nTheValue)
273 {
274 DBG_ASSERT(GetRefCount() == 0, "CntUInt32Item::SetValue(): Pooled item");
275 m_nValue = nTheValue;
276 }
277
278 #endif // _SVTOOLS_CINTITEM_HXX
279
280