update dev300-m57
[ooovba.git] / framework / inc / services / dispatchhelper.hxx
blobd6bae3833a34ab771d3847d314944ebd24b6eb2a
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/weak.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 css::lang::XTypeProvider
78 , public css::lang::XServiceInfo
79 , public css::frame::XDispatchHelper
80 , public css::frame::XDispatchResultListener // => XEventListener
81 , public ThreadHelpBase // must be the first base class!
82 , public ::cppu::OWeakObject // => XInterface, XWeak
85 //-------------------------------------------
86 // member
88 private:
90 /** global uno service manager.
91 Can be used to create own needed services. */
92 css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
94 /** used to wait for asynchronous listener callbacks. */
95 ::osl::Condition m_aBlock;
97 css::uno::Any m_aResult;
99 css::uno::Reference< css::uno::XInterface > m_xBroadcaster;
101 //-------------------------------------------
102 // interface
104 public:
106 //---------------------------------------
107 // ctor/dtor
109 DispatchHelper( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR );
110 virtual ~DispatchHelper( );
112 //---------------------------------------
113 // XInterface, XTypeProvider, XServiceInfo
115 FWK_DECLARE_XINTERFACE
116 FWK_DECLARE_XTYPEPROVIDER
117 DECLARE_XSERVICEINFO
119 //---------------------------------------
120 // XDispatchHelper
121 virtual css::uno::Any SAL_CALL executeDispatch(
122 const css::uno::Reference< css::frame::XDispatchProvider >& xDispatchProvider ,
123 const ::rtl::OUString& sURL ,
124 const ::rtl::OUString& sTargetFrameName ,
125 sal_Int32 nSearchFlags ,
126 const css::uno::Sequence< css::beans::PropertyValue >& lArguments )
127 throw(css::uno::RuntimeException);
129 //---------------------------------------
130 // XDispatchResultListener
131 virtual void SAL_CALL dispatchFinished(
132 const css::frame::DispatchResultEvent& aResult )
133 throw(css::uno::RuntimeException);
135 //---------------------------------------
136 // XEventListener
137 virtual void SAL_CALL disposing(
138 const css::lang::EventObject& aEvent )
139 throw(css::uno::RuntimeException);
144 #endif