Branch data Line data Source code
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 FORMS_SOURCE_RICHTEXT_FEATUREDISPATCHER_HXX
21 : : #define FORMS_SOURCE_RICHTEXT_FEATUREDISPATCHER_HXX
22 : :
23 : : #include <com/sun/star/frame/XDispatch.hpp>
24 : : #include <com/sun/star/lang/DisposedException.hpp>
25 : : #include <cppuhelper/interfacecontainer.hxx>
26 : : #include <cppuhelper/implbase1.hxx>
27 : : #include <comphelper/broadcasthelper.hxx>
28 : :
29 : : class EditView;
30 : : //........................................................................
31 : : namespace frm
32 : : {
33 : : //........................................................................
34 : :
35 : : //====================================================================
36 : : //= ORichTextFeatureDispatcher
37 : : //====================================================================
38 : : typedef ::cppu::WeakImplHelper1 < ::com::sun::star::frame::XDispatch
39 : : > ORichTextFeatureDispatcher_Base;
40 : :
41 : : class ORichTextFeatureDispatcher :public ::comphelper::OBaseMutex
42 : : ,public ORichTextFeatureDispatcher_Base
43 : : {
44 : : private:
45 : : ::com::sun::star::util::URL m_aFeatureURL;
46 : : ::cppu::OInterfaceContainerHelper m_aStatusListeners;
47 : : EditView* m_pEditView;
48 : : bool m_bDisposed;
49 : :
50 : : protected:
51 : 0 : EditView* getEditView() { return m_pEditView; }
52 : 0 : const EditView* getEditView() const { return m_pEditView; }
53 : :
54 : : protected:
55 : 0 : inline const ::com::sun::star::util::URL& getFeatureURL() const { return m_aFeatureURL; }
56 : 0 : inline ::cppu::OInterfaceContainerHelper& getStatusListeners() { return m_aStatusListeners; }
57 : 0 : inline bool isDisposed() const { return m_bDisposed; }
58 [ # # ][ # # ]: 0 : inline void checkDisposed() const { if ( isDisposed() ) throw ::com::sun::star::lang::DisposedException(); }
59 : :
60 : : protected:
61 : : ORichTextFeatureDispatcher( EditView& _rView, const ::com::sun::star::util::URL& _rURL );
62 : : ~ORichTextFeatureDispatcher( );
63 : :
64 : : public:
65 : : /// clean up resources associated with this instance
66 : : void dispose();
67 : :
68 : : // invalidate the feature, re-retrieve it's state, and broadcast changes, if necessary
69 : : void invalidate();
70 : :
71 : : protected:
72 : : // overridables
73 : : virtual void newStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxListener );
74 : : virtual void disposing( ::osl::ClearableMutexGuard& _rClearBeforeNotify );
75 : : virtual void invalidateFeatureState_Broadcast();
76 : :
77 : : // to be overridden, and filled with the info special do your derived class
78 : : virtual ::com::sun::star::frame::FeatureStateEvent
79 : : buildStatusEvent() const;
80 : :
81 : : void doNotify(
82 : : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxListener,
83 : : const ::com::sun::star::frame::FeatureStateEvent& _rEvent
84 : : ) const SAL_THROW(());
85 : :
86 : : protected:
87 : : // XDispatch
88 : : virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxControl, const ::com::sun::star::util::URL& _rURL ) throw (::com::sun::star::uno::RuntimeException);
89 : : virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxControl, const ::com::sun::star::util::URL& _rURL ) throw (::com::sun::star::uno::RuntimeException);
90 : : };
91 : :
92 : : //........................................................................
93 : : } // namespace frm
94 : : //........................................................................
95 : :
96 : : #endif // FORMS_SOURCE_RICHTEXT_FEATUREDISPATCHER_HXX
97 : :
98 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|