xref: /trunk/main/sc/source/core/inc/addinlis.hxx (revision 38d50f7b)
1*38d50f7bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*38d50f7bSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*38d50f7bSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*38d50f7bSAndrew Rist  * distributed with this work for additional information
6*38d50f7bSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*38d50f7bSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*38d50f7bSAndrew Rist  * "License"); you may not use this file except in compliance
9*38d50f7bSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*38d50f7bSAndrew Rist  *
11*38d50f7bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*38d50f7bSAndrew Rist  *
13*38d50f7bSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*38d50f7bSAndrew Rist  * software distributed under the License is distributed on an
15*38d50f7bSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*38d50f7bSAndrew Rist  * KIND, either express or implied.  See the License for the
17*38d50f7bSAndrew Rist  * specific language governing permissions and limitations
18*38d50f7bSAndrew Rist  * under the License.
19*38d50f7bSAndrew Rist  *
20*38d50f7bSAndrew Rist  *************************************************************/
21*38d50f7bSAndrew Rist 
22*38d50f7bSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SC_ADDINLIS_HXX
25cdf0e10cSrcweir #define SC_ADDINLIS_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "adiasync.hxx"			// for ScAddInDocs PtrArr
28cdf0e10cSrcweir #include <tools/list.hxx>
29cdf0e10cSrcweir #include <com/sun/star/sheet/XResultListener.hpp>
30cdf0e10cSrcweir #include <com/sun/star/sheet/XVolatileResult.hpp>
31cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
32cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir 
35cdf0e10cSrcweir 
36cdf0e10cSrcweir class ScDocument;
37cdf0e10cSrcweir 
38cdf0e10cSrcweir 
39cdf0e10cSrcweir class ScAddInListener : public cppu::WeakImplHelper2<
40cdf0e10cSrcweir 							com::sun::star::sheet::XResultListener,
41cdf0e10cSrcweir 							com::sun::star::lang::XServiceInfo >,
42cdf0e10cSrcweir 						public SvtBroadcaster
43cdf0e10cSrcweir {
44cdf0e10cSrcweir private:
45cdf0e10cSrcweir 	com::sun::star::uno::Reference<com::sun::star::sheet::XVolatileResult> xVolRes;
46cdf0e10cSrcweir 	com::sun::star::uno::Any	aResult;
47cdf0e10cSrcweir 	ScAddInDocs*				pDocs;			// documents where this is used
48cdf0e10cSrcweir 
49cdf0e10cSrcweir 	static List					aAllListeners;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 							// always allocated via CreateListener
52cdf0e10cSrcweir 							ScAddInListener(
53cdf0e10cSrcweir 								com::sun::star::uno::Reference<
54cdf0e10cSrcweir 									com::sun::star::sheet::XVolatileResult> xVR,
55cdf0e10cSrcweir 								ScDocument* pD );
56cdf0e10cSrcweir 
57cdf0e10cSrcweir public:
58cdf0e10cSrcweir 	virtual					~ScAddInListener();
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 							// create Listener and put it into global list
61cdf0e10cSrcweir 	static ScAddInListener*	CreateListener(
62cdf0e10cSrcweir 								com::sun::star::uno::Reference<
63cdf0e10cSrcweir 									com::sun::star::sheet::XVolatileResult> xVR,
64cdf0e10cSrcweir 								ScDocument* pDoc );
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 	static ScAddInListener*	Get( com::sun::star::uno::Reference<
67cdf0e10cSrcweir 									com::sun::star::sheet::XVolatileResult> xVR );
68cdf0e10cSrcweir 	static void				RemoveDocument( ScDocument* pDocument );
69cdf0e10cSrcweir 
HasDocument(ScDocument * pDoc) const70cdf0e10cSrcweir 	sal_Bool					HasDocument( ScDocument* pDoc ) const	{ return pDocs->Seek_Entry( pDoc ); }
AddDocument(ScDocument * pDoc)71cdf0e10cSrcweir 	void					AddDocument( ScDocument* pDoc )			{ pDocs->Insert( pDoc ); }
GetResult() const72cdf0e10cSrcweir 	const com::sun::star::uno::Any& GetResult() const				{ return aResult; }
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 							// XResultListener
76cdf0e10cSrcweir 	virtual void SAL_CALL	modified( const ::com::sun::star::sheet::ResultEvent& aEvent )
77cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 							// XEventListener
80cdf0e10cSrcweir 	virtual void SAL_CALL	disposing( const ::com::sun::star::lang::EventObject& Source )
81cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 							// XServiceInfo
84cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getImplementationName(  )
85cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
86cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
87cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
88cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  )
89cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
90cdf0e10cSrcweir };
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 
93cdf0e10cSrcweir #endif
94cdf0e10cSrcweir 
95