tdf#162246 use main ViewShell when synching the annotations

Current ViewShell is not always available, but we use the main
ViewShell most of the time anyway in AnnotationManager, so use
that when annotation synching. Use only the current ViewShell
when opening the annotation pop-up window.

Change-Id: Ibbc8e0859d0b91617577148e76e8293cb8015941
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179849
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Jenkins
This commit is contained in:
Tomaž Vajngerl
2025-01-07 05:44:09 +01:00
committed by Tomaž Vajngerl
parent d3afb7aceb
commit 481e230e83
@@ -1010,17 +1010,12 @@ void AnnotationManagerImpl::SyncAnnotationObjects()
if (!mxCurrentPage.is() || !mpDoc)
return;
sd::DrawDocShell* pDocShell = dynamic_cast<sd::DrawDocShell*>(SfxObjectShell::Current());
sd::ViewShell* pViewShell = pDocShell ? pDocShell->GetViewShell() : nullptr;
std::shared_ptr<DrawViewShell> pDrawViewShell = std::dynamic_pointer_cast<DrawViewShell>(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;