summaryrefslogtreecommitdiff
path: root/svx/source/dialog
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/source/dialog
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/source/dialog')
-rw-r--r--svx/source/dialog/dialcontrol.cxx23
-rw-r--r--svx/source/dialog/imapwnd.cxx8
2 files changed, 15 insertions, 16 deletions
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
{