sc/source/ui/view/tabvwsh4.cxx | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
New commits: commit a70c34ccf5c446967bf9a258b8da2bd7addc9695 Author: Ashod Nakashian <[email protected]> Date: Tue May 2 08:21:29 2017 -0400 Calc Lok: prevent a new view from resetting tiled view dimensions When creating a new view the document tiled view dimensions are also reset to the original. When an existing view had grown said dimensions, this results in tiles that previously (before creating the new view) rendered fine to start rendering blank (transparent) as they are now outside of the doc bounds. This makes sure that the new view inherits the largest doc tiled view dimensions of all existing views. Change-Id: Ie10e85ad1eb9501ddd8a901188a2c822a0952a00 Reviewed-on: https://gerrit.libreoffice.org/37155 Reviewed-by: Jan Holesovsky <[email protected]> Tested-by: Jan Holesovsky <[email protected]> diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index e8f4491ae26e..2f31b44dcfb1 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -1684,6 +1684,32 @@ ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame, pAccessibilityBroadcaster(nullptr), mbInSwitch(false) { + // FIXME this is just a workaround, the real fix is to move the + // CurMaxCol/Row to ScTable, so that we maintain them consistently + // for all the views: + // If another view had enlarged the dimensions, preserve it + // lest we reduce it to the original, and they get blank tiles + // (in the area outside the original dimensions). + long nMaxTiledRow = 0; + long nMaxTiledCol = 0; + SfxViewShell* pViewShell = SfxViewShell::GetFirst(); + while (pViewShell) + { + ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell); + if (pTabViewShell && getPart() == pTabViewShell->getPart()) + { + ScViewData& rViewData = pTabViewShell->GetViewData(); + const long nCurMaxTiledRow = rViewData.GetMaxTiledRow(); + const long nCurMaxTiledCol = rViewData.GetMaxTiledCol(); + SAL_INFO("sc.lok.docsize", "sfxlokhelper::createview: maxTiledRow: " << + nCurMaxTiledRow << ", maxTiledCol: " << nCurMaxTiledCol); + nMaxTiledRow = std::max(nCurMaxTiledRow, nMaxTiledRow); + nMaxTiledCol = std::max(nCurMaxTiledCol, nMaxTiledCol); + } + + pViewShell = SfxViewShell::GetNext(*pViewShell); + } + const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions(); // if switching back from print preview, @@ -1744,6 +1770,15 @@ ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame, //put things back as we found them if (bInstalledScTabViewObjAsTempController) GetViewData().GetDocShell()->GetModel()->setCurrentController(nullptr); + + // Set the maximum dimensions as explained above, but only if they have + // the default values. + SAL_INFO("sc.lok.docsize", "sfxlokhelper::createview: overwriting new view's maxTiledRow: " << + nMaxTiledRow << ", maxTiledCol: " << nMaxTiledCol); + if (GetViewData().GetMaxTiledRow() == 50 && nMaxTiledRow > 0) + GetViewData().SetMaxTiledRow(nMaxTiledRow); + if (GetViewData().GetMaxTiledCol() == 20 && nMaxTiledCol > 0) + GetViewData().SetMaxTiledCol(nMaxTiledCol); } ScTabViewShell::~ScTabViewShell() _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
