Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
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.
15 : : *
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).
21 : : *
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.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_ADDINLIS_HXX
30 : : #define SC_ADDINLIS_HXX
31 : :
32 : : #include "adiasync.hxx" // for ScAddInDocs PtrArr
33 : : #include <com/sun/star/sheet/XResultListener.hpp>
34 : : #include <com/sun/star/sheet/XVolatileResult.hpp>
35 : : #include <com/sun/star/lang/XServiceInfo.hpp>
36 : : #include <cppuhelper/implbase2.hxx>
37 : :
38 : : class ScDocument;
39 : :
40 : : class ScAddInListener : public cppu::WeakImplHelper2<
41 : : com::sun::star::sheet::XResultListener,
42 : : com::sun::star::lang::XServiceInfo >,
43 : : public SvtBroadcaster
44 : : {
45 : : private:
46 : : com::sun::star::uno::Reference<com::sun::star::sheet::XVolatileResult> xVolRes;
47 : : com::sun::star::uno::Any aResult;
48 : : ScAddInDocs* pDocs; // documents where this is used
49 : :
50 : : static ::std::list<ScAddInListener*> aAllListeners;
51 : :
52 : : // always allocated via CreateListener
53 : : ScAddInListener( com::sun::star::uno::Reference<com::sun::star::sheet::XVolatileResult> xVR,
54 : : ScDocument* pD );
55 : :
56 : : public:
57 : : virtual ~ScAddInListener();
58 : :
59 : : // create Listener and put it into global list
60 : : static ScAddInListener* CreateListener(
61 : : com::sun::star::uno::Reference<com::sun::star::sheet::XVolatileResult> xVR,
62 : : ScDocument* pDoc );
63 : :
64 : : static ScAddInListener*Get( com::sun::star::uno::Reference<
65 : : com::sun::star::sheet::XVolatileResult> xVR );
66 : :
67 : : static void RemoveDocument( ScDocument* pDocument );
68 : :
69 : 0 : bool HasDocument( ScDocument* pDoc ) const
70 [ # # ]: 0 : { return pDocs->find( pDoc ) != pDocs->end(); }
71 : :
72 : 0 : void AddDocument( ScDocument* pDoc )
73 : 0 : { pDocs->insert( pDoc ); }
74 : :
75 : 0 : const com::sun::star::uno::Any& GetResult() const
76 : 0 : { return aResult; }
77 : :
78 : : // XResultListener
79 : : virtual void SAL_CALL modified( const ::com::sun::star::sheet::ResultEvent& aEvent )
80 : : throw(::com::sun::star::uno::RuntimeException);
81 : :
82 : : // XEventListener
83 : : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
84 : : throw(::com::sun::star::uno::RuntimeException);
85 : :
86 : : // XServiceInfo
87 : : virtual ::rtl::OUString SAL_CALL getImplementationName()
88 : : throw(::com::sun::star::uno::RuntimeException);
89 : :
90 : : virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
91 : : throw(::com::sun::star::uno::RuntimeException);
92 : :
93 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
94 : : throw(::com::sun::star::uno::RuntimeException);
95 : : };
96 : :
97 : : #endif // SC_ADDINLIS_HXX
98 : :
99 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|