cui/source/options/optcolor.cxx | 1 cui/uiconfig/ui/colorconfigwin.ui | 35 ++++++++++++++++- include/svtools/colorcfg.hxx | 1 officecfg/registry/data/org/openoffice/Office/UI.xcu | 5 ++ officecfg/registry/schema/org/openoffice/Office/UI.xcs | 10 ++++ svtools/source/config/colorcfg.cxx | 2 sw/inc/viewopt.hxx | 3 + sw/qa/extras/tiledrendering/tiledrendering.cxx | 2 sw/source/core/inc/txtfrm.hxx | 2 sw/source/core/text/frmpaint.cxx | 4 - sw/source/core/text/inftxt.cxx | 6 +- sw/source/core/text/porexp.cxx | 2 sw/source/core/text/porrst.cxx | 4 - sw/source/core/text/txtfld.cxx | 2 sw/source/core/text/txthyph.cxx | 2 sw/source/core/txtnode/fntcache.cxx | 2 sw/source/uibase/config/viewopt.cxx | 9 ++++ 17 files changed, 77 insertions(+), 15 deletions(-)
New commits: commit aabb5be81a066c70142e9c15e64ebfbed9994e3c Author: Heiko Tietze <tietze.he...@gmail.com> AuthorDate: Tue Aug 13 12:48:24 2024 +0200 Commit: Heiko Tietze <heiko.tie...@documentfoundation.org> CommitDate: Wed Aug 14 09:24:29 2024 +0200 Resolves tdf#80054 - Customization for non-printable character color Change-Id: I82783a49d3a1c2096dcfa7c97a3fce14c555c988 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171814 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org> diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx index df3965b28199..4ccb305a17f9 100644 --- a/cui/source/options/optcolor.cxx +++ b/cui/source/options/optcolor.cxx @@ -127,6 +127,7 @@ const vEntryInfo[] = { Group_Writer, IDS_CB(section), std::u16string_view(u"/WriterSectionBoundaries") }, { Group_Writer, IDS(hdft), std::u16string_view(u"/WriterHeaderFooterMark") }, { Group_Writer, IDS(pagebreak), std::u16string_view(u"/WriterPageBreaks") }, + { Group_Writer, IDS(nonprintchars), std::u16string_view(u"/WriterNonPrintChars") }, { Group_Html, IDS(sgml), std::u16string_view(u"/HTMLSGML") }, { Group_Html, IDS(htmlcomment), std::u16string_view(u"/HTMLComment") }, diff --git a/cui/uiconfig/ui/colorconfigwin.ui b/cui/uiconfig/ui/colorconfigwin.ui index 8154d626a884..91243182fdb6 100644 --- a/cui/uiconfig/ui/colorconfigwin.ui +++ b/cui/uiconfig/ui/colorconfigwin.ui @@ -482,7 +482,7 @@ <property name="label-xalign">0</property> <property name="shadow-type">none</property> <child> - <!-- n-columns=2 n-rows=9 --> + <!-- n-columns=2 n-rows=10 --> <object class="GtkGrid"> <property name="visible">True</property> <property name="can-focus">False</property> @@ -821,6 +821,39 @@ <property name="top-attach">3</property> </packing> </child> + <child> + <object class="GtkLabel" id="nonprintchars"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="halign">start</property> + <property name="valign">center</property> + <property name="label" translatable="yes" context="colorconfigwin|nonprintchars">Non-printable characters</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">nonprintchars_lb</property> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">9</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="nonprintchars_lb"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="halign">end</property> + <property name="xalign">0</property> + <property name="draw-indicator">True</property> + <property name="label" translatable="no"></property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">9</property> + </packing> + </child> </object> </child> <child type="label"> diff --git a/include/svtools/colorcfg.hxx b/include/svtools/colorcfg.hxx index 72e3ae3a63e8..d49dec4db8f3 100644 --- a/include/svtools/colorcfg.hxx +++ b/include/svtools/colorcfg.hxx @@ -49,6 +49,7 @@ enum ColorConfigEntry : int WRITERSECTIONBOUNDARIES, WRITERHEADERFOOTERMARK, WRITERPAGEBREAKS, + WRITERNONPRINTCHARS, HTMLSGML , HTMLCOMMENT , HTMLKEYWORD , diff --git a/officecfg/registry/data/org/openoffice/Office/UI.xcu b/officecfg/registry/data/org/openoffice/Office/UI.xcu index 73c944ced65f..a99248c6b7fb 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI.xcu @@ -268,6 +268,11 @@ <value xsi:nil="true"/> </prop> </node> + <node oor:name="WriterNonPrintChars"> + <prop oor:name="Color"> + <value xsi:nil="true"/> + </prop> + </node> <node oor:name="HTMLSGML"> <prop oor:name="Color"> <value xsi:nil="true"/> diff --git a/officecfg/registry/schema/org/openoffice/Office/UI.xcs b/officecfg/registry/schema/org/openoffice/Office/UI.xcs index e7b62337aca9..80961a50c7a5 100644 --- a/officecfg/registry/schema/org/openoffice/Office/UI.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/UI.xcs @@ -300,6 +300,16 @@ </info> </prop> </group> + <group oor:name="WriterNonPrintChars"> + <info> + <desc>Specifies the settings for the non-printable characters in Writer.</desc> + </info> + <prop oor:name="Color" oor:type="xs:int"> + <info> + <desc>Specifies the color used for the non-printable characters.</desc> + </info> + </prop> + </group> <group oor:name="HTMLSGML"> <info> <desc>Specifies the settings used for SGML in HTML documents.</desc> diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx index b46c3d1a9d6e..8769cc1ba7f0 100644 --- a/svtools/source/config/colorcfg.cxx +++ b/svtools/source/config/colorcfg.cxx @@ -130,6 +130,7 @@ uno::Sequence< OUString> GetPropertyNames(std::u16string_view rScheme) { std::u16string_view(u"/WriterSectionBoundaries") ,true }, { std::u16string_view(u"/WriterHeaderFooterMark") ,false }, { std::u16string_view(u"/WriterPageBreaks") ,false }, + { std::u16string_view(u"/WriterNonPrintChars") ,false }, { std::u16string_view(u"/HTMLSGML") ,false }, { std::u16string_view(u"/HTMLComment") ,false }, { std::u16string_view(u"/HTMLKeyword") ,false }, @@ -420,6 +421,7 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry, int nMod) { COL_LIGHTGRAY, Color(0x666666) }, // WRITERSECTIONBOUNDARIES { Color(0x0369a3), Color(0xB4C7DC) }, // WRITERHEADERFOOTERMARK { COL_BLUE, Color(0x729FCF) }, // WRITERPAGEBREAKS + { Color(0x268BD2), Color(0x268BD2) }, // WRITERNONPRINTCHARS { COL_LIGHTBLUE, COL_LIGHTBLUE }, // HTMLSGML { COL_LIGHTGREEN, COL_LIGHTGREEN }, // HTMLCOMMENT { COL_LIGHTRED, COL_LIGHTRED }, // HTMLKEYWORD diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx index 4f34c7286d3b..8c51eb88bfbe 100644 --- a/sw/inc/viewopt.hxx +++ b/sw/inc/viewopt.hxx @@ -218,6 +218,7 @@ struct SwViewColors && m_aFieldShadingsColor == rOther.m_aFieldShadingsColor && m_aSectionBoundColor == rOther.m_aSectionBoundColor && m_aPageBreakColor == rOther.m_aPageBreakColor + && m_aNonPrintingCharacterColor == rOther.m_aNonPrintingCharacterColor && m_aScriptIndicatorColor == rOther.m_aScriptIndicatorColor && m_aShadowColor == rOther.m_aShadowColor && m_aHeaderFooterMarkColor == rOther.m_aHeaderFooterMarkColor @@ -239,6 +240,7 @@ struct SwViewColors Color m_aFieldShadingsColor; Color m_aSectionBoundColor; Color m_aPageBreakColor; + Color m_aNonPrintingCharacterColor; Color m_aScriptIndicatorColor; Color m_aShadowColor; Color m_aHeaderFooterMarkColor; @@ -848,6 +850,7 @@ public: const Color& GetFieldShadingsColor() const; const Color& GetSectionBoundColor() const; const Color& GetPageBreakColor() const; + const Color& GetNonPrintingCharacterColor() const; const Color& GetHeaderFooterMarkColor() const; bool IsAppearanceFlag(ViewOptFlags nFlag) const; diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index e7e309f67e50..cba5c265c864 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -3029,7 +3029,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testPilcrowRedlining) // if its color is not white, black or non-printing character color if ( aColor == aColor2 && aColor == aColor3 && aColor == aColor4 && aColor != COL_WHITE && aColor != COL_BLACK && - aColor != NON_PRINTING_CHARACTER_COLOR ) + aColor != Color(0x268BD2) ) { bHasRedlineColor = true; break; diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx index 4bd6bc0cd58c..42fa3c498724 100644 --- a/sw/source/core/inc/txtfrm.hxx +++ b/sw/source/core/inc/txtfrm.hxx @@ -54,8 +54,6 @@ class SwWrtShell; class SwNode; class SwFlyAtContentFrame; -#define NON_PRINTING_CHARACTER_COLOR Color(0x26, 0x8b, 0xd2) - /// a clone of SwInterHyphInfo, but with TextFrameIndex instead of node index class SwInterHyphInfoTextFrame { diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx index 54aee83a48d9..4b82ea4a1380 100644 --- a/sw/source/core/text/frmpaint.cxx +++ b/sw/source/core/text/frmpaint.cxx @@ -206,7 +206,7 @@ void SwExtraPainter::PaintExtra( SwTwips nY, tools::Long nAsc, tools::Long nMax, if ( pRedlineText ) { - m_pFnt->SetColor(NON_PRINTING_CHARACTER_COLOR); + m_pFnt->SetColor(m_pSh->GetViewOptions()->GetNonPrintingCharacterColor()); // don't strike out text in Insertions In Margin mode if ( !m_pSh->GetViewOptions()->IsShowChangesInMargin2() ) m_pFnt->SetStrikeout( STRIKEOUT_SINGLE ); @@ -630,7 +630,7 @@ bool SwTextFrame::PaintEmpty( const SwRect &rRect, bool bCheck ) const pFnt->SetUnderline( LINESTYLE_NONE ); } - pFnt->SetColor(NON_PRINTING_CHARACTER_COLOR); + pFnt->SetColor(pSh->GetViewOptions()->GetNonPrintingCharacterColor()); pFnt->DrawText_( aDrawInf ); } } diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index 5ceabd3a4b4b..38f51bb74468 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -981,7 +981,7 @@ void SwTextPaintInfo::DrawTab( const SwLinePortion &rPor ) const const sal_Unicode cChar = GetTextFrame()->IsRightToLeft() ? CHAR_TAB_RTL : CHAR_TAB; const sal_uInt8 nOptions = DRAW_SPECIAL_OPTIONS_CENTER | DRAW_SPECIAL_OPTIONS_ROTATE; - lcl_DrawSpecial( *this, rPor, aRect, NON_PRINTING_CHARACTER_COLOR, cChar, nOptions ); + lcl_DrawSpecial( *this, rPor, aRect, SwViewOption::GetCurrentViewOptions().GetNonPrintingCharacterColor(), cChar, nOptions ); } void SwTextPaintInfo::DrawLineBreak( const SwLinePortion &rPor ) const @@ -1013,13 +1013,13 @@ void SwTextPaintInfo::DrawLineBreak( const SwLinePortion &rPor ) const aTextRect.AddLeft(30); if (eClear == SwLineBreakClear::RIGHT || eClear == SwLineBreakClear::ALL) aTextRect.AddRight(-30); - lcl_DrawSpecial( *this, rPor, aTextRect, NON_PRINTING_CHARACTER_COLOR, cChar, nOptions ); + lcl_DrawSpecial( *this, rPor, aTextRect, SwViewOption::GetCurrentViewOptions().GetNonPrintingCharacterColor(), cChar, nOptions ); if (eClear != SwLineBreakClear::NONE) { // Paint indicator if this clear is left/right/all. m_pOut->Push(vcl::PushFlags::LINECOLOR); - m_pOut->SetLineColor(NON_PRINTING_CHARACTER_COLOR); + m_pOut->SetLineColor(SwViewOption::GetCurrentViewOptions().GetNonPrintingCharacterColor()); if (eClear != SwLineBreakClear::RIGHT) m_pOut->DrawLine(aRect.BottomLeft(), aRect.TopLeft()); if (eClear != SwLineBreakClear::LEFT) diff --git a/sw/source/core/text/porexp.cxx b/sw/source/core/text/porexp.cxx index 2361c3acab82..78f7de5a8b3b 100644 --- a/sw/source/core/text/porexp.cxx +++ b/sw/source/core/text/porexp.cxx @@ -238,7 +238,7 @@ void SwBlankPortion::Paint( const SwTextPaintInfo &rInf ) const aMarkerPor.SetAscent(GetAscent()); Color colorBackup = aInf.GetFont()->GetColor(); - aInf.GetFont()->SetColor(NON_PRINTING_CHARACTER_COLOR); + aInf.GetFont()->SetColor(SwViewOption::GetCurrentViewOptions().GetNonPrintingCharacterColor()); aInf.DrawText(aMarkerPor, TextFrameIndex(aMarker.getLength()), true); aInf.GetFont()->SetColor(colorBackup); } diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index bec5faf41f9c..ee409a4c80e2 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -102,7 +102,7 @@ void SwTmpEndPortion::Paint( const SwTextPaintInfo &rInf ) const } - aFont.SetColor( NON_PRINTING_CHARACTER_COLOR ); + aFont.SetColor( SwViewOption::GetCurrentViewOptions().GetNonPrintingCharacterColor() ); aFont.SetStrikeout( STRIKEOUT_NONE ); aFont.SetUnderline( LINESTYLE_NONE ); const_cast<SwTextPaintInfo&>(rInf).SetFont(&aFont); @@ -697,7 +697,7 @@ bool SwControlCharPortion::DoPaint(SwTextPaintInfo const& rTextPaintInfo, } rTmpFont.SetEscapement( CHAR_ZWSP == mcChar ? DFLT_ESC_AUTO_SUB : -25 ); - rTmpFont.SetColor( NON_PRINTING_CHARACTER_COLOR ); + rTmpFont.SetColor( SwViewOption::GetCurrentViewOptions().GetNonPrintingCharacterColor() ); const sal_uInt16 nProp = 40; rTmpFont.SetProportion( nProp ); // a smaller font diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index 308b6cce3c91..9f3aeec7a878 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -684,7 +684,7 @@ SwNumberPortion *SwTextFormatter::NewNumberPortion( SwTextFormatInfo &rInf ) con checkApplyParagraphMarkFormatToNumbering(pNumFnt.get(), rInf, pIDSA, pFormat); if ( !lcl_setRedlineAttr( rInf, *pTextNd, pNumFnt ) && bHasHiddenNum ) - pNumFnt->SetColor(NON_PRINTING_CHARACTER_COLOR); + pNumFnt->SetColor(SwViewOption::GetCurrentViewOptions().GetNonPrintingCharacterColor()); // we do not allow a vertical font pNumFnt->SetVertical( pNumFnt->GetOrientation(), m_pFrame->IsVertical() ); diff --git a/sw/source/core/text/txthyph.cxx b/sw/source/core/text/txthyph.cxx index 7992114f6221..ab1ebf984b74 100644 --- a/sw/source/core/text/txthyph.cxx +++ b/sw/source/core/text/txthyph.cxx @@ -455,7 +455,7 @@ void SwSoftHyphPortion::Paint( const SwTextPaintInfo &rInf ) const aMarkerPor.SetAscent(GetAscent()); Color colorBackup = aInf.GetFont()->GetColor(); - aInf.GetFont()->SetColor(NON_PRINTING_CHARACTER_COLOR); + aInf.GetFont()->SetColor(SwViewOption::GetCurrentViewOptions().GetNonPrintingCharacterColor()); aInf.DrawText(aMarkerPor, TextFrameIndex(aMarker.getLength()), true); aInf.GetFont()->SetColor(colorBackup); } diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index f31bbd4c672b..a57173c32c61 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -1556,7 +1556,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) FontLineStyle aPreviousOverline = pTmpFont->GetOverline(); FontStrikeout aPreviousStrikeout = pTmpFont->GetStrikeout(); - pTmpFont->SetColor( NON_PRINTING_CHARACTER_COLOR ); + pTmpFont->SetColor( SwViewOption::GetCurrentViewOptions().GetNonPrintingCharacterColor() ); pTmpFont->SetUnderline(LINESTYLE_NONE); pTmpFont->SetOverline(LINESTYLE_NONE); pTmpFont->SetStrikeout(STRIKEOUT_NONE); diff --git a/sw/source/uibase/config/viewopt.cxx b/sw/source/uibase/config/viewopt.cxx index 87a727ca1e5c..00a908d7b624 100644 --- a/sw/source/uibase/config/viewopt.cxx +++ b/sw/source/uibase/config/viewopt.cxx @@ -61,6 +61,7 @@ SwViewColors::SwViewColors() : m_aFieldShadingsColor(COL_LIGHTGRAY), m_aSectionBoundColor(COL_LIGHTGRAY), m_aPageBreakColor(COL_BLUE), + m_aNonPrintingCharacterColor(Color(0x268bd2)), m_aScriptIndicatorColor(COL_GREEN), m_aShadowColor(COL_GRAY), m_aHeaderFooterMarkColor(COL_BLUE), @@ -133,6 +134,9 @@ SwViewColors::SwViewColors(const svtools::ColorConfig& rConfig) aValue = rConfig.GetColorValue(svtools::WRITERPAGEBREAKS); m_aPageBreakColor = aValue.nColor; + aValue = rConfig.GetColorValue(svtools::WRITERNONPRINTCHARS); + m_aNonPrintingCharacterColor = aValue.nColor; + aValue = rConfig.GetColorValue(svtools::WRITERHEADERFOOTERMARK); m_aHeaderFooterMarkColor = aValue.nColor; @@ -541,6 +545,11 @@ const Color& SwViewOption::GetPageBreakColor() const return m_aColorConfig.m_aPageBreakColor; } +const Color& SwViewOption::GetNonPrintingCharacterColor() const +{ + return m_aColorConfig.m_aNonPrintingCharacterColor; +} + const Color& SwViewOption::GetHeaderFooterMarkColor() const { return m_aColorConfig.m_aHeaderFooterMarkColor;