Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _XMLOFF_SCH_XMLIMPORTHELPER_HXX_
29 : : #define _XMLOFF_SCH_XMLIMPORTHELPER_HXX_
30 : :
31 : : #include <xmloff/uniref.hxx>
32 : : #include <xmloff/families.hxx>
33 : : #include <com/sun/star/util/XStringMapping.hpp>
34 : : #include <com/sun/star/chart/XChartDocument.hpp>
35 : :
36 : : namespace com { namespace sun { namespace star {
37 : : namespace frame {
38 : : class XModel;
39 : : }
40 : : namespace task {
41 : : class XStatusIndicator;
42 : : }
43 : : namespace xml {
44 : : namespace sax {
45 : : class XAttributeList;
46 : : }
47 : : }
48 : : namespace chart2 {
49 : : namespace data {
50 : : class XDataProvider;
51 : : class XLabeledDataSequence;
52 : : }
53 : : class XChartDocument;
54 : : class XDataSeries;
55 : : }
56 : : }}}
57 : :
58 : : class SvXMLUnitConverter;
59 : : class SvXMLStylesContext;
60 : : class XMLChartImportPropertyMapper;
61 : : class SvXMLTokenMap;
62 : : class SvXMLImportContext;
63 : : class SvXMLImport;
64 : :
65 : : // ========================================
66 : :
67 : : /** With this class you can import a <chart:chart> element containing
68 : : its data as <table:table> element or without internal table. In
69 : : the latter case you have to provide a table address mapper that
70 : : converts table addresses in XML format to the appropriate application
71 : : format.
72 : : */
73 : : class SchXMLImportHelper : public UniRefBase
74 : : {
75 : : private:
76 : : com::sun::star::uno::Reference< com::sun::star::chart::XChartDocument > mxChartDoc;
77 : : SvXMLStylesContext* mpAutoStyles;
78 : :
79 : : SvXMLTokenMap* mpChartDocElemTokenMap;
80 : : SvXMLTokenMap* mpTableElemTokenMap;
81 : : SvXMLTokenMap* mpChartElemTokenMap;
82 : : SvXMLTokenMap* mpPlotAreaElemTokenMap;
83 : : SvXMLTokenMap* mpSeriesElemTokenMap;
84 : :
85 : : SvXMLTokenMap* mpChartAttrTokenMap;
86 : : SvXMLTokenMap* mpPlotAreaAttrTokenMap;
87 : : SvXMLTokenMap* mpAutoStyleAttrTokenMap;
88 : : SvXMLTokenMap* mpCellAttrTokenMap;
89 : : SvXMLTokenMap* mpSeriesAttrTokenMap;
90 : : SvXMLTokenMap* mpRegEquationAttrTokenMap;
91 : :
92 : : public:
93 : :
94 : : SchXMLImportHelper();
95 : : ~SchXMLImportHelper();
96 : :
97 : : /** get the context for reading the <chart:chart> element with subelements.
98 : : The result is stored in the XModel given if it also implements
99 : : XChartDocument
100 : : */
101 : : SvXMLImportContext* CreateChartContext(
102 : : SvXMLImport& rImport,
103 : : sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
104 : : const com::sun::star::uno::Reference<
105 : : com::sun::star::frame::XModel > xChartModel,
106 : : const com::sun::star::uno::Reference<
107 : : com::sun::star::xml::sax::XAttributeList >& xAttrList );
108 : :
109 : : /** set the auto-style context that will be used to retrieve auto-styles
110 : : used inside the following <chart:chart> element to parse
111 : : */
112 : 360 : void SetAutoStylesContext( SvXMLStylesContext* pAutoStyles ) { mpAutoStyles = pAutoStyles; }
113 : 90 : SvXMLStylesContext* GetAutoStylesContext() const { return mpAutoStyles; }
114 : :
115 : : const com::sun::star::uno::Reference<
116 : 102 : com::sun::star::chart::XChartDocument >& GetChartDocument()
117 : 102 : { return mxChartDoc; }
118 : :
119 : : const SvXMLTokenMap& GetDocElemTokenMap();
120 : : const SvXMLTokenMap& GetTableElemTokenMap();
121 : : const SvXMLTokenMap& GetChartElemTokenMap();
122 : : const SvXMLTokenMap& GetPlotAreaElemTokenMap();
123 : : const SvXMLTokenMap& GetSeriesElemTokenMap();
124 : :
125 : : const SvXMLTokenMap& GetChartAttrTokenMap();
126 : : const SvXMLTokenMap& GetPlotAreaAttrTokenMap();
127 : : const SvXMLTokenMap& GetCellAttrTokenMap();
128 : : const SvXMLTokenMap& GetSeriesAttrTokenMap();
129 : : const SvXMLTokenMap& GetRegEquationAttrTokenMap();
130 : :
131 : 102 : static sal_uInt16 GetChartFamilyID() { return XML_STYLE_FAMILY_SCH_CHART_ID; }
132 : :
133 : : /** @param bPushLastChartType If </sal_False>, in case a new chart type has to
134 : : be added (because it does not exist yet), it is appended at the
135 : : end of the chart-type container. When </sal_True>, a new chart type
136 : : is added at one position before the last one, i.e. the formerly
137 : : last chart type is pushed back, so that it remains the last one.
138 : :
139 : : This is needed when the global chart type is set to type A, but
140 : : the first series has type B. Then B should appear before A (done
141 : : by passing true). Once a series of type A has been read,
142 : : following new chart types are again be added at the end (by
143 : : passing false).
144 : : */
145 : : static ::com::sun::star::uno::Reference<
146 : : ::com::sun::star::chart2::XDataSeries > GetNewDataSeries(
147 : : const ::com::sun::star::uno::Reference<
148 : : ::com::sun::star::chart2::XChartDocument > & xDoc,
149 : : sal_Int32 nCoordinateSystemIndex,
150 : : const ::rtl::OUString & rChartTypeName,
151 : : bool bPushLastChartType = false );
152 : :
153 : : static void DeleteDataSeries(
154 : : const ::com::sun::star::uno::Reference<
155 : : ::com::sun::star::chart2::XDataSeries >& xSeries,
156 : : const ::com::sun::star::uno::Reference<
157 : : ::com::sun::star::chart2::XChartDocument > & xDoc );
158 : : };
159 : :
160 : : #endif // _XMLOFF_SCH_XMLIMPORTHELPER_HXX_
161 : :
162 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|