summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.co.uk>2017-08-29 15:32:14 +0530
committerDennis Francis <dennis.francis@collabora.co.uk>2017-08-31 14:45:38 +0200
commitc864fc9eab79d0b24036588cf8fc37ef51bd1907 (patch)
tree19daf5112a188426d56fb6360ab32119c2664ad6 /sc/source
parent0906937a5dabc2300bb8a3974348772f7cad7423 (diff)
tdf#111939: Fallback to getting view data from best view shell...
...when ScDocShell::GetViewData() returns nullptr. This is needed when a macro is run from the macro editor window instead of running the macro from Tools menu in the Calc window. Change-Id: I89c23c2ec08e8e9907f02eb1389236111530058b Reviewed-on: https://gerrit.libreoffice.org/41733 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Dennis Francis <dennis.francis@collabora.co.uk>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/vba/vbarange.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index dec8b43ca9d8..29380216900b 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -4255,6 +4255,12 @@ static void lcl_SelectAll( const ScDocShell* pDocShell, const ScQueryParam& aPar
if ( pDocShell )
{
ScViewData* pViewData = ScDocShell::GetViewData();
+ if ( !pViewData )
+ {
+ ScTabViewShell* pViewSh = pDocShell->GetBestViewShell( true );
+ pViewData = pViewSh ? &pViewSh->GetViewData() : nullptr;
+ }
+
if ( pViewData )
{
pViewData->GetView()->Query( aParam, nullptr, true );