cui/source/options/optcolor.cxx | 14 cui/uiconfig/ui/colorconfigwin.ui | 346 ++++++++++++++++- include/svtools/colorcfg.hxx | 9 include/tools/color.hxx | 27 - officecfg/registry/data/org/openoffice/Office/UI.xcu | 45 ++ officecfg/registry/schema/org/openoffice/Office/UI.xcs | 90 ++++ sd/source/ui/annotations/annotationmanager.cxx | 54 +- svtools/source/config/colorcfg.cxx | 18 svx/source/annotation/AnnotationObject.cxx | 28 + sw/inc/AnnotationWin.hxx | 1 sw/inc/PostItMgr.hxx | 1 sw/source/uibase/app/apphdl.cxx | 8 sw/source/uibase/app/swmodul1.cxx | 20 sw/source/uibase/docvw/AnnotationWin2.cxx | 43 +- sw/source/uibase/docvw/PostItMgr.cxx | 71 ++- 15 files changed, 655 insertions(+), 120 deletions(-)
New commits: commit 919e13fb3ba254312593727f92a6cf8f060e3051 Author: Heiko Tietze <tietze.he...@gmail.com> AuthorDate: Tue Aug 6 11:14:12 2024 +0200 Commit: Heiko Tietze <heiko.tie...@documentfoundation.org> CommitDate: Sun Aug 11 08:26:23 2024 +0200 Resolves tdf#61242 - Customization of comment background color * COL_AUTHOR<1..>_DARK/LIGHT/NORMAL removed Author1..9 added * dark variants calculated from light with 50% brightness * light does In/DecreaseLuminance(30) and dark (sd) resp. anchor (sw) In/DecreaseLuminance(80) depending on GetUseDarkMode() * sw: font color depends on outline background, which now picks up DOCCOLOR; this does not work for dark colors in light mode, for example * sd does not update on changes and requires a restart Change-Id: I773793de8cfbdc0d23124db790604b93030375c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171523 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 0987e25ca923..df3965b28199 100644 --- a/cui/source/options/optcolor.cxx +++ b/cui/source/options/optcolor.cxx @@ -54,6 +54,7 @@ enum Group Group_Html, Group_Calc, Group_Draw, + Group_Comment, Group_Basic, Group_Sql, @@ -76,8 +77,9 @@ const vGroupInfo[] = { Group_Html, u"html"_ustr }, { Group_Calc, u"calc"_ustr }, { Group_Draw, u"draw"_ustr }, + { Group_Comment, u"comment"_ustr }, { Group_Basic, u"basic"_ustr }, - { Group_Sql, u"sql"_ustr } + { Group_Sql, u"sql"_ustr }, }; // color config entry data (see ColorConfigWindow_Impl::Entry below) @@ -150,6 +152,16 @@ const vEntryInfo[] = { Group_Draw, IDS(drawgrid), std::u16string_view(u"/DrawGrid") }, + { Group_Comment, IDS(author1), std::u16string_view(u"/Author1") }, + { Group_Comment, IDS(author2), std::u16string_view(u"/Author2") }, + { Group_Comment, IDS(author3), std::u16string_view(u"/Author3") }, + { Group_Comment, IDS(author4), std::u16string_view(u"/Author4") }, + { Group_Comment, IDS(author5), std::u16string_view(u"/Author5") }, + { Group_Comment, IDS(author6), std::u16string_view(u"/Author6") }, + { Group_Comment, IDS(author7), std::u16string_view(u"/Author7") }, + { Group_Comment, IDS(author8), std::u16string_view(u"/Author8") }, + { Group_Comment, IDS(author9), std::u16string_view(u"/Author9") }, + { Group_Basic, IDS(basiceditor), std::u16string_view(u"/BASICEditor") }, { Group_Basic, IDS(basicid), std::u16string_view(u"/BASICIdentifier") }, { Group_Basic, IDS(basiccomment), std::u16string_view(u"/BASICComment") }, diff --git a/cui/uiconfig/ui/colorconfigwin.ui b/cui/uiconfig/ui/colorconfigwin.ui index d81a14520b66..8154d626a884 100644 --- a/cui/uiconfig/ui/colorconfigwin.ui +++ b/cui/uiconfig/ui/colorconfigwin.ui @@ -1504,6 +1504,346 @@ <property name="position">3</property> </packing> </child> + <child> + <object class="GtkFrame" id="frmComments"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label-xalign">0</property> + <property name="shadow-type">none</property> + <child> + <!-- n-columns=2 n-rows=9 --> + <object class="GtkGrid"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-start">6</property> + <property name="margin-end">12</property> + <property name="row-spacing">3</property> + <property name="column-spacing">6</property> + <child> + <object class="GtkLabel" id="author1"> + <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|author1">Author 1</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">author1_lb</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">0</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="author1_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> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="author2"> + <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|author2">Author 2</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">author2_lb</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">1</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="author2_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> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="author3"> + <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|author3">Author 3</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">author3_lb</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">2</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="author3_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> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="author4"> + <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|author4">Author 4</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">author4_lb</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">3</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="author4_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> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">3</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="author5"> + <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|author5">Author 5</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">author5_lb</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">4</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="author5_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> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">4</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="author6"> + <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|author6">Author 6</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">author6_lb</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">5</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="author6_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> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">5</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="author7"> + <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|author7">Author 7</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">author7_lb</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">6</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="author7_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> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">6</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="author8"> + <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|author8">Author 8</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">author8_lb</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">7</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="author8_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> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">7</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="author9"> + <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|author9">Author 9</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">author9_lb</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">8</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="author9_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> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">8</property> + </packing> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="lbComment"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes" context="colorconfigwin|comments">Comments</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> <child> <object class="GtkFrame" id="frmBasic"> <property name="visible">True</property> @@ -1800,7 +2140,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">4</property> + <property name="position">5</property> </packing> </child> <child> @@ -2066,7 +2406,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">5</property> + <property name="position">6</property> </packing> </child> <child> @@ -2233,7 +2573,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">6</property> + <property name="position">7</property> </packing> </child> </object> diff --git a/include/svtools/colorcfg.hxx b/include/svtools/colorcfg.hxx index 89074ec03887..72e3ae3a63e8 100644 --- a/include/svtools/colorcfg.hxx +++ b/include/svtools/colorcfg.hxx @@ -70,6 +70,15 @@ enum ColorConfigEntry : int CALCTEXT, CALCPROTECTEDBACKGROUND, DRAWGRID , + AUTHOR1, + AUTHOR2, + AUTHOR3, + AUTHOR4, + AUTHOR5, + AUTHOR6, + AUTHOR7, + AUTHOR8, + AUTHOR9, BASICEDITOR, BASICIDENTIFIER, BASICCOMMENT , diff --git a/include/tools/color.hxx b/include/tools/color.hxx index f95ef582f1d6..653111c50bb4 100644 --- a/include/tools/color.hxx +++ b/include/tools/color.hxx @@ -469,33 +469,6 @@ inline constexpr ::Color COL_LIGHTMAGENTA ( 0xFF, 0x00, 0xFF ); inline constexpr ::Color COL_LIGHTGRAYBLUE ( 0xE0, 0xE0, 0xFF ); inline constexpr ::Color COL_YELLOW ( 0xFF, 0xFF, 0x00 ); inline constexpr ::Color COL_WHITE ( 0xFF, 0xFF, 0xFF ); -inline constexpr ::Color COL_AUTHOR1_DARK ( 0xC6, 0x92, 0x00 ); -inline constexpr ::Color COL_AUTHOR1_NORMAL ( 0xFF, 0xFF, 0x9E ); -inline constexpr ::Color COL_AUTHOR1_LIGHT ( 0xFF, 0xFF, 0xC3 ); -inline constexpr ::Color COL_AUTHOR2_DARK ( 0x06, 0x46, 0xA2 ); -inline constexpr ::Color COL_AUTHOR2_NORMAL ( 0xD8, 0xE8, 0xFF ); -inline constexpr ::Color COL_AUTHOR2_LIGHT ( 0xE9, 0xF2, 0xFF ); -inline constexpr ::Color COL_AUTHOR3_DARK ( 0x57, 0x9D, 0x1C ); -inline constexpr ::Color COL_AUTHOR3_NORMAL ( 0xDA, 0xF8, 0xC1 ); -inline constexpr ::Color COL_AUTHOR3_LIGHT ( 0xE2, 0xFA, 0xCF ); -inline constexpr ::Color COL_AUTHOR4_DARK ( 0x69, 0x2B, 0x9D ); -inline constexpr ::Color COL_AUTHOR4_NORMAL ( 0xE4, 0xD2, 0xF5 ); -inline constexpr ::Color COL_AUTHOR4_LIGHT ( 0xEF, 0xE4, 0xF8 ); -inline constexpr ::Color COL_AUTHOR5_DARK ( 0xC5, 0x00, 0x0B ); -inline constexpr ::Color COL_AUTHOR5_NORMAL ( 0xFE, 0xCD, 0xD0 ); -inline constexpr ::Color COL_AUTHOR5_LIGHT ( 0xFF, 0xE3, 0xE5 ); -inline constexpr ::Color COL_AUTHOR6_DARK ( 0x00, 0x80, 0x80 ); -inline constexpr ::Color COL_AUTHOR6_NORMAL ( 0xD2, 0xF6, 0xF6 ); -inline constexpr ::Color COL_AUTHOR6_LIGHT ( 0xE6, 0xFA, 0xFA ); -inline constexpr ::Color COL_AUTHOR7_DARK ( 0x8C, 0x84, 0x00 ); -inline constexpr ::Color COL_AUTHOR7_NORMAL ( 0xED, 0xFC, 0xA3 ); -inline constexpr ::Color COL_AUTHOR7_LIGHT ( 0xF2, 0xFE, 0xB5 ); -inline constexpr ::Color COL_AUTHOR8_DARK ( 0x35, 0x55, 0x6B ); -inline constexpr ::Color COL_AUTHOR8_NORMAL ( 0xD3, 0xDE, 0xE8 ); -inline constexpr ::Color COL_AUTHOR8_LIGHT ( 0xE2, 0xEA, 0xF1 ); -inline constexpr ::Color COL_AUTHOR9_DARK ( 0xD1, 0x76, 0x00 ); -inline constexpr ::Color COL_AUTHOR9_NORMAL ( 0xFF, 0xE2, 0xB9 ); -inline constexpr ::Color COL_AUTHOR9_LIGHT ( 0xFF, 0xE7, 0xC7 ); inline constexpr ::Color COL_AUTHOR_TABLE_INS ( 0xE1, 0xF2, 0xFA ); inline constexpr ::Color COL_AUTHOR_TABLE_DEL ( 0xFC, 0xE6, 0xF4 ); diff --git a/officecfg/registry/data/org/openoffice/Office/UI.xcu b/officecfg/registry/data/org/openoffice/Office/UI.xcu index 2976c56d182b..73c944ced65f 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI.xcu @@ -382,6 +382,51 @@ <value xsi:nil="true"/> </prop> </node> + <node oor:name="Author1"> + <prop oor:name="Color"> + <value xsi:nil="true"/> + </prop> + </node> + <node oor:name="Author2"> + <prop oor:name="Color"> + <value xsi:nil="true"/> + </prop> + </node> + <node oor:name="Author3"> + <prop oor:name="Color"> + <value xsi:nil="true"/> + </prop> + </node> + <node oor:name="Author4"> + <prop oor:name="Color"> + <value xsi:nil="true"/> + </prop> + </node> + <node oor:name="Author5"> + <prop oor:name="Color"> + <value xsi:nil="true"/> + </prop> + </node> + <node oor:name="Author6"> + <prop oor:name="Color"> + <value xsi:nil="true"/> + </prop> + </node> + <node oor:name="Author7"> + <prop oor:name="Color"> + <value xsi:nil="true"/> + </prop> + </node> + <node oor:name="Author8"> + <prop oor:name="Color"> + <value xsi:nil="true"/> + </prop> + </node> + <node oor:name="Author9"> + <prop oor:name="Color"> + <value xsi:nil="true"/> + </prop> + </node> <node oor:name="BASICEditor"> <prop oor:name="Color" oor:type="xs:int"> <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 0180598dbfd5..e7b62337aca9 100644 --- a/officecfg/registry/schema/org/openoffice/Office/UI.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/UI.xcs @@ -528,6 +528,96 @@ </info> </prop> </group> + <group oor:name="Author1"> + <info> + <desc>Specifies the settings used for the comments of author #1.</desc> + </info> + <prop oor:name="Color" oor:type="xs:int"> + <info> + <desc>Specifies the color used for author #1.</desc> + </info> + </prop> + </group> + <group oor:name="Author2"> + <info> + <desc>Specifies the settings used for the comments of author #2.</desc> + </info> + <prop oor:name="Color" oor:type="xs:int"> + <info> + <desc>Specifies the color used for author #2.</desc> + </info> + </prop> + </group> + <group oor:name="Author3"> + <info> + <desc>Specifies the settings used for the comments of author #3.</desc> + </info> + <prop oor:name="Color" oor:type="xs:int"> + <info> + <desc>Specifies the color used for author #3.</desc> + </info> + </prop> + </group> + <group oor:name="Author4"> + <info> + <desc>Specifies the settings used for the comments of author #4.</desc> + </info> + <prop oor:name="Color" oor:type="xs:int"> + <info> + <desc>Specifies the color used for author #4.</desc> + </info> + </prop> + </group> + <group oor:name="Author5"> + <info> + <desc>Specifies the settings used for the comments of author #5.</desc> + </info> + <prop oor:name="Color" oor:type="xs:int"> + <info> + <desc>Specifies the color used for author #5.</desc> + </info> + </prop> + </group> + <group oor:name="Author6"> + <info> + <desc>Specifies the settings used for the comments of author #6.</desc> + </info> + <prop oor:name="Color" oor:type="xs:int"> + <info> + <desc>Specifies the color used for author #6.</desc> + </info> + </prop> + </group> + <group oor:name="Author7"> + <info> + <desc>Specifies the settings used for the comments of author #7.</desc> + </info> + <prop oor:name="Color" oor:type="xs:int"> + <info> + <desc>Specifies the color used for author #7.</desc> + </info> + </prop> + </group> + <group oor:name="Author8"> + <info> + <desc>Specifies the settings used for the comments of author #8.</desc> + </info> + <prop oor:name="Color" oor:type="xs:int"> + <info> + <desc>Specifies the color used for author #8.</desc> + </info> + </prop> + </group> + <group oor:name="Author9"> + <info> + <desc>Specifies the settings used for the comments of author #9.</desc> + </info> + <prop oor:name="Color" oor:type="xs:int"> + <info> + <desc>Specifies the color used for author #9.</desc> + </info> + </prop> + </group> <group oor:name="BASICEditor"> <info> <desc>Specifies the settings of the BASIC code editor.</desc> diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index e547521bdb49..cada3c0c29ad 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -1158,16 +1158,24 @@ IMPL_LINK(AnnotationManagerImpl,EventMultiplexerListener, } } +// TODO: Update colors on notification via DrawViewShell::ConfigurationChanged() Color AnnotationManagerImpl::GetColor(sal_uInt16 aAuthorIndex) { if (!Application::GetSettings().GetStyleSettings().GetHighContrastMode()) { - static const Color aArrayNormal[] = { - COL_AUTHOR1_NORMAL, COL_AUTHOR2_NORMAL, COL_AUTHOR3_NORMAL, - COL_AUTHOR4_NORMAL, COL_AUTHOR5_NORMAL, COL_AUTHOR6_NORMAL, - COL_AUTHOR7_NORMAL, COL_AUTHOR8_NORMAL, COL_AUTHOR9_NORMAL }; - - return aArrayNormal[ aAuthorIndex % SAL_N_ELEMENTS( aArrayNormal ) ]; + svtools::ColorConfig aColorConfig; + switch (aAuthorIndex % 9) + { + case 0: return aColorConfig.GetColorValue(svtools::AUTHOR1).nColor; + case 1: return aColorConfig.GetColorValue(svtools::AUTHOR2).nColor; + case 2: return aColorConfig.GetColorValue(svtools::AUTHOR3).nColor; + case 3: return aColorConfig.GetColorValue(svtools::AUTHOR4).nColor; + case 4: return aColorConfig.GetColorValue(svtools::AUTHOR5).nColor; + case 5: return aColorConfig.GetColorValue(svtools::AUTHOR6).nColor; + case 6: return aColorConfig.GetColorValue(svtools::AUTHOR7).nColor; + case 7: return aColorConfig.GetColorValue(svtools::AUTHOR8).nColor; + case 8: return aColorConfig.GetColorValue(svtools::AUTHOR9).nColor; + } } return COL_WHITE; @@ -1175,32 +1183,22 @@ Color AnnotationManagerImpl::GetColor(sal_uInt16 aAuthorIndex) Color AnnotationManagerImpl::GetColorLight(sal_uInt16 aAuthorIndex) { - if (!Application::GetSettings().GetStyleSettings().GetHighContrastMode()) - { - static const Color aArrayLight[] = { - COL_AUTHOR1_LIGHT, COL_AUTHOR2_LIGHT, COL_AUTHOR3_LIGHT, - COL_AUTHOR4_LIGHT, COL_AUTHOR5_LIGHT, COL_AUTHOR6_LIGHT, - COL_AUTHOR7_LIGHT, COL_AUTHOR8_LIGHT, COL_AUTHOR9_LIGHT }; - - return aArrayLight[ aAuthorIndex % SAL_N_ELEMENTS( aArrayLight ) ]; - } - - return COL_WHITE; + Color aColor = GetColor(aAuthorIndex); + if (MiscSettings::GetUseDarkMode()) + aColor.IncreaseLuminance(30); + else + aColor.DecreaseLuminance(30); + return aColor; } Color AnnotationManagerImpl::GetColorDark(sal_uInt16 aAuthorIndex) { - if (!Application::GetSettings().GetStyleSettings().GetHighContrastMode()) - { - static const Color aArrayAnkor[] = { - COL_AUTHOR1_DARK, COL_AUTHOR2_DARK, COL_AUTHOR3_DARK, - COL_AUTHOR4_DARK, COL_AUTHOR5_DARK, COL_AUTHOR6_DARK, - COL_AUTHOR7_DARK, COL_AUTHOR8_DARK, COL_AUTHOR9_DARK }; - - return aArrayAnkor[ aAuthorIndex % SAL_N_ELEMENTS( aArrayAnkor ) ]; - } - - return COL_WHITE; + Color aColor = GetColor(aAuthorIndex);; + if (MiscSettings::GetUseDarkMode()) + aColor.DecreaseLuminance(80); + else + aColor.IncreaseLuminance(80); + return aColor; } SdPage* AnnotationManagerImpl::GetNextPage( SdPage const * pPage, bool bForward ) diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx index 9ba8004f752a..93e3e2e988da 100644 --- a/svtools/source/config/colorcfg.cxx +++ b/svtools/source/config/colorcfg.cxx @@ -151,6 +151,15 @@ uno::Sequence< OUString> GetPropertyNames(std::u16string_view rScheme) { std::u16string_view(u"/CalcText") ,false }, { std::u16string_view(u"/CalcProtectedBackground") ,false }, { std::u16string_view(u"/DrawGrid") ,true }, + { std::u16string_view(u"/Author1"), false }, + { std::u16string_view(u"/Author2"), false }, + { std::u16string_view(u"/Author3"), false }, + { std::u16string_view(u"/Author4"), false }, + { std::u16string_view(u"/Author5"), false }, + { std::u16string_view(u"/Author6"), false }, + { std::u16string_view(u"/Author7"), false }, + { std::u16string_view(u"/Author8"), false }, + { std::u16string_view(u"/Author9"), false }, { std::u16string_view(u"/BASICEditor"), false }, { std::u16string_view(u"/BASICIdentifier"), false }, { std::u16string_view(u"/BASICComment") , false }, @@ -432,6 +441,15 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry, int nMod) { COL_BLACK, Color(0xEEEEEE) }, // CALCTEXT { COL_LIGHTGRAY, Color(0x1C1C1C) }, // CALCPROTECTEDBACKGROUND { COL_GRAY7, COL_GRAY7 }, // DRAWGRID + { Color(0xFFFF9E), Color(0x80804f) }, // AUTHOR1 + { Color(0xD8E8FF), Color(0x6c7480) }, // AUTHOR2 + { Color(0xDAF8C1), Color(0x708063) }, // AUTHOR3 + { Color(0xE4D2F5), Color(0x776d80) }, // AUTHOR4 + { Color(0xFECDD0), Color(0x806768) }, // AUTHOR5 + { Color(0xD2F6F6), Color(0x6c8080) }, // AUTHOR6 + { Color(0xEDFCA3), Color(0x788052) }, // AUTHOR7 + { Color(0xD3DEE8), Color(0x747a80) }, // AUTHOR8 + { Color(0xFFE2B9), Color(0x80715d) }, // AUTHOR9 { COL_WHITE, Color(0x1C1C1C) }, // BASICEDITOR { COL_GREEN, Color(0xDDE8CB) }, // BASICIDENTIFIER { COL_GRAY, Color(0xEEEEEE) }, // BASICCOMMENT diff --git a/svx/source/annotation/AnnotationObject.cxx b/svx/source/annotation/AnnotationObject.cxx index 193a3438c277..f108e0d5113d 100644 --- a/svx/source/annotation/AnnotationObject.cxx +++ b/svx/source/annotation/AnnotationObject.cxx @@ -27,6 +27,7 @@ #include <svx/sdooitm.hxx> #include <svx/sdtagitm.hxx> #include <svx/sdasitm.hxx> +#include <svtools/colorcfg.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> @@ -79,11 +80,28 @@ Color getColorLight(sal_uInt16 aAuthorIndex) { if (!Application::GetSettings().GetStyleSettings().GetHighContrastMode()) { - constexpr const auto constArrayLight - = std::to_array<Color>({ COL_AUTHOR1_LIGHT, COL_AUTHOR2_LIGHT, COL_AUTHOR3_LIGHT, - COL_AUTHOR4_LIGHT, COL_AUTHOR5_LIGHT, COL_AUTHOR6_LIGHT, - COL_AUTHOR7_LIGHT, COL_AUTHOR8_LIGHT, COL_AUTHOR9_LIGHT }); - return constArrayLight[aAuthorIndex % constArrayLight.size()]; + svtools::ColorConfig aColorConfig; + switch (aAuthorIndex % 9) + { + case 0: + return aColorConfig.GetColorValue(svtools::AUTHOR1).nColor; + case 1: + return aColorConfig.GetColorValue(svtools::AUTHOR2).nColor; + case 2: + return aColorConfig.GetColorValue(svtools::AUTHOR3).nColor; + case 3: + return aColorConfig.GetColorValue(svtools::AUTHOR4).nColor; + case 4: + return aColorConfig.GetColorValue(svtools::AUTHOR5).nColor; + case 5: + return aColorConfig.GetColorValue(svtools::AUTHOR6).nColor; + case 6: + return aColorConfig.GetColorValue(svtools::AUTHOR7).nColor; + case 7: + return aColorConfig.GetColorValue(svtools::AUTHOR8).nColor; + case 8: + return aColorConfig.GetColorValue(svtools::AUTHOR9).nColor; + } } return COL_WHITE; diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx index cbeaf7ceca44..32f7b77f4829 100644 --- a/sw/inc/AnnotationWin.hxx +++ b/sw/inc/AnnotationWin.hxx @@ -94,6 +94,7 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin final : public InterimItemWindow void SetPosAndSize(); void TranslateTopPosition(const tools::Long aAmount); void CheckMetaText(); + void UpdateColors(); Point const & GetAnchorPos() { return mAnchorRect.Pos(); } const SwRect& GetAnchorRect() const { return mAnchorRect; } diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx index 2cc8ec9d5222..f11c821240cd 100644 --- a/sw/inc/PostItMgr.hxx +++ b/sw/inc/PostItMgr.hxx @@ -224,6 +224,7 @@ class SAL_DLLPUBLIC_RTTI SwPostItMgr final : public SfxListener void RegisterAnswerText(const OUString& aAnswerText) { maAnswerText = aAnswerText; } const OUString& GetAnswerText() const { return maAnswerText; } void CheckMetaText(); + void UpdateColors(); sal_uInt16 Replace(SvxSearchItem const * pItem); sal_uInt16 SearchReplace(const SwFormatField &pField, const i18nutil::SearchOptions2& rSearchOptions,bool bSrchForward); diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx index 35504f1c8f33..fffe14724dfe 100644 --- a/sw/source/uibase/app/apphdl.cxx +++ b/sw/source/uibase/app/apphdl.cxx @@ -46,6 +46,7 @@ #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <o3tl/string_view.hxx> +#include <PostItMgr.hxx> #include <view.hxx> #include <pview.hxx> @@ -998,6 +999,13 @@ void SwModule::ConfigurationChanged(utl::ConfigurationBroadcaster* pBrdCst, Conf aViewColors.m_aDocColor.AsRGBHexString().toUtf8()); } + if (!bKit) + { + SwPostItMgr* pPostItManager = pSwView->GetPostItMgr(); + if (pPostItManager) + pPostItManager->UpdateColors(); + } + // if nothing changed, and the hint was OnlyCurrentDocumentColorScheme we can skip invalidate const bool bSkipInvalidate = !bChanged && bKit && eHints == ConfigurationHints::OnlyCurrentDocumentColorScheme; if (!bSkipInvalidate) diff --git a/sw/source/uibase/app/swmodul1.cxx b/sw/source/uibase/app/swmodul1.cxx index 4f4bcd780e31..a5d6d0b7124b 100644 --- a/sw/source/uibase/app/swmodul1.cxx +++ b/sw/source/uibase/app/swmodul1.cxx @@ -54,6 +54,7 @@ #include <doc.hxx> #include <strings.hrc> #include <IDocumentLayoutAccess.hxx> +#include <svtools/colorcfg.hxx> #include <tools/color.hxx> #include <tools/json_writer.hxx> @@ -428,14 +429,19 @@ void SwModule::ClearRedlineAuthors() static Color lcl_GetAuthorColor(std::size_t nPos) { - static const Color aColArr[] = + switch (nPos % 9) { - COL_AUTHOR1_DARK, COL_AUTHOR2_DARK, COL_AUTHOR3_DARK, - COL_AUTHOR4_DARK, COL_AUTHOR5_DARK, COL_AUTHOR6_DARK, - COL_AUTHOR7_DARK, COL_AUTHOR8_DARK, COL_AUTHOR9_DARK - }; - - return aColArr[nPos % SAL_N_ELEMENTS(aColArr)]; + case 0: return SW_MOD()->GetColorConfig().GetColorValue(svtools::AUTHOR1).nColor; + case 1: return SW_MOD()->GetColorConfig().GetColorValue(svtools::AUTHOR2).nColor; + case 2: return SW_MOD()->GetColorConfig().GetColorValue(svtools::AUTHOR3).nColor; + case 3: return SW_MOD()->GetColorConfig().GetColorValue(svtools::AUTHOR4).nColor; + case 4: return SW_MOD()->GetColorConfig().GetColorValue(svtools::AUTHOR5).nColor; + case 5: return SW_MOD()->GetColorConfig().GetColorValue(svtools::AUTHOR6).nColor; + case 6: return SW_MOD()->GetColorConfig().GetColorValue(svtools::AUTHOR7).nColor; + case 7: return SW_MOD()->GetColorConfig().GetColorValue(svtools::AUTHOR8).nColor; + case 8: return SW_MOD()->GetColorConfig().GetColorValue(svtools::AUTHOR9).nColor; + default: return COL_AUTO; // silence -Wreturn-type + } } /// Returns a JSON representation of a redline author. diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index debca6ca43a6..f786c1f038f5 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -76,6 +76,7 @@ #include <SwRewriter.hxx> #include <txtannotationfld.hxx> #include <ndtxt.hxx> +#include <svtools/colorcfg.hxx> #include <drawinglayer/processor2d/baseprocessor2d.hxx> #include <drawinglayer/processor2d/processor2dtools.hxx> @@ -176,7 +177,7 @@ void SwAnnotationWin::DrawForPage(OutputDevice* pDev, const Point& rPt) pDev->SetFillColor(mColorDark); pDev->SetLineColor(); - pDev->SetTextColor(mColorAnchor); + pDev->SetTextColor(mColorDark.IsDark() ? COL_WHITE : COL_BLACK); vcl::Font aFont = maLabelFont; aFont.SetFontHeight(aFont.GetFontHeight() * 20); pDev->SetFont(aFont); @@ -451,18 +452,18 @@ void SwAnnotationWin::CheckMetaText() { mxMetadataDate->set_label(sMeta); } + UpdateColors(); +} +void SwAnnotationWin::UpdateColors() +{ std::size_t aIndex = SW_MOD()->InsertRedlineAuthor(GetAuthor()); SetColor( SwPostItMgr::GetColorDark(aIndex), SwPostItMgr::GetColorLight(aIndex), SwPostItMgr::GetColorAnchor(aIndex)); -} - -static Color ColorFromAlphaColor(const sal_uInt8 aTransparency, const Color& aFront, const Color& aBack) -{ - return Color(sal_uInt8(aFront.GetRed() * aTransparency / 255.0 + aBack.GetRed() * (1 - aTransparency / 255.0)), - sal_uInt8(aFront.GetGreen() * aTransparency / 255.0 + aBack.GetGreen() * (1 - aTransparency / 255.0)), - sal_uInt8(aFront.GetBlue() * aTransparency / 255.0 + aBack.GetBlue() * (1 - aTransparency / 255.0))); + // draw comments either black or white depending on the document background + // TODO: make editeng depend on the actual note background + mpOutlinerView->SetBackgroundColor(svtools::ColorConfig().GetColorValue(svtools::DOCCOLOR).nColor); } void SwAnnotationWin::SetMenuButtonColors() @@ -470,8 +471,6 @@ void SwAnnotationWin::SetMenuButtonColors() if (!mxMenuButton) return; - mxMenuButton->set_background(mColorDark); - SwWrtShell* pWrtShell = mrView.GetWrtShellPtr(); if (!pWrtShell) return; @@ -484,13 +483,13 @@ void SwAnnotationWin::SetMenuButtonColors() xVirDev->SetOutputSizePixel(aSize); Gradient aGradient(css::awt::GradientStyle_LINEAR, - ColorFromAlphaColor(15, mColorAnchor, mColorDark), - ColorFromAlphaColor(80, mColorAnchor, mColorDark)); + mColorLight, + mColorDark); xVirDev->DrawGradient(aRect, aGradient); //draw rect around button xVirDev->SetFillColor(); - xVirDev->SetLineColor(ColorFromAlphaColor(90, mColorAnchor, mColorDark)); + xVirDev->SetLineColor(mColorDark.IsDark() ? mColorLight : mColorDark); xVirDev->DrawRect(aRect); tools::Rectangle aSymbolRect(aRect); @@ -498,14 +497,15 @@ void SwAnnotationWin::SetMenuButtonColors() const tools::Long nBorderDistanceLeftAndRight = ((aSymbolRect.GetWidth() * 250) + 500) / 1000; aSymbolRect.AdjustLeft(nBorderDistanceLeftAndRight ); aSymbolRect.AdjustRight( -nBorderDistanceLeftAndRight ); - // 40% distance to the top button border - const tools::Long nBorderDistanceTop = ((aSymbolRect.GetHeight() * 400) + 500) / 1000; + // 30% distance to the top button border + const tools::Long nBorderDistanceTop = ((aSymbolRect.GetHeight() * 300) + 500) / 1000; aSymbolRect.AdjustTop(nBorderDistanceTop ); - // 15% distance to the bottom button border - const tools::Long nBorderDistanceBottom = ((aSymbolRect.GetHeight() * 150) + 500) / 1000; + // 25% distance to the bottom button border + const tools::Long nBorderDistanceBottom = ((aSymbolRect.GetHeight() * 250) + 500) / 1000; aSymbolRect.AdjustBottom( -nBorderDistanceBottom ); + DecorationView aDecoView(xVirDev.get()); - aDecoView.DrawSymbol(aSymbolRect, SymbolType::SPIN_DOWN, COL_BLACK, + aDecoView.DrawSymbol(aSymbolRect, SymbolType::SPIN_DOWN, mColorDark.IsDark() ? COL_WHITE : COL_BLACK, DrawSymbolFlags::NONE); mxMenuButton->set_image(xVirDev); mxMenuButton->set_size_request(aSize.Width() + 4, aSize.Height() + 4); @@ -901,11 +901,12 @@ void SwAnnotationWin::SetColor(Color aColorDark,Color aColorLight, Color aColorA m_xContainer->set_background(mColorDark); SetMenuButtonColors(); - mxMetadataAuthor->set_font_color(aColorAnchor); + Color aColor(mColorDark.IsDark() ? COL_WHITE : COL_BLACK); + mxMetadataAuthor->set_font_color(aColor); - mxMetadataDate->set_font_color(aColorAnchor); + mxMetadataDate->set_font_color(aColor); - mxMetadataResolved->set_font_color(aColorAnchor); + mxMetadataResolved->set_font_color(aColor); mxVScrollbar->customize_scrollbars(mColorLight, mColorAnchor, diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 08bbdbd57dbe..764968fe07e5 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -2250,45 +2250,51 @@ Color SwPostItMgr::GetColorDark(std::size_t aAuthorIndex) { if (!Application::GetSettings().GetStyleSettings().GetHighContrastMode()) { - static const Color aArrayNormal[] = { - COL_AUTHOR1_NORMAL, COL_AUTHOR2_NORMAL, COL_AUTHOR3_NORMAL, - COL_AUTHOR4_NORMAL, COL_AUTHOR5_NORMAL, COL_AUTHOR6_NORMAL, - COL_AUTHOR7_NORMAL, COL_AUTHOR8_NORMAL, COL_AUTHOR9_NORMAL }; - - return aArrayNormal[ aAuthorIndex % SAL_N_ELEMENTS( aArrayNormal )]; + svtools::ColorConfig aColorConfig; + switch (aAuthorIndex % 9) + { + case 0: + return aColorConfig.GetColorValue(svtools::AUTHOR1).nColor; + case 1: + return aColorConfig.GetColorValue(svtools::AUTHOR2).nColor; + case 2: + return aColorConfig.GetColorValue(svtools::AUTHOR3).nColor; + case 3: + return aColorConfig.GetColorValue(svtools::AUTHOR4).nColor; + case 4: + return aColorConfig.GetColorValue(svtools::AUTHOR5).nColor; + case 5: + return aColorConfig.GetColorValue(svtools::AUTHOR6).nColor; + case 6: + return aColorConfig.GetColorValue(svtools::AUTHOR7).nColor; + case 7: + return aColorConfig.GetColorValue(svtools::AUTHOR8).nColor; + case 8: + return aColorConfig.GetColorValue(svtools::AUTHOR9).nColor; + } } - else - return COL_WHITE; + + return COL_WHITE; } Color SwPostItMgr::GetColorLight(std::size_t aAuthorIndex) { - if (!Application::GetSettings().GetStyleSettings().GetHighContrastMode()) - { - static const Color aArrayLight[] = { - COL_AUTHOR1_LIGHT, COL_AUTHOR2_LIGHT, COL_AUTHOR3_LIGHT, - COL_AUTHOR4_LIGHT, COL_AUTHOR5_LIGHT, COL_AUTHOR6_LIGHT, - COL_AUTHOR7_LIGHT, COL_AUTHOR8_LIGHT, COL_AUTHOR9_LIGHT }; - - return aArrayLight[ aAuthorIndex % SAL_N_ELEMENTS( aArrayLight )]; - } + Color aColor = GetColorDark(aAuthorIndex); + if (MiscSettings::GetUseDarkMode()) + aColor.IncreaseLuminance(30); else - return COL_WHITE; + aColor.DecreaseLuminance(30); + return aColor; } Color SwPostItMgr::GetColorAnchor(std::size_t aAuthorIndex) { - if (!Application::GetSettings().GetStyleSettings().GetHighContrastMode()) - { - static const Color aArrayAnchor[] = { - COL_AUTHOR1_DARK, COL_AUTHOR2_DARK, COL_AUTHOR3_DARK, - COL_AUTHOR4_DARK, COL_AUTHOR5_DARK, COL_AUTHOR6_DARK, - COL_AUTHOR7_DARK, COL_AUTHOR8_DARK, COL_AUTHOR9_DARK }; - - return aArrayAnchor[ aAuthorIndex % SAL_N_ELEMENTS( aArrayAnchor )]; - } + Color aColor = GetColorDark(aAuthorIndex); + if (aColor.IsDark()) + aColor.IncreaseLuminance(80); else - return COL_WHITE; + aColor.DecreaseLuminance(80); + return aColor; } void SwPostItMgr::SetActiveSidebarWin( SwAnnotationWin* p) @@ -2388,7 +2394,16 @@ void SwPostItMgr::CheckMetaText() for (auto const& postItField : mvPostItFields) if ( postItField->mpPostIt ) postItField->mpPostIt->CheckMetaText(); +} +void SwPostItMgr::UpdateColors() +{ + for (auto const& postItField : mvPostItFields) + if ( postItField->mpPostIt ) + { + postItField->mpPostIt->UpdateColors(); + postItField->mpPostIt->Invalidate(); + } } sal_uInt16 SwPostItMgr::Replace(SvxSearchItem const * pItem)