diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index 7c8de65421bd..cfcfa52ef971 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -1010,17 +1010,12 @@ void AnnotationManagerImpl::SyncAnnotationObjects() if (!mxCurrentPage.is() || !mpDoc) return; - sd::DrawDocShell* pDocShell = dynamic_cast(SfxObjectShell::Current()); - sd::ViewShell* pViewShell = pDocShell ? pDocShell->GetViewShell() : nullptr; + std::shared_ptr pDrawViewShell = std::dynamic_pointer_cast(mrBase.GetMainViewShell()); - if (!pViewShell) - { - pViewShell = mrBase.GetMainViewShell().get(); - if (!pViewShell) - return; - } + if (!pDrawViewShell) + return; - auto* pView = pViewShell->GetView(); + auto* pView = pDrawViewShell->GetView(); if (!pView) return;