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 0036a8c05cd160c66121a5c630cfadcb2cfec54a
Author:     Gülşah Köse <gulsah.k...@collabora.com>
AuthorDate: Fri Jul 5 15:00:05 2024 +0300
Commit:     Gülşah Köse <gulsah.k...@collabora.com>
CommitDate: Tue Sep 3 08:12:54 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>
    (cherry picked from commit 1ae9e6fc33bac1ba0ac49a61ca567965dc81a6d6)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172668
    Tested-by: Jenkins

diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index 26b79b17b63b..59b1d2bf18a4 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -184,6 +184,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 40acbca390af..8eb9261b52ca 100644
--- a/sc/source/core/tool/editutil.cxx
+++ b/sc/source/core/tool/editutil.cxx
@@ -243,7 +243,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 ce3704db8246..7a0db5dc45c7 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -897,6 +897,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