LibreOffice Module framework (master) 1
dispatchhelper.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_FRAMEWORK_INC_SERVICES_DISPATCHHELPER_HXX
21#define INCLUDED_FRAMEWORK_INC_SERVICES_DISPATCHHELPER_HXX
22
23#include <config_options.h>
24#include <com/sun/star/frame/XDispatchHelper.hpp>
25#include <com/sun/star/frame/XDispatchResultListener.hpp>
26#include <com/sun/star/lang/XServiceInfo.hpp>
27#include <com/sun/star/uno/Any.hxx>
28
30#include <framework/fwkdllapi.h>
31#include <condition_variable>
32#include <mutex>
33
35{
36class XMultiServiceFactory;
37}
39{
40class XSingleServiceFactory;
41}
42namespace com::sun::star::uno
43{
44class XComponentContext;
45}
46
47namespace framework
48{
57class UNLESS_MERGELIBS(FWK_DLLPUBLIC) DispatchHelper final
58 : public ::cppu::WeakImplHelper<css::lang::XServiceInfo, css::frame::XDispatchHelper,
59 css::frame::XDispatchResultListener>
60{
61 std::mutex m_mutex;
62
65 css::uno::Reference<css::uno::XComponentContext> m_xContext;
66
68 std::condition_variable m_aBlock;
69 bool m_aBlockFlag;
70
71 css::uno::Any m_aResult;
72
73 css::uno::Reference<css::uno::XInterface> m_xBroadcaster;
74
75 // interface
76
77public:
78 // ctor/dtor
79
80 DispatchHelper(css::uno::Reference<css::uno::XComponentContext> xContext);
81 virtual ~DispatchHelper() override;
82
83 // XServiceInfo
84 virtual OUString SAL_CALL getImplementationName() override;
85 virtual sal_Bool SAL_CALL supportsService(const OUString& sServiceName) override;
86 virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
87
88 // XDispatchHelper
89 virtual css::uno::Any SAL_CALL
90 executeDispatch(const css::uno::Reference<css::frame::XDispatchProvider>& xDispatchProvider,
91 const OUString& sURL, const OUString& sTargetFrameName, sal_Int32 nSearchFlags,
92 const css::uno::Sequence<css::beans::PropertyValue>& lArguments) override;
93
94 // not a public XDispatchHelper-method, need in sfx2/source/control/statcach.cxx for extensions
96 const css::uno::Any&
97 executeDispatch(const css::uno::Reference<css::frame::XDispatch>& xDispatch,
98 const css::util::URL& aURL, bool SyncronFlag,
99 const css::uno::Sequence<css::beans::PropertyValue>& lArguments);
100
101 // XDispatchResultListener
102 virtual void SAL_CALL dispatchFinished(const css::frame::DispatchResultEvent& aResult) override;
103
104 // XEventListener
105 virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) override;
106};
107}
108
109#endif
110
111/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::uno::XComponentContext > m_xContext
std::mutex m_mutex
Definition: loadenv.cxx:108
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
unsigned char sal_Bool
Any m_aResult