cid#1640468 Dereference after null check
[LibreOffice.git] / include / sfx2 / sfxstatuslistener.hxx
blob53060aa16a31edc6609e222e94b67e57736c8e2b
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 <com/sun/star/lang/XComponent.hpp>
27 #include <com/sun/star/frame/XStatusListener.hpp>
29 #include <cppuhelper/implbase.hxx>
31 namespace com::sun::star::frame { class XDispatch; }
32 namespace com::sun::star::frame { class XDispatchProvider; }
34 class SFX2_DLLPUBLIC SfxStatusListener : public cppu::WeakImplHelper<
35 css::frame::XStatusListener,
36 css::lang::XComponent>
38 public:
40 SfxStatusListener( const css::uno::Reference< css::frame::XDispatchProvider >& rDispatchProvider, sal_uInt16 nSlotId, const OUString& aCommand );
41 virtual ~SfxStatusListener() override;
43 // old methods from SfxControllerItem
44 sal_uInt16 GetId() const { return m_nSlotID; }
45 void UnBind();
46 void ReBind();
48 virtual void StateChangedAtStatusListener( SfxItemState eState, const SfxPoolItem* pState );
50 // XComponent
51 virtual void SAL_CALL dispose() override;
52 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
53 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
55 // XEventListener
56 virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
58 // XStatusListener
59 virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& Event) override;
61 private:
62 SfxStatusListener( const SfxStatusListener& ) = delete;
63 SfxStatusListener& operator=( const SfxStatusListener& ) = delete;
65 sal_uInt16 m_nSlotID;
66 css::util::URL m_aCommand;
67 css::uno::Reference< css::frame::XDispatchProvider > m_xDispatchProvider;
68 css::uno::Reference< css::frame::XDispatch > m_xDispatch;
71 #endif // INCLUDED_SFX2_SFXSTATUSLISTENER_HXX
73 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */