summaryrefslogtreecommitdiff
path: root/sd
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 /sd
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 'sd')
-rw-r--r--sd/qa/unit/uiimpress.cxx2
-rw-r--r--sd/source/ui/app/optsitem.cxx4
-rw-r--r--sd/source/ui/dlg/copydlg.cxx4
-rw-r--r--sd/source/ui/dlg/tpoption.cxx4
-rw-r--r--sd/source/ui/func/fuconarc.cxx8
-rw-r--r--sd/source/ui/func/fuconcs.cxx2
-rw-r--r--sd/source/ui/func/fucopy.cxx3
-rw-r--r--sd/source/ui/func/fusel.cxx12
-rw-r--r--sd/source/ui/inc/optsitem.hxx1
-rw-r--r--sd/source/ui/view/frmview.cxx8
10 files changed, 25 insertions, 23 deletions
diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index 56165d350009..ce2ca269e56c 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ b/sd/qa/unit/uiimpress.cxx
@@ -122,7 +122,7 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf111522)
// Rotate the shape in window 2 & undo.
pView2->MarkObj(pShape2, pView2->GetSdrPageView());
- pView2->RotateMarkedObj(pShape2->GetLastBoundRect().Center(), /*nAngle=*/45);
+ pView2->RotateMarkedObj(pShape2->GetLastBoundRect().Center(), /*nAngle=*/45_deg100);
// Without the accompanying fix in place, this test would have failed with an assertion failure
// in SdrObjEditView::SdrEndTextEdit() as mpOldTextEditUndoManager was not nullptr.
pViewShell2->GetViewFrame()->GetDispatcher()->Execute(SID_UNDO, SfxCallMode::SYNCHRON);
diff --git a/sd/source/ui/app/optsitem.cxx b/sd/source/ui/app/optsitem.cxx
index 7944bf5c93e6..d70e79c517d6 100644
--- a/sd/source/ui/app/optsitem.cxx
+++ b/sd/source/ui/app/optsitem.cxx
@@ -847,8 +847,8 @@ SdOptionsSnapItem::SdOptionsSnapItem( SdOptions const * pOpts, ::sd::FrameView c
maOptionsSnap.SetBigOrtho( pView->IsBigOrtho() );
maOptionsSnap.SetRotate( pView->IsAngleSnapEnabled() );
maOptionsSnap.SetSnapArea( pView->GetSnapMagneticPixel() );
- maOptionsSnap.SetAngle( Degree10(pView->GetSnapAngle() / 10) );
- maOptionsSnap.SetEliminatePolyPointLimitAngle( Degree10(pView->GetEliminatePolyPointLimitAngle() / 10) );
+ maOptionsSnap.SetAngle( toDegree10(pView->GetSnapAngle()) );
+ maOptionsSnap.SetEliminatePolyPointLimitAngle( toDegree10(pView->GetEliminatePolyPointLimitAngle()) );
}
else if( pOpts )
{
diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx
index e1e26a542767..5de5d71bcd8d 100644
--- a/sd/source/ui/dlg/copydlg.cxx
+++ b/sd/source/ui/dlg/copydlg.cxx
@@ -132,7 +132,7 @@ void CopyDlg::Reset()
SetMetricValue( *m_xMtrFldMoveY, tools::Long(nMoveY / maUIScale), MapUnit::Map100thMM);
if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_ANGLE, true, &pPoolItem ) )
- m_xMtrFldAngle->set_value(static_cast<const SdrAngleItem*>( pPoolItem )->GetValue(), FieldUnit::NONE);
+ m_xMtrFldAngle->set_value(static_cast<const SdrAngleItem*>( pPoolItem )->GetValue().get(), FieldUnit::NONE);
else
m_xMtrFldAngle->set_value(0, FieldUnit::NONE);
@@ -188,7 +188,7 @@ void CopyDlg::GetAttr( SfxItemSet& rOutAttrs )
rOutAttrs.Put( SfxUInt16Item( ATTR_COPY_NUMBER, static_cast<sal_uInt16>(m_xNumFldCopies->get_value()) ) );
rOutAttrs.Put( SfxInt32Item( ATTR_COPY_MOVE_X, nMoveX ) );
rOutAttrs.Put( SfxInt32Item( ATTR_COPY_MOVE_Y, nMoveY ) );
- rOutAttrs.Put( SdrAngleItem( ATTR_COPY_ANGLE, static_cast<sal_Int32>(m_xMtrFldAngle->get_value(FieldUnit::DEGREE)) ) );
+ rOutAttrs.Put( SdrAngleItem( ATTR_COPY_ANGLE, Degree100(static_cast<sal_Int32>(m_xMtrFldAngle->get_value(FieldUnit::DEGREE))) ) );
rOutAttrs.Put( SfxInt32Item( ATTR_COPY_WIDTH, nWidth ) );
rOutAttrs.Put( SfxInt32Item( ATTR_COPY_HEIGHT, nHeight ) );
diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx
index 4c647eaf9ea8..e0d43be48569 100644
--- a/sd/source/ui/dlg/tpoption.cxx
+++ b/sd/source/ui/dlg/tpoption.cxx
@@ -89,8 +89,8 @@ void SdTpOptionsSnap::Reset( const SfxItemSet* rAttrs )
m_xCbxBigOrtho->set_active( aOptsItem.GetOptionsSnap().IsBigOrtho() );
m_xCbxRotate->set_active( aOptsItem.GetOptionsSnap().IsRotate() );
m_xMtrFldSnapArea->set_value(aOptsItem.GetOptionsSnap().GetSnapArea(), FieldUnit::PIXEL);
- m_xMtrFldAngle->set_value(aOptsItem.GetOptionsSnap().GetAngle().get() / 10, FieldUnit::DEGREE);
- m_xMtrFldBezAngle->set_value(aOptsItem.GetOptionsSnap().GetEliminatePolyPointLimitAngle().get() / 10, FieldUnit::DEGREE);
+ m_xMtrFldAngle->set_value(aOptsItem.GetOptionsSnap().GetAngle().get(), FieldUnit::DEGREE);
+ m_xMtrFldBezAngle->set_value(aOptsItem.GetOptionsSnap().GetEliminatePolyPointLimitAngle().get(), FieldUnit::DEGREE);
ClickRotateHdl_Impl(*m_xCbxRotate);
}
diff --git a/sd/source/ui/func/fuconarc.cxx b/sd/source/ui/func/fuconarc.cxx
index 2671f4e2fa76..1ced022927ac 100644
--- a/sd/source/ui/func/fuconarc.cxx
+++ b/sd/source/ui/func/fuconarc.cxx
@@ -94,8 +94,8 @@ void FuConstructArc::DoExecute( SfxRequest& rReq )
mpView->getSdrModelFromSdrView(),
ToSdrCircKind(mpView->GetCurrentObjIdentifier()),
aNewRectangle,
- static_cast<::tools::Long>(pPhiStart->GetValue () * 10.0),
- static_cast<::tools::Long>(pPhiEnd->GetValue () * 10.0));
+ pPhiStart->GetValue(),
+ pPhiEnd->GetValue());
SdrPageView *pPV = mpView->GetSdrPageView();
mpView->InsertObjectAtView(pNewCircle, *pPV, SdrInsertFlags::SETDEFLAYER);
@@ -226,8 +226,8 @@ SdrObjectUniquePtr FuConstructArc::CreateDefaultObject(const sal_uInt16 nID, con
pObj->SetLogicRect(aRect);
SfxItemSet aAttr(mpDoc->GetPool());
- aAttr.Put(makeSdrCircStartAngleItem(9000));
- aAttr.Put(makeSdrCircEndAngleItem(0));
+ aAttr.Put(makeSdrCircStartAngleItem(9000_deg100));
+ aAttr.Put(makeSdrCircEndAngleItem(0_deg100));
if(SID_DRAW_PIE_NOFILL == nID ||
SID_DRAW_CIRCLEPIE_NOFILL == nID ||
diff --git a/sd/source/ui/func/fuconcs.cxx b/sd/source/ui/func/fuconcs.cxx
index 844bd824fc74..d1fcf0f3e36e 100644
--- a/sd/source/ui/func/fuconcs.cxx
+++ b/sd/source/ui/func/fuconcs.cxx
@@ -183,7 +183,7 @@ void FuConstructCustomShape::SetAttributes( SdrObject* pObj )
EE_ITEMS_START, EE_ITEMS_END>{});
aDest.Set( rSource );
pObj->SetMergedItemSet( aDest );
- sal_Int32 nAngle = pSourceObj->GetRotateAngle();
+ Degree100 nAngle = pSourceObj->GetRotateAngle();
if ( nAngle )
pObj->NbcRotate( pObj->GetSnapRect().Center(), nAngle );
bAttributesAppliedFromGallery = true;
diff --git a/sd/source/ui/func/fucopy.cxx b/sd/source/ui/func/fucopy.cxx
index ba50612dce3d..c291e3468349 100644
--- a/sd/source/ui/func/fucopy.cxx
+++ b/sd/source/ui/func/fucopy.cxx
@@ -120,7 +120,8 @@ void FuCopy::DoExecute( SfxRequest& rReq )
}
::tools::Rectangle aRect;
- sal_Int32 lWidth = 0, lHeight = 0, lSizeX = 0, lSizeY = 0, lAngle = 0;
+ sal_Int32 lWidth = 0, lHeight = 0, lSizeX = 0, lSizeY = 0;
+ Degree100 lAngle(0);
sal_uInt16 nNumber = 0;
Color aStartColor, aEndColor;
bool bColor = false;
diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx
index 904696bb063a..fbcd7ada5c53 100644
--- a/sd/source/ui/func/fusel.cxx
+++ b/sd/source/ui/func/fusel.cxx
@@ -169,10 +169,10 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
mpWindow->CaptureMouse();
pHdl = mpView->PickHandle(aMDPos);
- ::tools::Long nAngle0 = GetAngle(aMDPos - mpView->GetRef1());
- nAngle0 -= 27000;
+ Degree100 nAngle0 = GetAngle(aMDPos - mpView->GetRef1());
+ nAngle0 -= 27000_deg100;
nAngle0 = NormAngle36000(nAngle0);
- bMirrorSide0 = nAngle0 < 18000;
+ bMirrorSide0 = nAngle0 < 18000_deg100;
if (!pHdl && mpView->Is3DRotationCreationActive())
{
@@ -742,10 +742,10 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
* If 3D-rotation bodies are about to be created,
* end creation now
**********************************************************/
- ::tools::Long nAngle1 = GetAngle(aPnt - mpView->GetRef1());
- nAngle1 -= 27000;
+ Degree100 nAngle1 = GetAngle(aPnt - mpView->GetRef1());
+ nAngle1 -= 27000_deg100;
nAngle1 = NormAngle36000(nAngle1);
- bool bMirrorSide1 = nAngle1 < 18000;
+ bool bMirrorSide1 = nAngle1 < 18000_deg100;
if (bMirrorSide0 != bMirrorSide1)
{
diff --git a/sd/source/ui/inc/optsitem.hxx b/sd/source/ui/inc/optsitem.hxx
index 2c8350946f9c..2e03490950ff 100644
--- a/sd/source/ui/inc/optsitem.hxx
+++ b/sd/source/ui/inc/optsitem.hxx
@@ -23,6 +23,7 @@
#include <unotools/configitem.hxx>
#include <sfx2/module.hxx>
#include <svx/optgrid.hxx>
+#include <tools/degree.hxx>
#include <sddllapi.h>
#include <memory>
diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx
index 88b04b035a3b..5b873f5aaef6 100644
--- a/sd/source/ui/view/frmview.cxx
+++ b/sd/source/ui/view/frmview.cxx
@@ -280,7 +280,7 @@ void FrameView::Update(SdOptions const * pOptions)
mbRuler = pOptions->IsRulerVisible();
SetGridVisible( pOptions->IsGridVisible() );
- SetSnapAngle( pOptions->GetAngle().get() * 10 ); // convert to hundredths of a degree
+ SetSnapAngle( toDegree100(pOptions->GetAngle()) );
SetGridSnap( pOptions->IsUseGridSnap() );
SetBordSnap( pOptions->IsSnapBorder() );
SetHlplSnap( pOptions->IsSnapHelplines() );
@@ -298,7 +298,7 @@ void FrameView::Update(SdOptions const * pOptions)
SetAngleSnapEnabled( pOptions->IsRotate() );
SetBigOrtho( pOptions->IsBigOrtho() );
SetOrtho( pOptions->IsOrtho() );
- SetEliminatePolyPointLimitAngle( pOptions->GetEliminatePolyPointLimitAngle().get() * 10 ); // convert to degree100
+ SetEliminatePolyPointLimitAngle( toDegree100(pOptions->GetEliminatePolyPointLimitAngle()) );
GetModel()->SetPickThroughTransparentTextFrames( pOptions->IsPickThrough() );
SetSolidDragging( pOptions->IsSolidDragging() );
@@ -770,7 +770,7 @@ void FrameView::ReadUserDataSequence ( const css::uno::Sequence < css::beans::Pr
{
if( rValue.Value >>= nInt32 )
{
- SetEliminatePolyPointLimitAngle( nInt32 );
+ SetEliminatePolyPointLimitAngle( Degree100(nInt32) );
}
}
else if ( rValue.Name == sUNO_View_IsEliminatePolyPoints )
@@ -844,7 +844,7 @@ void FrameView::ReadUserDataSequence ( const css::uno::Sequence < css::beans::Pr
{
if( rValue.Value >>= nInt32 )
{
- SetSnapAngle( nInt32 );
+ SetSnapAngle( Degree100(nInt32) );
}
}
else if ( rValue.Name == sUNO_View_GridSnapWidthXNumerator )