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
22 #include <xmloff/uniref.hxx>
23 #include <xmloff/families.hxx>
24 #include <com/sun/star/util/XStringMapping.hpp>
25 #include <com/sun/star/chart/XChartDocument.hpp>
27 namespace com
{ namespace sun
{ namespace star
{
32 class XStatusIndicator
;
42 class XLabeledDataSequence
;
49 class SvXMLUnitConverter
;
50 class SvXMLStylesContext
;
51 class XMLChartImportPropertyMapper
;
53 class SvXMLImportContext
;
56 // ========================================
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
64 class SchXMLImportHelper
: public UniRefBase
67 com::sun::star::uno::Reference
< com::sun::star::chart::XChartDocument
> mxChartDoc
;
68 SvXMLStylesContext
* mpAutoStyles
;
70 SvXMLTokenMap
* mpChartDocElemTokenMap
;
71 SvXMLTokenMap
* mpTableElemTokenMap
;
72 SvXMLTokenMap
* mpChartElemTokenMap
;
73 SvXMLTokenMap
* mpPlotAreaElemTokenMap
;
74 SvXMLTokenMap
* mpSeriesElemTokenMap
;
76 SvXMLTokenMap
* mpChartAttrTokenMap
;
77 SvXMLTokenMap
* mpPlotAreaAttrTokenMap
;
78 SvXMLTokenMap
* mpAutoStyleAttrTokenMap
;
79 SvXMLTokenMap
* mpCellAttrTokenMap
;
80 SvXMLTokenMap
* mpSeriesAttrTokenMap
;
81 SvXMLTokenMap
* mpRegEquationAttrTokenMap
;
86 ~SchXMLImportHelper();
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 com::sun::star::uno::Reference
<
96 com::sun::star::frame::XModel
> xChartModel
,
97 const com::sun::star::uno::Reference
<
98 com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
100 /** set the auto-style context that will be used to retrieve auto-styles
101 used inside the following <chart:chart> element to parse
103 void SetAutoStylesContext( SvXMLStylesContext
* pAutoStyles
) { mpAutoStyles
= pAutoStyles
; }
104 SvXMLStylesContext
* GetAutoStylesContext() const { return mpAutoStyles
; }
106 const com::sun::star::uno::Reference
<
107 com::sun::star::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();
116 const SvXMLTokenMap
& GetChartAttrTokenMap();
117 const SvXMLTokenMap
& GetPlotAreaAttrTokenMap();
118 const SvXMLTokenMap
& GetCellAttrTokenMap();
119 const SvXMLTokenMap
& GetSeriesAttrTokenMap();
120 const SvXMLTokenMap
& GetRegEquationAttrTokenMap();
122 static sal_uInt16
GetChartFamilyID() { return XML_STYLE_FAMILY_SCH_CHART_ID
; }
124 /** @param bPushLastChartType If </sal_False>, in case a new chart type has to
125 be added (because it does not exist yet), it is appended at the
126 end of the chart-type container. When </sal_True>, a new chart type
127 is added at one position before the last one, i.e. the formerly
128 last chart type is pushed back, so that it remains the last one.
130 This is needed when the global chart type is set to type A, but
131 the first series has type B. Then B should appear before A (done
132 by passing true). Once a series of type A has been read,
133 following new chart types are again be added at the end (by
136 static ::com::sun::star::uno::Reference
<
137 ::com::sun::star::chart2::XDataSeries
> GetNewDataSeries(
138 const ::com::sun::star::uno::Reference
<
139 ::com::sun::star::chart2::XChartDocument
> & xDoc
,
140 sal_Int32 nCoordinateSystemIndex
,
141 const OUString
& rChartTypeName
,
142 bool bPushLastChartType
= false );
144 static void DeleteDataSeries(
145 const ::com::sun::star::uno::Reference
<
146 ::com::sun::star::chart2::XDataSeries
>& xSeries
,
147 const ::com::sun::star::uno::Reference
<
148 ::com::sun::star::chart2::XChartDocument
> & xDoc
);
151 #endif // INCLUDED_XMLOFF_SCHXMLIMPORTHELPER_HXX
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */