1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#pragma once
#include "InternalData.hxx"
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/chart/XDateCategories.hpp>
#include <com/sun/star/chart2/XAnyDescriptionAccess.hpp>
#include <com/sun/star/chart2/XInternalDataProvider.hpp>
#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/util/XCloneable.hpp>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/weakref.hxx>
#include <rtl/ref.hxx>
#include <map>
namespace com::sun::star::chart2 { class XChartDocument; }
namespace chart
{
class ChartModel;
class UncachedDataSequence;
namespace impl
{
typedef ::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;
}
/** Data provider that handles data internally. This is used for charts with
their own data.
<p>The format for single ranges is "categories|label n|n" where n is a
non-negative number. Meaning return all categories, the label of sequence n,
or the data of sequence n.</p>
<p>The format for a complete range is "all". (Do we need more than
that?)</p>
*/
class InternalDataProvider final :
public impl::InternalDataProvider_Base
{
public:
explicit InternalDataProvider();
// #i120559# allow handing over a default for data orientation
// (DataInColumns) that will be used when no data is available
explicit InternalDataProvider(
const rtl::Reference< ::chart::ChartModel > & xChartDoc,
bool bConnectToModel,
bool bDefaultDataInColumns );
explicit InternalDataProvider( const InternalDataProvider & rOther );
virtual ~InternalDataProvider() override;
/// declare XServiceInfo methods
virtual OUString SAL_CALL getImplementationName() override;
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
// ____ XInternalDataProvider ____
virtual sal_Bool SAL_CALL hasDataByRangeRepresentation( const OUString& aRange ) override;
virtual css::uno::Sequence< css::uno::Any > SAL_CALL
getDataByRangeRepresentation( const OUString& aRange ) override;
virtual void SAL_CALL setDataByRangeRepresentation(
const OUString& aRange,
const css::uno::Sequence< css::uno::Any >& aNewData ) override;
virtual void SAL_CALL insertSequence( ::sal_Int32 nAfterIndex ) override;
virtual void SAL_CALL deleteSequence( ::sal_Int32 nAtIndex ) override;
virtual void SAL_CALL appendSequence() override;
virtual void SAL_CALL insertComplexCategoryLevel( ::sal_Int32 nLevel ) override;
virtual void SAL_CALL deleteComplexCategoryLevel( ::sal_Int32 nLevel ) override;
virtual void SAL_CALL insertDataPointForAllSequences( ::sal_Int32 nAfterIndex ) override;
virtual void SAL_CALL deleteDataPointForAllSequences( ::sal_Int32 nAtIndex ) override;
virtual void SAL_CALL swapDataPointWithNextOneForAllSequences( ::sal_Int32 nAtIndex ) override;
virtual void SAL_CALL registerDataSequenceForChanges(
const css::uno::Reference< css::chart2::data::XDataSequence >& xSeq ) override;
// ____ XDataProvider (base of XInternalDataProvider) ____
virtual sal_Bool SAL_CALL createDataSourcePossible(
const css::uno::Sequence< css::beans::PropertyValue >& aArguments ) override;
virtual css::uno::Reference< css::chart2::data::XDataSource > SAL_CALL createDataSource(
const css::uno::Sequence< css::beans::PropertyValue >& aArguments ) override;
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL detectArguments(
const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource ) override;
virtual sal_Bool SAL_CALL createDataSequenceByRangeRepresentationPossible(
const OUString& aRangeRepresentation ) override;
virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentation(
const OUString& aRangeRepresentation ) override;
virtual css::uno::Reference<css::chart2::data::XDataSequence> SAL_CALL
createDataSequenceByValueArray( const OUString& aRole, const OUString& aRangeRepresentation,
const OUString& aRoleQualifier ) override;
virtual css::uno::Reference< css::sheet::XRangeSelection > SAL_CALL getRangeSelection() override;
// ____ XRangeXMLConversion ____
virtual OUString SAL_CALL convertRangeToXML(
const OUString& aRangeRepresentation ) override;
virtual OUString SAL_CALL convertRangeFromXML(
const OUString& aXMLRange ) override;
// ____ XDateCategories ____
virtual css::uno::Sequence< double > SAL_CALL getDateCategories() override;
virtual void SAL_CALL setDateCategories( const css::uno::Sequence< double >& rDates ) override;
// ____ XAnyDescriptionAccess ____
virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL
getAnyRowDescriptions() override;
virtual void SAL_CALL setAnyRowDescriptions(
const css::uno::Sequence< css::uno::Sequence< css::uno::Any > >& aRowDescriptions ) override;
virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL
getAnyColumnDescriptions() override;
virtual void SAL_CALL setAnyColumnDescriptions(
const css::uno::Sequence< css::uno::Sequence< css::uno::Any > >& aColumnDescriptions ) override;
// ____ XComplexDescriptionAccess (base of XAnyDescriptionAccess) ____
virtual css::uno::Sequence< css::uno::Sequence< OUString > > SAL_CALL
getComplexRowDescriptions() override;
virtual void SAL_CALL setComplexRowDescriptions(
const css::uno::Sequence< css::uno::Sequence< OUString > >& aRowDescriptions ) override;
virtual css::uno::Sequence< css::uno::Sequence< OUString > > SAL_CALL
getComplexColumnDescriptions() override;
virtual void SAL_CALL setComplexColumnDescriptions(
const css::uno::Sequence< css::uno::Sequence< OUString > >& aColumnDescriptions ) override;
// ____ XChartDataArray (base of XComplexDescriptionAccess) ____
virtual css::uno::Sequence< css::uno::Sequence< double > > SAL_CALL getData() override;
virtual void SAL_CALL setData(
const css::uno::Sequence< css::uno::Sequence< double > >& aData ) override;
virtual css::uno::Sequence< OUString > SAL_CALL getRowDescriptions() override;
virtual void SAL_CALL setRowDescriptions(
const css::uno::Sequence< OUString >& aRowDescriptions ) override;
virtual css::uno::Sequence< OUString > SAL_CALL getColumnDescriptions() override;
virtual void SAL_CALL setColumnDescriptions(
const css::uno::Sequence< OUString >& aColumnDescriptions ) override;
// ____ XChartData (base of XChartDataArray) ____
virtual void SAL_CALL addChartDataChangeEventListener(
const css::uno::Reference< css::chart::XChartDataChangeEventListener >& aListener ) override;
virtual void SAL_CALL removeChartDataChangeEventListener(
const css::uno::Reference< css::chart::XChartDataChangeEventListener >& aListener ) override;
virtual double SAL_CALL getNotANumber() override;
virtual sal_Bool SAL_CALL isNotANumber(
double nNumber ) override;
// ____ XCloneable ____
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override;
// css::lang::XInitialization:
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > & aArguments) override;
private:
void addDataSequenceToMap(
const OUString & rRangeRepresentation,
const css::uno::Reference< css::chart2::data::XDataSequence > & xSequence );
css::uno::Reference< css::chart2::data::XDataSequence >
createDataSequenceAndAddToMap( const OUString & rRangeRepresentation,
const OUString & rRole );
rtl::Reference< UncachedDataSequence >
createDataSequenceAndAddToMap( const OUString & rRangeRepresentation );
rtl::Reference<UncachedDataSequence>
createDataSequenceFromArray( const OUString& rArrayStr, std::u16string_view rRole,
std::u16string_view rRoleQualifier);
void deleteMapReferences( const OUString & rRangeRepresentation );
void adaptMapReferences(
const OUString & rOldRangeRepresentation,
const OUString & rNewRangeRepresentation );
void increaseMapReferences( sal_Int32 nBegin, sal_Int32 nEnd );
void decreaseMapReferences( sal_Int32 nBegin, sal_Int32 nEnd );
typedef std::multimap< OUString,
css::uno::WeakReference< css::chart2::data::XDataSequence > >
tSequenceMap;
typedef std::pair< tSequenceMap::iterator, tSequenceMap::iterator > tSequenceMapRange;
/** cache for all sequences that have been returned.
If the range-representation of a sequence changes and it is still
referred to by some component (weak reference is valid), the range will
be adapted.
*/
tSequenceMap m_aSequenceMap;
InternalData m_aInternalData;
bool m_bDataInColumns;
};
} // namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|