Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef SVX_SOURCE_INC_FMTEXTCONTROLFEATURE_HXX
21 : #define SVX_SOURCE_INC_FMTEXTCONTROLFEATURE_HXX
22 :
23 : #include <com/sun/star/beans/PropertyValue.hpp>
24 : #include <com/sun/star/frame/XDispatch.hpp>
25 : #include <com/sun/star/frame/XStatusListener.hpp>
26 : #include <com/sun/star/util/URL.hpp>
27 : #include <cppuhelper/implbase1.hxx>
28 : #include "fmslotinvalidator.hxx"
29 :
30 : //........................................................................
31 : namespace svx
32 : {
33 : //........................................................................
34 :
35 : //====================================================================
36 : //= FmTextControlFeature
37 : //====================================================================
38 : typedef ::cppu::WeakImplHelper1 < ::com::sun::star::frame::XStatusListener
39 : > FmTextControlFeature_Base;
40 :
41 : class FmTextControlFeature : public FmTextControlFeature_Base
42 : {
43 : private:
44 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >
45 : m_xDispatcher;
46 : ::com::sun::star::util::URL m_aFeatureURL;
47 : ::com::sun::star::uno::Any m_aFeatureState;
48 : SfxSlotId m_nSlotId;
49 : ISlotInvalidator* m_pInvalidator;
50 : bool m_bFeatureEnabled;
51 :
52 : public:
53 : /** constructs an FmTextControlFeature object
54 : @param _rxDispatcher
55 : the dispatcher which the instance should work with
56 : @param _rFeatureURL
57 : the URL which the instance should be responsible for
58 : */
59 : FmTextControlFeature(
60 : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _rxDispatcher,
61 : const ::com::sun::star::util::URL& _rFeatureURL,
62 : SfxSlotId _nId,
63 : ISlotInvalidator* _pInvalidator
64 : );
65 :
66 : /// determines whether the feature we're responsible for is currently enabled
67 0 : inline bool isFeatureEnabled( ) const { return m_bFeatureEnabled; }
68 0 : inline const ::com::sun::star::uno::Any& getFeatureState( ) const { return m_aFeatureState; }
69 :
70 : /** dispatches the feature URL to the dispatcher
71 : */
72 : void dispatch() const SAL_THROW(());
73 :
74 : /** dispatches the feature URL to the dispatcher, with passing the given arguments
75 : */
76 : void dispatch( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArgs ) const SAL_THROW(());
77 :
78 : /// releases any resources associated with this instance
79 : void dispose() SAL_THROW(());
80 :
81 : protected:
82 : ~FmTextControlFeature();
83 :
84 : protected:
85 : // XStatusListener
86 : virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& State ) throw (::com::sun::star::uno::RuntimeException);
87 : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
88 : };
89 :
90 : //........................................................................
91 : } // namespace svx
92 : //........................................................................
93 :
94 : #endif // SVX_SOURCE_INC_FMTEXTCONTROLFEATURE_HXX
95 :
96 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|