From 4cbbd8d6261dfebbe0808168a3ab745e52825492 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 8 Jan 2024 15:04:07 +0000 Subject: Related: cool#7951 don't invalidate when creating a new view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In writer the ViewOptions are in the ViewShell and are copied when a new ViewShell is created from that ViewShell so the dark/light-mode and doc color are the same in a new view as the old view. But in calc the ViewOptions exist in both the ViewShell and Document and a new ViewShell copies from the document not the old ViewShell. Setting the ViewOptions of a ViewShell in calc doesn't have an effect of having the same setting in a new view in calc. So if you create a new view from an old view you got the ViewOptions of the document, whose light/dark mode remained as "Default" when the old view dark/light more was set. So the mismatch triggered an invalidate. These additions to ViewOptions are relatively new in calc, and the desire is to get the same behaviour in calc as in writer, so move the new additions to a separate class that belongs to the ViewShell and copy them from the current ViewShell when creating a new ViewShell. Change-Id: Ie4b1dbb0437763ec4c8d067179c1fbef520161e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161791 Reviewed-by: Michael Meeks Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161880 Tested-by: Jenkins --- sc/source/ui/view/tabview.cxx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sc/source/ui/view/tabview.cxx') diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 9eff50195e84..71a37ddce9da 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -169,11 +169,18 @@ bool lcl_HasRowOutline( const ScViewData& rViewData ) return false; } +ScViewRenderingOptions getViewRenderingOptions(ScDocShell& rDocShell) +{ + ScTabViewShell* pViewShell = rDocShell.GetBestViewShell(); + return pViewShell ? pViewShell->GetViewRenderingData() : ScViewRenderingOptions(); +} + } // anonymous namespace ScTabView::ScTabView( vcl::Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell ) : pFrameWin( pParent ), aViewData( rDocSh, pViewShell ), + aViewRenderingData(getViewRenderingOptions(rDocSh)), aFunctionSet( &aViewData ), aHdrFunc( &aViewData ), aVScrollTop( VclPtr::Create( pFrameWin, false ) ), -- cgit