summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/source/uibase/utlui/content.cxx26
-rw-r--r--sw/source/uibase/utlui/glbltree.cxx32
2 files changed, 35 insertions, 23 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:
diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx
index 448f2655727a..7d7d0104fc7b 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -1164,21 +1164,27 @@ IMPL_LINK( SwGlobalTree, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, vo
void SwGlobalTree::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)
{
- EndListening(*m_pActiveShell->GetView().GetDocShell());
- m_pActiveShell = nullptr;
- }
- else
- {
- SfxListener::Notify(rBC, rHint);
- if (rHint.GetId() == SfxHintId::SwNavigatorUpdateTracking)
- UpdateTracking();
+ 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())
+ {
+ EndListening(*m_pActiveShell->GetView().GetDocShell());
+ m_pActiveShell = nullptr;
+ }
+ }
+ return;
+ }
}
+ SfxListener::Notify(rBC, rHint);
+ if (rHint.GetId() == SfxHintId::SwNavigatorUpdateTracking)
+ UpdateTracking();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */