cui/source/options/optaccessibility.cxx                    |    7 ---
 cui/source/options/optaccessibility.hxx                    |    1 
 cui/uiconfig/ui/optaccessibilitypage.ui                    |   24 ----------
 officecfg/registry/data/org/openoffice/Setup.xcu           |    1 
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |   10 ----
 svtools/source/config/colorcfg.cxx                         |   18 +-------
 vcl/source/window/settings.cxx                             |   29 -------------
 vcl/win/window/salframe.cxx                                |    5 --
 8 files changed, 6 insertions(+), 89 deletions(-)

New commits:
commit 75fd3093ea748e35beca1f903e7828ad82f2372f
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Oct 14 20:17:05 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sat Oct 15 21:09:34 2022 +0200

    tdf#151522 drop Accessibility::AutoDetectSystemHC
    
    which doesn't preclude having a different option to force it
    on/off against the system HighContrast mode setting.
    
    Change-Id: Iab9f7f501ac5fd7bb865d07b30b6fad9f1f6809c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141386
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/cui/source/options/optaccessibility.cxx 
b/cui/source/options/optaccessibility.cxx
index a394ff955a4a..1f85254dae22 100644
--- a/cui/source/options/optaccessibility.cxx
+++ b/cui/source/options/optaccessibility.cxx
@@ -29,7 +29,6 @@ 
SvxAccessibilityOptionsTabPage::SvxAccessibilityOptionsTabPage(weld::Container*
     , 
m_xTextSelectionInReadonly(m_xBuilder->weld_check_button("textselinreadonly"))
     , m_xAnimatedGraphics(m_xBuilder->weld_check_button("animatedgraphics"))
     , m_xAnimatedTexts(m_xBuilder->weld_check_button("animatedtext"))
-    , m_xAutoDetectHC(m_xBuilder->weld_check_button("autodetecthc"))
     , m_xAutomaticFontColor(m_xBuilder->weld_check_button("autofontcolor"))
     , m_xPagePreviews(m_xBuilder->weld_check_button("systempagepreviewcolor"))
 {
@@ -61,8 +60,6 @@ bool SvxAccessibilityOptionsTabPage::FillItemSet( SfxItemSet* 
)
         
officecfg::Office::Common::Accessibility::IsAutomaticFontColor::set(m_xAutomaticFontColor->get_active(),
 batch);
     if ( 
!officecfg::Office::Common::Accessibility::IsSelectionInReadonly::isReadOnly() )
         
officecfg::Office::Common::Accessibility::IsSelectionInReadonly::set(m_xTextSelectionInReadonly->get_active(),
 batch);
-    if ( 
!officecfg::Office::Common::Accessibility::AutoDetectSystemHC::isReadOnly() )
-        
officecfg::Office::Common::Accessibility::AutoDetectSystemHC::set(m_xAutoDetectHC->get_active(),
 batch);
     batch->commit();
 
     AllSettings aAllSettings = Application::GetSettings();
@@ -99,10 +96,6 @@ void SvxAccessibilityOptionsTabPage::Reset( const 
SfxItemSet* )
     if( 
officecfg::Office::Common::Accessibility::IsSelectionInReadonly::isReadOnly() )
         m_xTextSelectionInReadonly->set_sensitive(false);
 
-    m_xAutoDetectHC->set_active( 
officecfg::Office::Common::Accessibility::AutoDetectSystemHC::get() );
-    if( 
officecfg::Office::Common::Accessibility::AutoDetectSystemHC::isReadOnly() )
-        m_xAutoDetectHC->set_sensitive(false);
-
     AllSettings aAllSettings = Application::GetSettings();
     const MiscSettings& aMiscSettings = aAllSettings.GetMiscSettings();
     m_xAccessibilityTool->set_active(aMiscSettings.GetEnableATToolSupport());
diff --git a/cui/source/options/optaccessibility.hxx 
b/cui/source/options/optaccessibility.hxx
index 35d5fdefde03..c53c17be1158 100644
--- a/cui/source/options/optaccessibility.hxx
+++ b/cui/source/options/optaccessibility.hxx
@@ -26,7 +26,6 @@ class SvxAccessibilityOptionsTabPage : public SfxTabPage
     std::unique_ptr<weld::CheckButton> m_xTextSelectionInReadonly;
     std::unique_ptr<weld::CheckButton> m_xAnimatedGraphics;
     std::unique_ptr<weld::CheckButton> m_xAnimatedTexts;
-    std::unique_ptr<weld::CheckButton> m_xAutoDetectHC;
     std::unique_ptr<weld::CheckButton> m_xAutomaticFontColor;
     std::unique_ptr<weld::CheckButton> m_xPagePreviews;
 
diff --git a/cui/uiconfig/ui/optaccessibilitypage.ui 
b/cui/uiconfig/ui/optaccessibilitypage.ui
index 43be59802974..2643000fd246 100644
--- a/cui/uiconfig/ui/optaccessibilitypage.ui
+++ b/cui/uiconfig/ui/optaccessibilitypage.ui
@@ -135,26 +135,6 @@
             <property name="margin-top">6</property>
             <property name="orientation">vertical</property>
             <property name="spacing">6</property>
-            <child>
-              <object class="GtkCheckButton" id="autodetecthc">
-                <property name="label" translatable="yes" 
context="optaccessibilitypage|autodetecthc">Automatically _detect high contrast 
mode of operating system</property>
-                <property name="visible">True</property>
-                <property name="can-focus">True</property>
-                <property name="receives-default">False</property>
-                <property name="use-underline">True</property>
-                <property name="draw-indicator">True</property>
-                <child internal-child="accessible">
-                  <object class="AtkObject" id="autodetecthc-atkobject">
-                    <property name="AtkObject::accessible-description" 
translatable="yes" context="extended_tip|autodetecthc">Switches the office 
suite into high contrast mode when the system background color is very 
dark.</property>
-                  </object>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
             <child>
               <object class="GtkCheckButton" id="autofontcolor">
                 <property name="label" translatable="yes" 
context="optaccessibilitypage|autofontcolor">Use automatic font _color for 
screen display</property>
@@ -172,7 +152,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>
@@ -192,7 +172,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">2</property>
+                <property name="position">1</property>
               </packing>
             </child>
           </object>
diff --git a/officecfg/registry/data/org/openoffice/Setup.xcu 
b/officecfg/registry/data/org/openoffice/Setup.xcu
index dacedf277f93..bc1a855e216c 100644
--- a/officecfg/registry/data/org/openoffice/Setup.xcu
+++ b/officecfg/registry/data/org/openoffice/Setup.xcu
@@ -863,7 +863,6 @@
                 <it>/org.openoffice.Office.Paths</it>
                 <it>/org.openoffice.Office.Recovery</it>
                 <it>/org.openoffice.Office.Common/Accessibility</it>
-                
<it>/org.openoffice.Office.Common/Accessibility/AutoDetectSystemHC</it>
                 <it>/org.openoffice.Office.Common/AsianLayout</it>
                 <it>/org.openoffice.Office.Common/AutoCorrect</it>
                 <it>/org.openoffice.Office.Common/Cache</it>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 235c5d2cd679..89adf15bd234 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -6188,16 +6188,6 @@
       <info>
         <desc>Specifies settings for the accessibility options.</desc>
       </info>
-      <prop oor:name="AutoDetectSystemHC" oor:type="xs:boolean" 
oor:nillable="false">
-        <info>
-          <desc>Enables the automatic detection of a high contrast mode set for
-          your desktop. Some OS' do not provide this option explicitly, but
-          allow the user to choose a color scheme that is HC-compliant
-          implicitly, which is recognized if the option is set.</desc>
-          <label>detect system's high contrast</label>
-        </info>
-        <value>false</value>
-      </prop>
       <prop oor:name="IsForPagePreviews" oor:type="xs:boolean" 
oor:nillable="false">
         <info>
           <desc>Enables the use of high contrast colors, instead of displaying
diff --git a/svtools/source/config/colorcfg.cxx 
b/svtools/source/config/colorcfg.cxx
index 48889833f716..b29c7e4b3562 100644
--- a/svtools/source/config/colorcfg.cxx
+++ b/svtools/source/config/colorcfg.cxx
@@ -66,7 +66,6 @@ class ColorConfig_Impl : public utl::ConfigItem
 {
     ColorConfigValue m_aConfigValues[ColorConfigEntryCount];
     OUString         m_sLoadedScheme;
-    bool             m_bAutoDetectSystemHC;
 
     virtual void                    ImplCommit() override;
 
@@ -94,7 +93,6 @@ public:
     using ConfigItem::SetModified;
     using ConfigItem::ClearModified;
     void                            SettingsChanged();
-    bool GetAutoDetectSystemHC() const {return m_bAutoDetectSystemHC;}
 
     DECL_LINK( DataChangedEventListener, VclSimpleEvent&, void );
 };
@@ -184,8 +182,7 @@ uno::Sequence< OUString> 
GetPropertyNames(std::u16string_view rScheme)
 }
 
 ColorConfig_Impl::ColorConfig_Impl() :
-    ConfigItem("Office.UI/ColorScheme"),
-    m_bAutoDetectSystemHC(true)
+    ConfigItem("Office.UI/ColorScheme")
 {
     //try to register on the root node - if possible
     uno::Sequence < OUString > aNames(1);
@@ -237,15 +234,6 @@ void ColorConfig_Impl::Load(const OUString& rScheme)
         if(pColorNames[nIndex].endsWith(g_sIsVisible))
              m_aConfigValues[i].bIsVisible = Any2Bool(pColors[nIndex++]);
     }
-    // fdo#71511: check if we are running in a11y autodetect
-    {
-        utl::OConfigurationNode aNode = 
utl::OConfigurationTreeRoot::tryCreateWithComponentContext(comphelper::getProcessComponentContext(),"org.openoffice.Office.Common/Accessibility"
 );
-        if(aNode.isValid())
-        {
-            uno::Any aValue = 
aNode.getNodeValue(OUString("AutoDetectSystemHC"));
-            aValue >>= m_bAutoDetectSystemHC;
-        }
-    }
 }
 
 void    ColorConfig_Impl::Notify( const uno::Sequence<OUString>& )
