sc/source/core/data/SheetViewManager.cxx | 2 +- sc/source/ui/inc/viewdata.hxx | 5 +---- sc/source/ui/unoobj/docuno.cxx | 8 ++++++-- sc/source/ui/view/viewdata.cxx | 14 +++++++++++--- sc/source/ui/view/viewfun3.cxx | 10 +++++++++- 5 files changed, 28 insertions(+), 11 deletions(-)
New commits: commit d6430dedf6fb119c6c3f59770e2a79e94bfde66d Author: Tomaž Vajngerl <[email protected]> AuthorDate: Fri Oct 17 16:05:52 2025 +0900 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Mon Oct 20 04:50:13 2025 +0200 sc: fix issues with tile invalidation Include sheet view in a view render state, so we get the correct tiles for our current view. Also use CurrentTabForData to get the anything connected to the size of columns and rows. We need to get that from the holder sheet if we hide, show, change the size, of columns and rows. Change-Id: I9431488d43920f5bb492c4bdcbc83dd24db0d89f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192602 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <[email protected]> diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx index deb49ad11aa3..1eaa197682ef 100644 --- a/sc/source/ui/inc/viewdata.hxx +++ b/sc/source/ui/inc/viewdata.hxx @@ -411,10 +411,7 @@ public: */ SC_DLLPUBLIC SCTAB CurrentTabForData() const; - void SetSheetViewID(sc::SheetViewID nID) - { - pThisTab->mnSheetViewID = nID; - } + void SetSheetViewID(sc::SheetViewID nID); sc::SheetViewID GetSheetViewID() const { diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index afb880509a69..b2d71b55be57 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -523,6 +523,10 @@ static OString getTabViewRenderState(const ScTabViewShell& rTabViewShell) OString aThemeName = OUStringToOString(rViewRenderingOptions.GetColorSchemeName(), RTL_TEXTENCODING_UTF8); aState.append(aThemeName); + sc::SheetViewID nSheetViewID = rTabViewShell.GetViewData().GetSheetViewID(); + if (nSheetViewID >= 0) + aState.append(";VS:" + OString::number(nSheetViewID)); + return aState.makeStringAndClear(); } @@ -546,7 +550,7 @@ static ScViewData* lcl_getViewMatchingDocZoomTab(const Fraction& rZoomX, continue; ScViewData& rData = pTabViewShell->GetViewData(); - if (rData.CurrentTabForData() == nTab && rData.GetZoomX() == rZoomX && rData.GetZoomY() == rZoomY && + if (rData.GetTabNumber() == nTab && rData.GetZoomX() == rZoomX && rData.GetZoomY() == rZoomY && getTabViewRenderState(*pTabViewShell) == rViewRenderState) { return &rData; @@ -575,7 +579,7 @@ void ScModelObj::paintTile( VirtualDevice& rDevice, // first few shells. This is to avoid switching of zooms in ScGridWindow::PaintTile // and hence avoid grid-offset recomputation on all shapes which is not cheap. ScViewData* pViewData = lcl_getViewMatchingDocZoomTab(aFracX, aFracY, - pActiveViewData->CurrentTabForData(), pViewShell->GetDocId(), + pActiveViewData->GetTabNumber(), pViewShell->GetDocId(), getTabViewRenderState(*pViewShell)); if (!pViewData) pViewData = pActiveViewData; diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index b629c9a4719c..909df42d53c2 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -2437,12 +2437,12 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich, } if (nForTab == -1) - nForTab = GetTabNumber(); - bool bForCurTab = (nForTab == GetTabNumber()); + nForTab = CurrentTabForData(); + bool bForCurTab = (nForTab == CurrentTabForData()); if (!bForCurTab && (!ValidTab(nForTab) || (nForTab >= static_cast<SCTAB>(maTabData.size())))) { SAL_WARN("sc.viewdata", "ScViewData::GetScrPos : invalid nForTab = " << nForTab); - nForTab = GetTabNumber(); + nForTab = CurrentTabForData(); bForCurTab = true; } @@ -4446,6 +4446,14 @@ SCTAB ScViewData::CurrentTabForData() const return GetTabNumber(); } +void ScViewData::SetSheetViewID(sc::SheetViewID nID) +{ + pThisTab->mnSheetViewID = nID; + + CalcPPT(); + RecalcPixPos(); +} + sc::SheetViewID ScViewData::GetSheetViewIDForSheet(SCTAB nTab) const { if (!IsValidTabNumber(nTab)) diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 1cd122a14115..e15906bba1d9 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -66,6 +66,8 @@ #include <SheetViewManager.hxx> #include <uiitems.hxx> #include <com/sun/star/util/XCloneable.hpp> +#include <sfx2/lokhelper.hxx> + using namespace com::sun::star; @@ -2065,7 +2067,13 @@ void ScViewFunc::SheetViewChanged() { ScDocShell& rDocSh = GetViewData().GetDocShell(); ScDocument& rDocument = GetViewData().GetDocument(); - rDocSh.PostPaint(0,0,0, rDocument.MaxCol(), rDocument.MaxRow(), MAXTAB, PaintPartFlags::All); + rDocSh.PostPaint(0, 0, 0, rDocument.MaxCol(), rDocument.MaxRow(), MAXTAB, PaintPartFlags::All); + + if (ScTabViewShell* pViewShell = GetViewData().GetViewShell()) + { + ScModelObj* pModel = comphelper::getFromUnoTunnel<ScModelObj>(pViewShell->GetCurrentDocument()); + SfxLokHelper::notifyViewRenderState(pViewShell, pModel); + } } void ScViewFunc::MakeNewSheetView() commit 862abbbaa3362e809da8bc0a4463e924ed9b0bde Author: Tomaž Vajngerl <[email protected]> AuthorDate: Fri Oct 17 15:59:47 2025 +0900 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Mon Oct 20 04:50:01 2025 +0200 sc: change how the names are generated for temp sheet views from "Temp SheetView *" to a more concise "Temp View *" Change-Id: Ib19aa5debb7519fe0699483069f4e60621d12e79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192567 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192601 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <[email protected]> diff --git a/sc/source/core/data/SheetViewManager.cxx b/sc/source/core/data/SheetViewManager.cxx index 82c50f985c55..658b862b4277 100644 --- a/sc/source/core/data/SheetViewManager.cxx +++ b/sc/source/core/data/SheetViewManager.cxx @@ -122,7 +122,7 @@ void SheetViewManager::unsyncAllSheetViews() OUString SheetViewManager::generateName() { maNameCounter++; - return u"Temp SheetView " + OUString::number(maNameCounter); + return u"Temp View " + OUString::number(maNameCounter); } }
