cui/inc/strings.hrc                                        |    1 
 cui/source/options/optcolor.cxx                            |   36 +
 cui/source/options/optcolor.hxx                            |    3 
 cui/uiconfig/ui/optappearancepage.ui                       |  220 ++++-----
 include/vcl/settings.hxx                                   |    3 
 officecfg/registry/data/org/openoffice/Office/UI.xcu       |  303 -------------
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |   25 +
 sc/inc/viewopti.hxx                                        |    2 
 sc/source/ui/view/gridwin4.cxx                             |    2 
 svtools/source/config/colorcfg.cxx                         |  121 ++---
 sw/qa/extras/tiledrendering/tiledrendering.cxx             |   20 
 sw/source/uibase/uno/unotxdoc.cxx                          |    2 
 vcl/source/app/settings.cxx                                |   12 
 13 files changed, 261 insertions(+), 489 deletions(-)

New commits:
commit 5675937f7564fa5614f7be5aec0d7f20ba91d02c
Author:     Heiko Tietze <tietze.he...@gmail.com>
AuthorDate: Fri Mar 17 16:10:39 2023 +0100
Commit:     Heiko Tietze <heiko.tie...@documentfoundation.org>
CommitDate: Wed Mar 29 10:34:27 2023 +0000

    Resolves tdf#152184 - Application color should follow system color
    
    This patch reverts the previously added "LibreOffice Dark" application 
color set and adds it to the automatic colors. Switching between light and dark 
changes the Automatic color accordingly instead switching to another color 
scheme. The added System Theme option makes Light/Dark follow the actual OS 
appearance.
    
    Reverts 6dfc49bb6a72bf6bb79167b12f0d2d0c5a155d06 (Introduce dark color set),
    546ad5d17d3e363b75337c336cfb2b2f8acc55e3 (color scheme translatable),
    9f0cf00d29298ed55737928ec4dddc50ac850cd8 (Update view options string based 
on theme)
    
    Change-Id: Ibf491f2e510fac5f1d27a7166560c4ec281d98d7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149059
    Tested-by: Jenkins
    Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org>

diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc
index 0cd2d2cd4566..498e60e75bc2 100644
--- a/cui/inc/strings.hrc
+++ b/cui/inc/strings.hrc
@@ -408,6 +408,5 @@
 
 // Translatable names of color schemes
 #define RID_COLOR_SCHEME_LIBREOFFICE_AUTOMATIC      
NC_("RID_COLOR_SCHEME_LIBREOFFICE_AUTOMATIC", "Automatic")
-#define RID_COLOR_SCHEME_LIBREOFFICE_DARK           
NC_("RID_COLOR_SCHEME_LIBREOFFICE_DARK", "Dark")
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
index 4ad5d2b5e93f..15d3dadcf244 100644
--- a/cui/source/options/optcolor.cxx
+++ b/cui/source/options/optcolor.cxx
@@ -34,7 +34,8 @@
 #include <dialmgr.hxx>
 #include "optcolor.hxx"
 #include <strings.hrc>
-
+#include <svtools/miscopt.hxx>
+#include <officecfg/Office/Common.hxx>
 using namespace ::com::sun::star;
 using namespace ::svtools;
 
@@ -165,7 +166,6 @@ const std::map<OUString, OUString> &getColorSchemes()
 {
     static std::map<OUString, OUString> const vColorSchemes = {
         {"COLOR_SCHEME_LIBREOFFICE_AUTOMATIC", 
CuiResId(RID_COLOR_SCHEME_LIBREOFFICE_AUTOMATIC)},
-        {"COLOR_SCHEME_LIBREOFFICE_DARK",      
CuiResId(RID_COLOR_SCHEME_LIBREOFFICE_DARK)}
     };
     return vColorSchemes;
 };
@@ -204,6 +204,7 @@ public:
                   Link<weld::Widget&,void> const&,
                   weld::ScrolledWindow& rScroll);
     void Update(EditableColorConfig const*, EditableExtendedColorConfig 
const*);
+    void UpdateEntries();
     void ClickHdl(EditableColorConfig*, const weld::Toggleable&);
     void ColorHdl(EditableColorConfig*, EditableExtendedColorConfig*, const 
ColorListBox*);
 
@@ -528,6 +529,16 @@ void ColorConfigWindow_Impl::Update (
     }
 }
 
