1f8e07b45SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3f8e07b45SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4f8e07b45SAndrew Rist * or more contributor license agreements. See the NOTICE file 5f8e07b45SAndrew Rist * distributed with this work for additional information 6f8e07b45SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7f8e07b45SAndrew Rist * to you under the Apache License, Version 2.0 (the 8f8e07b45SAndrew Rist * "License"); you may not use this file except in compliance 9f8e07b45SAndrew Rist * with the License. You may obtain a copy of the License at 10f8e07b45SAndrew Rist * 11f8e07b45SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12f8e07b45SAndrew Rist * 13f8e07b45SAndrew Rist * Unless required by applicable law or agreed to in writing, 14f8e07b45SAndrew Rist * software distributed under the License is distributed on an 15f8e07b45SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16f8e07b45SAndrew Rist * KIND, either express or implied. See the License for the 17f8e07b45SAndrew Rist * specific language governing permissions and limitations 18f8e07b45SAndrew Rist * under the License. 19f8e07b45SAndrew Rist * 20f8e07b45SAndrew Rist *************************************************************/ 21f8e07b45SAndrew Rist 22f8e07b45SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef __FRAMEWORK_DISPATCH_SYSTEMEXEC_HXX_ 25cdf0e10cSrcweir #define __FRAMEWORK_DISPATCH_SYSTEMEXEC_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 28cdf0e10cSrcweir // my own includes 29cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include <macros/generic.hxx> 32cdf0e10cSrcweir #include <macros/xinterface.hxx> 33cdf0e10cSrcweir #include <macros/xtypeprovider.hxx> 34cdf0e10cSrcweir #include <macros/xserviceinfo.hxx> 35cdf0e10cSrcweir #include <macros/debug.hxx> 36cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx> 37cdf0e10cSrcweir #include <general.h> 38cdf0e10cSrcweir #include <stdtypes.h> 39cdf0e10cSrcweir 40cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 41cdf0e10cSrcweir // interface includes 42cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 43cdf0e10cSrcweir #include <com/sun/star/lang/XTypeProvider.hpp> 44cdf0e10cSrcweir #include <com/sun/star/frame/XNotifyingDispatch.hpp> 45cdf0e10cSrcweir #include <com/sun/star/frame/XDispatch.hpp> 46cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp> 47cdf0e10cSrcweir #include <com/sun/star/util/URL.hpp> 48cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 49cdf0e10cSrcweir #include <com/sun/star/frame/XStatusListener.hpp> 50cdf0e10cSrcweir 51cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 52cdf0e10cSrcweir // other includes 53cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 54cdf0e10cSrcweir #include <cppuhelper/weak.hxx> 55cdf0e10cSrcweir 56cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 57cdf0e10cSrcweir // namespace 58cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 59cdf0e10cSrcweir 60cdf0e10cSrcweir namespace framework{ 61cdf0e10cSrcweir 62cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 63cdf0e10cSrcweir // exported const 64cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 65cdf0e10cSrcweir 66cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 67cdf0e10cSrcweir // exported definitions 68cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 69cdf0e10cSrcweir 70cdf0e10cSrcweir /** 71cdf0e10cSrcweir @short protocol handler for "systemexec:*" URLs 72cdf0e10cSrcweir @descr It's a special dispatch/provider object which is registered for such URL pattern and will 73cdf0e10cSrcweir be automaticly used by the framework dispatch mechanism if such URL occured. 74cdf0e10cSrcweir It forwards all URL's to the underlying operating system. 75cdf0e10cSrcweir So it would e.g. be possible to open HTML files outside the office within a web browser. 76cdf0e10cSrcweir 77cdf0e10cSrcweir @base ThreadHelpBase 78cdf0e10cSrcweir exports a lock member to guarantee right initialize value of it 79cdf0e10cSrcweir @base OWeakObject 80cdf0e10cSrcweir provides XWeak and ref count mechanism 81cdf0e10cSrcweir 82cdf0e10cSrcweir @devstatus ready to use 83cdf0e10cSrcweir */ 84cdf0e10cSrcweir class SystemExec : // interfaces 85cdf0e10cSrcweir public css::lang::XTypeProvider , 86cdf0e10cSrcweir public css::lang::XServiceInfo , 87cdf0e10cSrcweir public css::frame::XDispatchProvider , 88cdf0e10cSrcweir public css::frame::XNotifyingDispatch, // => XDispatch 89cdf0e10cSrcweir // baseclasses 90cdf0e10cSrcweir // Order is neccessary for right initialization! 91cdf0e10cSrcweir private ThreadHelpBase , 92cdf0e10cSrcweir public cppu::OWeakObject 93cdf0e10cSrcweir { 94cdf0e10cSrcweir /* member */ 95cdf0e10cSrcweir private: 96*9807c9deSAriel Constenla-Haile css::uno::Reference< css::uno::XComponentContext > m_xContext; 97cdf0e10cSrcweir 98cdf0e10cSrcweir /* interface */ 99cdf0e10cSrcweir public: 100cdf0e10cSrcweir 101cdf0e10cSrcweir // ctor/dtor 102*9807c9deSAriel Constenla-Haile SystemExec( const css::uno::Reference< css::uno::XComponentContext >& xContext ); 103cdf0e10cSrcweir virtual ~SystemExec( ); 104cdf0e10cSrcweir 105cdf0e10cSrcweir // XInterface, XTypeProvider, XServiceInfo 106cdf0e10cSrcweir FWK_DECLARE_XINTERFACE 107cdf0e10cSrcweir FWK_DECLARE_XTYPEPROVIDER 108cdf0e10cSrcweir DECLARE_XSERVICEINFO 109cdf0e10cSrcweir 110cdf0e10cSrcweir // XDispatchProvider 111cdf0e10cSrcweir virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch ( const css::util::URL& aURL , 112cdf0e10cSrcweir const ::rtl::OUString& sTarget , 113cdf0e10cSrcweir sal_Int32 nFlags ) throw( css::uno::RuntimeException ); 114cdf0e10cSrcweir virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptor ) throw( css::uno::RuntimeException ); 115cdf0e10cSrcweir 116cdf0e10cSrcweir // XNotifyingDispatch 117cdf0e10cSrcweir virtual void SAL_CALL dispatchWithNotification( const css::util::URL& aURL , 118cdf0e10cSrcweir const css::uno::Sequence< css::beans::PropertyValue >& lArguments, 119cdf0e10cSrcweir const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) throw( css::uno::RuntimeException ); 120cdf0e10cSrcweir 121cdf0e10cSrcweir // XDispatch 122cdf0e10cSrcweir virtual void SAL_CALL dispatch ( const css::util::URL& aURL , 123cdf0e10cSrcweir const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException ); 124cdf0e10cSrcweir virtual void SAL_CALL addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xListener , 125cdf0e10cSrcweir const css::util::URL& aURL ) throw( css::uno::RuntimeException ); 126cdf0e10cSrcweir virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener , 127cdf0e10cSrcweir const css::util::URL& aURL ) throw( css::uno::RuntimeException ); 128cdf0e10cSrcweir 129cdf0e10cSrcweir /* internal */ 130cdf0e10cSrcweir private: 131cdf0e10cSrcweir 132cdf0e10cSrcweir void impl_notifyResultListener(const css::uno::Reference< css::frame::XDispatchResultListener >& xListener, 133cdf0e10cSrcweir const sal_Int16 nState ); 134cdf0e10cSrcweir 135cdf0e10cSrcweir }; // class SystemExec 136cdf0e10cSrcweir 137cdf0e10cSrcweir } // namespace framework 138cdf0e10cSrcweir 139cdf0e10cSrcweir #endif // #ifndef __FRAMEWORK_DISPATCH_SYSTEMEXEC_HXX_ 140