1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #include "oox/drawingml/chart/datasourceconverter.hxx"
29 
30 #include <com/sun/star/chart2/XChartDocument.hpp>
31 #include "oox/drawingml/chart/chartconverter.hxx"
32 #include "oox/drawingml/chart/datasourcemodel.hxx"
33 
34 namespace oox {
35 namespace drawingml {
36 namespace chart {
37 
38 // ============================================================================
39 
40 using namespace ::com::sun::star::chart2::data;
41 using namespace ::com::sun::star::uno;
42 
43 using ::rtl::OUString;
44 
45 // ============================================================================
46 
47 DataSequenceConverter::DataSequenceConverter( const ConverterRoot& rParent, DataSequenceModel& rModel ) :
48     ConverterBase< DataSequenceModel >( rParent, rModel )
49 {
50 }
51 
52 DataSequenceConverter::~DataSequenceConverter()
53 {
54 }
55 
56 Reference< XDataSequence > DataSequenceConverter::createDataSequence( const OUString& rRole )
57 {
58     // create data sequence from data source model (virtual call at chart converter)
59     Reference< XDataSequence > xDataSeq = getChartConverter().createDataSequence( getChartDocument()->getDataProvider(), mrModel );
60 
61     // set sequence role
62     PropertySet aSeqProp( xDataSeq );
63     aSeqProp.setProperty( PROP_Role, rRole );
64 
65     return xDataSeq;
66 }
67 
68 // ============================================================================
69 
70 DataSourceConverter::DataSourceConverter( const ConverterRoot& rParent, DataSourceModel& rModel ) :
71     ConverterBase< DataSourceModel >( rParent, rModel )
72 {
73 }
74 
75 DataSourceConverter::~DataSourceConverter()
76 {
77 }
78 
79 Reference< XDataSequence > DataSourceConverter::createDataSequence( const OUString& rRole )
80 {
81     Reference< XDataSequence > xDataSeq;
82     if( mrModel.mxDataSeq.is() )
83     {
84         DataSequenceConverter aDataSeqConv( *this, *mrModel.mxDataSeq );
85         xDataSeq = aDataSeqConv.createDataSequence( rRole );
86     }
87     return xDataSeq;
88 }
89 
90 // ============================================================================
91 
92 } // namespace chart
93 } // namespace drawingml
94 } // namespace oox
95