1*f8e07b45SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f8e07b45SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f8e07b45SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f8e07b45SAndrew Rist * distributed with this work for additional information 6*f8e07b45SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f8e07b45SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f8e07b45SAndrew Rist * "License"); you may not use this file except in compliance 9*f8e07b45SAndrew Rist * with the License. You may obtain a copy of the License at 10*f8e07b45SAndrew Rist * 11*f8e07b45SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*f8e07b45SAndrew Rist * 13*f8e07b45SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f8e07b45SAndrew Rist * software distributed under the License is distributed on an 15*f8e07b45SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f8e07b45SAndrew Rist * KIND, either express or implied. See the License for the 17*f8e07b45SAndrew Rist * specific language governing permissions and limitations 18*f8e07b45SAndrew Rist * under the License. 19*f8e07b45SAndrew Rist * 20*f8e07b45SAndrew Rist *************************************************************/ 21*f8e07b45SAndrew Rist 22*f8e07b45SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef __FRAMEWORK_SERVICES_DISPATCHHELPER_HXX_ 25cdf0e10cSrcweir #define __FRAMEWORK_SERVICES_DISPATCHHELPER_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir //_______________________________________________ 28cdf0e10cSrcweir // my own includes 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx> 31cdf0e10cSrcweir #include <macros/generic.hxx> 32cdf0e10cSrcweir #include <macros/debug.hxx> 33cdf0e10cSrcweir #include <macros/xinterface.hxx> 34cdf0e10cSrcweir #include <macros/xtypeprovider.hxx> 35cdf0e10cSrcweir #include <macros/xserviceinfo.hxx> 36cdf0e10cSrcweir #include <general.h> 37cdf0e10cSrcweir 38cdf0e10cSrcweir //_______________________________________________ 39cdf0e10cSrcweir // interface includes 40cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 41cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchHelper.hpp> 42cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchResultListener.hpp> 43cdf0e10cSrcweir #include <com/sun/star/frame/DispatchResultEvent.hpp> 44cdf0e10cSrcweir 45cdf0e10cSrcweir //_______________________________________________ 46cdf0e10cSrcweir // other includes 47cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx> 48cdf0e10cSrcweir #include <osl/conditn.hxx> 49cdf0e10cSrcweir 50cdf0e10cSrcweir //_______________________________________________ 51cdf0e10cSrcweir // namespace 52cdf0e10cSrcweir 53cdf0e10cSrcweir namespace framework{ 54cdf0e10cSrcweir 55cdf0e10cSrcweir //_______________________________________________ 56cdf0e10cSrcweir // exported const 57cdf0e10cSrcweir 58cdf0e10cSrcweir //_______________________________________________ 59cdf0e10cSrcweir // exported definitions 60cdf0e10cSrcweir 61cdf0e10cSrcweir /** 62cdf0e10cSrcweir @short implements an easy way for dispatches 63cdf0e10cSrcweir @descr Dispatches are splitted into different parts: 64cdf0e10cSrcweir - parsing of the URL 65cdf0e10cSrcweir - searching for a dispatcgh object 66cdf0e10cSrcweir - dispatching of the URL 67cdf0e10cSrcweir All these steps are done inside one method call here. 68cdf0e10cSrcweir */ 69cdf0e10cSrcweir 70cdf0e10cSrcweir class DispatchHelper : public ThreadHelpBase // must be the first base class! 71cdf0e10cSrcweir ,public ::cppu::WeakImplHelper3< ::com::sun::star::lang::XServiceInfo,::com::sun::star::frame::XDispatchHelper,::com::sun::star::frame::XDispatchResultListener > 72cdf0e10cSrcweir { 73cdf0e10cSrcweir 74cdf0e10cSrcweir //------------------------------------------- 75cdf0e10cSrcweir // member 76cdf0e10cSrcweir 77cdf0e10cSrcweir private: 78cdf0e10cSrcweir 79cdf0e10cSrcweir /** global uno service manager. 80cdf0e10cSrcweir Can be used to create own needed services. */ 81cdf0e10cSrcweir css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; 82cdf0e10cSrcweir 83cdf0e10cSrcweir /** used to wait for asynchronous listener callbacks. */ 84cdf0e10cSrcweir ::osl::Condition m_aBlock; 85cdf0e10cSrcweir 86cdf0e10cSrcweir css::uno::Any m_aResult; 87cdf0e10cSrcweir 88cdf0e10cSrcweir css::uno::Reference< css::uno::XInterface > m_xBroadcaster; 89cdf0e10cSrcweir 90cdf0e10cSrcweir //------------------------------------------- 91cdf0e10cSrcweir // interface 92cdf0e10cSrcweir 93cdf0e10cSrcweir public: 94cdf0e10cSrcweir 95cdf0e10cSrcweir //--------------------------------------- 96cdf0e10cSrcweir // ctor/dtor 97cdf0e10cSrcweir 98cdf0e10cSrcweir DispatchHelper( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ); 99cdf0e10cSrcweir virtual ~DispatchHelper( ); 100cdf0e10cSrcweir 101cdf0e10cSrcweir //--------------------------------------- 102cdf0e10cSrcweir // XInterface, XTypeProvider, XServiceInfo 103cdf0e10cSrcweir 104cdf0e10cSrcweir DECLARE_XSERVICEINFO 105cdf0e10cSrcweir 106cdf0e10cSrcweir //--------------------------------------- 107cdf0e10cSrcweir // XDispatchHelper 108cdf0e10cSrcweir virtual css::uno::Any SAL_CALL executeDispatch( 109cdf0e10cSrcweir const css::uno::Reference< css::frame::XDispatchProvider >& xDispatchProvider , 110cdf0e10cSrcweir const ::rtl::OUString& sURL , 111cdf0e10cSrcweir const ::rtl::OUString& sTargetFrameName , 112cdf0e10cSrcweir sal_Int32 nSearchFlags , 113cdf0e10cSrcweir const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) 114cdf0e10cSrcweir throw(css::uno::RuntimeException); 115cdf0e10cSrcweir 116cdf0e10cSrcweir //--------------------------------------- 117cdf0e10cSrcweir // XDispatchResultListener 118cdf0e10cSrcweir virtual void SAL_CALL dispatchFinished( 119cdf0e10cSrcweir const css::frame::DispatchResultEvent& aResult ) 120cdf0e10cSrcweir throw(css::uno::RuntimeException); 121cdf0e10cSrcweir 122cdf0e10cSrcweir //--------------------------------------- 123cdf0e10cSrcweir // XEventListener 124cdf0e10cSrcweir virtual void SAL_CALL disposing( 125cdf0e10cSrcweir const css::lang::EventObject& aEvent ) 126cdf0e10cSrcweir throw(css::uno::RuntimeException); 127cdf0e10cSrcweir }; 128cdf0e10cSrcweir 129cdf0e10cSrcweir } 130cdf0e10cSrcweir 131cdf0e10cSrcweir #endif 132