1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_CHART2_SOURCE_INC_INTERNALDATAPROVIDER_HXX
20 #define INCLUDED_CHART2_SOURCE_INC_INTERNALDATAPROVIDER_HXX
22 #include "InternalData.hxx"
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/chart/XDateCategories.hpp>
26 #include <com/sun/star/chart2/XAnyDescriptionAccess.hpp>
27 #include <com/sun/star/chart2/XInternalDataProvider.hpp>
28 #include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
29 #include <com/sun/star/lang/XInitialization.hpp>
30 #include <com/sun/star/util/XCloneable.hpp>
31 #include <cppuhelper/implbase.hxx>
32 #include <cppuhelper/weakref.hxx>
36 namespace com
{ namespace sun
{ namespace star
{ namespace chart2
{ class XChartDocument
; } } } }
44 typedef ::cppu::WeakImplHelper
<
45 css::chart2::XInternalDataProvider
,
46 css::chart2::data::XRangeXMLConversion
,
47 css::chart2::XAnyDescriptionAccess
,
48 css::chart::XDateCategories
,
49 css::util::XCloneable
,
50 css::lang::XInitialization
,
51 css::lang::XServiceInfo
>
52 InternalDataProvider_Base
;
55 /** Data provider that handles data internally. This is used for charts with
58 <p>The format for single ranges is "categories|label n|n" where n is a
59 non-negative number. Meaning return all categories, the label of sequence n,
60 or the data of sequence n.</p>
62 <p>The format for a complete range is "all". (Do we need more than
65 class InternalDataProvider
:
66 public impl::InternalDataProvider_Base
69 explicit InternalDataProvider();
71 // #i120559# allow handing over a default for data orientation
72 // (DataInColumns) that will be used when no data is available
73 explicit InternalDataProvider(
74 const css::uno::Reference
< css::chart2::XChartDocument
> & xChartDoc
,
76 bool bDefaultDataInColumns
);
77 explicit InternalDataProvider( const InternalDataProvider
& rOther
);
78 virtual ~InternalDataProvider() override
;
80 /// declare XServiceInfo methods
81 virtual OUString SAL_CALL
getImplementationName() override
;
82 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
83 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
85 // ____ XInternalDataProvider ____
86 virtual sal_Bool SAL_CALL
hasDataByRangeRepresentation( const OUString
& aRange
) override
;
87 virtual css::uno::Sequence
< css::uno::Any
> SAL_CALL
88 getDataByRangeRepresentation( const OUString
& aRange
) override
;
89 virtual void SAL_CALL
setDataByRangeRepresentation(
90 const OUString
& aRange
,
91 const css::uno::Sequence
< css::uno::Any
>& aNewData
) override
;
92 virtual void SAL_CALL
insertSequence( ::sal_Int32 nAfterIndex
) override
;
93 virtual void SAL_CALL
deleteSequence( ::sal_Int32 nAtIndex
) override
;
94 virtual void SAL_CALL
appendSequence() override
;
95 virtual void SAL_CALL
insertComplexCategoryLevel( ::sal_Int32 nLevel
) override
;
96 virtual void SAL_CALL
deleteComplexCategoryLevel( ::sal_Int32 nLevel
) override
;
97 virtual void SAL_CALL
insertDataPointForAllSequences( ::sal_Int32 nAfterIndex
) override
;
98 virtual void SAL_CALL
deleteDataPointForAllSequences( ::sal_Int32 nAtIndex
) override
;
99 virtual void SAL_CALL
swapDataPointWithNextOneForAllSequences( ::sal_Int32 nAtIndex
) override
;
100 virtual void SAL_CALL
registerDataSequenceForChanges(
101 const css::uno::Reference
< css::chart2::data::XDataSequence
>& xSeq
) override
;
103 // ____ XDataProvider (base of XInternalDataProvider) ____
104 virtual sal_Bool SAL_CALL
createDataSourcePossible(
105 const css::uno::Sequence
< css::beans::PropertyValue
>& aArguments
) override
;
106 virtual css::uno::Reference
< css::chart2::data::XDataSource
> SAL_CALL
createDataSource(
107 const css::uno::Sequence
< css::beans::PropertyValue
>& aArguments
) override
;
108 virtual css::uno::Sequence
< css::beans::PropertyValue
> SAL_CALL
detectArguments(
109 const css::uno::Reference
< css::chart2::data::XDataSource
>& xDataSource
) override
;
110 virtual sal_Bool SAL_CALL
createDataSequenceByRangeRepresentationPossible(
111 const OUString
& aRangeRepresentation
) override
;
112 virtual css::uno::Reference
< css::chart2::data::XDataSequence
> SAL_CALL
createDataSequenceByRangeRepresentation(
113 const OUString
& aRangeRepresentation
) override
;
115 virtual css::uno::Reference
<css::chart2::data::XDataSequence
> SAL_CALL
116 createDataSequenceByValueArray( const OUString
& aRole
, const OUString
& aRangeRepresentation
) override
;
118 virtual css::uno::Reference
< css::sheet::XRangeSelection
> SAL_CALL
getRangeSelection() override
;
120 // ____ XRangeXMLConversion ____
121 virtual OUString SAL_CALL
convertRangeToXML(
122 const OUString
& aRangeRepresentation
) override
;
123 virtual OUString SAL_CALL
convertRangeFromXML(
124 const OUString
& aXMLRange
) override
;
126 // ____ XDateCategories ____
127 virtual css::uno::Sequence
< double > SAL_CALL
getDateCategories() override
;
128 virtual void SAL_CALL
setDateCategories( const css::uno::Sequence
< double >& rDates
) override
;
130 // ____ XAnyDescriptionAccess ____
131 virtual css::uno::Sequence
< css::uno::Sequence
< css::uno::Any
> > SAL_CALL
132 getAnyRowDescriptions() override
;
133 virtual void SAL_CALL
setAnyRowDescriptions(
134 const css::uno::Sequence
< css::uno::Sequence
< css::uno::Any
> >& aRowDescriptions
) override
;
135 virtual css::uno::Sequence
< css::uno::Sequence
< css::uno::Any
> > SAL_CALL
136 getAnyColumnDescriptions() override
;
137 virtual void SAL_CALL
setAnyColumnDescriptions(
138 const css::uno::Sequence
< css::uno::Sequence
< css::uno::Any
> >& aColumnDescriptions
) override
;
140 // ____ XComplexDescriptionAccess (base of XAnyDescriptionAccess) ____
141 virtual css::uno::Sequence
< css::uno::Sequence
< OUString
> > SAL_CALL
142 getComplexRowDescriptions() override
;
143 virtual void SAL_CALL
setComplexRowDescriptions(
144 const css::uno::Sequence
< css::uno::Sequence
< OUString
> >& aRowDescriptions
) override
;
145 virtual css::uno::Sequence
< css::uno::Sequence
< OUString
> > SAL_CALL
146 getComplexColumnDescriptions() override
;
147 virtual void SAL_CALL
setComplexColumnDescriptions(
148 const css::uno::Sequence
< css::uno::Sequence
< OUString
> >& aColumnDescriptions
) override
;
150 // ____ XChartDataArray (base of XComplexDescriptionAccess) ____
151 virtual css::uno::Sequence
< css::uno::Sequence
< double > > SAL_CALL
getData() override
;
152 virtual void SAL_CALL
setData(
153 const css::uno::Sequence
< css::uno::Sequence
< double > >& aData
) override
;
154 virtual css::uno::Sequence
< OUString
> SAL_CALL
getRowDescriptions() override
;
155 virtual void SAL_CALL
setRowDescriptions(
156 const css::uno::Sequence
< OUString
>& aRowDescriptions
) override
;
157 virtual css::uno::Sequence
< OUString
> SAL_CALL
getColumnDescriptions() override
;
158 virtual void SAL_CALL
setColumnDescriptions(
159 const css::uno::Sequence
< OUString
>& aColumnDescriptions
) override
;
161 // ____ XChartData (base of XChartDataArray) ____
162 virtual void SAL_CALL
addChartDataChangeEventListener(
163 const css::uno::Reference
< css::chart::XChartDataChangeEventListener
>& aListener
) override
;
164 virtual void SAL_CALL
removeChartDataChangeEventListener(
165 const css::uno::Reference
< css::chart::XChartDataChangeEventListener
>& aListener
) override
;
166 virtual double SAL_CALL
getNotANumber() override
;
167 virtual sal_Bool SAL_CALL
isNotANumber(
168 double nNumber
) override
;
170 // ____ XCloneable ____
171 virtual css::uno::Reference
< css::util::XCloneable
> SAL_CALL
createClone() override
;
172 // css::lang::XInitialization:
173 virtual void SAL_CALL
initialize(const css::uno::Sequence
< css::uno::Any
> & aArguments
) override
;
176 void addDataSequenceToMap(
177 const OUString
& rRangeRepresentation
,
178 const css::uno::Reference
< css::chart2::data::XDataSequence
> & xSequence
);
180 css::uno::Reference
< css::chart2::data::XDataSequence
>
181 createDataSequenceAndAddToMap( const OUString
& rRangeRepresentation
,
182 const OUString
& rRole
);
183 css::uno::Reference
< css::chart2::data::XDataSequence
>
184 createDataSequenceAndAddToMap( const OUString
& rRangeRepresentation
);
186 css::uno::Reference
<css::chart2::data::XDataSequence
>
187 createDataSequenceFromArray( const OUString
& rArrayStr
, const OUString
& rRole
);
189 void deleteMapReferences( const OUString
& rRangeRepresentation
);
191 void adaptMapReferences(
192 const OUString
& rOldRangeRepresentation
,
193 const OUString
& rNewRangeRepresentation
);
195 void increaseMapReferences( sal_Int32 nBegin
, sal_Int32 nEnd
);
196 void decreaseMapReferences( sal_Int32 nBegin
, sal_Int32 nEnd
);
198 typedef std::multimap
< OUString
,
199 css::uno::WeakReference
< css::chart2::data::XDataSequence
> >
201 typedef std::pair
< tSequenceMap::iterator
, tSequenceMap::iterator
> tSequenceMapRange
;
203 /** cache for all sequences that have been returned.
205 If the range-representation of a sequence changes and it is still
206 referred to by some component (weak reference is valid), the range will
209 tSequenceMap m_aSequenceMap
;
210 InternalData m_aInternalData
;
211 bool m_bDataInColumns
;
216 // INCLUDED_CHART2_SOURCE_INC_INTERNALDATAPROVIDER_HXX
219 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */