Kaydet (Commit) cdd69ce7 authored tarafından Olivier R's avatar Olivier R Kaydeden (comit) Michael Stahl

Linguistic: new underlining styles for grammar checkers

This patch adds two new underlining styles:
- BOLDWAVE: a thicker version of the default WAVE style
- BOLD: a thick straight line

No default setting changed. It's up to the grammar checkers to specify
the underlining style they want.

This contribution to LibreOffice is licensed under the MPLv2/LGPLv3+ dual license.

modified :         include/vcl/outdev.hxx
modified :         offapi/com/sun/star/text/TextMarkupDescriptor.idl
modified :         sw/source/core/inc/wrong.hxx
modified :         sw/source/core/txtnode/fntcache.cxx
modified :         vcl/source/outdev/textline.cxx
modified :         vcl/workben/outdevgrind.cxx

Change-Id: I5629253905ba40c51cc748a7ceeb84170ef5d94c
Reviewed-on: https://gerrit.libreoffice.org/73412
Tested-by: Jenkins
Reviewed-by: 's avatarMichael Stahl <Michael.Stahl@cib.de>
üst e770bacc
......@@ -988,7 +988,7 @@ public:
void ImplDrawTextLines( SalLayout&, FontStrikeout eStrikeout, FontLineStyle eUnderline,
FontLineStyle eOverline, bool bWordLine, bool bUnderlineAbove );
void DrawWaveLine( const Point& rStartPos, const Point& rEndPos );
void DrawWaveLine( const Point& rStartPos, const Point& rEndPos, long nLineWidth = 1 );
bool ImplDrawRotateText( SalLayout& );
......
......@@ -54,7 +54,9 @@ struct TextMarkupDescriptor
nType | aKey
------------------------- | -------------
PROOFREADING or SMARTTAG | "LineColor": changes the markup color from default to RGB aValue (int32)
PROOFREADING or SMARTTAG | "LineType": changes the wiggly line type from default to aValue (short) (WAVE or DASH)
PROOFREADING or SMARTTAG | "LineType": changes the underlining style to aValue (short): WAVE, DASH
| @since 6.3: BOLDWAVE, BOLD
| See: com::sun::star::awt::FontUnderline
*/
com::sun::star::container::XStringKeyMap xMarkupInfoContainer;
};
......
......@@ -47,9 +47,11 @@ class SwWrongList;
enum WrongAreaLineType
{
WRONGAREA_DASHED,
WRONGAREA_NONE,
WRONGAREA_WAVE,
WRONGAREA_NONE
WRONGAREA_BOLDWAVE,
WRONGAREA_BOLD,
WRONGAREA_DASHED
};
enum WrongListType
......@@ -125,6 +127,14 @@ private:
{
return WRONGAREA_WAVE;
}
if (css::awt::FontUnderline::BOLDWAVE == lineType)
{
return WRONGAREA_BOLDWAVE;
}
if (css::awt::FontUnderline::BOLD == lineType)
{
return WRONGAREA_BOLD;
}
if (css::awt::FontUnderline::DASH == lineType)
{
return WRONGAREA_DASHED;
......@@ -189,6 +199,14 @@ private:
{
return WRONGAREA_WAVE;
}
if (css::awt::FontUnderline::BOLDWAVE == lineType)
{
return WRONGAREA_BOLDWAVE;
}
if (css::awt::FontUnderline::BOLD == lineType)
{
return WRONGAREA_BOLD;
}
if (css::awt::FontUnderline::SMALLWAVE == lineType)
{
return WRONGAREA_WAVE; //Code draws wave height based on space that fits.
......
......@@ -784,25 +784,42 @@ static void lcl_DrawLineForWrongListData(
SwWrongArea const*const wrongArea = pWList->GetWrongElement(nNextStart + rInf.GetIdx());
if (wrongArea != nullptr)
{
if (WRONGAREA_DASHED == wrongArea->mLineType)
if (WRONGAREA_WAVE == wrongArea->mLineType)
{
rInf.GetOut().SetLineColor( wrongArea->mColor );
rInf.GetOut().DrawWaveLine( aStart, aEnd, 1 );
}
else if (WRONGAREA_BOLDWAVE == wrongArea->mLineType)
{
rInf.GetOut().SetLineColor( wrongArea->mColor );
rInf.GetOut().DrawWaveLine( aStart, aEnd, 2 );
}
else if (WRONGAREA_BOLD == wrongArea->mLineType)
{
rInf.GetOut().SetLineColor( wrongArea->mColor );
aStart.AdjustY(30 );
aEnd.AdjustY(30 );
LineInfo aLineInfo( LineStyle::Dash );
aLineInfo.SetDistance( 40 );
aLineInfo.SetDashLen( 1 );
aLineInfo.SetDashCount(1);
LineInfo aLineInfo( LineStyle::Solid, 26 );
rInf.GetOut().DrawLine( aStart, aEnd, aLineInfo );
}
else if (WRONGAREA_WAVE == wrongArea->mLineType)
else if (WRONGAREA_DASHED == wrongArea->mLineType)
{
rInf.GetOut().SetLineColor( wrongArea->mColor );
rInf.GetOut().DrawWaveLine( aStart, aEnd );
aStart.AdjustY(30 );
aEnd.AdjustY(30 );
LineInfo aLineInfo( LineStyle::Dash );
aLineInfo.SetDistance( 40 );
aLineInfo.SetDashLen( 1 );
aLineInfo.SetDashCount(1);
rInf.GetOut().DrawLine( aStart, aEnd, aLineInfo );
}
}
}
......
......@@ -936,7 +936,7 @@ void OutputDevice::DrawTextLine( const Point& rPos, long nWidth,
mpAlphaVDev->DrawTextLine( rPos, nWidth, eStrikeout, eUnderline, eOverline, bUnderlineAbove );
}
void OutputDevice::DrawWaveLine( const Point& rStartPos, const Point& rEndPos )
void OutputDevice::DrawWaveLine( const Point& rStartPos, const Point& rEndPos, long nLineWidth )
{
assert(!is_double_buffered_window());
......@@ -998,13 +998,14 @@ void OutputDevice::DrawWaveLine( const Point& rStartPos, const Point& rEndPos )
if( nWaveHeight > pFontInstance->mxFontMetric->GetWavelineUnderlineSize() )
{
nWaveHeight = pFontInstance->mxFontMetric->GetWavelineUnderlineSize();
nLineWidth = 1;
}
ImplDrawWaveLine(nStartX, nStartY, 0, 0,
nEndX-nStartX, nWaveHeight,
fScaleFactor, nOrientation, GetLineColor());
nLineWidth, nOrientation, GetLineColor());
if( mpAlphaVDev )
mpAlphaVDev->DrawWaveLine( rStartPos, rEndPos );
mpAlphaVDev->DrawWaveLine( rStartPos, rEndPos, nLineWidth );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -550,15 +550,6 @@ void setupMethodStubs( functor_vector_type& res )
return pDev->DrawWallpaper(aRect2, aWallpaper);
});
#ifdef FIXME_HAVE_WAVE_NORMAL
/* void DrawWaveLine( const Point& rStartPos, const Point& rEndPos, sal_uInt16 nStyle ); */
add(res,
"DrawWaveLine",
[&] (OutputDevice * pDev) {
return pDev->DrawWaveLine(aPt1, aPt2, (sal_uInt16)WAVE_NORMAL);
});
#endif
/* void DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLong nFlags ); */
add(res,
"DrawGrid",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment