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>
This commit is contained in:
Szymon Kłos
2018-03-23 18:43:54 +01:00
parent f1b19fe29f
commit 030c30b33b
9 changed files with 215 additions and 46 deletions

View File

@@ -137,6 +137,10 @@ const vEntryInfo[] =
{ Group_Calc, IDS(deterror) },
{ Group_Calc, IDS(ref) },
{ Group_Calc, IDS(notes) },
{ Group_Calc, IDS(values) },
{ Group_Calc, IDS(formulas) },
{ Group_Calc, IDS(text) },
{ Group_Calc, IDS(protectedcells) },
{ Group_Draw, IDS(drawgrid) },

View File

@@ -789,6 +789,98 @@
<property name="top_attach">34</property>
</packing>
</child>
<child>
<object class="svxcorelo-SvxColorListBox" id="values_lb">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">35</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="values">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">6</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="colorconfigwin|values">Values</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">35</property>
</packing>
</child>
<child>
<object class="svxcorelo-SvxColorListBox" id="formulas_lb">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">36</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="formulas">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">6</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="colorconfigwin|formulas">Formulas</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">36</property>
</packing>
</child>
<child>
<object class="svxcorelo-SvxColorListBox" id="text_lb">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">37</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="text">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">6</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="colorconfigwin|text">Text</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">37</property>
</packing>
</child>
<child>
<object class="svxcorelo-SvxColorListBox" id="protectedcells_lb">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">38</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="protectedcells">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">6</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="colorconfigwin|protectedcells">Protected cells background</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">38</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="draw">
<property name="visible">True</property>
@@ -801,7 +893,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">35</property>
<property name="top_attach">39</property>
<property name="width">3</property>
</packing>
</child>
@@ -812,7 +904,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">36</property>
<property name="top_attach">40</property>
</packing>
</child>
<child>
@@ -825,7 +917,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">36</property>
<property name="top_attach">40</property>
</packing>
</child>
<child>
@@ -840,7 +932,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">37</property>
<property name="top_attach">41</property>
<property name="width">3</property>
</packing>
</child>
@@ -851,7 +943,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">38</property>
<property name="top_attach">42</property>
</packing>
</child>
<child>
@@ -864,7 +956,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">38</property>
<property name="top_attach">42</property>
</packing>
</child>
<child>
@@ -874,7 +966,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">39</property>
<property name="top_attach">43</property>
</packing>
</child>
<child>
@@ -887,7 +979,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">39</property>
<property name="top_attach">43</property>
</packing>
</child>
<child>
@@ -897,7 +989,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">40</property>
<property name="top_attach">44</property>
</packing>
</child>
<child>
@@ -910,7 +1002,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">40</property>
<property name="top_attach">44</property>
</packing>
</child>
<child>
@@ -920,7 +1012,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">41</property>
<property name="top_attach">45</property>
</packing>
</child>
<child>
@@ -933,7 +1025,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">41</property>
<property name="top_attach">45</property>
</packing>
</child>
<child>
@@ -943,7 +1035,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">42</property>
<property name="top_attach">46</property>
</packing>
</child>
<child>
@@ -956,7 +1048,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">42</property>
<property name="top_attach">46</property>
</packing>
</child>
<child>
@@ -966,7 +1058,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">43</property>
<property name="top_attach">47</property>
</packing>
</child>
<child>
@@ -979,7 +1071,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">43</property>
<property name="top_attach">47</property>
</packing>
</child>
<child>
@@ -989,7 +1081,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">44</property>
<property name="top_attach">48</property>
</packing>
</child>
<child>
@@ -1002,7 +1094,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">44</property>
<property name="top_attach">48</property>
</packing>
</child>
<child>
@@ -1017,7 +1109,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">45</property>
<property name="top_attach">49</property>
<property name="width">3</property>
</packing>
</child>
@@ -1028,7 +1120,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">46</property>
<property name="top_attach">50</property>
</packing>
</child>
<child>
@@ -1041,7 +1133,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">46</property>
<property name="top_attach">50</property>
</packing>
</child>
<child>
@@ -1051,7 +1143,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">47</property>
<property name="top_attach">51</property>
</packing>
</child>
<child>
@@ -1064,7 +1156,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">47</property>
<property name="top_attach">51</property>
</packing>
</child>
<child>
@@ -1074,7 +1166,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">48</property>
<property name="top_attach">52</property>
</packing>
</child>
<child>
@@ -1087,7 +1179,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">48</property>
<property name="top_attach">52</property>
</packing>
</child>
<child>
@@ -1097,7 +1189,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">49</property>
<property name="top_attach">53</property>
</packing>
</child>
<child>
@@ -1110,7 +1202,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">49</property>
<property name="top_attach">53</property>
</packing>
</child>
<child>
@@ -1120,7 +1212,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">50</property>
<property name="top_attach">54</property>
</packing>
</child>
<child>
@@ -1133,7 +1225,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">50</property>
<property name="top_attach">54</property>
</packing>
</child>
<child>
@@ -1143,7 +1235,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">51</property>
<property name="top_attach">55</property>
</packing>
</child>
<child>
@@ -1156,7 +1248,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">51</property>
<property name="top_attach">55</property>
</packing>
</child>
<child>
@@ -1166,7 +1258,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">52</property>
<property name="top_attach">56</property>
</packing>
</child>
<child>
@@ -1179,7 +1271,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">52</property>
<property name="top_attach">56</property>
</packing>
</child>
<child>

View File

@@ -61,6 +61,10 @@ enum ColorConfigEntry
CALCDETECTIVEERROR ,
CALCREFERENCE ,
CALCNOTESBACKGROUND ,
CALCVALUE,
CALCFORMULA,
CALCTEXT,
CALCPROTECTEDBACKGROUND,
DRAWGRID ,
BASICIDENTIFIER,
BASICCOMMENT ,

View File

@@ -323,6 +323,26 @@
<value xsi:nil="true"/>
</prop>
</node>
<node oor:name="CalcValue">
<prop oor:name="Color">
<value xsi:nil="true"/>
</prop>
</node>
<node oor:name="CalcFormula">
<prop oor:name="Color">
<value xsi:nil="true"/>
</prop>
</node>
<node oor:name="CalcText">
<prop oor:name="Color">
<value xsi:nil="true"/>
</prop>
</node>
<node oor:name="CalcProtectedBackground">
<prop oor:name="Color">
<value xsi:nil="true"/>
</prop>
</node>
<node oor:name="DrawGrid">
<prop oor:name="IsVisible">
<value>true</value>

View File

@@ -410,6 +410,46 @@
</info>
</prop>
</group>
<group oor:name="CalcValue">
<info>
<desc>Specifies the settings used for values in Calc.</desc>
</info>
<prop oor:name="Color" oor:type="xs:int">
<info>
<desc>Specifies the color used for values.</desc>
</info>
</prop>
</group>
<group oor:name="CalcFormula">
<info>
<desc>Specifies the settings used for formulas in Calc.</desc>
</info>
<prop oor:name="Color" oor:type="xs:int">
<info>
<desc>Specifies the color used for formulas.</desc>
</info>
</prop>
</group>
<group oor:name="CalcText">
<info>
<desc>Specifies the settings used for the text in Calc.</desc>
</info>
<prop oor:name="Color" oor:type="xs:int">
<info>
<desc>Specifies the color used for the text.</desc>
</info>
</prop>
</group>
<group oor:name="CalcProtectedBackground">
<info>
<desc>Specifies the settings used for the background of protected cells in Calc.</desc>
</info>
<prop oor:name="Color" oor:type="xs:int">
<info>
<desc>Specifies the color used for the background of protected cells.</desc>
</info>
</prop>
</group>
<group oor:name="DrawGrid">
<info>
<desc>Specifies the settings used for the grid in Draw/Impress.</desc>

View File

@@ -518,7 +518,6 @@ class ScGlobal
static SvxBrushItem* pEmptyBrushItem;
static SvxBrushItem* pButtonBrushItem;
static SvxBrushItem* pEmbeddedBrushItem;
static SvxBrushItem* pProtectedBrushItem;
static ScFunctionList* pStarCalcFunctionList;
static ScFunctionMgr* pStarCalcFunctionMgr;
@@ -598,7 +597,6 @@ public:
static void InitTextHeight(const SfxItemPool* pPool);
static SvxBrushItem* GetEmptyBrushItem() { return pEmptyBrushItem; }
static SvxBrushItem* GetButtonBrushItem();
static SvxBrushItem* GetProtectedBrushItem() { return pProtectedBrushItem; }
SC_DLLPUBLIC static const OUString& GetEmptyOUString();
static bool HasStarCalcFunctionList();

View File

@@ -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);

View File

@@ -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 &&

View File

@@ -144,6 +144,10 @@ uno::Sequence< OUString> GetPropertyNames(const OUString& rScheme)
{ OUStringLiteral("/CalcDetectiveError") ,false },
{ OUStringLiteral("/CalcReference") ,false },
{ OUStringLiteral("/CalcNotesBackground") ,false },
{ OUStringLiteral("/CalcValue") ,false },
{ OUStringLiteral("/CalcFormula") ,false },
{ OUStringLiteral("/CalcText") ,false },
{ OUStringLiteral("/CalcProtectedBackground") ,false },
{ OUStringLiteral("/DrawGrid") ,true },
{ OUStringLiteral("/BASICIdentifier"), false },
{ OUStringLiteral("/BASICComment") , false },
@@ -433,6 +437,10 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry)
COL_LIGHTRED, // CALCDETECTIVEERROR
Color(0xef0fff), // CALCREFERENCE
Color(0xffffc0), // CALCNOTESBACKGROUND
COL_LIGHTBLUE, // CALCVALUE
COL_GREEN, // CALCFORMULA
COL_BLACK, // CALCTEXT
COL_LIGHTGRAY, // CALCPROTECTEDBACKGROUND
COL_LIGHTGRAY, // DRAWGRID
COL_GREEN, // BASICIDENTIFIER,
COL_GRAY, // BASICCOMMENT,