1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_svl.hxx" 30*cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx> 31*cdf0e10cSrcweir #include <tools/stream.hxx> 32*cdf0e10cSrcweir #include <svl/cintitem.hxx> 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir //============================================================================ 35*cdf0e10cSrcweir // 36*cdf0e10cSrcweir // class CntByteItem 37*cdf0e10cSrcweir // 38*cdf0e10cSrcweir //============================================================================ 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir DBG_NAME(CntByteItem) 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir //============================================================================ 43*cdf0e10cSrcweir TYPEINIT1_AUTOFACTORY(CntByteItem, SfxPoolItem); 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir //============================================================================ 46*cdf0e10cSrcweir CntByteItem::CntByteItem(sal_uInt16 which, SvStream & rStream): 47*cdf0e10cSrcweir SfxPoolItem(which) 48*cdf0e10cSrcweir { 49*cdf0e10cSrcweir DBG_CTOR(CntByteItem, 0); 50*cdf0e10cSrcweir rStream >> m_nValue; 51*cdf0e10cSrcweir } 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir //============================================================================ 54*cdf0e10cSrcweir // virtual 55*cdf0e10cSrcweir int CntByteItem::operator ==(const SfxPoolItem & rItem) const 56*cdf0e10cSrcweir { 57*cdf0e10cSrcweir DBG_CHKTHIS(CntByteItem, 0); 58*cdf0e10cSrcweir DBG_ASSERT(rItem.ISA(CntByteItem), 59*cdf0e10cSrcweir "CntByteItem::operator ==(): Bad type"); 60*cdf0e10cSrcweir return m_nValue == SAL_STATIC_CAST(const CntByteItem *, &rItem)->m_nValue; 61*cdf0e10cSrcweir } 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir //============================================================================ 64*cdf0e10cSrcweir // virtual 65*cdf0e10cSrcweir int CntByteItem::Compare(const SfxPoolItem & rWith) const 66*cdf0e10cSrcweir { 67*cdf0e10cSrcweir DBG_CHKTHIS(CntByteItem, 0); 68*cdf0e10cSrcweir DBG_ASSERT(rWith.ISA(CntByteItem), "CntByteItem::Compare(): Bad type"); 69*cdf0e10cSrcweir return SAL_STATIC_CAST(const CntByteItem *, &rWith)->m_nValue < m_nValue ? 70*cdf0e10cSrcweir -1 : 71*cdf0e10cSrcweir SAL_STATIC_CAST(const CntByteItem *, &rWith)->m_nValue 72*cdf0e10cSrcweir == m_nValue ? 73*cdf0e10cSrcweir 0 : 1; 74*cdf0e10cSrcweir } 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir //============================================================================ 77*cdf0e10cSrcweir // virtual 78*cdf0e10cSrcweir SfxItemPresentation CntByteItem::GetPresentation(SfxItemPresentation, 79*cdf0e10cSrcweir SfxMapUnit, SfxMapUnit, 80*cdf0e10cSrcweir XubString & rText, 81*cdf0e10cSrcweir const IntlWrapper *) const 82*cdf0e10cSrcweir { 83*cdf0e10cSrcweir DBG_CHKTHIS(CntByteItem, 0); 84*cdf0e10cSrcweir rText = XubString::CreateFromInt32(m_nValue); 85*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NAMELESS; 86*cdf0e10cSrcweir } 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir //============================================================================ 89*cdf0e10cSrcweir // virtual 90*cdf0e10cSrcweir sal_Bool CntByteItem::QueryValue(com::sun::star::uno::Any& rVal,sal_uInt8) const 91*cdf0e10cSrcweir { 92*cdf0e10cSrcweir sal_Int8 nValue = m_nValue; 93*cdf0e10cSrcweir rVal <<= nValue; 94*cdf0e10cSrcweir return sal_True; 95*cdf0e10cSrcweir } 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir //============================================================================ 98*cdf0e10cSrcweir // virtual 99*cdf0e10cSrcweir sal_Bool CntByteItem::PutValue(const com::sun::star::uno::Any& rVal,sal_uInt8) 100*cdf0e10cSrcweir { 101*cdf0e10cSrcweir sal_Int8 nValue = sal_Int8(); 102*cdf0e10cSrcweir if (rVal >>= nValue) 103*cdf0e10cSrcweir { 104*cdf0e10cSrcweir m_nValue = nValue; 105*cdf0e10cSrcweir return sal_True; 106*cdf0e10cSrcweir } 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir DBG_ERROR( "CntByteItem::PutValue - Wrong type!" ); 109*cdf0e10cSrcweir return sal_False; 110*cdf0e10cSrcweir } 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir //============================================================================ 113*cdf0e10cSrcweir // virtual 114*cdf0e10cSrcweir SfxPoolItem * CntByteItem::Create(SvStream & rStream, sal_uInt16) const 115*cdf0e10cSrcweir { 116*cdf0e10cSrcweir DBG_CHKTHIS(CntByteItem, 0); 117*cdf0e10cSrcweir short nTheValue = 0; 118*cdf0e10cSrcweir rStream >> nTheValue; 119*cdf0e10cSrcweir return new CntByteItem(Which(), sal_uInt8(nTheValue)); 120*cdf0e10cSrcweir } 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir //============================================================================ 123*cdf0e10cSrcweir // virtual 124*cdf0e10cSrcweir SvStream & CntByteItem::Store(SvStream & rStream, sal_uInt16) const 125*cdf0e10cSrcweir { 126*cdf0e10cSrcweir DBG_CHKTHIS(CntByteItem, 0); 127*cdf0e10cSrcweir rStream << short(m_nValue); 128*cdf0e10cSrcweir return rStream; 129*cdf0e10cSrcweir } 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir //============================================================================ 132*cdf0e10cSrcweir // virtual 133*cdf0e10cSrcweir SfxPoolItem * CntByteItem::Clone(SfxItemPool *) const 134*cdf0e10cSrcweir { 135*cdf0e10cSrcweir DBG_CHKTHIS(CntByteItem, 0); 136*cdf0e10cSrcweir return new CntByteItem(*this); 137*cdf0e10cSrcweir } 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir //============================================================================ 140*cdf0e10cSrcweir // virtual 141*cdf0e10cSrcweir sal_uInt8 CntByteItem::GetMin() const 142*cdf0e10cSrcweir { 143*cdf0e10cSrcweir DBG_CHKTHIS(CntByteItem, 0); 144*cdf0e10cSrcweir return 0; 145*cdf0e10cSrcweir } 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir //============================================================================ 148*cdf0e10cSrcweir // virtual 149*cdf0e10cSrcweir sal_uInt8 CntByteItem::GetMax() const 150*cdf0e10cSrcweir { 151*cdf0e10cSrcweir DBG_CHKTHIS(CntByteItem, 0); 152*cdf0e10cSrcweir return 255; 153*cdf0e10cSrcweir } 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir //============================================================================ 156*cdf0e10cSrcweir // virtual 157*cdf0e10cSrcweir SfxFieldUnit CntByteItem::GetUnit() const 158*cdf0e10cSrcweir { 159*cdf0e10cSrcweir DBG_CHKTHIS(CntByteItem, 0); 160*cdf0e10cSrcweir return SFX_FUNIT_NONE; 161*cdf0e10cSrcweir } 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir //============================================================================ 164*cdf0e10cSrcweir // 165*cdf0e10cSrcweir // class CntUInt16Item 166*cdf0e10cSrcweir // 167*cdf0e10cSrcweir //============================================================================ 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir DBG_NAME(CntUInt16Item); 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir //============================================================================ 172*cdf0e10cSrcweir TYPEINIT1_AUTOFACTORY(CntUInt16Item, SfxPoolItem); 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir //============================================================================ 175*cdf0e10cSrcweir CntUInt16Item::CntUInt16Item(sal_uInt16 which, SvStream & rStream) : 176*cdf0e10cSrcweir SfxPoolItem(which) 177*cdf0e10cSrcweir { 178*cdf0e10cSrcweir DBG_CTOR(CntUInt16Item, 0); 179*cdf0e10cSrcweir sal_uInt16 nTheValue = 0; 180*cdf0e10cSrcweir rStream >> nTheValue; 181*cdf0e10cSrcweir m_nValue = nTheValue; 182*cdf0e10cSrcweir } 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir //============================================================================ 185*cdf0e10cSrcweir // virtual 186*cdf0e10cSrcweir int CntUInt16Item::operator ==(const SfxPoolItem & rItem) const 187*cdf0e10cSrcweir { 188*cdf0e10cSrcweir DBG_CHKTHIS(CntUInt16Item, 0); 189*cdf0e10cSrcweir DBG_ASSERT(rItem.ISA(CntUInt16Item), 190*cdf0e10cSrcweir "CntUInt16Item::operator ==(): Bad type"); 191*cdf0e10cSrcweir return m_nValue == SAL_STATIC_CAST(const CntUInt16Item *, &rItem)-> 192*cdf0e10cSrcweir m_nValue; 193*cdf0e10cSrcweir } 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir //============================================================================ 196*cdf0e10cSrcweir // virtual 197*cdf0e10cSrcweir int CntUInt16Item::Compare(const SfxPoolItem & rWith) const 198*cdf0e10cSrcweir { 199*cdf0e10cSrcweir DBG_CHKTHIS(CntUInt16Item, 0); 200*cdf0e10cSrcweir DBG_ASSERT(rWith.ISA(CntUInt16Item), 201*cdf0e10cSrcweir "CntUInt16Item::Compare(): Bad type"); 202*cdf0e10cSrcweir return SAL_STATIC_CAST(const CntUInt16Item *, &rWith)->m_nValue 203*cdf0e10cSrcweir < m_nValue ? 204*cdf0e10cSrcweir -1 : 205*cdf0e10cSrcweir SAL_STATIC_CAST(const CntUInt16Item *, &rWith)->m_nValue 206*cdf0e10cSrcweir == m_nValue ? 207*cdf0e10cSrcweir 0 : 1; 208*cdf0e10cSrcweir } 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir //============================================================================ 211*cdf0e10cSrcweir // virtual 212*cdf0e10cSrcweir SfxItemPresentation CntUInt16Item::GetPresentation(SfxItemPresentation, 213*cdf0e10cSrcweir SfxMapUnit, SfxMapUnit, 214*cdf0e10cSrcweir XubString & rText, 215*cdf0e10cSrcweir const IntlWrapper *) 216*cdf0e10cSrcweir const 217*cdf0e10cSrcweir { 218*cdf0e10cSrcweir DBG_CHKTHIS(CntUInt16Item, 0); 219*cdf0e10cSrcweir rText = XubString::CreateFromInt32(m_nValue); 220*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NAMELESS; 221*cdf0e10cSrcweir } 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir //============================================================================ 224*cdf0e10cSrcweir // virtual 225*cdf0e10cSrcweir sal_Bool CntUInt16Item::QueryValue(com::sun::star::uno::Any& rVal,sal_uInt8) const 226*cdf0e10cSrcweir { 227*cdf0e10cSrcweir sal_Int32 nValue = m_nValue; 228*cdf0e10cSrcweir rVal <<= nValue; 229*cdf0e10cSrcweir return sal_True; 230*cdf0e10cSrcweir } 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir //============================================================================ 233*cdf0e10cSrcweir // virtual 234*cdf0e10cSrcweir sal_Bool CntUInt16Item::PutValue(const com::sun::star::uno::Any& rVal,sal_uInt8) 235*cdf0e10cSrcweir { 236*cdf0e10cSrcweir sal_Int32 nValue = 0; 237*cdf0e10cSrcweir if (rVal >>= nValue) 238*cdf0e10cSrcweir { 239*cdf0e10cSrcweir DBG_ASSERT( nValue <= USHRT_MAX, "Overflow in UInt16 value!"); 240*cdf0e10cSrcweir m_nValue = (sal_uInt16)nValue; 241*cdf0e10cSrcweir return sal_True; 242*cdf0e10cSrcweir } 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir DBG_ERROR( "CntUInt16Item::PutValue - Wrong type!" ); 245*cdf0e10cSrcweir return sal_False; 246*cdf0e10cSrcweir } 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir //============================================================================ 249*cdf0e10cSrcweir // virtual 250*cdf0e10cSrcweir SfxPoolItem * CntUInt16Item::Create(SvStream & rStream, sal_uInt16) const 251*cdf0e10cSrcweir { 252*cdf0e10cSrcweir DBG_CHKTHIS(CntUInt16Item, 0); 253*cdf0e10cSrcweir return new CntUInt16Item(Which(), rStream); 254*cdf0e10cSrcweir } 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir //============================================================================ 257*cdf0e10cSrcweir // virtual 258*cdf0e10cSrcweir SvStream & CntUInt16Item::Store(SvStream &rStream, sal_uInt16) const 259*cdf0e10cSrcweir { 260*cdf0e10cSrcweir DBG_CHKTHIS(CntUInt16Item, 0); 261*cdf0e10cSrcweir rStream << sal_uInt16(m_nValue); 262*cdf0e10cSrcweir return rStream; 263*cdf0e10cSrcweir } 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir //============================================================================ 266*cdf0e10cSrcweir // virtual 267*cdf0e10cSrcweir SfxPoolItem * CntUInt16Item::Clone(SfxItemPool *) const 268*cdf0e10cSrcweir { 269*cdf0e10cSrcweir DBG_CHKTHIS(CntUInt16Item, 0); 270*cdf0e10cSrcweir return new CntUInt16Item(*this); 271*cdf0e10cSrcweir } 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir //============================================================================ 274*cdf0e10cSrcweir // virtual 275*cdf0e10cSrcweir sal_uInt16 CntUInt16Item::GetMin() const 276*cdf0e10cSrcweir { 277*cdf0e10cSrcweir DBG_CHKTHIS(CntUInt16Item, 0); 278*cdf0e10cSrcweir return 0; 279*cdf0e10cSrcweir } 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir //============================================================================ 282*cdf0e10cSrcweir // virtual 283*cdf0e10cSrcweir sal_uInt16 CntUInt16Item::GetMax() const 284*cdf0e10cSrcweir { 285*cdf0e10cSrcweir DBG_CHKTHIS(CntUInt16Item, 0); 286*cdf0e10cSrcweir return 65535; 287*cdf0e10cSrcweir } 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir //============================================================================ 290*cdf0e10cSrcweir // virtual 291*cdf0e10cSrcweir SfxFieldUnit CntUInt16Item::GetUnit() const 292*cdf0e10cSrcweir { 293*cdf0e10cSrcweir DBG_CHKTHIS(CntUInt16Item, 0); 294*cdf0e10cSrcweir return SFX_FUNIT_NONE; 295*cdf0e10cSrcweir } 296*cdf0e10cSrcweir 297*cdf0e10cSrcweir //============================================================================ 298*cdf0e10cSrcweir // 299*cdf0e10cSrcweir // class CntInt32Item 300*cdf0e10cSrcweir // 301*cdf0e10cSrcweir //============================================================================ 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir DBG_NAME(CntInt32Item); 304*cdf0e10cSrcweir 305*cdf0e10cSrcweir //============================================================================ 306*cdf0e10cSrcweir TYPEINIT1_AUTOFACTORY(CntInt32Item, SfxPoolItem); 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir //============================================================================ 309*cdf0e10cSrcweir CntInt32Item::CntInt32Item(sal_uInt16 which, SvStream & rStream) : 310*cdf0e10cSrcweir SfxPoolItem(which) 311*cdf0e10cSrcweir { 312*cdf0e10cSrcweir DBG_CTOR(CntInt32Item, 0); 313*cdf0e10cSrcweir long nTheValue = 0; 314*cdf0e10cSrcweir rStream >> nTheValue; 315*cdf0e10cSrcweir m_nValue = nTheValue; 316*cdf0e10cSrcweir } 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir //============================================================================ 319*cdf0e10cSrcweir // virtual 320*cdf0e10cSrcweir int CntInt32Item::operator ==(const SfxPoolItem & rItem) const 321*cdf0e10cSrcweir { 322*cdf0e10cSrcweir DBG_CHKTHIS(CntInt32Item, 0); 323*cdf0e10cSrcweir DBG_ASSERT(rItem.ISA(CntInt32Item), 324*cdf0e10cSrcweir "CntInt32Item::operator ==(): Bad type"); 325*cdf0e10cSrcweir return m_nValue == SAL_STATIC_CAST(const CntInt32Item *, &rItem)-> 326*cdf0e10cSrcweir m_nValue; 327*cdf0e10cSrcweir } 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir //============================================================================ 330*cdf0e10cSrcweir // virtual 331*cdf0e10cSrcweir int CntInt32Item::Compare(const SfxPoolItem & rWith) const 332*cdf0e10cSrcweir { 333*cdf0e10cSrcweir DBG_CHKTHIS(CntInt32Item, 0); 334*cdf0e10cSrcweir DBG_ASSERT(rWith.ISA(CntInt32Item), "CntInt32Item::Compare(): Bad type"); 335*cdf0e10cSrcweir return SAL_STATIC_CAST(const CntInt32Item *, &rWith)->m_nValue 336*cdf0e10cSrcweir < m_nValue ? 337*cdf0e10cSrcweir -1 : 338*cdf0e10cSrcweir SAL_STATIC_CAST(const CntInt32Item *, &rWith)->m_nValue 339*cdf0e10cSrcweir == m_nValue ? 340*cdf0e10cSrcweir 0 : 1; 341*cdf0e10cSrcweir } 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir //============================================================================ 344*cdf0e10cSrcweir // virtual 345*cdf0e10cSrcweir SfxItemPresentation CntInt32Item::GetPresentation(SfxItemPresentation, 346*cdf0e10cSrcweir SfxMapUnit, SfxMapUnit, 347*cdf0e10cSrcweir XubString & rText, 348*cdf0e10cSrcweir const IntlWrapper *) const 349*cdf0e10cSrcweir { 350*cdf0e10cSrcweir DBG_CHKTHIS(CntInt32Item, 0); 351*cdf0e10cSrcweir rText = XubString::CreateFromInt32(m_nValue); 352*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NAMELESS; 353*cdf0e10cSrcweir } 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir //============================================================================ 356*cdf0e10cSrcweir // virtual 357*cdf0e10cSrcweir sal_Bool CntInt32Item::QueryValue(com::sun::star::uno::Any& rVal,sal_uInt8) const 358*cdf0e10cSrcweir { 359*cdf0e10cSrcweir sal_Int32 nValue = m_nValue; 360*cdf0e10cSrcweir rVal <<= nValue; 361*cdf0e10cSrcweir return sal_True; 362*cdf0e10cSrcweir } 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir //============================================================================ 365*cdf0e10cSrcweir // virtual 366*cdf0e10cSrcweir sal_Bool CntInt32Item::PutValue(const com::sun::star::uno::Any& rVal,sal_uInt8) 367*cdf0e10cSrcweir { 368*cdf0e10cSrcweir sal_Int32 nValue = 0; 369*cdf0e10cSrcweir if (rVal >>= nValue) 370*cdf0e10cSrcweir { 371*cdf0e10cSrcweir m_nValue = nValue; 372*cdf0e10cSrcweir return sal_True; 373*cdf0e10cSrcweir } 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir DBG_ERROR( "CntInt32Item::PutValue - Wrong type!" ); 376*cdf0e10cSrcweir return sal_False; 377*cdf0e10cSrcweir } 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir //============================================================================ 380*cdf0e10cSrcweir // virtual 381*cdf0e10cSrcweir SfxPoolItem * CntInt32Item::Create(SvStream & rStream, sal_uInt16) const 382*cdf0e10cSrcweir { 383*cdf0e10cSrcweir DBG_CHKTHIS(CntInt32Item, 0); 384*cdf0e10cSrcweir return new CntInt32Item(Which(), rStream); 385*cdf0e10cSrcweir } 386*cdf0e10cSrcweir 387*cdf0e10cSrcweir //============================================================================ 388*cdf0e10cSrcweir // virtual 389*cdf0e10cSrcweir SvStream & CntInt32Item::Store(SvStream &rStream, sal_uInt16) const 390*cdf0e10cSrcweir { 391*cdf0e10cSrcweir DBG_CHKTHIS(CntInt32Item, 0); 392*cdf0e10cSrcweir rStream << long(m_nValue); 393*cdf0e10cSrcweir return rStream; 394*cdf0e10cSrcweir } 395*cdf0e10cSrcweir 396*cdf0e10cSrcweir //============================================================================ 397*cdf0e10cSrcweir // virtual 398*cdf0e10cSrcweir SfxPoolItem * CntInt32Item::Clone(SfxItemPool *) const 399*cdf0e10cSrcweir { 400*cdf0e10cSrcweir DBG_CHKTHIS(CntInt32Item, 0); 401*cdf0e10cSrcweir return new CntInt32Item(*this); 402*cdf0e10cSrcweir } 403*cdf0e10cSrcweir 404*cdf0e10cSrcweir //============================================================================ 405*cdf0e10cSrcweir // virtual 406*cdf0e10cSrcweir sal_Int32 CntInt32Item::GetMin() const 407*cdf0e10cSrcweir { 408*cdf0e10cSrcweir DBG_CHKTHIS(CntInt32Item, 0); 409*cdf0e10cSrcweir return sal_Int32(0x80000000); 410*cdf0e10cSrcweir } 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir //============================================================================ 413*cdf0e10cSrcweir // virtual 414*cdf0e10cSrcweir sal_Int32 CntInt32Item::GetMax() const 415*cdf0e10cSrcweir { 416*cdf0e10cSrcweir DBG_CHKTHIS(CntInt32Item, 0); 417*cdf0e10cSrcweir return 0x7FFFFFFF; 418*cdf0e10cSrcweir } 419*cdf0e10cSrcweir 420*cdf0e10cSrcweir //============================================================================ 421*cdf0e10cSrcweir // virtual 422*cdf0e10cSrcweir SfxFieldUnit CntInt32Item::GetUnit() const 423*cdf0e10cSrcweir { 424*cdf0e10cSrcweir DBG_CHKTHIS(CntInt32Item, 0); 425*cdf0e10cSrcweir return SFX_FUNIT_NONE; 426*cdf0e10cSrcweir } 427*cdf0e10cSrcweir 428*cdf0e10cSrcweir //============================================================================ 429*cdf0e10cSrcweir // 430*cdf0e10cSrcweir // class CntUInt32Item 431*cdf0e10cSrcweir // 432*cdf0e10cSrcweir //============================================================================ 433*cdf0e10cSrcweir 434*cdf0e10cSrcweir DBG_NAME(CntUInt32Item); 435*cdf0e10cSrcweir 436*cdf0e10cSrcweir //============================================================================ 437*cdf0e10cSrcweir TYPEINIT1_AUTOFACTORY(CntUInt32Item, SfxPoolItem); 438*cdf0e10cSrcweir 439*cdf0e10cSrcweir //============================================================================ 440*cdf0e10cSrcweir CntUInt32Item::CntUInt32Item(sal_uInt16 which, SvStream & rStream) : 441*cdf0e10cSrcweir SfxPoolItem(which) 442*cdf0e10cSrcweir { 443*cdf0e10cSrcweir DBG_CTOR(CntUInt32Item, 0); 444*cdf0e10cSrcweir sal_uInt32 nTheValue = 0; 445*cdf0e10cSrcweir rStream >> nTheValue; 446*cdf0e10cSrcweir m_nValue = nTheValue; 447*cdf0e10cSrcweir } 448*cdf0e10cSrcweir 449*cdf0e10cSrcweir //============================================================================ 450*cdf0e10cSrcweir // virtual 451*cdf0e10cSrcweir int CntUInt32Item::operator ==(const SfxPoolItem & rItem) const 452*cdf0e10cSrcweir { 453*cdf0e10cSrcweir DBG_CHKTHIS(CntUInt32Item, 0); 454*cdf0e10cSrcweir DBG_ASSERT(rItem.ISA(CntUInt32Item), 455*cdf0e10cSrcweir "CntUInt32Item::operator ==(): Bad type"); 456*cdf0e10cSrcweir return m_nValue == SAL_STATIC_CAST(const CntUInt32Item *, &rItem)-> 457*cdf0e10cSrcweir m_nValue; 458*cdf0e10cSrcweir } 459*cdf0e10cSrcweir 460*cdf0e10cSrcweir //============================================================================ 461*cdf0e10cSrcweir // virtual 462*cdf0e10cSrcweir int CntUInt32Item::Compare(const SfxPoolItem & rWith) const 463*cdf0e10cSrcweir { 464*cdf0e10cSrcweir DBG_CHKTHIS(CntUInt32Item, 0); 465*cdf0e10cSrcweir DBG_ASSERT(rWith.ISA(CntUInt32Item), 466*cdf0e10cSrcweir "CntUInt32Item::operator ==(): Bad type"); 467*cdf0e10cSrcweir return SAL_STATIC_CAST(const CntUInt32Item *, &rWith)->m_nValue 468*cdf0e10cSrcweir < m_nValue ? 469*cdf0e10cSrcweir -1 : 470*cdf0e10cSrcweir SAL_STATIC_CAST(const CntUInt32Item *, &rWith)->m_nValue 471*cdf0e10cSrcweir == m_nValue ? 472*cdf0e10cSrcweir 0 : 1; 473*cdf0e10cSrcweir } 474*cdf0e10cSrcweir 475*cdf0e10cSrcweir //============================================================================ 476*cdf0e10cSrcweir // virtual 477*cdf0e10cSrcweir SfxItemPresentation CntUInt32Item::GetPresentation(SfxItemPresentation, 478*cdf0e10cSrcweir SfxMapUnit, SfxMapUnit, 479*cdf0e10cSrcweir XubString & rText, 480*cdf0e10cSrcweir const IntlWrapper *) 481*cdf0e10cSrcweir const 482*cdf0e10cSrcweir { 483*cdf0e10cSrcweir DBG_CHKTHIS(CntUInt32Item, 0); 484*cdf0e10cSrcweir rText = XubString::CreateFromInt64(m_nValue); 485*cdf0e10cSrcweir return SFX_ITEM_PRESENTATION_NAMELESS; 486*cdf0e10cSrcweir } 487*cdf0e10cSrcweir 488*cdf0e10cSrcweir //============================================================================ 489*cdf0e10cSrcweir // virtual 490*cdf0e10cSrcweir sal_Bool CntUInt32Item::QueryValue(com::sun::star::uno::Any& rVal,sal_uInt8) const 491*cdf0e10cSrcweir { 492*cdf0e10cSrcweir sal_Int32 nValue = m_nValue; 493*cdf0e10cSrcweir DBG_ASSERT( nValue>=0, "Overflow in UInt32 value!"); 494*cdf0e10cSrcweir rVal <<= nValue; 495*cdf0e10cSrcweir return sal_True; 496*cdf0e10cSrcweir } 497*cdf0e10cSrcweir 498*cdf0e10cSrcweir //============================================================================ 499*cdf0e10cSrcweir // virtual 500*cdf0e10cSrcweir sal_Bool CntUInt32Item::PutValue(const com::sun::star::uno::Any& rVal,sal_uInt8) 501*cdf0e10cSrcweir { 502*cdf0e10cSrcweir sal_Int32 nValue = 0; 503*cdf0e10cSrcweir if (rVal >>= nValue) 504*cdf0e10cSrcweir { 505*cdf0e10cSrcweir DBG_ASSERT( nValue>=0, "Overflow in UInt32 value!"); 506*cdf0e10cSrcweir m_nValue = nValue; 507*cdf0e10cSrcweir return sal_True; 508*cdf0e10cSrcweir } 509*cdf0e10cSrcweir 510*cdf0e10cSrcweir DBG_ERROR( "CntUInt32Item::PutValue - Wrong type!" ); 511*cdf0e10cSrcweir return sal_False; 512*cdf0e10cSrcweir } 513*cdf0e10cSrcweir 514*cdf0e10cSrcweir //============================================================================ 515*cdf0e10cSrcweir // virtual 516*cdf0e10cSrcweir SfxPoolItem * CntUInt32Item::Create(SvStream & rStream, sal_uInt16) const 517*cdf0e10cSrcweir { 518*cdf0e10cSrcweir DBG_CHKTHIS(CntUInt32Item, 0); 519*cdf0e10cSrcweir return new CntUInt32Item(Which(), rStream); 520*cdf0e10cSrcweir } 521*cdf0e10cSrcweir 522*cdf0e10cSrcweir //============================================================================ 523*cdf0e10cSrcweir // virtual 524*cdf0e10cSrcweir SvStream & CntUInt32Item::Store(SvStream &rStream, sal_uInt16) const 525*cdf0e10cSrcweir { 526*cdf0e10cSrcweir DBG_CHKTHIS(CntUInt32Item, 0); 527*cdf0e10cSrcweir rStream << static_cast<sal_uInt32>(m_nValue); 528*cdf0e10cSrcweir return rStream; 529*cdf0e10cSrcweir } 530*cdf0e10cSrcweir 531*cdf0e10cSrcweir //============================================================================ 532*cdf0e10cSrcweir // virtual 533*cdf0e10cSrcweir SfxPoolItem * CntUInt32Item::Clone(SfxItemPool *) const 534*cdf0e10cSrcweir { 535*cdf0e10cSrcweir DBG_CHKTHIS(CntUInt32Item, 0); 536*cdf0e10cSrcweir return new CntUInt32Item(*this); 537*cdf0e10cSrcweir } 538*cdf0e10cSrcweir 539*cdf0e10cSrcweir //============================================================================ 540*cdf0e10cSrcweir // virtual 541*cdf0e10cSrcweir sal_uInt32 CntUInt32Item::GetMin() const 542*cdf0e10cSrcweir { 543*cdf0e10cSrcweir DBG_CHKTHIS(CntUInt32Item, 0); 544*cdf0e10cSrcweir return 0; 545*cdf0e10cSrcweir } 546*cdf0e10cSrcweir 547*cdf0e10cSrcweir //============================================================================ 548*cdf0e10cSrcweir // virtual 549*cdf0e10cSrcweir sal_uInt32 CntUInt32Item::GetMax() const 550*cdf0e10cSrcweir { 551*cdf0e10cSrcweir DBG_CHKTHIS(CntUInt32Item, 0); 552*cdf0e10cSrcweir return 0xFFFFFFFF; 553*cdf0e10cSrcweir } 554*cdf0e10cSrcweir 555*cdf0e10cSrcweir //============================================================================ 556*cdf0e10cSrcweir // virtual 557*cdf0e10cSrcweir SfxFieldUnit CntUInt32Item::GetUnit() const 558*cdf0e10cSrcweir { 559*cdf0e10cSrcweir DBG_CHKTHIS(CntUInt32Item, 0); 560*cdf0e10cSrcweir return SFX_FUNIT_NONE; 561*cdf0e10cSrcweir } 562*cdf0e10cSrcweir 563