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 <com/sun/star/uno/Reference.hxx>
23 #include <salhelper/simplereferenceobject.hxx>
24 #include <xmloff/dllapi.h>
25 #include <xmloff/families.hxx>
27 namespace com::sun::star::chart
{ class XChartDocument
; }
28 namespace com::sun::star::beans
{ class XPropertySet
; }
30 namespace com::sun::star
{
45 class SvXMLStylesContext
;
46 class SvXMLImportContext
;
50 /** With this class you can import a <chart:chart> element containing
51 its data as <table:table> element or without internal table. In
52 the latter case you have to provide a table address mapper that
53 converts table addresses in XML format to the appropriate application
56 class SchXMLImportHelper final
: public salhelper::SimpleReferenceObject
59 css::uno::Reference
< css::chart::XChartDocument
> mxChartDoc
;
60 SvXMLStylesContext
* mpAutoStyles
;
66 /** get the context for reading the <chart:chart> element with subelements.
67 The result is stored in the XModel given if it also implements
70 SvXMLImportContext
* CreateChartContext(
72 const css::uno::Reference
< css::frame::XModel
>& rChartModel
);
74 /** set the auto-style context that will be used to retrieve auto-styles
75 used inside the following <chart:chart> element to parse
77 void SetAutoStylesContext( SvXMLStylesContext
* pAutoStyles
) { mpAutoStyles
= pAutoStyles
; }
78 SvXMLStylesContext
* GetAutoStylesContext() const { return mpAutoStyles
; }
80 /// Fill in the autostyle.
81 void FillAutoStyle(const OUString
& rAutoStyleName
, const css::uno::Reference
<css::beans::XPropertySet
>& rProp
);
83 const css::uno::Reference
< css::chart::XChartDocument
>& GetChartDocument() const
84 { return mxChartDoc
; }
86 static XmlStyleFamily
GetChartFamilyID() { return XmlStyleFamily::SCH_CHART_ID
; }
88 /** @param bPushLastChartType If </sal_False>, in case a new chart type has to
89 be added (because it does not exist yet), it is appended at the
90 end of the chart-type container. When </sal_True>, a new chart type
91 is added at one position before the last one, i.e. the formerly
92 last chart type is pushed back, so that it remains the last one.
94 This is needed when the global chart type is set to type A, but
95 the first series has type B. Then B should appear before A (done
96 by passing true). Once a series of type A has been read,
97 following new chart types are again be added at the end (by
100 static css::uno::Reference
< css::chart2::XDataSeries
> GetNewDataSeries(
101 const css::uno::Reference
< css::chart2::XChartDocument
> & xDoc
,
102 sal_Int32 nCoordinateSystemIndex
,
103 const OUString
& rChartTypeName
,
104 bool bPushLastChartType
);
106 static void DeleteDataSeries(
107 const css::uno::Reference
< css::chart2::XDataSeries
>& xSeries
,
108 const css::uno::Reference
< css::chart2::XChartDocument
> & xDoc
);
111 XMLOFF_DLLPUBLIC
void setDataProvider(css::uno::Reference
<css::chart2::XChartDocument
> const & xChartDoc
, OUString
const & sDataPilotSource
);
113 #endif // INCLUDED_XMLOFF_SCHXMLIMPORTHELPER_HXX
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */