diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-01-08 15:04:07 +0000 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-01-10 13:45:16 +0100 |
commit | 961ffd72e2051490b3650348e97f99ef727a573b (patch) | |
tree | 2c92222ee8fe88c3cf75648598f9fa4fbd349765 /sc/inc | |
parent | 212bbbe5cafab06b408ddde930bf9c8d37b7c3aa (diff) |
Related: cool#7951 don't invalidate when creating a new view
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 <michael.meeks@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161880
Tested-by: Jenkins
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/viewopti.hxx | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/sc/inc/viewopti.hxx b/sc/inc/viewopti.hxx index beb0530e88a5..25f7db7d8527 100644 --- a/sc/inc/viewopti.hxx +++ b/sc/inc/viewopti.hxx @@ -73,6 +73,26 @@ public: bool operator!= ( const ScGridOptions& rOpt ) const { return !(operator==(rOpt)); } }; +class SC_DLLPUBLIC ScViewRenderingOptions +{ +public: + ScViewRenderingOptions(); + + const OUString& GetColorSchemeName() const { return sColorSchemeName; } + void SetColorSchemeName( const OUString& rName ) { sColorSchemeName = rName; } + + const Color& GetDocColor() const { return aDocCol; } + void SetDocColor(const Color& rDocColor) { aDocCol = rDocColor; } + + bool operator==(const ScViewRenderingOptions& rOther) const; + +private: + // The name of the color scheme + OUString sColorSchemeName; + // The background color of the document + Color aDocCol; +}; + // Options - View class SC_DLLPUBLIC ScViewOptions @@ -97,12 +117,6 @@ public: void SetGridOptions( const ScGridOptions& rNew ) { aGridOpt = rNew; } std::unique_ptr<SvxGridItem> CreateGridItem() const; - const OUString& GetColorSchemeName() const { return sColorSchemeName; } - void SetColorSchemeName( const OUString& rName ) { sColorSchemeName = rName; } - - const Color& GetDocColor() const { return aDocCol; } - void SetDocColor(const Color& rDocColor) { aDocCol = rDocColor; } - ScViewOptions& operator= ( const ScViewOptions& rCpy ); bool operator== ( const ScViewOptions& rOpt ) const; bool operator!= ( const ScViewOptions& rOpt ) const { return !(operator==(rOpt)); } @@ -113,10 +127,6 @@ private: Color aGridCol; OUString aGridColName; ScGridOptions aGridOpt; - // The name of the color scheme - OUString sColorSchemeName = "Default"; - // The background color of the document - Color aDocCol; }; // Item for the options dialog - View |