Avoid potential negative array index access to cached text.
[LibreOffice.git] / xmloff / source / chart / SchXMLAxisContext.hxx
blobf128edeab461b2bb83aa65456e762f2c24752856
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/SchXMLImportHelper.hxx>
22 #include <xmloff/xmlictxt.hxx>
24 #include "transporttypes.hxx"
26 #include <com/sun/star/chart/XDiagram.hpp>
27 #include <com/sun/star/xml/sax/XAttributeList.hpp>
29 class SchXMLAxisContext : public SvXMLImportContext
31 public:
32 SchXMLAxisContext( SchXMLImportHelper& rImpHelper,
33 SvXMLImport& rImport,
34 css::uno::Reference< css::chart::XDiagram > const & xDiagram,
35 std::vector< SchXMLAxis >& aAxes,
36 OUString& rCategoriesAddress,
37 bool bAddMissingXAxisForNetCharts,
38 bool bAdaptWrongPercentScaleValues,
39 bool bAdaptXAxisOrientationForOld2DBarCharts,
40 bool& rbAxisPositionAttributeImported );
41 virtual ~SchXMLAxisContext() override;
43 virtual void SAL_CALL startFastElement( sal_Int32 nElement,
44 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
45 virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
46 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
47 sal_Int32 nElement,
48 const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
50 static void CorrectAxisPositions( const css::uno::Reference< css::chart2::XChartDocument >& xNewDoc,
51 std::u16string_view rChartTypeServiceName,
52 std::u16string_view rODFVersionOfFile,
53 bool bAxisPositionAttributeImported );
55 private:
56 SchXMLImportHelper& m_rImportHelper;
57 css::uno::Reference< css::chart::XDiagram > m_xDiagram;
58 SchXMLAxis m_aCurrentAxis;
59 std::vector< SchXMLAxis >& m_rAxes;
60 css::uno::Reference< css::beans::XPropertySet > m_xAxisProps;
61 OUString m_aAutoStyleName;
62 OUString& m_rCategoriesAddress;
63 sal_Int32 m_nAxisType;//css::chart::ChartAxisType
64 bool m_bAxisTypeImported;
65 bool m_bDateScaleImported;
66 bool m_bAddMissingXAxisForNetCharts; //to correct errors from older versions
67 bool m_bAdaptWrongPercentScaleValues; //to correct errors from older versions
68 bool m_bAdaptXAxisOrientationForOld2DBarCharts; //to correct different behaviour from older versions
69 bool& m_rbAxisPositionAttributeImported;
71 css::uno::Reference< css::drawing::XShape > getTitleShape() const;
72 void CreateGrid( const OUString& sAutoStyleName, bool bIsMajor );
73 void CreateAxis();
74 void SetAxisTitle();
77 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */