Avoid potential negative array index access to cached text.
[LibreOffice.git] / chart2 / source / inc / ChartType.hxx
blob267d06f406dee5dd2ccad79d3c2307200b72c13b
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>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/chart2/XChartType.hpp>
26 #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
27 #include <com/sun/star/util/XCloneable.hpp>
28 #include <com/sun/star/util/XModifyBroadcaster.hpp>
29 #include <com/sun/star/util/XModifyListener.hpp>
30 #include <rtl/ref.hxx>
32 #include <vector>
33 #include "charttoolsdllapi.hxx"
35 namespace chart
37 class BaseCoordinateSystem;
38 class DataSeries;
39 class ModifyEventForwarder;
41 enum
43 PROP_PIECHARTTYPE_USE_RINGS,
44 PROP_PIECHARTTYPE_3DRELATIVEHEIGHT
49 namespace impl
51 typedef ::cppu::WeakImplHelper<
52 css::lang::XServiceInfo,
53 css::chart2::XChartType,
54 css::chart2::XDataSeriesContainer,
55 css::util::XCloneable,
56 css::util::XModifyBroadcaster,
57 css::util::XModifyListener >
58 ChartType_Base;
61 class OOO_DLLPUBLIC_CHARTTOOLS ChartType :
62 public impl::ChartType_Base,
63 public ::property::OPropertySet
65 public:
66 explicit ChartType();
67 virtual ~ChartType() override;
69 /// merge XInterface implementations
70 DECLARE_XINTERFACE()
72 explicit ChartType( const ChartType & rOther );
74 // ____ XChartType ____
75 // still abstract ! implement !
76 virtual OUString SAL_CALL getChartType() override = 0;
77 virtual css::uno::Reference< css::chart2::XCoordinateSystem > SAL_CALL
78 createCoordinateSystem( ::sal_Int32 DimensionCount ) final override;
79 virtual css::uno::Sequence< OUString > SAL_CALL
80 getSupportedMandatoryRoles() override;
81 virtual css::uno::Sequence< OUString > SAL_CALL
82 getSupportedOptionalRoles() override;
83 virtual OUString SAL_CALL getRoleOfSequenceForSeriesLabel() override;
84 virtual css::uno::Sequence< OUString > SAL_CALL
85 getSupportedPropertyRoles() override;
87 // ____ XDataSeriesContainer ____
88 virtual void SAL_CALL addDataSeries(
89 const css::uno::Reference< css::chart2::XDataSeries >& aDataSeries ) override;
90 virtual void SAL_CALL removeDataSeries(
91 const css::uno::Reference< css::chart2::XDataSeries >& aDataSeries ) override;
92 virtual css::uno::Sequence< css::uno::Reference< css::chart2::XDataSeries > > SAL_CALL getDataSeries() override;
93 virtual void SAL_CALL setDataSeries(
94 const css::uno::Sequence< css::uno::Reference< css::chart2::XDataSeries > >& aDataSeries ) override;
96 // ____ XModifyBroadcaster ____
97 virtual void SAL_CALL addModifyListener(
98 const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
99 virtual void SAL_CALL removeModifyListener(
100 const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
102 virtual rtl::Reference<ChartType> cloneChartType() const = 0;
104 void addDataSeries(
105 const rtl::Reference< ::chart::DataSeries >& aDataSeries );
106 void removeDataSeries(
107 const rtl::Reference< ::chart::DataSeries >& aDataSeries );
108 void setDataSeries(
109 const std::vector< rtl::Reference< ::chart::DataSeries > >& aDataSeries );
110 const std::vector< rtl::Reference< ::chart::DataSeries > > & getDataSeries2() const { return m_aDataSeries; }
112 virtual rtl::Reference< ::chart::BaseCoordinateSystem >
113 createCoordinateSystem2( sal_Int32 DimensionCount );
115 protected:
117 // ____ XModifyListener ____
118 virtual void SAL_CALL modified(
119 const css::lang::EventObject& aEvent ) override;
121 // ____ XEventListener (base of XModifyListener) ____
122 virtual void SAL_CALL disposing(
123 const css::lang::EventObject& Source ) override;
125 void fireModifyEvent();
127 // ____ OPropertySet ____
128 virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override;
129 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
131 virtual void firePropertyChangeEvent() override;
132 using OPropertySet::disposing;
134 // ____ XPropertySet ____
135 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
136 getPropertySetInfo() override;
138 /// merge XTypeProvider implementations
139 DECLARE_XTYPEPROVIDER()
141 protected:
142 rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder;
144 private:
145 void impl_addDataSeriesWithoutNotification(
146 const rtl::Reference< ::chart::DataSeries >& aDataSeries );
148 private:
149 typedef
150 std::vector< rtl::Reference< ::chart::DataSeries > > tDataSeriesContainerType;
152 // --- mutable members: the following members need mutex guard ---
154 tDataSeriesContainerType m_aDataSeries;
156 bool m_bNotifyChanges;
159 } // namespace chart
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */