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