Avoid potential negative array index access to cached text.
[LibreOffice.git] / xmloff / source / chart / SchXMLTableContext.hxx
blobcd8a6443b17713bc094f3f7f1d2c14d8decc0200
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
21 #include <xmloff/xmlictxt.hxx>
22 #include <xmloff/SchXMLImportHelper.hxx>
23 #include <com/sun/star/uno/Sequence.hxx>
25 #include <com/sun/star/chart/ChartDataRowSource.hpp>
27 #include "transporttypes.hxx"
29 namespace com::sun::star {
30 namespace xml::sax {
31 class XAttributeList;
33 namespace chart {
34 class XChartDocument;
38 class SchXMLTableContext : public SvXMLImportContext
40 private:
41 SchXMLTable& mrTable;
43 bool mbHasRowPermutation;
44 bool mbHasColumnPermutation;
45 css::uno::Sequence< sal_Int32 > maRowPermutation;
46 css::uno::Sequence< sal_Int32 > maColumnPermutation;
48 public:
49 SchXMLTableContext( SvXMLImport& rImport,
50 SchXMLTable& aTable );
51 virtual ~SchXMLTableContext() override;
53 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
54 sal_Int32 nElement,
55 const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
56 virtual void SAL_CALL startFastElement(
57 sal_Int32 nElement,
58 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
59 virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
61 void setRowPermutation( const css::uno::Sequence< sal_Int32 > & rPermutation );
62 void setColumnPermutation( const css::uno::Sequence< sal_Int32 > & rPermutation );
65 class SchXMLTableHelper
67 public:
68 static void applyTableToInternalDataProvider( const SchXMLTable& rTable,
69 const css::uno::Reference< css::chart2::XChartDocument >& xChartDoc );
71 /** This function reorders local data to fit the correct data structure.
72 Call it after the data series got their styles set.
74 static void switchRangesFromOuterToInternalIfNecessary( const SchXMLTable& rTable,
75 const tSchXMLLSequencesPerIndex & rLSequencesPerIndex,
76 const css::uno::Reference< css::chart2::XChartDocument >& xChartDoc,
77 css::chart::ChartDataRowSource eDataRowSource );
80 // classes for columns
82 /** With this context all column elements are parsed to
83 determine the index of the column containing
84 the row descriptions and probably get an estimate
85 for the altogether number of columns
87 class SchXMLTableColumnsContext : public SvXMLImportContext
89 private:
90 SchXMLTable& mrTable;
92 public:
93 SchXMLTableColumnsContext( SvXMLImport& rImport,
94 SchXMLTable& aTable );
95 virtual ~SchXMLTableColumnsContext() override;
97 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
98 sal_Int32 nElement,
99 const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
102 class SchXMLTableColumnContext : public SvXMLImportContext
104 private:
105 SchXMLTable& mrTable;
107 public:
108 SchXMLTableColumnContext( SvXMLImport& rImport,
109 SchXMLTable& aTable );
110 virtual ~SchXMLTableColumnContext() override;
111 virtual void SAL_CALL startFastElement(
112 sal_Int32 nElement,
113 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
116 // classes for rows
118 class SchXMLTableRowsContext : public SvXMLImportContext
120 private:
121 SchXMLTable& mrTable;
123 public:
124 SchXMLTableRowsContext( SvXMLImport& rImport,
125 SchXMLTable& aTable );
126 virtual ~SchXMLTableRowsContext() override;
128 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
129 sal_Int32 nElement,
130 const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
133 class SchXMLTableRowContext : public SvXMLImportContext
135 private:
136 SchXMLTable& mrTable;
138 public:
139 SchXMLTableRowContext( SvXMLImport& rImport,
140 SchXMLTable& aTable );
141 virtual ~SchXMLTableRowContext() override;
143 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
144 sal_Int32 nElement,
145 const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
148 // classes for cells and their content
150 class SchXMLTableCellContext : public SvXMLImportContext
152 private:
153 SchXMLTable& mrTable;
154 OUString maCellContent;
155 OUString maRangeId;
156 bool mbReadText;
158 public:
159 SchXMLTableCellContext( SvXMLImport& rImport,
160 SchXMLTable& aTable );
161 virtual ~SchXMLTableCellContext() override;
163 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
164 sal_Int32 nElement,
165 const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
166 virtual void SAL_CALL startFastElement(
167 sal_Int32 nElement,
168 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
169 virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */