1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
24 #include <salhelper/simplereferenceobject.hxx>
25 #include <xmloff/families.hxx>
26 #include <com/sun/star/util/XStringMapping.hpp>
27 #include <com/sun/star/chart/XChartDocument.hpp>
29 namespace com
{ namespace sun
{ namespace star
{
34 class XStatusIndicator
;
44 class XLabeledDataSequence
;
51 class SvXMLUnitConverter
;
52 class SvXMLStylesContext
;
53 class XMLChartImportPropertyMapper
;
55 class SvXMLImportContext
;
59 /** With this class you can import a <chart:chart> element containing
60 its data as <table:table> element or without internal table. In
61 the latter case you have to provide a table address mapper that
62 converts table addresses in XML format to the appropriate application
65 class SchXMLImportHelper
: public salhelper::SimpleReferenceObject
68 css::uno::Reference
< css::chart::XChartDocument
> mxChartDoc
;
69 SvXMLStylesContext
* mpAutoStyles
;
71 std::unique_ptr
<SvXMLTokenMap
> mpChartDocElemTokenMap
;
72 std::unique_ptr
<SvXMLTokenMap
> mpTableElemTokenMap
;
73 std::unique_ptr
<SvXMLTokenMap
> mpChartElemTokenMap
;
74 std::unique_ptr
<SvXMLTokenMap
> mpPlotAreaElemTokenMap
;
75 std::unique_ptr
<SvXMLTokenMap
> mpSeriesElemTokenMap
;
77 std::unique_ptr
<SvXMLTokenMap
> mpChartAttrTokenMap
;
78 std::unique_ptr
<SvXMLTokenMap
> mpPlotAreaAttrTokenMap
;
79 std::unique_ptr
<SvXMLTokenMap
> mpCellAttrTokenMap
;
80 std::unique_ptr
<SvXMLTokenMap
> mpSeriesAttrTokenMap
;
81 std::unique_ptr
<SvXMLTokenMap
> mpPropMappingAttrTokenMap
;
82 std::unique_ptr
<SvXMLTokenMap
> mpRegEquationAttrTokenMap
;
88 /** get the context for reading the <chart:chart> element with subelements.
89 The result is stored in the XModel given if it also implements
92 SvXMLImportContext
* CreateChartContext(
94 sal_uInt16 nPrefix
, const OUString
& rLocalName
,
95 const css::uno::Reference
< css::frame::XModel
>& rChartModel
,
96 const css::uno::Reference
< css::xml::sax::XAttributeList
>& rAttrList
);
98 /** set the auto-style context that will be used to retrieve auto-styles
99 used inside the following <chart:chart> element to parse
101 void SetAutoStylesContext( SvXMLStylesContext
* pAutoStyles
) { mpAutoStyles
= pAutoStyles
; }
102 SvXMLStylesContext
* GetAutoStylesContext() const { return mpAutoStyles
; }
104 /// Fill in the autostyle.
105 void FillAutoStyle(const OUString
& rAutoStyleName
, const css::uno::Reference
<css::beans::XPropertySet
>& rProp
);
107 const css::uno::Reference
< css::chart::XChartDocument
>& GetChartDocument()
108 { return mxChartDoc
; }
110 const SvXMLTokenMap
& GetDocElemTokenMap();
111 const SvXMLTokenMap
& GetTableElemTokenMap();
112 const SvXMLTokenMap
& GetChartElemTokenMap();
113 const SvXMLTokenMap
& GetPlotAreaElemTokenMap();
114 const SvXMLTokenMap
& GetSeriesElemTokenMap();
115 const SvXMLTokenMap
& GetPropMappingAttrTokenMap();
117 const SvXMLTokenMap
& GetChartAttrTokenMap();
118 const SvXMLTokenMap
& GetPlotAreaAttrTokenMap();
119 const SvXMLTokenMap
& GetCellAttrTokenMap();
120 const SvXMLTokenMap
& GetSeriesAttrTokenMap();
121 const SvXMLTokenMap
& GetRegEquationAttrTokenMap();
123 static sal_uInt16
GetChartFamilyID() { return XML_STYLE_FAMILY_SCH_CHART_ID
; }
125 /** @param bPushLastChartType If </sal_False>, in case a new chart type has to
126 be added (because it does not exist yet), it is appended at the
127 end of the chart-type container. When </sal_True>, a new chart type
128 is added at one position before the last one, i.e. the formerly
129 last chart type is pushed back, so that it remains the last one.
131 This is needed when the global chart type is set to type A, but
132 the first series has type B. Then B should appear before A (done
133 by passing true). Once a series of type A has been read,
134 following new chart types are again be added at the end (by
137 static css::uno::Reference
< css::chart2::XDataSeries
> GetNewDataSeries(
138 const css::uno::Reference
< css::chart2::XChartDocument
> & xDoc
,
139 sal_Int32 nCoordinateSystemIndex
,
140 const OUString
& rChartTypeName
,
141 bool bPushLastChartType
);
143 static void DeleteDataSeries(
144 const css::uno::Reference
< css::chart2::XDataSeries
>& xSeries
,
145 const css::uno::Reference
< css::chart2::XChartDocument
> & xDoc
);
148 #endif // INCLUDED_XMLOFF_SCHXMLIMPORTHELPER_HXX
150 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */