summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-05-26 13:55:37 +0100
committerEike Rathke <erack@redhat.com>2016-06-01 20:12:24 +0000
commitd44dea9e43c0f9d3b4bada800b1f94a48728f443 (patch)
tree235710a524d062f799cde85d25bb4f5ce18b8012
parentc51f7745cce6cd41851d61257207b989be54f884 (diff)
Resolves: tdf#53899 if there is no CurrentController, use the ScTabViewObj
as the CurrentController for the duration of the first recalculation. That way any StarBasic has a CurrentController available to it during initial load. Change-Id: I8aa85562a44b49192dd8729c9da57392470b9106 Reviewed-on: https://gerrit.libreoffice.org/25514 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com> (cherry picked from commit 50e39c58f152888e7001a1b0e3a9fd84b691216e) Reviewed-on: https://gerrit.libreoffice.org/25772
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx25
1 files changed, 22 insertions, 3 deletions
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 5d11fbe20dc4..d1430303fb14 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1692,6 +1692,24 @@ ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame,
Construct( nForceDesignMode );
+ // make Controller known to SFX
+ new ScTabViewObj( this );
+
+ // Resolves: tdf#53899 if there is no controller, register the above
+ // ScTabViewObj as the current controller for the duration of the first
+ // round of calculations triggered here by SetZoom. That way any StarBasic
+ // macros triggered while the document is loading have a CurrentController
+ // available to them.
+ bool bInstalledScTabViewObjAsTempController = false;
+ uno::Reference<frame::XController> xCurrentController(GetViewData().GetDocShell()->GetModel()->getCurrentController());
+ if (!xCurrentController.get())
+ {
+ //GetController here returns the ScTabViewObj above
+ GetViewData().GetDocShell()->GetModel()->setCurrentController(GetController());
+ bInstalledScTabViewObjAsTempController = true;
+ }
+ xCurrentController.clear();
+
if ( GetViewData().GetDocShell()->IsPreview() )
{
// preview for template dialog: always show whole page
@@ -1704,15 +1722,16 @@ ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame,
SetZoomType( rAppOpt.GetZoomType(), true );
}
- // make Controller known to SFX
- new ScTabViewObj( this );
-
SetCurSubShell(OST_Cell);
SvBorder aBorder;
GetBorderSize( aBorder, Size() );
SetBorderPixel( aBorder );
MakeDrawLayer();
+
+ //put things back as we found them
+ if (bInstalledScTabViewObjAsTempController)
+ GetViewData().GetDocShell()->GetModel()->setCurrentController(nullptr);
}
ScTabViewShell::~ScTabViewShell()