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