LibreOffice Module svx (master)  1
numinf.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #include <svx/numinf.hxx>
21 
22 
23 SvxNumberInfoItem::SvxNumberInfoItem( const sal_uInt16 nId ) :
24  SfxPoolItem ( nId ),
25  pFormatter ( nullptr ),
26  eValueType ( SvxNumberValueType::Undefined ),
27  aStringVal ( "" ),
28  nDoubleVal ( 0 )
29 {
30 }
31 
32 
34  const sal_uInt16 nId ) :
35  SfxPoolItem ( nId ),
36  pFormatter ( pNumFormatter ),
37  eValueType ( SvxNumberValueType::Undefined ),
38  aStringVal ( "" ),
39  nDoubleVal ( 0 )
40 {
41 }
42 
43 
45  const OUString& rVal, const sal_uInt16 nId ) :
46  SfxPoolItem ( nId ),
47  pFormatter ( pNumFormatter ),
48  eValueType ( SvxNumberValueType::String ),
49  aStringVal ( rVal ),
50  nDoubleVal ( 0 )
51 {
52 }
53 
54 
56  const double& rVal, const sal_uInt16 nId ) :
57  SfxPoolItem ( nId ),
58  pFormatter ( pNumFormatter ),
59  eValueType ( SvxNumberValueType::Number ),
60  aStringVal ( "" ),
61  nDoubleVal ( rVal )
62 {
63 }
64 
65 
67  const double& rVal, const OUString& rValueStr,
68  const sal_uInt16 nId ) :
69  SfxPoolItem ( nId ),
70  pFormatter ( pNumFormatter ),
71  eValueType ( SvxNumberValueType::Number ),
72  aStringVal ( rValueStr ),
73  nDoubleVal ( rVal )
74 {
75 }
76 
77 
79  SfxPoolItem ( rItem ),
80  pFormatter ( rItem.pFormatter ),
81  eValueType ( rItem.eValueType ),
82  aStringVal ( rItem.aStringVal ),
83  nDoubleVal ( rItem.nDoubleVal ),
84  mvDelFormats( rItem.mvDelFormats )
85 {
86 }
87 
88 
90 {
91 }
92 
93 
95 (
96  SfxItemPresentation /*ePres*/,
97  MapUnit /*eCoreUnit*/,
98  MapUnit /*ePresUnit*/,
99  OUString& rText, const IntlWrapper&
100 ) const
101 {
102  rText.clear();
103  return false;
104 }
105 
106 
107 bool SvxNumberInfoItem::operator==( const SfxPoolItem& rItem ) const
108 {
109  assert(SfxPoolItem::operator==(rItem));
110 
111  const SvxNumberInfoItem& rOther = static_cast<const SvxNumberInfoItem&>(rItem);
112 
113  return mvDelFormats == rOther.mvDelFormats &&
114  pFormatter == rOther.pFormatter &&
115  eValueType == rOther.eValueType &&
116  nDoubleVal == rOther.nDoubleVal &&
117  aStringVal == rOther.aStringVal;
118 }
119 
121 {
122  return new SvxNumberInfoItem( *this );
123 }
124 
125 void SvxNumberInfoItem::SetDelFormats( std::vector<sal_uInt32> && aData )
126 {
127  mvDelFormats = std::move(aData);
128 }
129 
130 
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvxNumberValueType
Definition: numfmtsh.hxx:33
SvNumberFormatter * pFormatter
Definition: numinf.hxx:64
virtual SvxNumberInfoItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: numinf.cxx:120
OUString aStringVal
Definition: numinf.hxx:66
virtual ~SvxNumberInfoItem() override
Definition: numinf.cxx:89
constexpr OUStringLiteral aData
SfxItemPresentation
void SetDelFormats(std::vector< sal_uInt32 > &&)
Definition: numinf.cxx:125
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: numinf.cxx:95
virtual bool operator==(const SfxPoolItem &) const override
Definition: numinf.cxx:107
double nDoubleVal
Definition: numinf.hxx:67
std::vector< sal_uInt32 > mvDelFormats
Definition: numinf.hxx:69
SvxNumberValueType eValueType
Definition: numinf.hxx:65
MapUnit
SvxNumberInfoItem(const sal_uInt16 nId)
Definition: numinf.cxx:23
This item is used as a transport medium for a number formatter.
Definition: numinf.hxx:29