pyuno: call target only with internal python
[LibreOffice.git] / sc / source / core / inc / addinlis.hxx
blobd1cc7f3dd85ba6ccdbf33d4b3310647bd562830b
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 #pragma once
22 #include <memory>
23 #include "adiasync.hxx"
24 #include <com/sun/star/sheet/XResultListener.hpp>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <cppuhelper/implbase.hxx>
28 namespace com::sun::star::sheet { class XVolatileResult; }
29 namespace rtl { template <class reference_type> class Reference; }
31 class ScDocument;
33 class ScAddInListener final : public cppu::WeakImplHelper<
34 css::sheet::XResultListener,
35 css::lang::XServiceInfo >,
36 public SvtBroadcaster
38 private:
39 css::uno::Reference<css::sheet::XVolatileResult> xVolRes;
40 css::uno::Any aResult;
41 std::unique_ptr<ScAddInDocs> pDocs; // documents where this is used
43 static ::std::vector<rtl::Reference<ScAddInListener>> aAllListeners;
45 // always allocated via CreateListener
46 ScAddInListener( css::uno::Reference<css::sheet::XVolatileResult> xVR,
47 ScDocument* pD );
49 public:
50 virtual ~ScAddInListener() override;
52 // create Listener and put it into global list
53 static ScAddInListener* CreateListener(
54 const css::uno::Reference<css::sheet::XVolatileResult>& xVR,
55 ScDocument* pDoc );
57 static ScAddInListener* Get( const css::uno::Reference<css::sheet::XVolatileResult>& xVR );
59 static void RemoveDocument( ScDocument* pDocument );
61 bool HasDocument( ScDocument* pDoc ) const
62 { return pDocs->find( pDoc ) != pDocs->end(); }
64 void AddDocument( ScDocument* pDoc )
65 { pDocs->insert( pDoc ); }
67 const css::uno::Any& GetResult() const
68 { return aResult; }
70 // XResultListener
71 virtual void SAL_CALL modified( const css::sheet::ResultEvent& aEvent ) override;
73 // XEventListener
74 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
76 // XServiceInfo
77 virtual OUString SAL_CALL getImplementationName() override;
79 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
81 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */