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.tietze@documentfoundation.org>
This commit is contained in:
Heiko Tietze
2024-08-13 12:48:24 +02:00
committed by Heiko Tietze
parent 6aa87b23c4
commit aabb5be81a
17 changed files with 77 additions and 15 deletions

View File

@@ -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") },

View File

@@ -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">

View File

@@ -49,6 +49,7 @@ enum ColorConfigEntry : int
WRITERSECTIONBOUNDARIES,
WRITERHEADERFOOTERMARK,
WRITERPAGEBREAKS,
WRITERNONPRINTCHARS,
HTMLSGML ,
HTMLCOMMENT ,
HTMLKEYWORD ,

View File

@@ -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"/>

View File

@@ -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>

View File

@@ -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

View File

@@ -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;

View File

@@ -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;

View File

@@ -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
{

View File

@@ -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 );
}
}

View File

@@ -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)

View File

@@ -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);
}

View File

@@ -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

View File

@@ -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() );

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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;