1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef __FRAMEWORK_SERVICES_DISPATCHHELPER_HXX_
21 #define __FRAMEWORK_SERVICES_DISPATCHHELPER_HXX_
23 #include <threadhelp/threadhelpbase.hxx>
24 #include <macros/generic.hxx>
25 #include <macros/debug.hxx>
26 #include <macros/xinterface.hxx>
27 #include <macros/xtypeprovider.hxx>
28 #include <macros/xserviceinfo.hxx>
31 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
32 #include <com/sun/star/frame/XDispatchHelper.hpp>
33 #include <com/sun/star/frame/XDispatchResultListener.hpp>
34 #include <com/sun/star/frame/DispatchResultEvent.hpp>
36 #include <cppuhelper/implbase3.hxx>
37 #include <osl/conditn.hxx>
42 @short implements an easy way for dispatches
43 @descr Dispatches are splitted into different parts:
45 - searching for a dispatcgh object
46 - dispatching of the URL
47 All these steps are done inside one method call here.
50 class DispatchHelper
: public ThreadHelpBase
// must be the first base class!
51 ,public ::cppu::WeakImplHelper3
< ::com::sun::star::lang::XServiceInfo
,::com::sun::star::frame::XDispatchHelper
,::com::sun::star::frame::XDispatchResultListener
>
54 //-------------------------------------------
59 /** global uno service manager.
60 Can be used to create own needed services. */
61 css::uno::Reference
< css::lang::XMultiServiceFactory
> m_xSMGR
;
63 /** used to wait for asynchronous listener callbacks. */
64 ::osl::Condition m_aBlock
;
66 css::uno::Any m_aResult
;
68 css::uno::Reference
< css::uno::XInterface
> m_xBroadcaster
;
70 //-------------------------------------------
75 //---------------------------------------
78 DispatchHelper( const css::uno::Reference
< css::lang::XMultiServiceFactory
>& xSMGR
);
79 virtual ~DispatchHelper( );
81 //---------------------------------------
82 // XInterface, XTypeProvider, XServiceInfo
86 //---------------------------------------
88 virtual css::uno::Any SAL_CALL
executeDispatch(
89 const css::uno::Reference
< css::frame::XDispatchProvider
>& xDispatchProvider
,
90 const OUString
& sURL
,
91 const OUString
& sTargetFrameName
,
92 sal_Int32 nSearchFlags
,
93 const css::uno::Sequence
< css::beans::PropertyValue
>& lArguments
)
94 throw(css::uno::RuntimeException
);
96 //---------------------------------------
97 // XDispatchResultListener
98 virtual void SAL_CALL
dispatchFinished(
99 const css::frame::DispatchResultEvent
& aResult
)
100 throw(css::uno::RuntimeException
);
102 //---------------------------------------
104 virtual void SAL_CALL
disposing(
105 const css::lang::EventObject
& aEvent
)
106 throw(css::uno::RuntimeException
);
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */