summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-10-20 07:27:44 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-10-21 08:13:05 +0200
commit0fb58a1ff168ae122e9c8993a3136658e3b0e3f0 (patch)
tree908983b02f466e0a49599edc70aaa1baaa240371 /vcl/source
parentb84afd2188d6993c91081885dc24664bd3f1cc73 (diff)
new tools::Degree10 strong typedef
partly to flush some use of "long" out the codebase, but also to make it obvious which units are being used for angle values. Change-Id: I1dc22494ca42c4677a63f685d5903f2b89886dc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104548 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/bitmap/bitmappaint.cxx20
-rw-r--r--vcl/source/control/fixed.cxx2
-rw-r--r--vcl/source/filter/GraphicNativeTransform.cxx15
-rw-r--r--vcl/source/filter/jpeg/Exif.cxx12
-rw-r--r--vcl/source/filter/jpeg/Exif.hxx3
-rw-r--r--vcl/source/filter/jpeg/JpegTransform.cxx2
-rw-r--r--vcl/source/filter/jpeg/JpegTransform.hxx4
-rw-r--r--vcl/source/filter/jpeg/jpeg.h2
-rw-r--r--vcl/source/filter/jpeg/jpegc.cxx4
-rw-r--r--vcl/source/filter/wmf/emfwr.cxx2
-rw-r--r--vcl/source/filter/wmf/wmfwr.cxx2
-rw-r--r--vcl/source/font/PhysicalFontFace.cxx2
-rw-r--r--vcl/source/font/font.cxx9
-rw-r--r--vcl/source/font/fontselect.cxx10
-rw-r--r--vcl/source/gdi/TypeSerializer.cxx4
-rw-r--r--vcl/source/gdi/bitmapex.cxx2
-rw-r--r--vcl/source/gdi/gdimtf.cxx12
-rw-r--r--vcl/source/gdi/gradient.cxx12
-rw-r--r--vcl/source/gdi/hatch.cxx9
-rw-r--r--vcl/source/gdi/mtfxmldump.cxx6
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx16
-rw-r--r--vcl/source/gdi/sallayout.cxx6
-rw-r--r--vcl/source/gdi/svmconverter.cxx4
-rw-r--r--vcl/source/gdi/wall.cxx2
-rw-r--r--vcl/source/graphic/GraphicObject.cxx4
-rw-r--r--vcl/source/graphic/GraphicObject2.cxx2
-rw-r--r--vcl/source/outdev/bitmap.cxx2
-rw-r--r--vcl/source/outdev/font.cxx4
-rw-r--r--vcl/source/outdev/gradient.cxx8
-rw-r--r--vcl/source/outdev/hatch.cxx26
-rw-r--r--vcl/source/outdev/text.cxx14
-rw-r--r--vcl/source/outdev/textline.cxx10
-rw-r--r--vcl/source/window/cursor.cxx6
-rw-r--r--vcl/source/window/printdlg.cxx2
-rw-r--r--vcl/source/window/toolbox.cxx6
-rw-r--r--vcl/source/window/toolbox2.cxx12
36 files changed, 131 insertions, 127 deletions
diff --git a/vcl/source/bitmap/bitmappaint.cxx b/vcl/source/bitmap/bitmappaint.cxx
index ebc7e1288ef5..f9dff4ee0b26 100644
--- a/vcl/source/bitmap/bitmappaint.cxx
+++ b/vcl/source/bitmap/bitmappaint.cxx
@@ -209,16 +209,16 @@ bool Bitmap::Mirror(BmpMirrorFlags nMirrorFlags)
return bRet;
}
-bool Bitmap::Rotate(tools::Long nAngle10, const Color& rFillColor)
+bool Bitmap::Rotate(Degree10 nAngle10, const Color& rFillColor)
{
bool bRet = false;
- nAngle10 %= 3600;
- nAngle10 = (nAngle10 < 0) ? (3599L + nAngle10) : nAngle10;
+ nAngle10 %= Degree10(3600);
+ nAngle10 = (nAngle10 < Degree10(0)) ? (Degree10(3599) + nAngle10) : nAngle10;
if (!nAngle10)
bRet = true;
- else if (nAngle10 == 1800)
+ else if (nAngle10 == Degree10(1800))
bRet = Mirror(BmpMirrorFlags::Horizontal | BmpMirrorFlags::Vertical);
else
{
@@ -229,7 +229,7 @@ bool Bitmap::Rotate(tools::Long nAngle10, const Color& rFillColor)
{
const Size aSizePix(GetSizePixel());
- if (nAngle10 == 900 || nAngle10 == 2700)
+ if (nAngle10 == Degree10(900) || nAngle10 == Degree10(2700))
{
const Size aNewSizePix(aSizePix.Height(), aSizePix.Width());
Bitmap aNewBmp(aNewSizePix, GetBitCount(), &pReadAcc->GetPalette());
@@ -244,7 +244,7 @@ bool Bitmap::Rotate(tools::Long nAngle10, const Color& rFillColor)
const tools::Long nNewWidth = aNewSizePix.Width();
const tools::Long nNewHeight = aNewSizePix.Height();
- if (nAngle10 == 900)
+ if (nAngle10 == Degree10(900))
{
for (tools::Long nY = 0, nOtherX = nWidth1; nY < nNewHeight;
nY++, nOtherX--)
@@ -257,7 +257,7 @@ bool Bitmap::Rotate(tools::Long nAngle10, const Color& rFillColor)
}
}
}
- else if (nAngle10 == 2700)
+ else if (nAngle10 == Degree10(2700))
{
for (tools::Long nY = 0, nOtherX = 0; nY < nNewHeight; nY++, nOtherX++)
{
@@ -280,7 +280,7 @@ bool Bitmap::Rotate(tools::Long nAngle10, const Color& rFillColor)
Point aTmpPoint;
tools::Rectangle aTmpRectangle(aTmpPoint, aSizePix);
tools::Polygon aPoly(aTmpRectangle);
- aPoly.Rotate(aTmpPoint, static_cast<sal_uInt16>(nAngle10));
+ aPoly.Rotate(aTmpPoint, nAngle10);
tools::Rectangle aNewBound(aPoly.GetBoundRect());
const Size aNewSizePix(aNewBound.GetSize());
@@ -290,8 +290,8 @@ bool Bitmap::Rotate(tools::Long nAngle10, const Color& rFillColor)
if (pWriteAcc)
{
const BitmapColor aFillColor(pWriteAcc->GetBestMatchingColor(rFillColor));
- const double fCosAngle = cos(nAngle10 * F_PI1800);
- const double fSinAngle = sin(nAngle10 * F_PI1800);
+ const double fCosAngle = cos(nAngle10.get() * F_PI1800);
+ const double fSinAngle = sin(nAngle10.get() * F_PI1800);
const double fXMin = aNewBound.Left();
const double fYMin = aNewBound.Top();
const tools::Long nWidth = aSizePix.Width();
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index 51688a092564..bb9831dcf425 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -507,7 +507,7 @@ void FixedLine::ImplDraw(vcl::RenderContext& rRenderContext)
tools::Long nWidth = rRenderContext.GetTextWidth(aText);
rRenderContext.Push(PushFlags::FONT);
vcl::Font aFont(rRenderContext.GetFont());
- aFont.SetOrientation(900);
+ aFont.SetOrientation(Degree10(900));
SetFont(aFont);
Point aStartPt(aOutSize.Width() / 2, aOutSize.Height() - 1);
if (nWinStyle & WB_VCENTER)
diff --git a/vcl/source/filter/GraphicNativeTransform.cxx b/vcl/source/filter/GraphicNativeTransform.cxx
index b2d90f43e8d7..d6c77c71caba 100644
--- a/vcl/source/filter/GraphicNativeTransform.cxx
+++ b/vcl/source/filter/GraphicNativeTransform.cxx
@@ -35,16 +35,17 @@ GraphicNativeTransform::GraphicNativeTransform(Graphic& rGraphic)
GraphicNativeTransform::~GraphicNativeTransform() {}
-void GraphicNativeTransform::rotate(sal_uInt16 aInputRotation)
+void GraphicNativeTransform::rotate(Degree10 aInputRotation)
{
// Rotation can be between 0 and 3600
- sal_uInt16 aRotation = aInputRotation % 3600;
+ Degree10 aRotation = aInputRotation % Degree10(3600);
- if (aRotation == 0)
+ if (aRotation == Degree10(0))
{
return; // No rotation is needed
}
- else if (aRotation != 900 && aRotation != 1800 && aRotation != 2700)
+ else if (aRotation != Degree10(900) && aRotation != Degree10(1800)
+ && aRotation != Degree10(2700))
{
return;
}
@@ -68,7 +69,7 @@ void GraphicNativeTransform::rotate(sal_uInt16 aInputRotation)
}
}
-bool GraphicNativeTransform::rotateBitmapOnly(sal_uInt16 aRotation)
+bool GraphicNativeTransform::rotateBitmapOnly(Degree10 aRotation)
{
if (mrGraphic.IsAnimated())
{
@@ -82,7 +83,7 @@ bool GraphicNativeTransform::rotateBitmapOnly(sal_uInt16 aRotation)
return true;
}
-bool GraphicNativeTransform::rotateGeneric(sal_uInt16 aRotation, const OUString& aType)
+bool GraphicNativeTransform::rotateGeneric(Degree10 aRotation, const OUString& aType)
{
// Can't rotate animations yet
if (mrGraphic.IsAnimated())
@@ -117,7 +118,7 @@ bool GraphicNativeTransform::rotateGeneric(sal_uInt16 aRotation, const OUString&
return true;
}
-void GraphicNativeTransform::rotateJPEG(sal_uInt16 aRotation)
+void GraphicNativeTransform::rotateJPEG(Degree10 aRotation)
{
BitmapEx aBitmap = mrGraphic.GetBitmapEx();
diff --git a/vcl/source/filter/jpeg/Exif.cxx b/vcl/source/filter/jpeg/Exif.cxx
index 4f773a48bc24..b8760b63aef7 100644
--- a/vcl/source/filter/jpeg/Exif.cxx
+++ b/vcl/source/filter/jpeg/Exif.cxx
@@ -49,21 +49,21 @@ exif::Orientation Exif::convertToOrientation(sal_Int32 value)
return exif::TOP_LEFT;
}
-sal_Int32 Exif::getRotation() const
+Degree10 Exif::getRotation() const
{
switch(maOrientation) {
case exif::TOP_LEFT:
- return 0;
+ return Degree10(0);
case exif::BOTTOM_RIGHT:
- return 1800;
+ return Degree10(1800);
case exif::RIGHT_TOP:
- return 2700;
+ return Degree10(2700);
case exif::LEFT_BOTTOM:
- return 900;
+ return Degree10(900);
default:
break;
}
- return 0;
+ return Degree10(0);
}
bool Exif::read(SvStream& rStream)
diff --git a/vcl/source/filter/jpeg/Exif.hxx b/vcl/source/filter/jpeg/Exif.hxx
index 6052a44842da..c39de1b08fdf 100644
--- a/vcl/source/filter/jpeg/Exif.hxx
+++ b/vcl/source/filter/jpeg/Exif.hxx
@@ -20,6 +20,7 @@
#pragma once
#include <tools/stream.hxx>
+#include <tools/degree.hxx>
namespace exif {
@@ -71,7 +72,7 @@ public:
bool hasExif() const { return mbExifPresent;}
exif::Orientation getOrientation() const { return maOrientation;}
- sal_Int32 getRotation() const;
+ Degree10 getRotation() const;
void setOrientation(exif::Orientation orientation);
diff --git a/vcl/source/filter/jpeg/JpegTransform.cxx b/vcl/source/filter/jpeg/JpegTransform.cxx
index f3b1e7723bdf..b1016c022272 100644
--- a/vcl/source/filter/jpeg/JpegTransform.cxx
+++ b/vcl/source/filter/jpeg/JpegTransform.cxx
@@ -37,7 +37,7 @@ void JpegTransform::perform()
Transform( &mrInputStream, &mrOutputStream, maRotate );
}
-void JpegTransform::setRotate(sal_uInt16 aRotate)
+void JpegTransform::setRotate(Degree10 aRotate)
{
maRotate = aRotate;
}
diff --git a/vcl/source/filter/jpeg/JpegTransform.hxx b/vcl/source/filter/jpeg/JpegTransform.hxx
index cb6d3acbcec1..ed5d550276fa 100644
--- a/vcl/source/filter/jpeg/JpegTransform.hxx
+++ b/vcl/source/filter/jpeg/JpegTransform.hxx
@@ -24,7 +24,7 @@
class JpegTransform final
{
- sal_uInt16 maRotate;
+ Degree10 maRotate;
SvStream& mrInputStream;
SvStream& mrOutputStream;
@@ -33,7 +33,7 @@ public:
JpegTransform(SvStream& rInputStream, SvStream& rOutputStream);
~JpegTransform();
- void setRotate(sal_uInt16 aRotate);
+ void setRotate(Degree10 aRotate);
void perform();
};
diff --git a/vcl/source/filter/jpeg/jpeg.h b/vcl/source/filter/jpeg/jpeg.h
index 908eee030d88..8a8e757a9719 100644
--- a/vcl/source/filter/jpeg/jpeg.h
+++ b/vcl/source/filter/jpeg/jpeg.h
@@ -50,7 +50,7 @@ void ReadJPEG( JPEGReader* pJPEGReader, void* pInputStream, tools::Long* pLin
GraphicFilterImportFlags nImportFlags,
BitmapScopedWriteAccess* ppAccess );
-void Transform(void* pInputStream, void* pOutputStream, tools::Long nAngle);
+void Transform(void* pInputStream, void* pOutputStream, Degree10 nAngle);
/* Expanded data source object for stdio input */
diff --git a/vcl/source/filter/jpeg/jpegc.cxx b/vcl/source/filter/jpeg/jpegc.cxx
index 804278ec8300..4718ec94560c 100644
--- a/vcl/source/filter/jpeg/jpegc.cxx
+++ b/vcl/source/filter/jpeg/jpegc.cxx
@@ -425,7 +425,7 @@ bool WriteJPEG( JPEGWriter* pJPEGWriter, void* pOutputStream,
return true;
}
-void Transform(void* pInputStream, void* pOutputStream, tools::Long nAngle)
+void Transform(void* pInputStream, void* pOutputStream, Degree10 nAngle)
{
jpeg_transform_info aTransformOption;
JCOPY_OPTION aCopyOption = JCOPYOPT_ALL;
@@ -445,7 +445,7 @@ void Transform(void* pInputStream, void* pOutputStream, tools::Long nAngle)
// Angle to transform option
// 90 Clockwise = 270 Counterclockwise
- switch (nAngle)
+ switch (nAngle.get())
{
case 2700:
aTransformOption.transform = JXFORM_ROT_90;
diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx
index 754f1d46386c..63026cd2e7dc 100644
--- a/vcl/source/filter/wmf/emfwr.cxx
+++ b/vcl/source/filter/wmf/emfwr.cxx
@@ -463,7 +463,7 @@ void EMFWriter::ImplCheckTextAttr()
m_rStm.WriteUInt32( mnTextHandle );
ImplWriteExtent( -rFont.GetFontSize().Height() );
ImplWriteExtent( rFont.GetFontSize().Width() );
- m_rStm.WriteInt32( rFont.GetOrientation() ).WriteInt32( rFont.GetOrientation() );
+ m_rStm.WriteInt32( rFont.GetOrientation().get() ).WriteInt32( rFont.GetOrientation().get() );
switch( rFont.GetWeight() )
{
diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx
index 0ecbbc9be36e..43463c10e62e 100644
--- a/vcl/source/filter/wmf/wmfwr.cxx
+++ b/vcl/source/filter/wmf/wmfwr.cxx
@@ -312,7 +312,7 @@ void WMFWriter::WMFRecord_CreateFontIndirect(const vcl::Font & rFont)
WriteRecordHeader(0x00000000,W_META_CREATEFONTINDIRECT);
WriteHeightWidth(Size(rFont.GetFontSize().Width(),-rFont.GetFontSize().Height()));
- pWMF->WriteInt16( rFont.GetOrientation() ).WriteInt16( rFont.GetOrientation() );
+ pWMF->WriteInt16( rFont.GetOrientation().get() ).WriteInt16( rFont.GetOrientation().get() );
switch (rFont.GetWeight()) {
case WEIGHT_THIN: nWeight=W_FW_THIN; break;
diff --git a/vcl/source/font/PhysicalFontFace.cxx b/vcl/source/font/PhysicalFontFace.cxx
index b16488ddc88d..9610c1268057 100644
--- a/vcl/source/font/PhysicalFontFace.cxx
+++ b/vcl/source/font/PhysicalFontFace.cxx
@@ -161,7 +161,7 @@ bool PhysicalFontFace::IsBetterMatch( const FontSelectPattern& rFSD, FontMatchSt
int nHeightMatch = 0;
int nWidthMatch = 0;
- if( rFSD.mnOrientation != 0 )
+ if( rFSD.mnOrientation != Degree10(0) )
nMatch += 80;
else if( rFSD.mnWidth != 0 )
nMatch += 25;
diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx
index f9ca44f061f9..2818e71e00ea 100644
--- a/vcl/source/font/font.cxx
+++ b/vcl/source/font/font.cxx
@@ -189,7 +189,7 @@ void Font::SetPitch( FontPitch ePitch )
mpImplFont->SetPitch( ePitch );
}
-void Font::SetOrientation( short nOrientation )
+void Font::SetOrientation( Degree10 nOrientation )
{
if (const_cast<const ImplType&>(mpImplFont)->mnOrientation != nOrientation)
mpImplFont->mnOrientation = nOrientation;
@@ -361,6 +361,7 @@ SvStream& ReadImplFont( SvStream& rIStm, ImplFont& rImplFont )
{
VersionCompat aCompat( rIStm, StreamMode::READ );
sal_uInt16 nTmp16(0);
+ sal_Int16 nTmps16(0);
bool bTmp(false);
sal_uInt8 nTmp8(0);
@@ -379,7 +380,7 @@ SvStream& ReadImplFont( SvStream& rIStm, ImplFont& rImplFont )
rIStm.ReadUInt16( nTmp16 ); rImplFont.maLanguageTag.reset( LanguageType(nTmp16) );
rIStm.ReadUInt16( nTmp16 ); rImplFont.meWidthType = static_cast<FontWidth>(nTmp16);
- rIStm.ReadInt16( rImplFont.mnOrientation );
+ rIStm.ReadInt16( nTmps16 ); rImplFont.mnOrientation = Degree10(nTmps16);
rIStm.ReadCharAsBool( bTmp ); rImplFont.mbWordLine = bTmp;
rIStm.ReadCharAsBool( bTmp ); rImplFont.mbOutline = bTmp;
@@ -423,7 +424,7 @@ SvStream& WriteImplFont( SvStream& rOStm, const ImplFont& rImplFont )
rOStm.WriteUInt16( static_cast<sal_uInt16>(rImplFont.maLanguageTag.getLanguageType( false)) );
rOStm.WriteUInt16( rImplFont.GetWidthTypeNoAsk() );
- rOStm.WriteInt16( rImplFont.mnOrientation );
+ rOStm.WriteInt16( rImplFont.mnOrientation.get() );
rOStm.WriteBool( rImplFont.mbWordLine );
rOStm.WriteBool( rImplFont.mbOutline );
@@ -683,7 +684,7 @@ const LanguageTag& Font::GetCJKContextLanguageTag() const { return mpImplFont->m
LanguageType Font::GetLanguage() const { return mpImplFont->maLanguageTag.getLanguageType( false); }
LanguageType Font::GetCJKContextLanguage() const { return mpImplFont->maCJKLanguageTag.getLanguageType( false); }
-short Font::GetOrientation() const { return mpImplFont->mnOrientation; }
+Degree10 Font::GetOrientation() const { return mpImplFont->mnOrientation; }
bool Font::IsVertical() const { return mpImplFont->mbVertical; }
FontKerning Font::GetKerning() const { return mpImplFont->meKerning; }
diff --git a/vcl/source/font/fontselect.cxx b/vcl/source/font/fontselect.cxx
index faafdb61b398..09fb90e8b15f 100644
--- a/vcl/source/font/fontselect.cxx
+++ b/vcl/source/font/fontselect.cxx
@@ -46,12 +46,12 @@ FontSelectPattern::FontSelectPattern( const vcl::Font& rFont,
rFont.GetFontAttributes( *this );
// normalize orientation between 0 and 3600
- if( 3600 <= static_cast<unsigned>(mnOrientation) )
+ if( mnOrientation < Degree10(0) || mnOrientation >= Degree10(3600) )
{
- if( mnOrientation >= 0 )
- mnOrientation %= 3600;
+ if( mnOrientation >= Degree10(0) )
+ mnOrientation %= Degree10(3600);
else
- mnOrientation = 3600 - (-mnOrientation % 3600);
+ mnOrientation = Degree10(3600) - (-mnOrientation % Degree10(3600));
}
// normalize width and height
@@ -99,7 +99,7 @@ size_t FontSelectPattern::hashCode() const
nHash += 11U * mnHeight;
nHash += 19 * GetWeight();
nHash += 29 * GetItalic();
- nHash += 37 * mnOrientation;
+ nHash += 37 * mnOrientation.get();
nHash += 41 * static_cast<sal_uInt16>(meLanguage);
if( mbVertical )
nHash += 53;
diff --git a/vcl/source/gdi/TypeSerializer.cxx b/vcl/source/gdi/TypeSerializer.cxx
index ad5f3e3a6dc2..0b1b53372030 100644
--- a/vcl/source/gdi/TypeSerializer.cxx
+++ b/vcl/source/gdi/TypeSerializer.cxx
@@ -58,7 +58,7 @@ void TypeSerializer::readGradient(Gradient& rGradient)
rGradient.SetStyle(static_cast<GradientStyle>(nStyle));
rGradient.SetStartColor(aStartColor);
rGradient.SetEndColor(aEndColor);
- rGradient.SetAngle(nAngle);
+ rGradient.SetAngle(Degree10(nAngle));
rGradient.SetBorder(nBorder);
rGradient.SetOfsX(nOffsetX);
rGradient.SetOfsY(nOffsetY);
@@ -74,7 +74,7 @@ void TypeSerializer::writeGradient(const Gradient& rGradient)
mrStream.WriteUInt16(static_cast<sal_uInt16>(rGradient.GetStyle()));
writeColor(rGradient.GetStartColor());
writeColor(rGradient.GetEndColor());
- mrStream.WriteUInt16(rGradient.GetAngle());
+ mrStream.WriteUInt16(rGradient.GetAngle().get());
mrStream.WriteUInt16(rGradient.GetBorder());
mrStream.WriteUInt16(rGradient.GetOfsX());
mrStream.WriteUInt16(rGradient.GetOfsY());
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index 9e411aa02029..14733bf4b64a 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -383,7 +383,7 @@ bool BitmapEx::Scale( const Size& rNewSize, BmpScaleFlag nScaleFlag )
return bRet;
}
-bool BitmapEx::Rotate( tools::Long nAngle10, const Color& rFillColor )
+bool BitmapEx::Rotate( Degree10 nAngle10, const Color& rFillColor )
{
bool bRet = false;
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 18a45ea92dad..40c1d7aba529 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -819,17 +819,17 @@ void GDIMetaFile::ImplAddGradientEx( GDIMetaFile& rMtf,
}
}
-void GDIMetaFile::Rotate( tools::Long nAngle10 )
+void GDIMetaFile::Rotate( Degree10 nAngle10 )
{
- nAngle10 %= 3600;
- nAngle10 = ( nAngle10 < 0 ) ? ( 3599 + nAngle10 ) : nAngle10;
+ nAngle10 %= Degree10(3600);
+ nAngle10 = ( nAngle10 < Degree10(0) ) ? ( Degree10(3599) + nAngle10 ) : nAngle10;
if( !nAngle10 )
return;
GDIMetaFile aMtf;
ScopedVclPtrInstance< VirtualDevice > aMapVDev;
- const double fAngle = F_PI1800 * nAngle10;
+ const double fAngle = F_PI1800 * nAngle10.get();
const double fSin = sin( fAngle );
const double fCos = cos( fAngle );
tools::Rectangle aRect( Point(), GetPrefSize() );
@@ -1148,7 +1148,7 @@ void GDIMetaFile::Rotate( tools::Long nAngle10 )
MetaHatchAction* pAct = static_cast<MetaHatchAction*>(pAction);
Hatch aHatch( pAct->GetHatch() );
- aHatch.SetAngle( aHatch.GetAngle() + static_cast<sal_uInt16>(nAngle10) );
+ aHatch.SetAngle( aHatch.GetAngle() + nAngle10 );
aMtf.AddAction( new MetaHatchAction( ImplGetRotatedPolyPolygon( pAct->GetPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ),
aHatch ) );
}
@@ -1236,7 +1236,7 @@ void GDIMetaFile::Rotate( tools::Long nAngle10 )
MetaFontAction* pAct = static_cast<MetaFontAction*>(pAction);
vcl::Font aFont( pAct->GetFont() );
- aFont.SetOrientation( aFont.GetOrientation() + static_cast<sal_uInt16>(nAngle10) );
+ aFont.SetOrientation( aFont.GetOrientation() + nAngle10 );
aMtf.AddAction( new MetaFontAction( aFont ) );
}
break;
diff --git a/vcl/source/gdi/gradient.cxx b/vcl/source/gdi/gradient.cxx
index ac826f985cdd..b5c331e6953c 100644
--- a/vcl/source/gdi/gradient.cxx
+++ b/vcl/source/gdi/gradient.cxx
@@ -26,7 +26,7 @@ public:
GradientStyle meStyle;
Color maStartColor;
Color maEndColor;
- sal_uInt16 mnAngle;
+ Degree10 mnAngle;
sal_uInt16 mnBorder;
sal_uInt16 mnOfsX;
sal_uInt16 mnOfsY;
@@ -125,12 +125,12 @@ void Gradient::SetEndColor( const Color& rColor )
mpImplGradient->maEndColor = rColor;
}
-sal_uInt16 Gradient::GetAngle() const
+Degree10 Gradient::GetAngle() const
{
return mpImplGradient->mnAngle;
}
-void Gradient::SetAngle( sal_uInt16 nAngle )
+void Gradient::SetAngle( Degree10 nAngle )
{
mpImplGradient->mnAngle = nAngle;
}
@@ -198,11 +198,11 @@ void Gradient::SetSteps( sal_uInt16 nSteps )
void Gradient::GetBoundRect( const tools::Rectangle& rRect, tools::Rectangle& rBoundRect, Point& rCenter ) const
{
tools::Rectangle aRect( rRect );
- sal_uInt16 nAngle = GetAngle() % 3600;
+ Degree10 nAngle = GetAngle() % Degree10(3600);
if( GetStyle() == GradientStyle::Linear || GetStyle() == GradientStyle::Axial )
{
- const double fAngle = nAngle * F_PI1800;
+ const double fAngle = nAngle.get() * F_PI1800;
const double fWidth = aRect.GetWidth();
const double fHeight = aRect.GetHeight();
double fDX = fWidth * fabs( cos( fAngle ) ) +
@@ -223,7 +223,7 @@ void Gradient::GetBoundRect( const tools::Rectangle& rRect, tools::Rectangle& rB
{
if( GetStyle() == GradientStyle::Square || GetStyle() == GradientStyle::Rect )
{
- const double fAngle = nAngle * F_PI1800;
+ const double fAngle = nAngle.get() * F_PI1800;
const double fWidth = aRect.GetWidth();
const double fHeight = aRect.GetHeight();
double fDX = fWidth * fabs( cos( fAngle ) ) + fHeight * fabs( sin( fAngle ) );
diff --git a/vcl/source/gdi/hatch.cxx b/vcl/source/gdi/hatch.cxx
index 5d139b0a079e..353b8cbd01dd 100644
--- a/vcl/source/gdi/hatch.cxx
+++ b/vcl/source/gdi/hatch.cxx
@@ -43,7 +43,7 @@ Hatch::Hatch() = default;
Hatch::Hatch( const Hatch& ) = default;
Hatch::Hatch( HatchStyle eStyle, const Color& rColor,
- tools::Long nDistance, sal_uInt16 nAngle10 ) : mpImplHatch()
+ tools::Long nDistance, Degree10 nAngle10 ) : mpImplHatch()
{
mpImplHatch->maColor = rColor;
mpImplHatch->meStyle = eStyle;
@@ -71,7 +71,7 @@ void Hatch::SetDistance( tools::Long nDistance )
mpImplHatch->mnDistance = nDistance;
}
-void Hatch::SetAngle( sal_uInt16 nAngle10 )
+void Hatch::SetAngle( Degree10 nAngle10 )
{
mpImplHatch->mnAngle = nAngle10;
}
@@ -88,8 +88,9 @@ SvStream& ReadHatch( SvStream& rIStm, Hatch& rHatch )
tools::GenericTypeSerializer aSerializer(rIStm);
aSerializer.readColor(rHatch.mpImplHatch->maColor);
rIStm.ReadInt32(nTmp32);
- rIStm.ReadUInt16(rHatch.mpImplHatch->mnAngle);
rHatch.mpImplHatch->mnDistance = nTmp32;
+ rIStm.ReadUInt16(nTmp16);
+ rHatch.mpImplHatch->mnAngle = Degree10(nTmp16);
return rIStm;
}
@@ -102,7 +103,7 @@ SvStream& WriteHatch( SvStream& rOStm, const Hatch& rHatch )
tools::GenericTypeSerializer aSerializer(rOStm);
aSerializer.writeColor(rHatch.mpImplHatch->maColor);
- rOStm.WriteInt32( rHatch.mpImplHatch->mnDistance ).WriteUInt16( rHatch.mpImplHatch->mnAngle );
+ rOStm.WriteInt32( rHatch.mpImplHatch->mnDistance ).WriteUInt16( rHatch.mpImplHatch->mnAngle.get() );
return rOStm;
}
diff --git a/vcl/source/gdi/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx
index 229cecda695a..5e80e3f229f5 100644
--- a/vcl/source/gdi/mtfxmldump.cxx
+++ b/vcl/source/gdi/mtfxmldump.cxx
@@ -485,7 +485,7 @@ void writeGradient(tools::XmlWriter& rWriter, Gradient const& rGradient)
rWriter.attribute("style", convertGradientStyle(rGradient.GetStyle()));
rWriter.attribute("startcolor", convertColorToString(rGradient.GetStartColor()));
rWriter.attribute("endcolor", convertColorToString(rGradient.GetEndColor()));
- rWriter.attribute("angle", rGradient.GetAngle());
+ rWriter.attribute("angle", rGradient.GetAngle().get());
rWriter.attribute("border", rGradient.GetBorder());
rWriter.attribute("offsetx", rGradient.GetOfsX());
rWriter.attribute("offsety", rGradient.GetOfsY());
@@ -963,7 +963,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& r
rWriter.attribute("style", convertHatchStyle(rHatch.GetStyle()));
rWriter.attribute("color", convertColorToString(rHatch.GetColor()));
rWriter.attribute("distance", sal_Int32(rHatch.GetDistance()));
- rWriter.attribute("angle", sal_Int32(rHatch.GetAngle()));
+ rWriter.attribute("angle", sal_Int32(rHatch.GetAngle().get()));
rWriter.endElement();
rWriter.endElement();
@@ -1144,7 +1144,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& r
rWriter.attribute("stylename", aFont.GetStyleName());
rWriter.attribute("width", aFont.GetFontSize().Width());
rWriter.attribute("height", aFont.GetFontSize().Height());
- rWriter.attribute("orientation", aFont.GetOrientation());
+ rWriter.attribute("orientation", aFont.GetOrientation().get());
rWriter.attribute("weight", convertFontWeightToString(aFont.GetWeight()));
rWriter.attribute("vertical", aFont.IsVertical() ? "true" : "false");
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index a3390cca44f7..592638222b2c 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6060,12 +6060,12 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
fXScale *= double(m_aCurrentPDFState.m_aMapMode.GetScaleX()) / double(m_aCurrentPDFState.m_aMapMode.GetScaleY());
}
- int nAngle = m_aCurrentPDFState.m_aFont.GetOrientation();
+ Degree10 nAngle = m_aCurrentPDFState.m_aFont.GetOrientation();
// normalize angles
- while( nAngle < 0 )
- nAngle += 3600;
- nAngle = nAngle % 3600;
- double fAngle = static_cast<double>(nAngle) * M_PI / 1800.0;
+ while( nAngle < Degree10(0) )
+ nAngle += Degree10(3600);
+ nAngle = nAngle % Degree10(3600);
+ double fAngle = static_cast<double>(nAngle.get()) * M_PI / 1800.0;
Matrix3 aRotScale;
aRotScale.scale( fXScale, 1.0 );
@@ -7155,7 +7155,7 @@ void PDFWriterImpl::drawTextLine( const Point& rPos, tools::Long nWidth, FontStr
aLine.append( "q " );
// rotate and translate matrix
- double fAngle = static_cast<double>(m_aCurrentPDFState.m_aFont.GetOrientation()) * M_PI / 1800.0;
+ double fAngle = static_cast<double>(m_aCurrentPDFState.m_aFont.GetOrientation().get()) * M_PI / 1800.0;
Matrix3 aMat;
aMat.rotate( fAngle );
aMat.translate( aPos.X(), aPos.Y() );
@@ -8300,7 +8300,7 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit const & rObject )
tools::Rectangle aBoundRect;
Point aCenter;
- sal_uInt16 nAngle = rObject.m_aGradient.GetAngle() % 3600;
+ Degree10 nAngle = rObject.m_aGradient.GetAngle() % Degree10(3600);
rObject.m_aGradient.GetBoundRect( aRect, aBoundRect, aCenter );
const bool bLinear = (rObject.m_aGradient.GetStyle() == GradientStyle::Linear);
@@ -8326,7 +8326,7 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit const & rObject )
tools::Polygon aPoly( 2 );
aPoly[0] = aBoundRect.BottomCenter();
aPoly[1] = aBoundRect.TopCenter();
- aPoly.Rotate( aCenter, 3600 - nAngle );
+ aPoly.Rotate( aCenter, Degree10(3600) - nAngle );
aLine.append( static_cast<sal_Int32>(aPoly[0].X()) );
aLine.append( " " );
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 95cf5d891521..16fa84ab95d5 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -562,17 +562,17 @@ Point SalLayout::GetDrawPosition( const Point& rRelative ) const
Point aPos = maDrawBase;
Point aOfs = rRelative + maDrawOffset;
- if( mnOrientation == 0 )
+ if( mnOrientation == Degree10(0) )
aPos += aOfs;
else
{
// cache trigonometric results
- static int nOldOrientation = 0;
+ static Degree10 nOldOrientation(0);
static double fCos = 1.0, fSin = 0.0;
if( nOldOrientation != mnOrientation )
{
nOldOrientation = mnOrientation;
- double fRad = mnOrientation * (M_PI / 1800.0);
+ double fRad = mnOrientation.get() * (M_PI / 1800.0);
fCos = cos( fRad );
fSin = sin( fRad );
}
diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index d0b1ac953d80..2af54eabf368 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -657,7 +657,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
aFont.SetItalic( bItalic ? ITALIC_NORMAL : ITALIC_NONE );
aFont.SetOutline( bOutline );
aFont.SetShadow( bShadow );
- aFont.SetOrientation( nLineOrient );
+ aFont.SetOrientation( Degree10(nLineOrient) );
aFont.SetTransparent( bTransparent );
eActualCharSet = aFont.GetCharSet();
@@ -1055,7 +1055,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
Gradient aGrad( static_cast<GradientStyle>(nStyle), aStartCol, aEndCol );
- aGrad.SetAngle( nAngle );
+ aGrad.SetAngle( Degree10(nAngle) );
aGrad.SetBorder( nBorder );
aGrad.SetOfsX( nOfsX );
aGrad.SetOfsY( nOfsY );
diff --git a/vcl/source/gdi/wall.cxx b/vcl/source/gdi/wall.cxx
index 5170134cc24c..2300a8f8ad23 100644
--- a/vcl/source/gdi/wall.cxx
+++ b/vcl/source/gdi/wall.cxx
@@ -288,7 +288,7 @@ bool Wallpaper::IsGradient() const
Gradient Wallpaper::ImplGetApplicationGradient()
{
Gradient g;
- g.SetAngle( 900 );
+ g.SetAngle( Degree10(900) );
g.SetStyle( GradientStyle::Linear );
g.SetStartColor( Application::GetSettings().GetStyleSettings().GetFaceColor() );
// no 'extreme' gradient when high contrast
diff --git a/vcl/source/graphic/GraphicObject.cxx b/vcl/source/graphic/GraphicObject.cxx
index 415e42e3313a..aa8b5a3169b7 100644
--- a/vcl/source/graphic/GraphicObject.cxx
+++ b/vcl/source/graphic/GraphicObject.cxx
@@ -110,7 +110,7 @@ bool lclDrawObj( OutputDevice* pOut, const Point& rPt, const Size& rSz,
if( aGraphic.IsSupportedGraphic() )
{
- const sal_uInt16 nRot10 = rAttr.GetRotation() % 3600;
+ const Degree10 nRot10 = rAttr.GetRotation() % Degree10(3600);
if( nRot10 )
{
@@ -353,7 +353,7 @@ bool GraphicObject::ImplGetCropParams( OutputDevice const * pOut, Point& rPt, Si
if( GetType() != GraphicType::NONE )
{
tools::Polygon aClipPoly( tools::Rectangle( rPt, rSz ) );
- const sal_uInt16 nRot10 = pAttr->GetRotation() % 3600;
+ const Degree10 nRot10 = pAttr->GetRotation() % Degree10(3600);
const Point aOldOrigin( rPt );
const MapMode aMap100( MapUnit::Map100thMM );
Size aSize100;
diff --git a/vcl/source/graphic/GraphicObject2.cxx b/vcl/source/graphic/GraphicObject2.cxx
index d858b47b8f34..4153ff47a6ea 100644
--- a/vcl/source/graphic/GraphicObject2.cxx
+++ b/vcl/source/graphic/GraphicObject2.cxx
@@ -484,7 +484,7 @@ void GraphicObject::ImplTransformBitmap( BitmapEx& rBmpEx,
const Size aSizePixel( rBmpEx.GetSizePixel() );
- if( rAttr.GetRotation() == 0 || IsAnimated() )
+ if( rAttr.GetRotation() == Degree10(0) || IsAnimated() )
return;
if( !(aSizePixel.Width() && aSizePixel.Height() && rDstSize.Width() && rDstSize.Height()) )
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 10c7f0d164d2..6ba48c1699d5 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -1434,7 +1434,7 @@ void OutputDevice::DrawTransformedBitmapEx(
{
fFullRotate += F_2PI;
}
- tools::Long nAngle10 = basegfx::fround(basegfx::rad2deg(fFullRotate) * 10);
+ Degree10 nAngle10(basegfx::fround(basegfx::rad2deg(fFullRotate) * 10));
aTransformed.Rotate(nAngle10, COL_TRANSPARENT);
}
basegfx::B2DRange aTargetRange(0.0, 0.0, 1.0, 1.0);
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 9d4883ccea8d..a5301e3a594a 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -1033,7 +1033,7 @@ bool OutputDevice::ImplNewFont() const
// get metric data from device layers
pFontInstance->mbInit = true;
- pFontInstance->mxFontMetric->SetOrientation( sal::static_int_cast<short>(mpFontInstance->GetFontSelectPattern().mnOrientation) );
+ pFontInstance->mxFontMetric->SetOrientation( mpFontInstance->GetFontSelectPattern().mnOrientation );
mpGraphics->GetFontMetric( pFontInstance->mxFontMetric, 0 );
pFontInstance->mxFontMetric->ImplInitTextLineSize( this );
@@ -1123,7 +1123,7 @@ void OutputDevice::SetFontOrientation( LogicalFontInstance* const pFontInstance
{
if( pFontInstance->GetFontSelectPattern().mnOrientation && !pFontInstance->mxFontMetric->GetOrientation() )
{
- pFontInstance->mnOwnOrientation = sal::static_int_cast<short>(pFontInstance->GetFontSelectPattern().mnOrientation);
+ pFontInstance->mnOwnOrientation = pFontInstance->GetFontSelectPattern().mnOrientation;
pFontInstance->mnOrientation = pFontInstance->mnOwnOrientation;
}
else
diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx
index 0acd89dfdb18..d67430da187d 100644
--- a/vcl/source/outdev/gradient.cxx
+++ b/vcl/source/outdev/gradient.cxx
@@ -264,7 +264,7 @@ void OutputDevice::DrawLinearGradient( const tools::Rectangle& rRect,
// get BoundRect of rotated rectangle
tools::Rectangle aRect;
Point aCenter;
- sal_uInt16 nAngle = rGradient.GetAngle() % 3600;
+ Degree10 nAngle = rGradient.GetAngle() % Degree10(3600);
rGradient.GetBoundRect( rRect, aRect, aCenter );
@@ -469,7 +469,7 @@ void OutputDevice::DrawComplexGradient( const tools::Rectangle& rRect,
tools::Long nRedSteps = nEndRed - nStartRed;
tools::Long nGreenSteps = nEndGreen - nStartGreen;
tools::Long nBlueSteps = nEndBlue - nStartBlue;
- sal_uInt16 nAngle = rGradient.GetAngle() % 3600;
+ Degree10 nAngle = rGradient.GetAngle() % Degree10(3600);
rGradient.GetBoundRect( rRect, aRect, aCenter );
@@ -622,7 +622,7 @@ void OutputDevice::DrawLinearGradientToMetafile( const tools::Rectangle& rRect,
// get BoundRect of rotated rectangle
tools::Rectangle aRect;
Point aCenter;
- sal_uInt16 nAngle = rGradient.GetAngle() % 3600;
+ Degree10 nAngle = rGradient.GetAngle() % Degree10(3600);
rGradient.GetBoundRect( rRect, aRect, aCenter );
@@ -819,7 +819,7 @@ void OutputDevice::DrawComplexGradientToMetafile( const tools::Rectangle& rRect,
tools::Long nRedSteps = nEndRed - nStartRed;
tools::Long nGreenSteps = nEndGreen - nStartGreen;
tools::Long nBlueSteps = nEndBlue - nStartBlue;
- sal_uInt16 nAngle = rGradient.GetAngle() % 3600;
+ Degree10 nAngle = rGradient.GetAngle() % Degree10(3600);
rGradient.GetBoundRect( rRect, aRect, aCenter );
diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx
index 4ee38bff1aa2..bb2cb67cb1ac 100644
--- a/vcl/source/outdev/hatch.cxx
+++ b/vcl/source/outdev/hatch.cxx
@@ -186,7 +186,7 @@ void OutputDevice::DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch&
if( ( rHatch.GetStyle() == HatchStyle::Double ) || ( rHatch.GetStyle() == HatchStyle::Triple ) )
{
// Double hatch
- CalcHatchValues( aRect, nWidth, rHatch.GetAngle() + 900, aPt1, aPt2, aInc, aEndPt1 );
+ CalcHatchValues( aRect, nWidth, rHatch.GetAngle() + Degree10(900), aPt1, aPt2, aInc, aEndPt1 );
do
{
DrawHatchLine( tools::Line( aPt1, aPt2 ), rPolyPoly, pPtBuffer.get(), bMtf );
@@ -198,7 +198,7 @@ void OutputDevice::DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch&
if( rHatch.GetStyle() == HatchStyle::Triple )
{
// Triple hatch
- CalcHatchValues( aRect, nWidth, rHatch.GetAngle() + 450, aPt1, aPt2, aInc, aEndPt1 );
+ CalcHatchValues( aRect, nWidth, rHatch.GetAngle() + Degree10(450), aPt1, aPt2, aInc, aEndPt1 );
do
{
DrawHatchLine( tools::Line( aPt1, aPt2 ), rPolyPoly, pPtBuffer.get(), bMtf );
@@ -211,19 +211,19 @@ void OutputDevice::DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch&
}
}
-void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long nDist, sal_uInt16 nAngle10,
+void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long nDist, Degree10 nAngle10,
Point& rPt1, Point& rPt2, Size& rInc, Point& rEndPt1 )
{
Point aRef;
- tools::Long nAngle = nAngle10 % 1800;
+ Degree10 nAngle = nAngle10 % Degree10(1800);
tools::Long nOffset = 0;
- if( nAngle > 900 )
- nAngle -= 1800;
+ if( nAngle > Degree10(900) )
+ nAngle -= Degree10(1800);
aRef = ( !IsRefPoint() ? rRect.TopLeft() : GetRefPoint() );
- if( 0 == nAngle )
+ if( Degree10(0) == nAngle )
{
rInc = Size( 0, nDist );
rPt1 = rRect.TopLeft();
@@ -238,7 +238,7 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long n
rPt1.AdjustY( -nOffset );
rPt2.AdjustY( -nOffset );
}
- else if( 900 == nAngle )
+ else if( Degree10(900) == nAngle )
{
rInc = Size( nDist, 0 );
rPt1 = rRect.TopLeft();
@@ -253,9 +253,9 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long n
rPt1.AdjustX( -nOffset );
rPt2.AdjustX( -nOffset );
}
- else if( nAngle >= -450 && nAngle <= 450 )
+ else if( nAngle >= Degree10(-450) && nAngle <= Degree10(450) )
{
- const double fAngle = F_PI1800 * labs( nAngle );
+ const double fAngle = F_PI1800 * labs( nAngle.get() );
const double fTan = tan( fAngle );
const tools::Long nYOff = FRound( ( rRect.Right() - rRect.Left() ) * fTan );
tools::Long nPY;
@@ -263,7 +263,7 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long n
nDist = FRound( nDist / cos( fAngle ) );
rInc = Size( 0, nDist );
- if( nAngle > 0 )
+ if( nAngle > Degree10(0) )
{
rPt1 = rRect.TopLeft();
rPt2 = Point( rRect.Right(), rRect.Top() - nYOff );
@@ -288,7 +288,7 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long n
}
else
{
- const double fAngle = F_PI1800 * labs( nAngle );
+ const double fAngle = F_PI1800 * labs( nAngle.get() );
const double fTan = tan( fAngle );
const tools::Long nXOff = FRound( ( rRect.Bottom() - rRect.Top() ) / fTan );
tools::Long nPX;
@@ -296,7 +296,7 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long n
nDist = FRound( nDist / sin( fAngle ) );
rInc = Size( nDist, 0 );
- if( nAngle > 0 )
+ if( nAngle > Degree10(0) )
{
rPt1 = rRect.TopLeft();
rPt2 = Point( rRect.Left() - nXOff, rRect.Bottom() );
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 5c4b355c2536..8573affbae99 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -89,13 +89,13 @@ void OutputDevice::ImplDrawTextRect( tools::Long nBaseX, tools::Long nBaseY,
tools::Long nX = nDistX;
tools::Long nY = nDistY;
- short nOrientation = mpFontInstance->mnOrientation;
+ Degree10 nOrientation = mpFontInstance->mnOrientation;
if ( nOrientation )
{
// Rotate rect without rounding problems for 90 degree rotations
- if ( !(nOrientation % 900) )
+ if ( !(nOrientation % Degree10(900)) )
{
- if ( nOrientation == 900 )
+ if ( nOrientation == Degree10(900) )
{
tools::Long nTemp = nX;
nX = nY;
@@ -105,7 +105,7 @@ void OutputDevice::ImplDrawTextRect( tools::Long nBaseX, tools::Long nBaseY,
nHeight = nTemp;
nY -= nHeight;
}
- else if ( nOrientation == 1800 )
+ else if ( nOrientation == Degree10(1800) )
{
nX = -nX;
nY = -nY;
@@ -176,7 +176,7 @@ tools::Rectangle OutputDevice::ImplGetTextBoundRect( const SalLayout& rSalLayout
if ( mpFontInstance->mnOrientation )
{
tools::Long nBaseX = nX, nBaseY = nY;
- if ( !(mpFontInstance->mnOrientation % 900) )
+ if ( !(mpFontInstance->mnOrientation % Degree10(900)) )
{
tools::Long nX2 = nX+nWidth;
tools::Long nY2 = nY+nHeight;
@@ -228,7 +228,7 @@ bool OutputDevice::ImplDrawRotateText( SalLayout& rSalLayout )
const FontSelectPattern& rPattern = mpFontInstance->GetFontSelectPattern();
vcl::Font aFont( GetFont() );
- aFont.SetOrientation( 0 );
+ aFont.SetOrientation( Degree10(0) );
aFont.SetFontSize( Size( rPattern.mnWidth, rPattern.mnHeight ) );
pVDev->SetFont( aFont );
pVDev->SetTextColor( COL_BLACK );
@@ -1241,7 +1241,7 @@ ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( OUString& rStr,
// set layout options
ImplLayoutArgs aLayoutArgs(rStr, nMinIndex, nEndIndex, nLayoutFlags, maFont.GetLanguageTag(), pLayoutCache);
- int nOrientation = mpFontInstance ? mpFontInstance->mnOrientation : 0;
+ Degree10 nOrientation = mpFontInstance ? mpFontInstance->mnOrientation : Degree10(0);
aLayoutArgs.SetOrientation( nOrientation );
aLayoutArgs.SetLayoutWidth( nPixelWidth );
diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx
index eb716ebdb49f..09ee52f6339a 100644
--- a/vcl/source/outdev/textline.cxx
+++ b/vcl/source/outdev/textline.cxx
@@ -49,7 +49,7 @@ void OutputDevice::ImplInitAboveTextLineSize()
void OutputDevice::ImplDrawWavePixel( tools::Long nOriginX, tools::Long nOriginY,
tools::Long nCurX, tools::Long nCurY,
- short nOrientation,
+ Degree10 nOrientation,
SalGraphics* pGraphics,
OutputDevice const * pOutDev,
bool bDrawPixAsRect,
@@ -75,7 +75,7 @@ void OutputDevice::ImplDrawWavePixel( tools::Long nOriginX, tools::Long nOriginY
void OutputDevice::ImplDrawWaveLine( tools::Long nBaseX, tools::Long nBaseY,
tools::Long nDistX, tools::Long nDistY,
tools::Long nWidth, tools::Long nHeight,
- tools::Long nLineWidth, short nOrientation,
+ tools::Long nLineWidth, Degree10 nOrientation,
const Color& rColor )
{
if ( !nHeight )
@@ -678,7 +678,7 @@ void OutputDevice::ImplDrawTextLine( tools::Long nX, tools::Long nY,
{
tools::Long nXAdd = nWidth - nDistX;
if( mpFontInstance->mnOrientation )
- nXAdd = FRound( nXAdd * cos( mpFontInstance->mnOrientation * F_PI1800 ) );
+ nXAdd = FRound( nXAdd * cos( mpFontInstance->mnOrientation.get() * F_PI1800 ) );
nX += nXAdd - 1;
}
@@ -750,7 +750,7 @@ void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout, FontStrikeout eStri
if( mpFontInstance->mnOrientation )
{
const tools::Long nDY = aPos.Y() - aStartPt.Y();
- const double fRad = mpFontInstance->mnOrientation * F_PI1800;
+ const double fRad = mpFontInstance->mnOrientation.get() * F_PI1800;
nDist = FRound( nDist*cos(fRad) - nDY*sin(fRad) );
}
}
@@ -972,7 +972,7 @@ void OutputDevice::DrawWaveLine(const Point& rStartPos, const Point& rEndPos, to
fOrientation = std::atan2(nStartY - nEndY, (nLengthX == 0 ? 0.000000001 : nLengthX));
fOrientation /= F_PI180;
// un-rotate the end point
- aStartPt.RotateAround(nEndX, nEndY, -fOrientation * 10.0);
+ aStartPt.RotateAround(nEndX, nEndY, Degree10(static_cast<sal_Int16>(-fOrientation * 10.0)));
}
tools::Long nWaveHeight = 3;
diff --git a/vcl/source/window/cursor.cxx b/vcl/source/window/cursor.cxx
index e80ba8d42b52..18773be22698 100644
--- a/vcl/source/window/cursor.cxx
+++ b/vcl/source/window/cursor.cxx
@@ -36,7 +36,7 @@ struct ImplCursorData
Point maPixPos; // Pixel-Position
Point maPixRotOff; // Pixel-Offset-Position
Size maPixSize; // Pixel-Size
- short mnOrientation; // Pixel-Orientation
+ Degree10 mnOrientation; // Pixel-Orientation
CursorDirection mnDirection; // indicates writing direction
sal_uInt16 mnStyle; // Cursor-Style
bool mbCurVisible; // Is cursor currently visible
@@ -332,7 +332,7 @@ vcl::Cursor::Cursor()
{
mpData = nullptr;
mpWindow = nullptr;
- mnOrientation = 0;
+ mnOrientation = Degree10(0);
mnDirection = CursorDirection::NONE;
mnStyle = 0;
mbVisible = false;
@@ -419,7 +419,7 @@ void vcl::Cursor::SetWidth( tools::Long nNewWidth )
}
}
-void vcl::Cursor::SetOrientation( short nNewOrientation )
+void vcl::Cursor::SetOrientation( Degree10 nNewOrientation )
{
if ( mnOrientation != nNewOrientation )
{
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 0212f7da0e5f..88516e9f320b 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -188,7 +188,7 @@ void PrintDialog::PrintPreviewWindow::Paint(vcl::RenderContext& rRenderContext,
{
rRenderContext.Push(PushFlags::FONT);
vcl::Font aFont(rRenderContext.GetFont());
- aFont.SetOrientation(900);
+ aFont.SetOrientation(Degree10(900));
rRenderContext.SetFont(aFont);
auto nLeft = aOffset.X() - nTextHeight;
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 344f60d175eb..ae9afe30250f 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -314,7 +314,7 @@ void ToolBox::ImplDrawGradientBackground(vcl::RenderContext& rRenderContext)
startCol = endCol;
Gradient g;
- g.SetAngle(mbHorz ? 0 : 900);
+ g.SetAngle(Degree10(mbHorz ? 0 : 900));
g.SetStyle(GradientStyle::Linear);
g.SetStartColor(startCol);
@@ -1147,7 +1147,7 @@ void ToolBox::ImplInitToolBoxData()
meTextPosition = ToolBoxTextPosition::Right;
mnLastFocusItemId = 0;
mnActivateCount = 0;
- mnImagesRotationAngle = 0;
+ mnImagesRotationAngle = Degree10(0);
mpStatusListener = new VclStatusListener<ToolBox>(this, ".uno:ImageOrientation");
mpStatusListener->startListening();
@@ -2716,7 +2716,7 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, ImplToolItems::si
bRotate = true;
vcl::Font aRotateFont = aOldFont;
- aRotateFont.SetOrientation( 2700 );
+ aRotateFont.SetOrientation( Degree10(2700) );
// center horizontally
nTextOffX += aTxtSize.Height();
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 59b7bbbbb01e..56abd3cea7ae 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -94,7 +94,7 @@ void ImplToolItem::init(sal_uInt16 nItemId, ToolBoxItemBits nItemBits,
mbBreak = false;
mnSepSize = TB_SEP_SIZE;
mnDropDownArrowWidth = TB_DROPDOWNARROWWIDTH;
- mnImageAngle = 0;
+ mnImageAngle = Degree10(0);
mbMirrorMode = false;
mbVisibleText = false;
mbExpand = false;
@@ -959,7 +959,7 @@ void ToolBox::SetItemImage( sal_uInt16 nItemId, const Image& rImage )
}
}
-static Image ImplRotImage( const Image& rImage, tools::Long nAngle10 )
+static Image ImplRotImage( const Image& rImage, Degree10 nAngle10 )
{
BitmapEx aRotBitmapEx( rImage.GetBitmapEx() );
@@ -968,7 +968,7 @@ static Image ImplRotImage( const Image& rImage, tools::Long nAngle10 )
return Image( aRotBitmapEx );
}
-void ToolBox::SetItemImageAngle( sal_uInt16 nItemId, tools::Long nAngle10 )
+void ToolBox::SetItemImageAngle( sal_uInt16 nItemId, Degree10 nAngle10 )
{
ImplToolItems::size_type nPos = GetItemPos( nItemId );
@@ -978,9 +978,9 @@ void ToolBox::SetItemImageAngle( sal_uInt16 nItemId, tools::Long nAngle10 )
ImplToolItem* pItem = &mpData->m_aItems[nPos];
Size aOldSize = pItem->maImage.GetSizePixel();
- tools::Long nDeltaAngle = (nAngle10 - pItem->mnImageAngle) % 3600;
- while( nDeltaAngle < 0 )
- nDeltaAngle += 3600;
+ Degree10 nDeltaAngle = (nAngle10 - pItem->mnImageAngle) % Degree10(3600);
+ while( nDeltaAngle < Degree10(0) )
+ nDeltaAngle += Degree10(3600);
pItem->mnImageAngle = nAngle10;
if( nDeltaAngle && !!pItem->maImage )