+void ColorConfigWindow_Impl::UpdateEntries()
+{
+    for (unsigned i = 0; i != ColorConfigEntryCount; ++i)
+    {
+        ColorConfigEntry const aEntry = static_cast<ColorConfigEntry>(i);
+        Color aColor = ColorConfig::GetDefaultColor(aEntry);
+        vEntries[i]->m_xColorList->SetAutoDisplayColor(aColor);
+    }
+}
+
 // ClickHdl()
 void ColorConfigWindow_Impl::ClickHdl(EditableColorConfig* pConfig, const 
weld::Toggleable& rBox)
 {
@@ -627,6 +638,7 @@ public:
     void SetConfig (EditableColorConfig& rConfig) { pColorConfig = &rConfig; }
     void SetExtendedConfig (EditableExtendedColorConfig& rConfig) { 
pExtColorConfig = &rConfig; }
     void Update();
+    void UpdateEntries();
     tools::Long GetScrollPosition() const
     {
         return m_xVScroll->vadjustment_get_value();
@@ -670,6 +682,11 @@ void ColorConfigCtrl_Impl::Update ()
     m_xScrollWindow->Update(pColorConfig, pExtColorConfig);
 }
 
+void ColorConfigCtrl_Impl::UpdateEntries()
+{
+    m_xScrollWindow->UpdateEntries();
+}
+
 IMPL_LINK(ColorConfigCtrl_Impl, ClickHdl, weld::Toggleable&, rBox, void)
 {
     DBG_ASSERT(pColorConfig, "Configuration not set");
@@ -726,6 +743,7 @@ 
SvxColorOptionsTabPage::SvxColorOptionsTabPage(weld::Container* pPage, weld::Dia
     : SfxTabPage(pPage, pController, "cui/ui/optappearancepage.ui", 
"OptAppearancePage", &rCoreSet)
     , bFillItemSetCalled(false)
     , m_nSizeAllocEventId(nullptr)
+    , m_xAutoColorLB(m_xBuilder->weld_combo_box("autocolorlb"))
     , m_xColorSchemeLB(m_xBuilder->weld_combo_box("colorschemelb"))
     , m_xSaveSchemePB(m_xBuilder->weld_button("save"))
     , m_xDeleteSchemePB(m_xBuilder->weld_button("delete"))
@@ -738,6 +756,7 @@ 
SvxColorOptionsTabPage::SvxColorOptionsTabPage(weld::Container* pPage, weld::Dia
 {
     m_xColorSchemeLB->make_sorted();
     m_xColorSchemeLB->connect_changed(LINK(this, SvxColorOptionsTabPage, 
SchemeChangedHdl_Impl));
+    m_xAutoColorLB->connect_changed(LINK(this, SvxColorOptionsTabPage, 
onAutoColorChanged));
     Link<weld::Button&,void> aLk = LINK(this, SvxColorOptionsTabPage, 
SaveDeleteHdl_Impl );
     m_xSaveSchemePB->connect_clicked(aLk);
     m_xDeleteSchemePB->connect_clicked(aLk);
@@ -812,6 +831,8 @@ void SvxColorOptionsTabPage::Reset( const SfxItemSet* )
     pExtColorConfig.reset(new EditableExtendedColorConfig);
     m_xColorConfigCT->SetExtendedConfig(*pExtColorConfig);
 
+    m_xAutoColorLB->set_active( MiscSettings::GetAppColorMode() );
+
     OUString sUser = GetUserData();
     //has to be called always to speed up accessibility tools
     m_xColorConfigCT->SetScrollPosition(sUser.toInt32());
@@ -838,6 +859,17 @@ void SvxColorOptionsTabPage::UpdateColorConfig()
     m_xColorConfigCT->Update();
 }
 
+IMPL_LINK_NOARG(SvxColorOptionsTabPage, onAutoColorChanged, weld::ComboBox&, 
void)
+{
+    MiscSettings::SetAppColorMode( m_xAutoColorLB->get_active() );
+
+    m_xColorConfigCT->UpdateEntries();
+
+    
pColorConfig->LoadScheme(lcl_TranslatedNameToSchemeId(m_xColorSchemeLB->get_active_text()));
+    
pExtColorConfig->LoadScheme(lcl_TranslatedNameToSchemeId(m_xColorSchemeLB->get_active_text()));
+    UpdateColorConfig();
+}
+
 IMPL_LINK(SvxColorOptionsTabPage, SchemeChangedHdl_Impl, weld::ComboBox&, 
rBox, void)
 {
     
pColorConfig->LoadScheme(lcl_TranslatedNameToSchemeId(rBox.get_active_text()));
diff --git a/cui/source/options/optcolor.hxx b/cui/source/options/optcolor.hxx
index 0fa8cf2c46ea..096ed93b256d 100644
--- a/cui/source/options/optcolor.hxx
+++ b/cui/source/options/optcolor.hxx
@@ -31,6 +31,7 @@ class SvxColorOptionsTabPage : public SfxTabPage
 
     ImplSVEvent* m_nSizeAllocEventId;
 
+    std::unique_ptr<weld::ComboBox> m_xAutoColorLB;
     std::unique_ptr<weld::ComboBox> m_xColorSchemeLB;
     std::unique_ptr<weld::Button> m_xSaveSchemePB;
     std::unique_ptr<weld::Button> m_xDeleteSchemePB;
@@ -38,6 +39,7 @@ class SvxColorOptionsTabPage : public SfxTabPage
     std::unique_ptr<weld::Widget> m_xTable;
     std::unique_ptr<weld::Label> m_xOnFT;
     std::unique_ptr<weld::Label> m_xColorFT;
+
     weld::Widget& m_rWidget1;
     weld::Widget& m_rWidget2;
 
@@ -45,6 +47,7 @@ class SvxColorOptionsTabPage : public SfxTabPage
     std::unique_ptr<svtools::EditableExtendedColorConfig> pExtColorConfig;
 
     DECL_LINK(SchemeChangedHdl_Impl, weld::ComboBox&, void);
+    DECL_LINK(onAutoColorChanged, weld::ComboBox&, void);
     DECL_LINK(SaveDeleteHdl_Impl, weld::Button&, void);
     DECL_LINK(CheckNameHdl_Impl, AbstractSvxNameDialog&, bool);
     DECL_LINK(AdjustHeaderBar, const Size&, void);
diff --git a/cui/uiconfig/ui/optappearancepage.ui 
b/cui/uiconfig/ui/optappearancepage.ui
index 64c338ba978f..63916d36543f 100644
--- a/cui/uiconfig/ui/optappearancepage.ui
+++ b/cui/uiconfig/ui/optappearancepage.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.38.2 -->
+<!-- Generated with glade 3.40.0 -->
 <interface domain="cui">
   <requires lib="gtk+" version="3.20"/>
   <object class="GtkBox" id="OptAppearancePage">
@@ -10,106 +10,6 @@
     <property name="border-width">6</property>
     <property name="orientation">vertical</property>
     <property name="spacing">12</property>
-    <child>
-      <object class="GtkFrame" id="frame1">
-        <property name="visible">True</property>
-        <property name="can-focus">False</property>
-        <property name="hexpand">True</property>
-        <property name="label-xalign">0</property>
-        <property name="shadow-type">none</property>
-        <child>
-          <!-- n-columns=4 n-rows=1 -->
-          <object class="GtkGrid" id="grid1">
-            <property name="visible">True</property>
-            <property name="can-focus">False</property>
-            <property name="margin-start">12</property>
-            <property name="margin-top">6</property>
-            <property name="hexpand">True</property>
-            <property name="column-spacing">12</property>
-            <child>
-              <object class="GtkLabel" id="label3">
-                <property name="visible">True</property>
-                <property name="can-focus">False</property>
-                <property name="label" translatable="yes" 
context="optappearancepage|label3">_Scheme:</property>
-                <property name="use-underline">True</property>
-                <property name="mnemonic-widget">colorschemelb</property>
-              </object>
-              <packing>
-                <property name="left-attach">0</property>
-                <property name="top-attach">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="save">
-                <property name="label" translatable="yes" 
context="optappearancepage|save">_Save</property>
-                <property name="visible">True</property>
-                <property name="can-focus">True</property>
-                <property name="receives-default">True</property>
-                <property name="use-underline">True</property>
-                <child internal-child="accessible">
-                  <object class="AtkObject" id="save-atkobject">
-                    <property name="AtkObject::accessible-description" 
translatable="yes" context="extended_tip|save">Saves the current settings as a 
color scheme that you can reload later.</property>
-                  </object>
-                </child>
-              </object>
-              <packing>
-                <property name="left-attach">2</property>
-                <property name="top-attach">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="delete">
-                <property name="label" translatable="yes" 
context="stock">_Delete</property>
-                <property name="visible">True</property>
-                <property name="can-focus">True</property>
-                <property name="receives-default">True</property>
-                <property name="use-underline">True</property>
-                <child internal-child="accessible">
-                  <object class="AtkObject" id="delete-atkobject">
-                    <property name="AtkObject::accessible-description" 
translatable="yes" context="extended_tip|delete">Deletes the color scheme shown 
in the Scheme box. You cannot delete the Default scheme.</property>
-                  </object>
-                </child>
-              </object>
-              <packing>
-                <property name="left-attach">3</property>
-                <property name="top-attach">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkComboBoxText" id="colorschemelb">
-                <property name="visible">True</property>
-                <property name="can-focus">False</property>
-                <property name="hexpand">True</property>
-                <child internal-child="accessible">
-                  <object class="AtkObject" id="colorschemelb-atkobject">
-                    <property name="AtkObject::accessible-description" 
translatable="yes" context="extended_tip|colorschemelb">Selects the color 
scheme you want to use.</property>
-                  </object>
-                </child>
-              </object>
-              <packing>
-                <property name="left-attach">1</property>
-                <property name="top-attach">0</property>
-              </packing>
-            </child>
-          </object>
-        </child>
-        <child type="label">
-          <object class="GtkLabel" id="label1">
-            <property name="visible">True</property>
-            <property name="can-focus">False</property>
-            <property name="label" translatable="yes" 
context="optappearancepage|label1">Color Scheme</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">0</property>
-      </packing>
-    </child>
     <child>
       <object class="GtkFrame" id="frame2">
         <property name="visible">True</property>
@@ -119,9 +19,10 @@
         <property name="label-xalign">0</property>
         <property name="shadow-type">none</property>
         <child>
-          <!-- n-columns=1 n-rows=2 -->
+          <!-- n-columns=1 n-rows=3 -->
           <object class="GtkGrid" id="table">
             <property name="visible">True</property>
+            <property name="sensitive">False</property>
             <property name="can-focus">False</property>
             <property name="margin-start">12</property>
             <property name="margin-top">6</property>
@@ -179,7 +80,7 @@
               </object>
               <packing>
                 <property name="left-attach">0</property>
-                <property name="top-attach">1</property>
+                <property name="top-attach">2</property>
               </packing>
             </child>
             <child>
@@ -187,6 +88,7 @@
               <object class="GtkGrid" id="grid3">
                 <property name="visible">True</property>
                 <property name="can-focus">False</property>
+                <property name="margin-top">6</property>
                 <property name="hexpand">True</property>
                 <property name="column-spacing">6</property>
                 <child>
@@ -228,6 +130,116 @@
                   </packing>
                 </child>
               </object>
+              <packing>
+                <property name="left-attach">0</property>
+                <property name="top-attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <!-- n-columns=6 n-rows=1 -->
+              <object class="GtkGrid" id="grid1">
+                <property name="visible">True</property>
+                <property name="can-focus">False</property>
+                <property name="margin-start">12</property>
+                <property name="margin-top">6</property>
+                <property name="hexpand">True</property>
+                <property name="column-spacing">6</property>
+                <child>
+                  <object class="GtkLabel" id="label3">
+                    <property name="visible">True</property>
+                    <property name="can-focus">False</property>
+                    <property name="label" translatable="yes" 
context="optappearancepage|label3">_Scheme:</property>
+                    <property name="use-underline">True</property>
+                    <property name="mnemonic-widget">colorschemelb</property>
+                  </object>
+                  <packing>
+                    <property name="left-attach">0</property>
+                    <property name="top-attach">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="save">
+                    <property name="label" translatable="yes" 
context="optappearancepage|save">_Save</property>
+                    <property name="visible">True</property>
+                    <property name="can-focus">True</property>
+                    <property name="receives-default">True</property>
+                    <property name="use-underline">True</property>
+                    <child internal-child="accessible">
+                      <object class="AtkObject" id="save-atkobject">
+                        <property name="AtkObject::accessible-description" 
translatable="yes" context="extended_tip|save">Saves the current settings as a 
color scheme that you can reload later.</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left-attach">2</property>
+                    <property name="top-attach">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="delete">
+                    <property name="label" translatable="yes" 
context="stock">_Delete</property>
+                    <property name="visible">True</property>
+                    <property name="can-focus">True</property>
+                    <property name="receives-default">True</property>
+                    <property name="use-underline">True</property>
+                    <child internal-child="accessible">
+                      <object class="AtkObject" id="delete-atkobject">
+                        <property name="AtkObject::accessible-description" 
translatable="yes" context="extended_tip|delete">Deletes the color scheme shown 
in the Scheme box. You cannot delete the Default scheme.</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left-attach">3</property>
+                    <property name="top-attach">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkComboBoxText" id="colorschemelb">
+                    <property name="visible">True</property>
+                    <property name="can-focus">False</property>
+                    <property name="hexpand">True</property>
+                    <child internal-child="accessible">
+                      <object class="AtkObject" id="colorschemelb-atkobject">
+                        <property name="AtkObject::accessible-description" 
translatable="yes" context="extended_tip|colorschemelb">Selects the color 
scheme you want to use.</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left-attach">1</property>
+                    <property name="top-attach">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="autocolor">
+                    <property name="visible">True</property>
+                    <property name="can-focus">False</property>
+                    <property name="margin-start">12</property>
+                    <property name="label" translatable="yes" 
context="optappearancepage|autocolor">_Automatic:</property>
+                    <property name="use-underline">True</property>
+                    <property name="mnemonic-widget">autocolorlb</property>
+                  </object>
+                  <packing>
+                    <property name="left-attach">4</property>
+                    <property name="top-attach">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkComboBoxText" id="autocolorlb">
+                    <property name="visible">True</property>
+                    <property name="can-focus">False</property>
+                    <property name="active">1</property>
+                    <items>
+                      <item id="0" translatable="yes" 
context="optappearancepage|cbSchemeEntry1">System Theme</item>
+                      <item id="1" translatable="yes" 
context="optappearancepage|cbSchemeEntry2">Light</item>
+                      <item id="2" translatable="yes" 
context="optappearancepage|cbSchemeEntry3">Dark</item>
+                    </items>
+                  </object>
+                  <packing>
+                    <property name="left-attach">5</property>
+                    <property name="top-attach">0</property>
+                  </packing>
+                </child>
+              </object>
               <packing>
                 <property name="left-attach">0</property>
                 <property name="top-attach">0</property>
@@ -249,7 +261,7 @@
       <packing>
         <property name="expand">False</property>
         <property name="fill">True</property>
-        <property name="position">1</property>
+        <property name="position">0</property>
       </packing>
     </child>
     <child internal-child="accessible">
diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index de6a4b903c07..9292e10e45cf 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -648,7 +648,8 @@ public:
     // 0 auto, 1 light, 2, dark
     static void                     SetDarkMode(int nMode);
     static int                      GetDarkMode();
-
+    static void                     SetAppColorMode(int nMode);
+    static int                      GetAppColorMode();
     bool                            operator ==( const MiscSettings& rSet ) 
const;
     bool                            operator !=( const MiscSettings& rSet ) 
const;
 };
diff --git a/officecfg/registry/data/org/openoffice/Office/UI.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI.xcu
index b7d704d43f81..30e1811960c1 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI.xcu
@@ -440,309 +440,6 @@
           </prop>
         </node>
       </node>
-      <node oor:name="COLOR_SCHEME_LIBREOFFICE_DARK" oor:op="replace">
-        <node oor:name="DocColor">
-          <prop oor:name="Color">
-            <value>1842204</value>
-          </prop>
-        </node>
-        <node oor:name="DocBoundaries">
-          <prop oor:name="IsVisible">
-            <value>true</value>
-          </prop>
-          <prop oor:name="Color">
-            <value>8421504</value>
-          </prop>
-        </node>
-        <node oor:name="AppBackground">
-          <prop oor:name="Color">
-            <value>3355443</value>
-          </prop>
-        </node>
-        <node oor:name="ObjectBoundaries">
-          <prop oor:name="IsVisible">
-            <value>true</value>
-          </prop>
-          <prop oor:name="Color">
-            <value>8421504</value>
-          </prop>
-        </node>
-        <node oor:name="TableBoundaries">
-          <prop oor:name="IsVisible">
-            <value>true</value>
-          </prop>
-          <prop oor:name="Color">
-            <value>1842204</value>
-          </prop>
-        </node>
-        <node oor:name="FontColor">
-          <prop oor:name="Color">
-            <value xsi:nil="true"/>
-          </prop>
-        </node>
-        <node oor:name="Links">
-          <prop oor:name="IsVisible">
-            <value>false</value>
-          </prop>
-          <prop oor:name="Color">
-            <value>1939955</value>
-          </prop>
-        </node>
-        <node oor:name="LinksVisited">
-          <prop oor:name="IsVisible">
-            <value>false</value>
-          </prop>
-          <prop oor:name="Color">
-            <value>10181046</value>
-          </prop>
-        </node>
-        <node oor:name="Spell">
-          <prop oor:name="Color">
-            <value>13181214</value>
-          </prop>
-        </node>
-        <node oor:name="Grammar">
-          <prop oor:name="Color">
-            <value>7512015</value>
-          </prop>
-        </node>
-        <node oor:name="SmartTags">
-          <prop oor:name="Color">
-            <value>7865203</value>
-          </prop>
-        </node>
-        <node oor:name="Shadow">
-          <prop oor:name="IsVisible">
-            <value>true</value>
-          </prop>
-          <prop oor:name="Color">
-            <value>1842204</value>
-          </prop>
-        </node>
-        <node oor:name="WriterTextGrid">
-          <prop oor:name="Color">
-            <value>8421504</value>
-          </prop>
-        </node>
-        <node oor:name="WriterFieldShadings">
-          <prop oor:name="IsVisible">
-            <value>true</value>
-          </prop>
-          <prop oor:name="Color">
-            <value xsi:nil="true"/>
-          </prop>
-        </node>
-        <node oor:name="WriterIdxShadings">
-          <prop oor:name="IsVisible">
-            <value>true</value>
-          </prop>
-          <prop oor:name="Color">
-            <value>1842204</value>
-          </prop>
-        </node>
-        <node oor:name="WriterDirectCursor">
-          <prop oor:name="IsVisible">
-            <value>true</value>
-          </prop>
-          <prop oor:name="Color">
-            <value xsi:nil="true"/>
-          </prop>
-        </node>
-        <node oor:name="WriterScriptIndicator">
-          <prop oor:name="Color">
-            <value>1993273</value>
-          </prop>
-        </node>
-        <node oor:name="WriterSectionBoundaries">
-          <prop oor:name="IsVisible">
-            <value>true</value>
-          </prop>
-          <prop oor:name="Color">
-            <value>6710886</value>
-          </prop>
-        </node>
-        <node oor:name="WriterHeaderFooterMark">
-          <prop oor:name="Color">
-            <value>11847644</value>
-          </prop>
-        </node>
-        <node oor:name="WriterPageBreaks">
-          <prop oor:name="Color">
-            <value>7512015</value>
-          </prop>
-        </node>
-        <node oor:name="HTMLSGML">
-          <prop oor:name="Color">
-            <value xsi:nil="true"/>
-          </prop>
-        </node>
-        <node oor:name="HTMLComment">
-          <prop oor:name="Color">
-            <value xsi:nil="true"/>
-          </prop>
-        </node>
-        <node oor:name="HTMLKeyword">
-          <prop oor:name="Color">
-            <value xsi:nil="true"/>
-          </prop>
-        </node>
-        <node oor:name="HTMLUnknown">
-          <prop oor:name="Color">
-            <value xsi:nil="true"/>
-          </prop>
-        </node>
-        <node oor:name="CalcGrid">
-          <prop oor:name="Color">
-            <value>6710886</value>
-          </prop>
-        </node>
-        <node oor:name="CalcPageBreak">
-          <prop oor:name="Color">
-            <value xsi:nil="true"/>
-          </prop>
-        </node>
-        <node oor:name="CalcPageBreakManual">
-          <prop oor:name="Color">
-            <value xsi:nil="true"/>
-          </prop>
-        </node>
-        <node oor:name="CalcPageBreakAutomatic">
-          <prop oor:name="Color">
-            <value xsi:nil="true"/>
-          </prop>
-        </node>
-        <node oor:name="CalcHiddenColRow">
-          <prop oor:name="IsVisible">
-            <value>false</value>
-          </prop>
-          <prop oor:name="Color">
-            <value xsi:nil="true"/>
-          </prop>
-        </node>
-        <node oor:name="CalcDetective">
-          <prop oor:name="Color">
-            <value>3494505</value>
-          </prop>
-        </node>
-        <node oor:name="CalcDetectiveError">
-          <prop oor:name="Color">
-            <value>13181214</value>
-          </prop>
-        </node>
-        <node oor:name="CalcReference">
-          <prop oor:name="Color">
-            <value>861141</value>
-          </prop>
-        </node>
-        <node oor:name="CalcNotesBackground">
-          <prop oor:name="Color">
-            <value>15245826</value>
-          </prop>
-        </node>
-        <node oor:name="CalcValue">
-          <prop oor:name="Color">
-            <value>7512015</value>
-          </prop>
-        </node>
-        <node oor:name="CalcFormula">
-          <prop oor:name="Color">
-            <value>7847013</value>
-          </prop>
-        </node>
-        <node oor:name="CalcText">
-          <prop oor:name="Color">
-            <value>15658734</value>
-          </prop>
-        </node>
-        <node oor:name="CalcProtectedBackground">
-          <prop oor:name="Color">
-            <value>1842204</value>
-          </prop>
-        </node>
-        <node oor:name="DrawGrid">
-          <prop oor:name="IsVisible">
-            <value>true</value>
-          </prop>
-          <prop oor:name="Color">
-            <value xsi:nil="true"/>
-          </prop>
-        </node>
-        <node oor:name="BASICEditor">
-          <prop oor:name="Color" oor:type="xs:int">
-            <value>1842204</value>
-          </prop>
-        </node>
-        <node oor:name="BASICIdentifier">
-          <prop oor:name="Color" oor:type="xs:int">
-            <value>14543051</value>
-          </prop>
-        </node>
-        <node oor:name="BASICComment">
-          <prop oor:name="Color" oor:type="xs:int">
-            <value>15658734</value>
-          </prop>
-        </node>
-        <node oor:name="BASICNumber">
-          <prop oor:name="Color" oor:type="xs:int">
-            <value>16754342</value>
-          </prop>
-        </node>
-        <node oor:name="BASICString">
-          <prop oor:name="Color" oor:type="xs:int">
-            <value>16754342</value>
-          </prop>
-        </node>
-        <node oor:name="BASICOperator">
-          <prop oor:name="Color" oor:type="xs:int">
-            <value>11847644</value>
-          </prop>
-        </node>
-        <node oor:name="BASICKeyword">
-          <prop oor:name="Color" oor:type="xs:int">
-            <value>11847644</value>
-          </prop>
-        </node>
-        <node oor:name="BASICError">
-          <prop oor:name="Color" oor:type="xs:int">
-            <value>16726072</value>
-          </prop>
-        </node>
-        <node oor:name="SQLIdentifier">
-          <prop oor:name="Color" oor:type="xs:int">
-            <value xsi:nil="true"/>
-          </prop>
-        </node>
-        <node oor:name="SQLNumber">
-          <prop oor:name="Color" oor:type="xs:int">
-            <value xsi:nil="true"/>
-          </prop>
-        </node>
-        <node oor:name="SQLString">
-          <prop oor:name="Color" oor:type="xs:int">
-            <value xsi:nil="true"/>
-          </prop>
-        </node>
-        <node oor:name="SQLOperator">
-          <prop oor:name="Color" oor:type="xs:int">
-            <value xsi:nil="true"/>
-          </prop>
-        </node>
-        <node oor:name="SQLKeyword">
-          <prop oor:name="Color" oor:type="xs:int">
-            <value xsi:nil="true"/>
-          </prop>
-        </node>
-        <node oor:name="SQLParameter">
-          <prop oor:name="Color" oor:type="xs:int">
-            <value xsi:nil="true"/>
-          </prop>
-        </node>
-        <node oor:name="SQLComment">
-          <prop oor:name="Color" oor:type="xs:int">
-            <value xsi:nil="true"/>
-          </prop>
-        </node>
-      </node>
     </node>
   </node>
 </oor:component-data>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 714fa8ccc485..6702c8499315 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5578,6 +5578,31 @@
         </constraints>
         <value>0</value>
       </prop>
+      <prop oor:name="ApplicationAppearance" oor:type="xs:short" 
oor:nillable="false">
+        <!-- UIHints: Tools  Options - General  View  [Section] Appearance -->
+        <info>
+          <desc>Specifies the application colors.</desc>
+          <label>Application Colors</label>
+        </info>
+        <constraints>
+          <enumeration oor:value="0">
+            <info>
+              <desc>Automatic, following the system settings</desc>
+            </info>
+          </enumeration>
+          <enumeration oor:value="1">
+            <info>
+              <desc>Light</desc>
+            </info>
+          </enumeration>
+          <enumeration oor:value="2">
+            <info>
+              <desc>Dark</desc>
+            </info>
+          </enumeration>
+        </constraints>
+        <value>1</value>
+      </prop>
       <prop oor:name="MaxOpenDocuments" oor:type="xs:int">
         <info>
           <desc>Determines the maximum count of documents, which are allowed to
diff --git a/sc/inc/viewopti.hxx b/sc/inc/viewopti.hxx
index b5a15f016e1b..cd641198753b 100644
--- a/sc/inc/viewopti.hxx
+++ b/sc/inc/viewopti.hxx
@@ -59,6 +59,8 @@ enum ScVObjType
 #define MAX_OPT             sal_uInt16(VOPT_CLIPMARKS)+1
 #define MAX_TYPE            sal_uInt16(VOBJ_TYPE_DRAW)+1
 
+// SC_STD_GRIDCOLOR is obsolete since tdf#152184 since GridColor == COL_AUTO
+// converts now to either light or dark but still used on options > view > 
visual aids
 #define SC_STD_GRIDCOLOR    COL_LIGHTGRAY
 
 // SvxGrid options with standard operators
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index d3d21f049e55..e4e8f1af3696 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -691,7 +691,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const 
ScTableInfo& rTableI
     tools::Long nScrY = aOutputData.nScrY;
 
     const svtools::ColorConfig& rColorCfg = pScMod->GetColorConfig();
-    Color aGridColor( rColorCfg.GetColorValue( svtools::CALCGRID, false 
).nColor );
+    Color aGridColor( rColorCfg.GetColorValue( svtools::CALCGRID ).nColor );
     if ( aGridColor == COL_TRANSPARENT )
     {
         //  use view options' grid color only if color config has "automatic" 
color
diff --git a/svtools/source/config/colorcfg.cxx 
b/svtools/source/config/colorcfg.cxx
index 359f55df45e1..8f8488feeefc 100644
--- a/svtools/source/config/colorcfg.cxx
+++ b/svtools/source/config/colorcfg.cxx
@@ -363,61 +363,65 @@ ColorConfig::~ColorConfig()
 
 Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry)
 {
-    static const Color aAutoColors[] =
+    enum ColorType { clLight = 0,
+                     clDark,
+                     nColorTypes };
+
+    static const Color cAutoColors[][nColorTypes] =
     {
-        COL_WHITE, // DOCCOLOR
-        COL_LIGHTGRAY, // DOCBOUNDARIES
-        Color(0xDFDFDE), // APPBACKGROUND
-        COL_LIGHTGRAY, // OBJECTBOUNDARIES
-        COL_LIGHTGRAY, // TABLEBOUNDARIES
-        COL_BLACK, // FONTCOLOR
-        COL_BLUE, // LINKS
-        Color(0x0000cc), // LINKSVISITED
-        COL_LIGHTRED, // SPELL
-        COL_LIGHTBLUE, // GRAMMAR
-        COL_LIGHTMAGENTA, // SMARTTAGS
-        COL_GRAY, // SHADOWCOLOR
-        COL_LIGHTGRAY, // WRITERTEXTGRID
-        COL_LIGHTGRAY, // WRITERFIELDSHADIN
-        COL_LIGHTGRAY, // WRITERIDXSHADINGS
-        COL_BLACK, // WRITERDIRECTCURSOR
-        COL_GREEN, //WRITERSCRIPTINDICATOR
-        COL_LIGHTGRAY, //WRITERSECTIONBOUNDARIES
-        Color(0x0369a3), //WRITERHEADERFOOTERMARK,
-        COL_BLUE, //WRITERPAGEBREAKS,
-        COL_LIGHTBLUE, // HTMLSGML
-        COL_LIGHTGREEN, // HTMLCOMMENT
-        COL_LIGHTRED, // HTMLKEYWORD
-        COL_GRAY, // HTMLUNKNOWN
-        COL_GRAY3, // CALCGRID
-        COL_BLUE, //CALCPAGEBREAK
-        Color(0x2300dc), //CALCPAGEBREAKMANUAL
-        COL_GRAY7, //CALCPAGEBREAKAUTOMATIC
-        Color(0x2300dc), //CALCHIDDENCOLROW
-        COL_LIGHTBLUE, // CALCDETECTIVE
-        COL_LIGHTRED, // CALCDETECTIVEERROR
-        Color(0xef0fff), // CALCREFERENCE
-        Color(0xffffc0), // CALCNOTESBACKGROUND
-        COL_LIGHTBLUE, // CALCVALUE
-        COL_GREEN, // CALCFORMULA
-        COL_BLACK, // CALCTEXT
-        COL_LIGHTGRAY, // CALCPROTECTEDBACKGROUND
-        COL_GRAY7, // DRAWGRID
-        COL_WHITE, // BASICEDITOR,
-        COL_GREEN, // BASICIDENTIFIER,
-        COL_GRAY, // BASICCOMMENT,
-        COL_LIGHTRED, // BASICNUMBER,
-        COL_LIGHTRED, // BASICSTRING,
-        COL_BLUE, // BASICOPERATOR,
-        COL_BLUE, // BASICKEYWORD,
-        COL_RED, //BASICERROR
-        Color(0x009900), // SQLIDENTIFIER
-        COL_BLACK, // SQLNUMBER
-        Color(0xCE7B00), // SQLSTRING
-        COL_BLACK, // SQLOPERATOR
-        Color(0x0000E6), // SQLKEYWORD
-        Color(0x259D9D), // SQLPARAMETER
-        COL_GRAY, // SQLCOMMENT
+        { COL_WHITE,        Color(0x1C1C1C) }, // DOCCOLOR
+        { COL_LIGHTGRAY,    Color(0x808080) }, // DOCBOUNDARIES
+        { Color(0xDFDFDE),  Color(0x333333) }, // APPBACKGROUND
+        { COL_LIGHTGRAY,    Color(0x808080) }, // OBJECTBOUNDARIES
+        { COL_LIGHTGRAY,    Color(0x1C1C1C) }, // TABLEBOUNDARIES
+        { COL_BLACK,        COL_BLACK       }, // FONTCOLOR
+        { COL_BLUE,         Color(0x1D99F3) }, // LINKS
+        { Color(0x0000cc),  Color(0x9B59B6) }, // LINKSVISITED
+        { COL_LIGHTRED,     Color(0xC9211E) }, // SPELL
+        { COL_LIGHTBLUE,    Color(0x729FCF) }, // GRAMMAR
+        { COL_LIGHTMAGENTA, Color(0x780373) }, // SMARTTAGS
+        { COL_GRAY,         Color(0x1C1C1C) }, // SHADOWCOLOR
+        { COL_LIGHTGRAY,    Color(0x808080) }, // WRITERTEXTGRID
+        { COL_LIGHTGRAY,    COL_LIGHTGRAY   }, // WRITERFIELDSHADING
+        { COL_LIGHTGRAY,    Color(0x1C1C1C) }, // WRITERIDXSHADINGS
+        { COL_BLACK,        COL_BLACK       }, // WRITERDIRECTCURSOR
+        { COL_GREEN,        Color(0x1E6A39) }, // WRITERSCRIPTINDICATOR
+        { COL_LIGHTGRAY,    Color(0x666666) }, // WRITERSECTIONBOUNDARIES
+        { Color(0x0369a3),  Color(0xB4C7DC) }, // WRITERHEADERFOOTERMARK
+        { COL_BLUE,         Color(0x729FCF) }, // WRITERPAGEBREAKS
+        { COL_LIGHTBLUE,    COL_LIGHTBLUE   }, // HTMLSGML
+        { COL_LIGHTGREEN,   COL_LIGHTGREEN  }, // HTMLCOMMENT
+        { COL_LIGHTRED,     COL_LIGHTRED    }, // HTMLKEYWORD
+        { COL_GRAY,         COL_GRAY        }, // HTMLUNKNOWN
+        { COL_GRAY3,        COL_GRAY7       }, // CALCGRID
+        { COL_BLUE,         COL_BLUE        }, // CALCPAGEBREAK
+        { Color(0x2300dc),  Color(0x2300DC) }, // CALCPAGEBREAKMANUAL
+        { COL_GRAY7,        COL_GRAY7       }, // CALCPAGEBREAKAUTOMATIC
+        { Color(0x2300dc),  Color(0x2300DC) }, // CALCHIDDENCOLROW
+        { COL_LIGHTBLUE,    Color(0x355269) }, // CALCDETECTIVE
+        { COL_LIGHTRED,     Color(0xC9211E) }, // CALCDETECTIVEERROR
+        { Color(0xef0fff),  Color(0x0D23D5) }, // CALCREFERENCE
+        { Color(0xffffc0),  Color(0xE8A202) }, // CALCNOTESBACKGROUND
+        { COL_LIGHTBLUE,    Color(0x729FCF) }, // CALCVALUE
+        { COL_GREEN,        Color(0x77BC65) }, // CALCFORMULA
+        { COL_BLACK,        Color(0xEEEEEE) }, // CALCTEXT
+        { COL_LIGHTGRAY,    Color(0x1C1C1C) }, // CALCPROTECTEDBACKGROUND
+        { COL_GRAY7,        COL_GRAY7       }, // DRAWGRID
+        { COL_WHITE,        Color(0x1C1C1C) }, // BASICEDITOR
+        { COL_GREEN,        Color(0xDDE8CB) }, // BASICIDENTIFIER
+        { COL_GRAY,         Color(0xEEEEEE) }, // BASICCOMMENT
+        { COL_LIGHTRED,     Color(0xFFA6A6) }, // BASICNUMBER
+        { COL_LIGHTRED,     Color(0xFFA6A6) }, // BASICSTRING
+        { COL_BLUE,         Color(0xB4C7DC) }, // BASICOPERATOR
+        { COL_BLUE,         Color(0xB4C7DC) }, // BASICKEYWORD
+        { COL_RED,          Color(0xFF3838) }, // BASICERROR
+        { Color(0x009900),  Color(0x009900) }, // SQLIDENTIFIER
+        { COL_BLACK,        COL_BLACK       }, // SQLNUMBER
+        { Color(0xCE7B00),  Color(0xCE7B00) }, // SQLSTRING
+        { COL_BLACK,        COL_BLACK       }, // SQLOPERATOR
+        { Color(0x0000E6),  Color(0x0000E6) }, // SQLKEYWORD
+        { Color(0x259D9D),  Color(0x259D9D) }, // SQLPARAMETER
+        { COL_GRAY,         COL_GRAY        }, // SQLCOMMENT
     };
     Color aRet;
     switch(eEntry)
@@ -435,7 +439,14 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry)
             break;
 
         default:
-            aRet = aAutoColors[eEntry];
+            int nAppMod;
+            switch (MiscSettings::GetAppColorMode()) {
+                case 0: nAppMod = clLight; break; // UseDarkMode() ? clDark : 
clLight; break;
+                case 1: nAppMod = clLight; break;
+                case 2: nAppMod = clDark; break;
+                default: nAppMod = clLight;
+            }
+            aRet = cAutoColors[eEntry][nAppMod];
     }
     // fdo#71511: if in a11y HC mode, do pull background color from theme
     if (Application::GetSettings().GetStyleSettings().GetHighContrastMode())
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 346023898c23..9f399cfc3452 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -1643,7 +1643,6 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testGetViewRenderState)
 
     // Create a second view
     SfxLokHelper::createView();
-    int nSecondViewId = SfxLokHelper::getView();
     ViewCallback aView2;
     {
         // Give the second view different options
@@ -1657,25 +1656,6 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testGetViewRenderState)
     // Switch back to the first view, and check that the options string is the 
same
     SfxLokHelper::setView(nFirstViewId);
     CPPUNIT_ASSERT_EQUAL(OString("PS"), pXTextDocument->getViewRenderState());
-
-    // Switch back to the second view, and change to dark mode
-    SfxLokHelper::setView(nSecondViewId);
-    {
-        SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc();
-        SwView* pView = pDoc->GetDocShell()->GetView();
-        uno::Reference<frame::XFrame> xFrame = 
pView->GetViewFrame().GetFrame().GetFrameInterface();
-        uno::Sequence<beans::PropertyValue> aPropertyValues = 
comphelper::InitPropertySequence(
-            {
-                { "NewTheme", 
uno::Any(OUString("COLOR_SCHEME_LIBREOFFICE_DARK")) },
-            }
-        );
-        comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, 
aPropertyValues);
-    }
-    CPPUNIT_ASSERT_EQUAL(OString("SD"), pXTextDocument->getViewRenderState());
-
-    // Switch back to the first view, and check that the options string is the 
same
-    SfxLokHelper::setView(nFirstViewId);
-    CPPUNIT_ASSERT_EQUAL(OString("PS"), pXTextDocument->getViewRenderState());
 }
 
 CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testSetViewGraphicSelection)
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 453c06741adb..e7eb52e81a21 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3414,8 +3414,6 @@ OString SwXTextDocument::getViewRenderState()
                 aState.append('P');
             if (pVOpt->IsOnlineSpell())
                 aState.append('S');
-            if (pVOpt->GetThemeName() == u"COLOR_SCHEME_LIBREOFFICE_DARK")
-                aState.append('D');
         }
     }
     return aState.makeStringAndClear();
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 4803fab81ce4..7981a2310c2f 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -2783,6 +2783,18 @@ void MiscSettings::SetDarkMode(int nMode)
     }
 }
 
+int MiscSettings::GetAppColorMode()
+{
+    return officecfg::Office::Common::Misc::ApplicationAppearance::get();
+}
+
+void MiscSettings::SetAppColorMode(int nMode)
+{
+    std::shared_ptr<comphelper::ConfigurationChanges> 
batch(comphelper::ConfigurationChanges::create());
+    officecfg::Office::Common::Misc::ApplicationAppearance::set(nMode, batch);
+    batch->commit();
+}
+
 HelpSettings::HelpSettings()
     : mxData(std::make_shared<ImplHelpData>())
 {

Reply via email to