tdf#119209: Windows share has inappropriate server suggestion
[LibreOffice.git] / include / svtools / framestatuslistener.hxx
blob0fa756b08dc83aeb64d5bd2a179adb3c330a78e9
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_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>
36 namespace svt
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
45 public:
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 );
52 void bindListener();
54 // XInterface
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;
59 // XComponent
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;
64 // XEventListener
65 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
67 // XStatusListener
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;
73 protected:
74 struct Listener
76 Listener( const css::util::URL& rURL, const css::uno::Reference< css::frame::XDispatch >& rDispatch ) :
77 aURL( rURL ), xDispatch( rDispatch ) {}
79 css::util::URL const aURL;
80 css::uno::Reference< css::frame::XDispatch > xDispatch;
83 typedef std::unordered_map< OUString,
84 css::uno::Reference< css::frame::XDispatch > > URLToDispatchMap;
86 bool m_bDisposed : 1;
87 css::uno::Reference< css::frame::XFrame > m_xFrame;
88 css::uno::Reference< css::uno::XComponentContext > m_xContext;
89 URLToDispatchMap m_aListenerMap;
94 #endif // INCLUDED_SVTOOLS_FRAMESTATUSLISTENER_HXX
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */