LibreOffice Module svl (master) 1
listener.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#ifndef INCLUDED_SVL_LISTENER_HXX
20#define INCLUDED_SVL_LISTENER_HXX
21
22#include <svl/svldllapi.h>
23
25
26class SvtBroadcaster;
27class SfxHint;
28
30{
31 friend class SvtBroadcaster;
34
35 const SvtListener& operator=(const SvtListener &) = delete;
36 // called from the SvtBroadcaster destructor
37 void BroadcasterDying( SvtBroadcaster& rBroadcaster );
38
39public:
41 {
42 sal_uInt16 mnId;
43 public:
44 QueryBase( sal_uInt16 nId ) : mnId(nId) {}
45 virtual ~QueryBase() {};
46
47 sal_uInt16 getId() const { return mnId; }
48 };
49
50 SvtListener() = default;
51 SvtListener( const SvtListener &r ) = default;
52 virtual ~SvtListener() COVERITY_NOEXCEPT_FALSE;
53
54 bool StartListening( SvtBroadcaster& rBroadcaster );
55 void EndListening( SvtBroadcaster& rBroadcaster );
56 void EndListeningAll();
57
59 void CopyAllBroadcasters( const SvtListener& r );
60 bool HasBroadcaster() const { return !maBroadcasters.empty(); }
61
62 virtual void Notify( const SfxHint& rHint );
63 virtual void Query( QueryBase& rQuery ) const;
64};
65
66
67#endif
68
69/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
QueryBase(sal_uInt16 nId)
Definition: listener.hxx:44
sal_uInt16 getId() const
Definition: listener.hxx:47
o3tl::sorted_vector< SvtBroadcaster * > BroadcastersType
Definition: listener.hxx:32
const SvtListener & operator=(const SvtListener &)=delete
SvtListener()=default
BroadcastersType maBroadcasters
Definition: listener.hxx:33
SvtListener(const SvtListener &r)=default
bool empty() const
sal_uInt16 mnId
void Notify(SwFlyFrame *pFly, SwPageFrame *pOld, const SwRect &rOld, const SwRect *pOldRect=nullptr)
Query
sal_Int16 nId
#define SVL_DLLPUBLIC
Definition: svldllapi.h:28