LibreOffice Module svx (master) 1
chrtitem.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 <rtl/math.hxx>
23#include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp>
24
25#include <svx/chrtitem.hxx>
26
27using namespace ::com::sun::star;
28
29
31
34 SfxEnumItem(nId, eOrder)
35{
36}
37
39{
40 return new SvxChartTextOrderItem(*this);
41}
42
43bool SvxChartTextOrderItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
44{
45 // the order of the two enums is not equal, so a mapping is required
46 css::chart::ChartAxisArrangeOrderType eAO;
47 SvxChartTextOrder eOrder( GetValue());
48
49 switch( eOrder )
50 {
52 eAO = css::chart::ChartAxisArrangeOrderType_SIDE_BY_SIDE; break;
54 eAO = css::chart::ChartAxisArrangeOrderType_STAGGER_ODD; break;
56 eAO = css::chart::ChartAxisArrangeOrderType_STAGGER_EVEN; break;
58 eAO = css::chart::ChartAxisArrangeOrderType_AUTO; break;
59 }
60
61 rVal <<= eAO;
62
63 return true;
64}
65
66
67bool SvxChartTextOrderItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
68{
69 // the order of the two enums is not equal, so a mapping is required
70 css::chart::ChartAxisArrangeOrderType eAO;
71 SvxChartTextOrder eOrder;
72
73 if(!(rVal >>= eAO))
74 {
75 // also try an int (for Basic)
76 sal_Int32 nAO = 0;
77 if(!(rVal >>= nAO))
78 return false;
79 eAO = static_cast< css::chart::ChartAxisArrangeOrderType >( nAO );
80 }
81
82 switch( eAO )
83 {
84 case css::chart::ChartAxisArrangeOrderType_SIDE_BY_SIDE:
85 eOrder = SvxChartTextOrder::SideBySide; break;
86 case css::chart::ChartAxisArrangeOrderType_STAGGER_ODD:
87 eOrder = SvxChartTextOrder::UpDown; break;
88 case css::chart::ChartAxisArrangeOrderType_STAGGER_EVEN:
89 eOrder = SvxChartTextOrder::DownUp; break;
90 case css::chart::ChartAxisArrangeOrderType_AUTO:
91 eOrder = SvxChartTextOrder::Auto; break;
92 default:
93 return false;
94 }
95
96 SetValue( eOrder );
97
98 return true;
99}
100
103 fVal(fValue)
104{
105}
106
108 SfxPoolItem(rItem),
109 fVal(rItem.fVal)
110{
111}
112
114 ( SfxItemPresentation /*ePresentation*/, MapUnit /*eCoreMetric*/,
115 MapUnit /*ePresentationMetric*/, OUString& rText,
116 const IntlWrapper& rIntlWrapper) const
117{
118 rText = ::rtl::math::doubleToUString( fVal, rtl_math_StringFormat_E, 4,
119 rIntlWrapper.getLocaleData()->getNumDecimalSep()[0], true );
120 return true;
121}
122
124{
125 assert(SfxPoolItem::operator==(rItem));
126 return static_cast<const SvxDoubleItem&>(rItem).fVal == fVal;
127}
128
130{
131 return new SvxDoubleItem(*this);
132}
133
134bool SvxDoubleItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
135{
136 rVal <<= fVal;
137 return true;
138}
139
140bool SvxDoubleItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
141{
142 return rVal >>= fVal;
143}
144
147 SfxEnumItem(nId, eOrient)
148{
149}
150
152{
153 return new SvxChartKindErrorItem(*this);
154}
155
158 SfxEnumItem(nId, eOrient)
159{
160}
161
163{
164 return new SvxChartIndicateItem(*this);
165}
166
169 SfxEnumItem(nId, eOrient)
170{
171}
172
174{
175 return new SvxChartRegressItem(*this);
176}
177
178/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvxChartRegress
Definition: chrtitem.hxx:66
SvxChartIndicate
Definition: chrtitem.hxx:56
SvxChartKindError
Definition: chrtitem.hxx:42
SvxChartTextOrder
Definition: chrtitem.hxx:32
const LocaleDataWrapper * getLocaleData() const
const OUString & getNumDecimalSep() const
void SetValue(EnumT nTheValue)
SvxChartIndicateItem(SvxChartIndicate eOrient, TypedWhichId< SvxChartIndicateItem > nId)
Definition: chrtitem.cxx:156
virtual SvxChartIndicateItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: chrtitem.cxx:162
SvxChartKindErrorItem(SvxChartKindError, TypedWhichId< SvxChartKindErrorItem > nId)
Definition: chrtitem.cxx:145
virtual SvxChartKindErrorItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: chrtitem.cxx:151
virtual SvxChartRegressItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: chrtitem.cxx:173
SvxChartRegressItem(SvxChartRegress eRegress, TypedWhichId< SvxChartRegressItem > nId)
Definition: chrtitem.cxx:167
virtual SvxChartTextOrderItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: chrtitem.cxx:38
SvxChartTextOrderItem(SvxChartTextOrder eOrder, TypedWhichId< SvxChartTextOrderItem > nId)
Definition: chrtitem.cxx:32
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: chrtitem.cxx:67
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: chrtitem.cxx:43
static SfxPoolItem * CreateDefault()
Definition: chrtitem.cxx:30
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: chrtitem.cxx:114
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: chrtitem.cxx:134
virtual bool operator==(const SfxPoolItem &) const override
Definition: chrtitem.cxx:123
SvxDoubleItem(double fValue, TypedWhichId< SvxDoubleItem > nId)
Definition: chrtitem.cxx:101
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: chrtitem.cxx:140
virtual SvxDoubleItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: chrtitem.cxx:129
MapUnit
sal_Int16 nId
SfxItemPresentation
unsigned char sal_uInt8