diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-05-26 13:55:37 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-06-01 11:12:50 +0000 |
commit | 50e39c58f152888e7001a1b0e3a9fd84b691216e (patch) | |
tree | afb2f5b4bb0fe98f16be301b3d1d57b0b721dba3 /sc | |
parent | abd6b40992d5866a7a87edc300caba984a66398e (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>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/view/tabvwsh4.cxx | 25 |
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() |