Update ooo320-m1
[ooovba.git] / chart2 / source / inc / UncachedDataSequence.hxx
blob3b215d6111b868a2f024d01ed1e5c51924356912
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: UncachedDataSequence.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _CHART_UNCACHEDDATASEQUENCE_HXX
31 #define _CHART_UNCACHEDDATASEQUENCE_HXX
33 // helper classes
34 #include <cppuhelper/compbase8.hxx>
35 #include <comphelper/uno3.hxx>
36 #include <comphelper/broadcasthelper.hxx>
37 #include <comphelper/propertycontainer.hxx>
38 #include <comphelper/proparrhlp.hxx>
39 #include "ServiceMacros.hxx"
40 #include "charttoolsdllapi.hxx"
42 // interfaces and types
43 #include <com/sun/star/lang/XServiceInfo.hpp>
44 #include <com/sun/star/beans/XPropertySet.hpp>
45 #include <com/sun/star/uno/XComponentContext.hpp>
46 #include <com/sun/star/chart2/XInternalDataProvider.hpp>
47 #include <com/sun/star/chart2/data/XDataSequence.hpp>
48 #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
49 #include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
50 #include <com/sun/star/container/XIndexReplace.hpp>
51 #include <com/sun/star/container/XNamed.hpp>
52 #include <com/sun/star/util/XCloneable.hpp>
53 #include <com/sun/star/util/XModifyBroadcaster.hpp>
54 #include <com/sun/star/util/XModifiable.hpp>
56 #include <vector>
58 // ____________________
59 namespace chart
62 namespace impl
64 typedef ::cppu::WeakComponentImplHelper8<
65 ::com::sun::star::chart2::data::XDataSequence,
66 ::com::sun::star::chart2::data::XNumericalDataSequence,
67 ::com::sun::star::chart2::data::XTextualDataSequence,
68 ::com::sun::star::util::XCloneable,
69 ::com::sun::star::util::XModifiable, // contains util::XModifyBroadcaster
70 ::com::sun::star::container::XIndexReplace,
71 ::com::sun::star::container::XNamed, // for setting a new range representation
72 ::com::sun::star::lang::XServiceInfo >
73 UncachedDataSequence_Base;
76 class UncachedDataSequence :
77 public ::comphelper::OMutexAndBroadcastHelper,
78 public ::comphelper::OPropertyContainer,
79 public ::comphelper::OPropertyArrayUsageHelper< UncachedDataSequence >,
80 public impl::UncachedDataSequence_Base
82 public:
83 /** The referring data provider is held as uno reference to ensure its
84 lifetime is at least as long as the one of this object.
86 UncachedDataSequence(
87 const ::com::sun::star::uno::Reference<
88 ::com::sun::star::chart2::XInternalDataProvider > & xIntDataProv,
89 const ::rtl::OUString & rRangeRepresentation );
90 UncachedDataSequence(
91 const ::com::sun::star::uno::Reference<
92 ::com::sun::star::chart2::XInternalDataProvider > & xIntDataProv,
93 const ::rtl::OUString & rRangeRepresentation,
94 const ::rtl::OUString & rRole );
95 UncachedDataSequence( const UncachedDataSequence & rSource );
96 virtual ~UncachedDataSequence();
98 /// declare XServiceInfo methods
99 APPHELPER_XSERVICEINFO_DECL()
101 /// merge XInterface implementations
102 DECLARE_XINTERFACE()
103 /// merge XTypeProvider implementations
104 DECLARE_XTYPEPROVIDER()
106 protected:
107 // ____ XPropertySet ____
108 /// @see ::com::sun::star::beans::XPropertySet
109 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo()
110 throw (::com::sun::star::uno::RuntimeException);
111 /// @see ::comphelper::OPropertySetHelper
112 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
113 /// @see ::comphelper::OPropertyArrayUsageHelper
114 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
116 // ____ XDataSequence ____
117 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getData()
118 throw (::com::sun::star::uno::RuntimeException);
119 virtual ::rtl::OUString SAL_CALL getSourceRangeRepresentation()
120 throw (::com::sun::star::uno::RuntimeException);
121 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL generateLabel(
122 ::com::sun::star::chart2::data::LabelOrigin nLabelOrigin )
123 throw (::com::sun::star::uno::RuntimeException);
124 virtual ::sal_Int32 SAL_CALL getNumberFormatKeyByIndex( ::sal_Int32 nIndex )
125 throw (::com::sun::star::lang::IndexOutOfBoundsException,
126 ::com::sun::star::uno::RuntimeException);
128 // ____ XNumericalDataSequence ____
129 /// @see ::com::sun::star::chart::data::XNumericalDataSequence
130 virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getNumericalData() throw (::com::sun::star::uno::RuntimeException);
132 // ____ XTextualDataSequence ____
133 /// @see ::com::sun::star::chart::data::XTextualDataSequence
134 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getTextualData() throw (::com::sun::star::uno::RuntimeException);
136 // ____ XIndexReplace ____
137 virtual void SAL_CALL replaceByIndex( ::sal_Int32 Index, const ::com::sun::star::uno::Any& Element )
138 throw (::com::sun::star::lang::IllegalArgumentException,
139 ::com::sun::star::lang::IndexOutOfBoundsException,
140 ::com::sun::star::lang::WrappedTargetException,
141 ::com::sun::star::uno::RuntimeException);
143 // ____ XIndexAccess (base of XIndexReplace) ____
144 virtual ::sal_Int32 SAL_CALL getCount()
145 throw (::com::sun::star::uno::RuntimeException);
146 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index )
147 throw (::com::sun::star::lang::IndexOutOfBoundsException,
148 ::com::sun::star::lang::WrappedTargetException,
149 ::com::sun::star::uno::RuntimeException);
151 // ____ XElementAccess (base of XIndexAccess) ____
152 virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
153 throw (::com::sun::star::uno::RuntimeException);
154 virtual ::sal_Bool SAL_CALL hasElements()
155 throw (::com::sun::star::uno::RuntimeException);
157 // ____ XNamed (for setting a new range representation) ____
158 virtual ::rtl::OUString SAL_CALL getName()
159 throw (::com::sun::star::uno::RuntimeException);
160 virtual void SAL_CALL setName( const ::rtl::OUString& aName )
161 throw (::com::sun::star::uno::RuntimeException);
163 // ____ XCloneable ____
164 virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
165 throw (::com::sun::star::uno::RuntimeException);
167 // ____ XModifiable ____
168 virtual ::sal_Bool SAL_CALL isModified()
169 throw (::com::sun::star::uno::RuntimeException);
170 virtual void SAL_CALL setModified( ::sal_Bool bModified )
171 throw (::com::sun::star::beans::PropertyVetoException,
172 ::com::sun::star::uno::RuntimeException);
174 // ____ XModifyBroadcaster (base of XModifiable) ____
175 virtual void SAL_CALL addModifyListener(
176 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
177 throw (::com::sun::star::uno::RuntimeException);
178 virtual void SAL_CALL removeModifyListener(
179 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
180 throw (::com::sun::star::uno::RuntimeException);
182 void fireModifyEvent();
184 mutable ::osl::Mutex m_aMutex;
186 // <properties>
187 sal_Int32 m_nNumberFormatKey;
188 ::rtl::OUString m_sRole;
189 ::rtl::OUString m_aXMLRange;
190 // </properties>
192 /** This method registers all properties. It should be called by all
193 constructors.
195 void registerProperties();
197 private:
198 ::com::sun::star::uno::Reference<
199 ::com::sun::star::chart2::XInternalDataProvider > m_xDataProvider;
200 ::rtl::OUString m_aSourceRepresentation;
201 ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >
202 m_xModifyEventForwarder;
205 } // namespace chart
208 // _CHART_UNCACHEDDATASEQUENCE_HXX
209 #endif