Bump for 3.6-28
[LibreOffice.git] / chart2 / source / inc / CachedDataSequence.hxx
bloba20411115bfc04fc350d9fff1ba84a44b329c8e7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
28 #ifndef _CHART_CACHEDDATASEQUENCE_HXX
29 #define _CHART_CACHEDDATASEQUENCE_HXX
31 // helper classes
32 #include <cppuhelper/compbase7.hxx>
33 #include <comphelper/uno3.hxx>
34 #include <comphelper/broadcasthelper.hxx>
35 #include <comphelper/propertycontainer.hxx>
36 #include <comphelper/proparrhlp.hxx>
37 #include "ServiceMacros.hxx"
39 // interfaces and types
40 #include <com/sun/star/lang/XServiceInfo.hpp>
41 #include <com/sun/star/lang/XInitialization.hpp>
42 #include <com/sun/star/beans/XPropertySet.hpp>
43 #include <com/sun/star/uno/XComponentContext.hpp>
44 #include <com/sun/star/chart2/data/XDataSequence.hpp>
45 #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
46 #include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
47 #include <com/sun/star/util/XCloneable.hpp>
48 #include <com/sun/star/util/XModifyBroadcaster.hpp>
50 #include <vector>
52 // ____________________
53 namespace chart
56 namespace impl
58 typedef ::cppu::WeakComponentImplHelper7<
59 ::com::sun::star::chart2::data::XDataSequence,
60 ::com::sun::star::chart2::data::XNumericalDataSequence,
61 ::com::sun::star::chart2::data::XTextualDataSequence,
62 ::com::sun::star::util::XCloneable,
63 ::com::sun::star::util::XModifyBroadcaster,
64 ::com::sun::star::lang::XInitialization,
65 ::com::sun::star::lang::XServiceInfo >
66 CachedDataSequence_Base;
69 class CachedDataSequence :
70 public ::comphelper::OMutexAndBroadcastHelper,
71 public ::comphelper::OPropertyContainer,
72 public ::comphelper::OPropertyArrayUsageHelper< CachedDataSequence >,
73 public impl::CachedDataSequence_Base
75 public:
76 /** constructs an empty sequence
78 CachedDataSequence();
80 explicit CachedDataSequence(
81 const ::com::sun::star::uno::Reference<
82 ::com::sun::star::uno::XComponentContext > & xContext );
84 /** creates a sequence and initializes it with the given string. This is
85 especially useful for labels, which only have one element.
87 explicit CachedDataSequence( const ::rtl::OUString & rSingleText );
89 /// Copy CTOR
90 explicit CachedDataSequence( const CachedDataSequence & rSource );
92 virtual ~CachedDataSequence();
94 /// establish methods for factory instatiation
95 APPHELPER_SERVICE_FACTORY_HELPER( CachedDataSequence )
96 /// declare XServiceInfo methods
97 APPHELPER_XSERVICEINFO_DECL()
99 /// merge XInterface implementations
100 DECLARE_XINTERFACE()
101 /// merge XTypeProvider implementations
102 DECLARE_XTYPEPROVIDER()
104 protected:
105 // ____ XPropertySet ____
106 /// @see ::com::sun::star::beans::XPropertySet
107 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo()
108 throw (::com::sun::star::uno::RuntimeException);
109 /// @see ::comphelper::OPropertySetHelper
110 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
111 /// @see ::comphelper::OPropertyArrayUsageHelper
112 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
114 // ____ XDataSequence ____
115 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getData()
116 throw (::com::sun::star::uno::RuntimeException);
117 virtual ::rtl::OUString SAL_CALL getSourceRangeRepresentation()
118 throw (::com::sun::star::uno::RuntimeException);
119 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL generateLabel(
120 ::com::sun::star::chart2::data::LabelOrigin nLabelOrigin )
121 throw (::com::sun::star::uno::RuntimeException);
122 virtual ::sal_Int32 SAL_CALL getNumberFormatKeyByIndex( ::sal_Int32 nIndex )
123 throw (::com::sun::star::lang::IndexOutOfBoundsException,
124 ::com::sun::star::uno::RuntimeException);
126 // ____ XNumericalDataSequence ____
127 /// @see ::com::sun::star::chart::data::XNumericalDataSequence
128 virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getNumericalData() throw (::com::sun::star::uno::RuntimeException);
130 // ____ XTextualDataSequence ____
131 /// @see ::com::sun::star::chart::data::XTextualDataSequence
132 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getTextualData() throw (::com::sun::star::uno::RuntimeException);
134 // ____ XCloneable ____
135 virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
136 throw (::com::sun::star::uno::RuntimeException);
138 // ____ XModifyBroadcaster ____
139 virtual void SAL_CALL addModifyListener(
140 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
141 throw (::com::sun::star::uno::RuntimeException);
142 virtual void SAL_CALL removeModifyListener(
143 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
144 throw (::com::sun::star::uno::RuntimeException);
146 // ::com::sun::star::lang::XInitialization:
147 virtual void SAL_CALL initialize(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > & aArguments)
148 throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::uno::Exception);
150 // <properties>
151 sal_Int32 m_nNumberFormatKey;
152 ::rtl::OUString m_sRole;
153 // </properties>
155 enum DataType
157 NUMERICAL,
158 TEXTUAL,
159 MIXED
162 /** This method registers all properties. It should be called by all
163 constructors.
165 void registerProperties();
167 private:
168 /** is used by interface method getNumericalData().
170 ::com::sun::star::uno::Sequence< double > Impl_getNumericalData() const;
171 /** is used by interface method getTextualData().
173 ::com::sun::star::uno::Sequence< ::rtl::OUString > Impl_getTextualData() const;
174 /** is used by interface method getData().
176 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > Impl_getMixedData() const;
178 private:
179 enum DataType m_eCurrentDataType;
181 ::com::sun::star::uno::Sequence< double > m_aNumericalSequence;
182 ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aTextualSequence;
183 ::com::sun::star::uno::Sequence<
184 ::com::sun::star::uno::Any > m_aMixedSequence;
185 ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >
186 m_xModifyEventForwarder;
189 } // namespace chart
192 // _CHART_CACHEDDATASEQUENCE_HXX
193 #endif
195 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */