nss: upgrade to release 3.73
[LibreOffice.git] / include / xmloff / SchXMLImportHelper.hxx
blobf60c222cba5032ca6d032b2431d32a959fe33cda
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_XMLOFF_SCHXMLIMPORTHELPER_HXX
20 #define INCLUDED_XMLOFF_SCHXMLIMPORTHELPER_HXX
22 #include <memory>
24 #include <salhelper/simplereferenceobject.hxx>
25 #include <xmloff/families.hxx>
26 #include <xmloff/xmltkmap.hxx>
28 namespace com::sun::star::chart { class XChartDocument; }
29 namespace com::sun::star::beans { class XPropertySet; }
31 namespace com::sun::star {
32 namespace frame {
33 class XModel;
35 namespace xml {
36 namespace sax {
37 class XAttributeList;
40 namespace chart2 {
41 class XChartDocument;
42 class XDataSeries;
46 class SvXMLStylesContext;
47 class SvXMLImportContext;
48 class SvXMLImport;
51 /** With this class you can import a <chart:chart> element containing
52 its data as <table:table> element or without internal table. In
53 the latter case you have to provide a table address mapper that
54 converts table addresses in XML format to the appropriate application
55 format.
57 class SchXMLImportHelper final : public salhelper::SimpleReferenceObject
59 private:
60 css::uno::Reference< css::chart::XChartDocument > mxChartDoc;
61 SvXMLStylesContext* mpAutoStyles;
63 std::unique_ptr<SvXMLTokenMap> mpChartDocElemTokenMap;
64 std::unique_ptr<SvXMLTokenMap> mpTableElemTokenMap;
65 std::unique_ptr<SvXMLTokenMap> mpChartElemTokenMap;
66 std::unique_ptr<SvXMLTokenMap> mpPlotAreaElemTokenMap;
67 std::unique_ptr<SvXMLTokenMap> mpSeriesElemTokenMap;
69 std::unique_ptr<SvXMLTokenMap> mpChartAttrTokenMap;
70 std::unique_ptr<SvXMLTokenMap> mpPlotAreaAttrTokenMap;
71 std::unique_ptr<SvXMLTokenMap> mpCellAttrTokenMap;
72 std::unique_ptr<SvXMLTokenMap> mpSeriesAttrTokenMap;
73 std::unique_ptr<SvXMLTokenMap> mpPropMappingAttrTokenMap;
74 std::unique_ptr<SvXMLTokenMap> mpRegEquationAttrTokenMap;
76 public:
78 SchXMLImportHelper();
80 /** get the context for reading the <chart:chart> element with subelements.
81 The result is stored in the XModel given if it also implements
82 XChartDocument
84 SvXMLImportContext* CreateChartContext(
85 SvXMLImport& rImport,
86 const css::uno::Reference< css::frame::XModel >& rChartModel );
88 /** set the auto-style context that will be used to retrieve auto-styles
89 used inside the following <chart:chart> element to parse
91 void SetAutoStylesContext( SvXMLStylesContext* pAutoStyles ) { mpAutoStyles = pAutoStyles; }
92 SvXMLStylesContext* GetAutoStylesContext() const { return mpAutoStyles; }
94 /// Fill in the autostyle.
95 void FillAutoStyle(const OUString& rAutoStyleName, const css::uno::Reference<css::beans::XPropertySet>& rProp);
97 const css::uno::Reference< css::chart::XChartDocument >& GetChartDocument() const
98 { return mxChartDoc; }
100 const SvXMLTokenMap& GetDocElemTokenMap();
101 const SvXMLTokenMap& GetTableElemTokenMap();
102 const SvXMLTokenMap& GetChartElemTokenMap();
103 const SvXMLTokenMap& GetPlotAreaElemTokenMap();
104 const SvXMLTokenMap& GetSeriesElemTokenMap();
105 const SvXMLTokenMap& GetPropMappingAttrTokenMap();
107 const SvXMLTokenMap& GetChartAttrTokenMap();
108 const SvXMLTokenMap& GetPlotAreaAttrTokenMap();
109 const SvXMLTokenMap& GetCellAttrTokenMap();
110 const SvXMLTokenMap& GetSeriesAttrTokenMap();
111 const SvXMLTokenMap& GetRegEquationAttrTokenMap();
113 static XmlStyleFamily GetChartFamilyID() { return XmlStyleFamily::SCH_CHART_ID; }
115 /** @param bPushLastChartType If </sal_False>, in case a new chart type has to
116 be added (because it does not exist yet), it is appended at the
117 end of the chart-type container. When </sal_True>, a new chart type
118 is added at one position before the last one, i.e. the formerly
119 last chart type is pushed back, so that it remains the last one.
121 This is needed when the global chart type is set to type A, but
122 the first series has type B. Then B should appear before A (done
123 by passing true). Once a series of type A has been read,
124 following new chart types are again be added at the end (by
125 passing false).
127 static css::uno::Reference< css::chart2::XDataSeries > GetNewDataSeries(
128 const css::uno::Reference< css::chart2::XChartDocument > & xDoc,
129 sal_Int32 nCoordinateSystemIndex,
130 const OUString & rChartTypeName,
131 bool bPushLastChartType );
133 static void DeleteDataSeries(
134 const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
135 const css::uno::Reference< css::chart2::XChartDocument > & xDoc );
138 #endif // INCLUDED_XMLOFF_SCHXMLIMPORTHELPER_HXX
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */