diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-10-22 18:25:35 +0000 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-10-23 00:18:55 +0200 |
commit | 6d3843a415bb74a00a40f312b7771db27060cf0b (patch) | |
tree | 38f2991232cc04f50ed23484885c42fee622f289 | |
parent | c816cb847da9a3302f23e113171c81fed6b319c0 (diff) |
Implement IsUnderlineAbove in vcl::Font
There was even a duplicate implementation...
Change-Id: I192ac2ec8e5b8dd0e6b3ab9b9ddf0bf53df546ab
Reviewed-on: https://gerrit.libreoffice.org/62199
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
-rw-r--r-- | include/vcl/font.hxx | 11 | ||||
-rw-r--r-- | include/vcl/outdev.hxx | 1 | ||||
-rw-r--r-- | svx/source/svdraw/svdotextdecomposition.cxx | 14 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 2 | ||||
-rw-r--r-- | vcl/source/outdev/text.cxx | 2 | ||||
-rw-r--r-- | vcl/source/outdev/textline.cxx | 10 |
6 files changed, 14 insertions, 26 deletions
diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx index 2dc0a5b326cd..02dab4d8b51e 100644 --- a/include/vcl/font.hxx +++ b/include/vcl/font.hxx @@ -163,10 +163,21 @@ public: typedef o3tl::cow_wrapper< ImplFont > ImplType; + inline bool IsUnderlineAbove() const; + private: ImplType mpImplFont; }; +inline bool Font::IsUnderlineAbove() const +{ + if (!IsVertical()) + return false; + // the underline is right for Japanese only + return (LANGUAGE_JAPANESE == GetLanguage()) || + (LANGUAGE_JAPANESE == GetCJKContextLanguage()); +} + } #endif // _VCL_FONT_HXX diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index f661bb377636..c9f9d06db17c 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -1201,7 +1201,6 @@ private: SAL_DLLPRIVATE void ImplDrawStrikeoutChar( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontStrikeout eStrikeout, Color aColor ); SAL_DLLPRIVATE void ImplDrawMnemonicLine( long nX, long nY, long nWidth ); - SAL_DLLPRIVATE static bool ImplIsUnderlineAbove( const vcl::Font& ); static SAL_DLLPRIVATE long ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const OUString& rStr, DrawTextFlags nStyle, const vcl::ITextLayout& _rLayout ); diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index b98ee9e053ba..e5e0ee273e11 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -90,7 +90,6 @@ namespace DECL_LINK(decomposeBlockBulletPrimitive, DrawBulletInfo*, void); DECL_LINK(decomposeStretchBulletPrimitive, DrawBulletInfo*, void); - static bool impIsUnderlineAbove(const vcl::Font& rFont); void impCreateTextPortionPrimitive(const DrawPortionInfo& rInfo); static drawinglayer::primitive2d::BasePrimitive2D* impCheckFieldPrimitive(drawinglayer::primitive2d::BasePrimitive2D* pPrimitive, const DrawPortionInfo& rInfo); void impFlushTextPortionPrimitivesToLinePrimitives(); @@ -152,17 +151,6 @@ namespace drawinglayer::primitive2d::Primitive2DContainer const & getPrimitive2DSequence(); }; - bool impTextBreakupHandler::impIsUnderlineAbove(const vcl::Font& rFont) - { - if(!rFont.IsVertical()) - { - return false; - } - - // the underline is right for Japanese only - return (LANGUAGE_JAPANESE == rFont.GetLanguage()) || (LANGUAGE_JAPANESE == rFont.GetCJKContextLanguage()); - } - void impTextBreakupHandler::impCreateTextPortionPrimitive(const DrawPortionInfo& rInfo) { if(rInfo.maText.isEmpty() || !rInfo.mnTextLen) @@ -284,7 +272,7 @@ namespace // check UnderlineAbove const bool bUnderlineAbove( - drawinglayer::primitive2d::TEXT_LINE_NONE != eFontLineStyle && impIsUnderlineAbove(rInfo.mrFont)); + drawinglayer::primitive2d::TEXT_LINE_NONE != eFontLineStyle && rInfo.mrFont.IsUnderlineAbove()); // prepare strikeout data const drawinglayer::primitive2d::TextStrikeout eTextStrikeout( diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 48475a52fba8..badc1af9a11c 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -6839,7 +6839,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool ) ) { - bool bUnderlineAbove = OutputDevice::ImplIsUnderlineAbove( m_aCurrentPDFState.m_aFont ); + bool bUnderlineAbove = m_aCurrentPDFState.m_aFont.IsUnderlineAbove(); if( m_aCurrentPDFState.m_aFont.IsWordLineMode() ) { Point aStartPt; diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index cd9ba5e628e3..3bc2ced9a3b5 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -300,7 +300,7 @@ void OutputDevice::ImplDrawTextDirect( SalLayout& rSalLayout, if( bTextLines ) ImplDrawTextLines( rSalLayout, maFont.GetStrikeout(), maFont.GetUnderline(), maFont.GetOverline(), - maFont.IsWordLineMode(), ImplIsUnderlineAbove( maFont ) ); + maFont.IsWordLineMode(), maFont.IsUnderlineAbove() ); // emphasis marks if( maFont.GetEmphasisMark() & FontEmphasisMark::Style ) diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx index de65574e1ac9..e35f4bb259af 100644 --- a/vcl/source/outdev/textline.cxx +++ b/vcl/source/outdev/textline.cxx @@ -36,16 +36,6 @@ #define UNDERLINE_LAST LINESTYLE_BOLDWAVE #define STRIKEOUT_LAST STRIKEOUT_X -bool OutputDevice::ImplIsUnderlineAbove( const vcl::Font& rFont ) -{ - if ( !rFont.IsVertical() ) - return false; - - // the underline is right for Japanese only - return (LANGUAGE_JAPANESE == rFont.GetLanguage()) || - (LANGUAGE_JAPANESE == rFont.GetCJKContextLanguage()); -} - void OutputDevice::ImplInitTextLineSize() { mpFontInstance->mxFontMetric->ImplInitTextLineSize( this ); |