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 INCLUDED_SVTOOLS_FRAMESTATUSLISTENER_HXX
21 #define INCLUDED_SVTOOLS_FRAMESTATUSLISTENER_HXX
23 #include <svtools/svtdllapi.h>
24 #include <com/sun/star/uno/XComponentContext.hpp>
25 #include <com/sun/star/util/XURLTransformer.hpp>
26 #include <com/sun/star/frame/XFrame.hpp>
27 #include <com/sun/star/frame/XFrameActionListener.hpp>
28 #include <com/sun/star/frame/XDispatch.hpp>
29 #include <com/sun/star/frame/XStatusListener.hpp>
30 #include <cppuhelper/weak.hxx>
31 #include <cppuhelper/interfacecontainer.hxx>
32 #include <cppuhelper/basemutex.hxx>
34 #include <unordered_map>
39 class SVT_DLLPUBLIC FrameStatusListener
: public css::frame::XStatusListener
,
40 public css::frame::XFrameActionListener
,
41 public css::lang::XComponent
,
42 public ::cppu::BaseMutex
,
43 public ::cppu::OWeakObject
46 FrameStatusListener( const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
,
47 const css::uno::Reference
< css::frame::XFrame
>& xFrame
);
48 virtual ~FrameStatusListener() override
;
50 // methods to support status forwarder, known by the old sfx2 toolbox controller implementation
51 void addStatusListener( const OUString
& aCommandURL
);
55 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& aType
) override
;
56 virtual void SAL_CALL
acquire() throw () override
;
57 virtual void SAL_CALL
release() throw () override
;
60 virtual void SAL_CALL
dispose() override
;
61 virtual void SAL_CALL
addEventListener( const css::uno::Reference
< css::lang::XEventListener
>& xListener
) override
;
62 virtual void SAL_CALL
removeEventListener( const css::uno::Reference
< css::lang::XEventListener
>& aListener
) override
;
65 virtual void SAL_CALL
disposing( const css::lang::EventObject
& Source
) override
;
68 virtual void SAL_CALL
statusChanged( const css::frame::FeatureStateEvent
& Event
) override
= 0;
70 // XFrameActionListener
71 virtual void SAL_CALL
frameAction( const css::frame::FrameActionEvent
& Action
) override
;
76 Listener( const css::util::URL
& rURL
, const css::uno::Reference
< css::frame::XDispatch
>& rDispatch
) :
77 aURL( rURL
), xDispatch( rDispatch
) {}
80 css::uno::Reference
< css::frame::XDispatch
> xDispatch
;
83 typedef std::unordered_map
< OUString
,
84 css::uno::Reference
< css::frame::XDispatch
>,
85 OUStringHash
> URLToDispatchMap
;
88 css::uno::Reference
< css::frame::XFrame
> m_xFrame
;
89 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
90 URLToDispatchMap m_aListenerMap
;
95 #endif // INCLUDED_SVTOOLS_FRAMESTATUSLISTENER_HXX
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */