16998d047SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
36998d047SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
46998d047SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
56998d047SAndrew Rist  * distributed with this work for additional information
66998d047SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
76998d047SAndrew Rist  * to you under the Apache License, Version 2.0 (the
86998d047SAndrew Rist  * "License"); you may not use this file except in compliance
96998d047SAndrew Rist  * with the License.  You may obtain a copy of the License at
106998d047SAndrew Rist  *
116998d047SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
126998d047SAndrew Rist  *
136998d047SAndrew Rist  * Unless required by applicable law or agreed to in writing,
146998d047SAndrew Rist  * software distributed under the License is distributed on an
156998d047SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
166998d047SAndrew Rist  * KIND, either express or implied.  See the License for the
176998d047SAndrew Rist  * specific language governing permissions and limitations
186998d047SAndrew Rist  * under the License.
196998d047SAndrew Rist  *
206998d047SAndrew Rist  *************************************************************/
216998d047SAndrew Rist 
226998d047SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _FRAMEWORK_SCRIPT_SCRIPTHANDLER_HXX
25cdf0e10cSrcweir #define _FRAMEWORK_SCRIPT_SCRIPTHANDLER_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/uno/RuntimeException.hpp>
28cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp>
29cdf0e10cSrcweir #include <com/sun/star/frame/XNotifyingDispatch.hpp>
30cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
31cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp>
32cdf0e10cSrcweir #include <cppuhelper/implbase4.hxx>
33cdf0e10cSrcweir #include <com/sun/star/script/provider/XScriptProvider.hpp>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir namespace rtl
36cdf0e10cSrcweir {
37cdf0e10cSrcweir class OUString;
38cdf0e10cSrcweir }
39cdf0e10cSrcweir 
40cdf0e10cSrcweir namespace com { namespace sun { namespace star {
41cdf0e10cSrcweir 
42cdf0e10cSrcweir     namespace document {
43cdf0e10cSrcweir         class XScriptInvocationContext;
44cdf0e10cSrcweir     }
45cdf0e10cSrcweir     namespace uno {
46cdf0e10cSrcweir         class Any;
47*7110543dSDamjan Jovanovic         class XComponentContext;
48cdf0e10cSrcweir     }
49cdf0e10cSrcweir     namespace lang {
50cdf0e10cSrcweir         class XMultiServiceFactory;
51cdf0e10cSrcweir         class XSingleServiceFactory;
52cdf0e10cSrcweir     }
53cdf0e10cSrcweir     namespace frame {
54cdf0e10cSrcweir         class XFrame;
55cdf0e10cSrcweir         class XModel;
56cdf0e10cSrcweir         class XDispatch;
57cdf0e10cSrcweir         class XNotifyingDispatch;
58cdf0e10cSrcweir         class XDispatchResultListener;
59cdf0e10cSrcweir         struct DispatchDescriptor;
60cdf0e10cSrcweir     }
61cdf0e10cSrcweir     namespace beans {
62cdf0e10cSrcweir         struct PropertyValue;
63cdf0e10cSrcweir     }
64cdf0e10cSrcweir     namespace util {
65cdf0e10cSrcweir         struct URL;
66cdf0e10cSrcweir     }
67cdf0e10cSrcweir } } }
68cdf0e10cSrcweir 
69cdf0e10cSrcweir namespace scripting_protocolhandler
70cdf0e10cSrcweir {
71cdf0e10cSrcweir 
72cdf0e10cSrcweir namespace css = ::com::sun::star;
73cdf0e10cSrcweir 
74cdf0e10cSrcweir class ScriptProtocolHandler :
75cdf0e10cSrcweir public ::cppu::WeakImplHelper4< css::frame::XDispatchProvider,
76cdf0e10cSrcweir     css::frame::XNotifyingDispatch, css::lang::XServiceInfo, css::lang::XInitialization >
77cdf0e10cSrcweir {
78cdf0e10cSrcweir private:
79cdf0e10cSrcweir     bool m_bInitialised;
80*7110543dSDamjan Jovanovic     css::uno::Reference < css::uno::XComponentContext >             m_xCtx;
81cdf0e10cSrcweir     css::uno::Reference < css::frame::XFrame >                      m_xFrame;
82cdf0e10cSrcweir     css::uno::Reference < css::script::provider::XScriptProvider >  m_xScriptProvider;
83cdf0e10cSrcweir     css::uno::Reference< css::document::XScriptInvocationContext >  m_xScriptInvocation;
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     void createScriptProvider();
86cdf0e10cSrcweir     bool getScriptInvocation();
87cdf0e10cSrcweir 
88cdf0e10cSrcweir public:
89cdf0e10cSrcweir     ScriptProtocolHandler( const css::uno::Reference <
90*7110543dSDamjan Jovanovic         css::uno::XComponentContext >& xCtx );
91cdf0e10cSrcweir     virtual ~ScriptProtocolHandler();
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     /* XServiceInfo */
94cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getImplementationName()
95cdf0e10cSrcweir         throw( css::uno::RuntimeException );
96cdf0e10cSrcweir     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& sServiceName )
97cdf0e10cSrcweir         throw( css::uno::RuntimeException );
98cdf0e10cSrcweir     virtual css::uno::Sequence < ::rtl::OUString > SAL_CALL getSupportedServiceNames()
99cdf0e10cSrcweir         throw( css::uno::RuntimeException );
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     /* Helper for XServiceInfo */
102cdf0e10cSrcweir     static css::uno::Sequence < ::rtl::OUString > impl_getStaticSupportedServiceNames();
103cdf0e10cSrcweir     static ::rtl::OUString impl_getStaticImplementationName();
104cdf0e10cSrcweir 
105cdf0e10cSrcweir     /* Helper for registry */
106cdf0e10cSrcweir     static css::uno::Reference < css::uno::XInterface > SAL_CALL
107cdf0e10cSrcweir     impl_createInstance(
108*7110543dSDamjan Jovanovic         const css::uno::Reference< css::uno::XComponentContext >& xCtx )
109cdf0e10cSrcweir     throw( css::uno::RuntimeException );
110cdf0e10cSrcweir 
111cdf0e10cSrcweir     /* Implementation for XDispatchProvider */
112cdf0e10cSrcweir     virtual css::uno::Reference < css::frame::XDispatch > SAL_CALL
113cdf0e10cSrcweir     queryDispatch( const css::util::URL& aURL, const ::rtl::OUString& sTargetFrameName,
114cdf0e10cSrcweir                    sal_Int32 eSearchFlags ) throw( css::uno::RuntimeException ) ;
115cdf0e10cSrcweir     virtual css::uno::Sequence< css::uno::Reference < css::frame::XDispatch > > SAL_CALL
116cdf0e10cSrcweir     queryDispatches(
117cdf0e10cSrcweir         const css::uno::Sequence < css::frame::DispatchDescriptor >& seqDescriptor )
118cdf0e10cSrcweir     throw( css::uno::RuntimeException );
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     /* Implementation for X(Notifying)Dispatch */
121cdf0e10cSrcweir     virtual void SAL_CALL dispatchWithNotification(
122cdf0e10cSrcweir     const css::util::URL& aURL,
123cdf0e10cSrcweir     const css::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs,
124cdf0e10cSrcweir     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& Listener )
125cdf0e10cSrcweir     throw ( css::uno::RuntimeException );
126cdf0e10cSrcweir     virtual void SAL_CALL dispatch(
127cdf0e10cSrcweir         const css::util::URL& aURL,
128cdf0e10cSrcweir         const css::uno::Sequence< css::beans::PropertyValue >& lArgs )
129cdf0e10cSrcweir         throw ( css::uno::RuntimeException );
130cdf0e10cSrcweir     virtual void SAL_CALL addStatusListener(
131cdf0e10cSrcweir         const css::uno::Reference< css::frame::XStatusListener >& xControl,
132cdf0e10cSrcweir         const css::util::URL& aURL )
133cdf0e10cSrcweir         throw ( css::uno::RuntimeException );
134cdf0e10cSrcweir     virtual void SAL_CALL removeStatusListener(
135cdf0e10cSrcweir         const css::uno::Reference< css::frame::XStatusListener >& xControl,
136cdf0e10cSrcweir         const css::util::URL& aURL )
137cdf0e10cSrcweir         throw ( css::uno::RuntimeException );
138cdf0e10cSrcweir 
139cdf0e10cSrcweir     /* Implementation for XInitialization */
140cdf0e10cSrcweir     virtual void SAL_CALL initialize(
141cdf0e10cSrcweir         const css::uno::Sequence < css::uno::Any >& aArguments )
142cdf0e10cSrcweir         throw ( css::uno::Exception );
143cdf0e10cSrcweir };
144cdf0e10cSrcweir 
145cdf0e10cSrcweir }
146cdf0e10cSrcweir #endif
147