xref: /aoo41x/main/svl/source/items/cintitem.cxx (revision 40df464e)
1*40df464eSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*40df464eSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*40df464eSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*40df464eSAndrew Rist  * distributed with this work for additional information
6*40df464eSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*40df464eSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*40df464eSAndrew Rist  * "License"); you may not use this file except in compliance
9*40df464eSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*40df464eSAndrew Rist  *
11*40df464eSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*40df464eSAndrew Rist  *
13*40df464eSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*40df464eSAndrew Rist  * software distributed under the License is distributed on an
15*40df464eSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*40df464eSAndrew Rist  * KIND, either express or implied.  See the License for the
17*40df464eSAndrew Rist  * specific language governing permissions and limitations
18*40df464eSAndrew Rist  * under the License.
19*40df464eSAndrew Rist  *
20*40df464eSAndrew Rist  *************************************************************/
21*40df464eSAndrew Rist 
22*40df464eSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svl.hxx"
26cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx>
27cdf0e10cSrcweir #include <tools/stream.hxx>
28cdf0e10cSrcweir #include <svl/cintitem.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir //============================================================================
31cdf0e10cSrcweir //
32cdf0e10cSrcweir //  class CntByteItem
33cdf0e10cSrcweir //
34cdf0e10cSrcweir //============================================================================
35cdf0e10cSrcweir 
36cdf0e10cSrcweir DBG_NAME(CntByteItem)
37cdf0e10cSrcweir 
38cdf0e10cSrcweir //============================================================================
39cdf0e10cSrcweir TYPEINIT1_AUTOFACTORY(CntByteItem, SfxPoolItem);
40cdf0e10cSrcweir 
41cdf0e10cSrcweir //============================================================================
CntByteItem(sal_uInt16 which,SvStream & rStream)42cdf0e10cSrcweir CntByteItem::CntByteItem(sal_uInt16 which, SvStream & rStream):
43cdf0e10cSrcweir 	SfxPoolItem(which)
44cdf0e10cSrcweir {
45cdf0e10cSrcweir 	DBG_CTOR(CntByteItem, 0);
46cdf0e10cSrcweir 	rStream >> m_nValue;
47cdf0e10cSrcweir }
48cdf0e10cSrcweir 
49cdf0e10cSrcweir //============================================================================
50cdf0e10cSrcweir // virtual
operator ==(const SfxPoolItem & rItem) const51cdf0e10cSrcweir int CntByteItem::operator ==(const SfxPoolItem & rItem) const
52cdf0e10cSrcweir {
53cdf0e10cSrcweir 	DBG_CHKTHIS(CntByteItem, 0);
54cdf0e10cSrcweir 	DBG_ASSERT(rItem.ISA(CntByteItem),
55cdf0e10cSrcweir 			   "CntByteItem::operator ==(): Bad type");
56cdf0e10cSrcweir 	return m_nValue == SAL_STATIC_CAST(const CntByteItem *, &rItem)->m_nValue;
57cdf0e10cSrcweir }
58cdf0e10cSrcweir 
59cdf0e10cSrcweir //============================================================================
60cdf0e10cSrcweir // virtual
Compare(const SfxPoolItem & rWith) const61cdf0e10cSrcweir int CntByteItem::Compare(const SfxPoolItem & rWith) const
62cdf0e10cSrcweir {
63cdf0e10cSrcweir 	DBG_CHKTHIS(CntByteItem, 0);
64cdf0e10cSrcweir 	DBG_ASSERT(rWith.ISA(CntByteItem), "CntByteItem::Compare(): Bad type");
65cdf0e10cSrcweir 	return SAL_STATIC_CAST(const CntByteItem *, &rWith)->m_nValue < m_nValue ?
66cdf0e10cSrcweir 	        -1 :
67cdf0e10cSrcweir 	       SAL_STATIC_CAST(const CntByteItem *, &rWith)->m_nValue
68cdf0e10cSrcweir 	         == m_nValue ?
69cdf0e10cSrcweir 		    0 : 1;
70cdf0e10cSrcweir }
71cdf0e10cSrcweir 
72cdf0e10cSrcweir //============================================================================
73cdf0e10cSrcweir // virtual
GetPresentation(SfxItemPresentation,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const74cdf0e10cSrcweir SfxItemPresentation CntByteItem::GetPresentation(SfxItemPresentation,
75cdf0e10cSrcweir 												 SfxMapUnit, SfxMapUnit,
76cdf0e10cSrcweir 												 XubString & rText,
77cdf0e10cSrcweir                                                  const IntlWrapper *) const
78cdf0e10cSrcweir {
79cdf0e10cSrcweir 	DBG_CHKTHIS(CntByteItem, 0);
80cdf0e10cSrcweir 	rText = XubString::CreateFromInt32(m_nValue);
81cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NAMELESS;
82cdf0e10cSrcweir }
83cdf0e10cSrcweir 
84cdf0e10cSrcweir //============================================================================
85cdf0e10cSrcweir // virtual
QueryValue(com::sun::star::uno::Any & rVal,sal_uInt8) const86cdf0e10cSrcweir sal_Bool CntByteItem::QueryValue(com::sun::star::uno::Any& rVal,sal_uInt8) const
87cdf0e10cSrcweir {
88cdf0e10cSrcweir 	sal_Int8 nValue = m_nValue;
89cdf0e10cSrcweir 	rVal <<= nValue;
90cdf0e10cSrcweir 	return sal_True;
91cdf0e10cSrcweir }
92cdf0e10cSrcweir 
93cdf0e10cSrcweir //============================================================================
94cdf0e10cSrcweir // virtual
PutValue(const com::sun::star::uno::Any & rVal,sal_uInt8)95cdf0e10cSrcweir sal_Bool CntByteItem::PutValue(const com::sun::star::uno::Any& rVal,sal_uInt8)
96cdf0e10cSrcweir {
97cdf0e10cSrcweir 	sal_Int8 nValue = sal_Int8();
98cdf0e10cSrcweir 	if (rVal >>= nValue)
99cdf0e10cSrcweir 	{
100cdf0e10cSrcweir 		m_nValue = nValue;
101cdf0e10cSrcweir 		return sal_True;
102cdf0e10cSrcweir 	}
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 	DBG_ERROR( "CntByteItem::PutValue - Wrong type!" );
105cdf0e10cSrcweir 	return sal_False;
106cdf0e10cSrcweir }
107cdf0e10cSrcweir 
108cdf0e10cSrcweir //============================================================================
109cdf0e10cSrcweir // virtual
Create(SvStream & rStream,sal_uInt16) const110cdf0e10cSrcweir SfxPoolItem * CntByteItem::Create(SvStream & rStream, sal_uInt16) const
111cdf0e10cSrcweir {
112cdf0e10cSrcweir 	DBG_CHKTHIS(CntByteItem, 0);
113cdf0e10cSrcweir 	short nTheValue = 0;
114cdf0e10cSrcweir 	rStream >> nTheValue;
115cdf0e10cSrcweir 	return new CntByteItem(Which(), sal_uInt8(nTheValue));
116cdf0e10cSrcweir }
117cdf0e10cSrcweir 
118cdf0e10cSrcweir //============================================================================
119cdf0e10cSrcweir // virtual
Store(SvStream & rStream,sal_uInt16) const120cdf0e10cSrcweir SvStream & CntByteItem::Store(SvStream & rStream, sal_uInt16) const
121cdf0e10cSrcweir {
122cdf0e10cSrcweir 	DBG_CHKTHIS(CntByteItem, 0);
123cdf0e10cSrcweir 	rStream << short(m_nValue);
124cdf0e10cSrcweir 	return rStream;
125cdf0e10cSrcweir }
126cdf0e10cSrcweir 
127cdf0e10cSrcweir //============================================================================
128cdf0e10cSrcweir // virtual
Clone(SfxItemPool *) const129cdf0e10cSrcweir SfxPoolItem * CntByteItem::Clone(SfxItemPool *) const
130cdf0e10cSrcweir {
131cdf0e10cSrcweir 	DBG_CHKTHIS(CntByteItem, 0);
132cdf0e10cSrcweir 	return new CntByteItem(*this);
133cdf0e10cSrcweir }
134cdf0e10cSrcweir 
135cdf0e10cSrcweir //============================================================================
136cdf0e10cSrcweir // virtual
GetMin() const137cdf0e10cSrcweir sal_uInt8 CntByteItem::GetMin() const
138cdf0e10cSrcweir {
139cdf0e10cSrcweir 	DBG_CHKTHIS(CntByteItem, 0);
140cdf0e10cSrcweir 	return 0;
141cdf0e10cSrcweir }
142cdf0e10cSrcweir 
143cdf0e10cSrcweir //============================================================================
144cdf0e10cSrcweir // virtual
GetMax() const145cdf0e10cSrcweir sal_uInt8 CntByteItem::GetMax() const
146cdf0e10cSrcweir {
147cdf0e10cSrcweir 	DBG_CHKTHIS(CntByteItem, 0);
148cdf0e10cSrcweir 	return 255;
149cdf0e10cSrcweir }
150cdf0e10cSrcweir 
151cdf0e10cSrcweir //============================================================================
152cdf0e10cSrcweir // virtual
GetUnit() const153cdf0e10cSrcweir SfxFieldUnit CntByteItem::GetUnit() const
154cdf0e10cSrcweir {
155cdf0e10cSrcweir 	DBG_CHKTHIS(CntByteItem, 0);
156cdf0e10cSrcweir 	return SFX_FUNIT_NONE;
157cdf0e10cSrcweir }
158cdf0e10cSrcweir 
159cdf0e10cSrcweir //============================================================================
160cdf0e10cSrcweir //
161cdf0e10cSrcweir //  class CntUInt16Item
162cdf0e10cSrcweir //
163cdf0e10cSrcweir //============================================================================
164cdf0e10cSrcweir 
165cdf0e10cSrcweir DBG_NAME(CntUInt16Item);
166cdf0e10cSrcweir 
167cdf0e10cSrcweir //============================================================================
168cdf0e10cSrcweir TYPEINIT1_AUTOFACTORY(CntUInt16Item, SfxPoolItem);
169cdf0e10cSrcweir 
170cdf0e10cSrcweir //============================================================================
CntUInt16Item(sal_uInt16 which,SvStream & rStream)171cdf0e10cSrcweir CntUInt16Item::CntUInt16Item(sal_uInt16 which, SvStream & rStream) :
172cdf0e10cSrcweir 	SfxPoolItem(which)
173cdf0e10cSrcweir {
174cdf0e10cSrcweir 	DBG_CTOR(CntUInt16Item, 0);
175cdf0e10cSrcweir 	sal_uInt16 nTheValue = 0;
176cdf0e10cSrcweir 	rStream >> nTheValue;
177cdf0e10cSrcweir 	m_nValue = nTheValue;
178cdf0e10cSrcweir }
179cdf0e10cSrcweir 
180cdf0e10cSrcweir //============================================================================
181cdf0e10cSrcweir // virtual
operator ==(const SfxPoolItem & rItem) const182cdf0e10cSrcweir int CntUInt16Item::operator ==(const SfxPoolItem & rItem) const
183cdf0e10cSrcweir {
184cdf0e10cSrcweir 	DBG_CHKTHIS(CntUInt16Item, 0);
185cdf0e10cSrcweir 	DBG_ASSERT(rItem.ISA(CntUInt16Item),
186cdf0e10cSrcweir 			   "CntUInt16Item::operator ==(): Bad type");
187cdf0e10cSrcweir 	return m_nValue == SAL_STATIC_CAST(const CntUInt16Item *, &rItem)->
188cdf0e10cSrcweir 	                    m_nValue;
189cdf0e10cSrcweir }
190cdf0e10cSrcweir 
191cdf0e10cSrcweir //============================================================================
192cdf0e10cSrcweir // virtual
Compare(const SfxPoolItem & rWith) const193cdf0e10cSrcweir int CntUInt16Item::Compare(const SfxPoolItem & rWith) const
194cdf0e10cSrcweir {
195cdf0e10cSrcweir 	DBG_CHKTHIS(CntUInt16Item, 0);
196cdf0e10cSrcweir 	DBG_ASSERT(rWith.ISA(CntUInt16Item),
197cdf0e10cSrcweir 			   "CntUInt16Item::Compare(): Bad type");
198cdf0e10cSrcweir 	return SAL_STATIC_CAST(const CntUInt16Item *, &rWith)->m_nValue
199cdf0e10cSrcweir 	         < m_nValue ?
200cdf0e10cSrcweir             -1 :
201cdf0e10cSrcweir 	       SAL_STATIC_CAST(const CntUInt16Item *, &rWith)->m_nValue
202cdf0e10cSrcweir 	         == m_nValue ?
203cdf0e10cSrcweir 	        0 : 1;
204cdf0e10cSrcweir }
205cdf0e10cSrcweir 
206cdf0e10cSrcweir //============================================================================
207cdf0e10cSrcweir // virtual
GetPresentation(SfxItemPresentation,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const208cdf0e10cSrcweir SfxItemPresentation CntUInt16Item::GetPresentation(SfxItemPresentation,
209cdf0e10cSrcweir 												   SfxMapUnit, SfxMapUnit,
210cdf0e10cSrcweir 												   XubString & rText,
211cdf0e10cSrcweir                                                    const IntlWrapper *)
212cdf0e10cSrcweir 	const
213cdf0e10cSrcweir {
214cdf0e10cSrcweir 	DBG_CHKTHIS(CntUInt16Item, 0);
215cdf0e10cSrcweir 	rText = XubString::CreateFromInt32(m_nValue);
216cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NAMELESS;
217cdf0e10cSrcweir }
218cdf0e10cSrcweir 
219cdf0e10cSrcweir //============================================================================
220cdf0e10cSrcweir // virtual
QueryValue(com::sun::star::uno::Any & rVal,sal_uInt8) const221cdf0e10cSrcweir sal_Bool CntUInt16Item::QueryValue(com::sun::star::uno::Any& rVal,sal_uInt8) const
222cdf0e10cSrcweir {
223cdf0e10cSrcweir     sal_Int32 nValue = m_nValue;
224cdf0e10cSrcweir 	rVal <<= nValue;
225cdf0e10cSrcweir 	return sal_True;
226cdf0e10cSrcweir }
227cdf0e10cSrcweir 
228cdf0e10cSrcweir //============================================================================
229cdf0e10cSrcweir // virtual
PutValue(const com::sun::star::uno::Any & rVal,sal_uInt8)230cdf0e10cSrcweir sal_Bool CntUInt16Item::PutValue(const com::sun::star::uno::Any& rVal,sal_uInt8)
231cdf0e10cSrcweir {
232cdf0e10cSrcweir 	sal_Int32 nValue = 0;
233cdf0e10cSrcweir 	if (rVal >>= nValue)
234cdf0e10cSrcweir 	{
235cdf0e10cSrcweir         DBG_ASSERT( nValue <= USHRT_MAX, "Overflow in UInt16 value!");
236cdf0e10cSrcweir         m_nValue = (sal_uInt16)nValue;
237cdf0e10cSrcweir 		return sal_True;
238cdf0e10cSrcweir 	}
239cdf0e10cSrcweir 
240cdf0e10cSrcweir 	DBG_ERROR( "CntUInt16Item::PutValue - Wrong type!" );
241cdf0e10cSrcweir 	return sal_False;
242cdf0e10cSrcweir }
243cdf0e10cSrcweir 
244cdf0e10cSrcweir //============================================================================
245cdf0e10cSrcweir // virtual
Create(SvStream & rStream,sal_uInt16) const246cdf0e10cSrcweir SfxPoolItem * CntUInt16Item::Create(SvStream & rStream, sal_uInt16) const
247cdf0e10cSrcweir {
248cdf0e10cSrcweir 	DBG_CHKTHIS(CntUInt16Item, 0);
249cdf0e10cSrcweir 	return new CntUInt16Item(Which(), rStream);
250cdf0e10cSrcweir }
251cdf0e10cSrcweir 
252cdf0e10cSrcweir //============================================================================
253cdf0e10cSrcweir // virtual
Store(SvStream & rStream,sal_uInt16) const254cdf0e10cSrcweir SvStream & CntUInt16Item::Store(SvStream &rStream, sal_uInt16) const
255cdf0e10cSrcweir {
256cdf0e10cSrcweir 	DBG_CHKTHIS(CntUInt16Item, 0);
257cdf0e10cSrcweir 	rStream << sal_uInt16(m_nValue);
258cdf0e10cSrcweir 	return rStream;
259cdf0e10cSrcweir }
260cdf0e10cSrcweir 
261cdf0e10cSrcweir //============================================================================
262cdf0e10cSrcweir // virtual
Clone(SfxItemPool *) const263cdf0e10cSrcweir SfxPoolItem * CntUInt16Item::Clone(SfxItemPool *) const
264cdf0e10cSrcweir {
265cdf0e10cSrcweir 	DBG_CHKTHIS(CntUInt16Item, 0);
266cdf0e10cSrcweir 	return new CntUInt16Item(*this);
267cdf0e10cSrcweir }
268cdf0e10cSrcweir 
269cdf0e10cSrcweir //============================================================================
270cdf0e10cSrcweir // virtual
GetMin() const271cdf0e10cSrcweir sal_uInt16 CntUInt16Item::GetMin() const
272cdf0e10cSrcweir {
273cdf0e10cSrcweir 	DBG_CHKTHIS(CntUInt16Item, 0);
274cdf0e10cSrcweir 	return 0;
275cdf0e10cSrcweir }
276cdf0e10cSrcweir 
277cdf0e10cSrcweir //============================================================================
278cdf0e10cSrcweir // virtual
GetMax() const279cdf0e10cSrcweir sal_uInt16 CntUInt16Item::GetMax() const
280cdf0e10cSrcweir {
281cdf0e10cSrcweir 	DBG_CHKTHIS(CntUInt16Item, 0);
282cdf0e10cSrcweir 	return 65535;
283cdf0e10cSrcweir }
284cdf0e10cSrcweir 
285cdf0e10cSrcweir //============================================================================
286cdf0e10cSrcweir // virtual
GetUnit() const287cdf0e10cSrcweir SfxFieldUnit CntUInt16Item::GetUnit() const
288cdf0e10cSrcweir {
289cdf0e10cSrcweir 	DBG_CHKTHIS(CntUInt16Item, 0);
290cdf0e10cSrcweir 	return SFX_FUNIT_NONE;
291cdf0e10cSrcweir }
292cdf0e10cSrcweir 
293cdf0e10cSrcweir //============================================================================
294cdf0e10cSrcweir //
295cdf0e10cSrcweir //  class CntInt32Item
296cdf0e10cSrcweir //
297cdf0e10cSrcweir //============================================================================
298cdf0e10cSrcweir 
299cdf0e10cSrcweir DBG_NAME(CntInt32Item);
300cdf0e10cSrcweir 
301cdf0e10cSrcweir //============================================================================
302cdf0e10cSrcweir TYPEINIT1_AUTOFACTORY(CntInt32Item, SfxPoolItem);
303cdf0e10cSrcweir 
304cdf0e10cSrcweir //============================================================================
CntInt32Item(sal_uInt16 which,SvStream & rStream)305cdf0e10cSrcweir CntInt32Item::CntInt32Item(sal_uInt16 which, SvStream & rStream) :
306cdf0e10cSrcweir 	SfxPoolItem(which)
307cdf0e10cSrcweir {
308cdf0e10cSrcweir 	DBG_CTOR(CntInt32Item, 0);
309cdf0e10cSrcweir 	long nTheValue = 0;
310cdf0e10cSrcweir 	rStream >> nTheValue;
311cdf0e10cSrcweir 	m_nValue = nTheValue;
312cdf0e10cSrcweir }
313cdf0e10cSrcweir 
314cdf0e10cSrcweir //============================================================================
315cdf0e10cSrcweir // virtual
operator ==(const SfxPoolItem & rItem) const316cdf0e10cSrcweir int CntInt32Item::operator ==(const SfxPoolItem & rItem) const
317cdf0e10cSrcweir {
318cdf0e10cSrcweir 	DBG_CHKTHIS(CntInt32Item, 0);
319cdf0e10cSrcweir 	DBG_ASSERT(rItem.ISA(CntInt32Item),
320cdf0e10cSrcweir 			   "CntInt32Item::operator ==(): Bad type");
321cdf0e10cSrcweir 	return m_nValue == SAL_STATIC_CAST(const CntInt32Item *, &rItem)->
322cdf0e10cSrcweir 	                    m_nValue;
323cdf0e10cSrcweir }
324cdf0e10cSrcweir 
325cdf0e10cSrcweir //============================================================================
326cdf0e10cSrcweir // virtual
Compare(const SfxPoolItem & rWith) const327cdf0e10cSrcweir int CntInt32Item::Compare(const SfxPoolItem & rWith) const
328cdf0e10cSrcweir {
329cdf0e10cSrcweir 	DBG_CHKTHIS(CntInt32Item, 0);
330cdf0e10cSrcweir 	DBG_ASSERT(rWith.ISA(CntInt32Item), "CntInt32Item::Compare(): Bad type");
331cdf0e10cSrcweir 	return SAL_STATIC_CAST(const CntInt32Item *, &rWith)->m_nValue
332cdf0e10cSrcweir 	         < m_nValue ?
333cdf0e10cSrcweir             -1 :
334cdf0e10cSrcweir 	       SAL_STATIC_CAST(const CntInt32Item *, &rWith)->m_nValue
335cdf0e10cSrcweir 	         == m_nValue ?
336cdf0e10cSrcweir 	        0 : 1;
337cdf0e10cSrcweir }
338cdf0e10cSrcweir 
339cdf0e10cSrcweir //============================================================================
340cdf0e10cSrcweir // virtual
GetPresentation(SfxItemPresentation,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const341cdf0e10cSrcweir SfxItemPresentation CntInt32Item::GetPresentation(SfxItemPresentation,
342cdf0e10cSrcweir 												  SfxMapUnit, SfxMapUnit,
343cdf0e10cSrcweir 												  XubString & rText,
344cdf0e10cSrcweir                                                   const IntlWrapper *) const
345cdf0e10cSrcweir {
346cdf0e10cSrcweir 	DBG_CHKTHIS(CntInt32Item, 0);
347cdf0e10cSrcweir 	rText = XubString::CreateFromInt32(m_nValue);
348cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NAMELESS;
349cdf0e10cSrcweir }
350cdf0e10cSrcweir 
351cdf0e10cSrcweir //============================================================================
352cdf0e10cSrcweir // virtual
QueryValue(com::sun::star::uno::Any & rVal,sal_uInt8) const353cdf0e10cSrcweir sal_Bool CntInt32Item::QueryValue(com::sun::star::uno::Any& rVal,sal_uInt8) const
354cdf0e10cSrcweir {
355cdf0e10cSrcweir 	sal_Int32 nValue = m_nValue;
356cdf0e10cSrcweir 	rVal <<= nValue;
357cdf0e10cSrcweir 	return sal_True;
358cdf0e10cSrcweir }
359cdf0e10cSrcweir 
360cdf0e10cSrcweir //============================================================================
361cdf0e10cSrcweir // virtual
PutValue(const com::sun::star::uno::Any & rVal,sal_uInt8)362cdf0e10cSrcweir sal_Bool CntInt32Item::PutValue(const com::sun::star::uno::Any& rVal,sal_uInt8)
363cdf0e10cSrcweir {
364cdf0e10cSrcweir 	sal_Int32 nValue = 0;
365cdf0e10cSrcweir 	if (rVal >>= nValue)
366cdf0e10cSrcweir 	{
367cdf0e10cSrcweir 		m_nValue = nValue;
368cdf0e10cSrcweir 		return sal_True;
369cdf0e10cSrcweir 	}
370cdf0e10cSrcweir 
371cdf0e10cSrcweir 	DBG_ERROR( "CntInt32Item::PutValue - Wrong type!" );
372cdf0e10cSrcweir 	return sal_False;
373cdf0e10cSrcweir }
374cdf0e10cSrcweir 
375cdf0e10cSrcweir //============================================================================
376cdf0e10cSrcweir // virtual
Create(SvStream & rStream,sal_uInt16) const377cdf0e10cSrcweir SfxPoolItem * CntInt32Item::Create(SvStream & rStream, sal_uInt16) const
378cdf0e10cSrcweir {
379cdf0e10cSrcweir 	DBG_CHKTHIS(CntInt32Item, 0);
380cdf0e10cSrcweir 	return new CntInt32Item(Which(), rStream);
381cdf0e10cSrcweir }
382cdf0e10cSrcweir 
383cdf0e10cSrcweir //============================================================================
384cdf0e10cSrcweir // virtual
Store(SvStream & rStream,sal_uInt16) const385cdf0e10cSrcweir SvStream & CntInt32Item::Store(SvStream &rStream, sal_uInt16) const
386cdf0e10cSrcweir {
387cdf0e10cSrcweir 	DBG_CHKTHIS(CntInt32Item, 0);
388cdf0e10cSrcweir 	rStream << long(m_nValue);
389cdf0e10cSrcweir 	return rStream;
390cdf0e10cSrcweir }
391cdf0e10cSrcweir 
392cdf0e10cSrcweir //============================================================================
393cdf0e10cSrcweir // virtual
Clone(SfxItemPool *) const394cdf0e10cSrcweir SfxPoolItem * CntInt32Item::Clone(SfxItemPool *) const
395cdf0e10cSrcweir {
396cdf0e10cSrcweir 	DBG_CHKTHIS(CntInt32Item, 0);
397cdf0e10cSrcweir 	return new CntInt32Item(*this);
398cdf0e10cSrcweir }
399cdf0e10cSrcweir 
400cdf0e10cSrcweir //============================================================================
401cdf0e10cSrcweir // virtual
GetMin() const402cdf0e10cSrcweir sal_Int32 CntInt32Item::GetMin() const
403cdf0e10cSrcweir {
404cdf0e10cSrcweir 	DBG_CHKTHIS(CntInt32Item, 0);
405cdf0e10cSrcweir 	return sal_Int32(0x80000000);
406cdf0e10cSrcweir }
407cdf0e10cSrcweir 
408cdf0e10cSrcweir //============================================================================
409cdf0e10cSrcweir // virtual
GetMax() const410cdf0e10cSrcweir sal_Int32 CntInt32Item::GetMax() const
411cdf0e10cSrcweir {
412cdf0e10cSrcweir 	DBG_CHKTHIS(CntInt32Item, 0);
413cdf0e10cSrcweir 	return 0x7FFFFFFF;
414cdf0e10cSrcweir }
415cdf0e10cSrcweir 
416cdf0e10cSrcweir //============================================================================
417cdf0e10cSrcweir // virtual
GetUnit() const418cdf0e10cSrcweir SfxFieldUnit CntInt32Item::GetUnit() const
419cdf0e10cSrcweir {
420cdf0e10cSrcweir 	DBG_CHKTHIS(CntInt32Item, 0);
421cdf0e10cSrcweir 	return SFX_FUNIT_NONE;
422cdf0e10cSrcweir }
423cdf0e10cSrcweir 
424cdf0e10cSrcweir //============================================================================
425cdf0e10cSrcweir //
426cdf0e10cSrcweir //  class CntUInt32Item
427cdf0e10cSrcweir //
428cdf0e10cSrcweir //============================================================================
429cdf0e10cSrcweir 
430cdf0e10cSrcweir DBG_NAME(CntUInt32Item);
431cdf0e10cSrcweir 
432cdf0e10cSrcweir //============================================================================
433cdf0e10cSrcweir TYPEINIT1_AUTOFACTORY(CntUInt32Item, SfxPoolItem);
434cdf0e10cSrcweir 
435cdf0e10cSrcweir //============================================================================
CntUInt32Item(sal_uInt16 which,SvStream & rStream)436cdf0e10cSrcweir CntUInt32Item::CntUInt32Item(sal_uInt16 which, SvStream & rStream) :
437cdf0e10cSrcweir 	SfxPoolItem(which)
438cdf0e10cSrcweir {
439cdf0e10cSrcweir 	DBG_CTOR(CntUInt32Item, 0);
440cdf0e10cSrcweir 	sal_uInt32 nTheValue = 0;
441cdf0e10cSrcweir 	rStream >> nTheValue;
442cdf0e10cSrcweir 	m_nValue = nTheValue;
443cdf0e10cSrcweir }
444cdf0e10cSrcweir 
445cdf0e10cSrcweir //============================================================================
446cdf0e10cSrcweir // virtual
operator ==(const SfxPoolItem & rItem) const447cdf0e10cSrcweir int CntUInt32Item::operator ==(const SfxPoolItem & rItem) const
448cdf0e10cSrcweir {
449cdf0e10cSrcweir 	DBG_CHKTHIS(CntUInt32Item, 0);
450cdf0e10cSrcweir 	DBG_ASSERT(rItem.ISA(CntUInt32Item),
451cdf0e10cSrcweir 			   "CntUInt32Item::operator ==(): Bad type");
452cdf0e10cSrcweir 	return m_nValue == SAL_STATIC_CAST(const CntUInt32Item *, &rItem)->
453cdf0e10cSrcweir 	                    m_nValue;
454cdf0e10cSrcweir }
455cdf0e10cSrcweir 
456cdf0e10cSrcweir //============================================================================
457cdf0e10cSrcweir // virtual
Compare(const SfxPoolItem & rWith) const458cdf0e10cSrcweir int CntUInt32Item::Compare(const SfxPoolItem & rWith) const
459cdf0e10cSrcweir {
460cdf0e10cSrcweir 	DBG_CHKTHIS(CntUInt32Item, 0);
461cdf0e10cSrcweir 	DBG_ASSERT(rWith.ISA(CntUInt32Item),
462cdf0e10cSrcweir 			   "CntUInt32Item::operator ==(): Bad type");
463cdf0e10cSrcweir 	return SAL_STATIC_CAST(const CntUInt32Item *, &rWith)->m_nValue
464cdf0e10cSrcweir 	         < m_nValue ?
465cdf0e10cSrcweir             -1 :
466cdf0e10cSrcweir 	       SAL_STATIC_CAST(const CntUInt32Item *, &rWith)->m_nValue
467cdf0e10cSrcweir 	         == m_nValue ?
468cdf0e10cSrcweir 	        0 : 1;
469cdf0e10cSrcweir }
470cdf0e10cSrcweir 
471cdf0e10cSrcweir //============================================================================
472cdf0e10cSrcweir // virtual
GetPresentation(SfxItemPresentation,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const473cdf0e10cSrcweir SfxItemPresentation CntUInt32Item::GetPresentation(SfxItemPresentation,
474cdf0e10cSrcweir 												   SfxMapUnit, SfxMapUnit,
475cdf0e10cSrcweir 												   XubString & rText,
476cdf0e10cSrcweir                                                    const IntlWrapper *)
477cdf0e10cSrcweir 	const
478cdf0e10cSrcweir {
479cdf0e10cSrcweir 	DBG_CHKTHIS(CntUInt32Item, 0);
480cdf0e10cSrcweir 	rText = XubString::CreateFromInt64(m_nValue);
481cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NAMELESS;
482cdf0e10cSrcweir }
483cdf0e10cSrcweir 
484cdf0e10cSrcweir //============================================================================
485cdf0e10cSrcweir // virtual
QueryValue(com::sun::star::uno::Any & rVal,sal_uInt8) const486cdf0e10cSrcweir sal_Bool CntUInt32Item::QueryValue(com::sun::star::uno::Any& rVal,sal_uInt8) const
487cdf0e10cSrcweir {
488cdf0e10cSrcweir 	sal_Int32 nValue = m_nValue;
489cdf0e10cSrcweir     DBG_ASSERT( nValue>=0, "Overflow in UInt32 value!");
490cdf0e10cSrcweir 	rVal <<= nValue;
491cdf0e10cSrcweir 	return sal_True;
492cdf0e10cSrcweir }
493cdf0e10cSrcweir 
494cdf0e10cSrcweir //============================================================================
495cdf0e10cSrcweir // virtual
PutValue(const com::sun::star::uno::Any & rVal,sal_uInt8)496cdf0e10cSrcweir sal_Bool CntUInt32Item::PutValue(const com::sun::star::uno::Any& rVal,sal_uInt8)
497cdf0e10cSrcweir {
498cdf0e10cSrcweir 	sal_Int32 nValue = 0;
499cdf0e10cSrcweir 	if (rVal >>= nValue)
500cdf0e10cSrcweir 	{
501cdf0e10cSrcweir         DBG_ASSERT( nValue>=0, "Overflow in UInt32 value!");
502cdf0e10cSrcweir 		m_nValue = nValue;
503cdf0e10cSrcweir 		return sal_True;
504cdf0e10cSrcweir 	}
505cdf0e10cSrcweir 
506cdf0e10cSrcweir 	DBG_ERROR( "CntUInt32Item::PutValue - Wrong type!" );
507cdf0e10cSrcweir 	return sal_False;
508cdf0e10cSrcweir }
509cdf0e10cSrcweir 
510cdf0e10cSrcweir //============================================================================
511cdf0e10cSrcweir // virtual
Create(SvStream & rStream,sal_uInt16) const512cdf0e10cSrcweir SfxPoolItem * CntUInt32Item::Create(SvStream & rStream, sal_uInt16) const
513cdf0e10cSrcweir {
514cdf0e10cSrcweir 	DBG_CHKTHIS(CntUInt32Item, 0);
515cdf0e10cSrcweir 	return new CntUInt32Item(Which(), rStream);
516cdf0e10cSrcweir }
517cdf0e10cSrcweir 
518cdf0e10cSrcweir //============================================================================
519cdf0e10cSrcweir // virtual
Store(SvStream & rStream,sal_uInt16) const520cdf0e10cSrcweir SvStream & CntUInt32Item::Store(SvStream &rStream, sal_uInt16) const
521cdf0e10cSrcweir {
522cdf0e10cSrcweir 	DBG_CHKTHIS(CntUInt32Item, 0);
523cdf0e10cSrcweir 	rStream << static_cast<sal_uInt32>(m_nValue);
524cdf0e10cSrcweir 	return rStream;
525cdf0e10cSrcweir }
526cdf0e10cSrcweir 
527cdf0e10cSrcweir //============================================================================
528cdf0e10cSrcweir // virtual
Clone(SfxItemPool *) const529cdf0e10cSrcweir SfxPoolItem * CntUInt32Item::Clone(SfxItemPool *) const
530cdf0e10cSrcweir {
531cdf0e10cSrcweir 	DBG_CHKTHIS(CntUInt32Item, 0);
532cdf0e10cSrcweir 	return new CntUInt32Item(*this);
533cdf0e10cSrcweir }
534cdf0e10cSrcweir 
535cdf0e10cSrcweir //============================================================================
536cdf0e10cSrcweir // virtual
GetMin() const537cdf0e10cSrcweir sal_uInt32 CntUInt32Item::GetMin() const
538cdf0e10cSrcweir {
539cdf0e10cSrcweir 	DBG_CHKTHIS(CntUInt32Item, 0);
540cdf0e10cSrcweir 	return 0;
541cdf0e10cSrcweir }
542cdf0e10cSrcweir 
543cdf0e10cSrcweir //============================================================================
544cdf0e10cSrcweir // virtual
GetMax() const545cdf0e10cSrcweir sal_uInt32 CntUInt32Item::GetMax() const
546cdf0e10cSrcweir {
547cdf0e10cSrcweir 	DBG_CHKTHIS(CntUInt32Item, 0);
548cdf0e10cSrcweir 	return 0xFFFFFFFF;
549cdf0e10cSrcweir }
550cdf0e10cSrcweir 
551cdf0e10cSrcweir //============================================================================
552cdf0e10cSrcweir // virtual
GetUnit() const553cdf0e10cSrcweir SfxFieldUnit CntUInt32Item::GetUnit() const
554cdf0e10cSrcweir {
555cdf0e10cSrcweir 	DBG_CHKTHIS(CntUInt32Item, 0);
556cdf0e10cSrcweir 	return SFX_FUNIT_NONE;
557cdf0e10cSrcweir }
558cdf0e10cSrcweir 
559