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