summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-08-18 09:25:40 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-08-18 12:53:31 +0200
commit88bf1749f1eb7322106da1254e349f51f5df0df5 (patch)
tree9dede2758a1cdc913b04b0bd76aca981f838254e /vcl
parent821ae763cc03f69e226cdba66bb9c82c03483a23 (diff)
undo changes to TextAlign
revert commit 8689bd5490b473a7ffb149bbe5f7f0683f679c72 Author: Caolán McNamara <caolanm@redhat.com> Date: Thu Jul 29 20:49:29 2021 +0100 convert TextAlign to scoped enum lets leave this as it always was Change-Id: Id4d2a5644974cdd2b0ed6d361d5c52629674d057 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120626 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qa/cppunit/font.cxx6
-rw-r--r--vcl/qa/cppunit/svm/svmtest.cxx2
-rw-r--r--vcl/source/app/help.cxx2
-rw-r--r--vcl/source/edit/texteng.cxx2
-rw-r--r--vcl/source/filter/eps/eps.cxx8
-rw-r--r--vcl/source/filter/idxf/dxf2mtf.cxx2
-rw-r--r--vcl/source/filter/imet/ios2met.cxx2
-rw-r--r--vcl/source/filter/ipict/ipict.cxx2
-rw-r--r--vcl/source/filter/wmf/emfwr.cxx12
-rw-r--r--vcl/source/filter/wmf/wmfwr.cxx22
-rw-r--r--vcl/source/font/font.cxx2
-rw-r--r--vcl/source/gdi/metaact.cxx2
-rw-r--r--vcl/source/gdi/mtfxmldump.cxx7
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx12
-rw-r--r--vcl/source/outdev/font.cxx10
-rw-r--r--vcl/source/outdev/outdevstate.cxx2
-rw-r--r--vcl/source/outdev/text.cxx8
-rw-r--r--vcl/workben/vcldemo.cxx2
18 files changed, 47 insertions, 58 deletions
diff --git a/vcl/qa/cppunit/font.cxx b/vcl/qa/cppunit/font.cxx
index 7eca6f1c0c5d..e99bf12a5124 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 TextAlign::Top", TextAlign::Top, aFont.GetAlignment());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "Text alignment should be ALIGN_TOP", TextAlign::ALIGN_TOP, aFont.GetAlignment());
- aFont.SetAlignment(TextAlign::Baseline);
- CPPUNIT_ASSERT_EQUAL_MESSAGE( "Text alignment should be TextAlign::Baseline", TextAlign::Baseline, aFont.GetAlignment());
+ aFont.SetAlignment(TextAlign::ALIGN_BASELINE);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "Text alignment should be ALIGN_BASELINE", TextAlign::ALIGN_BASELINE, aFont.GetAlignment());
}
diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx
index 05a3a8ce78a3..cdee28bdab57 100644
--- a/vcl/qa/cppunit/svm/svmtest.cxx
+++ b/vcl/qa/cppunit/svm/svmtest.cxx
@@ -1840,7 +1840,7 @@ void SvmTest::testTextAlign()
ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile);
- pVirtualDev->SetTextAlign(TextAlign::Bottom);
+ pVirtualDev->SetTextAlign(TextAlign::ALIGN_BOTTOM);
checkTextAlign(writeAndReadStream(aGDIMetaFile));
checkTextAlign(readFile(u"textalign.svm"));
diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx
index 45935937a9c4..c77bf57e1bd4 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(TextAlign::Top);
+ rRenderContext.SetTextAlign(ALIGN_TOP);
if (rRenderContext.IsNativeControlSupported(ControlType::Tooltip, ControlPart::Entire))
{
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index 95ef0dbcaf91..96ad2c63bc80 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(TextAlign::Top);
+ maFont.SetAlignment( ALIGN_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 61ea92e0269b..2da28338c97c 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 = TextAlign::Baseline;
+ eTextAlign = ALIGN_BASELINE;
if( pMTF->GetActionSize() )
{
@@ -2075,11 +2075,11 @@ void PSWriter::ImplSetAttrForText( const Point& rPoint )
ImplWriteDouble( aSize.Height() );
mpPS->WriteCharPtr( "sf " );
}
- if ( eTextAlign != TextAlign::Baseline )
+ if ( eTextAlign != ALIGN_BASELINE )
{ // PostScript does not know about FontAlignment
- if ( eTextAlign == TextAlign::Top ) // -> so I assume that
+ if ( eTextAlign == ALIGN_TOP ) // -> so I assume that
aPoint.AdjustY( aSize.Height() * 4 / 5 ); // the area under the baseline
- else if ( eTextAlign == TextAlign::Bottom ) // is about 20% of the font size
+ else if ( eTextAlign == ALIGN_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 1b470c63cc7f..06aebc3da16b 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(TextAlign::Baseline);
+ aFont.SetAlignment(ALIGN_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 f1a6057bc8bc..1d0b83ba1fb3 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(TextAlign::Baseline);
+ pF->aFont.SetAlignment(ALIGN_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 0c5adf8cfcb7..1d22137d0fcf 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(TextAlign::Baseline);
+ aActFont.SetAlignment(ALIGN_BASELINE);
aHRes = aVRes = Fraction( 1, 1 );
diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx
index 8c7f90654a14..430048a060a4 100644
--- a/vcl/source/filter/wmf/emfwr.cxx
+++ b/vcl/source/filter/wmf/emfwr.cxx
@@ -562,15 +562,9 @@ void EMFWriter::ImplCheckTextAttr()
switch( rFont.GetAlignment() )
{
- case TextAlign::Top:
- nTextAlign = TA_TOP;
- break;
- case TextAlign::Bottom:
- nTextAlign = TA_BOTTOM;
- break;
- case TextAlign::Baseline:
- nTextAlign = TA_BASELINE;
- break;
+ case ALIGN_TOP: nTextAlign = TA_TOP; break;
+ case ALIGN_BOTTOM: nTextAlign = TA_BOTTOM; break;
+ default: nTextAlign = TA_BASELINE; break;
}
nTextAlign |= mnHorTextAlign;
diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx
index ae62d54866d3..09c24110cbdb 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(TextAlign::Baseline)
+ , eSrcTextAlign(ALIGN_BASELINE)
, pAttrStack(nullptr)
, eSrcHorTextAlign(W_TA_LEFT)
, eDstROP2(RasterOp::OverPaint)
- , eDstTextAlign(TextAlign::Baseline)
+ , eDstTextAlign(ALIGN_BASELINE)
, eDstHorTextAlign(W_TA_LEFT)
, bHandleAllocated{}
, nDstPenHandle(0)
@@ -740,15 +740,9 @@ void WMFWriter::WMFRecord_SetTextAlign(TextAlign eFontAlign, sal_uInt16 eHorText
sal_uInt16 nAlign;
switch (eFontAlign) {
- case TextAlign::Top:
- nAlign=W_TA_TOP;
- break;
- case TextAlign::Bottom:
- nAlign=W_TA_BOTTOM;
- break;
- case TextAlign::Baseline:
- nAlign=W_TA_BASELINE;
- break;
+ case ALIGN_TOP: nAlign=W_TA_TOP; break;
+ case ALIGN_BOTTOM: nAlign=W_TA_BOTTOM; break;
+ default: nAlign=W_TA_BASELINE;
}
nAlign|=eHorTextAlign;
nAlign|=W_TA_NOUPDATECP;
@@ -1459,7 +1453,7 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
}
eSrcTextAlign = aSrcFont.GetAlignment();
aSrcTextColor = aSrcFont.GetColor();
- aSrcFont.SetAlignment( TextAlign::Baseline );
+ aSrcFont.SetAlignment( ALIGN_BASELINE );
aSrcFont.SetColor( COL_WHITE );
}
break;
@@ -1776,11 +1770,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( TextAlign::Baseline );
+ aFont.SetAlignment( ALIGN_BASELINE );
aDstFont = aSrcFont = aFont;
CreateSelectDeleteFont(aDstFont);
- eDstTextAlign = eSrcTextAlign = TextAlign::Baseline;
+ eDstTextAlign = eSrcTextAlign = ALIGN_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 c2edc3dca403..cc5042fc9506 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( TextAlign::Top ),
+ meAlign( ALIGN_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 7c0c755c4ac5..74f343ed9e9f 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -1569,7 +1569,7 @@ rtl::Reference<MetaAction> MetaOverlineColorAction::Clone() const
MetaTextAlignAction::MetaTextAlignAction() :
MetaAction ( MetaActionType::TEXTALIGN ),
- maAlign ( TextAlign::Top )
+ maAlign ( ALIGN_TOP )
{}
MetaTextAlignAction::~MetaTextAlignAction()
diff --git a/vcl/source/gdi/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx
index 9732b7cd1e9a..cccc64df808a 100644
--- a/vcl/source/gdi/mtfxmldump.cxx
+++ b/vcl/source/gdi/mtfxmldump.cxx
@@ -144,9 +144,10 @@ OUString convertTextAlignToString(TextAlign eAlign)
{
switch (eAlign)
{
- case TextAlign::Baseline: return "baseline";
- case TextAlign::Bottom: return "bottom";
- case TextAlign::Top: return "top";
+ case ALIGN_BASELINE: return "baseline";
+ case ALIGN_BOTTOM: return "bottom";
+ case ALIGN_TOP: return "top";
+ case TextAlign_FORCE_EQUAL_SIZE: return "equalsize";
}
return OUString();
}
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 9dfdd3e08acb..f8e17a33e8e5 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6234,9 +6234,9 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
}
Point aAlignOffset;
- if ( eAlign == TextAlign::Bottom )
+ if ( eAlign == ALIGN_BOTTOM )
aAlignOffset.AdjustY( -(aRefDevFontMetric.GetDescent()) );
- else if ( eAlign == TextAlign::Top )
+ else if ( eAlign == ALIGN_TOP )
aAlignOffset.AdjustY(aRefDevFontMetric.GetAscent() );
if( aAlignOffset.X() || aAlignOffset.Y() )
aAlignOffset = aRotScale.transform( aAlignOffset );
@@ -6405,9 +6405,9 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
tools::Long nEmphHeight2 = nEmphHeight / 2;
aOffset += Point( nEmphWidth2, nEmphHeight2 );
- if ( eAlign == TextAlign::Bottom )
+ if ( eAlign == ALIGN_BOTTOM )
aOffset.AdjustY( -(GetFontInstance()->mxFontMetric->GetDescent()) );
- else if ( eAlign == TextAlign::Top )
+ else if ( eAlign == ALIGN_TOP )
aOffset.AdjustY(GetFontInstance()->mxFontMetric->GetAscent() );
nIndex = 0;
@@ -7116,9 +7116,9 @@ void PDFWriterImpl::drawTextLine( const Point& rPos, tools::Long nWidth, FontStr
Point aPos( rPos );
TextAlign eAlign = m_aCurrentPDFState.m_aFont.GetAlignment();
- if( eAlign == TextAlign::Top )
+ if( eAlign == ALIGN_TOP )
aPos.AdjustY(HCONV( pFontInstance->mxFontMetric->GetAscent() ));
- else if( eAlign == TextAlign::Bottom )
+ else if( eAlign == ALIGN_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 220b5ddaa976..6c761ec4bf07 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::Top );
+ aFontMetric.SetAlignment( TextAlign::ALIGN_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::Top );
+ aMetric.SetAlignment( TextAlign::ALIGN_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 == TextAlign::Baseline )
+ if ( eAlign == ALIGN_BASELINE )
{
mnTextOffX = 0;
mnTextOffY = 0;
}
- else if ( eAlign == TextAlign::Top )
+ else if ( eAlign == ALIGN_TOP )
{
mnTextOffX = 0;
mnTextOffY = +pFontInstance->mxFontMetric->GetAscent() + mnEmphasisAscent;
@@ -1032,7 +1032,7 @@ bool OutputDevice::ImplNewFont() const
aOriginPt.RotateAround( mnTextOffX, mnTextOffY, pFontInstance->mnOrientation );
}
}
- else // eAlign == TextAlign::Bottom
+ else // eAlign == ALIGN_BOTTOM
{
mnTextOffX = 0;
mnTextOffY = -pFontInstance->mxFontMetric->GetDescent() + mnEmphasisDescent;
diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx
index ec16953d40f2..7fa966606744 100644
--- a/vcl/source/outdev/outdevstate.cxx
+++ b/vcl/source/outdev/outdevstate.cxx
@@ -32,7 +32,7 @@
OutDevState::OutDevState()
: mbMapActive(false)
- , meTextAlign(TextAlign::Top)
+ , meTextAlign(ALIGN_TOP)
, meRasterOp(RasterOp::OverPaint)
, mnTextLayoutMode(ComplexTextLayoutFlags::Default)
, meTextLanguage(0)
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 3c3f651b8cba..cf73436df2cf 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 == TextAlign::Bottom )
+ if ( eAlign == ALIGN_BOTTOM )
aPos.AdjustY(nTextHeight );
- else if ( eAlign == TextAlign::Baseline )
+ else if ( eAlign == ALIGN_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 == TextAlign::Bottom )
+ if ( eAlign == ALIGN_BOTTOM )
aPos.AdjustY(nTextHeight );
- else if ( eAlign == TextAlign::Baseline )
+ else if ( eAlign == ALIGN_BASELINE )
aPos.AdjustY(rTargetDevice.GetFontMetric().GetAscent() );
if ( nStyle & DrawTextFlags::Bottom )
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index b909910099c1..1d9b3cf742b3 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(TextAlign::Top);
+ SetTextAlign(ALIGN_TOP);
rRenderContext.DrawText(aTextRect, "This is a standalone help text test",
DrawTextFlags::MultiLine|DrawTextFlags::WordBreak|
DrawTextFlags::Left|DrawTextFlags::Top);