1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: bintitem.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svtools.hxx"
33 #include <com/sun/star/uno/Any.hxx>
34 #include <tools/stream.hxx>
35 #include <tools/bigint.hxx>
36 #include <svtools/bintitem.hxx>
40 DBG_NAME(SfxBigIntItem
)
43 TYPEINIT1_AUTOFACTORY(SfxBigIntItem
, SfxPoolItem
);
47 //============================================================================
48 SfxBigIntItem::SfxBigIntItem()
52 DBG_CTOR(SfxBigIntItem
, 0);
55 //============================================================================
56 SfxBigIntItem::SfxBigIntItem(USHORT which
, const BigInt
& rValue
)
60 DBG_CTOR(SfxBigIntItem
, 0);
63 //============================================================================
64 SfxBigIntItem::SfxBigIntItem(USHORT which
, SvStream
&rStream
)
67 DBG_CTOR(SfxBigIntItem
, 0);
69 rStream
.ReadByteString(sTmp
);
74 //============================================================================
75 SfxBigIntItem::SfxBigIntItem(const SfxBigIntItem
& rItem
)
79 DBG_CTOR(SfxBigIntItem
, 0);
82 //============================================================================
83 SfxItemPresentation
SfxBigIntItem::GetPresentation(
84 SfxItemPresentation
/*ePresentation*/,
85 SfxMapUnit
/*eCoreMetric*/,
86 SfxMapUnit
/*ePresentationMetric*/,
88 const IntlWrapper
* ) const
90 DBG_CHKTHIS(SfxBigIntItem
, 0);
91 rText
= aVal
.GetString();
92 return SFX_ITEM_PRESENTATION_NAMELESS
;
95 //============================================================================
96 int SfxBigIntItem::operator==(const SfxPoolItem
& rItem
) const
98 DBG_CHKTHIS(SfxBigIntItem
, 0);
99 DBG_ASSERT(SfxPoolItem::operator==(rItem
), "unequal type");
100 return ((SfxBigIntItem
&)rItem
).aVal
== aVal
;
103 //============================================================================
104 int SfxBigIntItem::Compare(const SfxPoolItem
& rItem
) const
106 DBG_CHKTHIS(SfxBigIntItem
, 0);
107 DBG_ASSERT(SfxPoolItem::operator==(rItem
), "unequal type");
109 if (((const SfxBigIntItem
&)rItem
).aVal
< aVal
)
111 else if (((const SfxBigIntItem
&)rItem
).aVal
== aVal
)
117 //============================================================================
118 SfxPoolItem
* SfxBigIntItem::Clone(SfxItemPool
*) const
120 DBG_CHKTHIS(SfxBigIntItem
, 0);
121 return new SfxBigIntItem(*this);
124 //============================================================================
125 SfxPoolItem
* SfxBigIntItem::Create(SvStream
&rStream
, USHORT
) const
127 DBG_CHKTHIS(SfxBigIntItem
, 0);
128 return new SfxBigIntItem(Which(), rStream
);
131 //============================================================================
132 SvStream
& SfxBigIntItem::Store(SvStream
&rStream
, USHORT
) const
134 DBG_CHKTHIS(SfxBigIntItem
, 0);
135 rStream
.WriteByteString( aVal
.GetByteString() );
139 //============================================================================
140 SfxFieldUnit
SfxBigIntItem::GetUnit() const
142 DBG_CHKTHIS(SfxBigIntItem
, 0);
143 return SFX_FUNIT_NONE
;
146 //============================================================================
148 BOOL
SfxBigIntItem::PutValue( const com::sun::star::uno::Any
& rVal
, BYTE
)
151 if ( rVal
>>= aValue
)
157 DBG_ERROR( "SfxBigIntItem::PutValue - Wrong type!" );
161 //============================================================================
163 BOOL
SfxBigIntItem::QueryValue( com::sun::star::uno::Any
& rVal
, BYTE
) const
165 double aValue
= GetValue();