sc/source/ui/unoobj/docuno.cxx | 11 +++++++++-- sd/source/ui/unoidl/unomodel.cxx | 10 ++++++++-- svtools/source/config/colorcfg.cxx | 4 ++-- sw/qa/extras/tiledrendering/tiledrendering.cxx | 8 +++++++- sw/source/uibase/uno/unotxdoc.cxx | 10 ++++++++-- 5 files changed, 34 insertions(+), 9 deletions(-)
New commits: commit ddfce993c3d833171b92980476b11c985fb7693d Author: Sahil Gautam <sahil.gautam.ext...@allotropia.de> AuthorDate: Tue Mar 18 16:51:03 2025 +0530 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Thu Mar 20 18:24:20 2025 +0100 tdf#165803 use COL_WHITE for DOCCOLOR for both light and dark modes LibreOffice since 1995 has used light as the default background color for slides and documents. 'LibreOffice Themes' broke this behaviour as it depends on the hardcoded color values for the document colors. if the desktop environment is in dark mode, a dark document color is used. this causes issues for the slides created pre themes as they were created with white slide background. issues like black text on black background. this is also concerning because DOCCOLOR is not saved with the document, so if someone creates slides/documents with DOCCOLOR in mind, they would be disappointed to see the difference. so the simplest solution to this problem would be to use white color for both light and dark modes. since we would be using COL_WHITE for DOCCOLOR after this patch, it would be best change CALCGRID as well, to use a lighter shade of grey in dark mode (which would match the document color changes) changing DOCCOLOR value to COL_WHITE for dark mode broke a sd_tiledrendering test it was using the DOCCOLOR to check if dark or light theme is being used. commented that test out for now (just for this patch). reworking themes ui and implementation details to simplify the feature. Change-Id: Ib1ff7f2ca14110270baa8d6790d76696fd268183 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183071 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> Reviewed-by: Sahil Gautam <sahil.gautam.ext...@allotropia.de> diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index f15a8c02bbe9..dc05cd55ee71 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -510,8 +510,15 @@ static OString getTabViewRenderState(ScTabViewShell& rTabViewShell) if (rTabViewShell.IsAutoSpell()) aState.append('S'); - if (rViewRenderingOptions.GetDocColor() == svtools::ColorConfig::GetDefaultColor(svtools::DOCCOLOR, 1)) - aState.append('D'); + + // NOTE: DOCCOLOR:dark was changed to COL_WHITE for 25.2.2, please read tdf#165803 for the reasons. + // TODO: Change-Id: Ib1ff7f2ca14110270baa8d6790d76696fd268183 (this patch) is a temporary fix for 25.2.2. + // looking for/working towards better solutions. + // + // document color canot be used to determine which theme is being used (light/dark), as they both use white + // document background color. + // if (rViewRenderingOptions.GetDocColor() == svtools::ColorConfig::GetDefaultColor(svtools::DOCCOLOR, 1)) + // aState.append('D'); aState.append(';'); diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index a2fff3370033..2fd2b79ea65d 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -3857,8 +3857,14 @@ OString SdXImpressDocument::getViewRenderState(SfxViewShell* pViewShell) const SdViewOptions& pVOpt = pView->GetViewOptions(); if (mpDoc->GetOnlineSpell()) aState.append('S'); - if (pVOpt.mnDocBackgroundColor == svtools::ColorConfig::GetDefaultColor(svtools::DOCCOLOR, 1)) - aState.append('D'); + // NOTE: DOCCOLOR:dark was changed to COL_WHITE for 25.2.2, please read tdf#165803 for the reasons. + // TODO: Change-Id: Ib1ff7f2ca14110270baa8d6790d76696fd268183 (this patch) is a temporary fix for 25.2.2. + // looking for/working towards better solutions + // + // document color canot be used to determine which theme is being used (light/dark), as they both use white + // document background color. + // if (pVOpt.mnDocBackgroundColor == svtools::ColorConfig::GetDefaultColor(svtools::DOCCOLOR, 1)) + // aState.append('D'); aState.append(';'); OString aThemeName = OUStringToOString(pVOpt.msColorSchemeName, RTL_TEXTENCODING_UTF8); diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx index c1a973af27a4..e0befa9d1cb1 100644 --- a/svtools/source/config/colorcfg.cxx +++ b/svtools/source/config/colorcfg.cxx @@ -611,7 +611,7 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry, int nMod) static const Color cAutoColors[][nColorTypes] = { - { COL_WHITE, Color(0x1C1C1C) }, // DOCCOLOR + { COL_WHITE, COL_WHITE }, // DOCCOLOR { COL_LIGHTGRAY, Color(0x808080) }, // DOCBOUNDARIES { Color(0xDFDFDE), Color(0x333333) }, // APPBACKGROUND { COL_LIGHTGRAY, Color(0x808080) }, // TABLEBOUNDARIES @@ -635,7 +635,7 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry, int nMod) { COL_LIGHTGREEN, COL_LIGHTGREEN }, // HTMLCOMMENT { COL_LIGHTRED, COL_LIGHTRED }, // HTMLKEYWORD { COL_GRAY, COL_GRAY }, // HTMLUNKNOWN - { COL_GRAY3, COL_GRAY7 }, // CALCGRID + { COL_GRAY3, COL_GRAY3 }, // CALCGRID { COL_LIGHTBLUE, COL_LIGHTBLUE }, // CALCCELLFOCUS { COL_BLUE, COL_BLUE }, // CALCPAGEBREAK { Color(0x2300dc), Color(0x2300DC) }, // CALCPAGEBREAKMANUAL diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 8b9387d2afb1..d6fa5ed7eaed 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -1396,7 +1396,13 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testThemeViewSeparation) // Test that changing the theme in one view doesn't change it in the other view CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testInvertBackgroundViewSeparation) { - Color aDarkColor(0x1c, 0x1c, 0x1c); + // NOTE: DOCCOLOR:dark was changed to COL_WHITE for 25.2.2, please read tdf#165803 for the reasons. + // TODO: Change-Id: Ib1ff7f2ca14110270baa8d6790d76696fd268183 (this patch) is a temporary fix for 25.2.2. + // looking for/working towards better solutions + // + // document color canot be used to determine which theme is being used (light/dark), as they both use white + // document background color. + Color aDarkColor(COL_WHITE); addDarkLightThemes(aDarkColor, COL_WHITE); SwXTextDocument* pXTextDocument = createDoc(); int nFirstViewId = SfxLokHelper::getView(); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 964a7983ee9d..a1d3aaa9d1d7 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3636,8 +3636,14 @@ OString SwXTextDocument::getViewRenderState(SfxViewShell* pViewShell) aState.append('P'); if (pVOpt->IsOnlineSpell()) aState.append('S'); - if (pVOpt->GetDocColor() == svtools::ColorConfig::GetDefaultColor(svtools::DOCCOLOR, 1)) - aState.append('D'); + // NOTE: DOCCOLOR:dark was changed to COL_WHITE for 25.2.2, please read tdf#165803 for the reasons. + // TODO: Change-Id: Ib1ff7f2ca14110270baa8d6790d76696fd268183 (this patch) is a temporary fix for 25.2.2. + // looking for/working towards better solutions. + // + // document color canot be used to determine which theme is being used (light/dark), as they both use white + // document background color. + // if (pVOpt->GetDocColor() == svtools::ColorConfig::GetDefaultColor(svtools::DOCCOLOR, 1)) + // aState.append('D'); if (pView->IsSpotlightParaStyles() || pView->IsSpotlightCharStyles()) {