fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / inc / CachedDataSequence.hxx
blob8119695628dacaba177bd38c8b349392774fb0f7
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 #ifndef INCLUDED_CHART2_SOURCE_INC_CACHEDDATASEQUENCE_HXX
20 #define INCLUDED_CHART2_SOURCE_INC_CACHEDDATASEQUENCE_HXX
22 // helper classes
23 #include <cppuhelper/compbase7.hxx>
24 #include <comphelper/uno3.hxx>
25 #include <comphelper/broadcasthelper.hxx>
26 #include <comphelper/propertycontainer.hxx>
27 #include <comphelper/proparrhlp.hxx>
29 // interfaces and types
30 #include <com/sun/star/lang/XServiceInfo.hpp>
31 #include <com/sun/star/lang/XInitialization.hpp>
32 #include <com/sun/star/beans/XPropertySet.hpp>
33 #include <com/sun/star/uno/XComponentContext.hpp>
34 #include <com/sun/star/chart2/data/XDataSequence.hpp>
35 #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
36 #include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
37 #include <com/sun/star/util/XCloneable.hpp>
38 #include <com/sun/star/util/XModifyBroadcaster.hpp>
40 #include <vector>
42 namespace chart
45 namespace impl
47 typedef ::cppu::WeakComponentImplHelper7<
48 ::com::sun::star::chart2::data::XDataSequence,
49 ::com::sun::star::chart2::data::XNumericalDataSequence,
50 ::com::sun::star::chart2::data::XTextualDataSequence,
51 ::com::sun::star::util::XCloneable,
52 ::com::sun::star::util::XModifyBroadcaster,
53 ::com::sun::star::lang::XInitialization,
54 ::com::sun::star::lang::XServiceInfo >
55 CachedDataSequence_Base;
58 /**
59 * This sequence object does store actual values within, hence "cached".
61 class CachedDataSequence :
62 public ::comphelper::OMutexAndBroadcastHelper,
63 public ::comphelper::OPropertyContainer,
64 public ::comphelper::OPropertyArrayUsageHelper< CachedDataSequence >,
65 public impl::CachedDataSequence_Base
67 public:
68 /** constructs an empty sequence
70 CachedDataSequence();
72 explicit CachedDataSequence(
73 const ::com::sun::star::uno::Reference<
74 ::com::sun::star::uno::XComponentContext > & xContext );
76 /** creates a sequence and initializes it with the given string. This is
77 especially useful for labels, which only have one element.
79 explicit CachedDataSequence( const OUString & rSingleText );
81 /// Copy CTOR
82 explicit CachedDataSequence( const CachedDataSequence & rSource );
84 virtual ~CachedDataSequence();
86 /// establish methods for factory instatiation
87 static css::uno::Reference< css::uno::XInterface > SAL_CALL create( css::uno::Reference< css::uno::XComponentContext > const & xContext)
88 throw(css::uno::Exception)
90 return (::cppu::OWeakObject *)new CachedDataSequence( xContext );
92 /// declare XServiceInfo methods
93 virtual OUString SAL_CALL getImplementationName()
94 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
95 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
96 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
97 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
98 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
100 static OUString getImplementationName_Static();
101 static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
103 /// merge XInterface implementations
104 DECLARE_XINTERFACE()
105 /// merge XTypeProvider implementations
106 DECLARE_XTYPEPROVIDER()
108 protected:
109 // ____ XPropertySet ____
110 /// @see ::com::sun::star::beans::XPropertySet
111 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo()
112 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
113 /// @see ::comphelper::OPropertySetHelper
114 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
115 /// @see ::comphelper::OPropertyArrayUsageHelper
116 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const SAL_OVERRIDE;
118 // ____ XDataSequence ____
119 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getData()
120 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
121 virtual OUString SAL_CALL getSourceRangeRepresentation()
122 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
123 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL generateLabel(
124 ::com::sun::star::chart2::data::LabelOrigin nLabelOrigin )
125 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
126 virtual ::sal_Int32 SAL_CALL getNumberFormatKeyByIndex( ::sal_Int32 nIndex )
127 throw (::com::sun::star::lang::IndexOutOfBoundsException,
128 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
130 // ____ XNumericalDataSequence ____
131 /// @see ::com::sun::star::chart::data::XNumericalDataSequence
132 virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getNumericalData() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
134 // ____ XTextualDataSequence ____
135 /// @see ::com::sun::star::chart::data::XTextualDataSequence
136 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getTextualData() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
138 // ____ XCloneable ____
139 virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
140 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
142 // ____ XModifyBroadcaster ____
143 virtual void SAL_CALL addModifyListener(
144 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
145 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
146 virtual void SAL_CALL removeModifyListener(
147 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
148 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
150 // ::com::sun::star::lang::XInitialization:
151 virtual void SAL_CALL initialize(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > & aArguments)
152 throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
154 // <properties>
155 sal_Int32 m_nNumberFormatKey;
156 OUString m_sRole;
157 // </properties>
159 enum DataType
161 NUMERICAL,
162 TEXTUAL,
163 MIXED
166 /** This method registers all properties. It should be called by all
167 constructors.
169 void registerProperties();
171 private:
172 /** is used by interface method getNumericalData().
174 ::com::sun::star::uno::Sequence< double > Impl_getNumericalData() const;
175 /** is used by interface method getTextualData().
177 ::com::sun::star::uno::Sequence< OUString > Impl_getTextualData() const;
178 /** is used by interface method getData().
180 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > Impl_getMixedData() const;
182 private:
183 enum DataType m_eCurrentDataType;
185 ::com::sun::star::uno::Sequence< double > m_aNumericalSequence;
186 ::com::sun::star::uno::Sequence< OUString > m_aTextualSequence;
187 ::com::sun::star::uno::Sequence<
188 ::com::sun::star::uno::Any > m_aMixedSequence;
189 ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >
190 m_xModifyEventForwarder;
193 } // namespace chart
195 // INCLUDED_CHART2_SOURCE_INC_CACHEDDATASEQUENCE_HXX
196 #endif
198 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */