diff options
Diffstat (limited to 'sw/source/uibase/utlui/content.cxx')
-rw-r--r-- | sw/source/uibase/utlui/content.cxx | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index f462148fa7d8..d044b611eb59 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -3664,18 +3664,24 @@ void SwContentTree::SetConstantShell(SwWrtShell* pSh) void SwContentTree::Notify(SfxBroadcaster & rBC, SfxHint const& rHint) { - SfxViewEventHint const*const pVEHint(dynamic_cast<SfxViewEventHint const*>(&rHint)); - SwXTextView* pDyingShell = nullptr; - if (m_pActiveShell && pVEHint && pVEHint->GetEventName() == "OnViewClosed") - pDyingShell = dynamic_cast<SwXTextView*>(pVEHint->GetController().get()); - if (pDyingShell && pDyingShell->GetView() == &m_pActiveShell->GetView()) + if (rHint.GetId() == SfxHintId::ThisIsAnSfxEventHint) { - SetActiveShell(nullptr); // our view is dying, clear our pointers to it - } - else - { - SfxListener::Notify(rBC, rHint); + const SfxEventHint* pEventHint = static_cast<const SfxEventHint*>(&rHint); + if (pEventHint->GetEventId() == SfxEventHintId::CloseView) + { + SfxViewEventHint const*const pVEHint(static_cast<SfxViewEventHint const*>(&rHint)); + if (m_pActiveShell) + { + SwXTextView* pDyingShell = dynamic_cast<SwXTextView*>(pVEHint->GetController().get()); + if (pDyingShell && pDyingShell->GetView() == &m_pActiveShell->GetView()) + { + SetActiveShell(nullptr); // our view is dying, clear our pointers to it + } + } + return; + } } + SfxListener::Notify(rBC, rHint); switch (rHint.GetId()) { case SfxHintId::SwNavigatorUpdateTracking: |