summaryrefslogtreecommitdiffstats
path: root/sw
diff options
context:
space:
mode:
authorTomaž Vajngerl <quikee@gmail.com>2014-02-04 11:19:42 +0100
committerTomaž Vajngerl <quikee@gmail.com>2014-02-06 09:26:47 +0100
commitfb99a6b9958815eb1ad27179d252a379ce8b79fd (patch)
treed40212c66c27e802d027b7cfb73ca46471855275 /sw
parentRemove LookupTree as it is replaced with Trie. (diff)
downloadcore-fb99a6b9958815eb1ad27179d252a379ce8b79fd.tar.gz
core-fb99a6b9958815eb1ad27179d252a379ce8b79fd.zip
fdo#68071 NPC characters now use a fixed color.
The color for non-printing characters (enable with CTRL+F10) has now been changed to a fixed color. Change-Id: I93dfc69fa4be1c1f1373f25434c8f4afa71355d3
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/inc/txtfrm.hxx2
-rw-r--r--sw/source/core/text/frmpaint.cxx1
-rw-r--r--sw/source/core/text/inftxt.cxx37
-rw-r--r--sw/source/core/text/inftxt.hxx2
-rw-r--r--sw/source/core/text/porrst.cxx4
-rw-r--r--sw/source/core/txtnode/fntcache.cxx40
6 files changed, 73 insertions, 13 deletions
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 00005554381b..84450649c145 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -45,6 +45,8 @@ class SwScriptInfo;
class SwViewOption;
class SwWrongList;
+#define NON_PRINTING_CHARACTER_COLOR RGB_COLORDATA( 0x6A, 0xBE, 0xD3 )
+
/// Represents the visualization of a paragraph.
class SwTxtFrm: public SwCntntFrm
{
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index 422a0496b9f4..358d134be5d3 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -560,6 +560,7 @@ sal_Bool SwTxtFrm::PaintEmpty( const SwRect &rRect, sal_Bool bCheck ) const
aDrawInf.SetFont( pFnt );
aDrawInf.SetSnapToGrid( sal_False );
+ pFnt->SetColor(NON_PRINTING_CHARACTER_COLOR);
pFnt->_DrawText( aDrawInf );
}
delete pClip;
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 73bbd5e564ad..a65a1ebd46dc 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -934,6 +934,29 @@ void SwTxtPaintInfo::DrawRect( const SwRect &rRect, bool bNoGraphic,
}
}
+void SwTxtPaintInfo::DrawSpecial( const SwLinePortion &rPor, sal_Unicode cChar, Color* pColor ) const
+{
+ if( OnWin() )
+ {
+ KSHORT nOldWidth = rPor.Width();
+ OUString sChar( cChar );
+ SwPosSize aSize( GetTxtSize( sChar ) );
+
+ ((SwLinePortion&)rPor).Width( aSize.Width() );
+
+ SwRect aRect;
+ CalcRect( rPor, &aRect );
+
+ if( aRect.HasArea() )
+ {
+ const sal_uInt8 nOptions = 0;
+ lcl_DrawSpecial( *this, rPor, aRect, pColor, cChar, nOptions );
+ }
+
+ ((SwLinePortion&)rPor).Width( nOldWidth );
+ }
+}
+
void SwTxtPaintInfo::DrawTab( const SwLinePortion &rPor ) const
{
if( OnWin() )
@@ -944,11 +967,10 @@ void SwTxtPaintInfo::DrawTab( const SwLinePortion &rPor ) const
if ( ! aRect.HasArea() )
return;
- const sal_Unicode cChar = GetTxtFrm()->IsRightToLeft() ?
- CHAR_TAB_RTL : CHAR_TAB;
- const sal_uInt8 nOptions = DRAW_SPECIAL_OPTIONS_CENTER |
- DRAW_SPECIAL_OPTIONS_ROTATE;
- lcl_DrawSpecial( *this, rPor, aRect, 0, cChar, nOptions );
+ const sal_Unicode cChar = GetTxtFrm()->IsRightToLeft() ? CHAR_TAB_RTL : CHAR_TAB;
+ const sal_uInt8 nOptions = DRAW_SPECIAL_OPTIONS_CENTER | DRAW_SPECIAL_OPTIONS_ROTATE;
+
+ lcl_DrawSpecial( *this, rPor, aRect, new Color(0x6a, 0xbe, 0xd3), cChar, nOptions );
}
}
@@ -967,7 +989,8 @@ void SwTxtPaintInfo::DrawLineBreak( const SwLinePortion &rPor ) const
const sal_Unicode cChar = GetTxtFrm()->IsRightToLeft() ?
CHAR_LINEBREAK_RTL : CHAR_LINEBREAK;
const sal_uInt8 nOptions = 0;
- lcl_DrawSpecial( *this, rPor, aRect, 0, cChar, nOptions );
+
+ lcl_DrawSpecial( *this, rPor, aRect, new Color(NON_PRINTING_CHARACTER_COLOR), cChar, nOptions );
}
((SwLinePortion&)rPor).Width( nOldWidth );
@@ -1064,7 +1087,7 @@ void SwTxtPaintInfo::DrawCheckBox( const SwFieldFormPortion &rPor, bool checked)
if (OnWin() && SwViewOption::IsFieldShadings() &&
!GetOpt().IsPagePreview())
{
- OutputDevice* pOut = (OutputDevice*)GetOut();
+ OutputDevice* pOut = (OutputDevice*)GetOut();
pOut->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
pOut->SetFillColor( SwViewOption::GetFieldShadingsColor() );
pOut->SetLineColor();
diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index 520dddcdcd8f..dd77975eda07 100644
--- a/sw/source/core/text/inftxt.hxx
+++ b/sw/source/core/text/inftxt.hxx
@@ -471,6 +471,8 @@ public:
void DrawRect( const SwRect &rRect, bool bNoGraphic = false,
bool bRetouche = true ) const;
+
+ void DrawSpecial( const SwLinePortion &rPor, sal_Unicode cChar, Color* pColor ) const;
void DrawTab( const SwLinePortion &rPor ) const;
void DrawLineBreak( const SwLinePortion &rPor ) const;
void DrawRedArrow( const SwLinePortion &rPor ) const;
diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx
index 51e2bfc5fa4a..10e9fec297b8 100644
--- a/sw/source/core/text/porrst.cxx
+++ b/sw/source/core/text/porrst.cxx
@@ -69,9 +69,7 @@ void SwTmpEndPortion::Paint( const SwTxtPaintInfo &rInf ) const
{
if( rInf.OnWin() && rInf.GetOpt().IsParagraph() )
{
- SwDefFontSave aSave( rInf );
- const OUString aTmp( CH_PAR );
- rInf.DrawText( aTmp, *this );
+ rInf.DrawSpecial( *this, CH_PAR, new Color(NON_PRINTING_CHARACTER_COLOR) );
}
}
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 8e2e3d43ad64..7299bcb44a8e 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -1443,6 +1443,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
{
const OUString* pStr = &rInf.GetText();
OUString aStr;
+ OUString aBulletOverlay;
sal_Bool bBullet = rInf.GetBullet();
if( bSymbol )
bBullet = sal_False;
@@ -1569,8 +1570,10 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
aStr = rInf.GetText().copy( nCopyStart, nCopyLen );
pStr = &aStr;
- for( sal_Int32 i = 0; i < aStr.getLength(); ++i )
- if( CH_BLANK == aStr[ i ] )
+ aBulletOverlay = rInf.GetText().copy( nCopyStart, nCopyLen );
+
+ for( sal_Int32 i = 0; i < aBulletOverlay.getLength(); ++i )
+ if( CH_BLANK == aBulletOverlay[ i ] )
{
/* fdo#72488 Hack: try to see if the space is zero width
* and don't bother with inserting a bullet in this case.
@@ -1578,9 +1581,17 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
if ((i + nCopyStart + 1 >= rInf.GetLen()) ||
pKernArray[i + nCopyStart] != pKernArray[ i + nCopyStart + 1])
{
- aStr = aStr.replaceAt(i, 1, OUString(CH_BULLET));
+ aBulletOverlay = aBulletOverlay.replaceAt(i, 1, OUString(CH_BULLET));
+ }
+ else
+ {
+ aBulletOverlay = aBulletOverlay.replaceAt(i, 1, OUString(CH_BLANK));
}
}
+ else
+ {
+ aBulletOverlay = aBulletOverlay.replaceAt(i, 1, OUString(CH_BLANK));
+ }
}
sal_Int32 nCnt = rInf.GetText().getLength();
@@ -1808,6 +1819,29 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
rInf.GetOut().DrawTextArray( aPos, *pStr, pKernArray + nOffs,
nTmpIdx + nOffs , nLen - nOffs );
+ if (bBullet)
+ {
+ rInf.GetOut().Push();
+ Color aPreviousColor = pTmpFont->GetColor();
+
+ FontUnderline aPreviousUnderline = pTmpFont->GetUnderline();
+ FontUnderline aPreviousOverline = pTmpFont->GetOverline();
+ FontStrikeout aPreviousStrikeout = pTmpFont->GetStrikeout();
+
+ pTmpFont->SetColor( Color(NON_PRINTING_CHARACTER_COLOR) );
+ pTmpFont->SetUnderline(UNDERLINE_NONE);
+ pTmpFont->SetOverline(UNDERLINE_NONE);
+ pTmpFont->SetStrikeout(STRIKEOUT_NONE);
+ rInf.GetOut().SetFont( *pTmpFont );
+ rInf.GetOut().DrawTextArray( aPos, aBulletOverlay, pKernArray + nOffs,
+ nTmpIdx + nOffs , nLen - nOffs );
+ pTmpFont->SetColor( aPreviousColor );
+
+ pTmpFont->SetUnderline(aPreviousUnderline);
+ pTmpFont->SetOverline(aPreviousOverline);
+ pTmpFont->SetStrikeout(aPreviousStrikeout);
+ rInf.GetOut().Pop();
+ }
}
}
delete[] pScrArray;