From ceba98a4f7712cf015d27370ef00df003b4955d2 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sun, 3 Jan 2021 09:50:29 +0200 Subject: tdf#139380 tdf#139379 Constrain object when rotating angle is off by factor 100 regression from commit cf5715da45ddce8b667f1b999d41c4e6e7e65659 Date: Wed Dec 23 09:57:24 2020 +0200 use Degree10 in SdOptionsSnap and fix some conversions Change-Id: Ib0bceda9ab13ebd2ad40b7442632af18a1cd1cc4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108607 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sd/source/ui/app/optsitem.cxx | 8 ++++---- sd/source/ui/dlg/tpoption.cxx | 8 ++++---- sd/source/ui/inc/optsitem.hxx | 12 ++++++------ sd/source/ui/view/frmview.cxx | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/sd/source/ui/app/optsitem.cxx b/sd/source/ui/app/optsitem.cxx index d70e79c517d6..a9fcbc511f79 100644 --- a/sd/source/ui/app/optsitem.cxx +++ b/sd/source/ui/app/optsitem.cxx @@ -799,8 +799,8 @@ bool SdOptionsSnap::ReadData( const Any* pValues ) if( pValues[5].hasValue() ) SetBigOrtho( *o3tl::doAccess(pValues[ 5 ]) ); if( pValues[6].hasValue() ) SetRotate( *o3tl::doAccess(pValues[ 6 ]) ); if( pValues[7].hasValue() ) SetSnapArea( static_cast(*o3tl::doAccess(pValues[ 7 ])) ); - if( pValues[8].hasValue() ) SetAngle( Degree10(*o3tl::doAccess(pValues[ 8 ])) ); - if( pValues[9].hasValue() ) SetEliminatePolyPointLimitAngle( Degree10(*o3tl::doAccess(pValues[ 9 ])) ); + if( pValues[8].hasValue() ) SetAngle( Degree100(*o3tl::doAccess(pValues[ 8 ])) ); + if( pValues[9].hasValue() ) SetEliminatePolyPointLimitAngle( Degree100(*o3tl::doAccess(pValues[ 9 ])) ); return true; } @@ -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( toDegree10(pView->GetSnapAngle()) ); - maOptionsSnap.SetEliminatePolyPointLimitAngle( toDegree10(pView->GetEliminatePolyPointLimitAngle()) ); + maOptionsSnap.SetAngle( pView->GetSnapAngle() ); + maOptionsSnap.SetEliminatePolyPointLimitAngle( pView->GetEliminatePolyPointLimitAngle() ); } else if( pOpts ) { diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx index e0d43be48569..d57870b171e6 100644 --- a/sd/source/ui/dlg/tpoption.cxx +++ b/sd/source/ui/dlg/tpoption.cxx @@ -64,8 +64,8 @@ bool SdTpOptionsSnap::FillItemSet( SfxItemSet* rAttrs ) aOptsItem.GetOptionsSnap().SetBigOrtho( m_xCbxBigOrtho->get_active() ); aOptsItem.GetOptionsSnap().SetRotate( m_xCbxRotate->get_active() ); aOptsItem.GetOptionsSnap().SetSnapArea(static_cast(m_xMtrFldSnapArea->get_value(FieldUnit::PIXEL))); - aOptsItem.GetOptionsSnap().SetAngle(Degree10(m_xMtrFldAngle->get_value(FieldUnit::DEGREE) * 10)); - aOptsItem.GetOptionsSnap().SetEliminatePolyPointLimitAngle(Degree10(m_xMtrFldBezAngle->get_value(FieldUnit::DEGREE) * 10)); + aOptsItem.GetOptionsSnap().SetAngle(Degree100(m_xMtrFldAngle->get_value(FieldUnit::DEGREE))); + aOptsItem.GetOptionsSnap().SetEliminatePolyPointLimitAngle(Degree100(m_xMtrFldBezAngle->get_value(FieldUnit::DEGREE))); rAttrs->Put( aOptsItem ); @@ -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(), FieldUnit::DEGREE); - m_xMtrFldBezAngle->set_value(aOptsItem.GetOptionsSnap().GetEliminatePolyPointLimitAngle().get(), FieldUnit::DEGREE); + m_xMtrFldAngle->set_value(aOptsItem.GetOptionsSnap().GetAngle().get() / 10, FieldUnit::DEGREE); + m_xMtrFldBezAngle->set_value(aOptsItem.GetOptionsSnap().GetEliminatePolyPointLimitAngle().get() / 10, FieldUnit::DEGREE); ClickRotateHdl_Impl(*m_xCbxRotate); } diff --git a/sd/source/ui/inc/optsitem.hxx b/sd/source/ui/inc/optsitem.hxx index 2e03490950ff..700ace8a1e9f 100644 --- a/sd/source/ui/inc/optsitem.hxx +++ b/sd/source/ui/inc/optsitem.hxx @@ -341,8 +341,8 @@ private: bool bBigOrtho : 1; // Snap/Position/ExtendEdges bool bRotate : 1; // Snap/Position/Rotating sal_Int16 nSnapArea; // Snap/Object/Range - Degree10 nAngle; // Snap/Position/RotatingValue - Degree10 nBezAngle; // Snap/Position/PointReduction + Degree100 nAngle; // Snap/Position/RotatingValue + Degree100 nBezAngle; // Snap/Position/PointReduction protected: @@ -364,8 +364,8 @@ public: bool IsBigOrtho() const { Init(); return bBigOrtho; } bool IsRotate() const { Init(); return bRotate; } sal_Int16 GetSnapArea() const { Init(); return nSnapArea; } - Degree10 GetAngle() const { Init(); return nAngle; } - Degree10 GetEliminatePolyPointLimitAngle() const { Init(); return nBezAngle; } + Degree100 GetAngle() const { Init(); return nAngle; } + Degree100 GetEliminatePolyPointLimitAngle() const { Init(); return nBezAngle; } void SetSnapHelplines( bool bOn ) { if( bSnapHelplines != bOn ) { OptionsChanged(); bSnapHelplines = bOn; } } void SetSnapBorder( bool bOn ) { if( bSnapBorder != bOn ) { OptionsChanged(); bSnapBorder = bOn; } } @@ -375,8 +375,8 @@ public: void SetBigOrtho( bool bOn ) { if( bBigOrtho != bOn ) { OptionsChanged(); bBigOrtho = bOn; } } void SetRotate( bool bOn ) { if( bRotate != bOn ) { OptionsChanged(); bRotate = bOn; } } void SetSnapArea( sal_Int16 nIn ) { if( nSnapArea != nIn ) { OptionsChanged(); nSnapArea = nIn; } } - void SetAngle( Degree10 nIn ) { if( nAngle != nIn ) { OptionsChanged(); nAngle = nIn; } } - void SetEliminatePolyPointLimitAngle( Degree10 nIn ) { if( nBezAngle != nIn ) { OptionsChanged(); nBezAngle = nIn; } } + void SetAngle( Degree100 nIn ) { if( nAngle != nIn ) { OptionsChanged(); nAngle = nIn; } } + void SetEliminatePolyPointLimitAngle( Degree100 nIn ) { if( nBezAngle != nIn ) { OptionsChanged(); nBezAngle = nIn; } } }; class SD_DLLPUBLIC SdOptionsSnapItem : public SfxPoolItem diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx index 5b873f5aaef6..691580927671 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( toDegree100(pOptions->GetAngle()) ); + SetSnapAngle( 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( toDegree100(pOptions->GetEliminatePolyPointLimitAngle()) ); + SetEliminatePolyPointLimitAngle( pOptions->GetEliminatePolyPointLimitAngle() ); GetModel()->SetPickThroughTransparentTextFrames( pOptions->IsPickThrough() ); SetSolidDragging( pOptions->IsSolidDragging() ); -- cgit