1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <svx/numinf.hxx>
24 SvxNumberInfoItem::SvxNumberInfoItem( const TypedWhichId
<SvxNumberInfoItem
> nId
) :
26 pFormatter ( nullptr ),
27 eValueType ( SvxNumberValueType::Undefined
),
34 SvxNumberInfoItem::SvxNumberInfoItem( SvNumberFormatter
* pNumFormatter
,
35 const TypedWhichId
<SvxNumberInfoItem
> nId
) :
37 pFormatter ( pNumFormatter
),
38 eValueType ( SvxNumberValueType::Undefined
),
45 SvxNumberInfoItem::SvxNumberInfoItem( SvNumberFormatter
* pNumFormatter
,
46 OUString aVal
, const TypedWhichId
<SvxNumberInfoItem
> nId
) :
48 pFormatter ( pNumFormatter
),
49 eValueType ( SvxNumberValueType::String
),
50 aStringVal (std::move( aVal
)),
56 SvxNumberInfoItem::SvxNumberInfoItem( SvNumberFormatter
* pNumFormatter
,
57 const double& rVal
, const TypedWhichId
<SvxNumberInfoItem
> nId
) :
59 pFormatter ( pNumFormatter
),
60 eValueType ( SvxNumberValueType::Number
),
67 SvxNumberInfoItem::SvxNumberInfoItem( SvNumberFormatter
* pNumFormatter
,
68 const double& rVal
, OUString aValueStr
,
69 const TypedWhichId
<SvxNumberInfoItem
> nId
) :
71 pFormatter ( pNumFormatter
),
72 eValueType ( SvxNumberValueType::Number
),
73 aStringVal (std::move( aValueStr
)),
79 SvxNumberInfoItem::SvxNumberInfoItem( const SvxNumberInfoItem
& rItem
) :
80 SfxPoolItem ( rItem
),
81 pFormatter ( rItem
.pFormatter
),
82 eValueType ( rItem
.eValueType
),
83 aStringVal ( rItem
.aStringVal
),
84 nDoubleVal ( rItem
.nDoubleVal
),
85 mvDelFormats( rItem
.mvDelFormats
)
90 SvxNumberInfoItem::~SvxNumberInfoItem()
95 bool SvxNumberInfoItem::GetPresentation
97 SfxItemPresentation
/*ePres*/,
98 MapUnit
/*eCoreUnit*/,
99 MapUnit
/*ePresUnit*/,
100 OUString
& rText
, const IntlWrapper
&
108 bool SvxNumberInfoItem::operator==( const SfxPoolItem
& rItem
) const
110 assert(SfxPoolItem::operator==(rItem
));
112 const SvxNumberInfoItem
& rOther
= static_cast<const SvxNumberInfoItem
&>(rItem
);
114 return mvDelFormats
== rOther
.mvDelFormats
&&
115 pFormatter
== rOther
.pFormatter
&&
116 eValueType
== rOther
.eValueType
&&
117 nDoubleVal
== rOther
.nDoubleVal
&&
118 aStringVal
== rOther
.aStringVal
;
121 SvxNumberInfoItem
* SvxNumberInfoItem::Clone( SfxItemPool
* ) const
123 return new SvxNumberInfoItem( *this );
126 void SvxNumberInfoItem::SetDelFormats( std::vector
<sal_uInt32
> && aData
)
128 mvDelFormats
= std::move(aData
);
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */