cui/inc/strings.hrc                                    |    1 +
 cui/source/options/appearance.cxx                      |    1 +
 include/svtools/colorcfg.hxx                           |    2 ++
 officecfg/registry/data/org/openoffice/Office/UI.xcu   |   15 +++++++++++++++
 officecfg/registry/schema/org/openoffice/Office/UI.xcs |   10 ++++++++++
 svtools/source/config/colorcfg.cxx                     |    1 +
 sw/inc/viewopt.hxx                                     |    3 +++
 sw/source/core/layout/paintfrm.cxx                     |    3 +--
 sw/source/uibase/config/viewopt.cxx                    |    7 +++++++
 sw/source/uibase/inc/usrpref.hxx                       |    2 +-
 10 files changed, 42 insertions(+), 3 deletions(-)

New commits:
commit 9ebbdb3db96af8b07a85a907fe71697d62b8ea74
Author:     Tamás Zolnai <[email protected]>
AuthorDate: Thu Dec 11 07:45:59 2025 +0100
Commit:     Tamás Zolnai <[email protected]>
CommitDate: Tue Dec 16 10:14:25 2025 +0100

    tdf#169806: Add customizable color for baseline grid.
    
    Change-Id: I18e7d840f66287ba5d4c98e2a357b8c72ef072f2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195634
    Tested-by: Jenkins
    Reviewed-by: Tamás Zolnai <[email protected]>

diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc
index 09d731c62ce6..cd9b4610966b 100644
--- a/cui/inc/strings.hrc
+++ b/cui/inc/strings.hrc
@@ -472,6 +472,7 @@
 #define REG_SMARTTAGS                       NC_("REG_SMARTTAGS", "Smart tags")
 #define REG_SHADOW                          NC_("REG_SHADOW", "Shadows")
 #define REG_WRITERTEXTGRID                  NC_("REG_WRITERTEXTGRID", "Text 
grid")
+#define REG_WRITERBASELINEGRID              NC_("REG_WRITERBASELINEGRID", 
"Baseline grid")
 #define REG_WRITERFIELDSHADINGS             NC_("REG_WRITERFIELDSHADINGS", 
"Field shadings")
 #define REG_WRITERIDXSHADINGS               NC_("REG_WRITERIDXSHADINGS", 
"Index and table shadings")
 #define REG_WRITERDIRECTCURSOR              NC_("REG_WRITERDIRECTCURSOR", 
"Direct cursor")
diff --git a/cui/source/options/appearance.cxx 
b/cui/source/options/appearance.cxx
index fa3b39b14f58..9304ab269f52 100644
--- a/cui/source/options/appearance.cxx
+++ b/cui/source/options/appearance.cxx
@@ -739,6 +739,7 @@ void SvxAppearanceTabPage::FillItemsList()
             { SMARTTAGS, CuiResId(REG_SMARTTAGS) },
             { SHADOWCOLOR, CuiResId(REG_SHADOW) },
             { WRITERTEXTGRID, CuiResId(REG_WRITERTEXTGRID) },
+            { WRITERBASELINEGRID, CuiResId(REG_WRITERBASELINEGRID) },
             { WRITERFIELDSHADINGS, CuiResId(REG_WRITERFIELDSHADINGS) },
             { WRITERIDXSHADINGS, CuiResId(REG_WRITERIDXSHADINGS) },
             { WRITERDIRECTCURSOR, CuiResId(REG_WRITERDIRECTCURSOR) },
diff --git a/include/svtools/colorcfg.hxx b/include/svtools/colorcfg.hxx
index 8d11846ee03d..844554e15a65 100644
--- a/include/svtools/colorcfg.hxx
+++ b/include/svtools/colorcfg.hxx
@@ -40,6 +40,7 @@ enum ColorConfigEntry : int
     SMARTTAGS     ,
     SHADOWCOLOR         ,
     WRITERTEXTGRID      ,
+    WRITERBASELINEGRID  ,
     WRITERFIELDSHADINGS ,
     WRITERIDXSHADINGS         ,
     WRITERDIRECTCURSOR        , // unused
@@ -150,6 +151,7 @@ namespace {
         { std::u16string_view(u"SmartTags"), false },
         { std::u16string_view(u"Shadow"), true },
         { std::u16string_view(u"WriterTextGrid"), false },
+        { std::u16string_view(u"WriterBaselineGrid"), false },
         { std::u16string_view(u"WriterFieldShadings"), true },
         { std::u16string_view(u"WriterIdxShadings"), true },
         { std::u16string_view(u"WriterDirectCursor"), true },
diff --git a/officecfg/registry/data/org/openoffice/Office/UI.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI.xcu
index 6c0abca5d2c5..8c208731d0ac 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI.xcu
@@ -208,6 +208,11 @@
             <value xsi:nil="true"/>
           </prop>
         </node>
+        <node oor:name="WriterBaselineGrid">
+          <prop oor:name="Color">
+            <value xsi:nil="true"/>
+          </prop>
+        </node>
         <node oor:name="WriterFieldShadings">
           <prop oor:name="IsVisible">
             <value>true</value>
@@ -694,6 +699,11 @@
             <value xsi:nil="true"/>
           </prop>
         </node>
+        <node oor:name="WriterBaselineGrid">
+          <prop oor:name="Color">
+            <value xsi:nil="true"/>
+          </prop>
+        </node>
         <node oor:name="WriterFieldShadings">
           <prop oor:name="IsVisible">
             <value>true</value>
@@ -1180,6 +1190,11 @@
             <value xsi:nil="true"/>
           </prop>
         </node>
+        <node oor:name="WriterBaselineGrid">
+          <prop oor:name="Color">
+            <value xsi:nil="true"/>
+          </prop>
+        </node>
         <node oor:name="WriterFieldShadings">
           <prop oor:name="IsVisible">
             <value>true</value>
diff --git a/officecfg/registry/schema/org/openoffice/Office/UI.xcs 
b/officecfg/registry/schema/org/openoffice/Office/UI.xcs
index c6bdc3bf1e90..bb24d1aabc55 100644
--- a/officecfg/registry/schema/org/openoffice/Office/UI.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/UI.xcs
@@ -184,6 +184,16 @@
           </info>
         </prop>
       </group>
+      <group oor:name="WriterBaselineGrid">
+        <info>
+          <desc>Specifies the settings for the baseline grid in Writer.</desc>
+        </info>
+        <prop oor:name="Color" oor:type="xs:int">
+          <info>
+            <desc>Specifies the color for the baseline grid in Writer.</desc>
+          </info>
+        </prop>
+      </group>
       <group oor:name="WriterFieldShadings">
         <info>
           <desc>Specifies the settings for field shadings in Writer.</desc>
diff --git a/svtools/source/config/colorcfg.cxx 
b/svtools/source/config/colorcfg.cxx
index 7390433af451..6ef48f077e83 100644
--- a/svtools/source/config/colorcfg.cxx
+++ b/svtools/source/config/colorcfg.cxx
@@ -537,6 +537,7 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry, 
int nMod)
         { COL_LIGHTMAGENTA, Color(0x780373) }, // SMARTTAGS
         { COL_GRAY,         Color(0x1C1C1C) }, // SHADOWCOLOR
         { COL_GRAY7,        COL_GRAY7       }, // WRITERTEXTGRID
+        { COL_GRAY7,        COL_GRAY7       }, // WRITERBASELINEGRID
         { COL_LIGHTGRAY,    COL_LIGHTGRAY   }, // WRITERFIELDSHADING
         { COL_LIGHTGRAY,    Color(0x1C1C1C) }, // WRITERIDXSHADINGS
         { COL_BLACK,        COL_BLACK       }, // WRITERDIRECTCURSOR
diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx
index a4120b6369fc..ce7fd6eab68c 100644
--- a/sw/inc/viewopt.hxx
+++ b/sw/inc/viewopt.hxx
@@ -234,6 +234,7 @@ struct SwViewColors
             && m_aLinksColor == rOther.m_aLinksColor
             && m_aVisitedLinksColor == rOther.m_aVisitedLinksColor
             && m_aTextGridColor == rOther.m_aTextGridColor
+            && m_aBaselineGridColor == rOther.m_aBaselineGridColor
             && m_aSpellColor == rOther.m_aSpellColor
             && m_aGrammarColor == rOther.m_aGrammarColor
             && m_aSmarttagColor == rOther.m_aSmarttagColor
@@ -254,6 +255,7 @@ struct SwViewColors
     Color m_aLinksColor;
     Color m_aVisitedLinksColor;
     Color m_aTextGridColor;
+    Color m_aBaselineGridColor;
     Color m_aSpellColor;     // mark color of online spell checking
     Color m_aGrammarColor;
     Color m_aSmarttagColor;
@@ -906,6 +908,7 @@ public:
     const Color& GetLinksColor() const;
     const Color& GetVisitedLinksColor() const;
     const Color& GetTextGridColor() const;
+    const Color& GetBaselineGridColor() const;
     const Color& GetSpellColor() const;
     const Color& GetGrammarColor() const;
     const Color& GetSmarttagColor() const;
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index ae9a794fec55..f9812b76b2fa 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -6264,9 +6264,8 @@ void SwPageFrame::PaintBaselineGrid(OutputDevice& 
rOututDevice) const
     // Grid area starts at the first baseline position of the page.
     aGridArea.AddTop(nLineOffset);
 
-    const Color aGridColor(COL_BLACK);
     const Color aOriginalLineColor(rOututDevice.GetLineColor());
-    rOututDevice.SetLineColor(aGridColor);
+    rOututDevice.SetLineColor(pViewOption->GetBaselineGridColor());
 
     const tools::Long nLineWidth = aGridArea.Right() - aGridArea.Left();
     rOututDevice.DrawGrid(aGridArea.SVRect(), Size(nLineWidth, nLineHeight),
diff --git a/sw/source/uibase/config/viewopt.cxx 
b/sw/source/uibase/config/viewopt.cxx
index 6c106d8e35b6..5332a78509fe 100644
--- a/sw/source/uibase/config/viewopt.cxx
+++ b/sw/source/uibase/config/viewopt.cxx
@@ -53,6 +53,7 @@ SwViewColors::SwViewColors() :
     m_aLinksColor(COL_BLUE),
     m_aVisitedLinksColor(COL_RED),
     m_aTextGridColor(COL_LIGHTGRAY),
+    m_aBaselineGridColor(COL_GRAY7),
     m_aSpellColor(COL_LIGHTRED),
     m_aGrammarColor(COL_LIGHTBLUE),
     m_aSmarttagColor(COL_LIGHTMAGENTA),
@@ -97,6 +98,7 @@ SwViewColors::SwViewColors(const svtools::ColorConfig& 
rConfig)
         m_nAppearanceFlags |= ViewOptFlags::Shadow;
 
     m_aTextGridColor = rConfig.GetColorValue(svtools::WRITERTEXTGRID).nColor;
+    m_aBaselineGridColor = 
rConfig.GetColorValue(svtools::WRITERBASELINEGRID).nColor;
 
     m_aSpellColor = rConfig.GetColorValue(svtools::SPELL).nColor;
     m_aGrammarColor = rConfig.GetColorValue(svtools::GRAMMAR).nColor;
@@ -477,6 +479,11 @@ const Color& SwViewOption::GetTextGridColor() const
     return m_aColorConfig.m_aTextGridColor;
 }
 
+const Color& SwViewOption::GetBaselineGridColor() const
+{
+    return m_aColorConfig.m_aBaselineGridColor;
+}
+
 const Color& SwViewOption::GetSpellColor() const
 {
     return m_aColorConfig.m_aSpellColor;
diff --git a/sw/source/uibase/inc/usrpref.hxx b/sw/source/uibase/inc/usrpref.hxx
index 151fe774d108..08bb434dcaae 100644
--- a/sw/source/uibase/inc/usrpref.hxx
+++ b/sw/source/uibase/inc/usrpref.hxx
@@ -178,7 +178,7 @@ class SwMasterUsrPref : public SwViewOption
     SwCursorConfig      m_aCursorConfig;
     std::unique_ptr<SwWebColorConfig>   m_pWebColorConfig;
     SwFmtAidsAutoComplConfig m_aFmtAidsAutoComplConfig;
-    std::optional<SwBaselineGridConfig> m_aBaselineGridConfig; // Not 
available in web view
+    std::optional<SwBaselineGridConfig> m_aBaselineGridConfig; // Not 
available in web mode
 
 public:
     SwMasterUsrPref(bool bWeb);

Reply via email to