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 ::com::sun::star::uno::Sequence
< sal_Int32
> maRowPermutation
;
47 ::com::sun::star::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 com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
60 virtual void StartElement( const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
61 virtual void EndElement() SAL_OVERRIDE
;
63 void setRowPermutation( const ::com::sun::star::uno::Sequence
< sal_Int32
> & rPermutation
);
64 void setColumnPermutation( const ::com::sun::star::uno::Sequence
< sal_Int32
> & rPermutation
);
67 class SchXMLTableHelper
70 static void GetCellAddress( const OUString
& rStr
, sal_Int32
& rCol
, sal_Int32
& rRow
);
71 static bool GetCellRangeAddress( const OUString
& rStr
, SchNumericCellRangeAddress
& rResult
);
72 static void AdjustMax( const SchNumericCellRangeAddress
& rAddr
,
73 sal_Int32
& nRows
, sal_Int32
& nColumns
);
76 static void applyTableToInternalDataProvider( const SchXMLTable
& rTable
,
77 com::sun::star::uno::Reference
< com::sun::star::chart2::XChartDocument
> xChartDoc
);
79 /** This function reorders local data to fit the correct data structure.
80 Call it after the data series got their styles set.
82 static void switchRangesFromOuterToInternalIfNecessary( const SchXMLTable
& rTable
,
83 const tSchXMLLSequencesPerIndex
& rLSequencesPerIndex
,
84 com::sun::star::uno::Reference
< com::sun::star::chart2::XChartDocument
> xChartDoc
,
85 ::com::sun::star::chart::ChartDataRowSource eDataRowSource
);
88 // classes for columns
90 /** With this context all column elements are parsed to
91 determine the index of the column containing
92 the row descriptions and probably get an estimate
93 for the altogether number of columns
95 class SchXMLTableColumnsContext
: public SvXMLImportContext
101 SchXMLTableColumnsContext( SvXMLImport
& rImport
,
102 const OUString
& rLocalName
,
103 SchXMLTable
& aTable
);
104 virtual ~SchXMLTableColumnsContext();
106 virtual SvXMLImportContext
* CreateChildContext(
108 const OUString
& rLocalName
,
109 const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
112 class SchXMLTableColumnContext
: public SvXMLImportContext
115 SchXMLTable
& mrTable
;
118 SchXMLTableColumnContext( SvXMLImport
& rImport
,
119 const OUString
& rLocalName
,
120 SchXMLTable
& aTable
);
121 virtual ~SchXMLTableColumnContext();
122 virtual void StartElement( const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
127 class SchXMLTableRowsContext
: public SvXMLImportContext
130 SchXMLImportHelper
& mrImportHelper
;
131 SchXMLTable
& mrTable
;
134 SchXMLTableRowsContext( SchXMLImportHelper
& rImpHelper
,
135 SvXMLImport
& rImport
,
136 const OUString
& rLocalName
,
137 SchXMLTable
& aTable
);
138 virtual ~SchXMLTableRowsContext();
140 virtual SvXMLImportContext
* CreateChildContext(
142 const OUString
& rLocalName
,
143 const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
146 class SchXMLTableRowContext
: public SvXMLImportContext
149 SchXMLImportHelper
& mrImportHelper
;
150 SchXMLTable
& mrTable
;
153 SchXMLTableRowContext( SchXMLImportHelper
& rImpHelper
,
154 SvXMLImport
& rImport
,
155 const OUString
& rLocalName
,
156 SchXMLTable
& aTable
);
157 virtual ~SchXMLTableRowContext();
159 virtual SvXMLImportContext
* CreateChildContext(
161 const OUString
& rLocalName
,
162 const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
165 // classes for cells and their content
167 class SchXMLTableCellContext
: public SvXMLImportContext
170 SchXMLImportHelper
& mrImportHelper
;
171 SchXMLTable
& mrTable
;
172 OUString maCellContent
;
177 SchXMLTableCellContext( SchXMLImportHelper
& rImpHelper
,
178 SvXMLImport
& rImport
,
179 const OUString
& rLocalName
,
180 SchXMLTable
& aTable
);
181 virtual ~SchXMLTableCellContext();
183 virtual SvXMLImportContext
* CreateChildContext(
185 const OUString
& rLocalName
,
186 const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
187 virtual void StartElement( const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
188 virtual void EndElement() SAL_OVERRIDE
;
191 #endif // INCLUDED_XMLOFF_SOURCE_CHART_SCHXMLTABLECONTEXT_HXX
193 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */