1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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/.
12 #include <svl/listener.hxx>
13 #include <svl/lstner.hxx>
16 class SwDeleteListener final
: public SwClient
21 virtual void SwClientNotify(const SwModify
&, const SfxHint
& rHint
) override
23 if (auto pLegacy
= dynamic_cast<const sw::LegacyModifyHint
*>(&rHint
))
25 if (pLegacy
->m_pOld
&& pLegacy
->m_pOld
->Which() == RES_OBJECTDYING
)
27 m_pModify
->Remove(this);
34 SwDeleteListener(SwModify
& rModify
)
40 bool WasDeleted() const { return !m_pModify
; }
42 virtual ~SwDeleteListener() override
46 m_pModify
->Remove(this);
50 class SvtDeleteListener final
: public SvtListener
56 explicit SvtDeleteListener(SvtBroadcaster
& rNotifier
)
57 : bObjectDeleted(false)
59 StartListening(rNotifier
);
62 virtual void Notify(const SfxHint
& rHint
) override
64 if (rHint
.GetId() == SfxHintId::Dying
)
65 bObjectDeleted
= true;
68 bool WasDeleted() const { return bObjectDeleted
; }
71 class SfxDeleteListener final
: public SfxListener
77 explicit SfxDeleteListener(SfxBroadcaster
& rNotifier
)
78 : bObjectDeleted(false)
80 StartListening(rNotifier
);
83 virtual void Notify(SfxBroadcaster
& /*rBC*/, const SfxHint
& rHint
) override
85 if (rHint
.GetId() == SfxHintId::Dying
)
86 bObjectDeleted
= true;
89 bool WasDeleted() const { return bObjectDeleted
; }
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */