1*6998d047SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*6998d047SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*6998d047SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*6998d047SAndrew Rist * distributed with this work for additional information 6*6998d047SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*6998d047SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*6998d047SAndrew Rist * "License"); you may not use this file except in compliance 9*6998d047SAndrew Rist * with the License. You may obtain a copy of the License at 10*6998d047SAndrew Rist * 11*6998d047SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*6998d047SAndrew Rist * 13*6998d047SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*6998d047SAndrew Rist * software distributed under the License is distributed on an 15*6998d047SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*6998d047SAndrew Rist * KIND, either express or implied. See the License for the 17*6998d047SAndrew Rist * specific language governing permissions and limitations 18*6998d047SAndrew Rist * under the License. 19*6998d047SAndrew Rist * 20*6998d047SAndrew Rist *************************************************************/ 21*6998d047SAndrew Rist 22*6998d047SAndrew 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; 47cdf0e10cSrcweir } 48cdf0e10cSrcweir namespace lang { 49cdf0e10cSrcweir class XMultiServiceFactory; 50cdf0e10cSrcweir class XSingleServiceFactory; 51cdf0e10cSrcweir } 52cdf0e10cSrcweir namespace frame { 53cdf0e10cSrcweir class XFrame; 54cdf0e10cSrcweir class XModel; 55cdf0e10cSrcweir class XDispatch; 56cdf0e10cSrcweir class XNotifyingDispatch; 57cdf0e10cSrcweir class XDispatchResultListener; 58cdf0e10cSrcweir struct DispatchDescriptor; 59cdf0e10cSrcweir } 60cdf0e10cSrcweir namespace beans { 61cdf0e10cSrcweir struct PropertyValue; 62cdf0e10cSrcweir } 63cdf0e10cSrcweir namespace util { 64cdf0e10cSrcweir struct URL; 65cdf0e10cSrcweir } 66cdf0e10cSrcweir } } } 67cdf0e10cSrcweir 68cdf0e10cSrcweir namespace scripting_protocolhandler 69cdf0e10cSrcweir { 70cdf0e10cSrcweir 71cdf0e10cSrcweir namespace css = ::com::sun::star; 72cdf0e10cSrcweir 73cdf0e10cSrcweir class ScriptProtocolHandler : 74cdf0e10cSrcweir public ::cppu::WeakImplHelper4< css::frame::XDispatchProvider, 75cdf0e10cSrcweir css::frame::XNotifyingDispatch, css::lang::XServiceInfo, css::lang::XInitialization > 76cdf0e10cSrcweir { 77cdf0e10cSrcweir private: 78cdf0e10cSrcweir bool m_bInitialised; 79cdf0e10cSrcweir css::uno::Reference < css::lang::XMultiServiceFactory > m_xFactory; 80cdf0e10cSrcweir css::uno::Reference < css::frame::XFrame > m_xFrame; 81cdf0e10cSrcweir css::uno::Reference < css::script::provider::XScriptProvider > m_xScriptProvider; 82cdf0e10cSrcweir css::uno::Reference< css::document::XScriptInvocationContext > m_xScriptInvocation; 83cdf0e10cSrcweir 84cdf0e10cSrcweir void createScriptProvider(); 85cdf0e10cSrcweir bool getScriptInvocation(); 86cdf0e10cSrcweir 87cdf0e10cSrcweir public: 88cdf0e10cSrcweir ScriptProtocolHandler( const css::uno::Reference < 89cdf0e10cSrcweir css::lang::XMultiServiceFactory >& xFactory ); 90cdf0e10cSrcweir virtual ~ScriptProtocolHandler(); 91cdf0e10cSrcweir 92cdf0e10cSrcweir /* XServiceInfo */ 93cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() 94cdf0e10cSrcweir throw( css::uno::RuntimeException ); 95cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& sServiceName ) 96cdf0e10cSrcweir throw( css::uno::RuntimeException ); 97cdf0e10cSrcweir virtual css::uno::Sequence < ::rtl::OUString > SAL_CALL getSupportedServiceNames() 98cdf0e10cSrcweir throw( css::uno::RuntimeException ); 99cdf0e10cSrcweir 100cdf0e10cSrcweir /* Helper for XServiceInfo */ 101cdf0e10cSrcweir static css::uno::Sequence < ::rtl::OUString > impl_getStaticSupportedServiceNames(); 102cdf0e10cSrcweir static ::rtl::OUString impl_getStaticImplementationName(); 103cdf0e10cSrcweir 104cdf0e10cSrcweir /* Helper for registry */ 105cdf0e10cSrcweir static css::uno::Reference < css::uno::XInterface > SAL_CALL 106cdf0e10cSrcweir impl_createInstance( 107cdf0e10cSrcweir const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) 108cdf0e10cSrcweir throw( css::uno::RuntimeException ); 109cdf0e10cSrcweir static css::uno::Reference < css::lang::XSingleServiceFactory > impl_createFactory( 110cdf0e10cSrcweir const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); 111cdf0e10cSrcweir 112cdf0e10cSrcweir /* Implementation for XDispatchProvider */ 113cdf0e10cSrcweir virtual css::uno::Reference < css::frame::XDispatch > SAL_CALL 114cdf0e10cSrcweir queryDispatch( const css::util::URL& aURL, const ::rtl::OUString& sTargetFrameName, 115cdf0e10cSrcweir sal_Int32 eSearchFlags ) throw( css::uno::RuntimeException ) ; 116cdf0e10cSrcweir virtual css::uno::Sequence< css::uno::Reference < css::frame::XDispatch > > SAL_CALL 117cdf0e10cSrcweir queryDispatches( 118cdf0e10cSrcweir const css::uno::Sequence < css::frame::DispatchDescriptor >& seqDescriptor ) 119cdf0e10cSrcweir throw( css::uno::RuntimeException ); 120cdf0e10cSrcweir 121cdf0e10cSrcweir /* Implementation for X(Notifying)Dispatch */ 122cdf0e10cSrcweir virtual void SAL_CALL dispatchWithNotification( 123cdf0e10cSrcweir const css::util::URL& aURL, 124cdf0e10cSrcweir const css::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs, 125cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& Listener ) 126cdf0e10cSrcweir throw ( css::uno::RuntimeException ); 127cdf0e10cSrcweir virtual void SAL_CALL dispatch( 128cdf0e10cSrcweir const css::util::URL& aURL, 129cdf0e10cSrcweir const css::uno::Sequence< css::beans::PropertyValue >& lArgs ) 130cdf0e10cSrcweir throw ( css::uno::RuntimeException ); 131cdf0e10cSrcweir virtual void SAL_CALL addStatusListener( 132cdf0e10cSrcweir const css::uno::Reference< css::frame::XStatusListener >& xControl, 133cdf0e10cSrcweir const css::util::URL& aURL ) 134cdf0e10cSrcweir throw ( css::uno::RuntimeException ); 135cdf0e10cSrcweir virtual void SAL_CALL removeStatusListener( 136cdf0e10cSrcweir const css::uno::Reference< css::frame::XStatusListener >& xControl, 137cdf0e10cSrcweir const css::util::URL& aURL ) 138cdf0e10cSrcweir throw ( css::uno::RuntimeException ); 139cdf0e10cSrcweir 140cdf0e10cSrcweir /* Implementation for XInitialization */ 141cdf0e10cSrcweir virtual void SAL_CALL initialize( 142cdf0e10cSrcweir const css::uno::Sequence < css::uno::Any >& aArguments ) 143cdf0e10cSrcweir throw ( css::uno::Exception ); 144cdf0e10cSrcweir }; 145cdf0e10cSrcweir 146cdf0e10cSrcweir } 147cdf0e10cSrcweir #endif 148