Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / forms / source / richtext / featuredispatcher.hxx
blobb36a563c9d0fa622ffa323cbf6f07a41269b3e4b
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_FORMS_SOURCE_RICHTEXT_FEATUREDISPATCHER_HXX
21 #define INCLUDED_FORMS_SOURCE_RICHTEXT_FEATUREDISPATCHER_HXX
23 #include <com/sun/star/frame/XDispatch.hpp>
24 #include <com/sun/star/lang/DisposedException.hpp>
25 #include <comphelper/interfacecontainer2.hxx>
26 #include <cppuhelper/implbase.hxx>
27 #include <comphelper/broadcasthelper.hxx>
29 class EditView;
31 namespace frm
34 typedef ::cppu::WeakImplHelper < css::frame::XDispatch
35 > ORichTextFeatureDispatcher_Base;
37 class ORichTextFeatureDispatcher :public ::comphelper::OBaseMutex
38 ,public ORichTextFeatureDispatcher_Base
40 private:
41 css::util::URL m_aFeatureURL;
42 ::comphelper::OInterfaceContainerHelper2 m_aStatusListeners;
43 EditView* m_pEditView;
44 bool m_bDisposed;
46 protected:
47 EditView* getEditView() { return m_pEditView; }
48 const EditView* getEditView() const { return m_pEditView; }
50 protected:
51 inline const css::util::URL& getFeatureURL() const { return m_aFeatureURL; }
52 inline ::comphelper::OInterfaceContainerHelper2& getStatusListeners() { return m_aStatusListeners; }
53 inline bool isDisposed() const { return m_bDisposed; }
54 inline void checkDisposed() const { if ( isDisposed() ) throw css::lang::DisposedException(); }
56 protected:
57 ORichTextFeatureDispatcher( EditView& _rView, const css::util::URL& _rURL );
58 virtual ~ORichTextFeatureDispatcher( );
60 public:
61 /// clean up resources associated with this instance
62 void dispose();
64 // invalidate the feature, re-retrieve it's state, and broadcast changes, if necessary
65 void invalidate();
67 protected:
68 void newStatusListener( const css::uno::Reference< css::frame::XStatusListener >& _rxListener );
69 // overridables
70 virtual void disposing( ::osl::ClearableMutexGuard& _rClearBeforeNotify );
71 virtual void invalidateFeatureState_Broadcast();
73 // to be overridden, and filled with the info special do your derived class
74 virtual css::frame::FeatureStateEvent
75 buildStatusEvent() const;
77 static void doNotify(
78 const css::uno::Reference< css::frame::XStatusListener >& _rxListener,
79 const css::frame::FeatureStateEvent& _rEvent
82 protected:
83 // XDispatch
84 virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& _rxControl, const css::util::URL& _rURL ) throw (css::uno::RuntimeException, std::exception) override;
85 virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& _rxControl, const css::util::URL& _rURL ) throw (css::uno::RuntimeException, std::exception) override;
89 } // namespace frm
92 #endif // INCLUDED_FORMS_SOURCE_RICHTEXT_FEATUREDISPATCHER_HXX
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */