1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: addinlis.hxx,v $
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 ************************************************************************/
31 #ifndef SC_ADDINLIS_HXX
32 #define SC_ADDINLIS_HXX
34 #include "adiasync.hxx" // for ScAddInDocs PtrArr
35 #include <tools/list.hxx>
36 #include <com/sun/star/sheet/XResultListener.hpp>
37 #include <com/sun/star/sheet/XVolatileResult.hpp>
38 #include <com/sun/star/lang/XServiceInfo.hpp>
39 #include <cppuhelper/implbase2.hxx>
46 class ScAddInListener
: public cppu::WeakImplHelper2
<
47 com::sun::star::sheet::XResultListener
,
48 com::sun::star::lang::XServiceInfo
>,
52 com::sun::star::uno::Reference
<com::sun::star::sheet::XVolatileResult
> xVolRes
;
53 com::sun::star::uno::Any aResult
;
54 ScAddInDocs
* pDocs
; // documents where this is used
56 static List aAllListeners
;
58 // always allocated via CreateListener
60 com::sun::star::uno::Reference
<
61 com::sun::star::sheet::XVolatileResult
> xVR
,
65 virtual ~ScAddInListener();
67 // create Listener and put it into global list
68 static ScAddInListener
* CreateListener(
69 com::sun::star::uno::Reference
<
70 com::sun::star::sheet::XVolatileResult
> xVR
,
73 static ScAddInListener
* Get( com::sun::star::uno::Reference
<
74 com::sun::star::sheet::XVolatileResult
> xVR
);
75 static void RemoveDocument( ScDocument
* pDocument
);
77 BOOL
HasDocument( ScDocument
* pDoc
) const { return pDocs
->Seek_Entry( pDoc
); }
78 void AddDocument( ScDocument
* pDoc
) { pDocs
->Insert( pDoc
); }
79 const com::sun::star::uno::Any
& GetResult() const { return aResult
; }
83 virtual void SAL_CALL
modified( const ::com::sun::star::sheet::ResultEvent
& aEvent
)
84 throw(::com::sun::star::uno::RuntimeException
);
87 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
)
88 throw(::com::sun::star::uno::RuntimeException
);
91 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
92 throw(::com::sun::star::uno::RuntimeException
);
93 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
94 throw(::com::sun::star::uno::RuntimeException
);
95 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames( )
96 throw(::com::sun::star::uno::RuntimeException
);