1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 _FRAMEWORK_SCRIPT_PROVIDER_OPENDOCUMENTLIST_HXX_
20 #define _FRAMEWORK_SCRIPT_PROVIDER_OPENDOCUMENTLIST_HXX_
22 #include <boost/unordered_map.hpp>
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>
31 #include <com/sun/star/lang/XEventListener.hpp>
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>
37 #include <comphelper/stl_types.hxx>
39 namespace func_provider
43 //=============================================================================
46 typedef ::std::map
< css::uno::Reference
< css::uno::XInterface
>
47 , css::uno::Reference
< css::script::provider::XScriptProvider
>
48 , ::comphelper::OInterfaceCompare
< css::uno::XInterface
>
49 > ScriptComponent_map
;
51 typedef ::boost::unordered_map
< OUString
,
52 css::uno::Reference
< css::script::provider::XScriptProvider
>,
54 ::std::equal_to
< OUString
> > Msp_hash
;
56 class ActiveMSPList
: public ::cppu::WeakImplHelper1
< css::lang::XEventListener
>
61 ActiveMSPList( const css::uno::Reference
<
62 css::uno::XComponentContext
> & xContext
);
65 css::uno::Reference
< css::script::provider::XScriptProvider
>
66 getMSPFromStringContext( const OUString
& context
)
67 SAL_THROW(( css::lang::IllegalArgumentException
, css::uno::RuntimeException
));
69 css::uno::Reference
< css::script::provider::XScriptProvider
>
70 getMSPFromAnyContext( const css::uno::Any
& context
)
71 SAL_THROW(( css::lang::IllegalArgumentException
, css::uno::RuntimeException
));
73 css::uno::Reference
< css::script::provider::XScriptProvider
>
74 getMSPFromInvocationContext( const css::uno::Reference
< css::document::XScriptInvocationContext
>& context
)
75 SAL_THROW(( css::lang::IllegalArgumentException
, css::uno::RuntimeException
));
78 //======================================================================
80 virtual void SAL_CALL
disposing( const css::lang::EventObject
& Source
)
81 throw ( css::uno::RuntimeException
);
84 void addActiveMSP( const css::uno::Reference
< css::uno::XInterface
>& xComponent
,
85 const css::uno::Reference
< css::script::provider::XScriptProvider
>& msp
);
86 css::uno::Reference
< css::script::provider::XScriptProvider
>
87 createNewMSP( const css::uno::Any
& context
);
88 css::uno::Reference
< css::script::provider::XScriptProvider
>
89 createNewMSP( const OUString
& context
)
91 return createNewMSP( css::uno::makeAny( context
) );
94 void createNonDocMSPs();
96 ScriptComponent_map m_mScriptComponents
;
98 OUString userDirString
;
99 OUString shareDirString
;
100 OUString bundledDirString
;
101 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */