merge the formfield patch from ooo-build
[ooovba.git] / scripting / source / runtimemgr / ScriptNameResolverImpl.hxx
blob1a60a4b4c014c7f0fffa9407f4bc19688a87cd9c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ScriptNameResolverImpl.hxx,v $
10 * $Revision: 1.15 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _FRAMEWORK_SCRIPT_SCRIPTNAMERESOLVERIMPL_HXX_
32 #define _FRAMEWORK_SCRIPT_SCRIPTNAMERESOLVERIMPL_HXX_
34 #include <cppuhelper/implbase1.hxx> // helper for XInterface, XTypeProvider etc.
36 #include <com/sun/star/lang/XServiceInfo.hpp>
37 #include <com/sun/star/lang/IllegalArgumentException.hpp>
38 #include <com/sun/star/uno/RuntimeException.hpp>
39 #include <com/sun/star/script/CannotConvertException.hpp>
40 #include <com/sun/star/reflection/InvocationTargetException.hpp>
42 #include <drafts/com/sun/star/script/framework/runtime/XScriptNameResolver.hpp>
43 #include <drafts/com/sun/star/script/framework/storage/XScriptInfoAccess.hpp>
44 #include <drafts/com/sun/star/script/framework/storage/XScriptInfo.hpp>
46 namespace scripting_runtimemgr
48 // for simplification
49 #define css ::com::sun::star
50 #define dcsssf ::drafts::com::sun::star::script::framework
52 class ScriptNameResolverImpl : public
53 ::cppu::WeakImplHelper1 < dcsssf::runtime::XScriptNameResolver >
55 public:
56 /**********************************************
57 ScriptNameResolverImpl Constructor
58 @param the current context
60 ScriptNameResolverImpl(
61 const css::uno::Reference< css::uno::XComponentContext > & xContext );
62 ~ScriptNameResolverImpl();
64 // XServiceInfo implementation
65 virtual ::rtl::OUString SAL_CALL getImplementationName()
66 throw( css::uno::RuntimeException );
67 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
68 throw( css::uno::RuntimeException );
69 virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
70 throw( css::uno::RuntimeException );
72 /**********************************************
73 resolve method
74 @param scriptURI this is the given ScriptURI
75 @param invocationCtx the invocation context contains the
76 documentStorageID and document reference for use in script name
77 resolving. On full name resolution it sets the resolvedScriptStorageID to
78 the actual storage location of the fully resolved script. May or may not * be the
79 same as the documentStorageID.
80 @exception CannotResolveScriptNameException
81 @exception IllegalArgumentException
82 @exception NullPointerException
83 @return the resolved XScriptURI
85 css::uno::Reference < dcsssf::storage::XScriptInfo > SAL_CALL resolve(
86 const ::rtl::OUString & scriptURI,
87 css::uno::Any& invocationCtx )
88 throw( css::script::CannotConvertException, css::lang::IllegalArgumentException,
89 css::uno::RuntimeException );
90 private:
91 css::uno::Reference < dcsssf::storage::XScriptInfo >
92 resolveURIFromStorageID( sal_Int32 sid, const rtl::OUString & docURI,
93 const ::rtl::OUString & nameToResolve )
94 SAL_THROW ( ( css::lang::IllegalArgumentException, css::uno::RuntimeException ) );
95 css::uno::Reference< dcsssf::storage::XScriptInfoAccess >
96 getStorageInstance( sal_Int32 sid, const rtl::OUString & permissionURI)
97 SAL_THROW ( ( css::uno::RuntimeException ) );
98 ::rtl::OUString
99 ScriptNameResolverImpl::getFilesysURL( const ::rtl::OUString & scriptURI )
100 throw( css::lang::IllegalArgumentException );
102 /**********************************************
103 Reference< XComponentContext > m_xContext
104 to obtain other services if needed
106 css::uno::Reference< css::uno::XComponentContext > m_xContext;
107 css::uno::Reference< css::lang::XMultiComponentFactory > m_xMultiComFac;
108 ::osl::Mutex m_mutex;
111 } // scripting_runtimemgr
113 #endif //_FRAMEWORK_SCRIPT_SCRIPTNAMERESOLVERIMPL_HXX_