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 INCLUDED_FRAMEWORK_INC_SERVICES_DISPATCHHELPER_HXX
21 #define INCLUDED_FRAMEWORK_INC_SERVICES_DISPATCHHELPER_HXX
23 #include <macros/generic.hxx>
24 #include <macros/xinterface.hxx>
25 #include <macros/xtypeprovider.hxx>
26 #include <macros/xserviceinfo.hxx>
29 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
30 #include <com/sun/star/frame/XDispatchHelper.hpp>
31 #include <com/sun/star/frame/XDispatchResultListener.hpp>
32 #include <com/sun/star/frame/DispatchResultEvent.hpp>
34 #include <cppuhelper/implbase3.hxx>
35 #include <osl/conditn.hxx>
40 @short implements an easy way for dispatches
41 @descr Dispatches are splitted into different parts:
43 - searching for a dispatcgh object
44 - dispatching of the URL
45 All these steps are done inside one method call here.
48 class DispatchHelper
: public ::cppu::WeakImplHelper3
< ::com::sun::star::lang::XServiceInfo
,::com::sun::star::frame::XDispatchHelper
,::com::sun::star::frame::XDispatchResultListener
>
57 /** global uno service manager.
58 Can be used to create own needed services. */
59 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
61 /** used to wait for asynchronous listener callbacks. */
62 ::osl::Condition m_aBlock
;
64 css::uno::Any m_aResult
;
66 css::uno::Reference
< css::uno::XInterface
> m_xBroadcaster
;
74 DispatchHelper( const css::uno::Reference
< css::uno::XComponentContext
>& xContext
);
75 virtual ~DispatchHelper( );
77 // XInterface, XTypeProvider, XServiceInfo
82 virtual css::uno::Any SAL_CALL
executeDispatch(
83 const css::uno::Reference
< css::frame::XDispatchProvider
>& xDispatchProvider
,
84 const OUString
& sURL
,
85 const OUString
& sTargetFrameName
,
86 sal_Int32 nSearchFlags
,
87 const css::uno::Sequence
< css::beans::PropertyValue
>& lArguments
)
88 throw(css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
90 // XDispatchResultListener
91 virtual void SAL_CALL
dispatchFinished(
92 const css::frame::DispatchResultEvent
& aResult
)
93 throw(css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
96 virtual void SAL_CALL
disposing(
97 const css::lang::EventObject
& aEvent
)
98 throw(css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */