Bump version to 6.4-15
[LibreOffice.git] / sc / inc / PivotTableDataSequence.hxx
blob7d6d04d4c3f125a44971f6a9cf5d95c54c5c361b
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 #ifndef INCLUDED_SC_INC_PIVOTTABLEDATASEQUENCE_HXX
11 #define INCLUDED_SC_INC_PIVOTTABLEDATASEQUENCE_HXX
13 #include <com/sun/star/chart2/data/XDataSequence.hpp>
14 #include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
15 #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
16 #include <com/sun/star/chart2/data/DataSequenceRole.hpp>
17 #include <com/sun/star/lang/XServiceInfo.hpp>
18 #include <com/sun/star/beans/XPropertySet.hpp>
19 #include <com/sun/star/util/XCloneable.hpp>
20 #include <com/sun/star/util/XModifyBroadcaster.hpp>
23 #include <svl/lstner.hxx>
24 #include <svl/itemprop.hxx>
25 #include <cppuhelper/implbase.hxx>
26 #include <rtl/math.hxx>
28 class ScDocument;
30 namespace sc
33 enum class ValueType
35 Empty,
36 String,
37 Numeric
40 struct ValueAndFormat
42 double m_fValue;
43 OUString m_aString;
44 ValueType m_eType;
45 sal_uInt32 m_nNumberFormat;
47 explicit ValueAndFormat()
48 : m_fValue(0.0)
49 , m_aString()
50 , m_eType(ValueType::Empty)
51 , m_nNumberFormat(0)
53 rtl::math::setNan(&m_fValue);
56 explicit ValueAndFormat(double fValue, sal_uInt32 nNumberFormat)
57 : m_fValue(fValue)
58 , m_aString()
59 , m_eType(ValueType::Numeric)
60 , m_nNumberFormat(nNumberFormat)
63 explicit ValueAndFormat(OUString const & rString)
64 : m_fValue(0.0)
65 , m_aString(rString)
66 , m_eType(ValueType::String)
67 , m_nNumberFormat(0)
69 rtl::math::setNan(&m_fValue);
73 typedef cppu::WeakImplHelper<css::chart2::data::XDataSequence,
74 css::chart2::data::XTextualDataSequence,
75 css::chart2::data::XNumericalDataSequence,
76 css::util::XCloneable,
77 css::util::XModifyBroadcaster,
78 css::beans::XPropertySet,
79 css::lang::XServiceInfo>
80 PivotTableDataSequence_Base;
82 class PivotTableDataSequence final : public PivotTableDataSequence_Base, public SfxListener
84 public:
85 explicit PivotTableDataSequence(ScDocument* pDocument, OUString const & sPivotTableName,
86 OUString const & sID, std::vector<ValueAndFormat> const & rData);
88 virtual ~PivotTableDataSequence() override;
89 PivotTableDataSequence(const PivotTableDataSequence&) = delete;
90 PivotTableDataSequence& operator=(const PivotTableDataSequence&) = delete;
92 virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
94 // XDataSequence
95 virtual css::uno::Sequence<css::uno::Any> SAL_CALL getData() override;
96 virtual OUString SAL_CALL getSourceRangeRepresentation() override;
97 virtual css::uno::Sequence<OUString> SAL_CALL
98 generateLabel(css::chart2::data::LabelOrigin nOrigin) override;
100 virtual sal_Int32 SAL_CALL getNumberFormatKeyByIndex(sal_Int32 nIndex) override;
102 // XNumericalDataSequence
103 virtual css::uno::Sequence<double> SAL_CALL getNumericalData() override;
105 // XTextualDataSequence
106 virtual css::uno::Sequence<OUString> SAL_CALL getTextualData() override;
108 // XPropertySet
109 virtual css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL
110 getPropertySetInfo() override;
112 virtual void SAL_CALL setPropertyValue(const OUString& rPropertyName,
113 const css::uno::Any& rValue) override;
115 virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& rPropertyName) override;
117 virtual void SAL_CALL addPropertyChangeListener(
118 const OUString& rPropertyName,
119 const css::uno::Reference< css::beans::XPropertyChangeListener>& xListener) override;
121 virtual void SAL_CALL removePropertyChangeListener(
122 const OUString& rPropertyName,
123 const css::uno::Reference< css::beans::XPropertyChangeListener>& rListener) override;
125 virtual void SAL_CALL addVetoableChangeListener(
126 const OUString& rPropertyName,
127 const css::uno::Reference< css::beans::XVetoableChangeListener>& rListener) override;
129 virtual void SAL_CALL removeVetoableChangeListener(
130 const OUString& rPropertyName,
131 const css::uno::Reference< css::beans::XVetoableChangeListener>& rListener) override;
133 // XCloneable
134 virtual css::uno::Reference<css::util::XCloneable> SAL_CALL createClone() override;
136 // XModifyBroadcaster
137 virtual void SAL_CALL addModifyListener(
138 const css::uno::Reference<css::util::XModifyListener>& aListener) override;
140 virtual void SAL_CALL removeModifyListener(
141 const css::uno::Reference<css::util::XModifyListener>& aListener) override;
143 // XServiceInfo
144 virtual OUString SAL_CALL getImplementationName() override;
146 virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override;
148 virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
150 // Other
152 void setRole(css::chart2::data::DataSequenceRole const & aRole)
154 m_aRole = aRole;
157 private:
158 ScDocument* m_pDocument;
159 OUString const m_sPivotTableName;
160 OUString const m_aID;
161 std::vector<ValueAndFormat> m_aData;
162 SfxItemPropertySet const m_aPropSet;
163 css::chart2::data::DataSequenceRole m_aRole;
164 std::vector<css::uno::Reference<css::util::XModifyListener>> m_aValueListeners;
169 #endif
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */