nss: upgrade to release 3.73
[LibreOffice.git] / scripting / source / provider / ActiveMSPList.hxx
bloba17286439e2fca36a0c86daea7abc90806ba513e
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 .
19 #ifndef INCLUDED_SCRIPTING_SOURCE_PROVIDER_ACTIVEMSPLIST_HXX
20 #define INCLUDED_SCRIPTING_SOURCE_PROVIDER_ACTIVEMSPLIST_HXX
22 #include <osl/mutex.hxx>
23 #include <rtl/ustring.hxx>
24 #include <cppuhelper/implbase.hxx>
26 #include <com/sun/star/lang/XEventListener.hpp>
28 #include <com/sun/star/script/provider/XScriptProvider.hpp>
29 #include <com/sun/star/document/XScriptInvocationContext.hpp>
30 #include <com/sun/star/uno/XComponentContext.hpp>
32 #include <map>
33 #include <unordered_map>
35 namespace func_provider
38 //Typedefs
39 typedef std::map < css::uno::Reference< css::uno::XInterface >
40 , css::uno::Reference< css::script::provider::XScriptProvider >
41 > ScriptComponent_map;
43 typedef std::unordered_map< OUString,
44 css::uno::Reference< css::script::provider::XScriptProvider > > Msp_hash;
46 class NonDocMSPCreator;
48 class ActiveMSPList : public ::cppu::WeakImplHelper< css::lang::XEventListener >
51 public:
53 explicit ActiveMSPList( const css::uno::Reference<
54 css::uno::XComponentContext > & xContext );
55 virtual ~ActiveMSPList() override;
57 css::uno::Reference< css::script::provider::XScriptProvider >
58 getMSPFromStringContext( const OUString& context );
60 css::uno::Reference< css::script::provider::XScriptProvider >
61 getMSPFromAnyContext( const css::uno::Any& context );
63 css::uno::Reference< css::script::provider::XScriptProvider >
64 getMSPFromInvocationContext( const css::uno::Reference< css::document::XScriptInvocationContext >& context );
66 //XEventListener
69 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
71 private:
72 void addActiveMSP( const css::uno::Reference< css::uno::XInterface >& xComponent,
73 const css::uno::Reference< css::script::provider::XScriptProvider >& msp );
74 css::uno::Reference< css::script::provider::XScriptProvider >
75 createNewMSP( const css::uno::Any& context );
76 css::uno::Reference< css::script::provider::XScriptProvider >
77 createNewMSP( const OUString& context )
79 return createNewMSP( css::uno::makeAny( context ) );
82 friend class NonDocMSPCreator;
83 void createNonDocMSPs();
85 Msp_hash m_hMsps;
86 ScriptComponent_map m_mScriptComponents;
87 osl::Mutex m_mutex;
88 OUString userDirString;
89 OUString shareDirString;
90 OUString bundledDirString;
91 css::uno::Reference< css::uno::XComponentContext > m_xContext;
93 } // func_provider
94 #endif
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */