Bump version to 6.4-15
[LibreOffice.git] / include / xmloff / SchXMLImportHelper.hxx
blob9cdb3f0566ee4b0172a4a97b75699d8fe7c444ac
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 { namespace sun { namespace star { namespace chart { class XChartDocument; } } } }
29 namespace com { namespace sun { namespace star { namespace beans { class XPropertySet; } } } }
31 namespace com { namespace sun { namespace 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;
44 }}}
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 sal_uInt16 nPrefix, const OUString& rLocalName,
87 const css::uno::Reference< css::frame::XModel >& rChartModel,
88 const css::uno::Reference< css::xml::sax::XAttributeList >& rAttrList );
90 /** set the auto-style context that will be used to retrieve auto-styles
91 used inside the following <chart:chart> element to parse
93 void SetAutoStylesContext( SvXMLStylesContext* pAutoStyles ) { mpAutoStyles = pAutoStyles; }
94 SvXMLStylesContext* GetAutoStylesContext() const { return mpAutoStyles; }
96 /// Fill in the autostyle.
97 void FillAutoStyle(const OUString& rAutoStyleName, const css::uno::Reference<css::beans::XPropertySet>& rProp);
99 const css::uno::Reference< css::chart::XChartDocument >& GetChartDocument() const
100 { return mxChartDoc; }
102 const SvXMLTokenMap& GetDocElemTokenMap();
103 const SvXMLTokenMap& GetTableElemTokenMap();
104 const SvXMLTokenMap& GetChartElemTokenMap();
105 const SvXMLTokenMap& GetPlotAreaElemTokenMap();
106 const SvXMLTokenMap& GetSeriesElemTokenMap();
107 const SvXMLTokenMap& GetPropMappingAttrTokenMap();
109 const SvXMLTokenMap& GetChartAttrTokenMap();
110 const SvXMLTokenMap& GetPlotAreaAttrTokenMap();
111 const SvXMLTokenMap& GetCellAttrTokenMap();
112 const SvXMLTokenMap& GetSeriesAttrTokenMap();
113 const SvXMLTokenMap& GetRegEquationAttrTokenMap();
115 static sal_uInt16 GetChartFamilyID() { return XML_STYLE_FAMILY_SCH_CHART_ID; }
117 /** @param bPushLastChartType If </sal_False>, in case a new chart type has to
118 be added (because it does not exist yet), it is appended at the
119 end of the chart-type container. When </sal_True>, a new chart type
120 is added at one position before the last one, i.e. the formerly
121 last chart type is pushed back, so that it remains the last one.
123 This is needed when the global chart type is set to type A, but
124 the first series has type B. Then B should appear before A (done
125 by passing true). Once a series of type A has been read,
126 following new chart types are again be added at the end (by
127 passing false).
129 static css::uno::Reference< css::chart2::XDataSeries > GetNewDataSeries(
130 const css::uno::Reference< css::chart2::XChartDocument > & xDoc,
131 sal_Int32 nCoordinateSystemIndex,
132 const OUString & rChartTypeName,
133 bool bPushLastChartType );
135 static void DeleteDataSeries(
136 const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
137 const css::uno::Reference< css::chart2::XChartDocument > & xDoc );
140 #endif // INCLUDED_XMLOFF_SCHXMLIMPORTHELPER_HXX
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */