1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 #include "oox/drawingml/chart/datasourceconverter.hxx"
25
26 #include <com/sun/star/chart2/XChartDocument.hpp>
27 #include "oox/drawingml/chart/chartconverter.hxx"
28 #include "oox/drawingml/chart/datasourcemodel.hxx"
29
30 namespace oox {
31 namespace drawingml {
32 namespace chart {
33
34 // ============================================================================
35
36 using namespace ::com::sun::star::chart2::data;
37 using namespace ::com::sun::star::uno;
38
39 using ::rtl::OUString;
40
41 // ============================================================================
42
DataSequenceConverter(const ConverterRoot & rParent,DataSequenceModel & rModel)43 DataSequenceConverter::DataSequenceConverter( const ConverterRoot& rParent, DataSequenceModel& rModel ) :
44 ConverterBase< DataSequenceModel >( rParent, rModel )
45 {
46 }
47
~DataSequenceConverter()48 DataSequenceConverter::~DataSequenceConverter()
49 {
50 }
51
createDataSequence(const OUString & rRole)52 Reference< XDataSequence > DataSequenceConverter::createDataSequence( const OUString& rRole )
53 {
54 // create data sequence from data source model (virtual call at chart converter)
55 Reference< XDataSequence > xDataSeq = getChartConverter().createDataSequence( getChartDocument()->getDataProvider(), mrModel );
56
57 // set sequence role
58 PropertySet aSeqProp( xDataSeq );
59 aSeqProp.setProperty( PROP_Role, rRole );
60
61 return xDataSeq;
62 }
63
64 // ============================================================================
65
DataSourceConverter(const ConverterRoot & rParent,DataSourceModel & rModel)66 DataSourceConverter::DataSourceConverter( const ConverterRoot& rParent, DataSourceModel& rModel ) :
67 ConverterBase< DataSourceModel >( rParent, rModel )
68 {
69 }
70
~DataSourceConverter()71 DataSourceConverter::~DataSourceConverter()
72 {
73 }
74
createDataSequence(const OUString & rRole)75 Reference< XDataSequence > DataSourceConverter::createDataSequence( const OUString& rRole )
76 {
77 Reference< XDataSequence > xDataSeq;
78 if( mrModel.mxDataSeq.is() )
79 {
80 DataSequenceConverter aDataSeqConv( *this, *mrModel.mxDataSeq );
81 xDataSeq = aDataSeqConv.createDataSequence( rRole );
82 }
83 return xDataSeq;
84 }
85
86 // ============================================================================
87
88 } // namespace chart
89 } // namespace drawingml
90 } // namespace oox
91