1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 _SFXSTATUSLISTENER_HXX
21 #define _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 <sfx2/sfxuno.hxx>
35 // Interface for implementations which needs to get notifications about state changes
36 class SfxStatusListenerInterface
39 virtual void StateChanged( sal_uInt16 nSlotId
, SfxItemState eState
, const SfxPoolItem
* pState
) = 0;
42 ~SfxStatusListenerInterface() {}
45 class SFX2_DLLPUBLIC SfxStatusListener
:
46 public ::com::sun::star::frame::XStatusListener
,
47 public ::com::sun::star::lang::XTypeProvider
,
48 public ::com::sun::star::lang::XComponent
,
49 public ::cppu::OWeakObject
52 SFX_DECL_XINTERFACE_XTYPEPROVIDER
54 SfxStatusListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
>& rDispatchProvider
, sal_uInt16 nSlotId
, const OUString
& aCommand
);
55 virtual ~SfxStatusListener();
57 // old methods from SfxControllerItem
58 sal_uInt16
GetId() const { return m_nSlotID
; }
62 virtual void StateChanged( sal_uInt16 nSID
, SfxItemState eState
, const SfxPoolItem
* pState
);
65 virtual void SAL_CALL
dispose() throw( ::com::sun::star::uno::RuntimeException
);
66 virtual void SAL_CALL
addEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
);
67 virtual void SAL_CALL
removeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& aListener
) throw (::com::sun::star::uno::RuntimeException
);
70 virtual void SAL_CALL
disposing(const ::com::sun::star::lang::EventObject
& Source
) throw( ::com::sun::star::uno::RuntimeException
);
73 virtual void SAL_CALL
statusChanged(const ::com::sun::star::frame::FeatureStateEvent
& Event
) throw( ::com::sun::star::uno::RuntimeException
);
76 SfxStatusListener( const SfxStatusListener
& );
78 SfxStatusListener
& operator=( const SfxStatusListener
& );
81 ::com::sun::star::util::URL m_aCommand
;
82 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatchProvider
> m_xDispatchProvider
;
83 ::com::sun::star::uno::Reference
< com::sun::star::frame::XDispatch
> m_xDispatch
;
86 #endif // _SFXSTATUSLISTENER_HXX
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */