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