Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_XMLOFF_SCHXMLIMPORTHELPER_HXX
20 : #define INCLUDED_XMLOFF_SCHXMLIMPORTHELPER_HXX
21 :
22 : #include <salhelper/simplereferenceobject.hxx>
23 : #include <xmloff/families.hxx>
24 : #include <com/sun/star/util/XStringMapping.hpp>
25 : #include <com/sun/star/chart/XChartDocument.hpp>
26 :
27 : namespace com { namespace sun { namespace star {
28 : namespace frame {
29 : class XModel;
30 : }
31 : namespace task {
32 : class XStatusIndicator;
33 : }
34 : namespace xml {
35 : namespace sax {
36 : class XAttributeList;
37 : }
38 : }
39 : namespace chart2 {
40 : namespace data {
41 : class XDataProvider;
42 : class XLabeledDataSequence;
43 : }
44 : class XChartDocument;
45 : class XDataSeries;
46 : }
47 : }}}
48 :
49 : class SvXMLUnitConverter;
50 : class SvXMLStylesContext;
51 : class XMLChartImportPropertyMapper;
52 : class SvXMLTokenMap;
53 : class SvXMLImportContext;
54 : class SvXMLImport;
55 :
56 :
57 :
58 : /** With this class you can import a <chart:chart> element containing
59 : its data as <table:table> element or without internal table. In
60 : the latter case you have to provide a table address mapper that
61 : converts table addresses in XML format to the appropriate application
62 : format.
63 : */
64 : class SchXMLImportHelper : public salhelper::SimpleReferenceObject
65 : {
66 : private:
67 : com::sun::star::uno::Reference< com::sun::star::chart::XChartDocument > mxChartDoc;
68 : SvXMLStylesContext* mpAutoStyles;
69 :
70 : SvXMLTokenMap* mpChartDocElemTokenMap;
71 : SvXMLTokenMap* mpTableElemTokenMap;
72 : SvXMLTokenMap* mpChartElemTokenMap;
73 : SvXMLTokenMap* mpPlotAreaElemTokenMap;
74 : SvXMLTokenMap* mpSeriesElemTokenMap;
75 :
76 : SvXMLTokenMap* mpChartAttrTokenMap;
77 : SvXMLTokenMap* mpPlotAreaAttrTokenMap;
78 : SvXMLTokenMap* mpAutoStyleAttrTokenMap;
79 : SvXMLTokenMap* mpCellAttrTokenMap;
80 : SvXMLTokenMap* mpSeriesAttrTokenMap;
81 : SvXMLTokenMap* mpPropMappingAttrTokenMap;
82 : SvXMLTokenMap* mpRegEquationAttrTokenMap;
83 :
84 : public:
85 :
86 : SchXMLImportHelper();
87 : virtual ~SchXMLImportHelper();
88 :
89 : /** get the context for reading the <chart:chart> element with subelements.
90 : The result is stored in the XModel given if it also implements
91 : XChartDocument
92 : */
93 : SvXMLImportContext* CreateChartContext(
94 : SvXMLImport& rImport,
95 : sal_uInt16 nPrefix, const OUString& rLocalName,
96 : const com::sun::star::uno::Reference<
97 : com::sun::star::frame::XModel > xChartModel,
98 : const com::sun::star::uno::Reference<
99 : com::sun::star::xml::sax::XAttributeList >& xAttrList );
100 :
101 : /** set the auto-style context that will be used to retrieve auto-styles
102 : used inside the following <chart:chart> element to parse
103 : */
104 1988 : void SetAutoStylesContext( SvXMLStylesContext* pAutoStyles ) { mpAutoStyles = pAutoStyles; }
105 2940 : SvXMLStylesContext* GetAutoStylesContext() const { return mpAutoStyles; }
106 :
107 : const com::sun::star::uno::Reference<
108 3728 : com::sun::star::chart::XChartDocument >& GetChartDocument()
109 3728 : { return mxChartDoc; }
110 :
111 : const SvXMLTokenMap& GetDocElemTokenMap();
112 : const SvXMLTokenMap& GetTableElemTokenMap();
113 : const SvXMLTokenMap& GetChartElemTokenMap();
114 : const SvXMLTokenMap& GetPlotAreaElemTokenMap();
115 : const SvXMLTokenMap& GetSeriesElemTokenMap();
116 : const SvXMLTokenMap& GetPropMappingAttrTokenMap();
117 :
118 : const SvXMLTokenMap& GetChartAttrTokenMap();
119 : const SvXMLTokenMap& GetPlotAreaAttrTokenMap();
120 : const SvXMLTokenMap& GetCellAttrTokenMap();
121 : const SvXMLTokenMap& GetSeriesAttrTokenMap();
122 : const SvXMLTokenMap& GetRegEquationAttrTokenMap();
123 :
124 3406 : static sal_uInt16 GetChartFamilyID() { return XML_STYLE_FAMILY_SCH_CHART_ID; }
125 :
126 : /** @param bPushLastChartType If </sal_False>, in case a new chart type has to
127 : be added (because it does not exist yet), it is appended at the
128 : end of the chart-type container. When </sal_True>, a new chart type
129 : is added at one position before the last one, i.e. the formerly
130 : last chart type is pushed back, so that it remains the last one.
131 :
132 : This is needed when the global chart type is set to type A, but
133 : the first series has type B. Then B should appear before A (done
134 : by passing true). Once a series of type A has been read,
135 : following new chart types are again be added at the end (by
136 : passing false).
137 : */
138 : static ::com::sun::star::uno::Reference<
139 : ::com::sun::star::chart2::XDataSeries > GetNewDataSeries(
140 : const ::com::sun::star::uno::Reference<
141 : ::com::sun::star::chart2::XChartDocument > & xDoc,
142 : sal_Int32 nCoordinateSystemIndex,
143 : const OUString & rChartTypeName,
144 : bool bPushLastChartType = false );
145 :
146 : static void DeleteDataSeries(
147 : const ::com::sun::star::uno::Reference<
148 : ::com::sun::star::chart2::XDataSeries >& xSeries,
149 : const ::com::sun::star::uno::Reference<
150 : ::com::sun::star::chart2::XChartDocument > & xDoc );
151 : };
152 :
153 : #endif // INCLUDED_XMLOFF_SCHXMLIMPORTHELPER_HXX
154 :
155 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|