cui/source/options/optcolor.cxx | 1 cui/uiconfig/ui/colorconfigwin.ui | 97 +++++++++++------ include/svtools/colorcfg.hxx | 1 officecfg/registry/data/org/openoffice/Office/UI.xcu | 5 officecfg/registry/schema/org/openoffice/Office/UI.xcs | 10 + sc/source/ui/view/gridwin.cxx | 6 - sc/source/ui/view/hdrcont.cxx | 6 - sc/source/ui/view/tabvwsh4.cxx | 44 +++++-- svtools/source/config/colorcfg.cxx | 6 + 9 files changed, 131 insertions(+), 45 deletions(-)
New commits: commit 4377341dd287b863573bb40ed77e2e2caa92b358 Author: Sahil <me.sahilgau...@gmail.com> AuthorDate: Mon Jan 15 08:02:38 2024 +0530 Commit: Heiko Tietze <heiko.tie...@documentfoundation.org> CommitDate: Tue Jan 23 11:27:43 2024 +0100 tdf#158891 Make cell cursor more accessible for color blind * Add an option to configure the accent color, which is blue by default might not be visible to color blind people. Change-Id: I72cbb0f57e864407a7c9315b5c46645a891d4764 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162055 Tested-by: Heiko Tietze <heiko.tie...@documentfoundation.org> Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org> Tested-by: Jenkins diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx index 7bb8b2f44ea5..d2c94669fa9f 100644 --- a/cui/source/options/optcolor.cxx +++ b/cui/source/options/optcolor.cxx @@ -132,6 +132,7 @@ const vEntryInfo[] = { Group_Html, IDS(unknown), std::u16string_view(u"/HTMLUnknown") }, { Group_Calc, IDS(calcgrid), std::u16string_view(u"/CalcGrid") }, + { Group_Calc, IDS(calccellfocus), std::u16string_view(u"/CalcCellFocus") }, { Group_Calc, IDS(brk), std::u16string_view(u"/CalcPageBreak") }, { Group_Calc, IDS(brkmanual), std::u16string_view(u"/CalcPageBreakManual") }, { Group_Calc, IDS(brkauto), std::u16string_view(u"/CalcPageBreakAutomatic") }, diff --git a/cui/uiconfig/ui/colorconfigwin.ui b/cui/uiconfig/ui/colorconfigwin.ui index bc5603ef6651..d81a14520b66 100644 --- a/cui/uiconfig/ui/colorconfigwin.ui +++ b/cui/uiconfig/ui/colorconfigwin.ui @@ -847,7 +847,7 @@ <property name="label-xalign">0</property> <property name="shadow-type">none</property> <child> - <!-- n-columns=2 n-rows=15 --> + <!-- n-columns=2 n-rows=16 --> <object class="GtkGrid" id="gdCalc"> <property name="visible">True</property> <property name="can-focus">False</property> @@ -901,7 +901,7 @@ </object> <packing> <property name="left-attach">0</property> - <property name="top-attach">1</property> + <property name="top-attach">2</property> </packing> </child> <child> @@ -919,7 +919,7 @@ </object> <packing> <property name="left-attach">1</property> - <property name="top-attach">1</property> + <property name="top-attach">2</property> </packing> </child> <child> @@ -934,7 +934,7 @@ </object> <packing> <property name="left-attach">0</property> - <property name="top-attach">2</property> + <property name="top-attach">3</property> </packing> </child> <child> @@ -952,7 +952,7 @@ </object> <packing> <property name="left-attach">1</property> - <property name="top-attach">2</property> + <property name="top-attach">3</property> </packing> </child> <child> @@ -967,7 +967,7 @@ </object> <packing> <property name="left-attach">0</property> - <property name="top-attach">3</property> + <property name="top-attach">4</property> </packing> </child> <child> @@ -985,7 +985,7 @@ </object> <packing> <property name="left-attach">1</property> - <property name="top-attach">3</property> + <property name="top-attach">4</property> </packing> </child> <child> @@ -1000,7 +1000,7 @@ </object> <packing> <property name="left-attach">0</property> - <property name="top-attach">7</property> + <property name="top-attach">8</property> </packing> </child> <child> @@ -1018,7 +1018,7 @@ </object> <packing> <property name="left-attach">1</property> - <property name="top-attach">7</property> + <property name="top-attach">8</property> </packing> </child> <child> @@ -1036,7 +1036,7 @@ </object> <packing> <property name="left-attach">1</property> - <property name="top-attach">8</property> + <property name="top-attach">9</property> </packing> </child> <child> @@ -1051,7 +1051,7 @@ </object> <packing> <property name="left-attach">0</property> - <property name="top-attach">8</property> + <property name="top-attach">9</property> </packing> </child> <child> @@ -1069,7 +1069,7 @@ </object> <packing> <property name="left-attach">1</property> - <property name="top-attach">9</property> + <property name="top-attach">10</property> </packing> </child> <child> @@ -1084,7 +1084,7 @@ </object> <packing> <property name="left-attach">0</property> - <property name="top-attach">9</property> + <property name="top-attach">10</property> </packing> </child> <child> @@ -1102,7 +1102,7 @@ </object> <packing> <property name="left-attach">1</property> - <property name="top-attach">10</property> + <property name="top-attach">11</property> </packing> </child> <child> @@ -1117,7 +1117,7 @@ </object> <packing> <property name="left-attach">0</property> - <property name="top-attach">10</property> + <property name="top-attach">11</property> </packing> </child> <child> @@ -1135,7 +1135,7 @@ </object> <packing> <property name="left-attach">1</property> - <property name="top-attach">11</property> + <property name="top-attach">12</property> </packing> </child> <child> @@ -1150,7 +1150,7 @@ </object> <packing> <property name="left-attach">0</property> - <property name="top-attach">11</property> + <property name="top-attach">12</property> </packing> </child> <child> @@ -1168,7 +1168,7 @@ </object> <packing> <property name="left-attach">1</property> - <property name="top-attach">12</property> + <property name="top-attach">13</property> </packing> </child> <child> @@ -1183,7 +1183,7 @@ </object> <packing> <property name="left-attach">0</property> - <property name="top-attach">12</property> + <property name="top-attach">13</property> </packing> </child> <child> @@ -1201,7 +1201,7 @@ </object> <packing> <property name="left-attach">1</property> - <property name="top-attach">13</property> + <property name="top-attach">14</property> </packing> </child> <child> @@ -1216,7 +1216,7 @@ </object> <packing> <property name="left-attach">0</property> - <property name="top-attach">13</property> + <property name="top-attach">14</property> </packing> </child> <child> @@ -1234,7 +1234,7 @@ </object> <packing> <property name="left-attach">1</property> - <property name="top-attach">14</property> + <property name="top-attach">15</property> </packing> </child> <child> @@ -1249,7 +1249,7 @@ </object> <packing> <property name="left-attach">0</property> - <property name="top-attach">14</property> + <property name="top-attach">15</property> </packing> </child> <child> @@ -1267,7 +1267,7 @@ </object> <packing> <property name="left-attach">0</property> - <property name="top-attach">4</property> + <property name="top-attach">5</property> </packing> </child> <child> @@ -1293,7 +1293,7 @@ </object> <packing> <property name="left-attach">1</property> - <property name="top-attach">4</property> + <property name="top-attach">5</property> </packing> </child> <child> @@ -1311,7 +1311,7 @@ </object> <packing> <property name="left-attach">0</property> - <property name="top-attach">5</property> + <property name="top-attach">6</property> </packing> </child> <child> @@ -1337,7 +1337,7 @@ </object> <packing> <property name="left-attach">1</property> - <property name="top-attach">5</property> + <property name="top-attach">6</property> </packing> </child> <child> @@ -1360,7 +1360,7 @@ </object> <packing> <property name="left-attach">1</property> - <property name="top-attach">6</property> + <property name="top-attach">7</property> </packing> </child> <child> @@ -1375,7 +1375,46 @@ </object> <packing> <property name="left-attach">0</property> - <property name="top-attach">6</property> + <property name="top-attach">7</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="calccellfocus"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="halign">start</property> + <property name="valign">center</property> + <property name="label" translatable="yes" context="colorconfigwin|calccellfocus">Cell Focus</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">calccellfocus_lb</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">1</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="calccellfocus_lb"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="halign">end</property> + <property name="hexpand">True</property> + <property name="xalign">0</property> + <property name="draw-indicator">True</property> + <property name="label" translatable="no"></property> + <child> + <placeholder/> + </child> + <child internal-child="accessible"> + <object class="AtkObject" id="calccellfocus_lb-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes" context="colorconfigwin|calccellfocus_lb">Cell Focus color</property> + </object> + </child> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">1</property> </packing> </child> </object> diff --git a/include/svtools/colorcfg.hxx b/include/svtools/colorcfg.hxx index 9e9d5bca7da8..c3e4af09885d 100644 --- a/include/svtools/colorcfg.hxx +++ b/include/svtools/colorcfg.hxx @@ -54,6 +54,7 @@ enum ColorConfigEntry : int HTMLKEYWORD , HTMLUNKNOWN , CALCGRID , + CALCCELLFOCUS , CALCPAGEBREAK , CALCPAGEBREAKMANUAL, CALCPAGEBREAKAUTOMATIC, diff --git a/officecfg/registry/data/org/openoffice/Office/UI.xcu b/officecfg/registry/data/org/openoffice/Office/UI.xcu index 2d403745d778..2976c56d182b 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI.xcu @@ -293,6 +293,11 @@ <value xsi:nil="true"/> </prop> </node> + <node oor:name="CalcCellFocus"> + <prop oor:name="Color"> + <value xsi:nil="true"/> + </prop> + </node> <node oor:name="CalcPageBreak"> <prop oor:name="Color"> <value xsi:nil="true"/> diff --git a/officecfg/registry/schema/org/openoffice/Office/UI.xcs b/officecfg/registry/schema/org/openoffice/Office/UI.xcs index 0a87d153674c..0180598dbfd5 100644 --- a/officecfg/registry/schema/org/openoffice/Office/UI.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/UI.xcs @@ -350,6 +350,16 @@ </info> </prop> </group> + <group oor:name="CalcCellFocus"> + <info> + <desc>Specifies the setting to change cell frame, col/row highlight and col/row header color in Calc</desc> + </info> + <prop oor:name="Color" oor:type="xs:int"> + <info> + <desc>Specifies the cell frame color for Calc</desc> + </info> + </prop> + </group> <group oor:name="CalcPageBreak"> <info> <desc>Specifies the settings used for page breaks in the page break preview in Calc.</desc> diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index c83d18e57787..44a5393c0a8a 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -6578,7 +6578,7 @@ void ScGridWindow::UpdateCursorOverlay() if (xOverlayManager.is()) { - Color aCursorColor = GetSettings().GetStyleSettings().GetAccentColor(); + Color aCursorColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCCELLFOCUS).nColor; if (mrViewData.GetActivePart() != eWhich) // non-active pane uses a different color. aCursorColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCPAGEBREAKAUTOMATIC).nColor; @@ -6753,7 +6753,7 @@ void ScGridWindow::UpdateHighlightOverlay() } const Color aBackgroundColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; - Color aHighlightColor = Application::GetSettings().GetStyleSettings().GetAccentColor(); + Color aHighlightColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCCELLFOCUS).nColor; aHighlightColor.Merge(aBackgroundColor, 100); std::unique_ptr<sdr::overlay::OverlayObject> pOverlay(new sdr::overlay::OverlaySelection( @@ -6844,7 +6844,7 @@ void ScGridWindow::UpdateAutoFillOverlay() } else if (xOverlayManager.is()) { - Color aHandleColor = GetSettings().GetStyleSettings().GetHighlightColor(); + Color aHandleColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCCELLFOCUS).nColor; if (mrViewData.GetActivePart() != eWhich) // non-active pane uses a different color. aHandleColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCPAGEBREAKAUTOMATIC).nColor; diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx index c6688ea11562..98ebabb702c3 100644 --- a/sc/source/ui/view/hdrcont.cxx +++ b/sc/source/ui/view/hdrcont.cxx @@ -242,7 +242,7 @@ void ScHeaderControl::Paint( vcl::RenderContext& /*rRenderContext*/, const tools else SetTextColor((bBoldSet && !bHighContrast) ? aSelTextColor : aTextColor); - Color aSelLineColor = rStyleSettings.GetHighlightColor(); + Color aSelLineColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCCELLFOCUS).nColor; aSelLineColor.Merge( COL_BLACK, 0xe0 ); // darken just a little bit bool bLayoutRTL = IsLayoutRTL(); @@ -361,7 +361,7 @@ void ScHeaderControl::Paint( vcl::RenderContext& /*rRenderContext*/, const tools { // background for selection GetOutDev()->SetLineColor(); - Color aColor( rStyleSettings.GetAccentColor() ); + Color aColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCCELLFOCUS).nColor; // merging the highlightcolor (which is used if accent does not exist) with the background // fails in many cases such as Breeze Dark (highlight is too close to background) and // Breeze Light (font color is white and not readable anymore) @@ -385,7 +385,7 @@ void ScHeaderControl::Paint( vcl::RenderContext& /*rRenderContext*/, const tools // line in different color for selection if ( nTransEnd * nLayoutSign >= nTransStart * nLayoutSign && !bHighContrast ) { - GetOutDev()->SetLineColor( aSelLineColor ); + GetOutDev()->SetLineColor(aSelLineColor); if (bVertical) { tools::Long nDarkPos = bMirrored ? 0 : nBarSize-1; diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 02ddae696640..da9ce6851087 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -1700,13 +1700,16 @@ public: private: ScTabViewShell& mrViewShell; - uno::Reference<util::XChangesNotifier> m_xChangesNotifier; + uno::Reference<util::XChangesNotifier> m_xViewChangesNotifier; + uno::Reference<util::XChangesNotifier> m_xColorSchemeChangesNotifier; }; void ScViewOptiChangesListener::stopListening() { - if (m_xChangesNotifier) - m_xChangesNotifier->removeChangesListener(this); + if (m_xViewChangesNotifier) + m_xViewChangesNotifier->removeChangesListener(this); + if (m_xColorSchemeChangesNotifier) + m_xColorSchemeChangesNotifier->removeChangesListener(this); } // virtual @@ -1720,13 +1723,23 @@ void SAL_CALL ScViewOptiChangesListener::changesOccurred(const util::ChangesEven mrViewShell.HighlightOverlay(); break; } + + if (OUString sChangedEntry; (change.Accessor >>= sChangedEntry) && sChangedEntry == + "ColorSchemes/org.openoffice.Office.UI:ColorScheme['COLOR_SCHEME_LIBREOFFICE_AUTOMATIC']/CalcCellFocus/Color") + { + mrViewShell.GetActiveWin()->UpdateCursorOverlay(); + mrViewShell.GetActiveWin()->UpdateAutoFillOverlay(); + mrViewShell.GetActiveWin()->UpdateHighlightOverlay(); + break; + } } } // virtual void SAL_CALL ScViewOptiChangesListener::disposing(const lang::EventObject& /* rEvent */) { - m_xChangesNotifier.clear(); + m_xViewChangesNotifier.clear(); + m_xColorSchemeChangesNotifier.clear(); } ScViewOptiChangesListener::ScViewOptiChangesListener(ScTabViewShell& rViewShell) @@ -1736,17 +1749,28 @@ ScViewOptiChangesListener::ScViewOptiChangesListener(ScTabViewShell& rViewShell) uno::Reference<lang::XMultiServiceFactory> xConfigurationProvider( configuration::theDefaultProvider::get(comphelper::getProcessComponentContext())); - beans::NamedValue aProperty{ u"nodepath"_ustr, + beans::NamedValue aViewProperty{ u"nodepath"_ustr, uno::Any(u"/org.openoffice.Office.Calc/Content/Display"_ustr) }; - uno::Reference<uno::XInterface> xConfigurationAccess + beans::NamedValue aColorSchemeProperty{ u"nodepath"_ustr, + uno::Any(u"/org.openoffice.Office.UI/ColorScheme"_ustr) }; + + uno::Reference<uno::XInterface> xViewConfigurationAccess + = xConfigurationProvider->createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationAccess", { uno::Any(aViewProperty) }); + + uno::Reference<uno::XInterface> xColorSchemeConfigurationAccess = xConfigurationProvider->createInstanceWithArguments( - "com.sun.star.configuration.ConfigurationAccess", { uno::Any(aProperty) }); + "com.sun.star.configuration.ConfigurationAccess", { uno::Any(aColorSchemeProperty) }); + + m_xViewChangesNotifier.set(xViewConfigurationAccess, uno::UNO_QUERY); + m_xColorSchemeChangesNotifier.set(xColorSchemeConfigurationAccess, uno::UNO_QUERY); - m_xChangesNotifier.set(xConfigurationAccess, uno::UNO_QUERY); + if (m_xViewChangesNotifier) + m_xViewChangesNotifier->addChangesListener(this); - if (m_xChangesNotifier) - m_xChangesNotifier->addChangesListener(this); + if (m_xColorSchemeChangesNotifier) + m_xColorSchemeChangesNotifier->addChangesListener(this); } ScTabViewShell::ScTabViewShell( SfxViewFrame& rViewFrame, diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx index 7105c1690ba4..dea9ca97db2f 100644 --- a/svtools/source/config/colorcfg.cxx +++ b/svtools/source/config/colorcfg.cxx @@ -135,6 +135,7 @@ uno::Sequence< OUString> GetPropertyNames(std::u16string_view rScheme) { std::u16string_view(u"/HTMLKeyword") ,false }, { std::u16string_view(u"/HTMLUnknown") ,false }, { std::u16string_view(u"/CalcGrid") ,false }, + { std::u16string_view(u"/CalcCellFocus") ,false }, { std::u16string_view(u"/CalcPageBreak"), false }, { std::u16string_view(u"/CalcPageBreakManual"), false }, { std::u16string_view(u"/CalcPageBreakAutomatic"), false }, @@ -415,6 +416,7 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry) { COL_LIGHTRED, COL_LIGHTRED }, // HTMLKEYWORD { COL_GRAY, COL_GRAY }, // HTMLUNKNOWN { COL_GRAY3, COL_GRAY7 }, // CALCGRID + { COL_LIGHTBLUE, COL_LIGHTBLUE }, // CALCCELLFOCUS { COL_BLUE, COL_BLUE }, // CALCPAGEBREAK { Color(0x2300dc), Color(0x2300DC) }, // CALCPAGEBREAKMANUAL { COL_GRAY7, COL_GRAY7 }, // CALCPAGEBREAKAUTOMATIC @@ -461,6 +463,10 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry) aRet = Application::GetSettings().GetStyleSettings().GetVisitedLinkColor(); break; + case CALCCELLFOCUS: + aRet = Application::GetSettings().GetStyleSettings().GetAccentColor(); + break; + default: int nAppMod; switch (MiscSettings::GetAppColorMode()) {