diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2018-03-23 18:43:54 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-03-27 15:03:15 +0200 |
commit | 1cf9fcc723041ceb97dc637de658f3486a755edf (patch) | |
tree | f6dae0c76fb080dd8b0760817e90170c848b6b96 /sc | |
parent | 0ddb4d18079fa6ceb60e0b8a35125b0b811a877d (diff) |
tdf#116241 Customizing value highlighting colors
Available in: Tools->Options->Application colors
Change-Id: I6e4f7a0dcad9a6ee222275019596853f0cbd3ab0
Reviewed-on: https://gerrit.libreoffice.org/51791
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/51943
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit a99998525242d7d3ee48bece6ea699814fd4433f)
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/global.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/global.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/output.cxx | 23 |
3 files changed, 16 insertions, 13 deletions
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 78ea62923445..77907e730713 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -518,7 +518,6 @@ class ScGlobal static SvxBrushItem* pEmptyBrushItem; static SvxBrushItem* pButtonBrushItem; static SvxBrushItem* pEmbeddedBrushItem; - static SvxBrushItem* pProtectedBrushItem; static ImageList* pOutlineBitmaps; @@ -601,7 +600,6 @@ public: static void InitTextHeight(SfxItemPool* pPool); static SvxBrushItem* GetEmptyBrushItem() { return pEmptyBrushItem; } static SvxBrushItem* GetButtonBrushItem(); - static SvxBrushItem* GetProtectedBrushItem() { return pProtectedBrushItem; } SC_DLLPUBLIC static const OUString& GetEmptyOUString(); /** Returns the specified image list with outline symbols. */ diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index b16a656981ab..fc434c0a97a4 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -45,6 +45,7 @@ #include <ctype.h> #include <numeric> #include <svx/svdmodel.hxx> +#include <svtools/colorcfg.hxx> #include <i18nlangtag/mslangid.hxx> #include <com/sun/star/lang/Locale.hpp> @@ -109,7 +110,6 @@ OUString* ScGlobal::pStrClipDocName = nullptr; SvxBrushItem* ScGlobal::pEmptyBrushItem = nullptr; SvxBrushItem* ScGlobal::pButtonBrushItem = nullptr; SvxBrushItem* ScGlobal::pEmbeddedBrushItem = nullptr; -SvxBrushItem* ScGlobal::pProtectedBrushItem = nullptr; ImageList* ScGlobal::pOutlineBitmaps = nullptr; @@ -509,7 +509,6 @@ void ScGlobal::Init() pEmptyBrushItem = new SvxBrushItem( Color( COL_TRANSPARENT ), ATTR_BACKGROUND ); pButtonBrushItem = new SvxBrushItem( Color(), ATTR_BACKGROUND ); pEmbeddedBrushItem = new SvxBrushItem( Color( COL_LIGHTCYAN ), ATTR_BACKGROUND ); - pProtectedBrushItem = new SvxBrushItem( Color( COL_LIGHTGRAY ), ATTR_BACKGROUND ); InitPPT(); //ScCompiler::InitSymbolsNative(); @@ -609,7 +608,6 @@ void ScGlobal::Clear() DELETEZ(pEmptyBrushItem); DELETEZ(pButtonBrushItem); DELETEZ(pEmbeddedBrushItem); - DELETEZ(pProtectedBrushItem); DELETEZ(pOutlineBitmaps); DELETEZ(pEnglishFormatter); DELETEZ(pCaseTransliteration); diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index 78d351ba3a51..56cdf6b4a2d6 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -298,12 +298,13 @@ void ScOutputData::SetSingleGrid( bool bNewMode ) void ScOutputData::SetSyntaxMode( bool bNewMode ) { mbSyntaxMode = bNewMode; - if (bNewMode) - if (!pValueColor) + if ( bNewMode ) + if ( !pValueColor ) { - pValueColor = new Color( COL_LIGHTBLUE ); - pTextColor = new Color( COL_BLACK ); - pFormulaColor = new Color( COL_GREEN ); + const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig(); + pValueColor = new Color( rColorCfg.GetColorValue( svtools::CALCVALUE ).nColor ); + pTextColor = new Color( rColorCfg.GetColorValue( svtools::CALCTEXT ).nColor ); + pFormulaColor = new Color( rColorCfg.GetColorValue( svtools::CALCFORMULA ).nColor ); } } @@ -1001,6 +1002,12 @@ void ScOutputData::DrawBackground(vcl::RenderContext& rRenderContext) Application::GetSettings().GetStyleSettings().GetHighContrastMode(); long nPosY = nScrY; + + const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig(); + Color aProtectedColor( rColorCfg.GetColorValue( svtools::CALCPROTECTEDBACKGROUND ).nColor ); + std::shared_ptr<SvxBrushItem> pProtectedBackground( new SvxBrushItem( aProtectedColor, ATTR_BACKGROUND ) ); + + // iterate through the rows to show for (SCSIZE nArrY=1; nArrY+1<nArrCount; nArrY++) { RowInfo* pThisRowInfo = &pRowInfo[nArrY]; @@ -1034,7 +1041,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& rRenderContext) aRect = rRenderContext.PixelToLogic(aRect); // internal data in pixels, but we'll be drawing in logic units const SvxBrushItem* pOldBackground = nullptr; - const SvxBrushItem* pBackground; + const SvxBrushItem* pBackground = nullptr; const Color* pOldColor = nullptr; const ScDataBarInfo* pOldDataBarInfo = nullptr; const ScIconSetInfo* pOldIconSetInfo = nullptr; @@ -1060,7 +1067,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& rRenderContext) const ScProtectionAttr& rProt = static_cast<const ScProtectionAttr&>( pP->GetItem(ATTR_PROTECTION)); if (rProt.GetProtection() || rProt.GetHideCell()) - pBackground = ScGlobal::GetProtectedBrushItem(); + pBackground = pProtectedBackground.get(); else pBackground = ScGlobal::GetEmptyBrushItem(); } @@ -1071,7 +1078,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& rRenderContext) pBackground = pInfo->pBackground; if ( bPagebreakMode && !pInfo->bPrinted ) - pBackground = ScGlobal::GetProtectedBrushItem(); + pBackground = pProtectedBackground.get(); if ( pInfo->nRotateDir > ScRotateDir::Standard && pBackground->GetColor().GetTransparency() != 255 && |