summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-11-19 00:22:31 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-11-19 15:42:03 +0100
commitbc0ab08634f59e1a1814e575fe6ad5e50bf1aee1 (patch)
tree8691eec1adefd9e4def8245898e8a3e5c5542037
parent168ae4c00a86b7534dedd303f9ef008e19822b99 (diff)
Drop F_PI1800/F_PI18000, and unify deg2rad/rad2deg conversions
Change-Id: Ib89b00c3dc8cd440e8a88906eea133becd1cef64 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125509 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
-rw-r--r--canvas/source/cairo/cairo_canvashelper_text.cxx2
-rw-r--r--canvas/source/vcl/canvashelper.cxx2
-rw-r--r--canvas/source/vcl/canvashelper_texturefill.cxx2
-rw-r--r--canvas/source/vcl/impltools.cxx2
-rw-r--r--chart2/source/view/main/ShapeFactory.cxx4
-rw-r--r--chart2/source/view/main/VTitle.cxx2
-rw-r--r--cppcanvas/source/mtfrenderer/implrenderer.cxx6
-rw-r--r--drawinglayer/source/primitive2d/textlayoutdevice.cxx2
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx4
-rw-r--r--drawinglayer/source/processor2d/vclpixelprocessor2d.cxx6
-rw-r--r--drawinglayer/source/tools/wmfemfhelper.cxx8
-rw-r--r--editeng/source/editeng/impedit3.cxx4
-rw-r--r--editeng/source/outliner/outliner.cxx2
-rw-r--r--filter/source/msfilter/eschesdo.cxx10
-rw-r--r--filter/source/msfilter/msdffimp.cxx6
-rw-r--r--filter/source/msfilter/svdfppt.cxx3
-rw-r--r--include/basegfx/numeric/ftools.hxx16
-rw-r--r--include/svx/svdtrans.hxx13
-rw-r--r--include/tools/degree.hxx7
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx4
-rw-r--r--oox/source/export/drawingml.cxx4
-rw-r--r--sc/qa/unit/ucalc.cxx4
-rw-r--r--sc/source/core/data/column2.cxx4
-rw-r--r--sc/source/core/data/table2.cxx2
-rw-r--r--sc/source/filter/excel/xichart.cxx2
-rw-r--r--sd/source/filter/eppt/epptso.cxx12
-rw-r--r--svx/source/customshapes/EnhancedCustomShape3d.cxx2
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dlathe.cxx2
-rw-r--r--svx/source/sdr/contact/viewcontactofgraphic.cxx2
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx2
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrcircobj.cxx10
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx4
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrole2obj.cxx2
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrpathobj.cxx2
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrrectobj.cxx2
-rw-r--r--svx/source/sdr/primitive2d/sdrattributecreator.cxx6
-rw-r--r--svx/source/svdraw/svddrgmt.cxx8
-rw-r--r--svx/source/svdraw/svdedtv1.cxx14
-rw-r--r--svx/source/svdraw/svdglev.cxx4
-rw-r--r--svx/source/svdraw/svdhdl.cxx2
-rw-r--r--svx/source/svdraw/svdoashp.cxx22
-rw-r--r--svx/source/svdraw/svdobj.cxx8
-rw-r--r--svx/source/svdraw/svdocirc.cxx14
-rw-r--r--svx/source/svdraw/svdomeas.cxx4
-rw-r--r--svx/source/svdraw/svdopath.cxx24
-rw-r--r--svx/source/svdraw/svdotext.cxx6
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx2
-rw-r--r--svx/source/svdraw/svdotextpathdecomposition.cxx2
-rw-r--r--svx/source/svdraw/svdpoev.cxx4
-rw-r--r--svx/source/svdraw/svdtrans.cxx9
-rw-r--r--svx/source/table/viewcontactoftableobj.cxx4
-rw-r--r--svx/source/unodraw/unoshape.cxx6
-rw-r--r--svx/source/xoutdev/xtabgrdt.cxx2
-rw-r--r--svx/source/xoutdev/xtabhtch.cxx2
-rw-r--r--sw/source/filter/ww8/docxsdrexport.cxx19
-rw-r--r--tools/source/generic/point.cxx2
-rw-r--r--tools/source/generic/poly.cxx2
-rw-r--r--tools/source/generic/poly2.cxx2
-rw-r--r--vcl/quartz/ctfonts.cxx9
-rw-r--r--vcl/skia/gdiimpl.cxx2
-rw-r--r--vcl/source/bitmap/bitmappaint.cxx4
-rw-r--r--vcl/source/gdi/gdimtf.cxx2
-rw-r--r--vcl/source/gdi/gradient.cxx4
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx2
-rw-r--r--vcl/source/outdev/hatch.cxx4
-rw-r--r--vcl/source/outdev/textline.cxx4
-rw-r--r--vcl/unx/generic/gdi/cairotextrender.cxx2
-rw-r--r--vcl/unx/generic/glyphs/freetype_glyphcache.cxx2
-rw-r--r--xmloff/source/text/XMLTextFrameContext.cxx2
-rw-r--r--xmloff/source/text/txtparae.cxx2
70 files changed, 170 insertions, 198 deletions
diff --git a/canvas/source/cairo/cairo_canvashelper_text.cxx b/canvas/source/cairo/cairo_canvashelper_text.cxx
index c5f387e27c60..5f78bb71a225 100644
--- a/canvas/source/cairo/cairo_canvashelper_text.cxx
+++ b/canvas/source/cairo/cairo_canvashelper_text.cxx
@@ -99,7 +99,7 @@ namespace cairocanvas
io_rVCLFont.SetFontHeight( ::basegfx::fround(nFontHeight * aScale.getY()) );
}
- io_rVCLFont.SetOrientation( Degree10(static_cast< sal_Int16 >( ::basegfx::fround(-fmod(nRotate, 2*M_PI)*(1800.0/M_PI)) )) );
+ io_rVCLFont.SetOrientation( Degree10( ::basegfx::fround(-basegfx::rad2deg<10>(fmod(nRotate, 2*M_PI))) ) );
// TODO(F2): Missing functionality in VCL: shearing
o_rPoint.setX( ::basegfx::fround(aTranslate.getX()) );
diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx
index 1a2f7209562f..918a8f5f97fe 100644
--- a/canvas/source/vcl/canvashelper.cxx
+++ b/canvas/source/vcl/canvashelper.cxx
@@ -792,7 +792,7 @@ namespace vclcanvas
// degrees with the orientation reversed: [0,2Pi) ->
// (3600,0]. Note that the original angle may have
// values outside the [0,2Pi) interval.
- const double nAngleInTenthOfDegrees (3600.0 - nRotate * 3600.0 / (2*M_PI));
+ const double nAngleInTenthOfDegrees (3600.0 - basegfx::rad2deg<10>(nRotate));
aGrfAttr.SetRotation( Degree10(::basegfx::fround(nAngleInTenthOfDegrees)) );
pGrfObj = std::make_shared<GraphicObject>( aBmpEx );
diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx
index 5cbf9ad3bc28..33f4f5c5318c 100644
--- a/canvas/source/vcl/canvashelper_texturefill.cxx
+++ b/canvas/source/vcl/canvashelper_texturefill.cxx
@@ -798,7 +798,7 @@ namespace vclcanvas
// degrees with the orientation reversed: [0,2Pi) ->
// (3600,0]. Note that the original angle may have
// values outside the [0,2Pi) interval.
- const double nAngleInTenthOfDegrees (3600.0 - nRotate * 3600.0 / (2*M_PI));
+ const double nAngleInTenthOfDegrees (3600.0 - basegfx::rad2deg<10>(nRotate));
aGrfAttr.SetRotation( Degree10(::basegfx::fround(nAngleInTenthOfDegrees)) );
pGrfObj = std::make_shared<GraphicObject>( aBmpEx );
diff --git a/canvas/source/vcl/impltools.cxx b/canvas/source/vcl/impltools.cxx
index 53faa65ffa71..025b80bd2233 100644
--- a/canvas/source/vcl/impltools.cxx
+++ b/canvas/source/vcl/impltools.cxx
@@ -126,7 +126,7 @@ namespace vclcanvas::tools
io_rVCLFont.SetFontHeight( ::basegfx::fround(nFontHeight * aScale.getY()) );
}
- io_rVCLFont.SetOrientation( Degree10( ::basegfx::fround(-fmod(nRotate, 2*M_PI)*(1800.0/M_PI)) ) );
+ io_rVCLFont.SetOrientation( Degree10( ::basegfx::fround(-basegfx::rad2deg<10>(fmod(nRotate, 2*M_PI))) ) );
// TODO(F2): Missing functionality in VCL: shearing
o_rPoint.setX( ::basegfx::fround(aTranslate.getX()) );
diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx
index fe9bfe783615..a7011527dfc6 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -426,7 +426,7 @@ uno::Reference<drawing::XShape>
//Matrix for position
basegfx::B3DHomMatrix aHomMatrix;
if (nRotateZAngleHundredthDegree != 0)
- aHomMatrix.rotate(0.0, 0.0, -nRotateZAngleHundredthDegree / 18000.00 * M_PI);
+ aHomMatrix.rotate(0.0, 0.0, -basegfx::deg2rad<100>(nRotateZAngleHundredthDegree));
aHomMatrix.translate(rPosition.PositionX, rPosition.PositionY,
rPosition.PositionZ - (fDepth / 2.0));
@@ -669,7 +669,7 @@ uno::Reference<drawing::XShape>
//Matrix for position
basegfx::B3DHomMatrix aHomMatrix;
if (nRotateZAngleHundredthDegree != 0)
- aHomMatrix.rotate(0.0,0.0,-nRotateZAngleHundredthDegree/18000.00*M_PI);
+ aHomMatrix.rotate(0.0,0.0,-basegfx::deg2rad<100>(nRotateZAngleHundredthDegree));
//stretch the symmetric objects to given depth
aHomMatrix.scale(1.0,1.0,rSize.DirectionZ/rSize.DirectionX);
aHomMatrix.translate(rPosition.PositionX, rPosition.PositionY, rPosition.PositionZ);
diff --git a/chart2/source/view/main/VTitle.cxx b/chart2/source/view/main/VTitle.cxx
index 44c2556ad989..b6ed5866a311 100644
--- a/chart2/source/view/main/VTitle.cxx
+++ b/chart2/source/view/main/VTitle.cxx
@@ -86,7 +86,7 @@ void VTitle::changePosition( const awt::Point& rPos )
//set position matrix
//the matrix needs to be set at the end behind autogrow and such position influencing properties
::basegfx::B2DHomMatrix aM;
- aM.rotate( -m_fRotationAngleDegree*M_PI/180.0 );//#i78696#->#i80521#
+ aM.rotate( basegfx::deg2rad(-m_fRotationAngleDegree) );//#i78696#->#i80521#
aM.translate( m_nXPos, m_nYPos);
xShapeProp->setPropertyValue( "Transformation", uno::Any( B2DHomMatrixToHomogenMatrix3(aM) ) );
}
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index 7f367cb9fe40..8aa1d1675fa9 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -764,11 +764,11 @@ namespace cppcanvas::internal
// setup state-local text transformation,
// if the font be rotated
- const short nFontAngle( rFont.GetOrientation() );
- if( nFontAngle != 0 )
+ const auto nFontAngle( rFont.GetOrientation() );
+ if( nFontAngle )
{
// set to unity transform rotated by font angle
- const double nAngle( nFontAngle * (M_PI / 1800.0) );
+ const double nAngle( toRadians(nFontAngle) );
o_rFontRotation = -nAngle;
}
else
diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
index a6e209a577c6..60370e722941 100644
--- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx
+++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
@@ -395,7 +395,7 @@ vcl::Font getVclFontFromFontAttribute(const attribute::FontAttribute& rFontAttri
// handle FontRotation (if defined)
if (!basegfx::fTools::equalZero(fFontRotation))
{
- sal_Int16 aRotate10th(static_cast<sal_Int16>(fFontRotation * (-1800.0 / M_PI)));
+ int aRotate10th(-basegfx::rad2deg<10>(fFontRotation));
aRetval.SetOrientation(Degree10(aRotate10th % 3600));
}
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 7ea03c9afd0c..87ae848b3ca9 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -272,7 +272,7 @@ void VclMetafileProcessor2D::impConvertFillGradientAttributeToVCLGradient(
}
o_rVCLGradient.SetAngle(
- Degree10(static_cast<sal_uInt16>(rFiGrAtt.getAngle() * (1.0 / F_PI1800))));
+ Degree10(static_cast<sal_uInt32>(basegfx::rad2deg<100>(rFiGrAtt.getAngle()))));
o_rVCLGradient.SetBorder(static_cast<sal_uInt16>(rFiGrAtt.getBorder() * 100.0));
o_rVCLGradient.SetOfsX(static_cast<sal_uInt16>(rFiGrAtt.getOffsetX() * 100.0));
o_rVCLGradient.SetOfsY(static_cast<sal_uInt16>(rFiGrAtt.getOffsetY() * 100.0));
@@ -1904,7 +1904,7 @@ void VclMetafileProcessor2D::processPolyPolygonHatchPrimitive2D(
Hatch(aHatchStyle,
Color(maBColorModifierStack.getModifiedColor(rFillHatchAttribute.getColor())),
basegfx::fround(rFillHatchAttribute.getDistance()),
- Degree10(basegfx::fround(rFillHatchAttribute.getAngle() / F_PI1800))));
+ Degree10(basegfx::fround(basegfx::rad2deg<10>(rFillHatchAttribute.getAngle())))));
impEndSvtGraphicFill(pSvtGraphicFill.get());
}
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 967b70aa793e..139bb0ba080a 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -852,8 +852,8 @@ void VclPixelProcessor2D::processFillHatchPrimitive2D(
const basegfx::B2DVector aDiscreteDistance(
maCurrentTransformation * basegfx::B2DVector(rFillHatchAttributes.getDistance(), 0.0));
const sal_uInt32 nDistance(basegfx::fround(aDiscreteDistance.getLength()));
- const sal_uInt16 nAngle10(
- static_cast<sal_uInt16>(basegfx::fround(rFillHatchAttributes.getAngle() / F_PI1800)));
+ const sal_uInt32 nAngle10(
+ basegfx::rad2deg<10>(basegfx::fround(rFillHatchAttributes.getAngle())));
::Hatch aVCLHatch(eHatchStyle, Color(rFillHatchAttributes.getColor()), nDistance,
Degree10(nAngle10));
@@ -1216,7 +1216,7 @@ void VclPixelProcessor2D::processFillGradientPrimitive2D(
Gradient aGradient(eGradientStyle, Color(rFillGradient.getStartColor()),
Color(rFillGradient.getEndColor()));
- aGradient.SetAngle(Degree10(static_cast<int>(rFillGradient.getAngle() / F_PI1800)));
+ aGradient.SetAngle(Degree10(static_cast<int>(basegfx::rad2deg<10>(rFillGradient.getAngle()))));
aGradient.SetBorder(rFillGradient.getBorder() * 100);
aGradient.SetOfsX(rFillGradient.getOffsetX() * 100.0);
aGradient.SetOfsY(rFillGradient.getOffsetY() * 100.0);
diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx
index f9cfbc60cbd3..22b1d4217413 100644
--- a/drawinglayer/source/tools/wmfemfhelper.cxx
+++ b/drawinglayer/source/tools/wmfemfhelper.cxx
@@ -737,7 +737,7 @@ namespace wmfemfhelper
static_cast<double>(rGradient.GetBorder()) * 0.01,
static_cast<double>(rGradient.GetOfsX()) * 0.01,
static_cast<double>(rGradient.GetOfsY()) * 0.01,
- static_cast<double>(rGradient.GetAngle().get()) * F_PI1800,
+ toRadians(rGradient.GetAngle()),
aStart,
aEnd,
rGradient.GetSteps());
@@ -772,7 +772,7 @@ namespace wmfemfhelper
return drawinglayer::attribute::FillHatchAttribute(
aHatchStyle,
static_cast<double>(rHatch.GetDistance()),
- static_cast<double>(rHatch.GetAngle().get()) * F_PI1800,
+ toRadians(rHatch.GetAngle()),
rHatch.GetColor().getBColor(),
3, // same default as VCL, a minimum of three discrete units (pixels) offset
false);
@@ -1086,7 +1086,7 @@ namespace wmfemfhelper
// add FontRotation (if used)
if(rFont.GetOrientation())
{
- rTextTransform.rotate(-rFont.GetOrientation().get() * F_PI1800);
+ rTextTransform.rotate(-toRadians(rFont.GetOrientation()));
}
}
@@ -1249,7 +1249,7 @@ namespace wmfemfhelper
if(rFont.GetOrientation())
{
- aTextTransform.rotate(-rFont.GetOrientation().get() * F_PI1800);
+ aTextTransform.rotate(-toRadians(rFont.GetOrientation()));
}
aTextTransform.translate(rTextStartPosition.X(), rTextStartPosition.Y());
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 75463945c724..4b2f860846f6 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -107,7 +107,7 @@ struct TabInfo
Point Rotate( const Point& rPoint, Degree10 nOrientation, const Point& rOrigin )
{
- double nRealOrientation = nOrientation.get() * F_PI1800;
+ double nRealOrientation = toRadians(nOrientation);
double nCos = cos( nRealOrientation );
double nSin = sin( nRealOrientation );
@@ -3108,7 +3108,7 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Po
double nCos = 0.0, nSin = 0.0;
if ( nOrientation )
{
- double nRealOrientation = nOrientation.get()*F_PI1800;
+ double nRealOrientation = toRadians(nOrientation);
nCos = cos( nRealOrientation );
nSin = sin( nRealOrientation );
}
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index d3500c879378..d50bdc9b3895 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -940,7 +940,7 @@ void Outliner::PaintBullet(sal_Int32 nPara, const Point& rStartPos, const Point&
{
// Both TopLeft and bottom left is not quite correct,
// since in EditEngine baseline ...
- double nRealOrientation = nOrientation.get() * F_PI1800;
+ double nRealOrientation = toRadians(nOrientation);
double nCos = cos( nRealOrientation );
double nSin = sin( nRealOrientation );
Point aRotatedPos;
diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx
index 114e2c9304f9..72b85624f302 100644
--- a/filter/source/msfilter/eschesdo.cxx
+++ b/filter/source/msfilter/eschesdo.cxx
@@ -89,7 +89,7 @@ void ImplEESdrWriter::ImplFlipBoundingBox( ImplEESdrObject& rObj, EscherProperty
while ( nAngle > 9000 )
nAngle = ( 18000 - ( nAngle % 18000 ) );
- double fVal = static_cast<double>(nAngle) * F_PI18000;
+ double fVal = basegfx::deg2rad<100>(nAngle);
double fCos = cos( fVal );
double fSin = sin( fVal );
@@ -368,10 +368,10 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
nEndAngle = *o3tl::doAccess<sal_Int32>(rObj.GetUsrAny());
Point aStart, aEnd, aCenter;
- aStart.setX( static_cast<sal_Int32>( cos( nStartAngle * F_PI18000 ) * 100.0 ) );
- aStart.setY( - static_cast<sal_Int32>( sin( nStartAngle * F_PI18000 ) * 100.0 ) );
- aEnd.setX( static_cast<sal_Int32>( cos( nEndAngle * F_PI18000 ) * 100.0 ) );
- aEnd.setY( - static_cast<sal_Int32>( sin( nEndAngle * F_PI18000 ) * 100.0 ) );
+ aStart.setX( static_cast<sal_Int32>( cos( basegfx::deg2rad<100>(nStartAngle) ) * 100.0 ) );
+ aStart.setY( - static_cast<sal_Int32>( sin( basegfx::deg2rad<100>(nStartAngle) ) * 100.0 ) );
+ aEnd.setX( static_cast<sal_Int32>( cos( basegfx::deg2rad<100>(nEndAngle) ) * 100.0 ) );
+ aEnd.setY( - static_cast<sal_Int32>( sin( basegfx::deg2rad<100>(nEndAngle) ) * 100.0 ) );
const tools::Rectangle& rRect = aRect100thmm;
aCenter.setX( rRect.Left() + ( rRect.GetWidth() / 2 ) );
aCenter.setY( rRect.Top() + ( rRect.GetHeight() / 2 ) );
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 743f4f7cdbe7..74b7bece8644 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4689,7 +4689,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
nAngle = 36000_deg100 - nAngle;
if ( nSpFlags & ShapeFlag::FlipV )
nAngle = -nAngle;
- double a = nAngle.get() * F_PI18000;
+ double a = toRadians(nAngle);
double ss = sin( a );
double cc = cos( a );
Point aP1( aOldBoundRect.TopLeft() );
@@ -4764,7 +4764,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
// pay attention to the rotations
if ( nObjectRotation )
{
- double a = nObjectRotation.get() * F_PI18000;
+ double a = toRadians(nObjectRotation);
Point aCenter( aObjData.aBoundRect.Center() );
double ss = sin(a);
double cc = cos(a);
@@ -5441,7 +5441,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
// rotate text with shape?
if ( mnFix16Angle )
{
- double a = mnFix16Angle.get() * F_PI18000;
+ double a = toRadians(mnFix16Angle);
pTextObj->NbcRotate( rObjData.aBoundRect.Center(), mnFix16Angle,
sin( a ), cos( a ) );
}
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index a4f469967bb5..360669ff90f2 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -1185,8 +1185,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, Svx
{
if ( rObjData.nSpFlags & ShapeFlag::FlipV )
{
- double a = 18000 * F_PI18000;
- pTObj->Rotate( rTextRect.Center(), 18000_deg100, sin( a ), cos( a ) );
+ pTObj->Rotate( rTextRect.Center(), 18000_deg100, 0.0, -1.0 );
}
if ( rObjData.nSpFlags & ShapeFlag::FlipH )
nAngle = 36000_deg100 - nAngle;
diff --git a/include/basegfx/numeric/ftools.hxx b/include/basegfx/numeric/ftools.hxx
index 63e7a0d460ce..14deaa059020 100644
--- a/include/basegfx/numeric/ftools.hxx
+++ b/include/basegfx/numeric/ftools.hxx
@@ -27,14 +27,6 @@
#include <algorithm>
-#ifndef F_PI1800
-#define F_PI1800 (M_PI/1800.0)
-#endif
-#ifndef F_PI18000
-#define F_PI18000 (M_PI/18000.0)
-#endif
-
-
// fTools defines
namespace basegfx
@@ -83,20 +75,20 @@ namespace basegfx
/** Convert value from degrees to radians
*/
- constexpr double deg2rad( double v )
+ template <int DegMultiple = 1> constexpr double deg2rad( double v )
{
// divide first, to get exact values for v being a multiple of
// 90 degrees
- return v / 90.0 * M_PI_2;
+ return v / (90.0 * DegMultiple) * M_PI_2;
}
/** Convert value radians to degrees
*/
- constexpr double rad2deg( double v )
+ template <int DegMultiple = 1> constexpr double rad2deg( double v )
{
// divide first, to get exact values for v being a multiple of
// pi/2
- return v / M_PI_2 * 90.0;
+ return v / M_PI_2 * (90.0 * DegMultiple);
}
/** Snap v to nearest multiple of fStep, from negative and
diff --git a/include/svx/svdtrans.hxx b/include/svx/svdtrans.hxx
index abc19bf617cd..67741e77728b 100644
--- a/include/svx/svdtrans.hxx
+++ b/include/svx/svdtrans.hxx
@@ -29,19 +29,6 @@
#include <tools/mapunit.hxx>
#include <tools/poly.hxx>
-// The DrawingEngine's angles are specified in 1/100th degrees
-// We need to convert these angles to radians, in order to be able
-// to process them with trigonometric functions.
-// This is done, using the constant F_PI18000.
-//
-// Example usage:
-// nAngle ... is an angle in 1/100 Deg
-//
-// Which is converted, by this:
-// double nSin=sin(nAngle*F_PI18000);
-//
-// To convert it back, we use division.
-
// That maximum shear angle
constexpr Degree100 SDRMAXSHEAR(8900);
diff --git a/include/tools/degree.hxx b/include/tools/degree.hxx
index 47dc7a8d98a7..74a27a2c2d35 100644
--- a/include/tools/degree.hxx
+++ b/include/tools/degree.hxx
@@ -8,6 +8,9 @@
*/
#pragma once
+#include <sal/config.h>
+
+#include <basegfx/numeric/ftools.hxx>
#include <sal/types.h>
#include <o3tl/strong_int.hxx>
#include <cstdlib>
@@ -35,11 +38,11 @@ constexpr Degree100 operator""_deg100(unsigned long long n) { return Degree100{
/** conversion functions */
inline Degree100 toDegree100(Degree10 x) { return Degree100(x.get() * 10); }
-inline double toRadians(Degree10 x) { return x.get() * (M_PI / 1800.0); }
+inline double toRadians(Degree10 x) { return basegfx::deg2rad<10>(x.get()); }
inline double toDegrees(Degree10 x) { return x.get() / 10.0; }
inline Degree10 toDegree10(Degree100 x) { return Degree10((x.get() + 5) / 10); }
-inline double toRadians(Degree100 x) { return x.get() * (M_PI / 18000.0); }
+inline double toRadians(Degree100 x) { return basegfx::deg2rad<100>(x.get()); }
inline double toDegrees(Degree100 x) { return x.get() / 100.0; }
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 41b8f0cc320a..015995016a36 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1929,8 +1929,8 @@ renderOverlay(LOKDocView* pDocView, cairo_t* pCairo)
twipToPixel(rRectangle.m_aRectangle.x + rRectangle.m_aRectangle.width, priv->m_fZoom) - 15,
twipToPixel(rRectangle.m_aRectangle.y + rRectangle.m_aRectangle.height, priv->m_fZoom) - 15,
5,
- 180.0 * (M_PI/180.0),
- 360.0 * (M_PI/180.0));
+ M_PI,
+ 2 * M_PI);
cairo_stroke(pCairo);
}
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 6c2011ac9eef..dfb30c2f484b 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1802,8 +1802,8 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa
{
int faccos=bFlipV ? -1 : 1;
int facsin=bFlipH ? -1 : 1;
- aPos.X-=(1-faccos*cos(nRotation.get()*F_PI18000))*aSize.Width/2-facsin*sin(nRotation.get()*F_PI18000)*aSize.Height/2;
- aPos.Y-=(1-faccos*cos(nRotation.get()*F_PI18000))*aSize.Height/2+facsin*sin(nRotation.get()*F_PI18000)*aSize.Width/2;
+ aPos.X-=(1-faccos*cos(toRadians(nRotation)))*aSize.Width/2-facsin*sin(toRadians(nRotation))*aSize.Height/2;
+ aPos.Y-=(1-faccos*cos(toRadians(nRotation)))*aSize.Height/2+facsin*sin(toRadians(nRotation))*aSize.Width/2;
}
else if (m_xParent.is() && nRotation != 0_deg100)
{
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 32a53aa25649..e936aada4a51 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -5152,8 +5152,8 @@ void Test::testAnchoredRotatedShape()
pPage->InsertObject(pObj);
Point aRef1(pObj->GetSnapRect().Center());
Degree100 nAngle = 9000_deg100; //90 deg.
- double nSin = sin(nAngle.get() * F_PI18000);
- double nCos = cos(nAngle.get() * F_PI18000);
+ double nSin = 1.0; // sin(90 deg)
+ double nCos = 0.0; // cos(90 deg)
pObj->Rotate(aRef1,nAngle,nSin,nCos);
ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *m_pDoc, 0, true);
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index ce1e30534179..037e34658c5d 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -301,7 +301,7 @@ tools::Long ScColumn::GetNeededSize(
{
//TODO: take different X/Y scaling into consideration
- double nRealOrient = nRotate.get() * F_PI18000; // nRotate is in 1/100 Grad
+ double nRealOrient = toRadians(nRotate);
double nCosAbs = fabs( cos( nRealOrient ) );
double nSinAbs = fabs( sin( nRealOrient ) );
tools::Long nHeight = static_cast<tools::Long>( aSize.Height() * nCosAbs + aSize.Width() * nSinAbs );
@@ -482,7 +482,7 @@ tools::Long ScColumn::GetNeededSize(
//TODO: take different X/Y scaling into consideration
Size aSize( pEngine->CalcTextWidth(), pEngine->GetTextHeight() );
- double nRealOrient = nRotate.get() * F_PI18000; // nRotate is in 1/100 Grad
+ double nRealOrient = toRadians(nRotate);
double nCosAbs = fabs( cos( nRealOrient ) );
double nSinAbs = fabs( sin( nRealOrient ) );
tools::Long nHeight = static_cast<tools::Long>( aSize.Height() * nCosAbs + aSize.Width() * nSinAbs );
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 8eacc29f65df..9c337b810e22 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2316,7 +2316,7 @@ SCSIZE ScTable::FillMaxRot( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCO
{
Degree100 nRotVal = pPattern->
GetItem( ATTR_ROTATE_VALUE, pCondSet ).GetValue();
- double nRealOrient = nRotVal.get() * F_PI18000; // 1/100 degree
+ double nRealOrient = toRadians(nRotVal);
double nCos = cos( nRealOrient );
double nSin = sin( nRealOrient );
//TODO: limit !!!
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index bf6ffd4a2c23..38c81adf2dcf 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -1204,7 +1204,7 @@ void XclImpChText::ConvertTitlePosition( const XclChTextKey& rTitleKey ) const
css::awt::Size aTitleSize = xTitleShape->getSize();
// rotated titles need special handling...
Degree100 nScRot = XclTools::GetScRotation( GetRotation(), 0_deg100 );
- double fRad = nScRot.get() * F_PI18000;
+ double fRad = toRadians(nScRot);
double fSin = fabs( sin( fRad ) );
// calculate the title position from the values in the CHTEXT record
css::awt::Point aTitlePos(
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
index b9d843739029..a85af722f0f3 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -963,8 +963,8 @@ void PPTWriter::ImplFlipBoundingBox( EscherPropertyContainer& rPropOpt )
else
mnAngle = ( 36000 - ( mnAngle % 36000 ) );
- double fCos = cos( static_cast<double>(mnAngle) * F_PI18000 );
- double fSin = sin( static_cast<double>(mnAngle) * F_PI18000 );
+ double fCos = cos( basegfx::deg2rad<100>(mnAngle) );
+ double fSin = sin( basegfx::deg2rad<100>(mnAngle) );
double fWidthHalf = maRect.GetWidth() / 2.0;
double fHeightHalf = maRect.GetHeight() / 2.0;
@@ -1872,10 +1872,10 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
css::awt::Size aSize( mXShape->getSize() );
css::awt::Point aStart, aEnd, aCenter;
::tools::Rectangle aRect( Point( aPoint.X, aPoint.Y ), Size( aSize.Width, aSize.Height ) );
- aStart.X = static_cast<sal_Int32>( cos( nStartAngle * F_PI18000 ) * 100.0 );
- aStart.Y = - static_cast<sal_Int32>( sin( nStartAngle * F_PI18000 ) * 100.0 );
- aEnd.X = static_cast<sal_Int32>( cos( nEndAngle * F_PI18000 ) * 100.0 );
- aEnd.Y = - static_cast<sal_Int32>( sin( nEndAngle * F_PI18000 ) * 100.0 ) ;
+ aStart.X = static_cast<sal_Int32>( cos( basegfx::deg2rad<100>(nStartAngle) ) * 100.0 );
+ aStart.Y = - static_cast<sal_Int32>( sin( basegfx::deg2rad<100>(nStartAngle) ) * 100.0 );
+ aEnd.X = static_cast<sal_Int32>( cos( basegfx::deg2rad<100>(nEndAngle) ) * 100.0 );
+ aEnd.Y = - static_cast<sal_Int32>( sin( basegfx::deg2rad<100>(nEndAngle) ) * 100.0 );
aCenter.X = aPoint.X + ( aSize.Width / 2 );
aCenter.Y = aPoint.Y + ( aSize.Height / 2 );
aStart.X += aCenter.X;
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx
index 4d3cb9de7cb1..bbad9f60753a 100644
--- a/svx/source/customshapes/EnhancedCustomShape3d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx
@@ -277,7 +277,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject(
Degree100 nObjectRotation(rSdrObjCustomShape.GetRotateAngle());
if ( nObjectRotation )
{
- double a = (36000 - nObjectRotation.get()) * F_PI18000;
+ double a = toRadians(36000_deg100 - nObjectRotation);
tools::Long dx = aSnapRect.Right() - aSnapRect.Left();
tools::Long dy = aSnapRect.Bottom()- aSnapRect.Top();
Point aP( aSnapRect.TopLeft() );
diff --git a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx
index 0d9d0714aa56..bcaa1c367f97 100644
--- a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx
@@ -72,7 +72,7 @@ namespace sdr::contact
const sal_uInt32 nVerticalSegments(GetE3dLatheObj().GetVerticalSegments());
const double fDiagonal(static_cast<double>(GetE3dLatheObj().GetPercentDiagonal()) / 100.0);
const double fBackScale(static_cast<double>(GetE3dLatheObj().GetBackScale()) / 100.0);
- const double fRotation((static_cast<double>(GetE3dLatheObj().GetEndAngle()) / 1800.0) * M_PI);
+ const double fRotation(basegfx::deg2rad<10>(GetE3dLatheObj().GetEndAngle()));
const bool bSmoothNormals(GetE3dLatheObj().GetSmoothNormals()); // Plane itself
const bool bSmoothLids(GetE3dLatheObj().GetSmoothLids()); // Front/back
const bool bCharacterMode(GetE3dLatheObj().GetCharacterMode());
diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx
index 7450b25be1a4..8e284f7ae79d 100644
--- a/svx/source/sdr/contact/viewcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx
@@ -341,7 +341,7 @@ namespace sdr::contact
// fill object matrix
const double fShearX(-rGeoStat.mfTanShearAngle);
- const double fRotate(nRotationAngle ? (36000 - nRotationAngle.get()) * F_PI18000 : 0.0);
+ const double fRotate(nRotationAngle ? toRadians(36000_deg100 - nRotationAngle) : 0.0);
const basegfx::B2DHomMatrix aObjectMatrix(basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
aObjectRange.getWidth(), aObjectRange.getHeight(),
fShearX, fRotate,
diff --git a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx
index d3198802a706..44eea3a13fd4 100644
--- a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx
@@ -74,7 +74,7 @@ namespace sdr::contact
basegfx::B2DHomMatrix aObjectMatrix(basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
aObjectRange.getWidth(), aObjectRange.getHeight(),
-rGeoStat.mfTanShearAngle,
- rGeoStat.nRotationAngle ? (36000 - rGeoStat.nRotationAngle.get()) * F_PI18000 : 0.0,
+ rGeoStat.nRotationAngle ? toRadians(36000_deg100 - rGeoStat.nRotationAngle) : 0.0,
aObjectRange.getMinX(), aObjectRange.getMinY()));
// calculate corner radius
diff --git a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx
index 7462c1080a2e..e150a6be7377 100644
--- a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx
@@ -57,7 +57,7 @@ namespace sdr::contact
basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
aObjectRange.getWidth(), aObjectRange.getHeight(),
-rGeoStat.mfTanShearAngle,
- rGeoStat.nRotationAngle ? (36000 - rGeoStat.nRotationAngle.get()) * F_PI18000 : 0.0,
+ rGeoStat.nRotationAngle ? toRadians(36000_deg100 - rGeoStat.nRotationAngle) : 0.0,
aObjectRange.getMinX(), aObjectRange.getMinY()));
// create primitive data
@@ -77,10 +77,10 @@ namespace sdr::contact
}
else
{
- const sal_Int32 nNewStart(rItemSet.Get(SDRATTR_CIRCSTARTANGLE).GetValue());
- const sal_Int32 nNewEnd(rItemSet.Get(SDRATTR_CIRCENDANGLE).GetValue());
- const double fStart(((36000 - nNewEnd) % 36000) * F_PI18000);
- const double fEnd(((36000 - nNewStart) % 36000) * F_PI18000);
+ const auto nNewStart(rItemSet.Get(SDRATTR_CIRCSTARTANGLE).GetValue());
+ const auto nNewEnd(rItemSet.Get(SDRATTR_CIRCENDANGLE).GetValue());
+ const double fStart(toRadians((36000_deg100 - nNewEnd) % 36000_deg100));
+ const double fEnd(toRadians((36000_deg100 - nNewStart) % 36000_deg100));
const bool bCloseSegment(OBJ_CARC != nIdentifier);
const bool bCloseUsingCenter(OBJ_SECT == nIdentifier);
diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
index 6a4e22ec7af0..879f36971f85 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
@@ -73,7 +73,7 @@ namespace sdr::contact
if(rGeoStat.nRotationAngle)
{
- aRotMatrix.rotate((36000 - rGeoStat.nRotationAngle.get()) * F_PI18000);
+ aRotMatrix.rotate(toRadians(36000_deg100 - rGeoStat.nRotationAngle));
}
aRotMatrix.translate(aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY());
@@ -202,7 +202,7 @@ namespace sdr::contact
if(rGeoStat.nRotationAngle)
{
- aTextBoxMatrix.rotate((36000 - rGeoStat.nRotationAngle.get()) * F_PI18000);
+ aTextBoxMatrix.rotate(toRadians(36000_deg100 - rGeoStat.nRotationAngle));
}
// give text it's target position
diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
index 610c483cbec8..a9ee47a30af3 100644
--- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
@@ -62,7 +62,7 @@ basegfx::B2DHomMatrix ViewContactOfSdrOle2Obj::createObjectTransform() const
// create object matrix
const GeoStat& rGeoStat(GetOle2Obj().GetGeoStat());
const double fShearX(-rGeoStat.mfTanShearAngle);
- const double fRotate(rGeoStat.nRotationAngle ? (36000 - rGeoStat.nRotationAngle.get()) * F_PI18000 : 0.0);
+ const double fRotate(rGeoStat.nRotationAngle ? toRadians(36000_deg100 - rGeoStat.nRotationAngle) : 0.0);
return basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
aObjectRange.getWidth(), aObjectRange.getHeight(),
diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
index 694c3ea32947..b326fd8af787 100644
--- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
@@ -158,7 +158,7 @@ namespace sdr::contact
aObjectMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
fScaleX, fScaleY,
-rGeoStat.mfTanShearAngle,
- rGeoStat.nRotationAngle ? (36000 - rGeoStat.nRotationAngle.get()) * F_PI18000 : 0.0,
+ rGeoStat.nRotationAngle ? toRadians(36000_deg100 - rGeoStat.nRotationAngle) : 0.0,
aObjectRange.getMinX(), aObjectRange.getMinY());
// create unit polygon from object's absolute path
diff --git a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx
index e1b8d69cd906..a8f1c3aeb125 100644
--- a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx
@@ -57,7 +57,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewContactOfSdrRectObj::createV
basegfx::B2DHomMatrix aObjectMatrix(basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
aObjectRange.getWidth(), aObjectRange.getHeight(),
-rGeoStat.mfTanShearAngle,
- rGeoStat.nRotationAngle ? (36000 - rGeoStat.nRotationAngle.get()) * F_PI18000 : 0.0,
+ rGeoStat.nRotationAngle ? toRadians(36000_deg100 - rGeoStat.nRotationAngle) : 0.0,
aObjectRange.getMinX(), aObjectRange.getMinY()));
// calculate corner radius
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index 7193dc4a663c..1b4f0abbac97 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -483,7 +483,7 @@ namespace drawinglayer::primitive2d
static_cast<double>(aXGradient.GetBorder()) * 0.01,
static_cast<double>(aXGradient.GetXOffset()) * 0.01,
static_cast<double>(aXGradient.GetYOffset()) * 0.01,
- static_cast<double>(aXGradient.GetAngle().get()) * F_PI1800,
+ toRadians(aXGradient.GetAngle()),
aStart,
aEnd,
rSet.Get(XATTR_GRADIENTSTEPCOUNT).GetValue());
@@ -498,7 +498,7 @@ namespace drawinglayer::primitive2d
aHatch = attribute::FillHatchAttribute(
XHatchStyleToHatchStyle(rHatch.GetHatchStyle()),
static_cast<double>(rHatch.GetDistance()),
- static_cast<double>(rHatch.GetAngle().get()) * F_PI1800,
+ toRadians(rHatch.GetAngle()),
aColorB.getBColor(),
3, // same default as VCL, a minimum of three discrete units (pixels) offset
rSet.Get(XATTR_FILLBACKGROUND).GetValue());
@@ -644,7 +644,7 @@ namespace drawinglayer::primitive2d
static_cast<double>(rGradient.GetBorder()) * 0.01,
static_cast<double>(rGradient.GetXOffset()) * 0.01,
static_cast<double>(rGradient.GetYOffset()) * 0.01,
- static_cast<double>(rGradient.GetAngle().get()) * F_PI1800,
+ toRadians(rGradient.GetAngle()),
basegfx::BColor(fStartLum, fStartLum, fStartLum),
basegfx::BColor(fEndLum, fEndLum, fEndLum));
}
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index bdba8aa0d7f4..1bbd4cbd46d9 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -1067,7 +1067,7 @@ void SdrDragMovHdl::MoveSdrDrag(const Point& rNoSnapPnt)
nNewAngle/=nSA;
nNewAngle*=nSA;
nNewAngle=NormAngle36000(nNewAngle);
- double a=(nNewAngle-nAngle).get()*F_PI18000;
+ double a=toRadians(nNewAngle-nAngle);
double nSin=sin(a);
double nCos=cos(a);
RotatePoint(aPnt,aRef,nSin,nCos);
@@ -2141,7 +2141,7 @@ void SdrDragRotate::MoveSdrDrag(const Point& rPnt_)
bRight=false;
nAngle=nNewAngle;
- double a = nAngle.get() * F_PI18000;
+ double a = toRadians(nAngle);
double nSin1=sin(a); // calculate now, so as little time as possible
double nCos1=cos(a); // passes between Hide() and Show()
Hide();
@@ -2356,7 +2356,7 @@ void SdrDragShear::MoveSdrDrag(const Point& rPnt)
if (bUpSideDown) nNewAngle -= 18000_deg100;
if (bNeg) nTmpAngle=-nTmpAngle;
bResize=true;
- aNewFract = cos(nTmpAngle.get() * F_PI18000);
+ aNewFract = cos(toRadians(nTmpAngle));
aFact.ReduceInaccurate(10); // three decimals should be enough
}
@@ -2370,7 +2370,7 @@ void SdrDragShear::MoveSdrDrag(const Point& rPnt)
{
nAngle=nNewAngle;
aFact=aNewFract;
- double a = nAngle.get() * F_PI18000;
+ double a = toRadians(nAngle);
double nTan1=tan(a); // calculate now, so as little time as possible passes between Hide() and Show()
Hide();
nTan=nTan1;
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index 852d160ccd98..0cc7cc0019a8 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -310,8 +310,8 @@ void SdrEditView::RotateMarkedObj(const Point& rRef, Degree100 nAngle, bool bCop
if (bCopy)
CopyMarkedObj();
- double nSin = sin(nAngle.get() * F_PI18000);
- double nCos = cos(nAngle.get() * F_PI18000);
+ double nSin = sin(toRadians(nAngle));
+ double nCos = cos(toRadians(nAngle));
const size_t nMarkCount(GetMarkedObjectCount());
if(nMarkCount)
@@ -468,7 +468,7 @@ void SdrEditView::ShearMarkedObj(const Point& rRef, Degree100 nAngle, bool bVShe
if (bCopy)
CopyMarkedObj();
- double nTan = tan(nAngle.get() * F_PI18000);
+ double nTan = tan(toRadians(nAngle));
const size_t nMarkCount=GetMarkedObjectCount();
for (size_t nm=0; nm<nMarkCount; ++nm)
{
@@ -559,7 +559,7 @@ void SdrEditView::ImpCrookObj(SdrObject* pO, const Point& rRef, const Point& rRa
aCtr1 -= aCtr0;
if(bRotOk)
- pO->Rotate(aCtr0, Degree100(FRound(nAngle / F_PI18000)), nSin, nCos);
+ pO->Rotate(aCtr0, Degree100(FRound(basegfx::rad2deg<100>(nAngle))), nSin, nCos);
pO->Move(Size(aCtr1.X(),aCtr1.Y()));
}
@@ -1643,10 +1643,10 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr, bool addPageMargin
} else {
if (nNewShearAngle!=0_deg100 && nOldShearAngle!=0_deg100) {
// bug fix
- double nOld = tan(static_cast<double>(nOldShearAngle.get()) * F_PI18000);
- double nNew = tan(static_cast<double>(nNewShearAngle.get()) * F_PI18000);
+ double nOld = tan(toRadians(nOldShearAngle));
+ double nNew = tan(toRadians(nNewShearAngle));
nNew-=nOld;
- nNew = atan(nNew) / F_PI18000;
+ nNew = basegfx::rad2deg<100>(atan(nNew));
nShearAngle=Degree100(FRound(nNew));
} else {
nShearAngle=nNewShearAngle-nOldShearAngle;
diff --git a/svx/source/svdraw/svdglev.cxx b/svx/source/svdraw/svdglev.cxx
index 78c92f778840..67c64eb1a8df 100644
--- a/svx/source/svdraw/svdglev.cxx
+++ b/svx/source/svdraw/svdglev.cxx
@@ -390,8 +390,8 @@ void SdrGlueEditView::RotateMarkedGluePoints(const Point& rRef, Degree100 nAngle
if (bCopy) aStr+=SvxResId(STR_EditWithCopy);
BegUndo(aStr,GetDescriptionOfMarkedGluePoints(),SdrRepeatFunc::Rotate);
if (bCopy) ImpCopyMarkedGluePoints();
- double nSin = sin(nAngle.get() * F_PI18000);
- double nCos = cos(nAngle.get() * F_PI18000);
+ double nSin = sin(toRadians(nAngle));
+ double nCos = cos(toRadians(nAngle));
ImpTransformMarkedGluePoints(ImpRotate,&rRef,&nAngle,&nSin,&nCos);
EndUndo();
AdjustMarkHdl();
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index d0c61f808ef3..f20daeabac4f 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -1831,7 +1831,7 @@ void ImpTextframeHdl::CreateB2dIAObject()
fTransparence,
3.0,
3.0,
- nRotationAngle.get() * -F_PI18000,
+ -toRadians(nRotationAngle),
true)); // allow animation; the Handle is not shown at text edit time
pNewOverlayObject->setHittable(false);
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index ffbfe6456e54..3b1612b15f68 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -1585,17 +1585,17 @@ void SdrObjCustomShape::NbcRotate( const Point& rRef, Degree100 nAngle, double s
maGeo.nRotationAngle = 0_deg100; // resetting aGeo data
maGeo.RecalcSinCos();
- tools::Long nW = static_cast<tools::Long>( fObjectRotation * 100 ); // applying our object rotation
+ Degree100 nW(static_cast<sal_Int32>( fObjectRotation * 100 )); // applying our object rotation
if ( bMirroredX )
- nW = 36000 - nW;
+ nW = 36000_deg100 - nW;
if ( bMirroredY )
- nW = 18000 - nW;
- nW = nW % 36000;
- if ( nW < 0 )
- nW = 36000 + nW;
- SdrTextObj::NbcRotate( maRect.TopLeft(), Degree100(nW), // applying text rotation
- sin( nW * F_PI18000 ),
- cos( nW * F_PI18000 ) );
+ nW = 18000_deg100 - nW;
+ nW = nW % 36000_deg100;
+ if ( nW < 0_deg100 )
+ nW = 36000_deg100 + nW;
+ SdrTextObj::NbcRotate( maRect.TopLeft(), nW, // applying text rotation
+ sin( toRadians(nW) ),
+ cos( toRadians(nW) ) );
int nSwap = 0;
if ( bMirroredX )
@@ -3034,7 +3034,7 @@ void SdrObjCustomShape::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix,
// #i123181# The fix for #121932# here was wrong, the trunk version does not correct the
// mirrored shear values, neither at the object level, nor on the API or XML level. Taking
// back the mirroring of the shear angle
- aGeoStat.nShearAngle = Degree100(FRound(basegfx::rad2deg(atan(fShearX)) * 100.0));
+ aGeoStat.nShearAngle = Degree100(FRound(basegfx::rad2deg<100>(atan(fShearX))));
aGeoStat.RecalcTan();
Shear(Point(), aGeoStat.nShearAngle, aGeoStat.mfTanShearAngle, false);
}
@@ -3047,7 +3047,7 @@ void SdrObjCustomShape::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix,
// #i78696#
// fRotate is mathematically correct, but aGeoStat.nRotationAngle is
// mirrored -> mirror value here
- aGeoStat.nRotationAngle = NormAngle36000(Degree100(FRound(-fRotate / F_PI18000)));
+ aGeoStat.nRotationAngle = NormAngle36000(Degree100(FRound(-basegfx::rad2deg<100>(fRotate))));
aGeoStat.RecalcSinCos();
Rotate(Point(), aGeoStat.nRotationAngle, aGeoStat.mfSinRotationAngle, aGeoStat.mfCosRotationAngle);
}
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 35aaebc13f09..957ea2e38ebc 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -1461,7 +1461,7 @@ void SdrObject::NbcRotate(const Point& rRef, Degree100 nAngle)
{
if (nAngle)
{
- double a = nAngle.get() * F_PI18000;
+ double a = toRadians(nAngle);
NbcRotate( rRef, nAngle, sin( a ), cos( a ) );
}
}
@@ -2079,7 +2079,7 @@ void SdrObject::NbcApplyNotPersistAttr(const SfxItemSet& rAttr)
Degree100 n=static_cast<const SdrShearAngleItem*>(pPoolItem)->GetValue();
n-=GetShearAngle();
if (n) {
- double nTan = tan(n.get() * F_PI18000);
+ double nTan = tan(toRadians(n));
NbcShear(aRef1,n,nTan,false);
}
}
@@ -2096,12 +2096,12 @@ void SdrObject::NbcApplyNotPersistAttr(const SfxItemSet& rAttr)
}
if (rAttr.GetItemState(SDRATTR_HORZSHEARONE,true,&pPoolItem)==SfxItemState::SET) {
Degree100 n=static_cast<const SdrHorzShearOneItem*>(pPoolItem)->GetValue();
- double nTan = tan(n.get() * F_PI18000);
+ double nTan = tan(toRadians(n));
NbcShear(aRef1,n,nTan,false);
}
if (rAttr.GetItemState(SDRATTR_VERTSHEARONE,true,&pPoolItem)==SfxItemState::SET) {
Degree100 n=static_cast<const SdrVertShearOneItem*>(pPoolItem)->GetValue();
- double nTan = tan(n.get() * F_PI18000);
+ double nTan = tan(toRadians(n));
NbcShear(aRef1,n,nTan,true);
}
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
index 4275daa86187..6f320d6d4ae7 100644
--- a/svx/source/svdraw/svdocirc.cxx
+++ b/svx/source/svdraw/svdocirc.cxx
@@ -56,7 +56,7 @@ static Point GetAnglePnt(const tools::Rectangle& rR, Degree100 nAngle)
tools::Long nWdt=rR.Right()-rR.Left();
tools::Long nHgt=rR.Bottom()-rR.Top();
tools::Long nMaxRad=(std::max(nWdt,nHgt)+1) /2;
- double a = nAngle.get() * F_PI18000;
+ double a = toRadians(nAngle);
Point aRetval(FRound(cos(a)*nMaxRad),-FRound(sin(a)*nMaxRad));
if (nWdt==0) aRetval.setX(0 );
if (nHgt==0) aRetval.setY(0 );
@@ -261,9 +261,8 @@ basegfx::B2DPolygon SdrCircObj::ImpCalcXPolyCirc(const SdrCircKind eCircleKind,
else
{
// mirror start, end for geometry creation since model coordinate system is mirrored in Y
- // #i111715# increase numerical correctness by first dividing and not using F_PI1800
- const double fStart((((36000 - nEnd.get()) % 36000) / 18000.0) * M_PI);
- const double fEnd((((36000 - nStart.get()) % 36000) / 18000.0) * M_PI);
+ const double fStart(toRadians((36000_deg100 - nEnd) % 36000_deg100));
+ const double fEnd(toRadians((36000_deg100 - nStart) % 36000_deg100));
// create circle segment. This is not closed by default
aCircPolygon = basegfx::utils::createPolygonFromEllipseSegment(
@@ -301,7 +300,7 @@ basegfx::B2DPolygon SdrCircObj::ImpCalcXPolyCirc(const SdrCircKind eCircleKind,
// shear, rotate and back to top left (if needed)
aMatrix = basegfx::utils::createShearXRotateTranslateB2DHomMatrix(
-maGeo.mfTanShearAngle,
- maGeo.nRotationAngle ? (36000_deg100 - maGeo.nRotationAngle).get() * F_PI18000 : 0.0,
+ maGeo.nRotationAngle ? toRadians(36000_deg100 - maGeo.nRotationAngle) : 0.0,
aTopLeft) * aMatrix;
// apply transformation
@@ -885,15 +884,14 @@ void SdrCircObj::NbcMirror(const Point& rRef1, const Point& rRef2)
tools::Long nWdt=maRect.GetWidth()-1;
tools::Long nHgt=maRect.GetHeight()-1;
tools::Long nMaxRad=(std::max(nWdt,nHgt)+1) /2;
- double a;
// starting point
- a = nStartAngle.get() * F_PI18000;
+ double a = toRadians(nStartAngle);
aTmpPt1=Point(FRound(cos(a)*nMaxRad),-FRound(sin(a)*nMaxRad));
if (nWdt==0) aTmpPt1.setX(0 );
if (nHgt==0) aTmpPt1.setY(0 );
aTmpPt1+=aCenter;
// finishing point
- a = nEndAngle.get() * F_PI18000;
+ a = toRadians(nEndAngle);
aTmpPt2=Point(FRound(cos(a)*nMaxRad),-FRound(sin(a)*nMaxRad));
if (nWdt==0) aTmpPt2.setX(0 );
if (nHgt==0) aTmpPt2.setY(0 );
diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx
index 6c2c4b1860b8..09601cae6f17 100644
--- a/svx/source/svdraw/svdomeas.cxx
+++ b/svx/source/svdraw/svdomeas.cxx
@@ -429,7 +429,7 @@ void SdrMeasureObj::ImpCalcGeometrics(const ImpMeasureRec& rRec, ImpMeasurePoly&
rPol.nArrow2Len=nArrow2Len;
rPol.nLineAngle=GetAngle(aDelt);
- double a = rPol.nLineAngle.get() * F_PI18000;
+ double a = toRadians(rPol.nLineAngle);
double nLineSin=sin(a);
double nLineCos=cos(a);
rPol.nLineSin=nLineSin;
@@ -873,7 +873,7 @@ OUString SdrMeasureObj::getSpecialDragComment(const SdrDragStat& /*rDrag*/) cons
void SdrMeasureObj::ImpEvalDrag(ImpMeasureRec& rRec, const SdrDragStat& rDrag) const
{
Degree100 nLineAngle=GetAngle(rRec.aPt2-rRec.aPt1);
- double a = nLineAngle.get() * F_PI18000;
+ double a = toRadians(nLineAngle);
double nSin=sin(a);
double nCos=cos(a);
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index efeefc79dcea..553c299b9831 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -322,20 +322,20 @@ void ImpPathCreateUser::CalcCircle(const Point& rP1, const Point& rP2, const Poi
bool bRet=nTmpAngle!=9000_deg100 && nTmpAngle!=27000_deg100;
tools::Long nRad=0;
if (bRet) {
- double cs = cos(nTmpAngle.get() * F_PI18000);
+ double cs = cos(toRadians(nTmpAngle));
double nR=static_cast<double>(GetLen(Point(dx,dy)))/cs/2;
nRad=std::abs(FRound(nR));
}
if (dAngle<18000_deg100) {
nCircStAngle=NormAngle36000(nTangAngle-9000_deg100);
nCircRelAngle=NormAngle36000(2_deg100*dAngle);
- aCircCenter.AdjustX(FRound(nRad * cos((nTangAngle.get() + 9000) * F_PI18000)));
- aCircCenter.AdjustY(-(FRound(nRad * sin((nTangAngle.get() + 9000) * F_PI18000))));
+ aCircCenter.AdjustX(FRound(nRad * cos(toRadians(nTangAngle + 9000_deg100))));
+ aCircCenter.AdjustY(-(FRound(nRad * sin(toRadians(nTangAngle + 9000_deg100)))));
} else {
nCircStAngle=NormAngle36000(nTangAngle+9000_deg100);
nCircRelAngle=-NormAngle36000(36000_deg100-2_deg100*dAngle);
- aCircCenter.AdjustX(FRound(nRad * cos((nTangAngle.get() - 9000) * F_PI18000)));
- aCircCenter.AdjustY(-(FRound(nRad * sin((nTangAngle.get() - 9000) * F_PI18000))));
+ aCircCenter.AdjustX(FRound(nRad * cos(toRadians(nTangAngle - 9000_deg100))));
+ aCircCenter.AdjustY(-(FRound(nRad * sin(toRadians(nTangAngle - 9000_deg100)))));
}
bAngleSnap=pView!=nullptr && pView->IsAngleSnapEnabled();
if (bAngleSnap) {
@@ -453,7 +453,7 @@ void ImpPathCreateUser::CalcRect(const Point& rP1, const Point& rP2, const Point
tools::Long nHypLen=aTmpPt.Y()-y;
Degree100 nTangAngle=-GetAngle(rDir);
// sin=g/h, g=h*sin
- double a = nTangAngle.get() * F_PI18000;
+ double a = toRadians(nTangAngle);
double sn=sin(a);
double cs=cos(a);
double nGKathLen=nHypLen*sn;
@@ -2305,7 +2305,7 @@ void SdrPathObj::NbcRotate(const Point& rRef, Degree100 nAngle, double sn, doubl
{
// Thank JOE, the angles are defined mirrored to the mathematical meanings
const basegfx::B2DHomMatrix aTrans(
- basegfx::utils::createRotateAroundPoint(rRef.X(), rRef.Y(), -nAngle.get() * F_PI18000));
+ basegfx::utils::createRotateAroundPoint(rRef.X(), rRef.Y(), -toRadians(nAngle)));
maPathPolygon.transform(aTrans);
// #i19871# first modify locally, then call parent (to get correct SnapRect with GluePoints)
@@ -2819,14 +2819,14 @@ bool SdrPathObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DP
if(maGeo.nShearAngle || maGeo.nRotationAngle)
{
// get rotate and shear in drawingLayer notation
- fRotate = maGeo.nRotationAngle.get() * F_PI18000;
- fShearX = maGeo.nShearAngle.get() * F_PI18000;
+ fRotate = toRadians(maGeo.nRotationAngle);
+ fShearX = toRadians(maGeo.nShearAngle);
// build mathematically correct (negative shear and rotate) object transform
// containing shear and rotate to extract unsheared, unrotated polygon
basegfx::B2DHomMatrix aObjectMatrix;
aObjectMatrix.shearX(-maGeo.mfTanShearAngle);
- aObjectMatrix.rotate((36000 - maGeo.nRotationAngle.get()) * F_PI18000);
+ aObjectMatrix.rotate(toRadians(36000_deg100 - maGeo.nRotationAngle));
// create inverse from it and back-transform polygon
basegfx::B2DHomMatrix aInvObjectMatrix(aObjectMatrix);
@@ -2962,7 +2962,7 @@ void SdrPathObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b
if(!basegfx::fTools::equalZero(fShearX))
{
aTransform.shearX(tan(-atan(fShearX)));
- maGeo.nShearAngle = Degree100(FRound(atan(fShearX) / F_PI18000));
+ maGeo.nShearAngle = Degree100(FRound(basegfx::rad2deg<100>(atan(fShearX))));
maGeo.RecalcTan();
}
@@ -2976,7 +2976,7 @@ void SdrPathObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b
// #i78696#
// fRotate is mathematically correct, but aGeoStat.nRotationAngle is
// mirrored -> mirror value here
- maGeo.nRotationAngle = NormAngle36000(Degree100(FRound(-fRotate / F_PI18000)));
+ maGeo.nRotationAngle = NormAngle36000(Degree100(FRound(-basegfx::rad2deg<100>(fRotate))));
maGeo.RecalcSinCos();
}
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index be570fff6089..30c5524288e9 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -577,7 +577,7 @@ void SdrTextObj::ImpSetContourPolygon( SdrOutliner& rOutliner, tools::Rectangle
if(maGeo.nRotationAngle)
{
// Unrotate!
- aMatrix.rotate(-maGeo.nRotationAngle.get() * F_PI18000);
+ aMatrix.rotate(-toRadians(maGeo.nRotationAngle));
}
aXorPolyPolygon.transform(aMatrix);
@@ -1649,7 +1649,7 @@ void SdrTextObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b
if(!basegfx::fTools::equalZero(fShearX))
{
GeoStat aGeoStat;
- aGeoStat.nShearAngle = Degree100(FRound(basegfx::rad2deg(atan(fShearX)) * 100.0));
+ aGeoStat.nShearAngle = Degree100(FRound(basegfx::rad2deg<100>(atan(fShearX))));
aGeoStat.RecalcTan();
Shear(Point(), aGeoStat.nShearAngle, aGeoStat.mfTanShearAngle, false);
}
@@ -1662,7 +1662,7 @@ void SdrTextObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b
// #i78696#
// fRotate is matematically correct, but aGeoStat.nRotationAngle is
// mirrored -> mirror value here
- aGeoStat.nRotationAngle = NormAngle36000(Degree100(FRound(-fRotate / F_PI18000)));
+ aGeoStat.nRotationAngle = NormAngle36000(Degree100(FRound(-basegfx::rad2deg<100>(fRotate))));
aGeoStat.RecalcSinCos();
Rotate(Point(), aGeoStat.nRotationAngle, aGeoStat.mfSinRotationAngle, aGeoStat.mfCosRotationAngle);
}
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index ce6fa2206326..607a2546d1d5 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -176,7 +176,7 @@ namespace
// apply font rotate
if(rInfo.mrFont.GetOrientation())
{
- aNewTransform.rotate(-rInfo.mrFont.GetOrientation().get() * F_PI1800);
+ aNewTransform.rotate(-toRadians(rInfo.mrFont.GetOrientation()));
}
// look for escapement, if necessary, translate accordingly
diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx
index 8f04b356cef7..42d332c53420 100644
--- a/svx/source/svdraw/svdotextpathdecomposition.cxx
+++ b/svx/source/svdraw/svdotextpathdecomposition.cxx
@@ -379,7 +379,7 @@ namespace
else // XFormTextShadow::Slant
{
double fScaleValue(maSdrFormTextAttribute.getFormTextShdwYVal() / 100.0);
- double fShearValue(-maSdrFormTextAttribute.getFormTextShdwXVal() * F_PI1800);
+ double fShearValue(-basegfx::deg2rad<10>(maSdrFormTextAttribute.getFormTextShdwXVal()));
aNewShadowTransform.scale(1.0, fScaleValue);
aNewShadowTransform.shearX(sin(fShearValue));
diff --git a/svx/source/svdraw/svdpoev.cxx b/svx/source/svdraw/svdpoev.cxx
index f6fafcf088d6..bcf9168a47cf 100644
--- a/svx/source/svdraw/svdpoev.cxx
+++ b/svx/source/svdraw/svdpoev.cxx
@@ -642,8 +642,8 @@ void SdrPolyEditView::RotateMarkedPoints(const Point& rRef, Degree100 nAngle)
ForceUndirtyMrkPnt();
OUString aStr(SvxResId(STR_EditResize));
BegUndo(aStr,GetDescriptionOfMarkedPoints(),SdrRepeatFunc::Rotate);
- double nSin = sin(nAngle.get() * F_PI18000);
- double nCos = cos(nAngle.get() * F_PI18000);
+ double nSin = sin(toRadians(nAngle));
+ double nCos = cos(toRadians(nAngle));
ImpTransformMarkedPoints(ImpRotate,&rRef,&nAngle,&nSin,&nCos);
EndUndo();
AdjustMarkHdl();
diff --git a/svx/source/svdraw/svdtrans.cxx b/svx/source/svdraw/svdtrans.cxx
index 6af3a49ea873..c0a8aa2605f7 100644
--- a/svx/source/svdraw/svdtrans.cxx
+++ b/svx/source/svdraw/svdtrans.cxx
@@ -128,7 +128,7 @@ void MirrorPoint(Point& rPnt, const Point& rRef1, const Point& rRef2)
rPnt-=rRef1;
Degree100 nPntAngle=GetAngle(rPnt);
Degree100 nAngle=2_deg100*(nRefAngle-nPntAngle);
- double a = nAngle.get() * F_PI18000;
+ double a = toRadians(nAngle);
double nSin=sin(a);
double nCos=cos(a);
RotatePoint(rPnt,Point(),nSin,nCos);
@@ -393,8 +393,7 @@ Degree100 GetAngle(const Point& rPnt)
if (rPnt.Y()>0) a=-9000_deg100;
else a=9000_deg100;
} else {
- a = Degree100(FRound(atan2(static_cast<double>(-rPnt.Y()), static_cast<double>(rPnt.X()))
- / F_PI18000));
+ a = Degree100(FRound(basegfx::rad2deg<100>(atan2(static_cast<double>(-rPnt.Y()), static_cast<double>(rPnt.X())))));
}
return a;
}
@@ -456,7 +455,7 @@ void GeoStat::RecalcSinCos()
mfSinRotationAngle=0.0;
mfCosRotationAngle=1.0;
} else {
- double a = nRotationAngle.get() * F_PI18000;
+ double a = toRadians(nRotationAngle);
mfSinRotationAngle=sin(a);
mfCosRotationAngle=cos(a);
}
@@ -467,7 +466,7 @@ void GeoStat::RecalcTan()
if (nShearAngle==0_deg100) {
mfTanShearAngle=0.0;
} else {
- double a = nShearAngle.get() * F_PI18000;
+ double a = toRadians(nShearAngle);
mfTanShearAngle=tan(a);
}
}
diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx
index 88b2071b2363..a79882e03a52 100644
--- a/svx/source/table/viewcontactoftableobj.cxx
+++ b/svx/source/table/viewcontactoftableobj.cxx
@@ -373,7 +373,7 @@ namespace sdr::contact
// create object matrix
const GeoStat& rGeoStat(rTableObj.GetGeoStat());
const double fShearX(-rGeoStat.mfTanShearAngle);
- const double fRotate(rGeoStat.nRotationAngle ? (36000 - rGeoStat.nRotationAngle.get()) * F_PI18000 : 0.0);
+ const double fRotate(rGeoStat.nRotationAngle ? toRadians(36000_deg100 - rGeoStat.nRotationAngle) : 0.0);
const basegfx::B2DHomMatrix aObjectMatrix(basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate,
aObjectRange.getMinX(), aObjectRange.getMinY()));
@@ -437,7 +437,7 @@ namespace sdr::contact
// create object matrix
const GeoStat& rGeoStat(rTableObj.GetGeoStat());
const double fShearX(-rGeoStat.mfTanShearAngle);
- const double fRotate(rGeoStat.nRotationAngle ? (36000 - rGeoStat.nRotationAngle.get()) * F_PI18000 : 0.0);
+ const double fRotate(rGeoStat.nRotationAngle ? toRadians(36000_deg100 - rGeoStat.nRotationAngle) : 0.0);
const basegfx::B2DHomMatrix aObjectMatrix(basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate,
aObjectRange.getMinX(), aObjectRange.getMinY()));
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 5965bb11cd2a..98a104c49fc8 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -2326,8 +2326,8 @@ bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertyMapEn
nAngle -= GetSdrObject()->GetRotateAngle();
if (nAngle)
{
- double nSin = sin(nAngle.get() * F_PI18000);
- double nCos = cos(nAngle.get() * F_PI18000);
+ double nSin = sin(toRadians(nAngle));
+ double nCos = cos(toRadians(nAngle));
GetSdrObject()->Rotate(aRef1,nAngle,nSin,nCos);
}
return true;
@@ -2346,7 +2346,7 @@ bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertyMapEn
if(nShear)
{
Point aRef1(GetSdrObject()->GetSnapRect().Center());
- double nTan = tan(nShear.get() * F_PI18000);
+ double nTan = tan(toRadians(nShear));
GetSdrObject()->Shear(aRef1,nShear,nTan,false);
return true;
}
diff --git a/svx/source/xoutdev/xtabgrdt.cxx b/svx/source/xoutdev/xtabgrdt.cxx
index 5010ff2e49bd..76438afdcb9a 100644
--- a/svx/source/xoutdev/xtabgrdt.cxx
+++ b/svx/source/xoutdev/xtabgrdt.cxx
@@ -158,7 +158,7 @@ BitmapEx XGradientList::CreateBitmap( tools::Long nIndex, const Size& rSize ) co
static_cast<double>(rGradient.GetBorder()) * 0.01,
static_cast<double>(rGradient.GetXOffset()) * 0.01,
static_cast<double>(rGradient.GetYOffset()) * 0.01,
- static_cast<double>(rGradient.GetAngle().get()) * F_PI1800,
+ toRadians(rGradient.GetAngle()),
aStart,
aEnd);
diff --git a/svx/source/xoutdev/xtabhtch.cxx b/svx/source/xoutdev/xtabhtch.cxx
index 19bc8b737887..f71540012b93 100644
--- a/svx/source/xoutdev/xtabhtch.cxx
+++ b/svx/source/xoutdev/xtabhtch.cxx
@@ -119,7 +119,7 @@ BitmapEx XHatchList::CreateBitmap( tools::Long nIndex, const Size& rSize) const
const drawinglayer::attribute::FillHatchAttribute aFillHatch(
aHatchStyle,
static_cast<double>(rHatch.GetDistance()) * fScaleValue,
- static_cast<double>(rHatch.GetAngle().get()) * F_PI1800,
+ toRadians(rHatch.GetAngle()),
rHatch.GetColor().getBColor(),
3, // same default as VCL, a minimum of three discrete units (pixels) offset
false);
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 2efafc412d82..dd15aeee8445 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -110,16 +110,15 @@ void lclMovePositionWithRotation(awt::Point& aPos, const Size& rSize, Degree100
// Use nRotation in [0;9000], for to have only one and not four cases.
if (nRotation100 == 0_deg100)
return;
- sal_Int64 nRotation = nRotation100.get();
- if (nRotation < 0)
- nRotation = (36000 + nRotation) % 36000;
- if (nRotation % 18000 == 0)
- nRotation = 0; // prevents endless loop
- while (nRotation > 9000)
- nRotation = (18000 - (nRotation % 18000));
-
- double fVal = static_cast<double>(nRotation) * F_PI18000;
- double fCos = (nRotation == 9000) ? 0.0 : cos(fVal);
+ if (nRotation100 < 0_deg100)
+ nRotation100 = (36000_deg100 + nRotation100) % 36000_deg100;
+ if (nRotation100 % 18000_deg100 == 0_deg100)
+ nRotation100 = 0_deg100; // prevents endless loop
+ while (nRotation100 > 9000_deg100)
+ nRotation100 = 18000_deg100 - (nRotation100 % 18000_deg100);
+
+ double fVal = toRadians(nRotation100);
+ double fCos = (nRotation100 == 9000_deg100) ? 0.0 : cos(fVal);
double fSin = sin(fVal);
double fWidthHalf = static_cast<double>(rSize.Width()) / 2.0;
diff --git a/tools/source/generic/point.cxx b/tools/source/generic/point.cxx
index 7308d25f7878..e9c3bd842a15 100644
--- a/tools/source/generic/point.cxx
+++ b/tools/source/generic/point.cxx
@@ -70,7 +70,7 @@ void Point::RotateAround( tools::Long& rX, tools::Long& rY,
}
else
{
- double nRealOrientation = nOrientation.get() * F_PI1800;
+ double nRealOrientation = toRadians(nOrientation);
double nCos = cos( nRealOrientation );
double nSin = sin( nRealOrientation );
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index 6a9aff2be250..13d2df0e47ef 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -1404,7 +1404,7 @@ void Polygon::Rotate( const Point& rCenter, Degree10 nAngle10 )
if( nAngle10 )
{
- const double fAngle = F_PI1800 * nAngle10.get();
+ const double fAngle = toRadians(nAngle10);
Rotate( rCenter, sin( fAngle ), cos( fAngle ) );
}
}
diff --git a/tools/source/generic/poly2.cxx b/tools/source/generic/poly2.cxx
index 631e88caf401..c6d0a46032c8 100644
--- a/tools/source/generic/poly2.cxx
+++ b/tools/source/generic/poly2.cxx
@@ -261,7 +261,7 @@ void PolyPolygon::Rotate( const Point& rCenter, Degree10 nAngle10 )
if( nAngle10 )
{
- const double fAngle = F_PI1800 * nAngle10.get();
+ const double fAngle = toRadians(nAngle10);
Rotate( rCenter, sin( fAngle ), cos( fAngle ) );
}
}
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index f7c922b8aa9e..99b9066d3a0a 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -41,11 +41,6 @@
#include <sallayout.hxx>
#include <hb-coretext.h>
-static double toRadian(int nDegree)
-{
- return nDegree * (M_PI / 1800.0);
-}
-
CoreTextStyle::CoreTextStyle(const vcl::font::PhysicalFontFace& rPFF, const vcl::font::FontSelectPattern& rFSP)
: LogicalFontInstance(rPFF, rFSP)
, mfFontStretch( 1.0 )
@@ -56,7 +51,7 @@ CoreTextStyle::CoreTextStyle(const vcl::font::PhysicalFontFace& rPFF, const vcl:
double fScaledFontHeight = rFSP.mfExactHeight;
// convert font rotation to radian
- mfFontRotation = toRadian(rFSP.mnOrientation.get());
+ mfFontRotation = toRadians(rFSP.mnOrientation);
// dummy matrix so we can use CGAffineTransformConcat() below
CGAffineTransform aMatrix = CGAffineTransformMakeTranslation(0, 0);
@@ -90,7 +85,7 @@ CoreTextStyle::CoreTextStyle(const vcl::font::PhysicalFontFace& rPFF, const vcl:
(rFSP.GetItalic() == ITALIC_OBLIQUE)) &&
(rPFF.GetItalic() == ITALIC_NONE))
{
- aMatrix = CGAffineTransformConcat(aMatrix, CGAffineTransformMake(1, 0, toRadian(120), 1, 0, 0));
+ aMatrix = CGAffineTransformConcat(aMatrix, CGAffineTransformMake(1, 0, basegfx::deg2rad(12), 1, 0, 0));
}
CTFontDescriptorRef pFontDesc = reinterpret_cast<CTFontDescriptorRef>(rPFF.GetFontId());
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 81f581d6ff78..ae07357cb0c1 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -2205,7 +2205,7 @@ bool SkiaSalGraphicsImpl::implDrawGradient(const basegfx::B2DPolyPolygon& rPolyP
return true;
}
-static double toRadian(Degree10 degree10th) { return (3600 - degree10th.get()) * M_PI / 1800.0; }
+static double toRadian(Degree10 degree10th) { return toRadians(3600_deg10 - degree10th); }
static double toCos(Degree10 degree10th) { return SkScalarCos(toRadian(degree10th)); }
static double toSin(Degree10 degree10th) { return SkScalarSin(toRadian(degree10th)); }
diff --git a/vcl/source/bitmap/bitmappaint.cxx b/vcl/source/bitmap/bitmappaint.cxx
index e06f96e8abd7..034fd5738a2a 100644
--- a/vcl/source/bitmap/bitmappaint.cxx
+++ b/vcl/source/bitmap/bitmappaint.cxx
@@ -363,8 +363,8 @@ bool Bitmap::Rotate(Degree10 nAngle10, const Color& rFillColor)
if (pWriteAcc)
{
const BitmapColor aFillColor(pWriteAcc->GetBestMatchingColor(rFillColor));
- const double fCosAngle = cos(nAngle10.get() * F_PI1800);
- const double fSinAngle = sin(nAngle10.get() * F_PI1800);
+ const double fCosAngle = cos(toRadians(nAngle10));
+ const double fSinAngle = sin(toRadians(nAngle10));
const double fXMin = aNewBound.Left();
const double fYMin = aNewBound.Top();
const tools::Long nWidth = aSizePix.Width();
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 86e020b92dac..3607a81ec2e8 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -825,7 +825,7 @@ void GDIMetaFile::Rotate( Degree10 nAngle10 )
GDIMetaFile aMtf;
ScopedVclPtrInstance< VirtualDevice > aMapVDev;
- const double fAngle = F_PI1800 * nAngle10.get();
+ const double fAngle = toRadians(nAngle10);
const double fSin = sin( fAngle );
const double fCos = cos( fAngle );
tools::Rectangle aRect( Point(), GetPrefSize() );
diff --git a/vcl/source/gdi/gradient.cxx b/vcl/source/gdi/gradient.cxx
index 899861cfc222..b94223a427c4 100644
--- a/vcl/source/gdi/gradient.cxx
+++ b/vcl/source/gdi/gradient.cxx
@@ -201,7 +201,7 @@ void Gradient::GetBoundRect( const tools::Rectangle& rRect, tools::Rectangle& rB
if( GetStyle() == GradientStyle::Linear || GetStyle() == GradientStyle::Axial )
{
- const double fAngle = nAngle.get() * F_PI1800;
+ const double fAngle = toRadians(nAngle);
const double fWidth = aRect.GetWidth();
const double fHeight = aRect.GetHeight();
double fDX = fWidth * fabs( cos( fAngle ) ) +
@@ -222,7 +222,7 @@ void Gradient::GetBoundRect( const tools::Rectangle& rRect, tools::Rectangle& rB
{
if( GetStyle() == GradientStyle::Square || GetStyle() == GradientStyle::Rect )
{
- const double fAngle = nAngle.get() * F_PI1800;
+ const double fAngle = toRadians(nAngle);
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/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 6aa8cb0eec73..48dda1916a0f 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -7138,7 +7138,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().get()) * M_PI / 1800.0;
+ double fAngle = toRadians(m_aCurrentPDFState.m_aFont.GetOrientation());
Matrix3 aMat;
aMat.rotate( fAngle );
aMat.translate( aPos.X(), aPos.Y() );
diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx
index 89e89f8a1db4..160aa904ffd6 100644
--- a/vcl/source/outdev/hatch.cxx
+++ b/vcl/source/outdev/hatch.cxx
@@ -236,7 +236,7 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long n
}
else if( nAngle >= Degree10(-450) && nAngle <= 450_deg10 )
{
- const double fAngle = F_PI1800 * std::abs( nAngle.get() );
+ const double fAngle = std::abs( toRadians(nAngle) );
const double fTan = tan( fAngle );
const tools::Long nYOff = FRound( ( rRect.Right() - rRect.Left() ) * fTan );
tools::Long nPY;
@@ -269,7 +269,7 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long n
}
else
{
- const double fAngle = F_PI1800 * std::abs( nAngle.get() );
+ const double fAngle = std::abs( toRadians(nAngle) );
const double fTan = tan( fAngle );
const tools::Long nXOff = FRound( ( rRect.Bottom() - rRect.Top() ) / fTan );
tools::Long nPX;
diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx
index 5fe1538f37f4..c4fcb33bf5d0 100644
--- a/vcl/source/outdev/textline.cxx
+++ b/vcl/source/outdev/textline.cxx
@@ -759,7 +759,7 @@ void OutputDevice::ImplDrawTextLine( tools::Long nX, tools::Long nY,
{
tools::Long nXAdd = nWidth - nDistX;
if( mpFontInstance->mnOrientation )
- nXAdd = FRound( nXAdd * cos( mpFontInstance->mnOrientation.get() * F_PI1800 ) );
+ nXAdd = FRound( nXAdd * cos( toRadians(mpFontInstance->mnOrientation) ) );
nX += nXAdd - 1;
}
@@ -831,7 +831,7 @@ void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout, FontStrikeout eStri
if( mpFontInstance->mnOrientation )
{
const tools::Long nDY = aPos.Y() - aStartPt.Y();
- const double fRad = mpFontInstance->mnOrientation.get() * F_PI1800;
+ const double fRad = toRadians(mpFontInstance->mnOrientation);
nDist = FRound( nDist*cos(fRad) - nDY*sin(fRad) );
}
}
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index 35e352555a10..b14c018652a4 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -95,7 +95,7 @@ namespace
double toRadian(Degree10 nDegree10th)
{
- return (3600_deg10 - nDegree10th).get() * M_PI / 1800.0;
+ return toRadians(3600_deg10 - nDegree10th);
}
cairo_t* syncCairoContext(cairo_t* cr)
diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
index 5754e2e6448c..29fca5443a6c 100644
--- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
@@ -418,7 +418,7 @@ FreetypeFont::FreetypeFont(FreetypeFontInstance& rFontInstance, const std::share
if( rFSD.mnOrientation )
{
- const double dRad = rFSD.mnOrientation.get() * ( 2 * M_PI / 3600.0 );
+ const double dRad = toRadians(rFSD.mnOrientation);
mnCos = static_cast<tools::Long>( 0x10000 * cos( dRad ) + 0.5 );
mnSin = static_cast<tools::Long>( 0x10000 * sin( dRad ) + 0.5 );
}
diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx
index 0100a25ef03e..354bda7c8ce7 100644
--- a/xmloff/source/text/XMLTextFrameContext.cxx
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -1030,7 +1030,7 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl(
// CAUTION-II: due to tdf#115782 it is better for current ODF to indeed use it
// with the wrong orientation as in all other cases - ARGH! We will need to
// correct this in future ODF ASAP! For now, mirror the rotation here AGAIN
- const double fRotate(aDecomposedTransform.getRotate() * (-1800.0/M_PI));
+ const double fRotate(-basegfx::rad2deg<10>(aDecomposedTransform.getRotate()));
nRotation = static_cast< sal_Int16 >(basegfx::fround(fRotate) % 3600);
// tdf#115529 may be negative, with the above modulo maximal -3599, so
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index b3a26d955ee2..732c119cdb58 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -3080,7 +3080,7 @@ void XMLTextParagraphExport::_exportTextGraphic(
// in XMLTextFrameContext_Impl::XMLTextFrameContext_Impl and #i78696#
// CAUTION-II: due to tdf#115782 it is better for current ODF to indeed write it with the wrong
// orientation as in all other cases - ARGH! We will need to correct this in future ODF ASAP!
- const double fRotate(static_cast< double >(nRotation) * (M_PI/1800.0));
+ const double fRotate(basegfx::deg2rad<10>(nRotation));
// transform to rotation center which is the object's center
aSdXMLImExTransform2D.AddTranslate(-aCenter);