1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _FRAMEWORK_SCRIPT_SCRIPTNAMERESOLVERIMPL_HXX_
30 #define _FRAMEWORK_SCRIPT_SCRIPTNAMERESOLVERIMPL_HXX_
32 #include <cppuhelper/implbase1.hxx> // helper for XInterface, XTypeProvider etc.
34 #include <com/sun/star/lang/XServiceInfo.hpp>
35 #include <com/sun/star/lang/IllegalArgumentException.hpp>
36 #include <com/sun/star/uno/RuntimeException.hpp>
37 #include <com/sun/star/script/CannotConvertException.hpp>
38 #include <com/sun/star/reflection/InvocationTargetException.hpp>
40 #include <drafts/com/sun/star/script/framework/runtime/XScriptNameResolver.hpp>
41 #include <drafts/com/sun/star/script/framework/storage/XScriptInfoAccess.hpp>
42 #include <drafts/com/sun/star/script/framework/storage/XScriptInfo.hpp>
44 namespace scripting_runtimemgr
47 #define css ::com::sun::star
48 #define dcsssf ::drafts::com::sun::star::script::framework
50 class ScriptNameResolverImpl
: public
51 ::cppu::WeakImplHelper1
< dcsssf::runtime::XScriptNameResolver
>
54 /**********************************************
55 ScriptNameResolverImpl Constructor
56 @param the current context
58 ScriptNameResolverImpl(
59 const css::uno::Reference
< css::uno::XComponentContext
> & xContext
);
60 ~ScriptNameResolverImpl();
62 // XServiceInfo implementation
63 virtual ::rtl::OUString SAL_CALL
getImplementationName()
64 throw( css::uno::RuntimeException
);
65 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
66 throw( css::uno::RuntimeException
);
67 virtual css::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
68 throw( css::uno::RuntimeException
);
70 /**********************************************
72 @param scriptURI this is the given ScriptURI
73 @param invocationCtx the invocation context contains the
74 documentStorageID and document reference for use in script name
75 resolving. On full name resolution it sets the resolvedScriptStorageID to
76 the actual storage location of the fully resolved script. May or may not * be the
77 same as the documentStorageID.
78 @exception CannotResolveScriptNameException
79 @exception IllegalArgumentException
80 @exception NullPointerException
81 @return the resolved XScriptURI
83 css::uno::Reference
< dcsssf::storage::XScriptInfo
> SAL_CALL
resolve(
84 const ::rtl::OUString
& scriptURI
,
85 css::uno::Any
& invocationCtx
)
86 throw( css::script::CannotConvertException
, css::lang::IllegalArgumentException
,
87 css::uno::RuntimeException
);
89 css::uno::Reference
< dcsssf::storage::XScriptInfo
>
90 resolveURIFromStorageID( sal_Int32 sid
, const rtl::OUString
& docURI
,
91 const ::rtl::OUString
& nameToResolve
)
92 SAL_THROW ( ( css::lang::IllegalArgumentException
, css::uno::RuntimeException
) );
93 css::uno::Reference
< dcsssf::storage::XScriptInfoAccess
>
94 getStorageInstance( sal_Int32 sid
, const rtl::OUString
& permissionURI
)
95 SAL_THROW ( ( css::uno::RuntimeException
) );
97 ScriptNameResolverImpl::getFilesysURL( const ::rtl::OUString
& scriptURI
)
98 throw( css::lang::IllegalArgumentException
);
100 /**********************************************
101 Reference< XComponentContext > m_xContext
102 to obtain other services if needed
104 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
105 css::uno::Reference
< css::lang::XMultiComponentFactory
> m_xMultiComFac
;
106 ::osl::Mutex m_mutex
;
109 } // scripting_runtimemgr
111 #endif //_FRAMEWORK_SCRIPT_SCRIPTNAMERESOLVERIMPL_HXX_
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */