Bump version to 6.4-15
[LibreOffice.git] / svx / source / inc / formfeaturedispatcher.hxx
blobb0d683ab6827a09aeaf09d79e4be70d5d66da700
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_SVX_SOURCE_INC_FORMFEATUREDISPATCHER_HXX
21 #define INCLUDED_SVX_SOURCE_INC_FORMFEATUREDISPATCHER_HXX
23 #include <com/sun/star/frame/XDispatch.hpp>
24 #include <com/sun/star/lang/DisposedException.hpp>
25 #include <com/sun/star/form/runtime/XFormOperations.hpp>
27 #include <cppuhelper/implbase.hxx>
28 #include <comphelper/interfacecontainer2.hxx>
31 namespace svx
34 typedef ::cppu::WeakImplHelper < css::frame::XDispatch
35 > OSingleFeatureDispatcher_Base;
37 class OSingleFeatureDispatcher final : public OSingleFeatureDispatcher_Base
39 public:
40 /** constructs the dispatcher
42 @param _rFeatureURL
43 the URL of the feature which this instance is responsible for
45 @param _nFeatureId
46 the feature which this instance is responsible for
48 @param _rController
49 the controller which is responsible for providing the state of feature of this instance,
50 and for executing it. After disposing the dispatcher instance, the controller will
51 not be accessed anymore
53 @see dispose
55 OSingleFeatureDispatcher(
56 const css::util::URL& _rFeatureURL,
57 const sal_Int16 _nFormFeature,
58 const css::uno::Reference< css::form::runtime::XFormOperations >& _rxFormOperations,
59 ::osl::Mutex& _rMutex
62 /** notifies all our listeners of the current state
64 void updateAllListeners();
66 private:
67 // XDispatch
68 virtual void SAL_CALL dispatch( const css::util::URL& _rURL, const css::uno::Sequence< css::beans::PropertyValue >& _rArguments ) override;
69 virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& _rxControl, const css::util::URL& _rURL ) override;
70 virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& _rxControl, const css::util::URL& _rURL ) override;
72 /** notifies our current state to one or all listeners
74 @param _rxListener
75 the listener to notify. May be NULL, in this case all our listeners will be
76 notified with the current state
78 @param _rFreeForNotification
79 a guard which currently locks our mutex, and which is to be cleared
80 for actually doing the notification(s)
82 void notifyStatus(
83 const css::uno::Reference< css::frame::XStatusListener >& _rxListener,
84 ::osl::ClearableMutexGuard& _rFreeForNotification
87 /** retrieves the current status of our feature, in a format which can be used
88 for UNO notifications
90 @precond
91 our mutex is locked
93 void getUnoState( css::frame::FeatureStateEvent& /* [out] */ _rState ) const;
95 ::osl::Mutex& m_rMutex;
96 ::comphelper::OInterfaceContainerHelper2 m_aStatusListeners;
97 css::uno::Reference< css::form::runtime::XFormOperations >
98 m_xFormOperations;
99 const css::util::URL m_aFeatureURL;
100 css::uno::Any m_aLastKnownState;
101 const sal_Int16 m_nFormFeature;
102 bool m_bLastKnownEnabled;
110 #endif
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */