Kaydet (Commit) fb29b826 authored tarafından Szymon Kłos's avatar Szymon Kłos

tdf#116241 Customizing value highlighting colors

Change-Id: I5d77e6207d1e29326282d7184c9348e59292977a
Reviewed-on: https://gerrit.libreoffice.org/51653Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarSzymon Kłos <szymon.klos@collabora.com>
üst fc3f43b6
......@@ -262,6 +262,38 @@
<info>
<desc>Contains settings that affect the window layout.</desc>
</info>
<group oor:name="Highlighting">
<info>
<desc>Contains settings that control highlighting.</desc>
</info>
<prop oor:name="ValueColor" oor:type="xs:int" oor:nillable="false">
<!-- UIHints: Tools - Options - LibreOffice Calc - View - [Section] Highlighting -->
<!-- Default 255 = LightBlue -->
<info>
<desc>Specifies the color of highlighted values.</desc>
<label>Value Color</label>
</info>
<value>255</value>
</prop>
<prop oor:name="FormulaColor" oor:type="xs:int" oor:nillable="false">
<!-- UIHints: Tools - Options - LibreOffice Calc - View - [Section] Highlighting -->
<!-- Default 32768 = Green -->
<info>
<desc>Specifies the color of highlighted formulas.</desc>
<label>Formula Color</label>
</info>
<value>32768</value>
</prop>
<prop oor:name="TextColor" oor:type="xs:int" oor:nillable="false">
<!-- UIHints: Tools - Options - LibreOffice Calc - View - [Section] Highlighting -->
<!-- Default 0 = Black -->
<info>
<desc>Specifies the color of the highlighted text.</desc>
<label>Text Color</label>
</info>
<value>0</value>
</prop>
</group>
<group oor:name="Line">
<info>
<desc>Contains settings that control visual aids.</desc>
......
......@@ -94,6 +94,15 @@ public:
void SetGridColor( const Color& rCol, const OUString& rName ) { aGridCol = rCol; aGridColName = rName;}
Color const & GetGridColor( OUString* pStrName = nullptr ) const;
void SetValueColor( const Color& rCol ) { aValueCol = rCol; }
Color const & GetValueColor() const { return aValueCol; }
void SetFormulaColor(const Color& rCol) { aFormulaCol = rCol; }
Color const & GetFormulaColor() const { return aFormulaCol; }
void SetTextColor(const Color& rCol) { aTextCol = rCol; }
Color const & GetTextColor() const { return aTextCol; }
const ScGridOptions& GetGridOptions() const { return aGridOpt; }
void SetGridOptions( const ScGridOptions& rNew ) { aGridOpt = rNew; }
SvxGridItem* CreateGridItem() const;
......@@ -108,6 +117,9 @@ private:
Color aGridCol;
OUString aGridColName;
ScGridOptions aGridOpt;
Color aValueCol;
Color aFormulaCol;
Color aTextCol;
};
// Item for the options dialog - View
......
......@@ -132,6 +132,10 @@ void ScViewOptions::SetDefaults()
aGridCol = SC_STD_GRIDCOLOR;
aGridColName = ScGlobal::GetRscString( STR_GRIDCOLOR );
aValueCol = COL_LIGHTBLUE;
aTextCol = COL_BLACK;
aFormulaCol = COL_GREEN;
aGridOpt.SetDefaults();
}
......@@ -153,6 +157,9 @@ ScViewOptions& ScViewOptions::operator=( const ScViewOptions& rCpy )
aGridCol = rCpy.aGridCol;
aGridColName = rCpy.aGridColName;
aGridOpt = rCpy.aGridOpt;
aValueCol = rCpy.aValueCol;
aTextCol = rCpy.aTextCol;
aFormulaCol = rCpy.aFormulaCol;
return *this;
}
......@@ -168,6 +175,9 @@ bool ScViewOptions::operator==( const ScViewOptions& rOpt ) const
bEqual = bEqual && (aGridCol == rOpt.aGridCol);
bEqual = bEqual && (aGridColName == rOpt.aGridColName);
bEqual = bEqual && (aGridOpt == rOpt.aGridOpt);
bEqual = bEqual && (aValueCol == rOpt.aValueCol);
bEqual = bEqual && (aTextCol == rOpt.aTextCol);
bEqual = bEqual && (aFormulaCol == rOpt.aFormulaCol);
return bEqual;
}
......@@ -230,6 +240,9 @@ SfxPoolItem* ScTpViewItem::Clone( SfxItemPool * ) const
#define SCLAYOUTOPT_SHEETTAB 7
#define SCLAYOUTOPT_OUTLINE 8
#define SCLAYOUTOPT_GRID_ONCOLOR 9
#define SCLAYOUTOPT_VALUE_COLOR 10
#define SCLAYOUTOPT_FORMULA_COLOR 11
#define SCLAYOUTOPT_TEXT_COLOR 12
#define CFGPATH_DISPLAY "Office.Calc/Content/Display"
......@@ -267,7 +280,10 @@ Sequence<OUString> ScViewCfg::GetLayoutPropertyNames()
"Window/VerticalScroll", // SCLAYOUTOPT_VERTSCROLL
"Window/SheetTab", // SCLAYOUTOPT_SHEETTAB
"Window/OutlineSymbol", // SCLAYOUTOPT_OUTLINE
"Line/GridOnColoredCells"}; // SCLAYOUTOPT_GRID_ONCOLOR;
"Line/GridOnColoredCells", // SCLAYOUTOPT_GRID_ONCOLOR
"Highlighting/ValueColor", // SCLAYOUTOPT_VALUE_COLOR
"Highlighting/FormulaColor",// SCLAYOUTOPT_FORMULA_COLOR
"Highlighting/TextColor"}; // SCLAYOUTOPT_TEXT_COLOR
}
Sequence<OUString> ScViewCfg::GetDisplayPropertyNames()
......@@ -355,6 +371,18 @@ ScViewCfg::ScViewCfg() :
case SCLAYOUTOPT_OUTLINE:
SetOption( VOPT_OUTLINER, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
break;
case SCLAYOUTOPT_VALUE_COLOR:
if (pValues[nProp] >>= nIntVal)
SetValueColor(Color(nIntVal));
break;
case SCLAYOUTOPT_FORMULA_COLOR:
if (pValues[nProp] >>= nIntVal)
SetFormulaColor(Color(nIntVal));
break;
case SCLAYOUTOPT_TEXT_COLOR:
if (pValues[nProp] >>= nIntVal)
SetTextColor(Color(nIntVal));
break;
}
}
}
......@@ -519,6 +547,15 @@ IMPL_LINK_NOARG(ScViewCfg, LayoutCommitHdl, ScLinkConfigItem&, void)
case SCLAYOUTOPT_OUTLINE:
pValues[nProp] <<= GetOption( VOPT_OUTLINER );
break;
case SCLAYOUTOPT_VALUE_COLOR:
pValues[nProp] <<= GetValueColor();
break;
case SCLAYOUTOPT_FORMULA_COLOR:
pValues[nProp] <<= GetFormulaColor();
break;
case SCLAYOUTOPT_TEXT_COLOR:
pValues[nProp] <<= GetTextColor();
break;
}
}
aLayoutItem.PutProperties(aNames, aValues);
......
......@@ -39,6 +39,10 @@ class ScTpContentOptions : public SfxTabPage
VclPtr<CheckBox> pBreakCB;
VclPtr<CheckBox> pGuideLineCB;
VclPtr<SvxColorListBox> pValueColorLB;
VclPtr<SvxColorListBox> pFormulaColorLB;
VclPtr<SvxColorListBox> pTextColorLB;
VclPtr<CheckBox> pFormulaCB;
VclPtr<CheckBox> pNilCB;
VclPtr<CheckBox> pAnnotCB;
......@@ -62,6 +66,7 @@ class ScTpContentOptions : public SfxTabPage
ScViewOptions* pLocalOptions;
void InitGridOpt();
void InitColors();
DECL_LINK( GridHdl, ListBox&, void );
DECL_LINK( SelLbObjHdl, ListBox&, void );
DECL_LINK( CBHdl, Button*, void );
......
......@@ -49,6 +49,10 @@ ScTpContentOptions::ScTpContentOptions( vcl::Window* pParent,
get(pBreakCB,"break");
get(pGuideLineCB,"guideline");
get(pValueColorLB, "value_color");
get(pFormulaColorLB, "formula_color");
get(pTextColorLB, "text_color");
get(pFormulaCB,"formula");
get(pNilCB,"nil");
get(pAnnotCB,"annot");
......@@ -107,6 +111,9 @@ void ScTpContentOptions::dispose()
pColorLB.clear();
pBreakCB.clear();
pGuideLineCB.clear();
pValueColorLB.clear();
pFormulaColorLB.clear();
pTextColorLB.clear();
pFormulaCB.clear();
pNilCB.clear();
pAnnotCB.clear();
......@@ -152,10 +159,16 @@ bool ScTpContentOptions::FillItemSet( SfxItemSet* rCoreSet )
pOutlineCB ->IsValueChangedFromSaved() ||
pColorLB ->IsValueChangedFromSaved() ||
pBreakCB ->IsValueChangedFromSaved() ||
pGuideLineCB ->IsValueChangedFromSaved())
pGuideLineCB ->IsValueChangedFromSaved() ||
pValueColorLB ->IsValueChangedFromSaved() ||
pFormulaColorLB->IsValueChangedFromSaved() ||
pTextColorLB ->IsValueChangedFromSaved() )
{
NamedColor aNamedColor = pColorLB->GetSelectedEntry();
pLocalOptions->SetGridColor(aNamedColor.first, aNamedColor.second);
pLocalOptions->SetValueColor(pValueColorLB->GetSelectedEntry().first);
pLocalOptions->SetFormulaColor(pFormulaColorLB->GetSelectedEntry().first);
pLocalOptions->SetTextColor(pTextColorLB->GetSelectedEntry().first);
rCoreSet->Put(ScTpViewItem(*pLocalOptions));
bRet = true;
}
......@@ -199,6 +212,7 @@ void ScTpContentOptions::Reset( const SfxItemSet* rCoreSet )
pOutlineCB->Check( pLocalOptions->GetOption(VOPT_OUTLINER) );
InitGridOpt();
InitColors();
pBreakCB->Check( pLocalOptions->GetOption(VOPT_PAGEBREAKS) );
pGuideLineCB->Check( pLocalOptions->GetOption(VOPT_HELPLINES) );
......@@ -229,6 +243,9 @@ void ScTpContentOptions::Reset( const SfxItemSet* rCoreSet )
pColorLB->SaveValue();
pBreakCB->SaveValue();
pGuideLineCB->SaveValue();
pValueColorLB->SaveValue();
pFormulaColorLB->SaveValue();
pTextColorLB->SaveValue();
}
void ScTpContentOptions::ActivatePage( const SfxItemSet& rSet)
......@@ -315,6 +332,18 @@ void ScTpContentOptions::InitGridOpt()
pColorLB->SelectEntry(std::make_pair(aCol, aName));
}
void ScTpContentOptions::InitColors()
{
Color aCol = pLocalOptions->GetValueColor();
pValueColorLB->SelectEntry(aCol);
aCol = pLocalOptions->GetFormulaColor();
pFormulaColorLB->SelectEntry(aCol);
aCol = pLocalOptions->GetTextColor();
pTextColorLB->SelectEntry(aCol);
}
IMPL_LINK( ScTpContentOptions, GridHdl, ListBox&, rLb, void )
{
sal_Int32 nSelPos = rLb.GetSelectedEntryPos();
......
......@@ -61,6 +61,7 @@
#include <scmod.hxx>
#include <appoptio.hxx>
#include <postit.hxx>
#include <viewopti.hxx>
#include <scresid.hxx>
#include <colorscale.hxx>
......@@ -295,9 +296,10 @@ void ScOutputData::SetSyntaxMode( bool bNewMode )
if (bNewMode)
if (!pValueColor)
{
pValueColor = new Color(COL_LIGHTBLUE);
pTextColor = new Color(COL_BLACK);
pFormulaColor = new Color(COL_GREEN);
const ScViewOptions& rOptions = mpDoc->GetViewOptions();
pValueColor = new Color(rOptions.GetValueColor());
pTextColor = new Color(rOptions.GetTextColor());
pFormulaColor = new Color(rOptions.GetFormulaColor());
}
}
......
......@@ -472,6 +472,142 @@
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="vexpand">True</property>
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
<object class="GtkGrid" id="grid8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<object class="svxcorelo-SvxColorListBox" id="value_color">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="svxcorelo-SvxColorListBox" id="formula_color">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="svxcorelo-SvxColorListBox" id="text_color">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="value_color_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="tpviewpage|value_color_label">Value color:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">color</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="formula_color_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="tpviewpage|formula_color_label">Formula color:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">color</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="text_color_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="tpviewpage|text_color_label">Text color:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">color</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="tpviewpage|label6">Highlighting</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame2">
<property name="visible">True</property>
......@@ -605,7 +741,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
......@@ -650,7 +786,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment