1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef FORMS_SOURCE_RICHTEXT_ATTRIBUTEDISPATCHER_HXX
24 #define FORMS_SOURCE_RICHTEXT_ATTRIBUTEDISPATCHER_HXX
25 
26 #include "featuredispatcher.hxx"
27 #include "rtattributes.hxx"
28 #include "textattributelistener.hxx"
29 
30 //........................................................................
31 namespace frm
32 {
33 //........................................................................
34 
35 	//====================================================================
36 	//= OAttributeDispatcher
37 	//====================================================================
38     class OAttributeDispatcher  :public ORichTextFeatureDispatcher
39                                 ,public ITextAttributeListener
40 	{
41     protected:
42         IMultiAttributeDispatcher*          m_pMasterDispatcher;
43         AttributeId                         m_nAttributeId;
44 
45     public:
46         /** ctor
47             @param _nAttributeId
48                 the id of the attribute which this instance is responsible for
49             @param _rURL
50                 the URL of the feature which this instance is responsible for
51             @param _pMasterDispatcher
52                 the dispatcher which can execute the given attribute
53             @param _pConverter
54                 an instance which is able to convert between SfxPoolItems and XDispatch-Parameters
55                 If not <NULL/>, the parametrized version of IMultiAttributeDispatcher::executeAttribute
56                 will be used.
57         */
58         OAttributeDispatcher(
59             EditView&                           _rView,
60             AttributeId                         _nAttributeId,
61             const ::com::sun::star::util::URL&  _rURL,
62             IMultiAttributeDispatcher*          _pMasterDispatcher
63         );
64 
65         /// notifies a new attribute state
66         void    notifyAttributeState( const AttributeState& _rState ) SAL_THROW (());
67 
68     protected:
69         ~OAttributeDispatcher( );
70 
71     protected:
72         // XDispatch
73         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);
74 
75         // ITextAttributeListener
76         virtual void    onAttributeStateChanged( AttributeId _nAttributeId, const AttributeState& _rState );
77 
78         // ORichTextFeatureDispatcher
79         virtual void    disposing( ::osl::ClearableMutexGuard& _rClearBeforeNotify );
80 
81         // ORichTextFeatureDispatcher
82         virtual ::com::sun::star::frame::FeatureStateEvent  buildStatusEvent() const;
83 
84         // own overridables
85         virtual void    fillFeatureEventFromAttributeState( ::com::sun::star::frame::FeatureStateEvent& _rEvent, const AttributeState& _rState ) const;
86 
87     protected:
88         /// notifies our feature state to one particular listener
89         void    notifyState(
90                     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxControl,
91                     const AttributeState& _rState
92                 ) SAL_THROW (());
93 	};
94 
95 //........................................................................
96 } // namespace frm
97 //........................................................................
98 
99 #endif // FORMS_SOURCE_RICHTEXT_ATTRIBUTEDISPATCHER_HXX
100 
101