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_SOURCE_CHART_SCHXMLTABLECONTEXT_HXX
20 #define INCLUDED_XMLOFF_SOURCE_CHART_SCHXMLTABLECONTEXT_HXX
22 #include <xmloff/xmlictxt.hxx>
23 #include "SchXMLImport.hxx"
24 #include <com/sun/star/uno/Sequence.hxx>
26 #include <com/sun/star/chart/ChartDataRowSource.hpp>
28 #include "transporttypes.hxx"
30 namespace com
{ namespace sun
{ namespace star
{
31 namespace xml
{ namespace sax
{
38 class SchXMLTableContext
: public SvXMLImportContext
41 SchXMLImportHelper
& mrImportHelper
;
44 bool mbHasRowPermutation
;
45 bool mbHasColumnPermutation
;
46 css::uno::Sequence
< sal_Int32
> maRowPermutation
;
47 css::uno::Sequence
< sal_Int32
> maColumnPermutation
;
50 SchXMLTableContext( SchXMLImportHelper
& rImpHelper
,
52 const OUString
& rLocalName
,
53 SchXMLTable
& aTable
);
54 virtual ~SchXMLTableContext();
56 virtual SvXMLImportContext
* CreateChildContext(
58 const OUString
& rLocalName
,
59 const css::uno::Reference
< css::xml::sax::XAttributeList
>& xAttrList
) override
;
60 virtual void StartElement( const css::uno::Reference
< css::xml::sax::XAttributeList
>& xAttrList
) override
;
61 virtual void EndElement() override
;
63 void setRowPermutation( const css::uno::Sequence
< sal_Int32
> & rPermutation
);
64 void setColumnPermutation( const css::uno::Sequence
< sal_Int32
> & rPermutation
);
67 class SchXMLTableHelper
70 static void applyTableToInternalDataProvider( const SchXMLTable
& rTable
,
71 const css::uno::Reference
< css::chart2::XChartDocument
>& xChartDoc
);
73 /** This function reorders local data to fit the correct data structure.
74 Call it after the data series got their styles set.
76 static void switchRangesFromOuterToInternalIfNecessary( const SchXMLTable
& rTable
,
77 const tSchXMLLSequencesPerIndex
& rLSequencesPerIndex
,
78 const css::uno::Reference
< css::chart2::XChartDocument
>& xChartDoc
,
79 css::chart::ChartDataRowSource eDataRowSource
);
82 // classes for columns
84 /** With this context all column elements are parsed to
85 determine the index of the column containing
86 the row descriptions and probably get an estimate
87 for the altogether number of columns
89 class SchXMLTableColumnsContext
: public SvXMLImportContext
95 SchXMLTableColumnsContext( SvXMLImport
& rImport
,
96 const OUString
& rLocalName
,
97 SchXMLTable
& aTable
);
98 virtual ~SchXMLTableColumnsContext();
100 virtual SvXMLImportContext
* CreateChildContext(
102 const OUString
& rLocalName
,
103 const css::uno::Reference
< css::xml::sax::XAttributeList
>& xAttrList
) override
;
106 class SchXMLTableColumnContext
: public SvXMLImportContext
109 SchXMLTable
& mrTable
;
112 SchXMLTableColumnContext( SvXMLImport
& rImport
,
113 const OUString
& rLocalName
,
114 SchXMLTable
& aTable
);
115 virtual ~SchXMLTableColumnContext();
116 virtual void StartElement( const css::uno::Reference
< css::xml::sax::XAttributeList
>& xAttrList
) override
;
121 class SchXMLTableRowsContext
: public SvXMLImportContext
124 SchXMLImportHelper
& mrImportHelper
;
125 SchXMLTable
& mrTable
;
128 SchXMLTableRowsContext( SchXMLImportHelper
& rImpHelper
,
129 SvXMLImport
& rImport
,
130 const OUString
& rLocalName
,
131 SchXMLTable
& aTable
);
132 virtual ~SchXMLTableRowsContext();
134 virtual SvXMLImportContext
* CreateChildContext(
136 const OUString
& rLocalName
,
137 const css::uno::Reference
< css::xml::sax::XAttributeList
>& xAttrList
) override
;
140 class SchXMLTableRowContext
: public SvXMLImportContext
143 SchXMLImportHelper
& mrImportHelper
;
144 SchXMLTable
& mrTable
;
147 SchXMLTableRowContext( SchXMLImportHelper
& rImpHelper
,
148 SvXMLImport
& rImport
,
149 const OUString
& rLocalName
,
150 SchXMLTable
& aTable
);
151 virtual ~SchXMLTableRowContext();
153 virtual SvXMLImportContext
* CreateChildContext(
155 const OUString
& rLocalName
,
156 const css::uno::Reference
< css::xml::sax::XAttributeList
>& xAttrList
) override
;
159 // classes for cells and their content
161 class SchXMLTableCellContext
: public SvXMLImportContext
164 SchXMLImportHelper
& mrImportHelper
;
165 SchXMLTable
& mrTable
;
166 OUString maCellContent
;
171 SchXMLTableCellContext( SchXMLImportHelper
& rImpHelper
,
172 SvXMLImport
& rImport
,
173 const OUString
& rLocalName
,
174 SchXMLTable
& aTable
);
175 virtual ~SchXMLTableCellContext();
177 virtual SvXMLImportContext
* CreateChildContext(
179 const OUString
& rLocalName
,
180 const css::uno::Reference
< css::xml::sax::XAttributeList
>& xAttrList
) override
;
181 virtual void StartElement( const css::uno::Reference
< css::xml::sax::XAttributeList
>& xAttrList
) override
;
182 virtual void EndElement() override
;
185 #endif // INCLUDED_XMLOFF_SOURCE_CHART_SCHXMLTABLECONTEXT_HXX
187 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */