summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2020-12-22 15:42:08 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-01-02 15:26:38 +0100
commit11e52fe2979b0947814a49b9c17ec373795cbf8e (patch)
tree48268579f052b7fdfcc2c334fffe8c91d29cb234 /svx
parent610ceb05025c9c7a9a34dddcb0dac506b8eab441 (diff)
introduce Degree100 strong_int type
Change-Id: I78f837a1340be0ca5c49097f543a481b7b43a632 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108367 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/dragmt3d.hxx4
-rw-r--r--svx/inc/sxcaitm.hxx2
-rw-r--r--svx/inc/sxmtaitm.hxx2
-rw-r--r--svx/inc/sxroaitm.hxx2
-rw-r--r--svx/inc/sxrooitm.hxx2
-rw-r--r--svx/inc/sxsaitm.hxx2
-rw-r--r--svx/inc/sxsalitm.hxx4
-rw-r--r--svx/inc/sxsoitm.hxx4
-rw-r--r--svx/qa/unit/customshapes.cxx2
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx6
-rw-r--r--svx/source/customshapes/EnhancedCustomShape3d.cxx4
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeEngine.cxx10
-rw-r--r--svx/source/dialog/dialcontrol.cxx23
-rw-r--r--svx/source/dialog/imapwnd.cxx8
-rw-r--r--svx/source/engine3d/dragmt3d.cxx8
-rw-r--r--svx/source/engine3d/obj3d.cxx4
-rw-r--r--svx/source/engine3d/scene3d.cxx4
-rw-r--r--svx/source/items/algitem.cxx12
-rw-r--r--svx/source/items/autoformathelper.cxx4
-rw-r--r--svx/source/sdr/contact/viewcontactofgraphic.cxx6
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx2
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrcircobj.cxx2
-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/properties/circleproperties.cxx2
-rw-r--r--svx/source/sidebar/possize/PosSizePropertyPanel.cxx11
-rw-r--r--svx/source/svdraw/svdattr.cxx6
-rw-r--r--svx/source/svdraw/svddrgm1.hxx12
-rw-r--r--svx/source/svdraw/svddrgmt.cxx144
-rw-r--r--svx/source/svdraw/svdedtv1.cxx58
-rw-r--r--svx/source/svdraw/svdedxv.cxx2
-rw-r--r--svx/source/svdraw/svdfmtf.cxx17
-rw-r--r--svx/source/svdraw/svdglev.cxx6
-rw-r--r--svx/source/svdraw/svdglue.cxx90
-rw-r--r--svx/source/svdraw/svdhdl.cxx30
-rw-r--r--svx/source/svdraw/svdmodel.cxx4
-rw-r--r--svx/source/svdraw/svdmrkv.cxx4
-rw-r--r--svx/source/svdraw/svdoashp.cxx49
-rw-r--r--svx/source/svdraw/svdobj.cxx46
-rw-r--r--svx/source/svdraw/svdocirc.cxx143
-rw-r--r--svx/source/svdraw/svdoedge.cxx4
-rw-r--r--svx/source/svdraw/svdograf.cxx12
-rw-r--r--svx/source/svdraw/svdogrp.cxx20
-rw-r--r--svx/source/svdraw/svdomeas.cxx34
-rw-r--r--svx/source/svdraw/svdopath.cxx92
-rw-r--r--svx/source/svdraw/svdorect.cxx28
-rw-r--r--svx/source/svdraw/svdotext.cxx44
-rw-r--r--svx/source/svdraw/svdotxdr.cxx8
-rw-r--r--svx/source/svdraw/svdotxed.cxx2
-rw-r--r--svx/source/svdraw/svdotxtr.cxx60
-rw-r--r--svx/source/svdraw/svdouno.cxx8
-rw-r--r--svx/source/svdraw/svdovirt.cxx16
-rw-r--r--svx/source/svdraw/svdpdf.cxx5
-rw-r--r--svx/source/svdraw/svdpoev.cxx6
-rw-r--r--svx/source/svdraw/svdtrans.cxx75
-rw-r--r--svx/source/table/viewcontactoftableobj.cxx4
-rw-r--r--svx/source/tbxctrls/grafctrl.cxx6
-rw-r--r--svx/source/uitest/sdrobject.cxx4
-rw-r--r--svx/source/unodraw/unoshape.cxx28
61 files changed, 598 insertions, 609 deletions
diff --git a/svx/inc/dragmt3d.hxx b/svx/inc/dragmt3d.hxx
index d174d966c062..79402d0defce 100644
--- a/svx/inc/dragmt3d.hxx
+++ b/svx/inc/dragmt3d.hxx
@@ -36,8 +36,8 @@ public:
basegfx::B3DHomMatrix maInvDisplayTransform;
basegfx::B3DHomMatrix maInitTransform;
basegfx::B3DHomMatrix maTransform;
- sal_Int32 mnStartAngle;
- sal_Int32 mnLastAngle;
+ Degree100 mnStartAngle;
+ Degree100 mnLastAngle;
E3dDragMethodUnit(E3dObject& r3DObj)
: mr3DObj(r3DObj),
diff --git a/svx/inc/sxcaitm.hxx b/svx/inc/sxcaitm.hxx
index d6e216bf5493..26d4a3194329 100644
--- a/svx/inc/sxcaitm.hxx
+++ b/svx/inc/sxcaitm.hxx
@@ -35,7 +35,7 @@
class SdrCaptionAngleItem final : public SdrAngleItem
{
public:
- SdrCaptionAngleItem(tools::Long nAngle = 0)
+ SdrCaptionAngleItem(Degree100 nAngle = 0_deg100)
: SdrAngleItem(SDRATTR_CAPTIONANGLE, nAngle)
{
}
diff --git a/svx/inc/sxmtaitm.hxx b/svx/inc/sxmtaitm.hxx
index ed2c3f440829..8798b05e13de 100644
--- a/svx/inc/sxmtaitm.hxx
+++ b/svx/inc/sxmtaitm.hxx
@@ -38,7 +38,7 @@ public:
// Angle in 1/100deg from viewpoint of the user.
class SdrMeasureTextAutoAngleViewItem final : public SdrAngleItem {
public:
- SdrMeasureTextAutoAngleViewItem(tools::Long nVal=31500): SdrAngleItem(SDRATTR_MEASURETEXTAUTOANGLEVIEW,nVal) {}
+ SdrMeasureTextAutoAngleViewItem(Degree100 nVal=31500_deg100): SdrAngleItem(SDRATTR_MEASURETEXTAUTOANGLEVIEW,nVal) {}
virtual SdrMeasureTextAutoAngleViewItem* Clone(SfxItemPool*) const override
{
return new SdrMeasureTextAutoAngleViewItem(*this);
diff --git a/svx/inc/sxroaitm.hxx b/svx/inc/sxroaitm.hxx
index 66785c68af7e..7f1aec1c54e5 100644
--- a/svx/inc/sxroaitm.hxx
+++ b/svx/inc/sxroaitm.hxx
@@ -26,7 +26,7 @@ class SdrRotateAllItem final : public SdrAngleItem
{
public:
SdrRotateAllItem()
- : SdrAngleItem(SDRATTR_ROTATEALL, 0)
+ : SdrAngleItem(SDRATTR_ROTATEALL, 0_deg100)
{
}
virtual SdrRotateAllItem* Clone(SfxItemPool*) const override
diff --git a/svx/inc/sxrooitm.hxx b/svx/inc/sxrooitm.hxx
index 28ceadafd90a..39cef3d4b1d2 100644
--- a/svx/inc/sxrooitm.hxx
+++ b/svx/inc/sxrooitm.hxx
@@ -24,7 +24,7 @@
class SdrRotateOneItem: public SdrAngleItem {
public:
- SdrRotateOneItem(): SdrAngleItem(SDRATTR_ROTATEONE,0) {}
+ SdrRotateOneItem(): SdrAngleItem(SDRATTR_ROTATEONE,0_deg100) {}
SdrRotateOneItem* Clone(SfxItemPool*) const override
{
return new SdrRotateOneItem(*this);
diff --git a/svx/inc/sxsaitm.hxx b/svx/inc/sxsaitm.hxx
index 1591dfa4938f..01824ef9e4a1 100644
--- a/svx/inc/sxsaitm.hxx
+++ b/svx/inc/sxsaitm.hxx
@@ -25,7 +25,7 @@
class SdrShearAngleItem : public SdrAngleItem
{
public:
- SdrShearAngleItem(tools::Long nAngle = 0)
+ SdrShearAngleItem(Degree100 nAngle = 0_deg100)
: SdrAngleItem(SDRATTR_SHEARANGLE, nAngle)
{
}
diff --git a/svx/inc/sxsalitm.hxx b/svx/inc/sxsalitm.hxx
index f73b460a9800..6e0cb2b38f70 100644
--- a/svx/inc/sxsalitm.hxx
+++ b/svx/inc/sxsalitm.hxx
@@ -24,7 +24,7 @@
class SdrHorzShearAllItem: public SdrAngleItem {
public:
- SdrHorzShearAllItem(): SdrAngleItem(SDRATTR_HORZSHEARALL,0) {}
+ SdrHorzShearAllItem(): SdrAngleItem(SDRATTR_HORZSHEARALL,0_deg100) {}
virtual SdrHorzShearAllItem* Clone(SfxItemPool*) const override
{
return new SdrHorzShearAllItem(*this);
@@ -33,7 +33,7 @@ public:
class SdrVertShearAllItem: public SdrAngleItem {
public:
- SdrVertShearAllItem(): SdrAngleItem(SDRATTR_VERTSHEARALL,0) {}
+ SdrVertShearAllItem(): SdrAngleItem(SDRATTR_VERTSHEARALL,0_deg100) {}
virtual SdrVertShearAllItem* Clone(SfxItemPool*) const override
{
return new SdrVertShearAllItem(*this);
diff --git a/svx/inc/sxsoitm.hxx b/svx/inc/sxsoitm.hxx
index 2c5273a5bda7..75faab3f1d66 100644
--- a/svx/inc/sxsoitm.hxx
+++ b/svx/inc/sxsoitm.hxx
@@ -24,7 +24,7 @@
class SdrHorzShearOneItem: public SdrAngleItem {
public:
- SdrHorzShearOneItem(): SdrAngleItem(SDRATTR_HORZSHEARONE,0) {}
+ SdrHorzShearOneItem(): SdrAngleItem(SDRATTR_HORZSHEARONE,0_deg100) {}
SdrHorzShearOneItem* Clone(SfxItemPool*) const override
{
return new SdrHorzShearOneItem(*this);
@@ -33,7 +33,7 @@ public:
class SdrVertShearOneItem: public SdrAngleItem {
public:
- SdrVertShearOneItem(): SdrAngleItem(SDRATTR_VERTSHEARONE,0) {}
+ SdrVertShearOneItem(): SdrAngleItem(SDRATTR_VERTSHEARONE,0_deg100) {}
SdrVertShearOneItem* Clone(SfxItemPool*) const override
{
return new SdrVertShearOneItem(*this);
diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index fe4e22f0a909..d0d4ac3d3e6d 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -863,7 +863,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf136176)
static_cast<SdrObjCustomShape&>(*GetSdrObjectFromXShape(xShape)));
// apply shearing 20deg
const Point aCenter = rSdrObjCustomShape.GetSnapRect().Center();
- rSdrObjCustomShape.Shear(aCenter, 2000, tan(basegfx::deg2rad(20.0)), false);
+ rSdrObjCustomShape.Shear(aCenter, 2000_deg100, tan(basegfx::deg2rad(20.0)), false);
}
// Save and reload
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index fb8fce63bc61..57d622eb6acc 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -749,7 +749,7 @@ EnhancedCustomShape2d::EnhancedCustomShape2d(SdrObjCustomShape& rSdrObjCustomSha
if ( pAny )
*pAny >>= bFlipV;
- nRotateAngle = static_cast<sal_Int32>(mrSdrObjCustomShape.GetObjectRotation() * 100.0);
+ nRotateAngle = Degree100(static_cast<sal_Int32>(mrSdrObjCustomShape.GetObjectRotation() * 100.0));
/*const sal_Int32* pDefData =*/ ApplyShapeAttributes( rGeometryItem );
SetPathSize();
@@ -1174,7 +1174,7 @@ bool EnhancedCustomShape2d::GetHandlePosition( const sal_uInt32 nIndex, Point& r
}
if ( nRotateAngle )
{
- double a = nRotateAngle * F_PI18000;
+ double a = toRadians(nRotateAngle);
RotatePoint( rReturnPosition, Point( aLogicRect.GetWidth() / 2, aLogicRect.GetHeight() / 2 ), sin( a ), cos( a ) );
}
if ( bFlipH )
@@ -1488,7 +1488,7 @@ bool EnhancedCustomShape2d::SetHandleControllerPosition( const sal_uInt32 nIndex
aP.setY( aLogicRect.GetHeight() - aP.Y() );
if ( nRotateAngle )
{
- double a = -nRotateAngle * F_PI18000;
+ double a = -toRadians(nRotateAngle);
RotatePoint( aP, Point( aLogicRect.GetWidth() / 2, aLogicRect.GetHeight() / 2 ), sin( a ), cos( a ) );
}
const GeoStat aGeoStat(mrSdrObjCustomShape.GetGeoStat());
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx
index f83be9f8e817..651d176f6076 100644
--- a/svx/source/customshapes/EnhancedCustomShape3d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx
@@ -271,10 +271,10 @@ SdrObject* EnhancedCustomShape3d::Create3DObject(
bool bIsMirroredX(rSdrObjCustomShape.IsMirroredX());
bool bIsMirroredY(rSdrObjCustomShape.IsMirroredY());
tools::Rectangle aSnapRect(rSdrObjCustomShape.GetLogicRect());
- tools::Long nObjectRotation(rSdrObjCustomShape.GetRotateAngle());
+ Degree100 nObjectRotation(rSdrObjCustomShape.GetRotateAngle());
if ( nObjectRotation )
{
- double a = (36000 - nObjectRotation) * F_PI18000;
+ double a = (36000 - nObjectRotation.get()) * F_PI18000;
tools::Long dx = aSnapRect.Right() - aSnapRect.Left();
tools::Long dy = aSnapRect.Bottom()- aSnapRect.Top();
Point aP( aSnapRect.TopLeft() );
diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
index 11f26ff775b2..d4635c4e0ddd 100644
--- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
@@ -282,7 +282,7 @@ Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render()
*pAny >>= bTextPathOn;
EnhancedCustomShape2d aCustomShape2d(rSdrObjCustomShape);
- sal_Int32 nRotateAngle = aCustomShape2d.GetRotateAngle();
+ Degree100 nRotateAngle = aCustomShape2d.GetRotateAngle();
bool bFlipV = aCustomShape2d.IsFlipVert();
bool bFlipH = aCustomShape2d.IsFlipHorz();
@@ -307,7 +307,7 @@ Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render()
if (xRenderedShape3d)
{
bFlipV = bFlipH = false;
- nRotateAngle = 0;
+ nRotateAngle = 0_deg100;
xRenderedShape = std::move(xRenderedShape3d);
}
@@ -316,7 +316,7 @@ Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render()
if ( rGeoStat.nShearAngle )
{
- tools::Long nShearAngle = rGeoStat.nShearAngle;
+ Degree100 nShearAngle = rGeoStat.nShearAngle;
double nTan = rGeoStat.mfTanShearAngle;
if (bFlipV != bFlipH)
{
@@ -413,7 +413,7 @@ drawing::PolyPolygonBezierCoords SAL_CALL EnhancedCustomShapeEngine::getLineGeom
if ( rGeoStat.nShearAngle )
{
- tools::Long nShearAngle = rGeoStat.nShearAngle;
+ Degree100 nShearAngle = rGeoStat.nShearAngle;
double nTan = rGeoStat.mfTanShearAngle;
if (bFlipV != bFlipH)
{
@@ -422,7 +422,7 @@ drawing::PolyPolygonBezierCoords SAL_CALL EnhancedCustomShapeEngine::getLineGeom
}
pObj->Shear( aRect.Center(), nShearAngle, nTan, false);
}
- sal_Int32 nRotateAngle = aCustomShape2d.GetRotateAngle();
+ Degree100 nRotateAngle = aCustomShape2d.GetRotateAngle();
if( nRotateAngle )
pObj->NbcRotate( aRect.Center(), nRotateAngle );
if ( bFlipH )
diff --git a/svx/source/dialog/dialcontrol.cxx b/svx/source/dialog/dialcontrol.cxx
index 9052d439bd26..ff8f0eee1529 100644
--- a/svx/source/dialog/dialcontrol.cxx
+++ b/svx/source/dialog/dialcontrol.cxx
@@ -63,9 +63,9 @@ void DialControlBmp::DrawBackground( const Size& rSize, bool bEnabled )
DrawBackground();
}
-void DialControlBmp::DrawElements( const OUString& rText, sal_Int32 nAngle )
+void DialControlBmp::DrawElements( const OUString& rText, Degree100 nAngle )
{
- double fAngle = basegfx::deg2rad(nAngle) / 100.0;
+ double fAngle = toRadians(nAngle);
double fSin = sin( fAngle );
double fCos = cos( fAngle );
double fWidth = GetTextWidth( rText ) / 2.0;
@@ -76,7 +76,7 @@ void DialControlBmp::DrawElements( const OUString& rText, sal_Int32 nAngle )
// rotated text
vcl::Font aFont( GetFont() );
aFont.SetColor( GetTextColor() );
- aFont.SetOrientation( Degree10(static_cast< sal_Int16 >( (nAngle + 5) / 10 )) ); // Font uses 1/10 degrees
+ aFont.SetOrientation( toDegree10(nAngle) ); // Font uses 1/10 degrees
aFont.SetWeight( WEIGHT_BOLD );
SetFont( aFont );
@@ -99,7 +99,7 @@ void DialControlBmp::DrawElements( const OUString& rText, sal_Int32 nAngle )
// *** drag button ***
- bool bMain = (nAngle % 4500) != 0;
+ bool bMain = (nAngle % 4500_deg100) != 0_deg100;
SetLineColor( GetButtonLineColor() );
SetFillColor( GetButtonFillColor( bMain ) );
@@ -348,12 +348,12 @@ void DialControl::SetNoRotation()
}
}
-sal_Int32 DialControl::GetRotation() const
+Degree100 DialControl::GetRotation() const
{
return mpImpl->mnAngle;
}
-void DialControl::SetRotation(sal_Int32 nAngle)
+void DialControl::SetRotation(Degree100 nAngle)
{
SetRotation(nAngle, false);
}
@@ -380,7 +380,7 @@ void DialControl::SetLinkedField(weld::MetricSpinButton* pField, sal_Int32 nDeci
IMPL_LINK_NOARG(DialControl, LinkedFieldModifyHdl, weld::MetricSpinButton&, void)
{
- SetRotation(mpImpl->mpLinkField->get_value(FieldUnit::DEGREE) * mpImpl->mnLinkedFieldValueMultiplyer, true);
+ SetRotation(Degree100(mpImpl->mpLinkField->get_value(FieldUnit::DEGREE) * mpImpl->mnLinkedFieldValueMultiplyer), true);
}
void DialControl::SaveValue()
@@ -420,20 +420,19 @@ void DialControl::InvalidateControl()
Invalidate();
}
-void DialControl::SetRotation(sal_Int32 nAngle, bool bBroadcast)
+void DialControl::SetRotation(Degree100 nAngle, bool bBroadcast)
{
bool bOldSel = mpImpl->mbNoRot;
mpImpl->mbNoRot = false;
- while (nAngle < 0)
- nAngle += 36000;
+ nAngle = NormAngle36000(nAngle);
if (!bOldSel || (mpImpl->mnAngle != nAngle))
{
mpImpl->mnAngle = nAngle;
InvalidateControl();
if( mpImpl->mpLinkField )
- mpImpl->mpLinkField->set_value(GetRotation() / mpImpl->mnLinkedFieldValueMultiplyer, FieldUnit::DEGREE);
+ mpImpl->mpLinkField->set_value(GetRotation().get() / mpImpl->mnLinkedFieldValueMultiplyer, FieldUnit::DEGREE);
if( bBroadcast )
mpImpl->maModifyHdl.Call(*this);
}
@@ -459,7 +458,7 @@ void DialControl::HandleMouseEvent( const Point& rPos, bool bInitial )
nAngle = ((nAngle + 750) / 1500) * 1500;
// Round up to 1 degree
nAngle = (((nAngle + 50) / 100) * 100) % 36000;
- SetRotation(nAngle, true);
+ SetRotation(Degree100(nAngle), true);
}
}
diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx
index 14345a5cdaff..6a2c5ef91048 100644
--- a/svx/source/dialog/imapwnd.cxx
+++ b/svx/source/dialog/imapwnd.cxx
@@ -210,8 +210,8 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj )
*pModel,
SdrCircKind::Full,
aCircle,
- 0,
- 36000);
+ 0_deg100,
+ 36000_deg100);
pCloneIMapObj.reset(static_cast<IMapObject*>(new IMapCircleObject( *pIMapCircleObj )));
}
break;
@@ -232,8 +232,8 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj )
*pModel,
SdrCircKind::Full,
aDrawRect,
- 0,
- 36000);
+ 0_deg100,
+ 36000_deg100);
}
else
{
diff --git a/svx/source/engine3d/dragmt3d.cxx b/svx/source/engine3d/dragmt3d.cxx
index bffd2e533684..c27d9559875b 100644
--- a/svx/source/engine3d/dragmt3d.cxx
+++ b/svx/source/engine3d/dragmt3d.cxx
@@ -122,7 +122,7 @@ bool E3dDragMethod::BeginSdrDrag()
{
E3dDragMethodUnit& rCandidate = maGrp[nOb];
rCandidate.mnStartAngle = GetAngle(DragStat().GetStart() - DragStat().GetRef1());
- rCandidate.mnLastAngle = 0;
+ rCandidate.mnLastAngle = 0_deg100;
}
}
else
@@ -355,10 +355,10 @@ void E3dDragRotate::MoveSdrDrag(const Point& rPnt)
if(E3dDragConstraint::Z == meConstraint)
{
- fWAngle = NormAngle36000(GetAngle(rPnt - DragStat().GetRef1()) -
+ Degree100 lastAngle = NormAngle36000(GetAngle(rPnt - DragStat().GetRef1()) -
rCandidate.mnStartAngle) - rCandidate.mnLastAngle;
- rCandidate.mnLastAngle = static_cast<tools::Long>(fWAngle) + rCandidate.mnLastAngle;
- fWAngle /= 100.0;
+ rCandidate.mnLastAngle = lastAngle + rCandidate.mnLastAngle;
+ fWAngle = toDegrees(lastAngle);
fHAngle = 0.0;
}
else
diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx
index 8d813176ced4..dac98b2d0fd6 100644
--- a/svx/source/engine3d/obj3d.cxx
+++ b/svx/source/engine3d/obj3d.cxx
@@ -432,13 +432,13 @@ void E3dObject::RestGeoData(const SdrObjGeoData& rGeo)
// This is however a correct implementation, because everything that has
// happened is a rotation around the axis perpendicular to the screen and that
// is regardless of how the scene has been rotated up until now.
-void E3dObject::NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs)
+void E3dObject::NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs)
{
// So currently the glue points are defined relative to the scene aOutRect.
// Before turning the glue points are defined relative to the page. They
// take no part in the rotation of the scene. To ensure this, there is the
// SetGlueReallyAbsolute(sal_True);
- double fAngleInRad = basegfx::deg2rad(nAngle/100.0);
+ double fAngleInRad = toRadians(nAngle);
basegfx::B3DHomMatrix aRotateZ;
aRotateZ.rotate(0.0, 0.0, fAngleInRad);
diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx
index 5c9989320695..0b6632a56a8a 100644
--- a/svx/source/engine3d/scene3d.cxx
+++ b/svx/source/engine3d/scene3d.cxx
@@ -614,7 +614,7 @@ void E3dScene::SetTransform(const basegfx::B3DHomMatrix& rMatrix)
}
}
-void E3dScene::NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs)
+void E3dScene::NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs)
{
// So currently the glue points are defined relative to the scene aOutRect.
// Before turning the glue points are defined relative to the page. They
@@ -628,7 +628,7 @@ void E3dScene::NbcRotate(const Point& rRef, tools::Long nAngle, double sn, doubl
// through the enter of aOutRect's (Steiner's theorem), so RotateZ
RotateScene (rRef, sn, cs); // Rotates the scene
- double fAngleInRad = basegfx::deg2rad(nAngle/100.0);
+ double fAngleInRad = toRadians(nAngle);
basegfx::B3DHomMatrix aRotation;
aRotation.rotate(0.0, 0.0, fAngleInRad);
diff --git a/svx/source/items/algitem.cxx b/svx/source/items/algitem.cxx
index 58a71f11594c..d432963f4b3d 100644
--- a/svx/source/items/algitem.cxx
+++ b/svx/source/items/algitem.cxx
@@ -42,14 +42,14 @@ SvxOrientationItem::SvxOrientationItem( const SvxCellOrientation eOrientation,
{
}
-SvxOrientationItem::SvxOrientationItem( sal_Int32 nRotation, bool bStacked, const sal_uInt16 nId ) :
+SvxOrientationItem::SvxOrientationItem( Degree100 nRotation, bool bStacked, const sal_uInt16 nId ) :
SfxEnumItem( nId, SvxCellOrientation::Standard )
{
if( bStacked )
{
SetValue( SvxCellOrientation::Stacked );
}
- else switch( nRotation )
+ else switch( nRotation.get() )
{
case 9000: SetValue( SvxCellOrientation::BottomUp ); break;
case 27000: SetValue( SvxCellOrientation::TopBottom ); break;
@@ -128,13 +128,13 @@ bool SvxOrientationItem::IsStacked() const
return GetValue() == SvxCellOrientation::Stacked;
}
-sal_Int32 SvxOrientationItem::GetRotation( sal_Int32 nStdAngle ) const
+Degree100 SvxOrientationItem::GetRotation( Degree100 nStdAngle ) const
{
- sal_Int32 nAngle = nStdAngle;
+ Degree100 nAngle = nStdAngle;
switch( GetValue() )
{
- case SvxCellOrientation::BottomUp: nAngle = 9000;break;
- case SvxCellOrientation::TopBottom: nAngle = 27000;break;
+ case SvxCellOrientation::BottomUp: nAngle = 9000_deg100; break;
+ case SvxCellOrientation::TopBottom: nAngle = 27000_deg100; break;
default: ; //prevent warning
}
return nAngle;
diff --git a/svx/source/items/autoformathelper.cxx b/svx/source/items/autoformathelper.cxx
index a15af6d6a3e4..1148fa7d12aa 100644
--- a/svx/source/items/autoformathelper.cxx
+++ b/svx/source/items/autoformathelper.cxx
@@ -361,7 +361,7 @@ bool AutoFormatBase::LoadBlockB( SvStream& rStream, const AutoFormatVersions& rV
}
m_aStacked->SetValue( aOrientation.IsStacked() );
- m_aRotateAngle->SetValue( aOrientation.GetRotation( m_aRotateAngle->GetValue() ) );
+ m_aRotateAngle->SetValue( aOrientation.GetRotation( Degree100(m_aRotateAngle->GetValue()) ).get() );
return ERRCODE_NONE == rStream.GetError();
}
@@ -407,7 +407,7 @@ bool AutoFormatBase::SaveBlockB( SvStream& rStream, sal_uInt16 fileVersion ) con
{
legacy::SvxHorJustify::Store(*m_aHorJustify, rStream, legacy::SvxHorJustify::GetVersion(fileVersion));
legacy::SvxVerJustify::Store(*m_aVerJustify, rStream, legacy::SvxVerJustify::GetVersion(fileVersion));
- SvxOrientationItem aOrientation( m_aRotateAngle->GetValue(), m_aStacked->GetValue(), 0 );
+ SvxOrientationItem aOrientation( Degree100(m_aRotateAngle->GetValue()), m_aStacked->GetValue(), 0 );
legacy::SvxOrientation::Store(aOrientation, rStream, legacy::SvxOrientation::GetVersion(fileVersion));
legacy::SvxMargin::Store(*m_aMargin, rStream, legacy::SvxMargin::GetVersion(fileVersion));
legacy::SfxBool::Store(*m_aLinebreak, rStream, legacy::SfxBool::GetVersion(fileVersion));
diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx
index 80140953d91b..e2e0b452a296 100644
--- a/svx/source/sdr/contact/viewcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx
@@ -315,8 +315,8 @@ namespace sdr::contact
// look for mirroring
const GeoStat& rGeoStat(GetGrafObject().GetGeoStat());
- const sal_Int32 nRotationAngle(rGeoStat.nRotationAngle);
- const bool bRota180(18000 == nRotationAngle);
+ const Degree100 nRotationAngle(rGeoStat.nRotationAngle);
+ const bool bRota180(18000_deg100 == nRotationAngle);
const bool bMirrored(GetGrafObject().IsMirrored());
const sal_uInt16 nMirrorCase(bRota180 ? (bMirrored ? 3 : 4) : (bMirrored ? 2 : 1));
bool bHMirr((2 == nMirrorCase ) || (4 == nMirrorCase));
@@ -341,7 +341,7 @@ namespace sdr::contact
// fill object matrix
const double fShearX(-rGeoStat.mfTanShearAngle);
- const double fRotate(nRotationAngle ? (36000 - nRotationAngle) * F_PI18000 : 0.0);
+ const double fRotate(nRotationAngle ? (36000 - nRotationAngle.get()) * F_PI18000 : 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 3e14a74d7516..d3198802a706 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) * F_PI18000 : 0.0,
+ rGeoStat.nRotationAngle ? (36000 - rGeoStat.nRotationAngle.get()) * F_PI18000 : 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 beafebfb7dd3..7462c1080a2e 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) * F_PI18000 : 0.0,
+ rGeoStat.nRotationAngle ? (36000 - rGeoStat.nRotationAngle.get()) * F_PI18000 : 0.0,
aObjectRange.getMinX(), aObjectRange.getMinY()));
// create primitive data
diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
index 1ad9b8a0e44d..f676bd89b739 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) * F_PI18000);
+ aRotMatrix.rotate((36000 - rGeoStat.nRotationAngle.get()) * F_PI18000);
}
aRotMatrix.translate(aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY());
@@ -202,7 +202,7 @@ namespace sdr::contact
if(rGeoStat.nRotationAngle)
{
- aTextBoxMatrix.rotate((36000 - rGeoStat.nRotationAngle) * F_PI18000);
+ aTextBoxMatrix.rotate((36000 - rGeoStat.nRotationAngle.get()) * F_PI18000);
}
// give text it's target position
diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
index ab7a93f421cb..db65802718c3 100644
--- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
@@ -63,7 +63,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) * F_PI18000 : 0.0);
+ const double fRotate(rGeoStat.nRotationAngle ? (36000 - rGeoStat.nRotationAngle.get()) * F_PI18000 : 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 bae0147ae241..5d2b0f1a4494 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) * F_PI18000 : 0.0,
+ rGeoStat.nRotationAngle ? (36000 - rGeoStat.nRotationAngle.get()) * F_PI18000 : 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 370c1e8a1a07..e2c3db4b08b2 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) * F_PI18000 : 0.0,
+ rGeoStat.nRotationAngle ? (36000 - rGeoStat.nRotationAngle.get()) * F_PI18000 : 0.0,
aObjectRange.getMinX(), aObjectRange.getMinY()));
// calculate corner radius
diff --git a/svx/source/sdr/properties/circleproperties.cxx b/svx/source/sdr/properties/circleproperties.cxx
index 895029ca7939..b6965fd235bb 100644
--- a/svx/source/sdr/properties/circleproperties.cxx
+++ b/svx/source/sdr/properties/circleproperties.cxx
@@ -106,7 +106,7 @@ namespace sdr::properties
mpItemSet->Put(makeSdrCircStartAngleItem(rObj.GetStartAngle()));
}
- if(rObj.GetEndAngle() != 36000)
+ if(rObj.GetEndAngle() != 36000_deg100)
{
mpItemSet->Put(makeSdrCircEndAngleItem(rObj.GetEndAngle()));
}
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index 8f34d7051889..69e0d42f0808 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -449,11 +449,11 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ClickAutoHdl, weld::ToggleButton&, void )
IMPL_LINK_NOARG( PosSizePropertyPanel, RotationHdl, DialControl&, void )
{
- sal_Int32 nTmp = mxCtrlDial->GetRotation();
+ Degree100 nTmp = mxCtrlDial->GetRotation();
// #i123993# Need to take UIScale into account when executing rotations
const double fUIScale(mpView && mpView->GetModel() ? double(mpView->GetModel()->GetUIScale()) : 1.0);
- SdrAngleItem aAngleItem( SID_ATTR_TRANSFORM_ANGLE,static_cast<sal_uInt32>(nTmp));
+ SdrAngleItem aAngleItem( SID_ATTR_TRANSFORM_ANGLE, nTmp);
SfxInt32Item aRotXItem( SID_ATTR_TRANSFORM_ROT_X, basegfx::fround(mlRotX * fUIScale));
SfxInt32Item aRotYItem( SID_ATTR_TRANSFORM_ROT_Y, basegfx::fround(mlRotY * fUIScale));
@@ -680,10 +680,9 @@ void PosSizePropertyPanel::NotifyItemUpdate(
if(pItem)
{
- tools::Long nTmp = pItem->GetValue();
- nTmp = nTmp < 0 ? 36000+nTmp : nTmp;
+ Degree100 nTmp = NormAngle36000(pItem->GetValue());
- mxMtrAngle->set_value(nTmp, FieldUnit::DEGREE);
+ mxMtrAngle->set_value(nTmp.get(), FieldUnit::DEGREE);
mxCtrlDial->SetRotation(nTmp);
break;
@@ -691,7 +690,7 @@ void PosSizePropertyPanel::NotifyItemUpdate(
}
mxMtrAngle->set_text( "" );
- mxCtrlDial->SetRotation( 0 );
+ mxCtrlDial->SetRotation( 0_deg100 );
break;
case SID_ATTR_METRIC:
diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx
index 5f6411804d06..0342f65c2760 100644
--- a/svx/source/svdraw/svdattr.cxx
+++ b/svx/source/svdraw/svdattr.cxx
@@ -203,8 +203,8 @@ SdrItemPool::SdrItemPool(
rPoolDefaults[SDRATTR_MEASURETEXTFIXEDANGLE -SDRATTR_START]=new SdrMeasureTextFixedAngleItem();
rPoolDefaults[SDRATTR_MEASUREDECIMALPLACES -SDRATTR_START]=new SdrMeasureDecimalPlacesItem();
rPoolDefaults[SDRATTR_CIRCKIND -SDRATTR_START]=new SdrCircKindItem;
- rPoolDefaults[SDRATTR_CIRCSTARTANGLE-SDRATTR_START]=new SdrAngleItem(SDRATTR_CIRCSTARTANGLE, 0);
- rPoolDefaults[SDRATTR_CIRCENDANGLE -SDRATTR_START]=new SdrAngleItem(SDRATTR_CIRCENDANGLE, 36000);
+ rPoolDefaults[SDRATTR_CIRCSTARTANGLE-SDRATTR_START]=new SdrAngleItem(SDRATTR_CIRCSTARTANGLE, 0_deg100);
+ rPoolDefaults[SDRATTR_CIRCENDANGLE -SDRATTR_START]=new SdrAngleItem(SDRATTR_CIRCENDANGLE, 36000_deg100);
rPoolDefaults[SDRATTR_OBJMOVEPROTECT -SDRATTR_START]=new SdrYesNoItem(SDRATTR_OBJMOVEPROTECT, false);
rPoolDefaults[SDRATTR_OBJSIZEPROTECT -SDRATTR_START]=new SdrYesNoItem(SDRATTR_OBJSIZEPROTECT, false);
rPoolDefaults[SDRATTR_OBJPRINTABLE -SDRATTR_START]=new SdrObjPrintableItem;
@@ -222,7 +222,7 @@ SdrItemPool::SdrItemPool(
rPoolDefaults[SDRATTR_ONESIZEHEIGHT -SDRATTR_START]=new SdrOneSizeHeightItem;
rPoolDefaults[SDRATTR_LOGICSIZEWIDTH -SDRATTR_START]=new SdrLogicSizeWidthItem;
rPoolDefaults[SDRATTR_LOGICSIZEHEIGHT-SDRATTR_START]=new SdrLogicSizeHeightItem;
- rPoolDefaults[SDRATTR_ROTATEANGLE -SDRATTR_START]=new SdrAngleItem(SDRATTR_ROTATEANGLE, 0);
+ rPoolDefaults[SDRATTR_ROTATEANGLE -SDRATTR_START]=new SdrAngleItem(SDRATTR_ROTATEANGLE, 0_deg100);
rPoolDefaults[SDRATTR_SHEARANGLE -SDRATTR_START]=new SdrShearAngleItem;
rPoolDefaults[SDRATTR_MOVEX -SDRATTR_START]=new SdrMoveXItem;
rPoolDefaults[SDRATTR_MOVEY -SDRATTR_START]=new SdrMoveYItem;
diff --git a/svx/source/svdraw/svddrgm1.hxx b/svx/source/svdraw/svddrgm1.hxx
index 25c1a5af126a..b8aa2280964b 100644
--- a/svx/source/svdraw/svddrgm1.hxx
+++ b/svx/source/svdraw/svddrgm1.hxx
@@ -49,8 +49,8 @@ class SdrDragRotate : public SdrDragMethod
private:
double nSin;
double nCos;
- tools::Long nAngle0;
- tools::Long nAngle;
+ Degree100 nAngle0;
+ Degree100 nAngle;
bool bRight;
public:
@@ -70,8 +70,8 @@ class SdrDragShear : public SdrDragMethod
{
private:
Fraction aFact;
- tools::Long nAngle0;
- tools::Long nAngle;
+ Degree100 nAngle0;
+ Degree100 nAngle;
double nTan;
bool bVertical; // contort vertically
bool bResize; // shear and resize
@@ -95,7 +95,7 @@ class SdrDragMirror : public SdrDragMethod
{
private:
Point aDif;
- tools::Long nAngle;
+ Degree100 nAngle;
bool bMirrored;
bool bSide0;
@@ -159,7 +159,7 @@ private:
bool bUpr;
bool bLwr;
bool bAtCenter;
- tools::Long nAngle;
+ Degree100 nAngle;
tools::Long nMarkSize;
SdrCrookMode eMode;
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index 0915dfc274c1..59381718eb22 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -1042,21 +1042,21 @@ void SdrDragMovHdl::MoveSdrDrag(const Point& rNoSnapPnt)
else
{
if (!DragStat().IsNoSnap()) SnapPos(aPnt);
- tools::Long nSA=0;
+ Degree100 nSA(0);
if (getSdrDragView().IsAngleSnapEnabled())
nSA=getSdrDragView().GetSnapAngle();
if (getSdrDragView().IsMirrorAllowed(true,true))
{ // limited
- if (!getSdrDragView().IsMirrorAllowed()) nSA=4500;
- if (!getSdrDragView().IsMirrorAllowed(true)) nSA=9000;
+ if (!getSdrDragView().IsMirrorAllowed()) nSA=4500_deg100;
+ if (!getSdrDragView().IsMirrorAllowed(true)) nSA=9000_deg100;
}
- if (getSdrDragView().IsOrtho() && nSA!=9000)
- nSA=4500;
+ if (getSdrDragView().IsOrtho() && nSA!=9000_deg100)
+ nSA=4500_deg100;
- if (nSA!=0)
+ if (nSA!=0_deg100)
{ // angle snapping
SdrHdlKind eRef=SdrHdlKind::Ref1;
@@ -1068,25 +1068,25 @@ void SdrDragMovHdl::MoveSdrDrag(const Point& rNoSnapPnt)
if (pH!=nullptr)
{
Point aRef(pH->GetPos());
- tools::Long nAngle=NormAngle36000(GetAngle(aPnt-aRef));
- tools::Long nNewAngle=nAngle;
- nNewAngle+=nSA/2;
+ Degree100 nAngle=NormAngle36000(GetAngle(aPnt-aRef));
+ Degree100 nNewAngle=nAngle;
+ nNewAngle+=nSA/2_deg100;
nNewAngle/=nSA;
nNewAngle*=nSA;
nNewAngle=NormAngle36000(nNewAngle);
- double a=(nNewAngle-nAngle)*F_PI18000;
+ double a=(nNewAngle-nAngle).get()*F_PI18000;
double nSin=sin(a);
double nCos=cos(a);
RotatePoint(aPnt,aRef,nSin,nCos);
// eliminate rounding errors for certain values
- if (nSA==9000)
+ if (nSA==9000_deg100)
{
- if (nNewAngle==0 || nNewAngle==18000) aPnt.setY(aRef.Y() );
- if (nNewAngle==9000 || nNewAngle==27000) aPnt.setX(aRef.X() );
+ if (nNewAngle==0_deg100 || nNewAngle==18000_deg100) aPnt.setY(aRef.Y() );
+ if (nNewAngle==9000_deg100 || nNewAngle==27000_deg100) aPnt.setX(aRef.X() );
}
- if (nSA==4500)
+ if (nSA==4500_deg100)
OrthoDistance8(aRef,aPnt,true);
}
}
@@ -2062,11 +2062,11 @@ OUString SdrDragRotate::GetSdrDragComment() const
{
OUString aStr = ImpGetDescriptionStr(STR_DragMethRotate) +
" (";
- sal_Int32 nTmpAngle(NormAngle36000(nAngle));
+ Degree100 nTmpAngle(NormAngle36000(nAngle));
if(bRight && nAngle)
{
- nTmpAngle -= 36000;
+ nTmpAngle -= 36000_deg100;
}
aStr += SdrModel::GetAngleString(nTmpAngle) + ")";
@@ -2117,20 +2117,20 @@ void SdrDragRotate::MoveSdrDrag(const Point& rPnt_)
if (!DragStat().CheckMinMoved(aPnt))
return;
- tools::Long nNewAngle=NormAngle36000(GetAngle(aPnt-DragStat().GetRef1())-nAngle0);
- tools::Long nSA=0;
+ Degree100 nNewAngle=NormAngle36000(GetAngle(aPnt-DragStat().GetRef1())-nAngle0);
+ Degree100 nSA(0);
if (getSdrDragView().IsAngleSnapEnabled())
nSA=getSdrDragView().GetSnapAngle();
if (!getSdrDragView().IsRotateAllowed())
- nSA=9000;
+ nSA=9000_deg100;
- if (nSA!=0)
+ if (nSA!=0_deg100)
{ // angle snapping
- nNewAngle+=nSA/2;
- nNewAngle/=nSA;
- nNewAngle*=nSA;
+ nNewAngle += nSA / 2_deg100;
+ nNewAngle /= nSA;
+ nNewAngle *= nSA;
}
nNewAngle=NormAngle18000(nNewAngle);
@@ -2148,7 +2148,7 @@ void SdrDragRotate::MoveSdrDrag(const Point& rPnt_)
bRight=false;
nAngle=nNewAngle;
- double a = nAngle * F_PI18000;
+ double a = nAngle.get() * F_PI18000;
double nSin1=sin(a); // calculate now, so as little time as possible
double nCos1=cos(a); // passes between Hide() and Show()
Hide();
@@ -2162,7 +2162,7 @@ bool SdrDragRotate::EndSdrDrag(bool bCopy)
{
Hide();
- if (nAngle!=0)
+ if (nAngle!=0_deg100)
{
if (IsDraggingPoints())
{
@@ -2204,10 +2204,10 @@ OUString SdrDragShear::GetSdrDragComment() const
OUString aStr = ImpGetDescriptionStr(STR_DragMethShear) +
" (";
- sal_Int32 nTmpAngle(nAngle);
+ Degree100 nTmpAngle(nAngle);
if(bUpSideDown)
- nTmpAngle += 18000;
+ nTmpAngle += 18000_deg100;
nTmpAngle = NormAngle18000(nTmpAngle);
@@ -2280,7 +2280,7 @@ void SdrDragShear::MoveSdrDrag(const Point& rPnt)
return;
bResize=!getSdrDragView().IsOrtho();
- tools::Long nSA=0;
+ Degree100 nSA(0);
if (getSdrDragView().IsAngleSnapEnabled())
nSA=getSdrDragView().GetSnapAngle();
@@ -2290,7 +2290,7 @@ void SdrDragShear::MoveSdrDrag(const Point& rPnt)
Fraction aNewFract(1,1);
// if angle snapping not activated, snap to raster (except when using slant)
- if (nSA==0 && !bSlant)
+ if (nSA==0_deg100 && !bSlant)
aPnt=GetSnapPos(aPnt);
if (!bSlant && !bResize)
@@ -2304,7 +2304,7 @@ void SdrDragShear::MoveSdrDrag(const Point& rPnt)
Point aRef(DragStat().GetRef1());
Point aDif(aPnt-aRef);
- tools::Long nNewAngle=0;
+ Degree100 nNewAngle(0);
if (bSlant)
{
@@ -2318,16 +2318,16 @@ void SdrDragShear::MoveSdrDrag(const Point& rPnt)
if (bVertical)
nNewAngle=NormAngle18000(GetAngle(aDif));
else
- nNewAngle=NormAngle18000(-(GetAngle(aDif)-9000));
+ nNewAngle=NormAngle18000(-(GetAngle(aDif)-9000_deg100));
- if (nNewAngle<-9000 || nNewAngle>9000)
- nNewAngle=NormAngle18000(nNewAngle+18000);
+ if (nNewAngle<Degree100(-9000) || nNewAngle>9000_deg100)
+ nNewAngle=NormAngle18000(nNewAngle+18000_deg100);
if (bResize)
{
Point aPt2(aPnt);
- if (nSA!=0)
+ if (nSA!=0_deg100)
aPt2=GetSnapPos(aPnt); // snap this one in any case
if (bVertical)
@@ -2341,34 +2341,34 @@ void SdrDragShear::MoveSdrDrag(const Point& rPnt)
}
}
- bool bNeg=nNewAngle<0;
+ bool bNeg=nNewAngle<0_deg100;
if (bNeg)
nNewAngle=-nNewAngle;
- if (nSA!=0)
+ if (nSA!=0_deg100)
{ // angle snapping
- nNewAngle+=nSA/2;
- nNewAngle/=nSA;
- nNewAngle*=nSA;
+ nNewAngle += nSA / 2_deg100;
+ nNewAngle /= nSA;
+ nNewAngle *= nSA;
}
nNewAngle=NormAngle36000(nNewAngle);
- bUpSideDown=nNewAngle>9000 && nNewAngle<27000;
+ bUpSideDown=nNewAngle>9000_deg100 && nNewAngle<27000_deg100;
if (bSlant)
{ // calculate resize for slant
// when angle snapping is activated, disable 89 degree limit
- tools::Long nTmpAngle=nNewAngle;
- if (bUpSideDown) nNewAngle-=18000;
+ Degree100 nTmpAngle=nNewAngle;
+ if (bUpSideDown) nNewAngle -= 18000_deg100;
if (bNeg) nTmpAngle=-nTmpAngle;
bResize=true;
- aNewFract = cos(nTmpAngle * F_PI18000);
+ aNewFract = cos(nTmpAngle.get() * F_PI18000);
aFact.ReduceInaccurate(10); // three decimals should be enough
}
- if (nNewAngle>8900)
- nNewAngle=8900;
+ if (nNewAngle > 8900_deg100)
+ nNewAngle = 8900_deg100;
if (bNeg)
nNewAngle=-nNewAngle;
@@ -2377,7 +2377,7 @@ void SdrDragShear::MoveSdrDrag(const Point& rPnt)
{
nAngle=nNewAngle;
aFact=aNewFract;
- double a = nAngle * F_PI18000;
+ double a = nAngle.get() * F_PI18000;
double nTan1=tan(a); // calculate now, so as little time as possible passes between Hide() and Show()
Hide();
nTan=nTan1;
@@ -2400,7 +2400,7 @@ void SdrDragShear::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
}
}
- if (nAngle!=0)
+ if (nAngle)
{
rTarget.Shear(DragStat().GetRef1(), nAngle, nTan, bVertical);
}
@@ -2413,9 +2413,9 @@ bool SdrDragShear::EndSdrDrag(bool bCopy)
if (bResize && aFact==Fraction(1,1))
bResize=false;
- if (nAngle!=0 || bResize)
+ if (nAngle || bResize)
{
- if (nAngle!=0 && bResize)
+ if (nAngle && bResize)
{
OUString aStr = ImpGetDescriptionStr(STR_EditShear);
@@ -2439,12 +2439,12 @@ bool SdrDragShear::EndSdrDrag(bool bCopy)
bCopy=false;
}
- if (nAngle!=0)
+ if (nAngle)
{
getSdrDragView().ShearMarkedObj(DragStat().GetRef1(),nAngle,bVertical,bCopy);
}
- if (nAngle!=0 && bResize)
+ if (nAngle && bResize)
getSdrDragView().EndUndo();
return true;
@@ -2480,11 +2480,11 @@ SdrDragMirror::SdrDragMirror(SdrDragView& rNewView)
bool SdrDragMirror::ImpCheckSide(const Point& rPnt) const
{
- tools::Long nAngle1=GetAngle(rPnt-DragStat().GetRef1());
+ Degree100 nAngle1=GetAngle(rPnt-DragStat().GetRef1());
nAngle1-=nAngle;
nAngle1=NormAngle36000(nAngle1);
- return nAngle1<18000;
+ return nAngle1<18000_deg100;
}
OUString SdrDragMirror::GetSdrDragComment() const
@@ -2787,7 +2787,7 @@ OUString SdrDragCrook::GetSdrDragComment() const
nVal *= 2;
nVal = std::abs(nVal);
- aStr += SdrModel::GetAngleString(nVal) + ")";
+ aStr += SdrModel::GetAngleString(Degree100(nVal)) + ")";
}
if(getSdrDragView().IsDragWithCopy())
@@ -3131,12 +3131,12 @@ void SdrDragCrook::MoveSdrDrag(const Point& rPnt)
}
tools::Long nNewRad=0;
- nAngle=0;
+ nAngle=0_deg100;
if (bValid)
{
double a=0; // slope of the radius
- tools::Long nPntWink=0;
+ Degree100 nPntWink(0);
if (bVertical)
{
@@ -3150,39 +3150,39 @@ void SdrDragCrook::MoveSdrDrag(const Point& rPnt)
a=static_cast<double>(dx1)/static_cast<double>(dy1); // slope of the radius
nNewRad=(static_cast<tools::Long>(dx1*a)+dy1) /2;
aNewCenter.AdjustY(nNewRad );
- nPntWink=GetAngle(aPnt-aNewCenter)-9000;
+ nPntWink=GetAngle(aPnt-aNewCenter)-9000_deg100;
}
if (!bAtCenter)
{
if (nNewRad<0)
{
- if (bRgt) nPntWink+=18000;
- if (bLft) nPntWink=18000-nPntWink;
- if (bLwr) nPntWink=-nPntWink;
+ if (bRgt) nPntWink += 18000_deg100;
+ if (bLft) nPntWink = 18000_deg100 - nPntWink;
+ if (bLwr) nPntWink =- nPntWink;
}
else
{
- if (bRgt) nPntWink=-nPntWink;
- if (bUpr) nPntWink=18000-nPntWink;
- if (bLwr) nPntWink+=18000;
+ if (bRgt) nPntWink = -nPntWink;
+ if (bUpr) nPntWink = 18000_deg100 - nPntWink;
+ if (bLwr) nPntWink += 18000_deg100;
}
nPntWink=NormAngle36000(nPntWink);
}
else
{
- if (nNewRad<0) nPntWink+=18000;
- if (bVertical) nPntWink=18000-nPntWink;
- nPntWink=NormAngle18000(nPntWink);
- nPntWink = std::abs(nPntWink);
+ if (nNewRad<0) nPntWink += 18000_deg100;
+ if (bVertical) nPntWink = 18000_deg100 - nPntWink;
+ nPntWink = NormAngle18000(nPntWink);
+ nPntWink = abs(nPntWink);
}
- double nUmfang = 2 * std::abs(nNewRad) * M_PI;
+ double nCircumference = 2 * std::abs(nNewRad) * M_PI;
if (bResize)
{
- tools::Long nMul=static_cast<tools::Long>(nUmfang*NormAngle36000(nPntWink)/36000);
+ tools::Long nMul=static_cast<tools::Long>(nCircumference * NormAngle36000(nPntWink).get() / 36000.0);
if (bAtCenter)
nMul*=2;
@@ -3192,14 +3192,14 @@ void SdrDragCrook::MoveSdrDrag(const Point& rPnt)
}
else
{
- nAngle=static_cast<tools::Long>((nMarkSize*360/nUmfang)*100)/2;
+ nAngle = Degree100(static_cast<tools::Long>((nMarkSize*360/nCircumference)*100)/2);
- if (nAngle==0)
+ if (nAngle==0_deg100)
bValid=false;
}
}
- if (nAngle==0 || nNewRad==0)
+ if (nAngle==0_deg100 || nNewRad==0)
bValid=false;
if (!bValid)
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index 9136ed35d83c..f2128824b6fa 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -280,9 +280,9 @@ void SdrEditView::ResizeMultMarkedObj(const Point& rRef,
EndUndo();
}
-tools::Long SdrEditView::GetMarkedObjRotate() const
+Degree100 SdrEditView::GetMarkedObjRotate() const
{
- tools::Long nRetval(0);
+ Degree100 nRetval(0);
if(GetMarkedObjectCount())
{
@@ -295,7 +295,7 @@ tools::Long SdrEditView::GetMarkedObjRotate() const
return nRetval;
}
-void SdrEditView::RotateMarkedObj(const Point& rRef, tools::Long nAngle, bool bCopy)
+void SdrEditView::RotateMarkedObj(const Point& rRef, Degree100 nAngle, bool bCopy)
{
const bool bUndo = IsUndoEnabled();
if( bUndo )
@@ -309,8 +309,8 @@ void SdrEditView::RotateMarkedObj(const Point& rRef, tools::Long nAngle, bool bC
if (bCopy)
CopyMarkedObj();
- double nSin = sin(nAngle * F_PI18000);
- double nCos = cos(nAngle * F_PI18000);
+ double nSin = sin(nAngle.get() * F_PI18000);
+ double nCos = cos(nAngle.get() * F_PI18000);
const size_t nMarkCount(GetMarkedObjectCount());
if(nMarkCount)
@@ -431,27 +431,27 @@ void SdrEditView::MirrorMarkedObjVertical()
MirrorMarkedObj(aCenter,aPt2);
}
-tools::Long SdrEditView::GetMarkedObjShear() const
+Degree100 SdrEditView::GetMarkedObjShear() const
{
bool b1st=true;
bool bOk=true;
- tools::Long nAngle=0;
+ Degree100 nAngle(0);
const size_t nMarkCount=GetMarkedObjectCount();
for (size_t nm=0; nm<nMarkCount && bOk; ++nm) {
SdrMark* pM=GetSdrMarkByIndex(nm);
SdrObject* pO=pM->GetMarkedSdrObj();
- tools::Long nAngle2=pO->GetShearAngle();
+ Degree100 nAngle2=pO->GetShearAngle();
if (b1st) nAngle=nAngle2;
else if (nAngle2!=nAngle) bOk=false;
b1st=false;
}
if (nAngle>SDRMAXSHEAR) nAngle=SDRMAXSHEAR;
if (nAngle<-SDRMAXSHEAR) nAngle=-SDRMAXSHEAR;
- if (!bOk) nAngle=0;
+ if (!bOk) nAngle=0_deg100;
return nAngle;
}
-void SdrEditView::ShearMarkedObj(const Point& rRef, tools::Long nAngle, bool bVShear, bool bCopy)
+void SdrEditView::ShearMarkedObj(const Point& rRef, Degree100 nAngle, bool bVShear, bool bCopy)
{
const bool bUndo = IsUndoEnabled();
@@ -467,7 +467,7 @@ void SdrEditView::ShearMarkedObj(const Point& rRef, tools::Long nAngle, bool bVS
if (bCopy)
CopyMarkedObj();
- double nTan = tan(nAngle * F_PI18000);
+ double nTan = tan(nAngle.get() * F_PI18000);
const size_t nMarkCount=GetMarkedObjectCount();
for (size_t nm=0; nm<nMarkCount; ++nm)
{
@@ -558,7 +558,7 @@ void SdrEditView::ImpCrookObj(SdrObject* pO, const Point& rRef, const Point& rRa
aCtr1 -= aCtr0;
if(bRotOk)
- pO->Rotate(aCtr0, FRound(nAngle / F_PI18000), nSin, nCos);
+ pO->Rotate(aCtr0, Degree100(FRound(nAngle / F_PI18000)), nSin, nCos);
pO->Move(Size(aCtr1.X(),aCtr1.Y()));
}
@@ -741,15 +741,15 @@ void SdrEditView::SetNotPersistAttrToMarked(const SfxItemSet& rAttr)
ResizeMarkedObj(aAllSnapRect.TopLeft(),Fraction(1,1),aYFact);
}
if (rAttr.GetItemState(SDRATTR_ROTATEALL,true,&pPoolItem)==SfxItemState::SET) {
- tools::Long nAngle=static_cast<const SdrRotateAllItem*>(pPoolItem)->GetValue();
+ Degree100 nAngle=static_cast<const SdrRotateAllItem*>(pPoolItem)->GetValue();
RotateMarkedObj(aAllSnapRect.Center(),nAngle);
}
if (rAttr.GetItemState(SDRATTR_HORZSHEARALL,true,&pPoolItem)==SfxItemState::SET) {
- tools::Long nAngle=static_cast<const SdrHorzShearAllItem*>(pPoolItem)->GetValue();
+ Degree100 nAngle=static_cast<const SdrHorzShearAllItem*>(pPoolItem)->GetValue();
ShearMarkedObj(aAllSnapRect.Center(),nAngle);
}
if (rAttr.GetItemState(SDRATTR_VERTSHEARALL,true,&pPoolItem)==SfxItemState::SET) {
- tools::Long nAngle=static_cast<const SdrVertShearAllItem*>(pPoolItem)->GetValue();
+ Degree100 nAngle=static_cast<const SdrVertShearAllItem*>(pPoolItem)->GetValue();
ShearMarkedObj(aAllSnapRect.Center(),nAngle,true);
}
@@ -789,8 +789,8 @@ void SdrEditView::MergeNotPersistAttrFromMarked(SfxItemSet& rAttr) const
tools::Long nSnapHgt=0; bool bSnapHgtDC=false;
tools::Long nLogicWdt=0; bool bLogicWdtDC=false,bLogicWdtDiff=false;
tools::Long nLogicHgt=0; bool bLogicHgtDC=false,bLogicHgtDiff=false;
- tools::Long nRotAngle=0; bool bRotAngleDC=false;
- tools::Long nShrAngle=0; bool bShrAngleDC=false;
+ Degree100 nRotAngle(0); bool bRotAngleDC=false;
+ Degree100 nShrAngle(0); bool bShrAngleDC=false;
tools::Rectangle aSnapRect;
tools::Rectangle aLogicRect;
const size_t nMarkCount=GetMarkedObjectCount();
@@ -1523,8 +1523,8 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr)
GetSdrPageView()->LogicToPagePos(aRect);
}
- tools::Long nOldRotateAngle=GetMarkedObjRotate();
- tools::Long nOldShearAngle=GetMarkedObjShear();
+ Degree100 nOldRotateAngle=GetMarkedObjRotate();
+ Degree100 nOldShearAngle=GetMarkedObjShear();
const SdrMarkList& rMarkList=GetMarkedObjectList();
const size_t nMarkCount=rMarkList.GetMarkCount();
SdrObject* pObj=nullptr;
@@ -1534,7 +1534,7 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr)
tools::Long nPosDY=0;
tools::Long nSizX=0;
tools::Long nSizY=0;
- tools::Long nRotateAngle=0;
+ Degree100 nRotateAngle(0);
bool bModeIsRotate(meDragMode == SdrDragMode::Rotate);
tools::Long nRotateX(0);
@@ -1554,7 +1554,7 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr)
nRotateY = nOldRotateY = aRotateAxe.Y();
}
- tools::Long nShearAngle=0;
+ Degree100 nShearAngle(0);
tools::Long nShearX=0;
tools::Long nShearY=0;
bool bShearVert=false;
@@ -1601,13 +1601,13 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr)
// rotation
if (SfxItemState::SET == rAttr.GetItemState(SID_ATTR_TRANSFORM_DELTA_ANGLE, true, &pPoolItem)) {
nRotateAngle = static_cast<const SdrAngleItem*>(pPoolItem)->GetValue();
- bRotate = (nRotateAngle != 0);
+ bRotate = (nRotateAngle != 0_deg100);
}
// rotation
if (SfxItemState::SET == rAttr.GetItemState(SID_ATTR_TRANSFORM_ANGLE, true, &pPoolItem)) {
nRotateAngle = static_cast<const SdrAngleItem*>(pPoolItem)->GetValue() - nOldRotateAngle;
- bRotate = (nRotateAngle != 0);
+ bRotate = (nRotateAngle != 0_deg100);
}
// position rotation point x
@@ -1620,7 +1620,7 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr)
// shearing
if (SfxItemState::SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_SHEAR,true,&pPoolItem)) {
- tools::Long nNewShearAngle=static_cast<const SdrAngleItem*>(pPoolItem)->GetValue();
+ Degree100 nNewShearAngle=static_cast<const SdrAngleItem*>(pPoolItem)->GetValue();
if (nNewShearAngle>SDRMAXSHEAR) nNewShearAngle=SDRMAXSHEAR;
if (nNewShearAngle<-SDRMAXSHEAR) nNewShearAngle=-SDRMAXSHEAR;
if (nNewShearAngle!=nOldShearAngle) {
@@ -1628,18 +1628,18 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr)
if (bShearVert) {
nShearAngle=nNewShearAngle;
} else {
- if (nNewShearAngle!=0 && nOldShearAngle!=0) {
+ if (nNewShearAngle!=0_deg100 && nOldShearAngle!=0_deg100) {
// bug fix
- double nOld = tan(static_cast<double>(nOldShearAngle) * F_PI18000);
- double nNew = tan(static_cast<double>(nNewShearAngle) * F_PI18000);
+ double nOld = tan(static_cast<double>(nOldShearAngle.get()) * F_PI18000);
+ double nNew = tan(static_cast<double>(nNewShearAngle.get()) * F_PI18000);
nNew-=nOld;
nNew = atan(nNew) / F_PI18000;
- nShearAngle=FRound(nNew);
+ nShearAngle=Degree100(FRound(nNew));
} else {
nShearAngle=nNewShearAngle-nOldShearAngle;
}
}
- bShear=nShearAngle!=0;
+ bShear=nShearAngle!=0_deg100;
if (bShear) {
nShearX=static_cast<const SfxInt32Item&>(rAttr.Get(SID_ATTR_TRANSFORM_SHEAR_X)).GetValue();
nShearY=static_cast<const SfxInt32Item&>(rAttr.Get(SID_ATTR_TRANSFORM_SHEAR_Y)).GetValue();
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index d761998f540c..5106702a4502 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -1521,7 +1521,7 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally)
pTEObj->EndTextEdit(*pTEOutliner);
- if ((pTEObj->GetRotateAngle() != 0)
+ if ((pTEObj->GetRotateAngle() != 0_deg100)
|| (dynamic_cast<const SdrTextObj*>(pTEObj) != nullptr && pTEObj->IsFontwork()))
{
pTEObj->ActionChanged();
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index 31624873f234..34a491211bf6 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -742,8 +742,8 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaEllipseAction const & rAct)
void ImpSdrGDIMetaFileImport::DoAction(MetaArcAction const & rAct)
{
Point aCenter(rAct.GetRect().Center());
- tools::Long nStart=GetAngle(rAct.GetStartPoint()-aCenter);
- tools::Long nEnd=GetAngle(rAct.GetEndPoint()-aCenter);
+ Degree100 nStart=GetAngle(rAct.GetStartPoint()-aCenter);
+ Degree100 nEnd=GetAngle(rAct.GetEndPoint()-aCenter);
SdrCircObj* pCirc = new SdrCircObj(
*mpModel,
SdrCircKind::Arc,
@@ -755,8 +755,8 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaArcAction const & rAct)
void ImpSdrGDIMetaFileImport::DoAction(MetaPieAction const & rAct)
{
Point aCenter(rAct.GetRect().Center());
- tools::Long nStart=GetAngle(rAct.GetStartPoint()-aCenter);
- tools::Long nEnd=GetAngle(rAct.GetEndPoint()-aCenter);
+ Degree100 nStart=GetAngle(rAct.GetStartPoint()-aCenter);
+ Degree100 nEnd=GetAngle(rAct.GetEndPoint()-aCenter);
SdrCircObj* pCirc = new SdrCircObj(
*mpModel,
SdrCircKind::Section,
@@ -770,8 +770,8 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaPieAction const & rAct)
void ImpSdrGDIMetaFileImport::DoAction(MetaChordAction const & rAct)
{
Point aCenter(rAct.GetRect().Center());
- tools::Long nStart=GetAngle(rAct.GetStartPoint()-aCenter);
- tools::Long nEnd=GetAngle(rAct.GetEndPoint()-aCenter);
+ Degree100 nStart=GetAngle(rAct.GetStartPoint()-aCenter);
+ Degree100 nEnd=GetAngle(rAct.GetEndPoint()-aCenter);
SdrCircObj* pCirc = new SdrCircObj(
*mpModel,
SdrCircKind::Cut,
@@ -1053,12 +1053,9 @@ void ImpSdrGDIMetaFileImport::ImportText( const Point& rPos, const OUString& rSt
aAttr.Put(XFillColorItem(OUString(), aFnt.GetFillColor()));
pText->SetMergedItemSet(aAttr);
}
- sal_Int32 nAngle = aFnt.GetOrientation().get();
+ Degree100 nAngle = toDegree100(aFnt.GetOrientation());
if ( nAngle )
- {
- nAngle*=10;
pText->SdrAttrObj::NbcRotate(aPos,nAngle);
- }
InsertObj( pText, false );
}
diff --git a/svx/source/svdraw/svdglev.cxx b/svx/source/svdraw/svdglev.cxx
index 370563d8be87..78c92f778840 100644
--- a/svx/source/svdraw/svdglev.cxx
+++ b/svx/source/svdraw/svdglev.cxx
@@ -383,15 +383,15 @@ static void ImpRotate(Point& rPt, const void* p1, const void* /*p2*/, const void
RotatePoint(rPt,*static_cast<const Point*>(p1),*static_cast<const double*>(p3),*static_cast<const double*>(p4));
}
-void SdrGlueEditView::RotateMarkedGluePoints(const Point& rRef, tools::Long nAngle, bool bCopy)
+void SdrGlueEditView::RotateMarkedGluePoints(const Point& rRef, Degree100 nAngle, bool bCopy)
{
ForceUndirtyMrkPnt();
OUString aStr(SvxResId(STR_EditRotate));
if (bCopy) aStr+=SvxResId(STR_EditWithCopy);
BegUndo(aStr,GetDescriptionOfMarkedGluePoints(),SdrRepeatFunc::Rotate);
if (bCopy) ImpCopyMarkedGluePoints();
- double nSin = sin(nAngle * F_PI18000);
- double nCos = cos(nAngle * F_PI18000);
+ double nSin = sin(nAngle.get() * F_PI18000);
+ double nCos = cos(nAngle.get() * F_PI18000);
ImpTransformMarkedGluePoints(ImpRotate,&rRef,&nAngle,&nSin,&nCos);
EndUndo();
AdjustMarkHdl();
diff --git a/svx/source/svdraw/svdglue.cxx b/svx/source/svdraw/svdglue.cxx
index 0d3db7f8d57d..4cce1a58ad26 100644
--- a/svx/source/svdraw/svdglue.cxx
+++ b/svx/source/svdraw/svdglue.cxx
@@ -125,68 +125,68 @@ void SdrGluePoint::SetAbsolutePos(const Point& rNewPos, const SdrObject& rObj)
aPos=aPt;
}
-tools::Long SdrGluePoint::GetAlignAngle() const
+Degree100 SdrGluePoint::GetAlignAngle() const
{
if (nAlign == (SdrAlign::HORZ_CENTER|SdrAlign::VERT_CENTER))
- return 0; // Invalid!
+ return 0_deg100; // Invalid!
else if (nAlign == (SdrAlign::HORZ_RIGHT |SdrAlign::VERT_CENTER))
- return 0;
+ return 0_deg100;
else if (nAlign == (SdrAlign::HORZ_RIGHT |SdrAlign::VERT_TOP))
- return 4500;
+ return 4500_deg100;
else if (nAlign == (SdrAlign::HORZ_CENTER|SdrAlign::VERT_TOP))
- return 9000;
+ return 9000_deg100;
else if (nAlign == (SdrAlign::HORZ_LEFT |SdrAlign::VERT_TOP))
- return 13500;
+ return 13500_deg100;
else if (nAlign == (SdrAlign::HORZ_LEFT |SdrAlign::VERT_CENTER))
- return 18000;
+ return 18000_deg100;
else if (nAlign == (SdrAlign::HORZ_LEFT |SdrAlign::VERT_BOTTOM))
- return 22500;
+ return 22500_deg100;
else if (nAlign == (SdrAlign::HORZ_CENTER|SdrAlign::VERT_BOTTOM))
- return 27000;
+ return 27000_deg100;
else if (nAlign == (SdrAlign::HORZ_RIGHT |SdrAlign::VERT_BOTTOM))
- return 31500;
- return 0;
+ return 31500_deg100;
+ return 0_deg100;
}
-void SdrGluePoint::SetAlignAngle(tools::Long nAngle)
+void SdrGluePoint::SetAlignAngle(Degree100 nAngle)
{
nAngle=NormAngle36000(nAngle);
- if (nAngle>=33750 || nAngle<2250) nAlign=SdrAlign::HORZ_RIGHT |SdrAlign::VERT_CENTER;
- else if (nAngle< 6750) nAlign=SdrAlign::HORZ_RIGHT |SdrAlign::VERT_TOP ;
- else if (nAngle<11250) nAlign=SdrAlign::HORZ_CENTER|SdrAlign::VERT_TOP ;
- else if (nAngle<15750) nAlign=SdrAlign::HORZ_LEFT |SdrAlign::VERT_TOP ;
- else if (nAngle<20250) nAlign=SdrAlign::HORZ_LEFT |SdrAlign::VERT_CENTER;
- else if (nAngle<24750) nAlign=SdrAlign::HORZ_LEFT |SdrAlign::VERT_BOTTOM;
- else if (nAngle<29250) nAlign=SdrAlign::HORZ_CENTER|SdrAlign::VERT_BOTTOM;
- else if (nAngle<33750) nAlign=SdrAlign::HORZ_RIGHT |SdrAlign::VERT_BOTTOM;
+ if (nAngle>=33750_deg100 || nAngle<2250_deg100) nAlign=SdrAlign::HORZ_RIGHT |SdrAlign::VERT_CENTER;
+ else if (nAngle< 6750_deg100) nAlign=SdrAlign::HORZ_RIGHT |SdrAlign::VERT_TOP ;
+ else if (nAngle<11250_deg100) nAlign=SdrAlign::HORZ_CENTER|SdrAlign::VERT_TOP ;
+ else if (nAngle<15750_deg100) nAlign=SdrAlign::HORZ_LEFT |SdrAlign::VERT_TOP ;
+ else if (nAngle<20250_deg100) nAlign=SdrAlign::HORZ_LEFT |SdrAlign::VERT_CENTER;
+ else if (nAngle<24750_deg100) nAlign=SdrAlign::HORZ_LEFT |SdrAlign::VERT_BOTTOM;
+ else if (nAngle<29250_deg100) nAlign=SdrAlign::HORZ_CENTER|SdrAlign::VERT_BOTTOM;
+ else if (nAngle<33750_deg100) nAlign=SdrAlign::HORZ_RIGHT |SdrAlign::VERT_BOTTOM;
}
-tools::Long SdrGluePoint::EscDirToAngle(SdrEscapeDirection nEsc)
+Degree100 SdrGluePoint::EscDirToAngle(SdrEscapeDirection nEsc)
{
switch (nEsc) {
- case SdrEscapeDirection::RIGHT : return 0;
- case SdrEscapeDirection::TOP : return 9000;
- case SdrEscapeDirection::LEFT : return 18000;
- case SdrEscapeDirection::BOTTOM: return 27000;
+ case SdrEscapeDirection::RIGHT : return 0_deg100;
+ case SdrEscapeDirection::TOP : return 9000_deg100;
+ case SdrEscapeDirection::LEFT : return 18000_deg100;
+ case SdrEscapeDirection::BOTTOM: return 27000_deg100;
default: break;
} // switch
- return 0;
+ return 0_deg100;
}
-SdrEscapeDirection SdrGluePoint::EscAngleToDir(tools::Long nAngle)
+SdrEscapeDirection SdrGluePoint::EscAngleToDir(Degree100 nAngle)
{
nAngle=NormAngle36000(nAngle);
- if (nAngle>=31500 || nAngle<4500)
+ if (nAngle>=31500_deg100 || nAngle<4500_deg100)
return SdrEscapeDirection::RIGHT;
- if (nAngle<13500)
+ if (nAngle<13500_deg100)
return SdrEscapeDirection::TOP;
- if (nAngle<22500)
+ if (nAngle<22500_deg100)
return SdrEscapeDirection::LEFT;
/* (nAngle<31500)*/
return SdrEscapeDirection::BOTTOM;
}
-void SdrGluePoint::Rotate(const Point& rRef, tools::Long nAngle, double sn, double cs, const SdrObject* pObj)
+void SdrGluePoint::Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs, const SdrObject* pObj)
{
Point aPt(pObj!=nullptr ? GetAbsolutePos(*pObj) : GetPos());
RotatePoint(aPt,rRef,sn,cs);
@@ -206,38 +206,38 @@ void SdrGluePoint::Rotate(const Point& rRef, tools::Long nAngle, double sn, doub
if (pObj!=nullptr) SetAbsolutePos(aPt,*pObj); else SetPos(aPt);
}
-void SdrGluePoint::Mirror(const Point& rRef1, const Point& rRef2, tools::Long nAngle, const SdrObject* pObj)
+void SdrGluePoint::Mirror(const Point& rRef1, const Point& rRef2, Degree100 nAngle, const SdrObject* pObj)
{
Point aPt(pObj!=nullptr ? GetAbsolutePos(*pObj) : GetPos());
MirrorPoint(aPt,rRef1,rRef2);
// mirror reference edge
if(nAlign != (SdrAlign::HORZ_CENTER|SdrAlign::VERT_CENTER))
{
- tools::Long nAW=GetAlignAngle();
- nAW+=2*(nAngle-nAW);
+ Degree100 nAW=GetAlignAngle();
+ nAW+=2_deg100*(nAngle-nAW);
SetAlignAngle(nAW);
}
// mirror exit directions
SdrEscapeDirection nEscDir0=nEscDir;
SdrEscapeDirection nEscDir1=SdrEscapeDirection::SMART;
if (nEscDir0&SdrEscapeDirection::LEFT) {
- tools::Long nEW=EscDirToAngle(SdrEscapeDirection::LEFT);
- nEW+=2*(nAngle-nEW);
+ Degree100 nEW=EscDirToAngle(SdrEscapeDirection::LEFT);
+ nEW+=2_deg100*(nAngle-nEW);
nEscDir1|=EscAngleToDir(nEW);
}
if (nEscDir0&SdrEscapeDirection::TOP) {
- tools::Long nEW=EscDirToAngle(SdrEscapeDirection::TOP);
- nEW+=2*(nAngle-nEW);
+ Degree100 nEW=EscDirToAngle(SdrEscapeDirection::TOP);
+ nEW+=2_deg100*(nAngle-nEW);
nEscDir1|=EscAngleToDir(nEW);
}
if (nEscDir0&SdrEscapeDirection::RIGHT) {
- tools::Long nEW=EscDirToAngle(SdrEscapeDirection::RIGHT);
- nEW+=2*(nAngle-nEW);
+ Degree100 nEW=EscDirToAngle(SdrEscapeDirection::RIGHT);
+ nEW+=2_deg100*(nAngle-nEW);
nEscDir1|=EscAngleToDir(nEW);
}
if (nEscDir0&SdrEscapeDirection::BOTTOM) {
- tools::Long nEW=EscDirToAngle(SdrEscapeDirection::BOTTOM);
- nEW+=2*(nAngle-nEW);
+ Degree100 nEW=EscDirToAngle(SdrEscapeDirection::BOTTOM);
+ nEW+=2_deg100*(nAngle-nEW);
nEscDir1|=EscAngleToDir(nEW);
}
nEscDir=nEscDir1;
@@ -361,7 +361,7 @@ void SdrGluePointList::SetReallyAbsolute(bool bOn, const SdrObject& rObj)
xGP->SetReallyAbsolute(bOn,rObj);
}
-void SdrGluePointList::Rotate(const Point& rRef, tools::Long nAngle, double sn, double cs, const SdrObject* pObj)
+void SdrGluePointList::Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs, const SdrObject* pObj)
{
for (auto& xGP : aList)
xGP->Rotate(rRef,nAngle,sn,cs,pObj);
@@ -370,11 +370,11 @@ void SdrGluePointList::Rotate(const Point& rRef, tools::Long nAngle, double sn,
void SdrGluePointList::Mirror(const Point& rRef1, const Point& rRef2, const SdrObject* pObj)
{
Point aPt(rRef2); aPt-=rRef1;
- tools::Long nAngle=GetAngle(aPt);
+ Degree100 nAngle=GetAngle(aPt);
Mirror(rRef1,rRef2,nAngle,pObj);
}
-void SdrGluePointList::Mirror(const Point& rRef1, const Point& rRef2, tools::Long nAngle, const SdrObject* pObj)
+void SdrGluePointList::Mirror(const Point& rRef1, const Point& rRef2, Degree100 nAngle, const SdrObject* pObj)
{
for (auto& xGP : aList)
xGP->Mirror(rRef1,rRef2,nAngle,pObj);
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index 99aae2aeddd9..33df3e759c7c 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -327,7 +327,7 @@ void SdrHdl::SetMoveOutside( bool bMoveOutside )
}
}
-void SdrHdl::SetRotationAngle(tools::Long n)
+void SdrHdl::SetRotationAngle(Degree100 n)
{
if(nRotationAngle != n)
{
@@ -965,24 +965,24 @@ PointerStyle SdrHdl::GetPointer() const
}
} else {
// When resizing rotated rectangles, rotate the mouse cursor slightly, too
- if (bSize && nRotationAngle!=0) {
- tools::Long nHdlAngle=0;
+ if (bSize && nRotationAngle!=0_deg100) {
+ Degree100 nHdlAngle(0);
switch (eKind) {
- case SdrHdlKind::LowerRight: nHdlAngle=31500; break;
- case SdrHdlKind::Lower: nHdlAngle=27000; break;
- case SdrHdlKind::LowerLeft: nHdlAngle=22500; break;
- case SdrHdlKind::Left : nHdlAngle=18000; break;
- case SdrHdlKind::UpperLeft: nHdlAngle=13500; break;
- case SdrHdlKind::Upper: nHdlAngle=9000; break;
- case SdrHdlKind::UpperRight: nHdlAngle=4500; break;
- case SdrHdlKind::Right: nHdlAngle=0; break;
+ case SdrHdlKind::LowerRight: nHdlAngle=31500_deg100; break;
+ case SdrHdlKind::Lower: nHdlAngle=27000_deg100; break;
+ case SdrHdlKind::LowerLeft: nHdlAngle=22500_deg100; break;
+ case SdrHdlKind::Left : nHdlAngle=18000_deg100; break;
+ case SdrHdlKind::UpperLeft: nHdlAngle=13500_deg100; break;
+ case SdrHdlKind::Upper: nHdlAngle=9000_deg100; break;
+ case SdrHdlKind::UpperRight: nHdlAngle=4500_deg100; break;
+ case SdrHdlKind::Right: nHdlAngle=0_deg100; break;
default:
break;
}
// a little bit more (for rounding)
- nHdlAngle = NormAngle36000(nHdlAngle + nRotationAngle + 2249);
- nHdlAngle/=4500;
- switch (static_cast<sal_uInt8>(nHdlAngle)) {
+ nHdlAngle = NormAngle36000(nHdlAngle + nRotationAngle + 2249_deg100);
+ nHdlAngle/=4500_deg100;
+ switch (static_cast<sal_uInt8>(nHdlAngle.get())) {
case 0: ePtr=PointerStyle::ESize; break;
case 1: ePtr=PointerStyle::NESize; break;
case 2: ePtr=PointerStyle::NSize; break;
@@ -1831,7 +1831,7 @@ void ImpTextframeHdl::CreateB2dIAObject()
fTransparence,
3.0,
3.0,
- nRotationAngle * -F_PI18000,
+ nRotationAngle.get() * -F_PI18000,
true)); // allow animation; the Handle is not shown at text edit time
pNewOverlayObject->setHittable(false);
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index e45aacaca197..1e95644654aa 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -1202,9 +1202,9 @@ OUString SdrModel::GetMetricString(tools::Long nVal, bool bNoUnitChars, sal_Int3
return aBuf.makeStringAndClear();
}
-OUString SdrModel::GetAngleString(tools::Long nAngle)
+OUString SdrModel::GetAngleString(Degree100 nAngle)
{
- bool bNeg = nAngle < 0;
+ bool bNeg = nAngle < 0_deg100;
if(bNeg)
nAngle = -nAngle;
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 0d6911e71a1d..dcb8c6037f1b 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -738,7 +738,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S
{
SdrMark* pM = GetSdrMarkByIndex(0);
SdrObject* pO = pM->GetMarkedSdrObj();
- tools::Long nRotAngle = pO->GetRotateAngle();
+ Degree100 nRotAngle = pO->GetRotateAngle();
// true if we are dealing with a RotGrfFlyFrame
// (SwVirtFlyDrawObj with a SwGrfNode)
bool bWriterGraphic = pO->HasLimitedRotation();
@@ -883,7 +883,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S
aExtraInfo.append("}");
sSelectionText = aSelection.toString() +
- ", " + OString::number(nRotAngle);
+ ", " + OString::number(nRotAngle.get());
if (!aExtraInfo.isEmpty())
{
sSelectionText += ", " + aExtraInfo.makeStringAndClear();
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index c935ca6f9093..835d4f139caf 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -1527,9 +1527,8 @@ void SdrObjCustomShape::NbcResize( const Point& rRef, const Fraction& rxFact, co
}
// updating fObjectRotation
- tools::Long nTextObjRotation = aGeo.nRotationAngle;
- double fAngle = nTextObjRotation;
- fAngle /= 100.0;
+ Degree100 nTextObjRotation = aGeo.nRotationAngle;
+ double fAngle = toDegrees(nTextObjRotation);
if (IsMirroredX())
{
if (IsMirroredY())
@@ -1552,7 +1551,7 @@ void SdrObjCustomShape::NbcResize( const Point& rRef, const Fraction& rxFact, co
InvalidateRenderGeometry();
}
-void SdrObjCustomShape::NbcRotate( const Point& rRef, tools::Long nAngle, double sn, double cs )
+void SdrObjCustomShape::NbcRotate( const Point& rRef, Degree100 nAngle, double sn, double cs )
{
bool bMirroredX = IsMirroredX();
bool bMirroredY = IsMirroredY();
@@ -1566,7 +1565,7 @@ void SdrObjCustomShape::NbcRotate( const Point& rRef, tools::Long nAngle, double
SdrTextObj::NbcRotate( maRect.TopLeft(), -aGeo.nRotationAngle, // retrieving the unrotated text object
-aGeo.mfSinRotationAngle,
aGeo.mfCosRotationAngle );
- aGeo.nRotationAngle = 0; // resetting aGeo data
+ aGeo.nRotationAngle = 0_deg100; // resetting aGeo data
aGeo.RecalcSinCos();
tools::Long nW = static_cast<tools::Long>( fObjectRotation * 100 ); // applying our object rotation
@@ -1577,7 +1576,7 @@ void SdrObjCustomShape::NbcRotate( const Point& rRef, tools::Long nAngle, double
nW = nW % 36000;
if ( nW < 0 )
nW = 36000 + nW;
- SdrTextObj::NbcRotate( maRect.TopLeft(), nW, // applying text rotation
+ SdrTextObj::NbcRotate( maRect.TopLeft(), Degree100(nW), // applying text rotation
sin( nW * F_PI18000 ),
cos( nW * F_PI18000 ) );
@@ -1587,8 +1586,7 @@ void SdrObjCustomShape::NbcRotate( const Point& rRef, tools::Long nAngle, double
if ( bMirroredY )
nSwap ^= 1;
- double fAngle = nAngle; // updating to our new object rotation
- fAngle /= 100.0;
+ double fAngle = toDegrees(nAngle); // updating to our new object rotation
fObjectRotation = fmod( nSwap ? fObjectRotation - fAngle : fObjectRotation + fAngle, 360.0 );
if ( fObjectRotation < 0 )
fObjectRotation = 360 + fObjectRotation;
@@ -1625,10 +1623,8 @@ void SdrObjCustomShape::NbcMirror( const Point& rRef1, const Point& rRef2 )
SdrTextObj::NbcMirror( rRef1, rRef2 );
// update fObjectRotation
- tools::Long nTextObjRotation = aGeo.nRotationAngle;
- double fAngle = nTextObjRotation;
-
- fAngle /= 100.0;
+ Degree100 nTextObjRotation = aGeo.nRotationAngle;
+ double fAngle = toDegrees(nTextObjRotation);
bool bSingleFlip = (IsMirroredX()!= IsMirroredY());
@@ -1644,20 +1640,19 @@ void SdrObjCustomShape::NbcMirror( const Point& rRef1, const Point& rRef2 )
InvalidateRenderGeometry();
}
-void SdrObjCustomShape::Shear( const Point& rRef, tools::Long nAngle, double tn, bool bVShear )
+void SdrObjCustomShape::Shear( const Point& rRef, Degree100 nAngle, double tn, bool bVShear )
{
SdrTextObj::Shear( rRef, nAngle, tn, bVShear );
InvalidateRenderGeometry();
}
-void SdrObjCustomShape::NbcShear( const Point& rRef, tools::Long nAngle, double tn, bool bVShear )
+void SdrObjCustomShape::NbcShear( const Point& rRef, Degree100 nAngle, double tn, bool bVShear )
{
// TTTT: Fix for old mirroring, can be removed again in aw080
SdrTextObj::NbcShear(rRef,nAngle,tn,bVShear);
// updating fObjectRotation
- tools::Long nTextObjRotation = aGeo.nRotationAngle;
- double fAngle = nTextObjRotation;
- fAngle /= 100.0;
+ Degree100 nTextObjRotation = aGeo.nRotationAngle;
+ double fAngle = toDegrees(nTextObjRotation);
if (IsMirroredX())
{
if (IsMirroredY())
@@ -1698,8 +1693,8 @@ SdrGluePoint SdrObjCustomShape::GetVertexGluePoint(sal_uInt16 nPosNum) const
case 2: aPt=maRect.BottomCenter(); aPt.AdjustY(nWdt ); break;
case 3: aPt=maRect.LeftCenter(); aPt.AdjustX( -nWdt ); break;
}
- if (aGeo.nShearAngle!=0) ShearPoint(aPt,maRect.TopLeft(),aGeo.mfTanShearAngle);
- if (aGeo.nRotationAngle!=0) RotatePoint(aPt,maRect.TopLeft(),aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
+ if (aGeo.nShearAngle!=0_deg100) ShearPoint(aPt,maRect.TopLeft(),aGeo.mfTanShearAngle);
+ if (aGeo.nRotationAngle!=0_deg100) RotatePoint(aPt,maRect.TopLeft(),aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
aPt-=GetSnapRect().Center();
SdrGluePoint aGP(aPt);
aGP.SetPercent(false);
@@ -1743,7 +1738,7 @@ void SdrObjCustomShape::ImpCheckCustomGluePointsAreAdded()
bool bMirroredX = IsMirroredX();
bool bMirroredY = IsMirroredY();
- tools::Long nShearAngle = aGeo.nShearAngle;
+ Degree100 nShearAngle = aGeo.nShearAngle;
double fTan = aGeo.mfTanShearAngle;
if ( aGeo.nRotationAngle || nShearAngle || bMirroredX || bMirroredY )
@@ -1756,7 +1751,7 @@ void SdrObjCustomShape::ImpCheckCustomGluePointsAreAdded()
ShearPoint(aPoly[i],maRect.Center(), fTan );
}
if ( aGeo.nRotationAngle )
- aPoly.Rotate( maRect.Center(), Degree10(aGeo.nRotationAngle / 10) );
+ aPoly.Rotate( maRect.Center(), toDegree10(aGeo.nRotationAngle) );
tools::Rectangle aBoundRect( aPoly.GetBoundRect() );
sal_Int32 nXDiff = aBoundRect.Left() - maRect.Left();
@@ -2744,7 +2739,7 @@ void SdrObjCustomShape::TakeTextRect( SdrOutliner& rOutliner, tools::Rectangle&
if (eVAdj==SDRTEXTVERTADJUST_BOTTOM)
aTextPos.AdjustY(nFreeHgt );
}
- if (aGeo.nRotationAngle!=0)
+ if (aGeo.nRotationAngle!=0_deg100)
RotatePoint(aTextPos,aAnkRect.TopLeft(),aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
if (pAnchorRect)
@@ -3003,9 +2998,9 @@ void SdrObjCustomShape::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix,
// reset object shear and rotations
fObjectRotation = 0.0;
- aGeo.nRotationAngle = 0;
+ aGeo.nRotationAngle = 0_deg100;
aGeo.RecalcSinCos();
- aGeo.nShearAngle = 0;
+ aGeo.nShearAngle = 0_deg100;
aGeo.RecalcTan();
// if anchor is used, make position relative to it
@@ -3038,7 +3033,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 = FRound(basegfx::rad2deg(atan(fShearX)) * 100.0);
+ aGeoStat.nShearAngle = Degree100(FRound(basegfx::rad2deg(atan(fShearX)) * 100.0));
aGeoStat.RecalcTan();
Shear(Point(), aGeoStat.nShearAngle, aGeoStat.mfTanShearAngle, false);
}
@@ -3051,7 +3046,7 @@ void SdrObjCustomShape::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix,
// #i78696#
// fRotate is mathematically correct, but aGeoStat.nRotationAngle is
// mirrored -> mirror value here
- aGeoStat.nRotationAngle = NormAngle36000(FRound(-fRotate / F_PI18000));
+ aGeoStat.nRotationAngle = NormAngle36000(Degree100(FRound(-fRotate / F_PI18000)));
aGeoStat.RecalcSinCos();
Rotate(Point(), aGeoStat.nRotationAngle, aGeoStat.mfSinRotationAngle, aGeoStat.mfCosRotationAngle);
}
@@ -3092,7 +3087,7 @@ bool SdrObjCustomShape::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegf
{
// get turn and shear
double fRotate = basegfx::deg2rad(fObjectRotation);
- double fShearX = basegfx::deg2rad(aGeo.nShearAngle / 100.0);
+ double fShearX = toRadians(aGeo.nShearAngle);
// get aRect, this is the unrotated snaprect
tools::Rectangle aRectangle(maRect);
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 3dafbfe39d4b..a3ef40271c6f 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -1401,16 +1401,16 @@ void SdrObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fracti
SetRectsDirty();
}
-void SdrObject::NbcRotate(const Point& rRef, tools::Long nAngle)
+void SdrObject::NbcRotate(const Point& rRef, Degree100 nAngle)
{
if (nAngle)
{
- double a = nAngle * F_PI18000;
+ double a = nAngle.get() * F_PI18000;
NbcRotate( rRef, nAngle, sin( a ), cos( a ) );
}
}
-void SdrObject::NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs)
+void SdrObject::NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs)
{
SetGlueReallyAbsolute(true);
aOutRect.Move(-rRef.X(),-rRef.Y());
@@ -1469,7 +1469,7 @@ void SdrObject::NbcMirror(const Point& rRef1, const Point& rRef2)
SetGlueReallyAbsolute(false);
}
-void SdrObject::NbcShear(const Point& rRef, tools::Long /*nAngle*/, double tn, bool bVShear)
+void SdrObject::NbcShear(const Point& rRef, Degree100 /*nAngle*/, double tn, bool bVShear)
{
SetGlueReallyAbsolute(true);
NbcShearGluePoints(rRef,tn,bVShear);
@@ -1521,9 +1521,9 @@ void SdrObject::Crop(const basegfx::B2DPoint& rRef, double fxFact, double fyFact
SendUserCall(SdrUserCallType::Resize,aBoundRect0);
}
-void SdrObject::Rotate(const Point& rRef, tools::Long nAngle, double sn, double cs)
+void SdrObject::Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs)
{
- if (nAngle!=0) {
+ if (nAngle) {
tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
NbcRotate(rRef,nAngle,sn,cs);
SetChanged();
@@ -1541,9 +1541,9 @@ void SdrObject::Mirror(const Point& rRef1, const Point& rRef2)
SendUserCall(SdrUserCallType::Resize,aBoundRect0);
}
-void SdrObject::Shear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear)
+void SdrObject::Shear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear)
{
- if (nAngle!=0) {
+ if (nAngle) {
tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
NbcShear(rRef,nAngle,tn,bVShear);
SetChanged();
@@ -1650,14 +1650,14 @@ void SdrObject::SetLogicRect(const tools::Rectangle& rRect)
SendUserCall(SdrUserCallType::Resize,aBoundRect0);
}
-tools::Long SdrObject::GetRotateAngle() const
+Degree100 SdrObject::GetRotateAngle() const
{
- return 0;
+ return 0_deg100;
}
-tools::Long SdrObject::GetShearAngle(bool /*bVertical*/) const
+Degree100 SdrObject::GetShearAngle(bool /*bVertical*/) const
{
- return 0;
+ return 0_deg100;
}
sal_uInt32 SdrObject::GetSnapPointCount() const
@@ -2000,32 +2000,32 @@ void SdrObject::NbcApplyNotPersistAttr(const SfxItemSet& rAttr)
}
if (rAttr.GetItemState(SDRATTR_SHEARANGLE,true,&pPoolItem)==SfxItemState::SET) {
- tools::Long n=static_cast<const SdrShearAngleItem*>(pPoolItem)->GetValue();
+ Degree100 n=static_cast<const SdrShearAngleItem*>(pPoolItem)->GetValue();
n-=GetShearAngle();
- if (n!=0) {
- double nTan = tan(n * F_PI18000);
+ if (n) {
+ double nTan = tan(n.get() * F_PI18000);
NbcShear(aRef1,n,nTan,false);
}
}
if (rAttr.GetItemState(SDRATTR_ROTATEANGLE,true,&pPoolItem)==SfxItemState::SET) {
- tools::Long n=static_cast<const SdrAngleItem*>(pPoolItem)->GetValue();
+ Degree100 n=static_cast<const SdrAngleItem*>(pPoolItem)->GetValue();
n-=GetRotateAngle();
- if (n!=0) {
+ if (n) {
NbcRotate(aRef1,n);
}
}
if (rAttr.GetItemState(SDRATTR_ROTATEONE,true,&pPoolItem)==SfxItemState::SET) {
- tools::Long n=static_cast<const SdrRotateOneItem*>(pPoolItem)->GetValue();
+ Degree100 n=static_cast<const SdrRotateOneItem*>(pPoolItem)->GetValue();
NbcRotate(aRef1,n);
}
if (rAttr.GetItemState(SDRATTR_HORZSHEARONE,true,&pPoolItem)==SfxItemState::SET) {
- tools::Long n=static_cast<const SdrHorzShearOneItem*>(pPoolItem)->GetValue();
- double nTan = tan(n * F_PI18000);
+ Degree100 n=static_cast<const SdrHorzShearOneItem*>(pPoolItem)->GetValue();
+ double nTan = tan(n.get() * F_PI18000);
NbcShear(aRef1,n,nTan,false);
}
if (rAttr.GetItemState(SDRATTR_VERTSHEARONE,true,&pPoolItem)==SfxItemState::SET) {
- tools::Long n=static_cast<const SdrVertShearOneItem*>(pPoolItem)->GetValue();
- double nTan = tan(n * F_PI18000);
+ Degree100 n=static_cast<const SdrVertShearOneItem*>(pPoolItem)->GetValue();
+ double nTan = tan(n.get() * F_PI18000);
NbcShear(aRef1,n,nTan,true);
}
@@ -2235,7 +2235,7 @@ void SdrObject::SetGlueReallyAbsolute(bool bOn)
}
}
-void SdrObject::NbcRotateGluePoints(const Point& rRef, tools::Long nAngle, double sn, double cs)
+void SdrObject::NbcRotateGluePoints(const Point& rRef, Degree100 nAngle, double sn, double cs)
{
// First a const call to see whether there are any glue points.
// Force const call!
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
index c55d935a2965..983adc4391a3 100644
--- a/svx/source/svdraw/svdocirc.cxx
+++ b/svx/source/svdraw/svdocirc.cxx
@@ -50,14 +50,13 @@
using namespace com::sun::star;
-static Point GetAnglePnt(const tools::Rectangle& rR, tools::Long nAngle)
+static Point GetAnglePnt(const tools::Rectangle& rR, Degree100 nAngle)
{
Point aCenter(rR.Center());
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;
- a = nAngle * F_PI18000;
+ double a = nAngle.get() * F_PI18000;
Point aRetval(FRound(cos(a)*nMaxRad),-FRound(sin(a)*nMaxRad));
if (nWdt==0) aRetval.setX(0 );
if (nHgt==0) aRetval.setY(0 );
@@ -120,8 +119,8 @@ SdrCircObj::SdrCircObj(
SdrCircKind eNewKind)
: SdrRectObj(rSdrModel)
{
- nStartAngle=0;
- nEndAngle=36000;
+ nStartAngle=0_deg100;
+ nEndAngle=36000_deg100;
meCircleKind=eNewKind;
bClosedObj=eNewKind!=SdrCircKind::Arc;
}
@@ -132,8 +131,8 @@ SdrCircObj::SdrCircObj(
const tools::Rectangle& rRect)
: SdrRectObj(rSdrModel, rRect)
{
- nStartAngle=0;
- nEndAngle=36000;
+ nStartAngle=0_deg100;
+ nEndAngle=36000_deg100;
meCircleKind=eNewKind;
bClosedObj=eNewKind!=SdrCircKind::Arc;
}
@@ -142,14 +141,14 @@ SdrCircObj::SdrCircObj(
SdrModel& rSdrModel,
SdrCircKind eNewKind,
const tools::Rectangle& rRect,
- tools::Long nNewStartWink,
- tools::Long nNewEndWink)
+ Degree100 nNewStartWink,
+ Degree100 nNewEndWink)
: SdrRectObj(rSdrModel, rRect)
{
- tools::Long nAngleDif=nNewEndWink-nNewStartWink;
+ Degree100 nAngleDif=nNewEndWink-nNewStartWink;
nStartAngle=NormAngle36000(nNewStartWink);
nEndAngle=NormAngle36000(nNewEndWink);
- if (nAngleDif==36000) nEndAngle+=nAngleDif; // full circle
+ if (nAngleDif==36000_deg100) nEndAngle+=nAngleDif; // full circle
meCircleKind=eNewKind;
bClosedObj=eNewKind!=SdrCircKind::Arc;
}
@@ -186,7 +185,7 @@ bool SdrCircObj::PaintNeedsXPolyCirc() const
// ellipse segments.
// If not WIN, then (for now) also for circle/ellipse segments and circle/
// ellipse arcs (for precision)
- bool bNeed=aGeo.nRotationAngle!=0 || aGeo.nShearAngle!=0 || meCircleKind==SdrCircKind::Cut;
+ bool bNeed=aGeo.nRotationAngle || aGeo.nShearAngle || meCircleKind==SdrCircKind::Cut;
// If not WIN, then for everything except full circle (for now!)
if (meCircleKind!=SdrCircKind::Full) bNeed = true;
@@ -230,7 +229,7 @@ bool SdrCircObj::PaintNeedsXPolyCirc() const
return bNeed;
}
-basegfx::B2DPolygon SdrCircObj::ImpCalcXPolyCirc(const SdrCircKind eCircleKind, const tools::Rectangle& rRect1, tools::Long nStart, tools::Long nEnd) const
+basegfx::B2DPolygon SdrCircObj::ImpCalcXPolyCirc(const SdrCircKind eCircleKind, const tools::Rectangle& rRect1, Degree100 nStart, Degree100 nEnd) const
{
const basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(rRect1);
basegfx::B2DPolygon aCircPolygon;
@@ -254,8 +253,8 @@ basegfx::B2DPolygon SdrCircObj::ImpCalcXPolyCirc(const SdrCircKind eCircleKind,
{
// 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) % 36000) / 18000.0) * F_PI);
- const double fEnd((((36000 - nStart) % 36000) / 18000.0) * F_PI);
+ const double fStart((((36000 - nEnd.get()) % 36000) / 18000.0) * F_PI);
+ const double fEnd((((36000 - nStart.get()) % 36000) / 18000.0) * F_PI);
// create circle segment. This is not closed by default
aCircPolygon = basegfx::utils::createPolygonFromEllipseSegment(
@@ -293,7 +292,7 @@ basegfx::B2DPolygon SdrCircObj::ImpCalcXPolyCirc(const SdrCircKind eCircleKind,
// shear, rotate and back to top left (if needed)
aMatrix = basegfx::utils::createShearXRotateTranslateB2DHomMatrix(
-aGeo.mfTanShearAngle,
- aGeo.nRotationAngle ? (36000 - aGeo.nRotationAngle) * F_PI18000 : 0.0,
+ aGeo.nRotationAngle ? (36000_deg100 - aGeo.nRotationAngle).get() * F_PI18000 : 0.0,
aTopLeft) * aMatrix;
// apply transformation
@@ -312,7 +311,7 @@ void SdrCircObj::RecalcXPoly()
OUString SdrCircObj::TakeObjNameSingul() const
{
const char* pID=STR_ObjNameSingulCIRC;
- if (maRect.GetWidth() == maRect.GetHeight() && aGeo.nShearAngle==0)
+ if (maRect.GetWidth() == maRect.GetHeight() && aGeo.nShearAngle==0_deg100)
{
switch (meCircleKind) {
case SdrCircKind::Full: pID=STR_ObjNameSingulCIRC; break;
@@ -346,7 +345,7 @@ OUString SdrCircObj::TakeObjNameSingul() const
OUString SdrCircObj::TakeObjNamePlural() const
{
const char* pID=STR_ObjNamePluralCIRC;
- if (maRect.GetWidth() == maRect.GetHeight() && aGeo.nShearAngle==0)
+ if (maRect.GetWidth() == maRect.GetHeight() && aGeo.nShearAngle==0_deg100)
{
switch (meCircleKind) {
case SdrCircKind::Full: pID=STR_ObjNamePluralCIRC; break;
@@ -400,8 +399,8 @@ struct ImpCircUser : public SdrDragStatUserData
Point aP1;
tools::Long nHgt;
tools::Long nWdt;
- tools::Long nStart;
- tools::Long nEnd;
+ Degree100 nStart;
+ Degree100 nEnd;
public:
ImpCircUser()
@@ -530,10 +529,10 @@ bool SdrCircObj::applySpecialDrag(SdrDragStat& rDrag)
{
Point aPt(rDrag.GetNow());
- if (aGeo.nRotationAngle!=0)
+ if (aGeo.nRotationAngle)
RotatePoint(aPt,maRect.TopLeft(),-aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
- if (aGeo.nShearAngle!=0)
+ if (aGeo.nShearAngle)
ShearPoint(aPt,maRect.TopLeft(),-aGeo.mfTanShearAngle);
aPt -= maRect.Center();
@@ -550,15 +549,15 @@ bool SdrCircObj::applySpecialDrag(SdrDragStat& rDrag)
aPt.setX(BigMulDiv(aPt.X(),nHgt,nWdt) );
}
- tools::Long nAngle=NormAngle36000(GetAngle(aPt));
+ Degree100 nAngle=NormAngle36000(GetAngle(aPt));
if (rDrag.GetView() && rDrag.GetView()->IsAngleSnapEnabled())
{
- tools::Long nSA=rDrag.GetView()->GetSnapAngle();
+ Degree100 nSA=rDrag.GetView()->GetSnapAngle();
- if (nSA!=0)
+ if (nSA)
{
- nAngle+=nSA/2;
+ nAngle+=nSA/2_deg100;
nAngle/=nSA;
nAngle*=nSA;
nAngle=NormAngle36000(nAngle);
@@ -599,7 +598,7 @@ OUString SdrCircObj::getSpecialDragComment(const SdrDragStat& rDrag) const
if(SdrCircKind::Full != meCircleKind && nPointCount > 2)
{
const ImpCircUser* pU = static_cast<const ImpCircUser*>(rDrag.GetUser());
- sal_Int32 nAngle;
+ Degree100 nAngle;
aBuf.append(" (");
@@ -624,7 +623,7 @@ OUString SdrCircObj::getSpecialDragComment(const SdrDragStat& rDrag) const
if(bAngle)
{
- const sal_Int32 nAngle(1 == rDrag.GetHdl()->GetPointNum() ? nStartAngle : nEndAngle);
+ const Degree100 nAngle(1 == rDrag.GetHdl()->GetPointNum() ? nStartAngle : nEndAngle);
OUStringBuffer aBuf(ImpGetDescriptionStr(STR_DragCircAngle));
aBuf.append(" (");
@@ -648,8 +647,8 @@ void ImpCircUser::SetCreateParams(SdrDragStat const & rStat)
aCenter=aR.Center();
nWdt=aR.Right()-aR.Left();
nHgt=aR.Bottom()-aR.Top();
- nStart=0;
- nEnd=36000;
+ nStart=0_deg100;
+ nEnd=36000_deg100;
if (rStat.GetPointCount()>2) {
Point aP(rStat.GetPoint(2)-aCenter);
if (nWdt==0) aP.setX(0 );
@@ -661,9 +660,9 @@ void ImpCircUser::SetCreateParams(SdrDragStat const & rStat)
}
nStart=NormAngle36000(GetAngle(aP));
if (rStat.GetView()!=nullptr && rStat.GetView()->IsAngleSnapEnabled()) {
- tools::Long nSA=rStat.GetView()->GetSnapAngle();
- if (nSA!=0) { // angle snapping
- nStart+=nSA/2;
+ Degree100 nSA=rStat.GetView()->GetSnapAngle();
+ if (nSA) { // angle snapping
+ nStart+=nSA/2_deg100;
nStart/=nSA;
nStart*=nSA;
nStart=NormAngle36000(nStart);
@@ -683,9 +682,9 @@ void ImpCircUser::SetCreateParams(SdrDragStat const & rStat)
}
nEnd=NormAngle36000(GetAngle(aP));
if (rStat.GetView()!=nullptr && rStat.GetView()->IsAngleSnapEnabled()) {
- tools::Long nSA=rStat.GetView()->GetSnapAngle();
- if (nSA!=0) { // angle snapping
- nEnd+=nSA/2;
+ Degree100 nSA=rStat.GetView()->GetSnapAngle();
+ if (nSA) { // angle snapping
+ nEnd+=nSA/2_deg100;
nEnd/=nSA;
nEnd*=nSA;
nEnd=NormAngle36000(nEnd);
@@ -831,10 +830,10 @@ void SdrCircObj::NbcMove(const Size& aSiz)
void SdrCircObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
{
- tools::Long nAngle0=aGeo.nRotationAngle;
- bool bNoShearRota=(aGeo.nRotationAngle==0 && aGeo.nShearAngle==0);
+ Degree100 nAngle0=aGeo.nRotationAngle;
+ bool bNoShearRota=(aGeo.nRotationAngle==0_deg100 && aGeo.nShearAngle==0_deg100);
SdrTextObj::NbcResize(rRef,xFact,yFact);
- bNoShearRota|=(aGeo.nRotationAngle==0 && aGeo.nShearAngle==0);
+ bNoShearRota|=(aGeo.nRotationAngle==0_deg100 && aGeo.nShearAngle==0_deg100);
if (meCircleKind!=SdrCircKind::Full) {
bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
@@ -843,26 +842,26 @@ void SdrCircObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract
// That, however, is pretty bad (because of forced "hard" formatting).
// Alternatively, we could implement a bMirrored flag (maybe even
// a more general one, e. g. for mirrored text, ...).
- tools::Long nS0=nStartAngle;
- tools::Long nE0=nEndAngle;
+ Degree100 nS0=nStartAngle;
+ Degree100 nE0=nEndAngle;
if (bNoShearRota) {
// the RectObj already mirrors at VMirror because of a 180deg rotation
if (! (bXMirr && bYMirr)) {
- tools::Long nTmp=nS0;
- nS0=18000-nE0;
- nE0=18000-nTmp;
+ Degree100 nTmp=nS0;
+ nS0=18000_deg100-nE0;
+ nE0=18000_deg100-nTmp;
}
} else { // mirror contorted ellipses
if (bXMirr!=bYMirr) {
nS0+=nAngle0;
nE0+=nAngle0;
if (bXMirr) {
- tools::Long nTmp=nS0;
- nS0=18000-nE0;
- nE0=18000-nTmp;
+ Degree100 nTmp=nS0;
+ nS0=18000_deg100-nE0;
+ nE0=18000_deg100-nTmp;
}
if (bYMirr) {
- tools::Long nTmp=nS0;
+ Degree100 nTmp=nS0;
nS0=-nE0;
nE0=-nTmp;
}
@@ -870,17 +869,17 @@ void SdrCircObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract
nE0-=aGeo.nRotationAngle;
}
}
- tools::Long nAngleDif=nE0-nS0;
+ Degree100 nAngleDif=nE0-nS0;
nStartAngle=NormAngle36000(nS0);
nEndAngle =NormAngle36000(nE0);
- if (nAngleDif==36000) nEndAngle+=nAngleDif; // full circle
+ if (nAngleDif==36000_deg100) nEndAngle+=nAngleDif; // full circle
}
}
SetXPolyDirty();
ImpSetCircInfoToAttr();
}
-void SdrCircObj::NbcShear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear)
+void SdrCircObj::NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear)
{
SdrTextObj::NbcShear(rRef,nAngle,tn,bVShear);
SetXPolyDirty();
@@ -899,22 +898,22 @@ void SdrCircObj::NbcMirror(const Point& rRef1, const Point& rRef2)
tools::Long nMaxRad=(std::max(nWdt,nHgt)+1) /2;
double a;
// starting point
- a = nStartAngle * F_PI18000;
+ a = nStartAngle.get() * F_PI18000;
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 * F_PI18000;
+ a = nEndAngle.get() * F_PI18000;
aTmpPt2=Point(FRound(cos(a)*nMaxRad),-FRound(sin(a)*nMaxRad));
if (nWdt==0) aTmpPt2.setX(0 );
if (nHgt==0) aTmpPt2.setY(0 );
aTmpPt2+=aCenter;
- if (aGeo.nRotationAngle!=0) {
+ if (aGeo.nRotationAngle) {
RotatePoint(aTmpPt1,maRect.TopLeft(),aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
RotatePoint(aTmpPt2,maRect.TopLeft(),aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
}
- if (aGeo.nShearAngle!=0) {
+ if (aGeo.nShearAngle) {
ShearPoint(aTmpPt1,maRect.TopLeft(),aGeo.mfTanShearAngle);
ShearPoint(aTmpPt2,maRect.TopLeft(),aGeo.mfTanShearAngle);
}
@@ -924,12 +923,12 @@ void SdrCircObj::NbcMirror(const Point& rRef1, const Point& rRef2)
MirrorPoint(aTmpPt1,rRef1,rRef2);
MirrorPoint(aTmpPt2,rRef1,rRef2);
// unrotate:
- if (aGeo.nRotationAngle!=0) {
+ if (aGeo.nRotationAngle) {
RotatePoint(aTmpPt1,maRect.TopLeft(),-aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle); // -sin for reversion
RotatePoint(aTmpPt2,maRect.TopLeft(),-aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle); // -sin for reversion
}
// unshear:
- if (aGeo.nShearAngle!=0) {
+ if (aGeo.nShearAngle) {
ShearPoint(aTmpPt1,maRect.TopLeft(),-aGeo.mfTanShearAngle); // -tan for reversion
ShearPoint(aTmpPt2,maRect.TopLeft(),-aGeo.mfTanShearAngle); // -tan for reversion
}
@@ -939,10 +938,10 @@ void SdrCircObj::NbcMirror(const Point& rRef1, const Point& rRef2)
// because it's mirrored, the angles are swapped, too
nStartAngle=GetAngle(aTmpPt2);
nEndAngle =GetAngle(aTmpPt1);
- tools::Long nAngleDif=nEndAngle-nStartAngle;
+ Degree100 nAngleDif=nEndAngle-nStartAngle;
nStartAngle=NormAngle36000(nStartAngle);
nEndAngle =NormAngle36000(nEndAngle);
- if (nAngleDif==36000) nEndAngle+=nAngleDif; // full circle
+ if (nAngleDif==36000_deg100) nEndAngle+=nAngleDif; // full circle
}
SetXPolyDirty();
ImpSetCircInfoToAttr();
@@ -985,30 +984,30 @@ void SdrCircObj::TakeUnrotatedSnapRect(tools::Rectangle& rRect) const
if (meCircleKind!=SdrCircKind::Full) {
const Point aPntStart(GetAnglePnt(maRect,nStartAngle));
const Point aPntEnd(GetAnglePnt(maRect,nEndAngle));
- tools::Long a=nStartAngle;
- tools::Long e=nEndAngle;
+ Degree100 a=nStartAngle;
+ Degree100 e=nEndAngle;
rRect.SetLeft(maRect.Right() );
rRect.SetRight(maRect.Left() );
rRect.SetTop(maRect.Bottom() );
rRect.SetBottom(maRect.Top() );
Union(rRect,aPntStart);
Union(rRect,aPntEnd);
- if ((a<=18000 && e>=18000) || (a>e && (a<=18000 || e>=18000))) {
+ if ((a<=18000_deg100 && e>=18000_deg100) || (a>e && (a<=18000_deg100 || e>=18000_deg100))) {
Union(rRect,maRect.LeftCenter());
}
- if ((a<=27000 && e>=27000) || (a>e && (a<=27000 || e>=27000))) {
+ if ((a<=27000_deg100 && e>=27000_deg100) || (a>e && (a<=27000_deg100 || e>=27000_deg100))) {
Union(rRect,maRect.BottomCenter());
}
if (a>e) {
Union(rRect,maRect.RightCenter());
}
- if ((a<=9000 && e>=9000) || (a>e && (a<=9000 || e>=9000))) {
+ if ((a<=9000_deg100 && e>=9000_deg100) || (a>e && (a<=9000_deg100 || e>=9000_deg100))) {
Union(rRect,maRect.TopCenter());
}
if (meCircleKind==SdrCircKind::Section) {
Union(rRect,maRect.Center());
}
- if (aGeo.nRotationAngle!=0) {
+ if (aGeo.nRotationAngle) {
Point aDst(rRect.TopLeft());
aDst-=maRect.TopLeft();
Point aDst0(aDst);
@@ -1017,11 +1016,11 @@ void SdrCircObj::TakeUnrotatedSnapRect(tools::Rectangle& rRect) const
rRect.Move(aDst.X(),aDst.Y());
}
}
- if (aGeo.nShearAngle==0)
+ if (aGeo.nShearAngle==0_deg100)
return;
tools::Long nDst=FRound((rRect.Bottom()-rRect.Top())*aGeo.mfTanShearAngle);
- if (aGeo.nShearAngle>0) {
+ if (aGeo.nShearAngle>0_deg100) {
Point aRef(rRect.TopLeft());
rRect.AdjustLeft( -nDst );
Point aTmpPt(rRect.TopLeft());
@@ -1044,7 +1043,7 @@ void SdrCircObj::RecalcSnapRect()
void SdrCircObj::NbcSetSnapRect(const tools::Rectangle& rRect)
{
- if (aGeo.nRotationAngle!=0 || aGeo.nShearAngle!=0 || meCircleKind!=SdrCircKind::Full) {
+ if (aGeo.nRotationAngle || aGeo.nShearAngle || meCircleKind!=SdrCircKind::Full) {
tools::Rectangle aSR0(GetSnapRect());
tools::Long nWdt0=aSR0.Right()-aSR0.Left();
tools::Long nHgt0=aSR0.Bottom()-aSR0.Top();
@@ -1092,8 +1091,8 @@ void SdrCircObj::ImpSetAttrToCircInfo()
const SfxItemSet& rSet = GetObjectItemSet();
SdrCircKind eNewKind = rSet.Get(SDRATTR_CIRCKIND).GetValue();
- sal_Int32 nNewStart = rSet.Get(SDRATTR_CIRCSTARTANGLE).GetValue();
- sal_Int32 nNewEnd = rSet.Get(SDRATTR_CIRCENDANGLE).GetValue();
+ Degree100 nNewStart = rSet.Get(SDRATTR_CIRCSTARTANGLE).GetValue();
+ Degree100 nNewEnd = rSet.Get(SDRATTR_CIRCENDANGLE).GetValue();
bool bKindChg = meCircleKind != eNewKind;
bool bAngleChg = nNewStart != nStartAngle || nNewEnd != nEndAngle;
@@ -1117,8 +1116,8 @@ void SdrCircObj::ImpSetCircInfoToAttr()
const SfxItemSet& rSet = GetObjectItemSet();
SdrCircKind eOldKindA = rSet.Get(SDRATTR_CIRCKIND).GetValue();
- sal_Int32 nOldStartAngle = rSet.Get(SDRATTR_CIRCSTARTANGLE).GetValue();
- sal_Int32 nOldEndAngle = rSet.Get(SDRATTR_CIRCENDANGLE).GetValue();
+ Degree100 nOldStartAngle = rSet.Get(SDRATTR_CIRCSTARTANGLE).GetValue();
+ Degree100 nOldEndAngle = rSet.Get(SDRATTR_CIRCENDANGLE).GetValue();
if(meCircleKind == eOldKindA && nStartAngle == nOldStartAngle && nEndAngle == nOldEndAngle)
return;
diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
index f1395767cd29..3e164e216f03 100644
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -2292,7 +2292,7 @@ void SdrEdgeObj::NbcResize(const Point& rRefPnt, const Fraction& aXFact, const F
}
// #i54102# added rotation support
-void SdrEdgeObj::NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs)
+void SdrEdgeObj::NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs)
{
if(bEdgeTrackUserDefined)
{
@@ -2354,7 +2354,7 @@ void SdrEdgeObj::NbcMirror(const Point& rRef1, const Point& rRef2)
}
// #i54102# added shear support
-void SdrEdgeObj::NbcShear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear)
+void SdrEdgeObj::NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear)
{
if(bEdgeTrackUserDefined)
{
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 991b3b288f46..e11d1b54528b 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -362,7 +362,7 @@ GraphicAttr SdrGrafObj::GetGraphicAttr( SdrGrafObjTransformsAttrs nTransformFlag
{
const bool bMirror = bool( nTransformFlags & SdrGrafObjTransformsAttrs::MIRROR );
const bool bRotate = bool( nTransformFlags & SdrGrafObjTransformsAttrs::ROTATE ) &&
- (aGeo.nRotationAngle && aGeo.nRotationAngle != 18000);
+ (aGeo.nRotationAngle && aGeo.nRotationAngle != 18000_deg100);
// Need cropping info earlier
const_cast<SdrGrafObj*>(this)->ImpSetAttrToGrafInfo();
@@ -373,7 +373,7 @@ GraphicAttr SdrGrafObj::GetGraphicAttr( SdrGrafObjTransformsAttrs nTransformFlag
if( bMirror )
{
- sal_uInt16 nMirrorCase = ( aGeo.nRotationAngle == 18000 ) ? ( bMirrored ? 3 : 4 ) : ( bMirrored ? 2 : 1 );
+ sal_uInt16 nMirrorCase = ( aGeo.nRotationAngle == 18000_deg100 ) ? ( bMirrored ? 3 : 4 ) : ( bMirrored ? 2 : 1 );
bool bHMirr = nMirrorCase == 2 || nMirrorCase == 4;
bool bVMirr = nMirrorCase == 3 || nMirrorCase == 4;
@@ -381,7 +381,7 @@ GraphicAttr SdrGrafObj::GetGraphicAttr( SdrGrafObjTransformsAttrs nTransformFlag
}
if( bRotate )
- aActAttr.SetRotation( Degree10(aGeo.nRotationAngle / 10) );
+ aActAttr.SetRotation( toDegree10(aGeo.nRotationAngle ) );
}
return aActAttr;
@@ -509,9 +509,9 @@ void SdrGrafObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
{
bool bNoPresGrf = ( mpGraphicObject->GetType() != GraphicType::NONE ) && !bEmptyPresObj;
- rInfo.bResizeFreeAllowed = aGeo.nRotationAngle % 9000 == 0 ||
- aGeo.nRotationAngle % 18000 == 0 ||
- aGeo.nRotationAngle % 27000 == 0;
+ rInfo.bResizeFreeAllowed = aGeo.nRotationAngle.get() % 9000 == 0 ||
+ aGeo.nRotationAngle.get() % 18000 == 0 ||
+ aGeo.nRotationAngle.get() % 27000 == 0;
rInfo.bResizePropAllowed = true;
rInfo.bRotateFreeAllowed = bNoPresGrf;
diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx
index b78a02cdfafe..34ae1c55fe8a 100644
--- a/svx/source/svdraw/svdogrp.cxx
+++ b/svx/source/svdraw/svdogrp.cxx
@@ -299,9 +299,9 @@ bool SdrObjGroup::BegCreate(SdrDragStat& /*rStat*/)
}
-tools::Long SdrObjGroup::GetRotateAngle() const
+Degree100 SdrObjGroup::GetRotateAngle() const
{
- tools::Long nRetval(0);
+ Degree100 nRetval(0);
if(0 != GetObjCount())
{
@@ -314,9 +314,9 @@ tools::Long SdrObjGroup::GetRotateAngle() const
}
-tools::Long SdrObjGroup::GetShearAngle(bool /*bVertical*/) const
+Degree100 SdrObjGroup::GetShearAngle(bool /*bVertical*/) const
{
- tools::Long nRetval(0);
+ Degree100 nRetval(0);
if(0 != GetObjCount())
{
@@ -413,7 +413,7 @@ void SdrObjGroup::NbcResize(const Point& rRef, const Fraction& xFact, const Frac
}
-void SdrObjGroup::NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs)
+void SdrObjGroup::NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs)
{
SetGlueReallyAbsolute(true);
RotatePoint(aRefPoint,rRef,sn,cs);
@@ -447,7 +447,7 @@ void SdrObjGroup::NbcMirror(const Point& rRef1, const Point& rRef2)
}
-void SdrObjGroup::NbcShear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear)
+void SdrObjGroup::NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear)
{
SetGlueReallyAbsolute(true);
ShearPoint(aRefPoint,rRef,tn);
@@ -610,9 +610,9 @@ void SdrObjGroup::Resize(const Point& rRef, const Fraction& xFact, const Fractio
}
-void SdrObjGroup::Rotate(const Point& rRef, tools::Long nAngle, double sn, double cs)
+void SdrObjGroup::Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs)
{
- if (nAngle==0)
+ if (nAngle==0_deg100)
return;
SetGlueReallyAbsolute(true);
@@ -673,9 +673,9 @@ void SdrObjGroup::Mirror(const Point& rRef1, const Point& rRef2)
}
-void SdrObjGroup::Shear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear)
+void SdrObjGroup::Shear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear)
{
- if (nAngle==0)
+ if (nAngle==0_deg100)
return;
SetGlueReallyAbsolute(true);
diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx
index 4bbfb61ea289..8464d2f86b6e 100644
--- a/svx/source/svdraw/svdomeas.cxx
+++ b/svx/source/svdraw/svdomeas.cxx
@@ -263,7 +263,7 @@ struct ImpMeasureRec : public SdrDragStatUserData
bool bTextRota90;
bool bTextUpsideDown;
bool bTextAutoAngle;
- tools::Long nTextAutoAngleView;
+ Degree100 nTextAutoAngleView;
};
namespace {
@@ -285,9 +285,9 @@ struct ImpMeasurePoly
ImpLineRec aHelpline2;
Size aTextSize;
tools::Long nLineLen;
- tools::Long nLineAngle;
- tools::Long nTextAngle;
- tools::Long nHlpAngle;
+ Degree100 nLineAngle;
+ Degree100 nTextAngle;
+ Degree100 nHlpAngle;
double nLineSin;
double nLineCos;
sal_uInt16 nMainlineCnt;
@@ -417,28 +417,28 @@ void SdrMeasureObj::ImpCalcGeometrics(const ImpMeasureRec& rRec, ImpMeasurePoly&
rPol.nArrow2Len=nArrow2Len;
rPol.nLineAngle=GetAngle(aDelt);
- double a = rPol.nLineAngle * F_PI18000;
+ double a = rPol.nLineAngle.get() * F_PI18000;
double nLineSin=sin(a);
double nLineCos=cos(a);
rPol.nLineSin=nLineSin;
rPol.nLineCos=nLineCos;
rPol.nTextAngle=rPol.nLineAngle;
- if (rRec.bTextRota90) rPol.nTextAngle+=9000;
+ if (rRec.bTextRota90) rPol.nTextAngle+=9000_deg100;
rPol.bAutoUpsideDown=false;
if (rRec.bTextAutoAngle) {
- tools::Long nTmpAngle=NormAngle36000(rPol.nTextAngle-rRec.nTextAutoAngleView);
- if (nTmpAngle>=18000) {
- rPol.nTextAngle+=18000;
+ Degree100 nTmpAngle=NormAngle36000(rPol.nTextAngle-rRec.nTextAutoAngleView);
+ if (nTmpAngle>=18000_deg100) {
+ rPol.nTextAngle+=18000_deg100;
rPol.bAutoUpsideDown=true;
}
}
- if (rRec.bTextUpsideDown) rPol.nTextAngle+=18000;
+ if (rRec.bTextUpsideDown) rPol.nTextAngle+=18000_deg100;
rPol.nTextAngle=NormAngle36000(rPol.nTextAngle);
- rPol.nHlpAngle=rPol.nLineAngle+9000;
- if (rRec.bBelowRefEdge) rPol.nHlpAngle+=18000;
+ rPol.nHlpAngle=rPol.nLineAngle+9000_deg100;
+ if (rRec.bBelowRefEdge) rPol.nHlpAngle+=18000_deg100;
rPol.nHlpAngle=NormAngle36000(rPol.nHlpAngle);
double nHlpSin=nLineCos;
double nHlpCos=-nLineSin;
@@ -878,8 +878,8 @@ OUString SdrMeasureObj::getSpecialDragComment(const SdrDragStat& /*rDrag*/) cons
void SdrMeasureObj::ImpEvalDrag(ImpMeasureRec& rRec, const SdrDragStat& rDrag) const
{
- tools::Long nLineAngle=GetAngle(rRec.aPt2-rRec.aPt1);
- double a = nLineAngle * F_PI18000;
+ Degree100 nLineAngle=GetAngle(rRec.aPt2-rRec.aPt1);
+ double a = nLineAngle.get() * F_PI18000;
double nSin=sin(a);
double nCos=cos(a);
@@ -1016,7 +1016,7 @@ void SdrMeasureObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fr
SetTextDirty();
}
-void SdrMeasureObj::NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs)
+void SdrMeasureObj::NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs)
{
SdrTextObj::NbcRotate(rRef,nAngle,sn,cs);
tools::Long nLen0=GetLen(aPt2-aPt1);
@@ -1047,7 +1047,7 @@ void SdrMeasureObj::NbcMirror(const Point& rRef1, const Point& rRef2)
SetRectsDirty();
}
-void SdrMeasureObj::NbcShear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear)
+void SdrMeasureObj::NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear)
{
SdrTextObj::NbcShear(rRef,nAngle,tn,bVShear);
ShearPoint(aPt1,rRef,tn,bVShear);
@@ -1056,7 +1056,7 @@ void SdrMeasureObj::NbcShear(const Point& rRef, tools::Long nAngle, double tn, b
SetTextDirty();
}
-tools::Long SdrMeasureObj::GetRotateAngle() const
+Degree100 SdrMeasureObj::GetRotateAngle() const
{
return GetAngle(aPt2-aPt1);
}
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index 24c93bb67f63..b7655a4a7b00 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -239,8 +239,8 @@ struct ImpPathCreateUser : public SdrDragStatUserData
Point aRectP2;
Point aRectP3;
tools::Long nCircRadius;
- tools::Long nCircStAngle;
- tools::Long nCircRelAngle;
+ Degree100 nCircStAngle;
+ Degree100 nCircRelAngle;
bool bBezier;
bool bBezHasCtrl0;
bool bCircle;
@@ -308,40 +308,40 @@ XPolygon ImpPathCreateUser::GetBezierPoly() const
void ImpPathCreateUser::CalcCircle(const Point& rP1, const Point& rP2, const Point& rDir, SdrView const * pView)
{
- tools::Long nTangAngle=GetAngle(rDir);
+ Degree100 nTangAngle=GetAngle(rDir);
aCircStart=rP1;
aCircEnd=rP2;
aCircCenter=rP1;
tools::Long dx=rP2.X()-rP1.X();
tools::Long dy=rP2.Y()-rP1.Y();
- tools::Long dAngle=GetAngle(Point(dx,dy))-nTangAngle;
+ Degree100 dAngle=GetAngle(Point(dx,dy))-nTangAngle;
dAngle=NormAngle36000(dAngle);
- tools::Long nTmpAngle=NormAngle36000(9000-dAngle);
- bool bRet=nTmpAngle!=9000 && nTmpAngle!=27000;
+ Degree100 nTmpAngle=NormAngle36000(9000_deg100-dAngle);
+ bool bRet=nTmpAngle!=9000_deg100 && nTmpAngle!=27000_deg100;
tools::Long nRad=0;
if (bRet) {
- double cs = cos(nTmpAngle * F_PI18000);
+ double cs = cos(nTmpAngle.get() * F_PI18000);
double nR=static_cast<double>(GetLen(Point(dx,dy)))/cs/2;
nRad=std::abs(FRound(nR));
}
- if (dAngle<18000) {
- nCircStAngle=NormAngle36000(nTangAngle-9000);
- nCircRelAngle=NormAngle36000(2*dAngle);
- aCircCenter.AdjustX(FRound(nRad * cos((nTangAngle + 9000) * F_PI18000)));
- aCircCenter.AdjustY(-(FRound(nRad * sin((nTangAngle + 9000) * F_PI18000))));
+ 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))));
} else {
- nCircStAngle=NormAngle36000(nTangAngle+9000);
- nCircRelAngle=-NormAngle36000(36000-2*dAngle);
- aCircCenter.AdjustX(FRound(nRad * cos((nTangAngle - 9000) * F_PI18000)));
- aCircCenter.AdjustY(-(FRound(nRad * sin((nTangAngle - 9000) * F_PI18000))));
+ 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))));
}
bAngleSnap=pView!=nullptr && pView->IsAngleSnapEnabled();
if (bAngleSnap) {
- tools::Long nSA=pView->GetSnapAngle();
- if (nSA!=0) { // angle snapping
- bool bNeg=nCircRelAngle<0;
+ Degree100 nSA=pView->GetSnapAngle();
+ if (nSA) { // angle snapping
+ bool bNeg=nCircRelAngle<0_deg100;
if (bNeg) nCircRelAngle=-nCircRelAngle;
- nCircRelAngle+=nSA/2;
+ nCircRelAngle+=nSA/2_deg100;
nCircRelAngle/=nSA;
nCircRelAngle*=nSA;
nCircRelAngle=NormAngle36000(nCircRelAngle);
@@ -349,21 +349,21 @@ void ImpPathCreateUser::CalcCircle(const Point& rP1, const Point& rP2, const Poi
}
}
nCircRadius=nRad;
- if (nRad==0 || std::abs(nCircRelAngle)<5) bRet=false;
+ if (nRad==0 || abs(nCircRelAngle).get()<5) bRet=false;
bCircle=bRet;
}
XPolygon ImpPathCreateUser::GetCirclePoly() const
{
- if (nCircRelAngle>=0) {
+ if (nCircRelAngle>=0_deg100) {
XPolygon aXP(aCircCenter,nCircRadius,nCircRadius,
- Degree10((nCircStAngle+5)/10),Degree10((nCircStAngle+nCircRelAngle+5)/10),false);
+ toDegree10(nCircStAngle), toDegree10(nCircStAngle+nCircRelAngle),false);
aXP[0]=aCircStart; aXP.SetFlags(0,PolyFlags::Smooth);
if (!bAngleSnap) aXP[aXP.GetPointCount()-1]=aCircEnd;
return aXP;
} else {
XPolygon aXP(aCircCenter,nCircRadius,nCircRadius,
- Degree10(NormAngle36000(nCircStAngle+nCircRelAngle+5)/10),Degree10((nCircStAngle+5)/10),false);
+ toDegree10(NormAngle36000(nCircStAngle+nCircRelAngle)), toDegree10(nCircStAngle),false);
sal_uInt16 nCount=aXP.GetPointCount();
for (sal_uInt16 nNum=nCount/2; nNum>0;) {
nNum--; // reverse XPoly's order of points
@@ -449,9 +449,9 @@ void ImpPathCreateUser::CalcRect(const Point& rP1, const Point& rP2, const Point
else {
y=BigMulDiv(x,nDirY,nDirX);
tools::Long nHypLen=aTmpPt.Y()-y;
- tools::Long nTangAngle=-GetAngle(rDir);
+ Degree100 nTangAngle=-GetAngle(rDir);
// sin=g/h, g=h*sin
- double a = nTangAngle * F_PI18000;
+ double a = nTangAngle.get() * F_PI18000;
double sn=sin(a);
double cs=cos(a);
double nGKathLen=nHypLen*sn;
@@ -736,12 +736,12 @@ bool ImpPathForDragAndCreate::movePathDrag( SdrDragStat& rDrag ) const
{
Point aPt(mpSdrPathDragData->aXP[nNextPnt]);
aPt-=rDrag.GetNow();
- tools::Long nAngle1=GetAngle(aPt);
+ Degree100 nAngle1=GetAngle(aPt);
aPt=rDrag.GetNow();
aPt-=mpSdrPathDragData->aXP[nPrevPnt];
- tools::Long nAngle2=GetAngle(aPt);
- tools::Long nDiff=nAngle1-nAngle2;
- nDiff=std::abs(nDiff);
+ Degree100 nAngle2=GetAngle(aPt);
+ Degree100 nDiff=nAngle1-nAngle2;
+ nDiff=abs(nDiff);
mpSdrPathDragData->bEliminate=nDiff<=rDrag.GetView()->GetEliminatePolyPointLimitAngle();
if (mpSdrPathDragData->bEliminate) { // adapt position, Smooth is true for the ends
aPt=mpSdrPathDragData->aXP[nNextPnt];
@@ -932,7 +932,7 @@ OUString ImpPathForDragAndCreate::getSpecialDragComment(const SdrDragStat& rDrag
if(pU->bCircle)
{
- aStr += SdrModel::GetAngleString(std::abs(pU->nCircRelAngle))
+ aStr += SdrModel::GetAngleString(abs(pU->nCircRelAngle))
+ " r="
+ mrSdrPathObject.getSdrModelFromSdrObject().GetMetricString(pU->nCircRadius, true);
}
@@ -945,7 +945,7 @@ OUString ImpPathForDragAndCreate::getSpecialDragComment(const SdrDragStat& rDrag
if(!IsFreeHand(meObjectKind))
{
sal_Int32 nLen(GetLen(aNow));
- sal_Int32 nAngle(GetAngle(aNow));
+ Degree100 nAngle(GetAngle(aNow));
aStr += " l="
+ mrSdrPathObject.getSdrModelFromSdrObject().GetMetricString(nLen, true)
+ " "
@@ -1027,7 +1027,7 @@ OUString ImpPathForDragAndCreate::getSpecialDragComment(const SdrDragStat& rDrag
aNow -= rXPoly[nRef];
sal_Int32 nLen(GetLen(aNow));
- sal_Int32 nAngle(GetAngle(aNow));
+ Degree100 nAngle(GetAngle(aNow));
aStr += " l="
+ mrSdrPathObject.getSdrModelFromSdrObject().GetMetricString(nLen, true)
+ " "
@@ -1070,7 +1070,7 @@ OUString ImpPathForDragAndCreate::getSpecialDragComment(const SdrDragStat& rDrag
aPt -= rXPoly[nPt1];
sal_Int32 nLen(GetLen(aPt));
- sal_Int32 nAngle(GetAngle(aPt));
+ Degree100 nAngle(GetAngle(aPt));
aStr += " l="
+ mrSdrPathObject.getSdrModelFromSdrObject().GetMetricString(nLen, true)
+ " "
@@ -1088,7 +1088,7 @@ OUString ImpPathForDragAndCreate::getSpecialDragComment(const SdrDragStat& rDrag
aPt -= rXPoly[nPt2];
sal_Int32 nLen(GetLen(aPt));
- sal_Int32 nAngle(GetAngle(aPt));
+ Degree100 nAngle(GetAngle(aPt));
aStr += "l="
+ mrSdrPathObject.getSdrModelFromSdrObject().GetMetricString(nLen, true)
+ " "
@@ -1670,7 +1670,7 @@ void SdrPathObj::ImpForceLineAngle()
const Point aDelt(FRound(aB2DDelt.getX()), FRound(aB2DDelt.getY()));
aGeo.nRotationAngle=GetAngle(aDelt);
- aGeo.nShearAngle=0;
+ aGeo.nShearAngle=0_deg100;
aGeo.RecalcSinCos();
aGeo.RecalcTan();
@@ -2293,18 +2293,18 @@ void SdrPathObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract
SdrTextObj::NbcResize(rRef,xFact,yFact);
}
-void SdrPathObj::NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs)
+void SdrPathObj::NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs)
{
// Thank JOE, the angles are defined mirrored to the mathematical meanings
const basegfx::B2DHomMatrix aTrans(
- basegfx::utils::createRotateAroundPoint(rRef.X(), rRef.Y(), -nAngle * F_PI18000));
+ basegfx::utils::createRotateAroundPoint(rRef.X(), rRef.Y(), -nAngle.get() * F_PI18000));
maPathPolygon.transform(aTrans);
// #i19871# first modify locally, then call parent (to get correct SnapRect with GluePoints)
SdrTextObj::NbcRotate(rRef,nAngle,sn,cs);
}
-void SdrPathObj::NbcShear(const Point& rRefPnt, tools::Long nAngle, double fTan, bool bVShear)
+void SdrPathObj::NbcShear(const Point& rRefPnt, Degree100 nAngle, double fTan, bool bVShear)
{
basegfx::B2DHomMatrix aTrans(basegfx::utils::createTranslateB2DHomMatrix(-rRefPnt.X(), -rRefPnt.Y()));
@@ -2811,14 +2811,14 @@ bool SdrPathObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DP
if(aGeo.nShearAngle || aGeo.nRotationAngle)
{
// get rotate and shear in drawingLayer notation
- fRotate = aGeo.nRotationAngle * F_PI18000;
- fShearX = aGeo.nShearAngle * F_PI18000;
+ fRotate = aGeo.nRotationAngle.get() * F_PI18000;
+ fShearX = aGeo.nShearAngle.get() * F_PI18000;
// build mathematically correct (negative shear and rotate) object transform
// containing shear and rotate to extract unsheared, unrotated polygon
basegfx::B2DHomMatrix aObjectMatrix;
aObjectMatrix.shearX(-aGeo.mfTanShearAngle);
- aObjectMatrix.rotate((36000 - aGeo.nRotationAngle) * F_PI18000);
+ aObjectMatrix.rotate((36000 - aGeo.nRotationAngle.get()) * F_PI18000);
// create inverse from it and back-transform polygon
basegfx::B2DHomMatrix aInvObjectMatrix(aObjectMatrix);
@@ -2901,9 +2901,9 @@ void SdrPathObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b
basegfx::B2DPolyPolygon aNewPolyPolygon(rPolyPolygon);
// reset object shear and rotations
- aGeo.nRotationAngle = 0;
+ aGeo.nRotationAngle = 0_deg100;
aGeo.RecalcSinCos();
- aGeo.nShearAngle = 0;
+ aGeo.nShearAngle = 0_deg100;
aGeo.RecalcTan();
if( getSdrModelFromSdrObject().IsWriter() )
@@ -2949,7 +2949,7 @@ void SdrPathObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b
if(!basegfx::fTools::equalZero(fShearX))
{
aTransform.shearX(tan(-atan(fShearX)));
- aGeo.nShearAngle = FRound(atan(fShearX) / F_PI18000);
+ aGeo.nShearAngle = Degree100(FRound(atan(fShearX) / F_PI18000));
aGeo.RecalcTan();
}
@@ -2963,7 +2963,7 @@ void SdrPathObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b
// #i78696#
// fRotate is mathematically correct, but aGeoStat.nRotationAngle is
// mirrored -> mirror value here
- aGeo.nRotationAngle = NormAngle36000(FRound(-fRotate / F_PI18000));
+ aGeo.nRotationAngle = NormAngle36000(Degree100(FRound(-fRotate / F_PI18000)));
aGeo.RecalcSinCos();
}
diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx
index 7491f6c85c91..111dd2b35086 100644
--- a/svx/source/svdraw/svdorect.cxx
+++ b/svx/source/svdraw/svdorect.cxx
@@ -115,8 +115,8 @@ XPolygon SdrRectObj::ImpCalcXPoly(const tools::Rectangle& rRect1, tools::Long nR
aXPoly=aNewPoly;
// these angles always relate to the top left corner of aRect
- if (aGeo.nShearAngle!=0) ShearXPoly(aXPoly,maRect.TopLeft(),aGeo.mfTanShearAngle);
- if (aGeo.nRotationAngle!=0) RotateXPoly(aXPoly,maRect.TopLeft(),aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
+ if (aGeo.nShearAngle) ShearXPoly(aXPoly,maRect.TopLeft(),aGeo.mfTanShearAngle);
+ if (aGeo.nRotationAngle) RotateXPoly(aXPoly,maRect.TopLeft(),aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
return aXPoly;
}
@@ -138,7 +138,7 @@ const XPolygon& SdrRectObj::GetXPoly() const
void SdrRectObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
{
bool bNoTextFrame=!IsTextFrame();
- rInfo.bResizeFreeAllowed=bNoTextFrame || aGeo.nRotationAngle%9000==0;
+ rInfo.bResizeFreeAllowed=bNoTextFrame || ((aGeo.nRotationAngle.get() % 9000) == 0);
rInfo.bResizePropAllowed=true;
rInfo.bRotateFreeAllowed=true;
rInfo.bRotate90Allowed =true;
@@ -170,11 +170,11 @@ SdrObjKind SdrRectObj::GetObjIdentifier() const
void SdrRectObj::TakeUnrotatedSnapRect(tools::Rectangle& rRect) const
{
rRect = maRect;
- if (aGeo.nShearAngle==0)
+ if (aGeo.nShearAngle==0_deg100)
return;
tools::Long nDst=FRound((maRect.Bottom()-maRect.Top())*aGeo.mfTanShearAngle);
- if (aGeo.nShearAngle>0)
+ if (aGeo.nShearAngle>0_deg100)
{
Point aRef(rRect.TopLeft());
rRect.AdjustLeft( -nDst );
@@ -200,7 +200,7 @@ OUString SdrRectObj::TakeObjNameSingul() const
bool bRounded = GetEckenradius() != 0; // rounded down
const char* pResId = bRounded ? STR_ObjNameSingulRECTRND : STR_ObjNameSingulRECT;
- if (aGeo.nShearAngle!=0)
+ if (aGeo.nShearAngle)
{
pResId = bRounded ? STR_ObjNameSingulPARALRND : STR_ObjNameSingulPARAL; // parallelogram or, maybe, rhombus
}
@@ -231,7 +231,7 @@ OUString SdrRectObj::TakeObjNamePlural() const
bool bRounded = GetEckenradius() != 0; // rounded down
const char* pResId = bRounded ? STR_ObjNamePluralRECTRND : STR_ObjNamePluralRECT;
- if (aGeo.nShearAngle!=0)
+ if (aGeo.nShearAngle)
{
pResId = bRounded ? STR_ObjNamePluralPARALRND : STR_ObjNamePluralPARAL; // parallelogram or rhombus
}
@@ -273,7 +273,7 @@ basegfx::B2DPolyPolygon SdrRectObj::TakeXorPoly() const
void SdrRectObj::RecalcSnapRect()
{
tools::Long nEckRad=GetEckenradius();
- if ((aGeo.nRotationAngle!=0 || aGeo.nShearAngle!=0) && nEckRad!=0) {
+ if ((aGeo.nRotationAngle || aGeo.nShearAngle) && nEckRad!=0) {
maSnapRect=GetXPoly().GetBoundRect();
} else {
SdrTextObj::RecalcSnapRect();
@@ -470,13 +470,13 @@ void SdrRectObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract
SetXPolyDirty();
}
-void SdrRectObj::NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs)
+void SdrRectObj::NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs)
{
SdrTextObj::NbcRotate(rRef,nAngle,sn,cs);
SetXPolyDirty();
}
-void SdrRectObj::NbcShear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear)
+void SdrRectObj::NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear)
{
SdrTextObj::NbcShear(rRef,nAngle,tn,bVShear);
SetXPolyDirty();
@@ -506,8 +506,8 @@ SdrGluePoint SdrRectObj::GetVertexGluePoint(sal_uInt16 nPosNum) const
case 2: aPt=maRect.BottomCenter(); aPt.AdjustY(nWdt ); break;
case 3: aPt=maRect.LeftCenter(); aPt.AdjustX( -nWdt ); break;
}
- if (aGeo.nShearAngle!=0) ShearPoint(aPt,maRect.TopLeft(),aGeo.mfTanShearAngle);
- if (aGeo.nRotationAngle!=0) RotatePoint(aPt,maRect.TopLeft(),aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
+ if (aGeo.nShearAngle) ShearPoint(aPt,maRect.TopLeft(),aGeo.mfTanShearAngle);
+ if (aGeo.nRotationAngle) RotatePoint(aPt,maRect.TopLeft(),aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
aPt-=GetSnapRect().Center();
SdrGluePoint aGP(aPt);
aGP.SetPercent(false);
@@ -532,8 +532,8 @@ SdrGluePoint SdrRectObj::GetCornerGluePoint(sal_uInt16 nPosNum) const
case 2: aPt=maRect.BottomRight(); aPt.AdjustX(nWdt ); aPt.AdjustY(nWdt ); break;
case 3: aPt=maRect.BottomLeft(); aPt.AdjustX( -nWdt ); aPt.AdjustY(nWdt ); break;
}
- if (aGeo.nShearAngle!=0) ShearPoint(aPt,maRect.TopLeft(),aGeo.mfTanShearAngle);
- if (aGeo.nRotationAngle!=0) RotatePoint(aPt,maRect.TopLeft(),aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
+ if (aGeo.nShearAngle) ShearPoint(aPt,maRect.TopLeft(),aGeo.mfTanShearAngle);
+ if (aGeo.nRotationAngle) RotatePoint(aPt,maRect.TopLeft(),aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
aPt-=GetSnapRect().Center();
SdrGluePoint aGP(aPt);
aGP.SetPercent(false);
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 710e81d6bfee..7ffc95af16c4 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -382,8 +382,8 @@ void SdrTextObj::ImpJustifyRect(tools::Rectangle& rRect)
void SdrTextObj::ImpCheckShear()
{
- if (bNoShear && aGeo.nShearAngle!=0) {
- aGeo.nShearAngle=0;
+ if (bNoShear && aGeo.nShearAngle) {
+ aGeo.nShearAngle=0_deg100;
aGeo.mfTanShearAngle=0;
}
}
@@ -391,7 +391,7 @@ void SdrTextObj::ImpCheckShear()
void SdrTextObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
{
bool bNoTextFrame=!IsTextFrame();
- rInfo.bResizeFreeAllowed=bNoTextFrame || aGeo.nRotationAngle%9000==0;
+ rInfo.bResizeFreeAllowed=bNoTextFrame || ((aGeo.nRotationAngle.get() % 9000) == 0);
rInfo.bResizePropAllowed=true;
rInfo.bRotateFreeAllowed=true;
rInfo.bRotate90Allowed =true;
@@ -531,7 +531,7 @@ void SdrTextObj::ImpSetContourPolygon( SdrOutliner& rOutliner, tools::Rectangle
if(aGeo.nRotationAngle)
{
// Unrotate!
- aMatrix.rotate(-aGeo.nRotationAngle * F_PI18000);
+ aMatrix.rotate(-aGeo.nRotationAngle.get() * F_PI18000);
}
aXorPolyPolygon.transform(aMatrix);
@@ -609,7 +609,7 @@ void SdrTextObj::TakeTextAnchorRect(tools::Rectangle& rAnchorRect) const
if (aAnkRect.GetWidth()<2) aAnkRect.SetRight(aAnkRect.Left()+1 ); // minimum size h and v: 2 px
if (aAnkRect.GetHeight()<2) aAnkRect.SetBottom(aAnkRect.Top()+1 );
}
- if (aGeo.nRotationAngle!=0) {
+ if (aGeo.nRotationAngle) {
Point aTmpPt(aAnkRect.TopLeft());
RotatePoint(aTmpPt,aRotateRef,aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
aTmpPt-=aAnkRect.TopLeft();
@@ -776,7 +776,7 @@ void SdrTextObj::TakeTextRect( SdrOutliner& rOutliner, tools::Rectangle& rTextRe
if (eVAdj==SDRTEXTVERTADJUST_BOTTOM)
aTextPos.AdjustY(nFreeHgt );
}
- if (aGeo.nRotationAngle!=0)
+ if (aGeo.nRotationAngle)
RotatePoint(aTextPos,aAnkRect.TopLeft(),aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
if (pAnchorRect)
@@ -1053,8 +1053,8 @@ SdrTextObj& SdrTextObj::operator=(const SdrTextObj& rObj)
basegfx::B2DPolyPolygon SdrTextObj::TakeXorPoly() const
{
tools::Polygon aPol(maRect);
- if (aGeo.nShearAngle!=0) ShearPoly(aPol,maRect.TopLeft(),aGeo.mfTanShearAngle);
- if (aGeo.nRotationAngle!=0) RotatePoly(aPol,maRect.TopLeft(),aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
+ if (aGeo.nShearAngle) ShearPoly(aPol,maRect.TopLeft(),aGeo.mfTanShearAngle);
+ if (aGeo.nRotationAngle) RotatePoly(aPol,maRect.TopLeft(),aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
basegfx::B2DPolyPolygon aRetval;
aRetval.append(aPol.getB2DPolygon());
@@ -1080,7 +1080,7 @@ basegfx::B2DPolyPolygon SdrTextObj::TakeContour() const
bool bFitToSize(IsFitToSize());
if (bFitToSize) aR=aAnchor2;
tools::Polygon aPol(aR);
- if (aGeo.nRotationAngle!=0) RotatePoly(aPol,aR.TopLeft(),aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
+ if (aGeo.nRotationAngle) RotatePoly(aPol,aR.TopLeft(),aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
aRetval.append(aPol.getB2DPolygon());
}
@@ -1090,11 +1090,11 @@ basegfx::B2DPolyPolygon SdrTextObj::TakeContour() const
void SdrTextObj::RecalcSnapRect()
{
- if (aGeo.nRotationAngle!=0 || aGeo.nShearAngle!=0)
+ if (aGeo.nRotationAngle || aGeo.nShearAngle)
{
tools::Polygon aPol(maRect);
- if (aGeo.nShearAngle!=0) ShearPoly(aPol,maRect.TopLeft(),aGeo.mfTanShearAngle);
- if (aGeo.nRotationAngle!=0) RotatePoly(aPol,maRect.TopLeft(),aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
+ if (aGeo.nShearAngle) ShearPoly(aPol,maRect.TopLeft(),aGeo.mfTanShearAngle);
+ if (aGeo.nRotationAngle) RotatePoly(aPol,maRect.TopLeft(),aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
maSnapRect=aPol.GetBoundRect();
} else {
maSnapRect = maRect;
@@ -1116,8 +1116,8 @@ Point SdrTextObj::GetSnapPoint(sal_uInt32 i) const
case 3: aP=maRect.BottomRight(); break;
default: aP=maRect.Center(); break;
}
- if (aGeo.nShearAngle!=0) ShearPoint(aP,maRect.TopLeft(),aGeo.mfTanShearAngle);
- if (aGeo.nRotationAngle!=0) RotatePoint(aP,maRect.TopLeft(),aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
+ if (aGeo.nShearAngle) ShearPoint(aP,maRect.TopLeft(),aGeo.mfTanShearAngle);
+ if (aGeo.nRotationAngle) RotatePoint(aP,maRect.TopLeft(),aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
return aP;
}
@@ -1585,8 +1585,8 @@ void SdrTextObj::SetVerticalWriting(bool bVertical)
bool SdrTextObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& /*rPolyPolygon*/) const
{
// get turn and shear
- double fRotate = basegfx::deg2rad(aGeo.nRotationAngle / 100.0);
- double fShearX = basegfx::deg2rad(aGeo.nShearAngle / 100.0);
+ double fRotate = basegfx::deg2rad(aGeo.nRotationAngle.get() / 100.0);
+ double fShearX = basegfx::deg2rad(aGeo.nShearAngle.get() / 100.0);
// get aRect, this is the unrotated snaprect
tools::Rectangle aRectangle(maRect);
@@ -1639,9 +1639,9 @@ void SdrTextObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b
}
// reset object shear and rotations
- aGeo.nRotationAngle = 0;
+ aGeo.nRotationAngle = 0_deg100;
aGeo.RecalcSinCos();
- aGeo.nShearAngle = 0;
+ aGeo.nShearAngle = 0_deg100;
aGeo.RecalcTan();
// if anchor is used, make position relative to it
@@ -1672,7 +1672,7 @@ void SdrTextObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b
if(!basegfx::fTools::equalZero(fShearX))
{
GeoStat aGeoStat;
- aGeoStat.nShearAngle = FRound(basegfx::rad2deg(atan(fShearX)) * 100.0);
+ aGeoStat.nShearAngle = Degree100(FRound(basegfx::rad2deg(atan(fShearX)) * 100.0));
aGeoStat.RecalcTan();
Shear(Point(), aGeoStat.nShearAngle, aGeoStat.mfTanShearAngle, false);
}
@@ -1685,7 +1685,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(FRound(-fRotate / F_PI18000));
+ aGeoStat.nRotationAngle = NormAngle36000(Degree100(FRound(-fRotate / F_PI18000)));
aGeoStat.RecalcSinCos();
Rotate(Point(), aGeoStat.nRotationAngle, aGeoStat.mfSinRotationAngle, aGeoStat.mfCosRotationAngle);
}
@@ -1792,8 +1792,8 @@ GDIMetaFile* SdrTextObj::GetTextScrollMetaFileAndRectangle(
// get outliner set up. To avoid getting a somehow rotated MetaFile,
// temporarily disable object rotation.
- sal_Int32 nAngle(aGeo.nRotationAngle);
- aGeo.nRotationAngle = 0;
+ Degree100 nAngle(aGeo.nRotationAngle);
+ aGeo.nRotationAngle = 0_deg100;
ImpSetupDrawOutlinerForPaint( bContourFrame, rOutliner, aTextRect, aAnchorRect, aPaintRect, aFitXCorrection );
aGeo.nRotationAngle = nAngle;
diff --git a/svx/source/svdraw/svdotxdr.cxx b/svx/source/svdraw/svdotxdr.cxx
index b7a7f54b76a3..e4727eb385ef 100644
--- a/svx/source/svdraw/svdotxdr.cxx
+++ b/svx/source/svdraw/svdotxdr.cxx
@@ -54,8 +54,8 @@ void SdrTextObj::AddToHdlList(SdrHdlList& rHdlList) const
case 6: aPnt=maRect.BottomCenter(); eKind=SdrHdlKind::Lower; break;
case 7: aPnt=maRect.BottomRight(); eKind=SdrHdlKind::LowerRight; break;
}
- if (aGeo.nShearAngle!=0) ShearPoint(aPnt,maRect.TopLeft(),aGeo.mfTanShearAngle);
- if (aGeo.nRotationAngle!=0) RotatePoint(aPnt,maRect.TopLeft(),aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
+ if (aGeo.nShearAngle) ShearPoint(aPnt,maRect.TopLeft(),aGeo.mfTanShearAngle);
+ if (aGeo.nRotationAngle) RotatePoint(aPnt,maRect.TopLeft(),aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
std::unique_ptr<SdrHdl> pH(new SdrHdl(aPnt,eKind));
pH->SetObj(const_cast<SdrTextObj*>(this));
pH->SetRotationAngle(aGeo.nRotationAngle);
@@ -79,9 +79,9 @@ tools::Rectangle SdrTextObj::ImpDragCalcRect(const SdrDragStat& rDrag) const
bool bBigOrtho=bEcke && bOrtho && rDrag.GetView()->IsBigOrtho();
Point aPos(rDrag.GetNow());
// Unrotate:
- if (aGeo.nRotationAngle!=0) RotatePoint(aPos,aTmpRect.TopLeft(),-aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
+ if (aGeo.nRotationAngle) RotatePoint(aPos,aTmpRect.TopLeft(),-aGeo.mfSinRotationAngle,aGeo.mfCosRotationAngle);
// Unshear:
- if (aGeo.nShearAngle!=0) ShearPoint(aPos,aTmpRect.TopLeft(),-aGeo.mfTanShearAngle);
+ if (aGeo.nShearAngle) ShearPoint(aPos,aTmpRect.TopLeft(),-aGeo.mfTanShearAngle);
bool bLft=(eHdl==SdrHdlKind::UpperLeft || eHdl==SdrHdlKind::Left || eHdl==SdrHdlKind::LowerLeft);
bool bRgt=(eHdl==SdrHdlKind::UpperRight || eHdl==SdrHdlKind::Right || eHdl==SdrHdlKind::LowerRight);
diff --git a/svx/source/svdraw/svdotxed.cxx b/svx/source/svdraw/svdotxed.cxx
index 96341a007d5b..f332bf524db3 100644
--- a/svx/source/svdraw/svdotxed.cxx
+++ b/svx/source/svdraw/svdotxed.cxx
@@ -134,7 +134,7 @@ void SdrTextObj::TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, tools::Recta
Size aPaperMin,aPaperMax;
tools::Rectangle aViewInit;
TakeTextAnchorRect(aViewInit);
- if (aGeo.nRotationAngle!=0) {
+ if (aGeo.nRotationAngle) {
Point aCenter(aViewInit.Center());
aCenter-=aViewInit.TopLeft();
Point aCenter0(aCenter);
diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx
index ce2ae53ffc8a..906ed2bfbfb8 100644
--- a/svx/source/svdraw/svdotxtr.cxx
+++ b/svx/source/svdraw/svdotxtr.cxx
@@ -41,7 +41,7 @@ using namespace com::sun::star;
void SdrTextObj::NbcSetSnapRect(const tools::Rectangle& rRect)
{
- if (aGeo.nRotationAngle!=0 || aGeo.nShearAngle!=0)
+ if (aGeo.nRotationAngle || aGeo.nShearAngle)
{
// Either the rotation or shear angle exists.
tools::Rectangle aSR0(GetSnapRect());
@@ -81,12 +81,12 @@ void SdrTextObj::NbcSetLogicRect(const tools::Rectangle& rRect)
SetRectsDirty();
}
-tools::Long SdrTextObj::GetRotateAngle() const
+Degree100 SdrTextObj::GetRotateAngle() const
{
return aGeo.nRotationAngle;
}
-tools::Long SdrTextObj::GetShearAngle(bool /*bVertical*/) const
+Degree100 SdrTextObj::GetShearAngle(bool /*bVertical*/) const
{
return aGeo.nShearAngle;
}
@@ -101,8 +101,8 @@ void SdrTextObj::NbcMove(const Size& rSiz)
void SdrTextObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
{
- bool bNotSheared=aGeo.nShearAngle==0;
- bool bRotate90=bNotSheared && aGeo.nRotationAngle % 9000 ==0;
+ bool bNotSheared=aGeo.nShearAngle==0_deg100;
+ bool bRotate90=bNotSheared && aGeo.nRotationAngle.get() % 9000 ==0;
bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
if (bXMirr || bYMirr) {
@@ -119,12 +119,12 @@ void SdrTextObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract
}
}
- if (aGeo.nRotationAngle==0 && aGeo.nShearAngle==0) {
+ if (aGeo.nRotationAngle==0_deg100 && aGeo.nShearAngle==0_deg100) {
ResizeRect(maRect,rRef,xFact,yFact);
if (bYMirr) {
maRect.Justify();
maRect.Move(maRect.Right()-maRect.Left(),maRect.Bottom()-maRect.Top());
- aGeo.nRotationAngle=18000;
+ aGeo.nRotationAngle=18000_deg100;
aGeo.RecalcSinCos();
}
}
@@ -153,19 +153,19 @@ void SdrTextObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract
}
if (bRotate90) {
- bool bRota90=aGeo.nRotationAngle % 9000 ==0;
+ bool bRota90=aGeo.nRotationAngle.get() % 9000 ==0;
if (!bRota90) { // there's seems to be a rounding error occurring: correct it
- tools::Long a=NormAngle36000(aGeo.nRotationAngle);
- if (a<4500) a=0;
- else if (a<13500) a=9000;
- else if (a<22500) a=18000;
- else if (a<31500) a=27000;
- else a=0;
+ Degree100 a=NormAngle36000(aGeo.nRotationAngle);
+ if (a<4500_deg100) a=0_deg100;
+ else if (a<13500_deg100) a=9000_deg100;
+ else if (a<22500_deg100) a=18000_deg100;
+ else if (a<31500_deg100) a=27000_deg100;
+ else a=0_deg100;
aGeo.nRotationAngle=a;
aGeo.RecalcSinCos();
}
- if (bNotSheared!=(aGeo.nShearAngle==0)) { // correct a rounding error occurring with Shear
- aGeo.nShearAngle=0;
+ if (bNotSheared!=(aGeo.nShearAngle==0_deg100)) { // correct a rounding error occurring with Shear
+ aGeo.nShearAngle=0_deg100;
aGeo.RecalcTan();
}
}
@@ -183,7 +183,7 @@ void SdrTextObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract
SetRectsDirty();
}
-void SdrTextObj::NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs)
+void SdrTextObj::NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs)
{
SetGlueReallyAbsolute(true);
tools::Long dx=maRect.Right()-maRect.Left();
@@ -194,7 +194,7 @@ void SdrTextObj::NbcRotate(const Point& rRef, tools::Long nAngle, double sn, dou
maRect.SetTop(aP.Y() );
maRect.SetRight(maRect.Left()+dx );
maRect.SetBottom(maRect.Top()+dy );
- if (aGeo.nRotationAngle==0) {
+ if (aGeo.nRotationAngle==0_deg100) {
aGeo.nRotationAngle=NormAngle36000(nAngle);
aGeo.mfSinRotationAngle=sn;
aGeo.mfCosRotationAngle=cs;
@@ -207,7 +207,7 @@ void SdrTextObj::NbcRotate(const Point& rRef, tools::Long nAngle, double sn, dou
SetGlueReallyAbsolute(false);
}
-void SdrTextObj::NbcShear(const Point& rRef, tools::Long /*nAngle*/, double tn, bool bVShear)
+void SdrTextObj::NbcShear(const Point& rRef, Degree100 /*nAngle*/, double tn, bool bVShear)
{
SetGlueReallyAbsolute(true);
@@ -232,12 +232,12 @@ void SdrTextObj::NbcShear(const Point& rRef, tools::Long /*nAngle*/, double tn,
void SdrTextObj::NbcMirror(const Point& rRef1, const Point& rRef2)
{
SetGlueReallyAbsolute(true);
- bool bNotSheared=aGeo.nShearAngle==0;
+ bool bNotSheared=aGeo.nShearAngle==0_deg100;
bool bRotate90 = false;
if (bNotSheared &&
(rRef1.X()==rRef2.X() || rRef1.Y()==rRef2.Y() ||
std::abs(rRef1.X()-rRef2.X())==std::abs(rRef1.Y()-rRef2.Y()))) {
- bRotate90=aGeo.nRotationAngle % 9000 ==0;
+ bRotate90=aGeo.nRotationAngle.get() % 9000 ==0;
}
tools::Polygon aPol(Rect2Poly(maRect,aGeo));
sal_uInt16 i;
@@ -255,20 +255,20 @@ void SdrTextObj::NbcMirror(const Point& rRef1, const Point& rRef2)
Poly2Rect(aPol,maRect,aGeo);
if (bRotate90) {
- bool bRota90=aGeo.nRotationAngle % 9000 ==0;
+ bool bRota90=aGeo.nRotationAngle.get() % 9000 ==0;
if (bRotate90 && !bRota90) { // there's seems to be a rounding error occurring: correct it
- tools::Long a=NormAngle36000(aGeo.nRotationAngle);
- if (a<4500) a=0;
- else if (a<13500) a=9000;
- else if (a<22500) a=18000;
- else if (a<31500) a=27000;
- else a=0;
+ Degree100 a=NormAngle36000(aGeo.nRotationAngle);
+ if (a<4500_deg100) a=0_deg100;
+ else if (a<13500_deg100) a=9000_deg100;
+ else if (a<22500_deg100) a=18000_deg100;
+ else if (a<31500_deg100) a=27000_deg100;
+ else a=0_deg100;
aGeo.nRotationAngle=a;
aGeo.RecalcSinCos();
}
}
- if (bNotSheared!=(aGeo.nShearAngle==0)) { // correct a rounding error occurring with Shear
- aGeo.nShearAngle=0;
+ if (bNotSheared!=(aGeo.nShearAngle==0_deg100)) { // correct a rounding error occurring with Shear
+ aGeo.nShearAngle=0_deg100;
aGeo.RecalcTan();
}
diff --git a/svx/source/svdraw/svdouno.cxx b/svx/source/svdraw/svdouno.cxx
index b4203689f5a5..d6800e2e5b83 100644
--- a/svx/source/svdraw/svdouno.cxx
+++ b/svx/source/svdraw/svdouno.cxx
@@ -297,17 +297,17 @@ void SdrUnoObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fracti
{
SdrRectObj::NbcResize(rRef,xFact,yFact);
- if (aGeo.nShearAngle==0 && aGeo.nRotationAngle==0)
+ if (aGeo.nShearAngle==0_deg100 && aGeo.nRotationAngle==0_deg100)
return;
// small correctors
- if (aGeo.nRotationAngle>=9000 && aGeo.nRotationAngle<27000)
+ if (aGeo.nRotationAngle>=9000_deg100 && aGeo.nRotationAngle<27000_deg100)
{
maRect.Move(maRect.Left()-maRect.Right(),maRect.Top()-maRect.Bottom());
}
- aGeo.nRotationAngle = 0;
- aGeo.nShearAngle = 0;
+ aGeo.nRotationAngle = 0_deg100;
+ aGeo.nShearAngle = 0_deg100;
aGeo.mfSinRotationAngle = 0.0;
aGeo.mfCosRotationAngle = 1.0;
aGeo.mfTanShearAngle = 0.0;
diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx
index 9a1957c628f4..ebd37b988cfa 100644
--- a/svx/source/svdraw/svdovirt.cxx
+++ b/svx/source/svdraw/svdovirt.cxx
@@ -305,7 +305,7 @@ void SdrVirtObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract
SetRectsDirty();
}
-void SdrVirtObj::NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs)
+void SdrVirtObj::NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs)
{
rRefObj.NbcRotate(rRef-aAnchor,nAngle,sn,cs);
SetRectsDirty();
@@ -317,7 +317,7 @@ void SdrVirtObj::NbcMirror(const Point& rRef1, const Point& rRef2)
SetRectsDirty();
}
-void SdrVirtObj::NbcShear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear)
+void SdrVirtObj::NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear)
{
rRefObj.NbcShear(rRef-aAnchor,nAngle,tn,bVShear);
SetRectsDirty();
@@ -345,9 +345,9 @@ void SdrVirtObj::Resize(const Point& rRef, const Fraction& xFact, const Fraction
}
}
-void SdrVirtObj::Rotate(const Point& rRef, tools::Long nAngle, double sn, double cs)
+void SdrVirtObj::Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs)
{
- if (nAngle!=0) {
+ if (nAngle) {
tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
rRefObj.Rotate(rRef-aAnchor,nAngle,sn,cs);
SetRectsDirty();
@@ -363,9 +363,9 @@ void SdrVirtObj::Mirror(const Point& rRef1, const Point& rRef2)
SendUserCall(SdrUserCallType::Resize,aBoundRect0);
}
-void SdrVirtObj::Shear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear)
+void SdrVirtObj::Shear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear)
{
- if (nAngle!=0) {
+ if (nAngle) {
tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
rRefObj.Shear(rRef-aAnchor,nAngle,tn,bVShear);
SetRectsDirty();
@@ -432,12 +432,12 @@ void SdrVirtObj::NbcSetLogicRect(const tools::Rectangle& rRect)
}
-tools::Long SdrVirtObj::GetRotateAngle() const
+Degree100 SdrVirtObj::GetRotateAngle() const
{
return rRefObj.GetRotateAngle();
}
-tools::Long SdrVirtObj::GetShearAngle(bool bVertical) const
+Degree100 SdrVirtObj::GetShearAngle(bool bVertical) const
{
return rRefObj.GetShearAngle(bVertical);
}
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index f9115175ce39..847d75250739 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -841,12 +841,9 @@ void ImpSdrPdfImport::InsertTextObject(const Point& rPos, const Size& rSize, con
aAttr.Put(XFillColorItem(OUString(), aFont.GetFillColor()));
pText->SetMergedItemSet(aAttr);
}
- sal_uInt32 nAngle = aFont.GetOrientation().get();
+ Degree100 nAngle = toDegree100(aFont.GetOrientation());
if (nAngle)
- {
- nAngle *= 10;
pText->SdrAttrObj::NbcRotate(aPosition, nAngle);
- }
InsertObj(pText, false);
}
diff --git a/svx/source/svdraw/svdpoev.cxx b/svx/source/svdraw/svdpoev.cxx
index b5329fbd17fc..f6fafcf088d6 100644
--- a/svx/source/svdraw/svdpoev.cxx
+++ b/svx/source/svdraw/svdpoev.cxx
@@ -637,13 +637,13 @@ static void ImpRotate(Point& rPt, Point* pC1, Point* pC2, const void* p1, const
if (pC2!=nullptr) RotatePoint(*pC2,*static_cast<const Point*>(p1),*static_cast<const double*>(p3),*static_cast<const double*>(p4));
}
-void SdrPolyEditView::RotateMarkedPoints(const Point& rRef, tools::Long nAngle)
+void SdrPolyEditView::RotateMarkedPoints(const Point& rRef, Degree100 nAngle)
{
ForceUndirtyMrkPnt();
OUString aStr(SvxResId(STR_EditResize));
BegUndo(aStr,GetDescriptionOfMarkedPoints(),SdrRepeatFunc::Rotate);
- double nSin = sin(nAngle * F_PI18000);
- double nCos = cos(nAngle * F_PI18000);
+ double nSin = sin(nAngle.get() * F_PI18000);
+ double nCos = cos(nAngle.get() * F_PI18000);
ImpTransformMarkedPoints(ImpRotate,&rRef,&nAngle,&nSin,&nCos);
EndUndo();
AdjustMarkHdl();
diff --git a/svx/source/svdraw/svdtrans.cxx b/svx/source/svdraw/svdtrans.cxx
index f3efd09c9f27..17106eec68bd 100644
--- a/svx/source/svdraw/svdtrans.cxx
+++ b/svx/source/svdraw/svdtrans.cxx
@@ -123,11 +123,11 @@ void MirrorPoint(Point& rPnt, const Point& rRef1, const Point& rRef2)
rPnt.setY(rRef1.Y()-dx1 );
} else { // arbitrary axis
// TODO: Optimize this! Raise perpendicular on the mirroring axis..?
- tools::Long nRefWink=GetAngle(rRef2-rRef1);
+ Degree100 nRefWink=GetAngle(rRef2-rRef1);
rPnt-=rRef1;
- tools::Long nPntWink=GetAngle(rPnt);
- tools::Long nAngle=2*(nRefWink-nPntWink);
- double a = nAngle * F_PI18000;
+ Degree100 nPntWink=GetAngle(rPnt);
+ Degree100 nAngle=2_deg100*(nRefWink-nPntWink);
+ double a = nAngle.get() * F_PI18000;
double nSin=sin(a);
double nCos=cos(a);
RotatePoint(rPnt,Point(),nSin,nCos);
@@ -383,42 +383,43 @@ void CrookStretchPoly(XPolyPolygon& rPoly, const Point& rCenter, const Point& rR
}
-tools::Long GetAngle(const Point& rPnt)
+Degree100 GetAngle(const Point& rPnt)
{
- tools::Long a=0;
+ Degree100 a;
if (rPnt.Y()==0) {
- if (rPnt.X()<0) a=-18000;
+ if (rPnt.X()<0) a=-18000_deg100;
} else if (rPnt.X()==0) {
- if (rPnt.Y()>0) a=-9000;
- else a=9000;
+ if (rPnt.Y()>0) a=-9000_deg100;
+ else a=9000_deg100;
} else {
- a = FRound(atan2(static_cast<double>(-rPnt.Y()), static_cast<double>(rPnt.X()))
- / F_PI18000);
+ a = Degree100(FRound(atan2(static_cast<double>(-rPnt.Y()), static_cast<double>(rPnt.X()))
+ / F_PI18000));
}
return a;
}
-tools::Long NormAngle18000(tools::Long a)
+Degree100 NormAngle18000(Degree100 a)
{
- while (a<-18000) a+=36000;
- while (a>=18000) a-=36000;
+ while (a<-18000_deg100) a+=36000_deg100;
+ while (a>=18000_deg100) a-=36000_deg100;
return a;
}
-tools::Long NormAngle36000(tools::Long a)
+Degree100 NormAngle36000(Degree100 deg100)
{
- while (a<0) a+=36000;
- while (a>=36000) a-=36000;
- return a;
+ // do an add because we want -90 to end up as 270
+ int a = 36000 + deg100.get();
+ a %= 36000;
+ a = std::abs(a);
+ return Degree100(a);
}
-sal_uInt16 GetAngleSector(tools::Long nAngle)
+sal_uInt16 GetAngleSector(Degree100 nAngle)
{
- while (nAngle<0) nAngle+=36000;
- while (nAngle>=36000) nAngle-=36000;
- if (nAngle< 9000) return 0;
- if (nAngle<18000) return 1;
- if (nAngle<27000) return 2;
+ nAngle = NormAngle36000(nAngle);
+ if (nAngle< 9000_deg100) return 0;
+ if (nAngle<18000_deg100) return 1;
+ if (nAngle<27000_deg100) return 2;
return 3;
}
@@ -450,11 +451,11 @@ tools::Long GetLen(const Point& rPnt)
void GeoStat::RecalcSinCos()
{
- if (nRotationAngle==0) {
+ if (nRotationAngle==0_deg100) {
mfSinRotationAngle=0.0;
mfCosRotationAngle=1.0;
} else {
- double a = nRotationAngle * F_PI18000;
+ double a = nRotationAngle.get() * F_PI18000;
mfSinRotationAngle=sin(a);
mfCosRotationAngle=cos(a);
}
@@ -462,10 +463,10 @@ void GeoStat::RecalcSinCos()
void GeoStat::RecalcTan()
{
- if (nShearAngle==0) {
+ if (nShearAngle==0_deg100) {
mfTanShearAngle=0.0;
} else {
- double a = nShearAngle * F_PI18000;
+ double a = nShearAngle.get() * F_PI18000;
mfTanShearAngle=tan(a);
}
}
@@ -479,8 +480,8 @@ tools::Polygon Rect2Poly(const tools::Rectangle& rRect, const GeoStat& rGeo)
aPol[2]=rRect.BottomRight();
aPol[3]=rRect.BottomLeft();
aPol[4]=rRect.TopLeft();
- if (rGeo.nShearAngle!=0) ShearPoly(aPol,rRect.TopLeft(),rGeo.mfTanShearAngle);
- if (rGeo.nRotationAngle!=0) RotatePoly(aPol,rRect.TopLeft(),rGeo.mfSinRotationAngle,rGeo.mfCosRotationAngle);
+ if (rGeo.nShearAngle) ShearPoly(aPol,rRect.TopLeft(),rGeo.mfTanShearAngle);
+ if (rGeo.nRotationAngle) RotatePoly(aPol,rRect.TopLeft(),rGeo.mfSinRotationAngle,rGeo.mfCosRotationAngle);
return aPol;
}
@@ -492,28 +493,28 @@ void Poly2Rect(const tools::Polygon& rPol, tools::Rectangle& rRect, GeoStat& rGe
rGeo.RecalcSinCos();
Point aPt1(rPol[1]-rPol[0]);
- if (rGeo.nRotationAngle!=0) RotatePoint(aPt1,Point(0,0),-rGeo.mfSinRotationAngle,rGeo.mfCosRotationAngle); // -Sin to reverse rotation
+ if (rGeo.nRotationAngle) RotatePoint(aPt1,Point(0,0),-rGeo.mfSinRotationAngle,rGeo.mfCosRotationAngle); // -Sin to reverse rotation
tools::Long nWdt=aPt1.X();
Point aPt0(rPol[0]);
Point aPt3(rPol[3]-rPol[0]);
- if (rGeo.nRotationAngle!=0) RotatePoint(aPt3,Point(0,0),-rGeo.mfSinRotationAngle,rGeo.mfCosRotationAngle); // -Sin to reverse rotation
+ if (rGeo.nRotationAngle) RotatePoint(aPt3,Point(0,0),-rGeo.mfSinRotationAngle,rGeo.mfCosRotationAngle); // -Sin to reverse rotation
tools::Long nHgt=aPt3.Y();
- tools::Long nShW=GetAngle(aPt3);
- nShW-=27000; // ShearWink is measured against a vertical line
+ Degree100 nShW=GetAngle(aPt3);
+ nShW-=27000_deg100; // ShearWink is measured against a vertical line
nShW=-nShW; // negating, because '+' is shearing clock-wise
bool bMirr=aPt3.Y()<0;
if (bMirr) { // "exchange of points" when mirroring
nHgt=-nHgt;
- nShW+=18000;
+ nShW+=18000_deg100;
aPt0=rPol[3];
}
nShW=NormAngle18000(nShW);
- if (nShW<-9000 || nShW>9000) {
- nShW=NormAngle18000(nShW+18000);
+ if (nShW<-9000_deg100 || nShW>9000_deg100) {
+ nShW=NormAngle18000(nShW+18000_deg100);
}
if (nShW<-SDRMAXSHEAR) nShW=-SDRMAXSHEAR; // limit ShearWinkel (shear angle) to +/- 89.00 deg
if (nShW>SDRMAXSHEAR) nShW=SDRMAXSHEAR;
diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx
index 9ea6ba050a20..56f68c0f7781 100644
--- a/svx/source/table/viewcontactoftableobj.cxx
+++ b/svx/source/table/viewcontactoftableobj.cxx
@@ -358,7 +358,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) * F_PI18000 : 0.0);
+ const double fRotate(rGeoStat.nRotationAngle ? (36000 - rGeoStat.nRotationAngle.get()) * F_PI18000 : 0.0);
const basegfx::B2DHomMatrix aObjectMatrix(basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate,
aObjectRange.getMinX(), aObjectRange.getMinY()));
@@ -422,7 +422,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) * F_PI18000 : 0.0);
+ const double fRotate(rGeoStat.nRotationAngle ? (36000 - rGeoStat.nRotationAngle.get()) * F_PI18000 : 0.0);
const basegfx::B2DHomMatrix aObjectMatrix(basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate,
aObjectRange.getMinX(), aObjectRange.getMinY()));
diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
index 126e6e02efbf..95c0ee341087 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -694,19 +694,19 @@ void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView )
// #106181# rotate snap rect before setting it
const GeoStat& aGeo = pObj->GetGeoStat();
- if (aGeo.nRotationAngle!=0 || aGeo.nShearAngle!=0)
+ if (aGeo.nRotationAngle || aGeo.nShearAngle)
{
tools::Polygon aPol(aNewRect);
// also transform origin offset
- if (aGeo.nShearAngle!=0)
+ if (aGeo.nShearAngle)
{
ShearPoly(aPol,
aNewRect.TopLeft(),
aGeo.mfTanShearAngle);
ShearPoint(aOffset, Point(0,0), aGeo.mfTanShearAngle);
}
- if (aGeo.nRotationAngle!=0)
+ if (aGeo.nRotationAngle)
{
RotatePoly(aPol,
aNewRect.TopLeft(),
diff --git a/svx/source/uitest/sdrobject.cxx b/svx/source/uitest/sdrobject.cxx
index 0892556791d2..8229a454376f 100644
--- a/svx/source/uitest/sdrobject.cxx
+++ b/svx/source/uitest/sdrobject.cxx
@@ -144,7 +144,7 @@ void SdrUIObject::execute(const OUString& rAction, const StringMap& rParameters)
throw css::uno::RuntimeException("missing parameter ANGLE");
double nAngle = itrAngle->second.toDouble();
- pObj->Rotate(aPos, nAngle, 0, 0);
+ pObj->Rotate(aPos, Degree100(sal_Int32(nAngle)), 0, 0);
}
else if (rAction == "Mirror")
{
@@ -152,7 +152,7 @@ void SdrUIObject::execute(const OUString& rAction, const StringMap& rParameters)
}
else if (rAction == "SHEAR")
{
- pObj->Shear(Point(), 0.0 /*nAngle*/, 0, false);
+ pObj->Shear(Point(), 0_deg100 /*nAngle*/, 0, false);
}
}
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 1715a6dea257..aade016dcf2f 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -1927,8 +1927,8 @@ uno::Any SvxShape::GetAnyForItem( SfxItemSet const & aSet, const SfxItemProperty
const SfxPoolItem* pPoolItem=nullptr;
if(aSet.GetItemState(SDRATTR_CIRCSTARTANGLE,false,&pPoolItem)==SfxItemState::SET)
{
- sal_Int32 nAngle = static_cast<const SdrAngleItem*>(pPoolItem)->GetValue();
- aAny <<= nAngle;
+ Degree100 nAngle = static_cast<const SdrAngleItem*>(pPoolItem)->GetValue();
+ aAny <<= nAngle.get();
}
break;
}
@@ -1938,8 +1938,8 @@ uno::Any SvxShape::GetAnyForItem( SfxItemSet const & aSet, const SfxItemProperty
const SfxPoolItem* pPoolItem=nullptr;
if (aSet.GetItemState(SDRATTR_CIRCENDANGLE,false,&pPoolItem)==SfxItemState::SET)
{
- sal_Int32 nAngle = static_cast<const SdrAngleItem*>(pPoolItem)->GetValue();
- aAny <<= nAngle;
+ Degree100 nAngle = static_cast<const SdrAngleItem*>(pPoolItem)->GetValue();
+ aAny <<= nAngle.get();
}
break;
}
@@ -2353,15 +2353,16 @@ bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertySimpl
}
case SDRATTR_ROTATEANGLE:
{
- sal_Int32 nAngle = 0;
- if( rValue >>= nAngle )
+ sal_Int32 nTmp = 0;
+ if( rValue >>= nTmp )
{
+ Degree100 nAngle(nTmp);
Point aRef1(GetSdrObject()->GetSnapRect().Center());
nAngle -= GetSdrObject()->GetRotateAngle();
- if (nAngle!=0)
+ if (nAngle)
{
- double nSin = sin(nAngle * F_PI18000);
- double nCos = cos(nAngle * F_PI18000);
+ double nSin = sin(nAngle.get() * F_PI18000);
+ double nCos = cos(nAngle.get() * F_PI18000);
GetSdrObject()->Rotate(aRef1,nAngle,nSin,nCos);
}
return true;
@@ -2372,14 +2373,15 @@ bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertySimpl
case SDRATTR_SHEARANGLE:
{
- sal_Int32 nShear = 0;
- if( rValue >>= nShear )
+ sal_Int32 nTmp = 0;
+ if( rValue >>= nTmp )
{
+ Degree100 nShear(nTmp);
nShear -= GetSdrObject()->GetShearAngle();
- if(nShear != 0 )
+ if(nShear)
{
Point aRef1(GetSdrObject()->GetSnapRect().Center());
- double nTan = tan(nShear * F_PI18000);
+ double nTan = tan(nShear.get() * F_PI18000);
GetSdrObject()->Shear(aRef1,nShear,nTan,false);
return true;
}