LibreOffice Module chart2 (master) 1
InternalDataProvider.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 * 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#pragma once
20
21#include "InternalData.hxx"
22
23#include <com/sun/star/lang/XServiceInfo.hpp>
24#include <com/sun/star/chart/XDateCategories.hpp>
25#include <com/sun/star/chart2/XAnyDescriptionAccess.hpp>
26#include <com/sun/star/chart2/XInternalDataProvider.hpp>
27#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
28#include <com/sun/star/lang/XInitialization.hpp>
29#include <com/sun/star/util/XCloneable.hpp>
32#include <rtl/ref.hxx>
33
34#include <map>
35
36namespace com::sun::star::chart2 { class XChartDocument; }
37
38namespace chart
39{
40class ChartModel;
41class UncachedDataSequence;
42
43namespace impl
44{
45
46typedef ::cppu::WeakImplHelper<
47 css::chart2::XInternalDataProvider,
48 css::chart2::data::XRangeXMLConversion,
49 css::chart2::XAnyDescriptionAccess,
50 css::chart::XDateCategories,
51 css::util::XCloneable,
52 css::lang::XInitialization,
53 css::lang::XServiceInfo >
55}
56
69{
70public:
71 explicit InternalDataProvider();
72
73 // #i120559# allow handing over a default for data orientation
74 // (DataInColumns) that will be used when no data is available
77 bool bConnectToModel,
78 bool bDefaultDataInColumns );
79 explicit InternalDataProvider( const InternalDataProvider & rOther );
80 virtual ~InternalDataProvider() override;
81
83 virtual OUString SAL_CALL getImplementationName() override;
84 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
85 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
86
87 // ____ XInternalDataProvider ____
88 virtual sal_Bool SAL_CALL hasDataByRangeRepresentation( const OUString& aRange ) override;
89 virtual css::uno::Sequence< css::uno::Any > SAL_CALL
90 getDataByRangeRepresentation( const OUString& aRange ) override;
91 virtual void SAL_CALL setDataByRangeRepresentation(
92 const OUString& aRange,
93 const css::uno::Sequence< css::uno::Any >& aNewData ) override;
94 virtual void SAL_CALL insertSequence( ::sal_Int32 nAfterIndex ) override;
95 virtual void SAL_CALL deleteSequence( ::sal_Int32 nAtIndex ) override;
96 virtual void SAL_CALL appendSequence() override;
97 virtual void SAL_CALL insertComplexCategoryLevel( ::sal_Int32 nLevel ) override;
98 virtual void SAL_CALL deleteComplexCategoryLevel( ::sal_Int32 nLevel ) override;
99 virtual void SAL_CALL insertDataPointForAllSequences( ::sal_Int32 nAfterIndex ) override;
100 virtual void SAL_CALL deleteDataPointForAllSequences( ::sal_Int32 nAtIndex ) override;
101 virtual void SAL_CALL swapDataPointWithNextOneForAllSequences( ::sal_Int32 nAtIndex ) override;
102 virtual void SAL_CALL registerDataSequenceForChanges(
103 const css::uno::Reference< css::chart2::data::XDataSequence >& xSeq ) override;
104
105 // ____ XDataProvider (base of XInternalDataProvider) ____
106 virtual sal_Bool SAL_CALL createDataSourcePossible(
107 const css::uno::Sequence< css::beans::PropertyValue >& aArguments ) override;
108 virtual css::uno::Reference< css::chart2::data::XDataSource > SAL_CALL createDataSource(
109 const css::uno::Sequence< css::beans::PropertyValue >& aArguments ) override;
110 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL detectArguments(
111 const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource ) override;
113 const OUString& aRangeRepresentation ) override;
114 virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentation(
115 const OUString& aRangeRepresentation ) override;
116
117 virtual css::uno::Reference<css::chart2::data::XDataSequence> SAL_CALL
118 createDataSequenceByValueArray( const OUString& aRole, const OUString& aRangeRepresentation,
119 const OUString& aRoleQualifier ) override;
120
121 virtual css::uno::Reference< css::sheet::XRangeSelection > SAL_CALL getRangeSelection() override;
122
123 // ____ XRangeXMLConversion ____
124 virtual OUString SAL_CALL convertRangeToXML(
125 const OUString& aRangeRepresentation ) override;
126 virtual OUString SAL_CALL convertRangeFromXML(
127 const OUString& aXMLRange ) override;
128
129 // ____ XDateCategories ____
130 virtual css::uno::Sequence< double > SAL_CALL getDateCategories() override;
131 virtual void SAL_CALL setDateCategories( const css::uno::Sequence< double >& rDates ) override;
132
133 // ____ XAnyDescriptionAccess ____
134 virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL
135 getAnyRowDescriptions() override;
136 virtual void SAL_CALL setAnyRowDescriptions(
137 const css::uno::Sequence< css::uno::Sequence< css::uno::Any > >& aRowDescriptions ) override;
138 virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL
139 getAnyColumnDescriptions() override;
140 virtual void SAL_CALL setAnyColumnDescriptions(
141 const css::uno::Sequence< css::uno::Sequence< css::uno::Any > >& aColumnDescriptions ) override;
142
143 // ____ XComplexDescriptionAccess (base of XAnyDescriptionAccess) ____
144 virtual css::uno::Sequence< css::uno::Sequence< OUString > > SAL_CALL
145 getComplexRowDescriptions() override;
146 virtual void SAL_CALL setComplexRowDescriptions(
147 const css::uno::Sequence< css::uno::Sequence< OUString > >& aRowDescriptions ) override;
148 virtual css::uno::Sequence< css::uno::Sequence< OUString > > SAL_CALL
150 virtual void SAL_CALL setComplexColumnDescriptions(
151 const css::uno::Sequence< css::uno::Sequence< OUString > >& aColumnDescriptions ) override;
152
153 // ____ XChartDataArray (base of XComplexDescriptionAccess) ____
154 virtual css::uno::Sequence< css::uno::Sequence< double > > SAL_CALL getData() override;
155 virtual void SAL_CALL setData(
156 const css::uno::Sequence< css::uno::Sequence< double > >& aData ) override;
157 virtual css::uno::Sequence< OUString > SAL_CALL getRowDescriptions() override;
158 virtual void SAL_CALL setRowDescriptions(
159 const css::uno::Sequence< OUString >& aRowDescriptions ) override;
160 virtual css::uno::Sequence< OUString > SAL_CALL getColumnDescriptions() override;
161 virtual void SAL_CALL setColumnDescriptions(
162 const css::uno::Sequence< OUString >& aColumnDescriptions ) override;
163
164 // ____ XChartData (base of XChartDataArray) ____
165 virtual void SAL_CALL addChartDataChangeEventListener(
166 const css::uno::Reference< css::chart::XChartDataChangeEventListener >& aListener ) override;
167 virtual void SAL_CALL removeChartDataChangeEventListener(
168 const css::uno::Reference< css::chart::XChartDataChangeEventListener >& aListener ) override;
169 virtual double SAL_CALL getNotANumber() override;
170 virtual sal_Bool SAL_CALL isNotANumber(
171 double nNumber ) override;
172
173 // ____ XCloneable ____
174 virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override;
175 // css::lang::XInitialization:
176 virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > & aArguments) override;
177
178private:
180 const OUString & rRangeRepresentation,
181 const css::uno::Reference< css::chart2::data::XDataSequence > & xSequence );
182
183 css::uno::Reference< css::chart2::data::XDataSequence >
184 createDataSequenceAndAddToMap( const OUString & rRangeRepresentation,
185 const OUString & rRole );
187 createDataSequenceAndAddToMap( const OUString & rRangeRepresentation );
188
190 createDataSequenceFromArray( const OUString& rArrayStr, std::u16string_view rRole,
191 std::u16string_view rRoleQualifier);
192
193 void deleteMapReferences( const OUString & rRangeRepresentation );
194
196 const OUString & rOldRangeRepresentation,
197 const OUString & rNewRangeRepresentation );
198
199 void increaseMapReferences( sal_Int32 nBegin, sal_Int32 nEnd );
200 void decreaseMapReferences( sal_Int32 nBegin, sal_Int32 nEnd );
201
202 typedef std::multimap< OUString,
203 css::uno::WeakReference< css::chart2::data::XDataSequence > >
205 typedef std::pair< tSequenceMap::iterator, tSequenceMap::iterator > tSequenceMapRange;
206
216};
217
218} // namespace chart
219
220/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Data provider that handles data internally.
std::multimap< OUString, css::uno::WeakReference< css::chart2::data::XDataSequence > > tSequenceMap
virtual void SAL_CALL appendSequence() override
virtual void SAL_CALL setDateCategories(const css::uno::Sequence< double > &rDates) override
virtual void SAL_CALL setAnyRowDescriptions(const css::uno::Sequence< css::uno::Sequence< css::uno::Any > > &aRowDescriptions) override
void increaseMapReferences(sal_Int32 nBegin, sal_Int32 nEnd)
virtual OUString SAL_CALL convertRangeFromXML(const OUString &aXMLRange) override
virtual void SAL_CALL removeChartDataChangeEventListener(const css::uno::Reference< css::chart::XChartDataChangeEventListener > &aListener) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Sequence< css::uno::Sequence< OUString > > SAL_CALL getComplexRowDescriptions() override
virtual void SAL_CALL swapDataPointWithNextOneForAllSequences(::sal_Int32 nAtIndex) override
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getAnyColumnDescriptions() override
virtual void SAL_CALL setComplexColumnDescriptions(const css::uno::Sequence< css::uno::Sequence< OUString > > &aColumnDescriptions) override
void adaptMapReferences(const OUString &rOldRangeRepresentation, const OUString &rNewRangeRepresentation)
virtual void SAL_CALL setColumnDescriptions(const css::uno::Sequence< OUString > &aColumnDescriptions) override
virtual ~InternalDataProvider() override
virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL createDataSequenceByValueArray(const OUString &aRole, const OUString &aRangeRepresentation, const OUString &aRoleQualifier) override
virtual void SAL_CALL setDataByRangeRepresentation(const OUString &aRange, const css::uno::Sequence< css::uno::Any > &aNewData) override
virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getAnyRowDescriptions() override
virtual OUString SAL_CALL getImplementationName() override
declare XServiceInfo methods
InternalDataProvider(const rtl::Reference< ::chart::ChartModel > &xChartDoc, bool bConnectToModel, bool bDefaultDataInColumns)
virtual sal_Bool SAL_CALL createDataSourcePossible(const css::uno::Sequence< css::beans::PropertyValue > &aArguments) override
virtual sal_Bool SAL_CALL createDataSequenceByRangeRepresentationPossible(const OUString &aRangeRepresentation) override
virtual OUString SAL_CALL convertRangeToXML(const OUString &aRangeRepresentation) override
void addDataSequenceToMap(const OUString &rRangeRepresentation, const css::uno::Reference< css::chart2::data::XDataSequence > &xSequence)
virtual void SAL_CALL addChartDataChangeEventListener(const css::uno::Reference< css::chart::XChartDataChangeEventListener > &aListener) override
virtual void SAL_CALL insertDataPointForAllSequences(::sal_Int32 nAfterIndex) override
virtual void SAL_CALL setData(const css::uno::Sequence< css::uno::Sequence< double > > &aData) override
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL detectArguments(const css::uno::Reference< css::chart2::data::XDataSource > &xDataSource) override
virtual css::uno::Reference< css::chart2::data::XDataSource > SAL_CALL createDataSource(const css::uno::Sequence< css::beans::PropertyValue > &aArguments) override
virtual css::uno::Reference< css::sheet::XRangeSelection > SAL_CALL getRangeSelection() override
std::pair< tSequenceMap::iterator, tSequenceMap::iterator > tSequenceMapRange
void decreaseMapReferences(sal_Int32 nBegin, sal_Int32 nEnd)
virtual css::uno::Sequence< double > SAL_CALL getDateCategories() override
virtual sal_Bool SAL_CALL isNotANumber(double nNumber) override
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
virtual css::uno::Sequence< OUString > SAL_CALL getRowDescriptions() override
virtual css::uno::Sequence< css::uno::Sequence< double > > SAL_CALL getData() override
virtual double SAL_CALL getNotANumber() override
void deleteMapReferences(const OUString &rRangeRepresentation)
tSequenceMap m_aSequenceMap
cache for all sequences that have been returned.
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getDataByRangeRepresentation(const OUString &aRange) override
virtual void SAL_CALL deleteDataPointForAllSequences(::sal_Int32 nAtIndex) override
css::uno::Reference< css::chart2::data::XDataSequence > createDataSequenceAndAddToMap(const OUString &rRangeRepresentation, const OUString &rRole)
virtual void SAL_CALL deleteSequence(::sal_Int32 nAtIndex) override
virtual void SAL_CALL registerDataSequenceForChanges(const css::uno::Reference< css::chart2::data::XDataSequence > &xSeq) override
virtual void SAL_CALL setRowDescriptions(const css::uno::Sequence< OUString > &aRowDescriptions) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Sequence< css::uno::Sequence< OUString > > SAL_CALL getComplexColumnDescriptions() override
virtual void SAL_CALL deleteComplexCategoryLevel(::sal_Int32 nLevel) override
virtual sal_Bool SAL_CALL hasDataByRangeRepresentation(const OUString &aRange) override
virtual void SAL_CALL setComplexRowDescriptions(const css::uno::Sequence< css::uno::Sequence< OUString > > &aRowDescriptions) override
virtual void SAL_CALL insertComplexCategoryLevel(::sal_Int32 nLevel) override
virtual void SAL_CALL setAnyColumnDescriptions(const css::uno::Sequence< css::uno::Sequence< css::uno::Any > > &aColumnDescriptions) override
rtl::Reference< UncachedDataSequence > createDataSequenceFromArray(const OUString &rArrayStr, std::u16string_view rRole, std::u16string_view rRoleQualifier)
virtual css::uno::Sequence< OUString > SAL_CALL getColumnDescriptions() override
virtual void SAL_CALL insertSequence(::sal_Int32 nAfterIndex) override
virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentation(const OUString &aRangeRepresentation) override
::cppu::WeakImplHelper< css::chart2::XInternalDataProvider, css::chart2::data::XRangeXMLConversion, css::chart2::XAnyDescriptionAccess, css::chart::XDateCategories, css::util::XCloneable, css::lang::XInitialization, css::lang::XServiceInfo > InternalDataProvider_Base
unsigned char sal_Bool