diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2018-03-23 18:43:54 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2018-03-26 23:24:08 +0200 |
commit | 030c30b33b569a38241ac8bd03a2de1fba2313cc (patch) | |
tree | 825cf706b79f0bea6f3d6be2f316e93960865c91 /sc/source | |
parent | f1b19fe29fd568cc8d4c531cb56dccadf2e93927 (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>
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/data/global.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/output.cxx | 21 |
2 files changed, 14 insertions, 11 deletions
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index b6924ae6e198..e0ba7f7995f4 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -43,6 +43,7 @@ #include <time.h> #include <numeric> #include <svx/svdmodel.hxx> +#include <svtools/colorcfg.hxx> #include <i18nlangtag/mslangid.hxx> #include <com/sun/star/lang/Locale.hpp> @@ -104,7 +105,6 @@ OUString* ScGlobal::pStrClipDocName = nullptr; SvxBrushItem* ScGlobal::pEmptyBrushItem = nullptr; SvxBrushItem* ScGlobal::pButtonBrushItem = nullptr; SvxBrushItem* ScGlobal::pEmbeddedBrushItem = nullptr; -SvxBrushItem* ScGlobal::pProtectedBrushItem = nullptr; ScFunctionList* ScGlobal::pStarCalcFunctionList = nullptr; ScFunctionMgr* ScGlobal::pStarCalcFunctionMgr = nullptr; @@ -467,7 +467,6 @@ void ScGlobal::Init() pEmptyBrushItem = new SvxBrushItem( COL_TRANSPARENT, ATTR_BACKGROUND ); pButtonBrushItem = new SvxBrushItem( Color(), ATTR_BACKGROUND ); pEmbeddedBrushItem = new SvxBrushItem( COL_LIGHTCYAN, ATTR_BACKGROUND ); - pProtectedBrushItem = new SvxBrushItem( COL_LIGHTGRAY, ATTR_BACKGROUND ); InitPPT(); //ScCompiler::InitSymbolsNative(); @@ -562,7 +561,6 @@ void ScGlobal::Clear() DELETEZ(pEmptyBrushItem); DELETEZ(pButtonBrushItem); DELETEZ(pEmbeddedBrushItem); - DELETEZ(pProtectedBrushItem); DELETEZ(pEnglishFormatter); DELETEZ(pCaseTransliteration); DELETEZ(pTransliteration); diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index a5bf884681ad..8005dd9c7e1d 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -292,12 +292,13 @@ void ScOutputData::SetMetaFileMode( 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 ); } } @@ -1026,6 +1027,10 @@ void ScOutputData::DrawBackground(vcl::RenderContext& rRenderContext) 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++) { @@ -1060,7 +1065,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; @@ -1085,7 +1090,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& rRenderContext) { const ScProtectionAttr& rProt = pP->GetItem(ATTR_PROTECTION); if (rProt.GetProtection() || rProt.GetHideCell()) - pBackground = ScGlobal::GetProtectedBrushItem(); + pBackground = pProtectedBackground.get(); else pBackground = ScGlobal::GetEmptyBrushItem(); } @@ -1096,7 +1101,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 && |