sc/source/ui/view/tabvwsh4.cxx | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)
New commits: commit 50e39c58f152888e7001a1b0e3a9fd84b691216e Author: Caolán McNamara <caol...@redhat.com> Date: Thu May 26 13:55:37 2016 +0100 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 <c...@libreoffice.org> Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Eike Rathke <er...@redhat.com> diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 5d11fbe..d143030 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()
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits