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 INCLUDED_SFX2_SFXSTATUSLISTENER_HXX
21 : #define INCLUDED_SFX2_SFXSTATUSLISTENER_HXX
22 :
23 : #include <sal/config.h>
24 : #include <sfx2/dllapi.h>
25 : #include <svl/poolitem.hxx>
26 : #include <cppuhelper/weak.hxx>
27 : #include <osl/conditn.hxx>
28 : #include <com/sun/star/frame/FeatureStateEvent.hpp>
29 : #include <com/sun/star/frame/XDispatchProvider.hpp>
30 : #include <com/sun/star/lang/XComponent.hpp>
31 : #include <com/sun/star/frame/XStatusListener.hpp>
32 :
33 : #include <cppuhelper/implbase2.hxx>
34 :
35 : // Interface for implementations which needs to get notifications about state changes
36 0 : class SfxStatusListenerInterface
37 : {
38 : public:
39 : virtual void StateChanged( sal_uInt16 nSlotId, SfxItemState eState, const SfxPoolItem* pState ) = 0;
40 :
41 : protected:
42 0 : ~SfxStatusListenerInterface() {}
43 : };
44 :
45 : class SFX2_DLLPUBLIC SfxStatusListener : public ::cppu::WeakImplHelper2<
46 : css::frame::XStatusListener,
47 : css::lang::XComponent>
48 : {
49 : public:
50 :
51 : SfxStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider, sal_uInt16 nSlotId, const OUString& aCommand );
52 : virtual ~SfxStatusListener();
53 :
54 : // old methods from SfxControllerItem
55 14282 : sal_uInt16 GetId() const { return m_nSlotID; }
56 : void UnBind();
57 : void ReBind();
58 :
59 : virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
60 :
61 : // XComponent
62 : virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
63 : virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
64 : virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
65 :
66 : // XEventListener
67 : virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
68 :
69 : // XStatusListener
70 : virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
71 :
72 : private:
73 : SfxStatusListener( const SfxStatusListener& );
74 : SfxStatusListener();
75 : SfxStatusListener& operator=( const SfxStatusListener& );
76 :
77 : sal_uInt16 m_nSlotID;
78 : ::com::sun::star::util::URL m_aCommand;
79 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xDispatchProvider;
80 : ::com::sun::star::uno::Reference< com::sun::star::frame::XDispatch > m_xDispatch;
81 : };
82 :
83 : #endif // INCLUDED_SFX2_SFXSTATUSLISTENER_HXX
84 :
85 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|