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