@@ -445,8 +433,8 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry)
         default:
             aRet = aAutoColors[eEntry];
     }
-    // fdo#71511: if in autodetected a11y HC mode, do pull background color 
from theme
-    if(m_pImpl &&  m_pImpl->GetAutoDetectSystemHC())
+    // fdo#71511: if in a11y HC mode, do pull background color from theme
+    if (Application::GetSettings().GetStyleSettings().GetHighContrastMode())
     {
         switch(eEntry)
         {
diff --git a/vcl/source/window/settings.cxx b/vcl/source/window/settings.cxx
index 11d863c98196..0f36ca84f852 100644
--- a/vcl/source/window/settings.cxx
+++ b/vcl/source/window/settings.cxx
@@ -221,35 +221,8 @@ void Window::ImplUpdateGlobalSettings( AllSettings& 
rSettings, bool bCallHdl ) c
 
     rSettings.SetStyleSettings( aStyleSettings );
 
-    bool bForceHCMode = false;
-
-    // auto detect HC mode; if the system already set it to "yes"
-    // (see above) then accept that
-    if (!rSettings.GetStyleSettings().GetHighContrastMode() && 
!utl::ConfigManager::IsFuzzing())
-    {
-        bool bAutoHCMode = true;
-        utl::OConfigurationNode aNode = 
utl::OConfigurationTreeRoot::tryCreateWithComponentContext(
-            comphelper::getProcessComponentContext(),
-            "org.openoffice.Office.Common/Accessibility" );    // note: case 
sensitive !
-        if ( aNode.isValid() )
-        {
-            css::uno::Any aValue = aNode.getNodeValue( "AutoDetectSystemHC" );
-            bool bTmp = false;
-            if( aValue >>= bTmp )
-                bAutoHCMode = bTmp;
-        }
-        if( bAutoHCMode )
-        {
-            if( rSettings.GetStyleSettings().GetFaceColor().IsDark() ||
-                rSettings.GetStyleSettings().GetWindowColor().IsDark() )
-                bForceHCMode = true;
-        }
-    }
-
     static const char* pEnvHC = getenv( "SAL_FORCE_HC" );
-    if( pEnvHC && *pEnvHC )
-        bForceHCMode = true;
-
+    const bool bForceHCMode = pEnvHC && *pEnvHC;
     if( bForceHCMode )
     {
         aStyleSettings = rSettings.GetStyleSettings();
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 9871eba67edd..1c31c5ad06a5 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2751,11 +2751,6 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings 
)
     pSVData->maNWFData.mnMenuFormatBorderY = 0;
     pSVData->maNWFData.maMenuBarHighlightTextColor = COL_TRANSPARENT;
     GetSalData()->mbThemeMenuSupport = false;
-    if (officecfg::Office::Common::Accessibility::AutoDetectSystemHC::get())
-    {
-        aStyleSettings.SetShadowColor( ImplWinColorToSal( GetSysColor( 
COLOR_ACTIVEBORDER ) ) );
-        aStyleSettings.SetWorkspaceColor( ImplWinColorToSal( GetSysColor( 
COLOR_MENU ) ) );
-    }
     aStyleSettings.SetMenuColor( ImplWinColorToSal( GetSysColor( COLOR_MENU ) 
) );
     aStyleSettings.SetMenuBarColor( aStyleSettings.GetMenuColor() );
     aStyleSettings.SetMenuBarRolloverColor( aStyleSettings.GetHighlightColor() 
);

Reply via email to