sc/inc/scmod.hxx                 |    1 +
 sc/source/core/tool/editutil.cxx |    4 ++++
 sc/source/ui/app/scmod.cxx       |   12 ++++++++++++
 3 files changed, 17 insertions(+)

New commits:
commit 1ae9e6fc33bac1ba0ac49a61ca567965dc81a6d6
Author:     Gülşah Köse <gulsah.k...@collabora.com>
AuthorDate: Fri Jul 5 15:00:05 2024 +0300
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Wed Aug 28 12:55:56 2024 +0200

    ONLINE: Fix multi user dark mode link color problem
    
    If one user change the theme to dark mode, other user's link color is
    changed to dark mode link color too. In this commit we prevent that
    problem.
    
    Signed-off-by: Gülşah Köse <gulsah.k...@collabora.com>
    Change-Id: I65838e106794d649c362cf181ca300045053f169
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169984
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index 18705e6189f0..5725c819bb7f 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -186,6 +186,7 @@ public:
     ScNavipiCfg&        GetNavipiCfg();
     ScAddInCfg&         GetAddInCfg();
     svtools::ColorConfig&   GetColorConfig();
+    static bool         IsLOKViewInDarkMode();
     SC_DLLPUBLIC SvtUserOptions& GetUserOptions();
 
     void                ModifyOptions( const SfxItemSet& rOptSet );
diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx
index 57e93d513866..c5fae033d270 100644
--- a/sc/source/core/tool/editutil.cxx
+++ b/sc/source/core/tool/editutil.cxx
@@ -241,7 +241,11 @@ OUString ScEditUtil::GetCellFieldValue(
                 INetURLHistory::GetOrCreate()->QueryUrl(aURL) ? 
svtools::LINKSVISITED : svtools::LINKS;
 
             if (ppTextColor)
+            {
                 *ppTextColor = 
SC_MOD()->GetColorConfig().GetColorValue(eEntry).nColor;
+                if (comphelper::LibreOfficeKit::isActive())
+                    ScModule::IsLOKViewInDarkMode() ? *ppTextColor = 
Color(0x1D99F3) : *ppTextColor = Color(0x000080);
+            }
 
             if (ppFldLineStyle)
                 *ppFldLineStyle = FontLineStyle::LINESTYLE_SINGLE;
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index d2005b0cc187..2dfdb0f0de5b 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -900,6 +900,18 @@ svtools::ColorConfig& ScModule::GetColorConfig()
     return *m_pColorConfig;
 }
 
+bool ScModule::IsLOKViewInDarkMode()
+{
+    SfxViewShell* pKitSh = comphelper::LibreOfficeKit::isActive() ? 
SfxViewShell::Current() : nullptr;
+    if( pKitSh )
+    {
+        Color aDocColor = pKitSh->GetColorConfigColor(svtools::DOCCOLOR);
+        if( aDocColor.IsDark() )
+            return true;
+    }
+    return false;
+}
+
 SvtUserOptions&  ScModule::GetUserOptions()
 {
     if( !m_pUserOptions )

Reply via email to