LibreOffice Module sc (master) 1
PivotTableDataProvider.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/XDataProvider.hpp>
13#include <com/sun/star/chart2/data/XPivotTableDataProvider.hpp>
14#include <com/sun/star/chart2/data/PivotTableFieldEntry.hpp>
15#include <com/sun/star/lang/XServiceInfo.hpp>
16#include <com/sun/star/beans/XPropertySet.hpp>
17#include <com/sun/star/util/XModifyBroadcaster.hpp>
18
19#include <svl/lstner.hxx>
21#include <rtl/ustring.hxx>
22#include <svl/itemprop.hxx>
23
24#include <vector>
25#include <unordered_map>
26
27namespace com::sun::star::chart2::data { class XDataSequence; }
28namespace com::sun::star::chart2::data { class XDataSource; }
29namespace com::sun::star::chart2::data { class XLabeledDataSequence; }
30namespace com::sun::star::uno { class XComponentContext; }
31
32class ScDocument;
33
34namespace sc
35{
36
37struct ValueAndFormat;
38
39typedef cppu::WeakImplHelper<css::chart2::data::XDataProvider,
40 css::chart2::data::XPivotTableDataProvider,
41 css::beans::XPropertySet,
42 css::lang::XServiceInfo,
43 css::util::XModifyBroadcaster>
45
47{
48public:
49
50 explicit PivotTableDataProvider(ScDocument& rDoc);
51 virtual ~PivotTableDataProvider() override;
52 virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
53
54 // XDataProvider
55 virtual sal_Bool SAL_CALL
56 createDataSourcePossible(const css::uno::Sequence<css::beans::PropertyValue>& aArguments) override;
57
58 virtual css::uno::Reference<css::chart2::data::XDataSource> SAL_CALL
59 createDataSource(const css::uno::Sequence<css::beans::PropertyValue>& aArguments) override;
60
61 virtual css::uno::Sequence<css::beans::PropertyValue> SAL_CALL
62 detectArguments(const css::uno::Reference<css::chart2::data::XDataSource>& xDataSource) override;
63
64 virtual sal_Bool SAL_CALL
65 createDataSequenceByRangeRepresentationPossible(const OUString& aRangeRepresentation) override;
66
67 virtual css::uno::Reference<css::chart2::data::XDataSequence> SAL_CALL
68 createDataSequenceByRangeRepresentation(const OUString& aRangeRepresentation) override;
69
70 virtual css::uno::Reference<css::chart2::data::XDataSequence> SAL_CALL
71 createDataSequenceByValueArray(const OUString& aRole, const OUString& aRangeRepresentation,
72 const OUString& aRoleQualifier) override;
73
74 virtual css::uno::Reference<css::sheet::XRangeSelection> SAL_CALL getRangeSelection() override;
75
76 // XPivotTableDataProvider
77 virtual css::uno::Sequence<css::chart2::data::PivotTableFieldEntry> SAL_CALL
78 getColumnFields() override;
79 virtual css::uno::Sequence<css::chart2::data::PivotTableFieldEntry> SAL_CALL
80 getRowFields() override;
81 virtual css::uno::Sequence<css::chart2::data::PivotTableFieldEntry> SAL_CALL
82 getPageFields() override;
83 virtual css::uno::Sequence<css::chart2::data::PivotTableFieldEntry> SAL_CALL
84 getDataFields() override;
85
86 virtual OUString SAL_CALL getPivotTableName() override;
87
88 virtual void SAL_CALL setPivotTableName(const OUString& sPivotTableName) override;
89
90 virtual sal_Bool SAL_CALL hasPivotTable() override;
91
92 virtual css::uno::Reference<css::chart2::data::XDataSequence> SAL_CALL
93 createDataSequenceOfValuesByIndex(sal_Int32 nIndex) override;
94 virtual css::uno::Reference<css::chart2::data::XDataSequence> SAL_CALL
95 createDataSequenceOfLabelsByIndex(sal_Int32 nIndex) override;
96 virtual css::uno::Reference<css::chart2::data::XDataSequence> SAL_CALL
98
99 virtual OUString SAL_CALL getFieldOutputDescription(sal_Int32 nPageFieldIndex) override;
100
101 // XPropertySet
102 virtual css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
103
104 virtual void SAL_CALL
105 setPropertyValue(const OUString& rPropertyName, const css::uno::Any& rValue) override;
106
107 virtual css::uno::Any SAL_CALL
108 getPropertyValue(const OUString& rPropertyName) override;
109
110 virtual void SAL_CALL addPropertyChangeListener(
111 const OUString& rPropertyName,
112 const css::uno::Reference<css::beans::XPropertyChangeListener>& xListener) override;
113
114 virtual void SAL_CALL removePropertyChangeListener(
115 const OUString& rPropertyName,
116 const css::uno::Reference<css::beans::XPropertyChangeListener>& rListener) override;
117
118 virtual void SAL_CALL addVetoableChangeListener(
119 const OUString& rPropertyName,
120 const css::uno::Reference<css::beans::XVetoableChangeListener>& rListener) override;
121
122 virtual void SAL_CALL removeVetoableChangeListener(
123 const OUString& rPropertyName,
124 const css::uno::Reference<css::beans::XVetoableChangeListener>& rListener) override;
125
126 // XModifyBroadcaster
127 virtual void SAL_CALL
128 addModifyListener(const css::uno::Reference<css::util::XModifyListener>& aListener) override;
129
130 virtual void SAL_CALL
131 removeModifyListener(const css::uno::Reference<css::util::XModifyListener>& aListener) override;
132
133 // XServiceInfo
134 virtual OUString SAL_CALL getImplementationName() override;
135
136 virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override;
137
138 virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
139
140private:
141
142 css::uno::Reference<css::chart2::data::XDataSource>
144
145 css::uno::Reference<css::chart2::data::XDataSource>
146 createCategoriesDataSource(bool bOrientationIsColumn);
147
148 css::uno::Reference<css::chart2::data::XLabeledDataSequence> newLabeledDataSequence();
149
150 css::uno::Reference<css::chart2::data::XDataSequence> assignLabelsToDataSequence(size_t nIndex);
151
152 css::uno::Reference<css::chart2::data::XDataSequence> assignValuesToDataSequence(size_t nIndex);
153
154 css::uno::Reference<css::chart2::data::XDataSequence> assignFirstCategoriesToDataSequence();
155
157
162
163 std::vector<std::vector<ValueAndFormat>> m_aCategoriesColumnOrientation;
164 std::vector<std::vector<ValueAndFormat>> m_aCategoriesRowOrientation;
165 std::vector<std::vector<ValueAndFormat>> m_aLabels;
166 std::vector<std::vector<ValueAndFormat>> m_aDataRowVector;
167
168 std::vector<css::chart2::data::PivotTableFieldEntry> m_aColumnFields;
169 std::vector<css::chart2::data::PivotTableFieldEntry> m_aRowFields;
170 std::vector<css::chart2::data::PivotTableFieldEntry> m_aPageFields;
171 std::vector<css::chart2::data::PivotTableFieldEntry> m_aDataFields;
172
173 std::unordered_map<sal_Int32, OUString> m_aFieldOutputDescriptionMap;
174
176
177 css::uno::Reference<css::uno::XComponentContext> m_xContext;
178
179 std::vector<css::uno::Reference<css::util::XModifyListener>> m_aValueListeners;
180};
181
182}
183
184/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
virtual css::uno::Reference< css::sheet::XRangeSelection > SAL_CALL getRangeSelection() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL removePropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &rListener) override
css::uno::Reference< css::chart2::data::XDataSequence > assignValuesToDataSequence(size_t nIndex)
virtual css::uno::Sequence< css::chart2::data::PivotTableFieldEntry > SAL_CALL getRowFields() override
virtual sal_Bool SAL_CALL hasPivotTable() override
css::uno::Reference< css::chart2::data::XLabeledDataSequence > newLabeledDataSequence()
virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL createDataSequenceOfCategories() override
virtual css::uno::Sequence< css::chart2::data::PivotTableFieldEntry > SAL_CALL getDataFields() override
std::vector< css::chart2::data::PivotTableFieldEntry > m_aDataFields
std::unordered_map< sal_Int32, OUString > m_aFieldOutputDescriptionMap
virtual void SAL_CALL setPivotTableName(const OUString &sPivotTableName) override
virtual css::uno::Reference< css::chart2::data::XDataSource > SAL_CALL createDataSource(const css::uno::Sequence< css::beans::PropertyValue > &aArguments) override
virtual void SAL_CALL addPropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual void SAL_CALL setPropertyValue(const OUString &rPropertyName, const css::uno::Any &rValue) override
virtual sal_Bool SAL_CALL createDataSequenceByRangeRepresentationPossible(const OUString &aRangeRepresentation) override
virtual void SAL_CALL removeVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &rListener) override
virtual OUString SAL_CALL getFieldOutputDescription(sal_Int32 nPageFieldIndex) override
std::vector< std::vector< ValueAndFormat > > m_aDataRowVector
virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL createDataSequenceOfValuesByIndex(sal_Int32 nIndex) override
std::vector< std::vector< ValueAndFormat > > m_aLabels
virtual sal_Bool SAL_CALL createDataSourcePossible(const css::uno::Sequence< css::beans::PropertyValue > &aArguments) override
virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL createDataSequenceOfLabelsByIndex(sal_Int32 nIndex) override
std::vector< css::chart2::data::PivotTableFieldEntry > m_aColumnFields
virtual ~PivotTableDataProvider() override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentation(const OUString &aRangeRepresentation) override
css::uno::Reference< css::chart2::data::XDataSource > createValuesDataSource()
virtual css::uno::Sequence< css::chart2::data::PivotTableFieldEntry > SAL_CALL getColumnFields() override
virtual OUString SAL_CALL getImplementationName() override
css::uno::Reference< css::chart2::data::XDataSequence > assignLabelsToDataSequence(size_t nIndex)
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
std::vector< css::chart2::data::PivotTableFieldEntry > m_aRowFields
virtual void SAL_CALL addVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &rListener) override
std::vector< css::uno::Reference< css::util::XModifyListener > > m_aValueListeners
std::vector< std::vector< ValueAndFormat > > m_aCategoriesRowOrientation
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &rPropertyName) override
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
virtual css::uno::Sequence< css::chart2::data::PivotTableFieldEntry > SAL_CALL getPageFields() override
std::vector< std::vector< ValueAndFormat > > m_aCategoriesColumnOrientation
virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
css::uno::Reference< css::chart2::data::XDataSource > createCategoriesDataSource(bool bOrientationIsColumn)
virtual OUString SAL_CALL getPivotTableName() override
css::uno::Reference< css::chart2::data::XDataSequence > assignFirstCategoriesToDataSequence()
std::vector< css::chart2::data::PivotTableFieldEntry > m_aPageFields
virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL createDataSequenceByValueArray(const OUString &aRole, const OUString &aRangeRepresentation, const OUString &aRoleQualifier) override
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL detectArguments(const css::uno::Reference< css::chart2::data::XDataSource > &xDataSource) override
Sequence< PropertyValue > aArguments
sal_Int32 nIndex
CAUTION! The following defines must be in the same namespace as the respective type.
Definition: broadcast.cxx:15
cppu::WeakImplHelper< css::chart2::data::XDataProvider, css::chart2::data::XPivotTableDataProvider, css::beans::XPropertySet, css::lang::XServiceInfo, css::util::XModifyBroadcaster > PivotTableDataProvider_Base
unsigned char sal_Bool