Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / core / inc / addinlis.hxx
blobc2a702469e5397c392f09af12c9e191219e457f2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef SC_ADDINLIS_HXX
21 #define SC_ADDINLIS_HXX
23 #include "adiasync.hxx"
24 #include <com/sun/star/sheet/XResultListener.hpp>
25 #include <com/sun/star/sheet/XVolatileResult.hpp>
26 #include <com/sun/star/lang/XServiceInfo.hpp>
27 #include <cppuhelper/implbase2.hxx>
29 class ScDocument;
31 class ScAddInListener : public cppu::WeakImplHelper2<
32 com::sun::star::sheet::XResultListener,
33 com::sun::star::lang::XServiceInfo >,
34 public SvtBroadcaster
36 private:
37 com::sun::star::uno::Reference<com::sun::star::sheet::XVolatileResult> xVolRes;
38 com::sun::star::uno::Any aResult;
39 ScAddInDocs* pDocs; // documents where this is used
41 static ::std::list<ScAddInListener*> aAllListeners;
43 // always allocated via CreateListener
44 ScAddInListener( com::sun::star::uno::Reference<com::sun::star::sheet::XVolatileResult> xVR,
45 ScDocument* pD );
47 public:
48 virtual ~ScAddInListener();
50 // create Listener and put it into global list
51 static ScAddInListener* CreateListener(
52 com::sun::star::uno::Reference<com::sun::star::sheet::XVolatileResult> xVR,
53 ScDocument* pDoc );
55 static ScAddInListener*Get( com::sun::star::uno::Reference<
56 com::sun::star::sheet::XVolatileResult> xVR );
58 static void RemoveDocument( ScDocument* pDocument );
60 bool HasDocument( ScDocument* pDoc ) const
61 { return pDocs->find( pDoc ) != pDocs->end(); }
63 void AddDocument( ScDocument* pDoc )
64 { pDocs->insert( pDoc ); }
66 const com::sun::star::uno::Any& GetResult() const
67 { return aResult; }
69 // XResultListener
70 virtual void SAL_CALL modified( const ::com::sun::star::sheet::ResultEvent& aEvent )
71 throw(::com::sun::star::uno::RuntimeException);
73 // XEventListener
74 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
75 throw(::com::sun::star::uno::RuntimeException);
77 // XServiceInfo
78 virtual OUString SAL_CALL getImplementationName()
79 throw(::com::sun::star::uno::RuntimeException);
81 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
82 throw(::com::sun::star::uno::RuntimeException);
84 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
85 throw(::com::sun::star::uno::RuntimeException);
88 #endif // SC_ADDINLIS_HXX
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */