[Libreoffice-commits] core.git: sd/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Wed Dec 23 10:10:26 UTC 2020
sd/source/ui/app/optsitem.cxx | 12 ++++++------
sd/source/ui/dlg/tpoption.cxx | 8 ++++----
sd/source/ui/inc/optsitem.hxx | 12 ++++++------
sd/source/ui/view/frmview.cxx | 4 ++--
4 files changed, 18 insertions(+), 18 deletions(-)
New commits:
commit cf5715da45ddce8b667f1b999d41c4e6e7e65659
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Wed Dec 23 09:57:24 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Dec 23 11:09:43 2020 +0100
use Degree10 in SdOptionsSnap and fix some conversions
Change-Id: I254b11d08049c4fbeaf77dc84812b19bc7f55c45
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108230
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sd/source/ui/app/optsitem.cxx b/sd/source/ui/app/optsitem.cxx
index b247a7e02a72..7944bf5c93e6 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<bool>(pValues[ 5 ]) );
if( pValues[6].hasValue() ) SetRotate( *o3tl::doAccess<bool>(pValues[ 6 ]) );
if( pValues[7].hasValue() ) SetSnapArea( static_cast<sal_Int16>(*o3tl::doAccess<sal_Int32>(pValues[ 7 ])) );
- if( pValues[8].hasValue() ) SetAngle( static_cast<sal_Int16>(*o3tl::doAccess<sal_Int32>(pValues[ 8 ])) );
- if( pValues[9].hasValue() ) SetEliminatePolyPointLimitAngle( static_cast<sal_Int16>(*o3tl::doAccess<sal_Int32>(pValues[ 9 ])) );
+ if( pValues[8].hasValue() ) SetAngle( Degree10(*o3tl::doAccess<sal_Int32>(pValues[ 8 ])) );
+ if( pValues[9].hasValue() ) SetEliminatePolyPointLimitAngle( Degree10(*o3tl::doAccess<sal_Int32>(pValues[ 9 ])) );
return true;
}
@@ -815,8 +815,8 @@ bool SdOptionsSnap::WriteData( Any* pValues ) const
pValues[ 5 ] <<= IsBigOrtho();
pValues[ 6 ] <<= IsRotate();
pValues[ 7 ] <<= static_cast<sal_Int32>(GetSnapArea());
- pValues[ 8 ] <<= static_cast<sal_Int32>(GetAngle());
- pValues[ 9 ] <<= static_cast<sal_Int32>(GetEliminatePolyPointLimitAngle());
+ pValues[ 8 ] <<= static_cast<sal_Int32>(GetAngle().get());
+ pValues[ 9 ] <<= static_cast<sal_Int32>(GetEliminatePolyPointLimitAngle().get());
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( static_cast<sal_Int16>(pView->GetSnapAngle()) );
- maOptionsSnap.SetEliminatePolyPointLimitAngle( static_cast<sal_Int16>(pView->GetEliminatePolyPointLimitAngle()) );
+ maOptionsSnap.SetAngle( Degree10(pView->GetSnapAngle() / 10) );
+ maOptionsSnap.SetEliminatePolyPointLimitAngle( Degree10(pView->GetEliminatePolyPointLimitAngle() / 10) );
}
else if( pOpts )
{
diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx
index d011508a8866..4c647eaf9ea8 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<sal_Int16>(m_xMtrFldSnapArea->get_value(FieldUnit::PIXEL)));
- aOptsItem.GetOptionsSnap().SetAngle(static_cast<sal_Int16>(m_xMtrFldAngle->get_value(FieldUnit::DEGREE)));
- aOptsItem.GetOptionsSnap().SetEliminatePolyPointLimitAngle(static_cast<sal_Int16>(m_xMtrFldBezAngle->get_value(FieldUnit::DEGREE)));
+ aOptsItem.GetOptionsSnap().SetAngle(Degree10(m_xMtrFldAngle->get_value(FieldUnit::DEGREE) * 10));
+ aOptsItem.GetOptionsSnap().SetEliminatePolyPointLimitAngle(Degree10(m_xMtrFldBezAngle->get_value(FieldUnit::DEGREE) * 10));
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(), FieldUnit::DEGREE);
- m_xMtrFldBezAngle->set_value(aOptsItem.GetOptionsSnap().GetEliminatePolyPointLimitAngle(), 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 db73144bad1d..2c8350946f9c 100644
--- a/sd/source/ui/inc/optsitem.hxx
+++ b/sd/source/ui/inc/optsitem.hxx
@@ -340,8 +340,8 @@ private:
bool bBigOrtho : 1; // Snap/Position/ExtendEdges
bool bRotate : 1; // Snap/Position/Rotating
sal_Int16 nSnapArea; // Snap/Object/Range
- sal_Int16 nAngle; // Snap/Position/RotatingValue
- sal_Int16 nBezAngle; // Snap/Position/PointReduction
+ Degree10 nAngle; // Snap/Position/RotatingValue
+ Degree10 nBezAngle; // Snap/Position/PointReduction
protected:
@@ -363,8 +363,8 @@ public:
bool IsBigOrtho() const { Init(); return bBigOrtho; }
bool IsRotate() const { Init(); return bRotate; }
sal_Int16 GetSnapArea() const { Init(); return nSnapArea; }
- sal_Int16 GetAngle() const { Init(); return nAngle; }
- sal_Int16 GetEliminatePolyPointLimitAngle() const { Init(); return nBezAngle; }
+ Degree10 GetAngle() const { Init(); return nAngle; }
+ Degree10 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; } }
@@ -374,8 +374,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( sal_Int16 nIn ) { if( nAngle != nIn ) { OptionsChanged(); nAngle = nIn; } }
- void SetEliminatePolyPointLimitAngle( sal_Int16 nIn ) { if( nBezAngle != nIn ) { OptionsChanged(); nBezAngle = nIn; } }
+ void SetAngle( Degree10 nIn ) { if( nAngle != nIn ) { OptionsChanged(); nAngle = nIn; } }
+ void SetEliminatePolyPointLimitAngle( Degree10 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 db7065f195df..88b04b035a3b 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() );
+ SetSnapAngle( pOptions->GetAngle().get() * 10 ); // convert to hundredths of a degree
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() );
+ SetEliminatePolyPointLimitAngle( pOptions->GetEliminatePolyPointLimitAngle().get() * 10 ); // convert to degree100
GetModel()->SetPickThroughTransparentTextFrames( pOptions->IsPickThrough() );
SetSolidDragging( pOptions->IsSolidDragging() );
More information about the Libreoffice-commits
mailing list