Avoid potential negative array index access to cached text.
[LibreOffice.git] / chart2 / source / inc / Axis.hxx
blob902a67487cf548a0852cdab1ad9c91dc90118c1c
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 "OPropertySet.hxx"
22 #include <cppuhelper/implbase.hxx>
23 #include <comphelper/uno3.hxx>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/chart2/XAxis.hpp>
27 #include <com/sun/star/chart2/XTitled.hpp>
28 #include <com/sun/star/util/XCloneable.hpp>
29 #include "ModifyListenerHelper.hxx"
30 #include "charttoolsdllapi.hxx"
31 #include "PropertyHelper.hxx"
33 namespace chart
35 class GridProperties;
36 class Title;
38 namespace impl
40 typedef ::cppu::WeakImplHelper<
41 css::chart2::XAxis,
42 css::chart2::XTitled,
43 css::lang::XServiceInfo,
44 css::util::XCloneable,
45 css::util::XModifyBroadcaster,
46 css::util::XModifyListener >
47 Axis_Base;
50 class OOO_DLLPUBLIC_CHARTTOOLS Axis final :
51 public impl::Axis_Base,
52 public ::property::OPropertySet
54 public:
55 explicit Axis();
56 virtual ~Axis() override;
58 /// XServiceInfo declarations
59 virtual OUString SAL_CALL getImplementationName() override;
60 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
61 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
63 /// merge XInterface implementations
64 DECLARE_XINTERFACE()
65 /// merge XTypeProvider implementations
66 DECLARE_XTYPEPROVIDER()
68 private:
69 explicit Axis( const Axis & rOther );
71 // late initialization to call after copy-constructing
72 void Init();
74 // ____ OPropertySet ____
75 virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
77 // ____ OPropertySet ____
78 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
80 public:
81 // ____ XPropertySet ____
82 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
83 getPropertySetInfo() override;
85 // ____ XAxis ____
86 virtual void SAL_CALL setScaleData( const css::chart2::ScaleData& rScaleData ) override;
87 virtual css::chart2::ScaleData SAL_CALL getScaleData() override;
88 virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getGridProperties() override;
89 virtual css::uno::Sequence< css::uno::Reference< css::beans::XPropertySet > > SAL_CALL getSubGridProperties() override;
90 virtual css::uno::Sequence< css::uno::Reference< css::beans::XPropertySet > > SAL_CALL getSubTickProperties() override;
92 // ____ XTitled ____
93 virtual css::uno::Reference< css::chart2::XTitle > SAL_CALL getTitleObject() override;
94 virtual void SAL_CALL setTitleObject(
95 const css::uno::Reference< css::chart2::XTitle >& Title ) override;
97 // ____ XCloneable ____
98 // Note: the coordinate systems are not cloned!
99 virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override;
101 // ____ XModifyBroadcaster ____
102 virtual void SAL_CALL addModifyListener(
103 const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
104 virtual void SAL_CALL removeModifyListener(
105 const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
107 rtl::Reference< ::chart::Title > getTitleObject2() const;
108 void setTitleObject( const rtl::Reference< ::chart::Title >& xNewTitle );
110 rtl::Reference< ::chart::GridProperties > getGridProperties2();
111 std::vector< rtl::Reference< ::chart::GridProperties > > getSubGridProperties2();
113 private:
114 // ____ XModifyListener ____
115 virtual void SAL_CALL modified(
116 const css::lang::EventObject& aEvent ) override;
118 // ____ XEventListener (base of XModifyListener) ____
119 virtual void SAL_CALL disposing(
120 const css::lang::EventObject& Source ) override;
122 // ____ OPropertySet ____
123 virtual void firePropertyChangeEvent() override;
124 using OPropertySet::disposing;
126 void fireModifyEvent();
128 void AllocateSubGrids();
130 rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder;
132 css::chart2::ScaleData m_aScaleData;
134 rtl::Reference< ::chart::GridProperties > m_xGrid;
136 std::vector< rtl::Reference< ::chart::GridProperties > > m_aSubGridProperties;
138 rtl::Reference< ::chart::Title > m_xTitle;
141 OOO_DLLPUBLIC_CHARTTOOLS const ::chart::tPropertyValueMap & StaticAxisDefaults();
143 } // namespace chart
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */