officecfg/registry/schema/org/openoffice/Office/Calc.xcs | 32 +++ sc/inc/viewopti.hxx | 12 + sc/source/core/tool/viewopti.cxx | 39 ++++ sc/source/ui/inc/tpview.hxx | 5 sc/source/ui/optdlg/tpview.cxx | 31 +++ sc/source/ui/view/output.cxx | 8 sc/uiconfig/scalc/ui/tpviewpage.ui | 140 ++++++++++++++- 7 files changed, 260 insertions(+), 7 deletions(-)
New commits: commit fb29b8262488d045a926504725669a362bacb5bb Author: Szymon Kłos <szymon.k...@collabora.com> Date: Tue Mar 20 16:40:35 2018 +0100 tdf#116241 Customizing value highlighting colors Change-Id: I5d77e6207d1e29326282d7184c9348e59292977a Reviewed-on: https://gerrit.libreoffice.org/51653 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs index 18b3612259e6..2fdd0caccd64 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs @@ -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> diff --git a/sc/inc/viewopti.hxx b/sc/inc/viewopti.hxx index 8bc3d380b28a..965d1ac73b69 100644 --- a/sc/inc/viewopti.hxx +++ b/sc/inc/viewopti.hxx @@ -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 diff --git a/sc/source/core/tool/viewopti.cxx b/sc/source/core/tool/viewopti.cxx index d882e82e6fd2..eef9125424bb 100644 --- a/sc/source/core/tool/viewopti.cxx +++ b/sc/source/core/tool/viewopti.cxx @@ -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); diff --git a/sc/source/ui/inc/tpview.hxx b/sc/source/ui/inc/tpview.hxx index 6ac52a2d1cd6..dd02675f078e 100644 --- a/sc/source/ui/inc/tpview.hxx +++ b/sc/source/ui/inc/tpview.hxx @@ -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 ); diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx index a7151bded5e7..d1811ca6dec9 100644 --- a/sc/source/ui/optdlg/tpview.cxx +++ b/sc/source/ui/optdlg/tpview.cxx @@ -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(); diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index a5bf884681ad..0e322ceca8ab 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -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()); } } diff --git a/sc/uiconfig/scalc/ui/tpviewpage.ui b/sc/uiconfig/scalc/ui/tpviewpage.ui index 349a28a2d999..ff3e855119f3 100644 --- a/sc/uiconfig/scalc/ui/tpviewpage.ui +++ b/sc/uiconfig/scalc/ui/tpviewpage.ui @@ -473,6 +473,142 @@ </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> <property name="can_focus">False</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> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits