Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : : #ifndef _FRAMEWORK_SCRIPT_PROVIDER_OPENDOCUMENTLIST_HXX_
20 : : #define _FRAMEWORK_SCRIPT_PROVIDER_OPENDOCUMENTLIST_HXX_
21 : :
22 : : #include <boost/unordered_map.hpp>
23 : : #include <map>
24 : :
25 : : #include <osl/mutex.hxx>
26 : : #include <rtl/ustring.hxx>
27 : : #include <cppuhelper/implbase1.hxx>
28 : : #include <com/sun/star/uno/RuntimeException.hpp>
29 : : #include <com/sun/star/lang/XServiceInfo.hpp>
30 : :
31 : : #include <com/sun/star/lang/XEventListener.hpp>
32 : :
33 : : #include <com/sun/star/script/provider/XScriptProvider.hpp>
34 : : #include <com/sun/star/script/browse/XBrowseNode.hpp>
35 : : #include <com/sun/star/document/XScriptInvocationContext.hpp>
36 : :
37 : : #include <comphelper/stl_types.hxx>
38 : :
39 : : namespace css = ::com::sun::star;
40 : :
41 : : namespace func_provider
42 : : {
43 : :
44 : : //Typedefs
45 : : //=============================================================================
46 : :
47 : :
48 : : typedef ::std::map < css::uno::Reference< css::uno::XInterface >
49 : : , css::uno::Reference< css::script::provider::XScriptProvider >
50 : : , ::comphelper::OInterfaceCompare< css::uno::XInterface >
51 : : > ScriptComponent_map;
52 : :
53 : : typedef ::boost::unordered_map< ::rtl::OUString,
54 : : css::uno::Reference< css::script::provider::XScriptProvider >,
55 : : ::rtl::OUStringHash,
56 : : ::std::equal_to< ::rtl::OUString > > Msp_hash;
57 : :
58 : : class ActiveMSPList : public ::cppu::WeakImplHelper1< css::lang::XEventListener >
59 : : {
60 : :
61 : : public:
62 : :
63 : : ActiveMSPList( const css::uno::Reference<
64 : : css::uno::XComponentContext > & xContext );
65 : : ~ActiveMSPList();
66 : :
67 : : css::uno::Reference< css::script::provider::XScriptProvider >
68 : : getMSPFromStringContext( const ::rtl::OUString& context )
69 : : SAL_THROW(( css::lang::IllegalArgumentException, css::uno::RuntimeException ));
70 : :
71 : : css::uno::Reference< css::script::provider::XScriptProvider >
72 : : getMSPFromAnyContext( const css::uno::Any& context )
73 : : SAL_THROW(( css::lang::IllegalArgumentException, css::uno::RuntimeException ));
74 : :
75 : : css::uno::Reference< css::script::provider::XScriptProvider >
76 : : getMSPFromInvocationContext( const css::uno::Reference< css::document::XScriptInvocationContext >& context )
77 : : SAL_THROW(( css::lang::IllegalArgumentException, css::uno::RuntimeException ));
78 : :
79 : : //XEventListener
80 : : //======================================================================
81 : :
82 : : virtual void SAL_CALL disposing( const css::lang::EventObject& Source )
83 : : throw ( css::uno::RuntimeException );
84 : :
85 : : private:
86 : : void addActiveMSP( const css::uno::Reference< css::uno::XInterface >& xComponent,
87 : : const css::uno::Reference< css::script::provider::XScriptProvider >& msp );
88 : : css::uno::Reference< css::script::provider::XScriptProvider >
89 : : createNewMSP( const css::uno::Any& context );
90 : : css::uno::Reference< css::script::provider::XScriptProvider >
91 : 13 : createNewMSP( const ::rtl::OUString& context )
92 : : {
93 [ + - ]: 13 : return createNewMSP( css::uno::makeAny( context ) );
94 : : }
95 : :
96 : : void createNonDocMSPs();
97 : : Msp_hash m_hMsps;
98 : : ScriptComponent_map m_mScriptComponents;
99 : : osl::Mutex m_mutex;
100 : : ::rtl::OUString userDirString;
101 : : ::rtl::OUString shareDirString;
102 : : ::rtl::OUString bundledDirString;
103 : : css::uno::Reference< css::uno::XComponentContext > m_xContext;
104 : : };
105 : : } // func_provider
106 : : #endif
107 : :
108 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|