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 #ifndef OOX_DRAWINGML_CHART_CHARTCONVERTER_HXX
25 #define OOX_DRAWINGML_CHART_CHARTCONVERTER_HXX
26 
27 #include <com/sun/star/uno/Reference.hxx>
28 #include <oox/dllapi.h>
29 
30 namespace com { namespace sun { namespace star {
31     namespace awt { struct Point; }
32     namespace awt { struct Size; }
33     namespace drawing { class XShapes; }
34     namespace chart2 { class XChartDocument; }
35     namespace chart2 { namespace data { class XDataProvider; } }
36     namespace chart2 { namespace data { class XDataSequence; } }
37 } } }
38 
39 namespace oox { namespace core { class XmlFilterBase; } }
40 
41 namespace oox {
42 namespace drawingml {
43 namespace chart {
44 
45 struct ChartSpaceModel;
46 struct DataSequenceModel;
47 
48 // ============================================================================
49 
50 class OOX_DLLPUBLIC ChartConverter
51 {
52 public:
53     explicit            ChartConverter();
54     virtual             ~ChartConverter();
55 
56     /** Converts the passed OOXML chart model to the passed chart2 document.
57 
58         @param rChartModel  The filled MSOOXML chart model structure.
59 
60         @param rxChartDoc  The UNO chart document model to be initialized.
61 
62         @param rxExternalPage  If null, all embedded shapes will be inserted
63             into the internal drawing page of the chart document. If not null,
64             all embedded shapes will be inserted into this shapes collection.
65 
66         @param rChartPos  The position of the chart shape in its drawing page,
67             in 1/100 mm. Will be used only, if parameter rxExternalPage is not
68             null, for correct positioning of the embedded shapes in the
69             external drawing page.
70 
71         @param rChartSize  The size of the chart shape in 1/100 mm. Needed for
72             calculation of position and size of the chart elements (diagram,
73             titles, legend, etc.) and embedded shapes.
74      */
75     void                convertFromModel(
76                             ::oox::core::XmlFilterBase& rFilter,
77                             ChartSpaceModel& rChartModel,
78                             const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc,
79                             const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxExternalPage,
80                             const ::com::sun::star::awt::Point& rChartPos,
81                             const ::com::sun::star::awt::Size& rChartSize );
82 
83     /** Creates an internal data provider. Derived classes may override this
84         function to create an external data provider. */
85     virtual void        createDataProvider(
86                             const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc );
87 
88     /** Creates a data sequence from a formula. Dummy implementation. Derived
89         classes have to override this function to actually parse the formula. */
90     virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >
91                         createDataSequence(
92                             const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider >& rxDataProvider,
93                             const DataSequenceModel& rDataSeq );
94 
95 private:
96                         ChartConverter( const ChartConverter& );
97     ChartConverter&     operator=( const ChartConverter& );
98 };
99 
100 // ============================================================================
101 
102 } // namespace chart
103 } // namespace drawingml
104 } // namespace oox
105 
106 #endif
107