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 
24 #ifndef SVX_SOURCE_INC_FMTEXTCONTROLFEATURE_HXX
25 #define SVX_SOURCE_INC_FMTEXTCONTROLFEATURE_HXX
26 
27 /** === begin UNO includes === **/
28 #include <com/sun/star/beans/PropertyValue.hpp>
29 #include <com/sun/star/frame/XDispatch.hpp>
30 #include <com/sun/star/frame/XStatusListener.hpp>
31 #include <com/sun/star/util/URL.hpp>
32 /** === end UNO includes === **/
33 #include <cppuhelper/implbase1.hxx>
34 #include "fmslotinvalidator.hxx"
35 
36 //........................................................................
37 namespace svx
38 {
39 //........................................................................
40 
41 	//====================================================================
42 	//= FmTextControlFeature
43 	//====================================================================
44     typedef ::cppu::WeakImplHelper1 <   ::com::sun::star::frame::XStatusListener
45                                     >   FmTextControlFeature_Base;
46 
47     class FmTextControlFeature : public FmTextControlFeature_Base
48 	{
49     private:
50         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >
51                                         m_xDispatcher;
52         ::com::sun::star::util::URL     m_aFeatureURL;
53         ::com::sun::star::uno::Any      m_aFeatureState;
54         SfxSlotId                       m_nSlotId;
55         ISlotInvalidator*               m_pInvalidator;
56         bool                            m_bFeatureEnabled;
57 
58     public:
59         /** constructs an FmTextControlFeature object
60         @param _rxDispatcher
61             the dispatcher which the instance should work with
62         @param _rFeatureURL
63             the URL which the instance should be responsible for
64         */
65         FmTextControlFeature(
66             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _rxDispatcher,
67             const ::com::sun::star::util::URL& _rFeatureURL,
68             SfxSlotId _nId,
69             ISlotInvalidator* _pInvalidator
70         );
71 
72         /// determines whether the feature we're responsible for is currently enabled
isFeatureEnabled() const73         inline  bool                                isFeatureEnabled( ) const { return m_bFeatureEnabled; }
getFeatureState() const74         inline  const ::com::sun::star::uno::Any&   getFeatureState( ) const { return m_aFeatureState; }
75 
76         /** dispatches the feature URL to the dispatcher
77         */
78         void    dispatch() const SAL_THROW(());
79 
80         /** dispatches the feature URL to the dispatcher, with passing the given arguments
81         */
82         void    dispatch( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArgs ) const SAL_THROW(());
83 
84         /// releases any resources associated with this instance
85         void    dispose() SAL_THROW(());
86 
87     protected:
88         ~FmTextControlFeature();
89 
90     protected:
91         // XStatusListener
92         virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& State ) throw (::com::sun::star::uno::RuntimeException);
93         virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
94 	};
95 
96 //........................................................................
97 } // namespace svx
98 //........................................................................
99 
100 #endif // SVX_SOURCE_INC_FMTEXTCONTROLFEATURE_HXX
101 
102