1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: scripthandler.hxx,v $
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_SCRIPTHANDLER_HXX
32 #define _FRAMEWORK_SCRIPT_SCRIPTHANDLER_HXX
34 #include <com/sun/star/uno/RuntimeException.hpp>
35 #include <com/sun/star/frame/XDispatchProvider.hpp>
36 #include <com/sun/star/frame/XNotifyingDispatch.hpp>
37 #include <com/sun/star/lang/XServiceInfo.hpp>
38 #include <com/sun/star/lang/XInitialization.hpp>
39 #include <cppuhelper/implbase4.hxx>
40 #include <com/sun/star/script/provider/XScriptProvider.hpp>
47 namespace com
{ namespace sun
{ namespace star
{
50 class XScriptInvocationContext
;
56 class XMultiServiceFactory
;
57 class XSingleServiceFactory
;
63 class XNotifyingDispatch
;
64 class XDispatchResultListener
;
65 struct DispatchDescriptor
;
75 namespace scripting_protocolhandler
78 namespace css
= ::com::sun::star
;
80 class ScriptProtocolHandler
:
81 public ::cppu::WeakImplHelper4
< css::frame::XDispatchProvider
,
82 css::frame::XNotifyingDispatch
, css::lang::XServiceInfo
, css::lang::XInitialization
>
86 css::uno::Reference
< css::lang::XMultiServiceFactory
> m_xFactory
;
87 css::uno::Reference
< css::frame::XFrame
> m_xFrame
;
88 css::uno::Reference
< css::script::provider::XScriptProvider
> m_xScriptProvider
;
89 css::uno::Reference
< css::document::XScriptInvocationContext
> m_xScriptInvocation
;
91 void createScriptProvider();
92 bool getScriptInvocation();
95 ScriptProtocolHandler( const css::uno::Reference
<
96 css::lang::XMultiServiceFactory
>& xFactory
);
97 virtual ~ScriptProtocolHandler();
100 virtual ::rtl::OUString SAL_CALL
getImplementationName()
101 throw( css::uno::RuntimeException
);
102 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& sServiceName
)
103 throw( css::uno::RuntimeException
);
104 virtual css::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
105 throw( css::uno::RuntimeException
);
107 /* Helper for XServiceInfo */
108 static css::uno::Sequence
< ::rtl::OUString
> impl_getStaticSupportedServiceNames();
109 static ::rtl::OUString
impl_getStaticImplementationName();
111 /* Helper for registry */
112 static css::uno::Reference
< css::uno::XInterface
> SAL_CALL
114 const css::uno::Reference
< css::lang::XMultiServiceFactory
>& xServiceManager
)
115 throw( css::uno::RuntimeException
);
116 static css::uno::Reference
< css::lang::XSingleServiceFactory
> impl_createFactory(
117 const css::uno::Reference
< css::lang::XMultiServiceFactory
>& xServiceManager
);
119 /* Implementation for XDispatchProvider */
120 virtual css::uno::Reference
< css::frame::XDispatch
> SAL_CALL
121 queryDispatch( const css::util::URL
& aURL
, const ::rtl::OUString
& sTargetFrameName
,
122 sal_Int32 eSearchFlags
) throw( css::uno::RuntimeException
) ;
123 virtual css::uno::Sequence
< css::uno::Reference
< css::frame::XDispatch
> > SAL_CALL
125 const css::uno::Sequence
< css::frame::DispatchDescriptor
>& seqDescriptor
)
126 throw( css::uno::RuntimeException
);
128 /* Implementation for X(Notifying)Dispatch */
129 virtual void SAL_CALL
dispatchWithNotification(
130 const css::util::URL
& aURL
,
131 const css::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& lArgs
,
132 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchResultListener
>& Listener
)
133 throw ( css::uno::RuntimeException
);
134 virtual void SAL_CALL
dispatch(
135 const css::util::URL
& aURL
,
136 const css::uno::Sequence
< css::beans::PropertyValue
>& lArgs
)
137 throw ( css::uno::RuntimeException
);
138 virtual void SAL_CALL
addStatusListener(
139 const css::uno::Reference
< css::frame::XStatusListener
>& xControl
,
140 const css::util::URL
& aURL
)
141 throw ( css::uno::RuntimeException
);
142 virtual void SAL_CALL
removeStatusListener(
143 const css::uno::Reference
< css::frame::XStatusListener
>& xControl
,
144 const css::util::URL
& aURL
)
145 throw ( css::uno::RuntimeException
);
147 /* Implementation for XInitialization */
148 virtual void SAL_CALL
initialize(
149 const css::uno::Sequence
< css::uno::Any
>& aArguments
)
150 throw ( css::uno::Exception
);