merge the formfield patch from ooo-build
[ooovba.git] / framework / inc / services / dispatchhelper.hxx
blob7708a8944fd33f2727056adc9a4b16e92f522c00
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dispatchhelper.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __FRAMEWORK_SERVICES_DISPATCHHELPER_HXX_
32 #define __FRAMEWORK_SERVICES_DISPATCHHELPER_HXX_
34 //_______________________________________________
35 // my own includes
37 #include <threadhelp/threadhelpbase.hxx>
38 #include <macros/generic.hxx>
39 #include <macros/debug.hxx>
40 #include <macros/xinterface.hxx>
41 #include <macros/xtypeprovider.hxx>
42 #include <macros/xserviceinfo.hxx>
43 #include <general.h>
45 //_______________________________________________
46 // interface includes
47 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
48 #include <com/sun/star/frame/XDispatchHelper.hpp>
49 #include <com/sun/star/frame/XDispatchResultListener.hpp>
50 #include <com/sun/star/frame/DispatchResultEvent.hpp>
52 //_______________________________________________
53 // other includes
54 #include <cppuhelper/implbase3.hxx>
55 #include <osl/conditn.hxx>
57 //_______________________________________________
58 // namespace
60 namespace framework{
62 //_______________________________________________
63 // exported const
65 //_______________________________________________
66 // exported definitions
68 /**
69 @short implements an easy way for dispatches
70 @descr Dispatches are splitted into different parts:
71 - parsing of the URL
72 - searching for a dispatcgh object
73 - dispatching of the URL
74 All these steps are done inside one method call here.
77 class DispatchHelper : public ThreadHelpBase // must be the first base class!
78 ,public ::cppu::WeakImplHelper3< ::com::sun::star::lang::XServiceInfo,::com::sun::star::frame::XDispatchHelper,::com::sun::star::frame::XDispatchResultListener >
81 //-------------------------------------------
82 // member
84 private:
86 /** global uno service manager.
87 Can be used to create own needed services. */
88 css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
90 /** used to wait for asynchronous listener callbacks. */
91 ::osl::Condition m_aBlock;
93 css::uno::Any m_aResult;
95 css::uno::Reference< css::uno::XInterface > m_xBroadcaster;
97 //-------------------------------------------
98 // interface
100 public:
102 //---------------------------------------
103 // ctor/dtor
105 DispatchHelper( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR );
106 virtual ~DispatchHelper( );
108 //---------------------------------------
109 // XInterface, XTypeProvider, XServiceInfo
111 DECLARE_XSERVICEINFO
113 //---------------------------------------
114 // XDispatchHelper
115 virtual css::uno::Any SAL_CALL executeDispatch(
116 const css::uno::Reference< css::frame::XDispatchProvider >& xDispatchProvider ,
117 const ::rtl::OUString& sURL ,
118 const ::rtl::OUString& sTargetFrameName ,
119 sal_Int32 nSearchFlags ,
120 const css::uno::Sequence< css::beans::PropertyValue >& lArguments )
121 throw(css::uno::RuntimeException);
123 //---------------------------------------
124 // XDispatchResultListener
125 virtual void SAL_CALL dispatchFinished(
126 const css::frame::DispatchResultEvent& aResult )
127 throw(css::uno::RuntimeException);
129 //---------------------------------------
130 // XEventListener
131 virtual void SAL_CALL disposing(
132 const css::lang::EventObject& aEvent )
133 throw(css::uno::RuntimeException);
138 #endif