[Libreoffice-commits] core.git: include/vcl offapi/com sw/source vcl/source vcl/workben

Olivier R (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 5 11:59:17 UTC 2019


 include/vcl/outdev.hxx                            |    2 -
 offapi/com/sun/star/text/TextMarkupDescriptor.idl |    4 ++
 sw/source/core/inc/wrong.hxx                      |   22 ++++++++++++++-
 sw/source/core/txtnode/fntcache.cxx               |   31 +++++++++++++++++-----
 vcl/source/outdev/textline.cxx                    |    7 ++--
 vcl/workben/outdevgrind.cxx                       |    9 ------
 6 files changed, 52 insertions(+), 23 deletions(-)

New commits:
commit cdd69ce780dc7758047a27ed3c76bdc01b5ffb89
Author:     Olivier R <olivier.dev at grammalecte.net>
AuthorDate: Mon Jun 3 20:33:21 2019 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Jun 5 13:58:23 2019 +0200

    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: Michael Stahl <Michael.Stahl at cib.de>

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 8e79c0f646ee..8f8c009fa291 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -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& );
 
diff --git a/offapi/com/sun/star/text/TextMarkupDescriptor.idl b/offapi/com/sun/star/text/TextMarkupDescriptor.idl
index f78cb28c07ce..2afd054a74aa 100644
--- a/offapi/com/sun/star/text/TextMarkupDescriptor.idl
+++ b/offapi/com/sun/star/text/TextMarkupDescriptor.idl
@@ -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;
 };
diff --git a/sw/source/core/inc/wrong.hxx b/sw/source/core/inc/wrong.hxx
index 3fe7cb7bf75b..53581720e853 100644
--- a/sw/source/core/inc/wrong.hxx
+++ b/sw/source/core/inc/wrong.hxx
@@ -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.
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index ed312422a361..871f9ce655ca 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -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 );
                 }
             }
         }
diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx
index 2c88586618bf..67feda6c4030 100644
--- a/vcl/source/outdev/textline.cxx
+++ b/vcl/source/outdev/textline.cxx
@@ -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: */
diff --git a/vcl/workben/outdevgrind.cxx b/vcl/workben/outdevgrind.cxx
index 317762eaa861..ac6f12aaa373 100644
--- a/vcl/workben/outdevgrind.cxx
+++ b/vcl/workben/outdevgrind.cxx
@@ -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",


More information about the Libreoffice-commits mailing list