LibreOffice Module sfx2 (master) 1
sfxstatuslistener.hxx
Go to the documentation of this file.
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 <com/sun/star/lang/XComponent.hpp>
27#include <com/sun/star/frame/XStatusListener.hpp>
28
30
31namespace com::sun::star::frame { class XDispatch; }
33namespace com::sun::star::frame { struct FeatureStateEvent; }
34
35class SFX2_DLLPUBLIC SfxStatusListener : public cppu::WeakImplHelper<
36 css::frame::XStatusListener,
37 css::lang::XComponent>
38{
39 public:
40
41 SfxStatusListener( const css::uno::Reference< css::frame::XDispatchProvider >& rDispatchProvider, sal_uInt16 nSlotId, const OUString& aCommand );
42 virtual ~SfxStatusListener() override;
43
44 // old methods from SfxControllerItem
45 sal_uInt16 GetId() const { return m_nSlotID; }
46 void UnBind();
47 void ReBind();
48
49 virtual void StateChangedAtStatusListener( SfxItemState eState, const SfxPoolItem* pState );
50
51 // XComponent
52 virtual void SAL_CALL dispose() override;
53 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
54 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
55
56 // XEventListener
57 virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
58
59 // XStatusListener
60 virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& Event) override;
61
62 private:
65
66 sal_uInt16 m_nSlotID;
67 css::util::URL m_aCommand;
68 css::uno::Reference< css::frame::XDispatchProvider > m_xDispatchProvider;
69 css::uno::Reference< css::frame::XDispatch > m_xDispatch;
70};
71
72#endif // INCLUDED_SFX2_SFXSTATUSLISTENER_HXX
73
74/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::util::URL m_aCommand
SfxStatusListener(const css::uno::Reference< css::frame::XDispatchProvider > &rDispatchProvider, sal_uInt16 nSlotId, const OUString &aCommand)
sal_uInt16 GetId() const
SfxStatusListener(const SfxStatusListener &)=delete
SfxStatusListener & operator=(const SfxStatusListener &)=delete
css::uno::Reference< css::frame::XDispatch > m_xDispatch
css::uno::Reference< css::frame::XDispatchProvider > m_xDispatchProvider
#define SFX2_DLLPUBLIC
Definition: dllapi.h:29
void dispose()
SfxItemState