diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2020-07-25 18:55:18 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-07-25 18:44:03 +0200 |
commit | e3b695f6a1525ac6b32abd27a6368a7e8b7d09fa (patch) | |
tree | 23b5315d87512b2fe50211660bb7455f957d5205 /sc | |
parent | b68c10a0d0e6f83b6b037da72210033cacb1677b (diff) |
tdf#130559: don't fail creation of preview when BackingComp can't add...
an event listener. This crashes when loading a document with print preview
set as active view.
Regression after commit 128ecffe53394c1f045521c2efb42ea03a319f4b.
Change-Id: I5dc421f7c08dd70d51772fac5432f33cd9a1491a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99442
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/view/prevwsh.cxx | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index 86986ee99fb6..c5d0f14e6ca1 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -154,10 +154,21 @@ ScPreviewShell::ScPreviewShell( SfxViewFrame* pViewFrame, { Construct( &pViewFrame->GetWindow() ); - SfxShell::SetContextBroadcasterEnabled(true); - SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Printpreview)); - SfxShell::BroadcastContextForActivation(true); - + try + { + SfxShell::SetContextBroadcasterEnabled(true); + SfxShell::SetContextName( + vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Printpreview)); + SfxShell::BroadcastContextForActivation(true); + } + catch (const css::uno::RuntimeException& e) + { + // tdf#130559: allow BackingComp to fail adding listener when opening document + css::uno::Reference<css::lang::XServiceInfo> xServiceInfo(e.Context, css::uno::UNO_QUERY); + if (!xServiceInfo || !xServiceInfo->supportsService("com.sun.star.frame.StartModule")) + throw; + SAL_WARN("sc.ui", "Opening file from StartModule straight into print preview"); + } auto& pNotebookBar = pViewFrame->GetWindow().GetSystemWindow()->GetNotebookBar(); if (pNotebookBar) |