tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / svx / source / inc / formfeaturedispatcher.hxx
blob62fe40e699c3d3344d8f5511033f4eb60bc865a4
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/form/runtime/XFormOperations.hpp>
26 #include <cppuhelper/implbase.hxx>
27 #include <comphelper/interfacecontainer3.hxx>
30 namespace svx
33 typedef ::cppu::WeakImplHelper < css::frame::XDispatch
34 > OSingleFeatureDispatcher_Base;
36 class OSingleFeatureDispatcher final : public OSingleFeatureDispatcher_Base
38 public:
39 /** constructs the dispatcher
41 @param _rFeatureURL
42 the URL of the feature which this instance is responsible for
44 @param _nFeatureId
45 the feature which this instance is responsible for
47 @param _rController
48 the controller which is responsible for providing the state of feature of this instance,
49 and for executing it. After disposing the dispatcher instance, the controller will
50 not be accessed anymore
52 @see dispose
54 OSingleFeatureDispatcher(
55 css::util::URL _aFeatureURL,
56 const sal_Int16 _nFormFeature,
57 const css::uno::Reference< css::form::runtime::XFormOperations >& _rxFormOperations,
58 ::osl::Mutex& _rMutex
61 /** notifies all our listeners of the current state
63 void updateAllListeners();
65 private:
66 // XDispatch
67 virtual void SAL_CALL dispatch( const css::util::URL& _rURL, const css::uno::Sequence< css::beans::PropertyValue >& _rArguments ) override;
68 virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& _rxControl, const css::util::URL& _rURL ) override;
69 virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& _rxControl, const css::util::URL& _rURL ) override;
71 /** notifies our current state to one or all listeners
73 @param _rxListener
74 the listener to notify. May be NULL, in this case all our listeners will be
75 notified with the current state
77 @param _rFreeForNotification
78 a guard which currently locks our mutex, and which is to be cleared
79 for actually doing the notification(s)
81 void notifyStatus(
82 const css::uno::Reference< css::frame::XStatusListener >& _rxListener,
83 ::osl::ClearableMutexGuard& _rFreeForNotification
86 /** retrieves the current status of our feature, in a format which can be used
87 for UNO notifications
89 @precond
90 our mutex is locked
92 void getUnoState( css::frame::FeatureStateEvent& /* [out] */ _rState ) const;
94 ::osl::Mutex& m_rMutex;
95 ::comphelper::OInterfaceContainerHelper3<css::frame::XStatusListener> m_aStatusListeners;
96 css::uno::Reference< css::form::runtime::XFormOperations >
97 m_xFormOperations;
98 const css::util::URL m_aFeatureURL;
99 css::uno::Any m_aLastKnownState;
100 const sal_Int16 m_nFormFeature;
101 bool m_bLastKnownEnabled;
109 #endif
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */