bump product version to 5.0.4.1
[LibreOffice.git] / svl / source / items / int64item.cxx
blobb9be4fb280aa2df9565f8289d77b85767be584df
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <svl/int64item.hxx>
11 #include <tools/stream.hxx>
13 SfxInt64Item::SfxInt64Item( sal_uInt16 nWhich, sal_Int64 nVal ) :
14 SfxPoolItem(nWhich), mnValue(nVal)
18 SfxInt64Item::SfxInt64Item( sal_uInt16 nWhich, SvStream& rStream ) :
19 SfxPoolItem(nWhich), mnValue(0)
21 rStream.ReadInt64(mnValue);
24 SfxInt64Item::SfxInt64Item( const SfxInt64Item& rItem ) :
25 SfxPoolItem(rItem), mnValue(rItem.mnValue)
29 SfxInt64Item::~SfxInt64Item() {}
31 bool SfxInt64Item::operator== ( const SfxPoolItem& rItem ) const
33 return mnValue == static_cast<const SfxInt64Item&>(rItem).mnValue;
36 int SfxInt64Item::Compare( const SfxPoolItem& r ) const
38 sal_Int64 nOther = static_cast<const SfxInt64Item&>(r).mnValue;
40 if (mnValue < nOther)
41 return -1;
43 if (mnValue > nOther)
44 return 1;
46 return 0;
49 int SfxInt64Item::Compare( const SfxPoolItem& r, const IntlWrapper& /*rIntlWrapper*/ ) const
51 return Compare(r);
54 bool SfxInt64Item::GetPresentation(
55 SfxItemPresentation, SfxMapUnit, SfxMapUnit, OUString& rText,
56 const IntlWrapper* /*pIntlWrapper*/ ) const
58 rText = OUString::number(mnValue);
59 return true;
62 bool SfxInt64Item::QueryValue(
63 com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
65 rVal <<= mnValue;
66 return true;
69 bool SfxInt64Item::PutValue(
70 const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
72 sal_Int64 nVal;
74 if (rVal >>= nVal)
76 mnValue = nVal;
77 return true;
80 return false;
83 SfxPoolItem* SfxInt64Item::Create( SvStream& rStream, sal_uInt16 /*nItemVersion*/ ) const
85 return new SfxInt64Item(Which(), rStream);
88 SvStream& SfxInt64Item::Store( SvStream& rStream, sal_uInt16 /*nItemVersion*/ ) const
90 return rStream.WriteInt64(mnValue);
93 SfxPoolItem* SfxInt64Item::Clone( SfxItemPool* /*pOther*/ ) const
95 return new SfxInt64Item(*this);
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */