bump product version to 4.2.0.1
[LibreOffice.git] / include / sfx2 / sfxstatuslistener.hxx
blobd404f47ee8218ae321320c0851bd01fc1d45704d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SFX2_SFXSTATUSLISTENER_HXX
21 #define INCLUDED_SFX2_SFXSTATUSLISTENER_HXX
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>
33 #include <cppuhelper/implbase2.hxx>
35 // Interface for implementations which needs to get notifications about state changes
36 class SfxStatusListenerInterface
38 public:
39 virtual void StateChanged( sal_uInt16 nSlotId, SfxItemState eState, const SfxPoolItem* pState ) = 0;
41 protected:
42 ~SfxStatusListenerInterface() {}
45 class SFX2_DLLPUBLIC SfxStatusListener : public ::cppu::WeakImplHelper2<
46 css::frame::XStatusListener,
47 css::lang::XComponent>
49 public:
51 SfxStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider, sal_uInt16 nSlotId, const OUString& aCommand );
52 virtual ~SfxStatusListener();
54 // old methods from SfxControllerItem
55 sal_uInt16 GetId() const { return m_nSlotID; }
56 void UnBind();
57 void ReBind();
59 virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
61 // XComponent
62 virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException );
63 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
64 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
66 // XEventListener
67 virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
69 // XStatusListener
70 virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event) throw( ::com::sun::star::uno::RuntimeException );
72 private:
73 SfxStatusListener( const SfxStatusListener& );
74 SfxStatusListener();
75 SfxStatusListener& operator=( const SfxStatusListener& );
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;
83 #endif // INCLUDED_SFX2_SFXSTATUSLISTENER_HXX
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */