1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef FORMS_SOURCE_RICHTEXT_ATTRIBUTEDISPATCHER_HXX
28 #define FORMS_SOURCE_RICHTEXT_ATTRIBUTEDISPATCHER_HXX
29 
30 #include "featuredispatcher.hxx"
31 #include "rtattributes.hxx"
32 #include "textattributelistener.hxx"
33 
34 //........................................................................
35 namespace frm
36 {
37 //........................................................................
38 
39 	//====================================================================
40 	//= OAttributeDispatcher
41 	//====================================================================
42     class OAttributeDispatcher  :public ORichTextFeatureDispatcher
43                                 ,public ITextAttributeListener
44 	{
45     protected:
46         IMultiAttributeDispatcher*          m_pMasterDispatcher;
47         AttributeId                         m_nAttributeId;
48 
49     public:
50         /** ctor
51             @param _nAttributeId
52                 the id of the attribute which this instance is responsible for
53             @param _rURL
54                 the URL of the feature which this instance is responsible for
55             @param _pMasterDispatcher
56                 the dispatcher which can execute the given attribute
57             @param _pConverter
58                 an instance which is able to convert between SfxPoolItems and XDispatch-Parameters
59                 If not <NULL/>, the parametrized version of IMultiAttributeDispatcher::executeAttribute
60                 will be used.
61         */
62         OAttributeDispatcher(
63             EditView&                           _rView,
64             AttributeId                         _nAttributeId,
65             const ::com::sun::star::util::URL&  _rURL,
66             IMultiAttributeDispatcher*          _pMasterDispatcher
67         );
68 
69         /// notifies a new attribute state
70         void    notifyAttributeState( const AttributeState& _rState ) SAL_THROW (());
71 
72     protected:
73         ~OAttributeDispatcher( );
74 
75     protected:
76         // XDispatch
77         virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& URL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments ) throw (::com::sun::star::uno::RuntimeException);
78 
79         // ITextAttributeListener
80         virtual void    onAttributeStateChanged( AttributeId _nAttributeId, const AttributeState& _rState );
81 
82         // ORichTextFeatureDispatcher
83         virtual void    disposing( ::osl::ClearableMutexGuard& _rClearBeforeNotify );
84 
85         // ORichTextFeatureDispatcher
86         virtual ::com::sun::star::frame::FeatureStateEvent  buildStatusEvent() const;
87 
88         // own overridables
89         virtual void    fillFeatureEventFromAttributeState( ::com::sun::star::frame::FeatureStateEvent& _rEvent, const AttributeState& _rState ) const;
90 
91     protected:
92         /// notifies our feature state to one particular listener
93         void    notifyState(
94                     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxControl,
95                     const AttributeState& _rState
96                 ) SAL_THROW (());
97 	};
98 
99 //........................................................................
100 } // namespace frm
101 //........................................................................
102 
103 #endif // FORMS_SOURCE_RICHTEXT_ATTRIBUTEDISPATCHER_HXX
104 
105