tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / scripting / source / provider / ActiveMSPList.hxx
blobfb52629c1dd2d08e36d6b8f3f072e5a6f76dd18c
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 #pragma once
21 #include <osl/mutex.hxx>
22 #include <rtl/ustring.hxx>
23 #include <cppuhelper/implbase.hxx>
25 #include <com/sun/star/lang/XEventListener.hpp>
27 #include <com/sun/star/script/provider/XScriptProvider.hpp>
28 #include <com/sun/star/document/XScriptInvocationContext.hpp>
29 #include <com/sun/star/uno/XComponentContext.hpp>
31 #include <map>
32 #include <unordered_map>
34 namespace func_provider
37 //Typedefs
38 typedef std::map < css::uno::Reference< css::uno::XInterface >
39 , css::uno::Reference< css::script::provider::XScriptProvider >
40 > ScriptComponent_map;
42 typedef std::unordered_map< OUString,
43 css::uno::Reference< css::script::provider::XScriptProvider > > Msp_hash;
45 class NonDocMSPCreator;
47 class ActiveMSPList : public ::cppu::WeakImplHelper< css::lang::XEventListener >
50 public:
52 explicit ActiveMSPList( const css::uno::Reference<
53 css::uno::XComponentContext > & xContext );
54 virtual ~ActiveMSPList() override;
56 css::uno::Reference< css::script::provider::XScriptProvider >
57 getMSPFromStringContext( const OUString& context );
59 css::uno::Reference< css::script::provider::XScriptProvider >
60 getMSPFromAnyContext( const css::uno::Any& context );
62 css::uno::Reference< css::script::provider::XScriptProvider >
63 getMSPFromInvocationContext( const css::uno::Reference< css::document::XScriptInvocationContext >& context );
65 //XEventListener
68 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
70 private:
71 void addActiveMSP( const css::uno::Reference< css::uno::XInterface >& xComponent,
72 const css::uno::Reference< css::script::provider::XScriptProvider >& msp );
73 css::uno::Reference< css::script::provider::XScriptProvider >
74 createNewMSP( const css::uno::Any& context );
75 css::uno::Reference< css::script::provider::XScriptProvider >
76 createNewMSP( const OUString& context )
78 return createNewMSP( css::uno::Any( context ) );
81 friend class NonDocMSPCreator;
82 void createNonDocMSPs();
84 Msp_hash m_hMsps;
85 ScriptComponent_map m_mScriptComponents;
86 osl::Mutex m_mutex;
87 OUString userDirString;
88 OUString shareDirString;
89 OUString bundledDirString;
90 css::uno::Reference< css::uno::XComponentContext > m_xContext;
92 } // func_provider
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */