LibreOffice Module sc (master) 1
PivotTableDataSequence.hxx
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
10#pragma once
11
12#include <com/sun/star/chart2/data/XDataSequence.hpp>
13#include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
14#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
15#include <com/sun/star/chart2/data/DataSequenceRole.hpp>
16#include <com/sun/star/lang/XServiceInfo.hpp>
17#include <com/sun/star/beans/XPropertySet.hpp>
18#include <com/sun/star/util/XCloneable.hpp>
19#include <com/sun/star/util/XModifyBroadcaster.hpp>
20
21
22#include <svl/lstner.hxx>
23#include <svl/itemprop.hxx>
25
26#include <limits>
27#include <utility>
28
29class ScDocument;
30
31namespace sc
32{
33
34enum class ValueType
35{
36 Empty,
37 String,
39};
40
42{
43 double m_fValue;
44 OUString m_aString;
46 sal_uInt32 m_nNumberFormat;
47
48 explicit ValueAndFormat()
49 : m_fValue(std::numeric_limits<double>::quiet_NaN())
50 , m_aString()
53 {
54 }
55
56 explicit ValueAndFormat(double fValue, sal_uInt32 nNumberFormat)
57 : m_fValue(fValue)
58 , m_aString()
60 , m_nNumberFormat(nNumberFormat)
61 {}
62
63 explicit ValueAndFormat(OUString aString)
64 : m_fValue(std::numeric_limits<double>::quiet_NaN())
65 , m_aString(std::move(aString))
68 {
69 }
70};
71
72typedef cppu::WeakImplHelper<css::chart2::data::XDataSequence,
73 css::chart2::data::XTextualDataSequence,
74 css::chart2::data::XNumericalDataSequence,
75 css::util::XCloneable,
76 css::util::XModifyBroadcaster,
77 css::beans::XPropertySet,
78 css::lang::XServiceInfo>
80
82{
83public:
84 explicit PivotTableDataSequence(ScDocument* pDocument,
85 OUString sID, std::vector<ValueAndFormat>&& rData);
86
87 virtual ~PivotTableDataSequence() override;
90
91 virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
92
93 // XDataSequence
94 virtual css::uno::Sequence<css::uno::Any> SAL_CALL getData() override;
95 virtual OUString SAL_CALL getSourceRangeRepresentation() override;
96 virtual css::uno::Sequence<OUString> SAL_CALL
97 generateLabel(css::chart2::data::LabelOrigin nOrigin) override;
98
99 virtual sal_Int32 SAL_CALL getNumberFormatKeyByIndex(sal_Int32 nIndex) override;
100
101 // XNumericalDataSequence
102 virtual css::uno::Sequence<double> SAL_CALL getNumericalData() override;
103
104 // XTextualDataSequence
105 virtual css::uno::Sequence<OUString> SAL_CALL getTextualData() override;
106
107 // XPropertySet
108 virtual css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL
109 getPropertySetInfo() override;
110
111 virtual void SAL_CALL setPropertyValue(const OUString& rPropertyName,
112 const css::uno::Any& rValue) override;
113
114 virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& rPropertyName) override;
115
116 virtual void SAL_CALL addPropertyChangeListener(
117 const OUString& rPropertyName,
118 const css::uno::Reference< css::beans::XPropertyChangeListener>& xListener) override;
119
120 virtual void SAL_CALL removePropertyChangeListener(
121 const OUString& rPropertyName,
122 const css::uno::Reference< css::beans::XPropertyChangeListener>& rListener) override;
123
124 virtual void SAL_CALL addVetoableChangeListener(
125 const OUString& rPropertyName,
126 const css::uno::Reference< css::beans::XVetoableChangeListener>& rListener) override;
127
128 virtual void SAL_CALL removeVetoableChangeListener(
129 const OUString& rPropertyName,
130 const css::uno::Reference< css::beans::XVetoableChangeListener>& rListener) override;
131
132 // XCloneable
133 virtual css::uno::Reference<css::util::XCloneable> SAL_CALL createClone() override;
134
135 // XModifyBroadcaster
136 virtual void SAL_CALL addModifyListener(
137 const css::uno::Reference<css::util::XModifyListener>& aListener) override;
138
139 virtual void SAL_CALL removeModifyListener(
140 const css::uno::Reference<css::util::XModifyListener>& aListener) override;
141
142 // XServiceInfo
143 virtual OUString SAL_CALL getImplementationName() override;
144
145 virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override;
146
147 virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
148
149 // Other
150
151 void setRole(css::chart2::data::DataSequenceRole const & aRole)
152 {
153 m_aRole = aRole;
154 }
155
156private:
158 OUString m_aID;
159 std::vector<ValueAndFormat> m_aData;
161 css::chart2::data::DataSequenceRole m_aRole;
162 std::vector<css::uno::Reference<css::util::XModifyListener>> m_aValueListeners;
163};
164
165}
166
167/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Sequence< double > SAL_CALL getNumericalData() override
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
virtual css::uno::Sequence< OUString > SAL_CALL getTextualData() override
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getData() override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
virtual css::uno::Sequence< OUString > SAL_CALL generateLabel(css::chart2::data::LabelOrigin nOrigin) override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &rPropertyName) override
virtual sal_Int32 SAL_CALL getNumberFormatKeyByIndex(sal_Int32 nIndex) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
PivotTableDataSequence & operator=(const PivotTableDataSequence &)=delete
virtual void SAL_CALL setPropertyValue(const OUString &rPropertyName, const css::uno::Any &rValue) override
std::vector< css::uno::Reference< css::util::XModifyListener > > m_aValueListeners
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
virtual void SAL_CALL removeVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &rListener) override
std::vector< ValueAndFormat > m_aData
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
css::chart2::data::DataSequenceRole m_aRole
virtual void SAL_CALL addPropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
void setRole(css::chart2::data::DataSequenceRole const &aRole)
virtual void SAL_CALL addVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &rListener) override
PivotTableDataSequence(const PivotTableDataSequence &)=delete
virtual ~PivotTableDataSequence() override
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
virtual OUString SAL_CALL getSourceRangeRepresentation() override
PivotTableDataSequence(ScDocument *pDocument, OUString sID, std::vector< ValueAndFormat > &&rData)
virtual void SAL_CALL removePropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &rListener) override
CAUTION! The following defines must be in the same namespace as the respective type.
Definition: broadcast.cxx:15
cppu::WeakImplHelper< css::chart2::data::XDataSequence, css::chart2::data::XTextualDataSequence, css::chart2::data::XNumericalDataSequence, css::util::XCloneable, css::util::XModifyBroadcaster, css::beans::XPropertySet, css::lang::XServiceInfo > PivotTableDataSequence_Base
Empty
ValueAndFormat(OUString aString)
ValueAndFormat(double fValue, sal_uInt32 nNumberFormat)
unsigned char sal_Bool