1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 FORMS_SOURCE_RICHTEXT_FEATUREDISPATCHER_HXX
21 #define FORMS_SOURCE_RICHTEXT_FEATUREDISPATCHER_HXX
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>
30 //........................................................................
33 //........................................................................
35 //====================================================================
36 //= ORichTextFeatureDispatcher
37 //====================================================================
38 typedef ::cppu::WeakImplHelper1
< ::com::sun::star::frame::XDispatch
39 > ORichTextFeatureDispatcher_Base
;
41 class ORichTextFeatureDispatcher
:public ::comphelper::OBaseMutex
42 ,public ORichTextFeatureDispatcher_Base
45 ::com::sun::star::util::URL m_aFeatureURL
;
46 ::cppu::OInterfaceContainerHelper m_aStatusListeners
;
47 EditView
* m_pEditView
;
51 EditView
* getEditView() { return m_pEditView
; }
52 const EditView
* getEditView() const { return m_pEditView
; }
55 inline const ::com::sun::star::util::URL
& getFeatureURL() const { return m_aFeatureURL
; }
56 inline ::cppu::OInterfaceContainerHelper
& getStatusListeners() { return m_aStatusListeners
; }
57 inline bool isDisposed() const { return m_bDisposed
; }
58 inline void checkDisposed() const { if ( isDisposed() ) throw ::com::sun::star::lang::DisposedException(); }
61 ORichTextFeatureDispatcher( EditView
& _rView
, const ::com::sun::star::util::URL
& _rURL
);
62 ~ORichTextFeatureDispatcher( );
65 /// clean up resources associated with this instance
68 // invalidate the feature, re-retrieve it's state, and broadcast changes, if necessary
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();
77 // to be overridden, and filled with the info special do your derived class
78 virtual ::com::sun::star::frame::FeatureStateEvent
79 buildStatusEvent() const;
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(());
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
);
92 //........................................................................
94 //........................................................................
96 #endif // FORMS_SOURCE_RICHTEXT_FEATUREDISPATCHER_HXX
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */