basctl/source/basicide/baside2.cxx | 4 +- basctl/source/dlged/dlged.cxx | 4 +- canvas/source/cairo/cairo_canvasfont.cxx | 2 - canvas/source/directx/dx_textlayout_drawhelper.cxx | 4 +- canvas/source/opengl/ogl_canvashelper.cxx | 2 - canvas/source/vcl/canvasfont.cxx | 2 - canvas/source/vcl/spritecanvashelper.cxx | 2 - canvas/source/vcl/spritehelper.cxx | 2 - cppcanvas/source/inc/outdevstate.hxx | 2 - cppcanvas/source/mtfrenderer/mtftools.cxx | 26 ++++++---------- cui/source/dialogs/cuicharmap.cxx | 2 - desktop/source/splash/splash.cxx | 2 - drawinglayer/source/primitive2d/textlayoutdevice.cxx | 2 - drawinglayer/source/tools/wmfemfhelper.cxx | 6 +-- editeng/source/editeng/editdoc.cxx | 2 - editeng/source/items/bulitem.cxx | 2 - editeng/source/outliner/outliner.cxx | 4 +- emfio/source/reader/mtftools.cxx | 6 +-- filter/source/pdf/pdfexport.cxx | 4 +- filter/source/svg/svgfontexport.cxx | 2 - filter/source/svg/svgwriter.cxx | 8 ++-- include/tools/fontenum.hxx | 10 +++++- sc/source/ui/view/gridwin4.cxx | 2 - sc/source/ui/view/output2.cxx | 2 - sfx2/source/control/charwin.cxx | 2 - slideshow/source/engine/rehearsetimingsactivity.cxx | 2 - starmath/source/dialog.cxx | 10 +++--- starmath/source/format.cxx | 4 +- starmath/source/rect.cxx | 2 - starmath/source/symbol.cxx | 4 +- starmath/source/unomodel.cxx | 2 - starmath/source/utility.cxx | 2 - starmath/source/view.cxx | 4 +- starmath/source/visitors.cxx | 4 +- svx/source/customshapes/EnhancedCustomShapeFontWork.cxx | 4 +- svx/source/dialog/charmap.cxx | 4 +- svx/source/dialog/fntctrl.cxx | 4 +- svx/source/dialog/searchcharmap.cxx | 2 - svx/source/svdraw/svdfmtf.cxx | 4 +- svx/source/svdraw/svdpdf.cxx | 4 +- sw/source/core/text/inftxt.cxx | 2 - sw/source/core/text/porrst.cxx | 2 - sw/source/core/txtnode/swfont.cxx | 4 +- sw/source/uibase/uiview/srcview.cxx | 2 - vcl/qa/cppunit/font.cxx | 6 +-- vcl/qa/cppunit/svm/svmtest.cxx | 2 - vcl/source/app/help.cxx | 2 - vcl/source/edit/texteng.cxx | 2 - vcl/source/filter/eps/eps.cxx | 8 ++-- vcl/source/filter/idxf/dxf2mtf.cxx | 2 - vcl/source/filter/imet/ios2met.cxx | 2 - vcl/source/filter/ipict/ipict.cxx | 2 - vcl/source/filter/wmf/emfwr.cxx | 12 +++++-- vcl/source/filter/wmf/wmfwr.cxx | 22 ++++++++----- vcl/source/font/font.cxx | 2 - vcl/source/gdi/metaact.cxx | 4 +- vcl/source/gdi/mtfxmldump.cxx | 7 +--- vcl/source/gdi/pdfwriter_impl.cxx | 12 +++---- vcl/source/outdev/font.cxx | 10 +++--- vcl/source/outdev/outdevstate.cxx | 2 - vcl/source/outdev/text.cxx | 8 ++-- vcl/workben/vcldemo.cxx | 2 - 62 files changed, 147 insertions(+), 132 deletions(-)
New commits: commit 8689bd5490b473a7ffb149bbe5f7f0683f679c72 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Jul 29 20:49:29 2021 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Fri Jul 30 16:40:56 2021 +0200 convert TextAlign to scoped enum Change-Id: Id2c466eacb44f0ea6adba75a0ac0be8be8e7ed4c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119682 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 4e562420ef19..d5f1e07e6e4f 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -121,7 +121,7 @@ void lcl_PrintHeader( Printer* pPrinter, sal_uInt16 nPages, sal_uInt16 nCurPage, vcl::Font aFont( aOldFont ); aFont.SetWeight( WEIGHT_BOLD ); - aFont.SetAlignment( ALIGN_BOTTOM ); + aFont.SetAlignment( TextAlign::Bottom ); pPrinter->SetFont( aFont ); tools::Long nFontHeight = pPrinter->GetTextHeight(); @@ -829,7 +829,7 @@ sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage ) vcl::Font aOldFont( pPrinter->GetFont() ); vcl::Font aFont( GetEditEngine()->GetFont() ); - aFont.SetAlignment( ALIGN_BOTTOM ); + aFont.SetAlignment( TextAlign::Bottom ); aFont.SetTransparent( true ); aFont.SetFontSize( Size( 0, 360 ) ); pPrinter->SetFont( aFont ); diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx index 34467260c140..e54ab203411c 100644 --- a/basctl/source/dlged/dlged.cxx +++ b/basctl/source/dlged/dlged.cxx @@ -1106,7 +1106,7 @@ static void lcl_PrintHeader( Printer* pPrinter, const OUString& rTitle ) // not vcl::Font aFont( pPrinter->GetFont() ); aFont.SetWeight( WEIGHT_BOLD ); - aFont.SetAlignment( ALIGN_BOTTOM ); + aFont.SetAlignment( TextAlign::Bottom ); pPrinter->SetFont( aFont ); tools::Long const nFontHeight = pPrinter->GetTextHeight(); @@ -1148,7 +1148,7 @@ void DlgEditor::Print( Printer* pPrinter, const OUString& rTitle ) // not wor MapMode aMap( MapUnit::Map100thMM ); pPrinter->SetMapMode( aMap ); vcl::Font aFont; - aFont.SetAlignment( ALIGN_BOTTOM ); + aFont.SetAlignment( TextAlign::Bottom ); aFont.SetFontSize( Size( 0, 360 )); pPrinter->SetFont( aFont ); diff --git a/canvas/source/cairo/cairo_canvasfont.cxx b/canvas/source/cairo/cairo_canvasfont.cxx index cca052d167e0..3270432b7a31 100644 --- a/canvas/source/cairo/cairo_canvasfont.cxx +++ b/canvas/source/cairo/cairo_canvasfont.cxx @@ -45,7 +45,7 @@ namespace cairocanvas maFontRequest( rFontRequest ), mpRefDevice( rDevice ) { - maFont->SetAlignment( ALIGN_BASELINE ); + maFont->SetAlignment( TextAlign::Baseline ); maFont->SetCharSet( (rFontRequest.FontDescription.IsSymbolFont==css::util::TriState_YES) ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE ); maFont->SetVertical( rFontRequest.FontDescription.IsVertical==css::util::TriState_YES ); diff --git a/canvas/source/directx/dx_textlayout_drawhelper.cxx b/canvas/source/directx/dx_textlayout_drawhelper.cxx index 1ffeb612de3d..c6d8d76ea9f5 100644 --- a/canvas/source/directx/dx_textlayout_drawhelper.cxx +++ b/canvas/source/directx/dx_textlayout_drawhelper.cxx @@ -111,7 +111,7 @@ namespace dxcanvas rFontRequest.FontDescription.StyleName, Size( 0, ::basegfx::fround(rFontRequest.CellSize))); - aFont.SetAlignment( ALIGN_BASELINE ); + aFont.SetAlignment( TextAlign::Baseline ); aFont.SetCharSet( (rFontRequest.FontDescription.IsSymbolFont==css::util::TriState_YES) ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE ); aFont.SetVertical( rFontRequest.FontDescription.IsVertical==css::util::TriState_YES ); aFont.SetWeight( static_cast<FontWeight>(rFontRequest.FontDescription.FontDescription.Weight) ); @@ -251,7 +251,7 @@ namespace dxcanvas rFontRequest.FontDescription.StyleName, Size( 0, ::basegfx::fround(rFontRequest.CellSize))); - aFont.SetAlignment( ALIGN_BASELINE ); + aFont.SetAlignment( TextAlign::Baseline ); aFont.SetCharSet( (rFontRequest.FontDescription.IsSymbolFont==css::util::TriState_YES) ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE ); aFont.SetVertical( rFontRequest.FontDescription.IsVertical==css::util::TriState_YES ); aFont.SetWeight( static_cast<FontWeight>(rFontRequest.FontDescription.FontDescription.Weight) ); diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx index 0484f710ae53..a7e15a6cf45d 100644 --- a/canvas/source/opengl/ogl_canvashelper.cxx +++ b/canvas/source/opengl/ogl_canvashelper.cxx @@ -692,7 +692,7 @@ namespace oglcanvas rFontRequest.FontDescription.StyleName, Size( 0, ::basegfx::fround(rFontRequest.CellSize))); - aFont.SetAlignment( ALIGN_BASELINE ); + aFont.SetAlignment( TextAlign::Baseline ); aFont.SetCharSet( (rFontRequest.FontDescription.IsSymbolFont==util::TriState_YES) ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE ); aFont.SetVertical( rFontRequest.FontDescription.IsVertical==util::TriState_YES ); aFont.SetWeight( static_cast<FontWeight>(rFontRequest.FontDescription.FontDescription.Weight) ); diff --git a/canvas/source/vcl/canvasfont.cxx b/canvas/source/vcl/canvasfont.cxx index e7fab0492549..0a5c29506134 100644 --- a/canvas/source/vcl/canvasfont.cxx +++ b/canvas/source/vcl/canvasfont.cxx @@ -49,7 +49,7 @@ namespace vclcanvas mpRefDevice( &rDevice ), mpOutDevProvider( rOutDevProvider ) { - maFont->SetAlignment( ALIGN_BASELINE ); + maFont->SetAlignment( TextAlign::Baseline ); maFont->SetCharSet( (rFontRequest.FontDescription.IsSymbolFont==css::util::TriState_YES) ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE ); maFont->SetVertical( rFontRequest.FontDescription.IsVertical==css::util::TriState_YES ); diff --git a/canvas/source/vcl/spritecanvashelper.cxx b/canvas/source/vcl/spritecanvashelper.cxx index 1796c8ac7ffe..0b7479aa19a9 100644 --- a/canvas/source/vcl/spritecanvashelper.cxx +++ b/canvas/source/vcl/spritecanvashelper.cxx @@ -107,7 +107,7 @@ namespace vclcanvas aVCLFont.SetFontHeight( 20 ); aVCLFont.SetColor( INFO_COLOR ); - rOutDev.SetTextAlign(ALIGN_TOP); + rOutDev.SetTextAlign(TextAlign::Top); rOutDev.SetTextColor( INFO_COLOR ); rOutDev.SetFont( aVCLFont ); diff --git a/canvas/source/vcl/spritehelper.cxx b/canvas/source/vcl/spritehelper.cxx index 57b38a9a2815..feba1b7c10b4 100644 --- a/canvas/source/vcl/spritehelper.cxx +++ b/canvas/source/vcl/spritehelper.cxx @@ -215,7 +215,7 @@ namespace vclcanvas aVCLFont.SetFontHeight( std::min(::tools::Long(20),aOutputSize.Height()) ); aVCLFont.SetColor( COL_RED ); - rTargetSurface.SetTextAlign(ALIGN_TOP); + rTargetSurface.SetTextAlign(TextAlign::Top); rTargetSurface.SetTextColor( COL_RED ); rTargetSurface.SetFont( aVCLFont ); diff --git a/cppcanvas/source/inc/outdevstate.hxx b/cppcanvas/source/inc/outdevstate.hxx index 16cc3c4ff25a..09b70b6cdcd5 100644 --- a/cppcanvas/source/inc/outdevstate.hxx +++ b/cppcanvas/source/inc/outdevstate.hxx @@ -63,7 +63,7 @@ namespace cppcanvas::internal textOverlineStyle(LINESTYLE_NONE), textUnderlineStyle(LINESTYLE_NONE), textStrikeoutStyle(STRIKEOUT_NONE), - textReferencePoint(ALIGN_BASELINE), + textReferencePoint(TextAlign::Baseline), isTextOutlineModeSet( false ), isTextEffectShadowSet( false ), diff --git a/cppcanvas/source/mtfrenderer/mtftools.cxx b/cppcanvas/source/mtfrenderer/mtftools.cxx index c5d36eb00652..52e35b73dc0c 100644 --- a/cppcanvas/source/mtfrenderer/mtftools.cxx +++ b/cppcanvas/source/mtfrenderer/mtftools.cxx @@ -51,28 +51,24 @@ namespace cppcanvas::tools ::Size getBaselineOffset( const ::cppcanvas::internal::OutDevState& outdevState, const VirtualDevice& rVDev ) { + ::Size aRet(0, 0); const ::FontMetric& aMetric = rVDev.GetFontMetric(); // calc offset for text output, the XCanvas always renders // baseline offset. switch( outdevState.textReferencePoint ) { - case ALIGN_TOP: - return ::Size( 0, - aMetric.GetInternalLeading() + aMetric.GetAscent() ); - - default: - ENSURE_OR_THROW( false, - "tools::getBaselineOffset(): Unexpected TextAlign value" ); - // FALLTHROUGH intended (to calm compiler warning - case won't happen) - case ALIGN_BASELINE: - return ::Size( 0, 0 ); - - case ALIGN_BOTTOM: - return ::Size( 0, - -aMetric.GetDescent() ); - + case TextAlign::Baseline: + break; + case TextAlign::Top: + aRet = ::Size(0, aMetric.GetInternalLeading() + aMetric.GetAscent()); + break; + case TextAlign::Bottom: + aRet = ::Size(0, -aMetric.GetDescent()); + break; } + + return aRet; } ::basegfx::B2DHomMatrix& calcLogic2PixelLinearTransform( ::basegfx::B2DHomMatrix& o_rMatrix, diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx index c8bf07cc5794..9036009c1bb9 100644 --- a/cui/source/dialogs/cuicharmap.cxx +++ b/cui/source/dialogs/cuicharmap.cxx @@ -1242,7 +1242,7 @@ void SvxShowText::SetFont( const vcl::Font& rFont ) m_aFont = rFont; m_aFont.SetWeight(WEIGHT_NORMAL); - m_aFont.SetAlignment(ALIGN_TOP); + m_aFont.SetAlignment(TextAlign::Top); m_aFont.SetFontSize(m_xVirDev->PixelToLogic(Size(0, nWinHeight / 2))); m_aFont.SetTransparent(true); diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx index e61f87041207..f59e179de5f3 100644 --- a/desktop/source/splash/splash.cxx +++ b/desktop/source/splash/splash.cxx @@ -609,7 +609,7 @@ void SplashScreenWindow::Paint(vcl::RenderContext& rRenderContext, const tools:: _vdev->DrawRect(tools::Rectangle(pSpl->_tlx+pSpl->_barspace, pSpl->_tly+pSpl->_barspace, pSpl->_tlx+pSpl->_barspace+length, pSpl->_tly+pSpl->_barheight-pSpl->_barspace)); vcl::Font aFont; aFont.SetFontSize(Size(0, 12)); - aFont.SetAlignment(ALIGN_BASELINE); + aFont.SetAlignment(TextAlign::Baseline); _vdev->SetFont(aFont); _vdev->SetTextColor(pSpl->_cProgressTextColor); _vdev->DrawText(Point(pSpl->_tlx, pSpl->_textBaseline), pSpl->_sProgressText); diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index 933476b2045a..dff9d3558d89 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -367,7 +367,7 @@ vcl::Font getVclFontFromFontAttribute(const attribute::FontAttribute& rFontAttri Size(bFontIsScaled ? std::max<sal_uInt32>(nWidth, 1) : 0, nHeight)); #endif // define various other FontAttribute - aRetval.SetAlignment(ALIGN_BASELINE); + aRetval.SetAlignment(TextAlign::Baseline); aRetval.SetCharSet(rFontAttribute.getSymbol() ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE); aRetval.SetVertical(rFontAttribute.getVertical()); diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx index a54893025984..98a807fa5c47 100644 --- a/drawinglayer/source/tools/wmfemfhelper.cxx +++ b/drawinglayer/source/tools/wmfemfhelper.cxx @@ -1077,16 +1077,16 @@ namespace wmfemfhelper rTextTransform.scale(aFontScaling.getX(), aFontScaling.getY()); // take text align into account - if(ALIGN_BASELINE != rFont.GetAlignment()) + if (TextAlign::Baseline != rFont.GetAlignment()) { drawinglayer::primitive2d::TextLayouterDevice aTextLayouterDevice; aTextLayouterDevice.setFont(rFont); - if(ALIGN_TOP == rFont.GetAlignment()) + if (TextAlign::Top == rFont.GetAlignment()) { rAlignmentOffset.setY(aTextLayouterDevice.getFontAscent()); } - else // ALIGN_BOTTOM + else // TextAlign::Bottom { rAlignmentOffset.setY(-aTextLayouterDevice.getFontDescent()); } diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 27aa19ed2992..902dc3369d68 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -1939,7 +1939,7 @@ void EditDoc::RemoveItemsFromPool(const ContentNode& rNode) void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent, SvtScriptType nScriptType ) { vcl::Font aPrevFont( rFont ); - rFont.SetAlignment( ALIGN_BASELINE ); + rFont.SetAlignment( TextAlign::Baseline ); rFont.SetTransparent( true ); sal_uInt16 nWhich_FontInfo = GetScriptItemId( EE_CHAR_FONTINFO, nScriptType ); diff --git a/editeng/source/items/bulitem.cxx b/editeng/source/items/bulitem.cxx index 769179748b40..aee2cd203a51 100644 --- a/editeng/source/items/bulitem.cxx +++ b/editeng/source/items/bulitem.cxx @@ -30,7 +30,7 @@ SvxBulletItem::SvxBulletItem( sal_uInt16 _nWhich ) , nScale(75) , cSymbol(' ') { - aFont.SetAlignment(ALIGN_BOTTOM); + aFont.SetAlignment(TextAlign::Bottom); aFont.SetTransparent( true ); } diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index e8d186cd7d41..ff126e75446a 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -859,7 +859,7 @@ vcl::Font Outliner::ImpCalcBulletFont( sal_Int32 nPara ) const nScaledLineHeight *= nScale*10; nScaledLineHeight /= 1000; - aBulletFont.SetAlignment( ALIGN_BOTTOM ); + aBulletFont.SetAlignment( TextAlign::Bottom ); aBulletFont.SetFontSize( Size( 0, nScaledLineHeight ) ); bool bVertical = IsVertical(); aBulletFont.SetVertical( bVertical ); @@ -922,7 +922,7 @@ void Outliner::PaintBullet(sal_Int32 nPara, const Point& rStartPos, const Point& vcl::Font aBulletFont( ImpCalcBulletFont( nPara ) ); // Use baseline bool bSymbol = pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL; - aBulletFont.SetAlignment( bSymbol ? ALIGN_BOTTOM : ALIGN_BASELINE ); + aBulletFont.SetAlignment( bSymbol ? TextAlign::Bottom : TextAlign::Baseline ); vcl::Font aOldFont = rOutDev.GetFont(); rOutDev.SetFont( aBulletFont ); diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx index e4d2ed462bdb..988e0aa7d1ec 100644 --- a/emfio/source/reader/mtftools.cxx +++ b/emfio/source/reader/mtftools.cxx @@ -1742,11 +1742,11 @@ namespace emfio SetGfxMode( nGfxMode ); TextAlign eTextAlign; if ( ( mnTextAlign & TA_BASELINE) == TA_BASELINE ) - eTextAlign = ALIGN_BASELINE; + eTextAlign = TextAlign::Baseline; else if( ( mnTextAlign & TA_BOTTOM) == TA_BOTTOM ) - eTextAlign = ALIGN_BOTTOM; + eTextAlign = TextAlign::Bottom; else - eTextAlign = ALIGN_TOP; + eTextAlign = TextAlign::Top; bool bChangeFont = false; if ( mnLatestTextAlign != mnTextAlign ) { diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 2932d2e52ac9..24fda92699ec 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -1118,7 +1118,7 @@ void PDFExport::ImplWriteWatermark( vcl::PDFWriter& rWriter, const Size& rPageSi aFont.SetItalic( ITALIC_NONE ); aFont.SetWidthType( WIDTH_NORMAL ); aFont.SetWeight( WEIGHT_NORMAL ); - aFont.SetAlignment( ALIGN_BOTTOM ); + aFont.SetAlignment( TextAlign::Bottom ); tools::Long nTextWidth = rPageSize.Width(); if( rPageSize.Width() < rPageSize.Height() ) { @@ -1189,7 +1189,7 @@ void PDFExport::ImplWriteTiledWatermark( vcl::PDFWriter& rWriter, const Size& rP aFont.SetItalic( ITALIC_NONE ); aFont.SetWidthType( WIDTH_NORMAL ); aFont.SetWeight( WEIGHT_NORMAL ); - aFont.SetAlignment( ALIGN_BOTTOM ); + aFont.SetAlignment( TextAlign::Bottom ); aFont.SetFontHeight(40); aFont.SetOrientation(450_deg10); diff --git a/filter/source/svg/svgfontexport.cxx b/filter/source/svg/svgfontexport.cxx index ab730d3d2774..249e222a0762 100644 --- a/filter/source/svg/svgfontexport.cxx +++ b/filter/source/svg/svgfontexport.cxx @@ -189,7 +189,7 @@ void SVGFontExport::implEmbedFont( const vcl::Font& rFont ) vcl::Font aFont( rFont ); aFont.SetFontSize( Size( 0, nFontEM ) ); - aFont.SetAlignment( ALIGN_BASELINE ); + aFont.SetAlignment( TextAlign::Baseline ); pVDev->SetMapMode(MapMode(MapUnit::Map100thMM)); pVDev->SetFont( aFont ); diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index fbf3561352c3..eefbbc61859a 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -1648,9 +1648,9 @@ void SVGTextWriter::implWriteTextPortion( const Point& rPos, const FontMetric aMetric( mpVDev->GetFontMetric() ); const vcl::Font& rFont = mpVDev->GetFont(); - if( rFont.GetAlignment() == ALIGN_TOP ) + if( rFont.GetAlignment() == TextAlign::Top ) aBaseLinePos.AdjustY(aMetric.GetAscent() ); - else if( rFont.GetAlignment() == ALIGN_BOTTOM ) + else if( rFont.GetAlignment() == TextAlign::Bottom ) aBaseLinePos.AdjustY( -(aMetric.GetDescent()) ); implMap( rPos, aPos ); @@ -2646,9 +2646,9 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText, const FontMetric aMetric( mpVDev->GetFontMetric() ); const vcl::Font& rFont = mpVDev->GetFont(); - if( rFont.GetAlignment() == ALIGN_TOP ) + if( rFont.GetAlignment() == TextAlign::Top ) aBaseLinePos.AdjustY(aMetric.GetAscent() ); - else if( rFont.GetAlignment() == ALIGN_BOTTOM ) + else if( rFont.GetAlignment() == TextAlign::Bottom ) aBaseLinePos.AdjustY( -(aMetric.GetDescent()) ); ImplMap( rPos, aPos ); diff --git a/include/tools/fontenum.hxx b/include/tools/fontenum.hxx index eeb35be1985c..419a6baaeb62 100644 --- a/include/tools/fontenum.hxx +++ b/include/tools/fontenum.hxx @@ -27,7 +27,15 @@ enum FontFamily { FAMILY_DONTKNOW, FAMILY_DECORATIVE, FAMILY_MODERN, enum FontPitch { PITCH_DONTKNOW, PITCH_FIXED, PITCH_VARIABLE, FontPitch_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; -enum TextAlign { ALIGN_TOP, ALIGN_BASELINE, ALIGN_BOTTOM, TextAlign_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; +enum class TextAlign : sal_Int16 { + Top = 0x0000, + Baseline = 0x0001, + Bottom = 0x0002, +}; +namespace o3tl +{ + template<> struct typed_flags<TextAlign> : is_typed_flags<TextAlign, 0x3> {}; +} enum FontWeight { WEIGHT_DONTKNOW, WEIGHT_THIN, WEIGHT_ULTRALIGHT, WEIGHT_LIGHT, WEIGHT_SEMILIGHT, WEIGHT_NORMAL, diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index b17e34c8586c..a6ca5defcfa6 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -124,7 +124,7 @@ static void lcl_DrawOneFrame( vcl::RenderContext* pDev, const tools::Rectangle& vcl::Font aAppFont = pDev->GetSettings().GetStyleSettings().GetAppFont(); aAppFont.SetFontSize( aAttrFont.GetFontSize() ); - aAppFont.SetAlignment( ALIGN_TOP ); + aAppFont.SetAlignment( TextAlign::Top ); pDev->SetFont( aAppFont ); Size aTextSize( pDev->GetTextWidth( rTitle ), pDev->GetTextHeight() ); diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 2d45fa62eaa7..bb7a860140f3 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -331,7 +331,7 @@ void ScDrawStringsVars::SetPattern( else pPattern->GetFont( aFont, eColorMode, pFmtDevice, &pOutput->aZoomY, pCondSet, nScript, &aBackConfigColor, &aTextConfigColor ); - aFont.SetAlignment(ALIGN_BASELINE); + aFont.SetAlignment(TextAlign::Baseline); // orientation diff --git a/sfx2/source/control/charwin.cxx b/sfx2/source/control/charwin.cxx index 99f5c5796d08..670ae38e9c7b 100644 --- a/sfx2/source/control/charwin.cxx +++ b/sfx2/source/control/charwin.cxx @@ -234,7 +234,7 @@ void SvxCharView::SetFont(const vcl::Font& rFont) tools::Long nWinHeight = GetOutputSizePixel().Height(); maFont = rFont; maFont.SetWeight(WEIGHT_NORMAL); - maFont.SetAlignment(ALIGN_TOP); + maFont.SetAlignment(TextAlign::Top); maFont.SetFontSize(mxVirDev->PixelToLogic(Size(0, nWinHeight / 2))); maFont.SetTransparent(true); diff --git a/slideshow/source/engine/rehearsetimingsactivity.cxx b/slideshow/source/engine/rehearsetimingsactivity.cxx index dd4e5beac67f..b655a34a1981 100644 --- a/slideshow/source/engine/rehearsetimingsactivity.cxx +++ b/slideshow/source/engine/rehearsetimingsactivity.cxx @@ -152,7 +152,7 @@ RehearseTimingsActivity::RehearseTimingsActivity( const SlideShowContext& rConte { maFont.SetFontHeight( maFont.GetFontHeight() * 2 ); maFont.SetAverageFontWidth( maFont.GetAverageFontWidth() * 2 ); - maFont.SetAlignment( ALIGN_BASELINE ); + maFont.SetAlignment( TextAlign::Baseline ); maFont.SetColor( COL_BLACK ); // determine sprite size (in pixel): diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index ff1d001578de..39ecda8db1df 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -244,7 +244,7 @@ void SmShowFont::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangl vcl::Font aFont(maFont); aFont.SetFontSize(Size(0, 24 * rRenderContext.GetDPIScaleFactor())); - aFont.SetAlignment(ALIGN_TOP); + aFont.SetAlignment(TextAlign::Top); rRenderContext.SetFont(aFont); rRenderContext.SetTextColor(aTextColor); @@ -987,7 +987,7 @@ void SmShowSymbolSet::Paint(vcl::RenderContext& rRenderContext, const tools::Rec { SmSym aSymbol(*aSymbolSet[i]); vcl::Font aFont(aSymbol.GetFace()); - aFont.SetAlignment(ALIGN_TOP); + aFont.SetAlignment(TextAlign::Top); // taking a FontSize which is a bit smaller (compared to nLen) in order to have a buffer // (hopefully enough for left and right, too) @@ -1192,7 +1192,7 @@ void SmShowSymbol::SetSymbol(const SmSym *pSymbol) if (pSymbol) { vcl::Font aFont(pSymbol->GetFace()); - aFont.SetAlignment(ALIGN_BASELINE); + aFont.SetAlignment(TextAlign::Baseline); SetFont(aFont); sal_UCS4 cChar = pSymbol->GetCharacter(); @@ -1406,7 +1406,7 @@ void SmShowChar::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangl if (!aText.isEmpty()) { vcl::Font aFont(m_aFont); - aFont.SetAlignment(ALIGN_TOP); + aFont.SetAlignment(TextAlign::Top); rRenderContext.SetFont(aFont); Size aTextSize(rRenderContext.GetTextWidth(aText), rRenderContext.GetTextHeight()); @@ -1431,7 +1431,7 @@ void SmShowChar::SetSymbol( sal_UCS4 cChar, const vcl::Font &rFont ) vcl::Font aFont( rFont ); Size aSize(GetOutputSizePixel()); aFont.SetFontSize(Size(0, aSize.Height() - aSize.Height() / 3)); - aFont.SetAlignment(ALIGN_BASELINE); + aFont.SetAlignment(TextAlign::Baseline); SetFont(aFont); OUString aText(&cChar, 1); diff --git a/starmath/source/format.cxx b/starmath/source/format.cxx index a4bf960fd583..6dfd888bf038 100644 --- a/starmath/source/format.cxx +++ b/starmath/source/format.cxx @@ -81,7 +81,7 @@ SmFormat::SmFormat() { SmFace &rFace = vFont[i]; rFace.SetTransparent( true ); - rFace.SetAlignment( ALIGN_BASELINE ); + rFace.SetAlignment( TextAlign::Baseline ); rFace.SetColor( COL_AUTO ); bDefaultFont[i] = false; } @@ -92,7 +92,7 @@ void SmFormat::SetFont(sal_uInt16 nIdent, const SmFace &rFont, bool bDefault ) { vFont[nIdent] = rFont; vFont[nIdent].SetTransparent( true ); - vFont[nIdent].SetAlignment( ALIGN_BASELINE ); + vFont[nIdent].SetAlignment( TextAlign::Baseline ); bDefaultFont[nIdent] = bDefault; } diff --git a/starmath/source/rect.cxx b/starmath/source/rect.cxx index 8d7ea52d9717..4857e25693bd 100644 --- a/starmath/source/rect.cxx +++ b/starmath/source/rect.cxx @@ -58,7 +58,7 @@ bool SmGetGlyphBoundRect(const vcl::RenderContext &rDev, pGlyphDev->Push(PushFlags::FONT | PushFlags::MAPMODE); vcl::Font aFnt(rDev.GetFont()); - aFnt.SetAlignment(ALIGN_TOP); + aFnt.SetAlignment(TextAlign::Top); // use scale factor when calling GetTextBoundRect to counter // negative effects from antialiasing which may otherwise result diff --git a/starmath/source/symbol.cxx b/starmath/source/symbol.cxx index 4dfd8374872c..cf45fecf1745 100644 --- a/starmath/source/symbol.cxx +++ b/starmath/source/symbol.cxx @@ -33,7 +33,7 @@ SmSym::SmSym() : { m_aExportName = m_aName; m_aFace.SetTransparent(true); - m_aFace.SetAlignment(ALIGN_BASELINE); + m_aFace.SetAlignment(TextAlign::Baseline); } @@ -50,7 +50,7 @@ SmSym::SmSym(const OUString& rName, const vcl::Font& rFont, sal_UCS4 cChar, m_aFace = rFont; m_aFace.SetTransparent(true); - m_aFace.SetAlignment(ALIGN_BASELINE); + m_aFace.SetAlignment(TextAlign::Baseline); m_cChar = cChar; m_aSetName = rSet; diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index b2e38bf645f9..1a5cecbabe3e 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -441,7 +441,7 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any* SmFace aSet( sFontName, rOld.GetFontSize() ); aSet.SetBorderWidth( rOld.GetBorderWidth() ); - aSet.SetAlignment( ALIGN_BASELINE ); + aSet.SetAlignment( TextAlign::Baseline ); aFormat.SetFont( (*ppEntries)->mnMemberId, aSet ); } } diff --git a/starmath/source/utility.cxx b/starmath/source/utility.cxx index 7012004bea94..8d97777c14f2 100644 --- a/starmath/source/utility.cxx +++ b/starmath/source/utility.cxx @@ -185,7 +185,7 @@ void SmFace::Impl_Init() { SetSize( GetFontSize() ); SetTransparent( true ); - SetAlignment( ALIGN_BASELINE ); + SetAlignment( TextAlign::Baseline ); SetColor( COL_AUTO ); } diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index ef05e243f798..7a93e8a280b2 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -1235,7 +1235,7 @@ void SmViewShell::Impl_Print(OutputDevice &rOutDev, const SmPrintUIOptions &rPri Size aSize650 (0, 650); vcl::Font aFont(FAMILY_DONTKNOW, aSize600); - aFont.SetAlignment(ALIGN_TOP); + aFont.SetAlignment(TextAlign::Top); aFont.SetWeight(WEIGHT_BOLD); aFont.SetFontSize(aSize650); aFont.SetColor( COL_BLACK ); @@ -1279,7 +1279,7 @@ void SmViewShell::Impl_Print(OutputDevice &rOutDev, const SmPrintUIOptions &rPri if (bIsPrintFormulaText) { vcl::Font aFont(FAMILY_DONTKNOW, Size(0, 600)); - aFont.SetAlignment(ALIGN_TOP); + aFont.SetAlignment(TextAlign::Top); aFont.SetColor( COL_BLACK ); // get size diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx index 7e02d4739c62..6a341084f06b 100644 --- a/starmath/source/visitors.cxx +++ b/starmath/source/visitors.cxx @@ -495,8 +495,8 @@ void SmDrawingVisitor::DrawTextNode( SmTextNode* pNode ) void SmDrawingVisitor::DrawSpecialNode( SmSpecialNode* pNode ) { //! since this chars might come from any font, that we may not have - //! set to ALIGN_BASELINE yet, we do it now. - pNode->GetFont( ).SetAlignment( ALIGN_BASELINE ); + //! set to TextAlign::Baseline yet, we do it now. + pNode->GetFont( ).SetAlignment( TextAlign::Baseline ); DrawTextNode( pNode ); } diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx index 5863c61aee04..4135dacdcc27 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx @@ -180,7 +180,7 @@ static void CalculateHorizontalScalingFactor( else aFont.SetFontHeight( rSdrObjCustomShape.GetLogicRect().GetHeight() / rFWData.nMaxParagraphsPerTextArea ); - aFont.SetAlignment( ALIGN_TOP ); + aFont.SetAlignment( TextAlign::Top ); aFont.SetFamilyName( rFontItem.GetFamilyName() ); aFont.SetFamily( rFontItem.GetFamily() ); aFont.SetStyleName( rFontItem.GetStyleName() ); @@ -289,7 +289,7 @@ static void GetTextAreaOutline( aFont.SetFontHeight( rFWData.nSingleLineHeight ); - aFont.SetAlignment( ALIGN_TOP ); + aFont.SetAlignment( TextAlign::Top ); aFont.SetFamilyName( rFontItem.GetFamilyName() ); aFont.SetFamily( rFontItem.GetFamily() ); diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx index 501c85d6b55d..16982c63487f 100644 --- a/svx/source/dialog/charmap.cxx +++ b/svx/source/dialog/charmap.cxx @@ -624,7 +624,7 @@ void SvxShowCharSet::InitSettings(vcl::RenderContext& rRenderContext) vcl::Font aFont(maFont); aFont.SetWeight(WEIGHT_LIGHT); - aFont.SetAlignment(ALIGN_TOP); + aFont.SetAlignment(TextAlign::Top); aFont.SetFontSize(maFontSize); aFont.SetTransparent(true); rRenderContext.SetFont(aFont); @@ -651,7 +651,7 @@ void SvxShowCharSet::RecalculateFont(vcl::RenderContext& rRenderContext) vcl::Font aFont = maFont; aFont.SetWeight(WEIGHT_LIGHT); - aFont.SetAlignment(ALIGN_TOP); + aFont.SetAlignment(TextAlign::Top); int nFontHeight = (aSize.Height() - 5) * 2 / (3 * ROW_COUNT); maFontSize = rRenderContext.PixelToLogic(Size(0, nFontHeight)); aFont.SetFontSize(maFontSize); diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx index 33d54bee40e5..28fff033abb6 100644 --- a/svx/source/dialog/fntctrl.cxx +++ b/svx/source/dialog/fntctrl.cxx @@ -90,7 +90,7 @@ void scaleFontWidth(vcl::Font& rFont, vcl::RenderContext const & rRenderContext, void initFont(vcl::Font& rFont) { rFont.SetTransparent(true); - rFont.SetAlignment(ALIGN_BASELINE); + rFont.SetAlignment(TextAlign::Baseline); } void setFontSize(vcl::Font& rFont) @@ -116,7 +116,7 @@ void setFont(const SvxFont& rNewFont, SvxFont& rImplFont) { rImplFont = rNewFont; rImplFont.SetTransparent(true); - rImplFont.SetAlignment(ALIGN_BASELINE); + rImplFont.SetAlignment(TextAlign::Baseline); } /* diff --git a/svx/source/dialog/searchcharmap.cxx b/svx/source/dialog/searchcharmap.cxx index 1cdb3cfc082a..bd88ec497089 100644 --- a/svx/source/dialog/searchcharmap.cxx +++ b/svx/source/dialog/searchcharmap.cxx @@ -291,7 +291,7 @@ void SvxSearchCharSet::RecalculateFont(vcl::RenderContext& rRenderContext) vcl::Font aFont = rRenderContext.GetFont(); aFont.SetWeight(WEIGHT_LIGHT); - aFont.SetAlignment(ALIGN_TOP); + aFont.SetAlignment(TextAlign::Top); int nFontHeight = (aSize.Height() - 5) * 2 / (3 * ROW_COUNT); maFontSize = rRenderContext.PixelToLogic(Size(0, nFontHeight)); aFont.SetFontSize(maFontSize); diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index de91990ccde8..80f03d393215 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -1014,9 +1014,9 @@ void ImpSdrGDIMetaFileImport::ImportText( const Point& rPos, const OUString& rSt Point aPos( FRound(rPos.X() * mfScaleX + maOfs.X()), FRound(rPos.Y() * mfScaleY + maOfs.Y()) ); Size aSize( nTextWidth, nTextHeight ); - if ( eAlg == ALIGN_BASELINE ) + if ( eAlg == TextAlign::Baseline ) aPos.AdjustY( -(FRound(aFontMetric.GetAscent() * mfScaleY)) ); - else if ( eAlg == ALIGN_BOTTOM ) + else if ( eAlg == TextAlign::Bottom ) aPos.AdjustY( -nTextHeight ); tools::Rectangle aTextRect( aPos, aSize ); diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx index 471aa47375c3..50cef2800dc8 100644 --- a/svx/source/svdraw/svdpdf.cxx +++ b/svx/source/svdraw/svdpdf.cxx @@ -799,9 +799,9 @@ void ImpSdrPdfImport::InsertTextObject(const Point& rPos, const Size& rSize, con FRound(rPos.Y() * mfScaleY + maOfs.Y())); Size aSize(FRound(rSize.Width() * mfScaleX), FRound(rSize.Height() * mfScaleY)); - if (eAlignment == ALIGN_BASELINE) + if (eAlignment == TextAlign::Baseline) aPosition.AdjustY(-FRound(aFontMetric.GetAscent() * mfScaleY)); - else if (eAlignment == ALIGN_BOTTOM) + else if (eAlignment == TextAlign::Bottom) aPosition.AdjustY(-nTextHeight); tools::Rectangle aTextRect(aPosition, aSize); diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index ddfc54bc6fc3..38e4b10195ed 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -1942,7 +1942,7 @@ SwFontSave::SwFontSave(const SwTextSizeInfo &rInf, SwFont *pNew, ( *pNew->GetBackColor() != *pFnt->GetBackColor() ) ) ) { pNew->SetTransparent( true ); - pNew->SetAlign( ALIGN_BASELINE ); + pNew->SetAlign( TextAlign::Baseline ); pInf->SetFont( pNew ); } else diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index 23f837d63051..ed81b325bcdc 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -599,7 +599,7 @@ bool SwBookmarkPortion::DoPaint(SwTextPaintInfo const& rTextPaintInfo, rFont.SetWeight(WEIGHT_THIN, rFont.GetActual()); rFont.SetColor(NON_PRINTING_CHARACTER_COLOR); // reset these to default... - rFont.SetAlign(ALIGN_BASELINE); + rFont.SetAlign(TextAlign::Baseline); rFont.SetUnderline(LINESTYLE_NONE); rFont.SetOverline(LINESTYLE_NONE); rFont.SetStrikeout(STRIKEOUT_NONE); diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx index 620c0d67682a..5a6db8fce090 100644 --- a/sw/source/core/txtnode/swfont.cxx +++ b/sw/source/core/txtnode/swfont.cxx @@ -597,7 +597,7 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet, SetEmphasisMark( static_cast<const SvxEmphasisMarkItem*>(pItem)->GetEmphasisMark() ); SetTransparent( true ); - SetAlign( ALIGN_BASELINE ); + SetAlign( TextAlign::Baseline ); if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CONTOUR, true, &pItem )) SetOutline( static_cast<const SvxContourItem*>(pItem)->GetValue() ); @@ -788,7 +788,7 @@ SwFont::SwFont( const SwAttrSet* pAttrSet, SetStrikeout( pAttrSet->GetCrossedOut().GetStrikeout() ); SetColor( pAttrSet->GetColor().GetValue() ); SetTransparent( true ); - SetAlign( ALIGN_BASELINE ); + SetAlign( TextAlign::Baseline ); SetOutline( pAttrSet->GetContour().GetValue() ); SetShadow( pAttrSet->GetShadowed().GetValue() ); SetPropWidth( pAttrSet->GetCharScaleW().GetValue() ); diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index e7b2059a1ec0..a30aa3a632d6 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -119,7 +119,7 @@ static void lcl_PrintHeader( vcl::RenderContext &rOutDev, sal_Int32 nPages, sal_ vcl::Font aFont( aOldFont ); aFont.SetWeight( WEIGHT_BOLD ); - aFont.SetAlignment( ALIGN_BOTTOM ); + aFont.SetAlignment( TextAlign::Bottom ); rOutDev.SetFont( aFont ); tools::Long nFontHeight = rOutDev.GetTextHeight(); diff --git a/vcl/qa/cppunit/font.cxx b/vcl/qa/cppunit/font.cxx index e99bf12a5124..7eca6f1c0c5d 100644 --- a/vcl/qa/cppunit/font.cxx +++ b/vcl/qa/cppunit/font.cxx @@ -86,10 +86,10 @@ void VclFontTest::testAlignment() { vcl::Font aFont; - CPPUNIT_ASSERT_EQUAL_MESSAGE( "Text alignment should be ALIGN_TOP", TextAlign::ALIGN_TOP, aFont.GetAlignment()); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Text alignment should be TextAlign::Top", TextAlign::Top, aFont.GetAlignment()); - aFont.SetAlignment(TextAlign::ALIGN_BASELINE); - CPPUNIT_ASSERT_EQUAL_MESSAGE( "Text alignment should be ALIGN_BASELINE", TextAlign::ALIGN_BASELINE, aFont.GetAlignment()); + aFont.SetAlignment(TextAlign::Baseline); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Text alignment should be TextAlign::Baseline", TextAlign::Baseline, aFont.GetAlignment()); } diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx index 7a1f4b8f0dba..5f9a4bced6a4 100644 --- a/vcl/qa/cppunit/svm/svmtest.cxx +++ b/vcl/qa/cppunit/svm/svmtest.cxx @@ -1836,7 +1836,7 @@ void SvmTest::testTextAlign() ScopedVclPtrInstance<VirtualDevice> pVirtualDev; setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile); - pVirtualDev->SetTextAlign(TextAlign::ALIGN_BOTTOM); + pVirtualDev->SetTextAlign(TextAlign::Bottom); checkTextAlign(writeAndReadStream(aGDIMetaFile)); checkTextAlign(readFile(u"textalign.svm")); diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index c77bf57e1bd4..45935937a9c4 100644 --- a/vcl/source/app/help.cxx +++ b/vcl/source/app/help.cxx @@ -289,7 +289,7 @@ void HelpTextWindow::ApplySettings(vcl::RenderContext& rRenderContext) const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); SetPointFont(rRenderContext, rStyleSettings.GetHelpFont()); rRenderContext.SetTextColor(rStyleSettings.GetHelpTextColor()); - rRenderContext.SetTextAlign(ALIGN_TOP); + rRenderContext.SetTextAlign(TextAlign::Top); if (rRenderContext.IsNativeControlSupported(ControlType::Tooltip, ControlPart::Entire)) { diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index 96ad2c63bc80..95ef0dbcaf91 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -188,7 +188,7 @@ void TextEngine::SetFont( const vcl::Font& rFont ) aFillColor.SetAlpha( 255 ); maFont.SetFillColor( aFillColor ); - maFont.SetAlignment( ALIGN_TOP ); + maFont.SetAlignment(TextAlign::Top); mpRefDev->SetFont( maFont ); mnDefTab = mpRefDev->GetTextWidth(" "); if ( !mnDefTab ) diff --git a/vcl/source/filter/eps/eps.cxx b/vcl/source/filter/eps/eps.cxx index 2da28338c97c..61ea92e0269b 100644 --- a/vcl/source/filter/eps/eps.cxx +++ b/vcl/source/filter/eps/eps.cxx @@ -408,7 +408,7 @@ bool PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Filter eLineCap = SvtGraphicStroke::capButt; eJoinType = SvtGraphicStroke::joinMiter; aBackgroundColor = COL_WHITE; - eTextAlign = ALIGN_BASELINE; + eTextAlign = TextAlign::Baseline; if( pMTF->GetActionSize() ) { @@ -2075,11 +2075,11 @@ void PSWriter::ImplSetAttrForText( const Point& rPoint ) ImplWriteDouble( aSize.Height() ); mpPS->WriteCharPtr( "sf " ); } - if ( eTextAlign != ALIGN_BASELINE ) + if ( eTextAlign != TextAlign::Baseline ) { // PostScript does not know about FontAlignment - if ( eTextAlign == ALIGN_TOP ) // -> so I assume that + if ( eTextAlign == TextAlign::Top ) // -> so I assume that aPoint.AdjustY( aSize.Height() * 4 / 5 ); // the area under the baseline - else if ( eTextAlign == ALIGN_BOTTOM ) // is about 20% of the font size + else if ( eTextAlign == TextAlign::Bottom ) // is about 20% of the font size aPoint.AdjustY( -( aSize.Height() / 5 ) ); } ImplMoveTo( aPoint ); diff --git a/vcl/source/filter/idxf/dxf2mtf.cxx b/vcl/source/filter/idxf/dxf2mtf.cxx index 06aebc3da16b..1b470c63cc7f 100644 --- a/vcl/source/filter/idxf/dxf2mtf.cxx +++ b/vcl/source/filter/idxf/dxf2mtf.cxx @@ -205,7 +205,7 @@ bool DXF2GDIMetaFile::SetFontAttribute(const DXFBasicEntity & rE, short nAngle, aFont.SetTransparent(true); aFont.SetFamily(FAMILY_SWISS); aFont.SetFontSize(Size(0,nHeight)); - aFont.SetAlignment(ALIGN_BASELINE); + aFont.SetAlignment(TextAlign::Baseline); aFont.SetOrientation(Degree10(nAngle)); if (aActFont!=aFont) { aActFont=aFont; diff --git a/vcl/source/filter/imet/ios2met.cxx b/vcl/source/filter/imet/ios2met.cxx index 1d0b83ba1fb3..f1a6057bc8bc 100644 --- a/vcl/source/filter/imet/ios2met.cxx +++ b/vcl/source/filter/imet/ios2met.cxx @@ -2348,7 +2348,7 @@ void OS2METReader::ReadFont(sal_uInt16 nFieldSize) pF->pSucc=pFontList; pFontList=pF; pF->nID=0; pF->aFont.SetTransparent(true); - pF->aFont.SetAlignment(ALIGN_BASELINE); + pF->aFont.SetAlignment(TextAlign::Baseline); auto nPos=pOS2MET->Tell(); auto nMaxPos = nPos + nFieldSize; diff --git a/vcl/source/filter/ipict/ipict.cxx b/vcl/source/filter/ipict/ipict.cxx index 1d22137d0fcf..0c5adf8cfcb7 100644 --- a/vcl/source/filter/ipict/ipict.cxx +++ b/vcl/source/filter/ipict/ipict.cxx @@ -1914,7 +1914,7 @@ void PictReader::ReadPict( SvStream & rStreamPict, GDIMetaFile & rGDIMetaFile ) aActFont.SetCharSet( GetTextEncoding()); aActFont.SetFamily(FAMILY_SWISS); aActFont.SetFontSize(Size(0,12)); - aActFont.SetAlignment(ALIGN_BASELINE); + aActFont.SetAlignment(TextAlign::Baseline); aHRes = aVRes = Fraction( 1, 1 ); diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx index 9776de87e182..6c6428959652 100644 --- a/vcl/source/filter/wmf/emfwr.cxx +++ b/vcl/source/filter/wmf/emfwr.cxx @@ -562,9 +562,15 @@ void EMFWriter::ImplCheckTextAttr() switch( rFont.GetAlignment() ) { - case ALIGN_TOP: nTextAlign = TA_TOP; break; - case ALIGN_BOTTOM: nTextAlign = TA_BOTTOM; break; - default: nTextAlign = TA_BASELINE; break; + case TextAlign::Top: + nTextAlign = TA_TOP; + break; + case TextAlign::Bottom: + nTextAlign = TA_BOTTOM; + break; + case TextAlign::Baseline: + nTextAlign = TA_BASELINE; + break; } nTextAlign |= mnHorTextAlign; diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx index 9b3751b9cea9..90e51a4ca93b 100644 --- a/vcl/source/filter/wmf/wmfwr.cxx +++ b/vcl/source/filter/wmf/wmfwr.cxx @@ -144,11 +144,11 @@ WMFWriter::WMFWriter() , nMaxRecordSize(0) , nActRecordPos(0) , eSrcRasterOp(RasterOp::OverPaint) - , eSrcTextAlign(ALIGN_BASELINE) + , eSrcTextAlign(TextAlign::Baseline) , pAttrStack(nullptr) , eSrcHorTextAlign(W_TA_LEFT) , eDstROP2(RasterOp::OverPaint) - , eDstTextAlign(ALIGN_BASELINE) + , eDstTextAlign(TextAlign::Baseline) , eDstHorTextAlign(W_TA_LEFT) , bHandleAllocated{} , nDstPenHandle(0) @@ -740,9 +740,15 @@ void WMFWriter::WMFRecord_SetTextAlign(TextAlign eFontAlign, sal_uInt16 eHorText sal_uInt16 nAlign; switch (eFontAlign) { - case ALIGN_TOP: nAlign=W_TA_TOP; break; - case ALIGN_BOTTOM: nAlign=W_TA_BOTTOM; break; - default: nAlign=W_TA_BASELINE; + case TextAlign::Top: + nAlign=W_TA_TOP; + break; + case TextAlign::Bottom: + nAlign=W_TA_BOTTOM; + break; + case TextAlign::Baseline: + nAlign=W_TA_BASELINE; + break; } nAlign|=eHorTextAlign; nAlign|=W_TA_NOUPDATECP; @@ -1453,7 +1459,7 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF ) } eSrcTextAlign = aSrcFont.GetAlignment(); aSrcTextColor = aSrcFont.GetColor(); - aSrcFont.SetAlignment( ALIGN_BASELINE ); + aSrcFont.SetAlignment( TextAlign::Baseline ); aSrcFont.SetColor( COL_WHITE ); } break; @@ -1770,11 +1776,11 @@ bool WMFWriter::WriteWMF( const GDIMetaFile& rMTF, SvStream& rTargetStream, vcl::Font aFont; aFont.SetCharSet( GetExtendedTextEncoding( RTL_TEXTENCODING_MS_1252 ) ); aFont.SetColor( COL_WHITE ); - aFont.SetAlignment( ALIGN_BASELINE ); + aFont.SetAlignment( TextAlign::Baseline ); aDstFont = aSrcFont = aFont; CreateSelectDeleteFont(aDstFont); - eDstTextAlign = eSrcTextAlign = ALIGN_BASELINE; + eDstTextAlign = eSrcTextAlign = TextAlign::Baseline; eDstHorTextAlign = eSrcHorTextAlign = W_TA_LEFT; WMFRecord_SetTextAlign( eDstTextAlign, eDstHorTextAlign ); diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx index cc5042fc9506..c2edc3dca403 100644 --- a/vcl/source/font/font.cxx +++ b/vcl/source/font/font.cxx @@ -880,7 +880,7 @@ ImplFont::ImplFont() : mePitch( PITCH_DONTKNOW ), meWidthType( WIDTH_DONTKNOW ), meItalic( ITALIC_NONE ), - meAlign( ALIGN_TOP ), + meAlign( TextAlign::Top ), meUnderline( LINESTYLE_NONE ), meOverline( LINESTYLE_NONE ), meStrikeout( STRIKEOUT_NONE ), diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index d5e4cc81bb94..8f119e569b0a 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -2670,7 +2670,7 @@ void MetaOverlineColorAction::Read( SvStream& rIStm, ImplMetaReadData* ) MetaTextAlignAction::MetaTextAlignAction() : MetaAction ( MetaActionType::TEXTALIGN ), - maAlign ( ALIGN_TOP ) + maAlign ( TextAlign::Top ) {} MetaTextAlignAction::~MetaTextAlignAction() @@ -2695,7 +2695,7 @@ void MetaTextAlignAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { MetaAction::Write(rOStm, pData); VersionCompatWrite aCompat(rOStm, 1); - rOStm.WriteUInt16( maAlign ); + rOStm.WriteUInt16(static_cast<sal_uInt16>(maAlign)); } void MetaTextAlignAction::Read( SvStream& rIStm, ImplMetaReadData* ) diff --git a/vcl/source/gdi/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx index cccc64df808a..9732b7cd1e9a 100644 --- a/vcl/source/gdi/mtfxmldump.cxx +++ b/vcl/source/gdi/mtfxmldump.cxx @@ -144,10 +144,9 @@ OUString convertTextAlignToString(TextAlign eAlign) { switch (eAlign) { - case ALIGN_BASELINE: return "baseline"; - case ALIGN_BOTTOM: return "bottom"; - case ALIGN_TOP: return "top"; - case TextAlign_FORCE_EQUAL_SIZE: return "equalsize"; + case TextAlign::Baseline: return "baseline"; + case TextAlign::Bottom: return "bottom"; + case TextAlign::Top: return "top"; } return OUString(); } diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index ab7926c50b4e..04af468aa0d6 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -6235,9 +6235,9 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool } Point aAlignOffset; - if ( eAlign == ALIGN_BOTTOM ) + if ( eAlign == TextAlign::Bottom ) aAlignOffset.AdjustY( -(aRefDevFontMetric.GetDescent()) ); - else if ( eAlign == ALIGN_TOP ) + else if ( eAlign == TextAlign::Top ) aAlignOffset.AdjustY(aRefDevFontMetric.GetAscent() ); if( aAlignOffset.X() || aAlignOffset.Y() ) aAlignOffset = aRotScale.transform( aAlignOffset ); @@ -6406,9 +6406,9 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool tools::Long nEmphHeight2 = nEmphHeight / 2; aOffset += Point( nEmphWidth2, nEmphHeight2 ); - if ( eAlign == ALIGN_BOTTOM ) + if ( eAlign == TextAlign::Bottom ) aOffset.AdjustY( -(GetFontInstance()->mxFontMetric->GetDescent()) ); - else if ( eAlign == ALIGN_TOP ) + else if ( eAlign == TextAlign::Top ) aOffset.AdjustY(GetFontInstance()->mxFontMetric->GetAscent() ); nIndex = 0; @@ -7117,9 +7117,9 @@ void PDFWriterImpl::drawTextLine( const Point& rPos, tools::Long nWidth, FontStr Point aPos( rPos ); TextAlign eAlign = m_aCurrentPDFState.m_aFont.GetAlignment(); - if( eAlign == ALIGN_TOP ) + if( eAlign == TextAlign::Top ) aPos.AdjustY(HCONV( pFontInstance->mxFontMetric->GetAscent() )); - else if( eAlign == ALIGN_BOTTOM ) + else if( eAlign == TextAlign::Bottom ) aPos.AdjustY( -HCONV( pFontInstance->mxFontMetric->GetDescent() ) ); OStringBuffer aLine( 512 ); diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 6c761ec4bf07..220b5ddaa976 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -61,7 +61,7 @@ FontMetric OutputDevice::GetDevFont( int nDevFontIndex ) const aFontMetric.SetPitch( rData.GetPitch() ); aFontMetric.SetWeight( rData.GetWeight() ); aFontMetric.SetItalic( rData.GetItalic() ); - aFontMetric.SetAlignment( TextAlign::ALIGN_TOP ); + aFontMetric.SetAlignment( TextAlign::Top ); aFontMetric.SetWidthType( rData.GetWidthType() ); aFontMetric.SetQuality( rData.GetQuality() ); } @@ -199,7 +199,7 @@ FontMetric OutputDevice::GetFontMetric() const aMetric.SetPitch( xFontMetric->GetPitch() ); aMetric.SetWeight( xFontMetric->GetWeight() ); aMetric.SetItalic( xFontMetric->GetItalic() ); - aMetric.SetAlignment( TextAlign::ALIGN_TOP ); + aMetric.SetAlignment( TextAlign::Top ); aMetric.SetWidthType( xFontMetric->GetWidthType() ); if ( pFontInstance->mnOwnOrientation ) aMetric.SetOrientation( pFontInstance->mnOwnOrientation ); @@ -1017,12 +1017,12 @@ bool OutputDevice::ImplNewFont() const // calculate text offset depending on TextAlignment TextAlign eAlign = maFont.GetAlignment(); - if ( eAlign == ALIGN_BASELINE ) + if ( eAlign == TextAlign::Baseline ) { mnTextOffX = 0; mnTextOffY = 0; } - else if ( eAlign == ALIGN_TOP ) + else if ( eAlign == TextAlign::Top ) { mnTextOffX = 0; mnTextOffY = +pFontInstance->mxFontMetric->GetAscent() + mnEmphasisAscent; @@ -1032,7 +1032,7 @@ bool OutputDevice::ImplNewFont() const aOriginPt.RotateAround( mnTextOffX, mnTextOffY, pFontInstance->mnOrientation ); } } - else // eAlign == ALIGN_BOTTOM + else // eAlign == TextAlign::Bottom { mnTextOffX = 0; mnTextOffY = -pFontInstance->mxFontMetric->GetDescent() + mnEmphasisDescent; diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx index 7fa966606744..ec16953d40f2 100644 --- a/vcl/source/outdev/outdevstate.cxx +++ b/vcl/source/outdev/outdevstate.cxx @@ -32,7 +32,7 @@ OutDevState::OutDevState() : mbMapActive(false) - , meTextAlign(ALIGN_TOP) + , meTextAlign(TextAlign::Top) , meRasterOp(RasterOp::OverPaint) , mnTextLayoutMode(ComplexTextLayoutFlags::Default) , meTextLanguage(0) diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 25234b9f0341..ef11013a02fe 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -1586,9 +1586,9 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const tools::Recta aPos.AdjustY((nHeight-(nFormatLines*nTextHeight))/2 ); // Font alignment - if ( eAlign == ALIGN_BOTTOM ) + if ( eAlign == TextAlign::Bottom ) aPos.AdjustY(nTextHeight ); - else if ( eAlign == ALIGN_BASELINE ) + else if ( eAlign == TextAlign::Baseline ) aPos.AdjustY(rTargetDevice.GetFontMetric().GetAscent() ); // Output all lines except for the last one @@ -1664,9 +1664,9 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const tools::Recta aPos.AdjustX((nWidth-nTextWidth)/2 ); // vertical font alignment - if ( eAlign == ALIGN_BOTTOM ) + if ( eAlign == TextAlign::Bottom ) aPos.AdjustY(nTextHeight ); - else if ( eAlign == ALIGN_BASELINE ) + else if ( eAlign == TextAlign::Baseline ) aPos.AdjustY(rTargetDevice.GetFontMetric().GetAscent() ); if ( nStyle & DrawTextFlags::Bottom ) diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 38557c20b955..65896b1f5efc 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -2034,7 +2034,7 @@ class DemoPopup : public FloatingWindow tools::Rectangle aTextRect(Point(6, 6), aSize); SetTextColor(COL_BLACK); - SetTextAlign(ALIGN_TOP); + SetTextAlign(TextAlign::Top); rRenderContext.DrawText(aTextRect, "This is a standalone help text test", DrawTextFlags::MultiLine|DrawTextFlags::WordBreak| DrawTextFlags::Left|DrawTextFlags::Top);