diff options
177 files changed, 1053 insertions, 1012 deletions
diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx index c8dee6c1b750..7934e90871dc 100644 --- a/chart2/source/controller/dialogs/res_DataLabel.cxx +++ b/chart2/source/controller/dialogs/res_DataLabel.cxx @@ -305,7 +305,7 @@ void DataLabelResources::FillItemSet( SfxItemSet* rOutAttrs ) const if( m_xDC_Dial->IsVisible() ) { - sal_Int32 nDegrees = m_xDC_Dial->GetRotation(); + Degree100 nDegrees = m_xDC_Dial->GetRotation(); rOutAttrs->Put(SdrAngleItem( SCHATTR_TEXT_DEGREES, nDegrees ) ); } } @@ -355,11 +355,11 @@ void DataLabelResources::Reset(const SfxItemSet& rInAttrs) if( rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, true, &pPoolItem ) == SfxItemState::SET ) { - sal_Int32 nDegrees = static_cast< const SdrAngleItem * >( pPoolItem )->GetValue(); + Degree100 nDegrees = static_cast< const SdrAngleItem * >( pPoolItem )->GetValue(); m_xDC_Dial->SetRotation( nDegrees ); } else - m_xDC_Dial->SetRotation( 0 ); + m_xDC_Dial->SetRotation( 0_deg100 ); EnableControls(); } diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.cxx b/chart2/source/controller/dialogs/tp_AxisLabel.cxx index afe98676545d..de028152e386 100644 --- a/chart2/source/controller/dialogs/tp_AxisLabel.cxx +++ b/chart2/source/controller/dialogs/tp_AxisLabel.cxx @@ -93,7 +93,7 @@ bool SchAxisLabelTabPage::FillItemSet( SfxItemSet* rOutAttrs ) if( m_xCtrlDial->HasRotation() ) { - sal_Int32 nDegrees = bStacked ? 0 : m_xCtrlDial->GetRotation(); + Degree100 nDegrees = bStacked ? 0_deg100 : m_xCtrlDial->GetRotation(); if( !m_bHasInitialDegrees || (nDegrees != m_nInitialDegrees) ) rOutAttrs->Put( SdrAngleItem( SCHATTR_TEXT_DEGREES, nDegrees ) ); } @@ -155,7 +155,7 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet* rInAttrs ) // Rotation as orient item or in degrees ---------- // check new degree item - m_nInitialDegrees = 0; + m_nInitialDegrees = 0_deg100; aState = rInAttrs->GetItemState( SCHATTR_TEXT_DEGREES, false, &pPoolItem ); if( aState == SfxItemState::SET ) m_nInitialDegrees = static_cast< const SdrAngleItem * >( pPoolItem )->GetValue(); diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.hxx b/chart2/source/controller/dialogs/tp_AxisLabel.hxx index 370eda70d6b0..0923c91118d5 100644 --- a/chart2/source/controller/dialogs/tp_AxisLabel.hxx +++ b/chart2/source/controller/dialogs/tp_AxisLabel.hxx @@ -20,6 +20,7 @@ #include <sfx2/tabdlg.hxx> #include <svx/dialcontrol.hxx> +#include <tools/degree.hxx> namespace chart { class TextDirectionListBox; } namespace weld { @@ -39,7 +40,7 @@ class SchAxisLabelTabPage : public SfxTabPage private: bool m_bShowStaggeringControls; - sal_Int32 m_nInitialDegrees; + Degree100 m_nInitialDegrees; bool m_bHasInitialDegrees; /// false = DialControl in tristate bool m_bInitialStacking; bool m_bHasInitialStacking; /// false = checkbox in tristate diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.cxx b/chart2/source/controller/dialogs/tp_PolarOptions.cxx index 865736b3b66d..59422b3a613e 100644 --- a/chart2/source/controller/dialogs/tp_PolarOptions.cxx +++ b/chart2/source/controller/dialogs/tp_PolarOptions.cxx @@ -74,7 +74,7 @@ void PolarOptionsTabPage::Reset(const SfxItemSet* rInAttrs) if (rInAttrs->GetItemState(SCHATTR_STARTING_ANGLE, true, &pPoolItem) == SfxItemState::SET) { - sal_Int32 nTmp = static_cast<const SdrAngleItem*>(pPoolItem)->GetValue(); + Degree100 nTmp = static_cast<const SdrAngleItem*>(pPoolItem)->GetValue(); m_xAngleDial->SetRotation( nTmp ); } else diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.cxx b/chart2/source/controller/dialogs/tp_TitleRotation.cxx index d2e1e02ab679..ede27edbac9d 100644 --- a/chart2/source/controller/dialogs/tp_TitleRotation.cxx +++ b/chart2/source/controller/dialogs/tp_TitleRotation.cxx @@ -94,7 +94,7 @@ bool SchAlignmentTabPage::FillItemSet(SfxItemSet* rOutAttrs) bool bStacked = m_xCbStacked->get_active(); rOutAttrs->Put( SfxBoolItem( SCHATTR_TEXT_STACKED, bStacked ) ); - sal_Int32 nDegrees = bStacked ? 0 : m_xCtrlDial->GetRotation(); + Degree100 nDegrees = bStacked ? 0_deg100 : m_xCtrlDial->GetRotation(); rOutAttrs->Put( SdrAngleItem( SCHATTR_TEXT_DEGREES, nDegrees ) ); SvxFrameDirection aDirection( m_xLbTextDirection->get_active_id() ); @@ -107,7 +107,7 @@ void SchAlignmentTabPage::Reset(const SfxItemSet* rInAttrs) { const SfxPoolItem* pItem = GetItem( *rInAttrs, SCHATTR_TEXT_DEGREES ); - sal_Int32 nDegrees = pItem ? static_cast<const SdrAngleItem*>(pItem)->GetValue() : 0; + Degree100 nDegrees = pItem ? static_cast<const SdrAngleItem*>(pItem)->GetValue() : 0_deg100; m_xCtrlDial->SetRotation( nDegrees ); pItem = GetItem( *rInAttrs, SCHATTR_TEXT_STACKED ); diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx index 7c31c9693ab7..297b3de704ee 100644 --- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx @@ -392,8 +392,8 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI if( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fVal ) { - rOutItemSet.Put( SdrAngleItem( nWhichId, static_cast< sal_Int32 >( - ::rtl::math::round( fVal * 100.0 ) ) )); + rOutItemSet.Put( SdrAngleItem( nWhichId, Degree100(static_cast< sal_Int32 >( + ::rtl::math::round( fVal * 100.0 )) ) )); } } break; @@ -881,7 +881,7 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet // convert int to double (divided by 100) double fVal = static_cast< double >( static_cast< const SdrAngleItem & >( - rItemSet.Get( nWhichId )).GetValue()) / 100.0; + rItemSet.Get( nWhichId )).GetValue().get()) / 100.0; double fOldVal = 0.0; bool bPropExisted = ( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fOldVal ); diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx index 97f66d4c8431..7693c6ccfa37 100644 --- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx @@ -550,7 +550,7 @@ bool DataPointItemConverter::ApplySpecialItem( { double fValue = static_cast< double >( static_cast< const SdrAngleItem & >( - rItemSet.Get( nWhichId )).GetValue()) / 100.0; + rItemSet.Get( nWhichId )).GetValue().get()) / 100.0; double fOldValue = 0.0; bool bPropExisted = ( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fOldValue ); @@ -800,8 +800,8 @@ void DataPointItemConverter::FillSpecialItem( if( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fValue ) { - rOutItemSet.Put( SdrAngleItem( nWhichId, static_cast< sal_Int32 >( - ::rtl::math::round( fValue * 100.0 ) ) )); + rOutItemSet.Put( SdrAngleItem( nWhichId, Degree100(static_cast< sal_Int32 >( + ::rtl::math::round( fValue * 100.0 ) ) ))); } } break; diff --git a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx index 3c8fbcca9990..fc25407d1a58 100644 --- a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx @@ -277,7 +277,7 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf { if( m_bSupportingStartingAngle ) { - m_nStartingAngle = static_cast< const SdrAngleItem & >( rItemSet.Get( nWhichId )).GetValue() / 100; + m_nStartingAngle = static_cast< const SdrAngleItem & >( rItemSet.Get( nWhichId )).GetValue().get() / 100; uno::Reference< beans::XPropertySet > xDiagramProperties( ChartModelHelper::findDiagram(m_xChartModel), uno::UNO_QUERY ); if( xDiagramProperties.is() ) { @@ -399,7 +399,7 @@ void SeriesOptionsItemConverter::FillSpecialItem( case SCHATTR_STARTING_ANGLE: { if( m_bSupportingStartingAngle ) - rOutItemSet.Put( SdrAngleItem(nWhichId,m_nStartingAngle*100)); + rOutItemSet.Put( SdrAngleItem(nWhichId, Degree100(m_nStartingAngle*100)) ); break; } case SCHATTR_CLOCKWISE: diff --git a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx index dad6ba3b30ef..adc0b849414b 100644 --- a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx @@ -489,7 +489,7 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte { double fValue = static_cast<double>( static_cast<const SdrAngleItem&>( - rItemSet.Get(nWhichId)).GetValue()) / 100.0; + rItemSet.Get(nWhichId)).GetValue().get()) / 100.0; double fOldValue = 0.0; bool bPropExisted = (GetPropertySet()->getPropertyValue("TextRotation") >>= fOldValue); @@ -705,7 +705,7 @@ void TextLabelItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet& r if (GetPropertySet()->getPropertyValue("TextRotation") >>= fValue) { rOutItemSet.Put( - SdrAngleItem(nWhichId, static_cast<sal_Int32>(rtl::math::round(fValue * 100.0)))); + SdrAngleItem(nWhichId, Degree100(static_cast<sal_Int32>(rtl::math::round(fValue * 100.0))))); } } break; diff --git a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx index 6ca38785fb56..9109bc3ea3a1 100644 --- a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx @@ -169,7 +169,7 @@ bool TitleItemConverter::ApplySpecialItem( // convert int to double (divided by 100) double fVal = static_cast< double >( static_cast< const SdrAngleItem & >( - rItemSet.Get( nWhichId )).GetValue()) / 100.0; + rItemSet.Get( nWhichId )).GetValue().get()) / 100.0; double fOldVal = 0.0; bool bPropExisted = ( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fOldVal ); @@ -198,8 +198,8 @@ void TitleItemConverter::FillSpecialItem( if( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fVal ) { - rOutItemSet.Put( SdrAngleItem( nWhichId, static_cast< sal_Int32 >( - ::rtl::math::round( fVal * 100.0 ) ) )); + rOutItemSet.Put( SdrAngleItem( nWhichId, Degree100(static_cast< sal_Int32 >( + ::rtl::math::round( fVal * 100.0 ) ) ))); } } break; diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx index 53ed1cfc7a32..ef0bdfd5af5b 100644 --- a/chart2/source/controller/main/DrawCommandDispatch.cxx +++ b/chart2/source/controller/main/DrawCommandDispatch.cxx @@ -142,7 +142,7 @@ void DrawCommandDispatch::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/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx index 4df7e269a56d..6af1c34c6ef6 100644 --- a/chart2/source/view/main/ChartItemPool.cxx +++ b/chart2/source/view/main/ChartItemPool.cxx @@ -63,7 +63,7 @@ ChartItemPool::ChartItemPool(): rPoolDefaults[SCHATTR_LEGEND_NO_OVERLAY - SCHATTR_START] = new SfxBoolItem(SCHATTR_LEGEND_NO_OVERLAY, true); //text - rPoolDefaults[SCHATTR_TEXT_DEGREES - SCHATTR_START] = new SdrAngleItem(SCHATTR_TEXT_DEGREES, 0); + rPoolDefaults[SCHATTR_TEXT_DEGREES - SCHATTR_START] = new SdrAngleItem(SCHATTR_TEXT_DEGREES, 0_deg100); rPoolDefaults[SCHATTR_TEXT_STACKED - SCHATTR_START] = new SfxBoolItem(SCHATTR_TEXT_STACKED,false); //statistic @@ -142,7 +142,7 @@ ChartItemPool::ChartItemPool(): rPoolDefaults[SCHATTR_SPLINE_ORDER - SCHATTR_START] = new SfxInt32Item( SCHATTR_SPLINE_ORDER, 3 ); rPoolDefaults[SCHATTR_SPLINE_RESOLUTION - SCHATTR_START] = new SfxInt32Item( SCHATTR_SPLINE_RESOLUTION, 20 ); rPoolDefaults[SCHATTR_GROUP_BARS_PER_AXIS - SCHATTR_START] = new SfxBoolItem(SCHATTR_GROUP_BARS_PER_AXIS, false); - rPoolDefaults[SCHATTR_STARTING_ANGLE - SCHATTR_START] = new SdrAngleItem( SCHATTR_STARTING_ANGLE, 9000 ); + rPoolDefaults[SCHATTR_STARTING_ANGLE - SCHATTR_START] = new SdrAngleItem( SCHATTR_STARTING_ANGLE, 9000_deg100 ); rPoolDefaults[SCHATTR_CLOCKWISE - SCHATTR_START] = new SfxBoolItem( SCHATTR_CLOCKWISE, false ); rPoolDefaults[SCHATTR_MISSING_VALUE_TREATMENT - SCHATTR_START] = new SfxInt32Item(SCHATTR_MISSING_VALUE_TREATMENT, 0); diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx index 142bd46e4d9b..de757f65991d 100644 --- a/cui/source/tabpages/transfrm.cxx +++ b/cui/source/tabpages/transfrm.cxx @@ -22,6 +22,7 @@ #include <algorithm> #include <svx/EnhancedCustomShape2d.hxx> +#include <svx/sdangitm.hxx> #include <svx/svdundo.hxx> #include <svx/svdview.hxx> #include <svx/svdobj.hxx> @@ -295,7 +296,7 @@ void SvxAngleTabPage::Reset(const SfxItemSet* rAttrs) } else { - m_xCtlAngle->SetRotation(0); + m_xCtlAngle->SetRotation(0_deg100); } m_xCtlAngle->SaveValue(); m_xMtrPosX->save_value(); @@ -461,7 +462,7 @@ bool SvxSlantTabPage::FillItemSet(SfxItemSet* rAttrs) if (m_xMtrAngle->get_value_changed_from_saved()) { sal_Int32 nValue = static_cast<sal_Int32>(m_xMtrAngle->get_value(FieldUnit::NONE)); - rAttrs->Put( SdrAngleItem( SID_ATTR_TRANSFORM_SHEAR, nValue ) ); + rAttrs->Put( SdrAngleItem( SID_ATTR_TRANSFORM_SHEAR, Degree100(nValue) ) ); bModified = true; } @@ -606,7 +607,7 @@ void SvxSlantTabPage::Reset(const SfxItemSet* rAttrs) if( pItem ) { - m_xMtrAngle->set_value(static_cast<const SdrAngleItem*>(pItem)->GetValue(), FieldUnit::NONE); + m_xMtrAngle->set_value(static_cast<const SdrAngleItem*>(pItem)->GetValue().get(), FieldUnit::NONE); } else { diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 505e43d91fc1..bde712649af4 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -2102,12 +2102,12 @@ static sal_Int32 lcl_GetConnectorAdjustValue ( const XPolygon& rPoly, sal_uInt16 } -static void lcl_Rotate(sal_Int32 nAngle, Point center, Point& pt) +static void lcl_Rotate(Degree100 nAngle, Point center, Point& pt) { nAngle = NormAngle36000(nAngle); int cs, sn; - switch (nAngle) + switch (nAngle.get()) { case 0: cs =1; @@ -2149,8 +2149,8 @@ static bool lcl_GetAngle(tools::Polygon &rPoly, ShapeFlag& rShapeFlags,sal_Int32 if ( nAngle ) { Point center((aEnd.X()+aStart.X())>>1,(aEnd.Y()+aStart.Y())>>1); - lcl_Rotate(-nAngle, center,p1); - lcl_Rotate(-nAngle, center,p2); + lcl_Rotate(Degree100(-nAngle), center,p1); + lcl_Rotate(Degree100(-nAngle), center,p2); } if ( p1.X() > p2.X() ) { diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 442509617f91..bddc9c2552c2 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -383,12 +383,12 @@ void DffPropertyReader::ReadPropSet( SvStream& rIn, SvxMSDffClientData* pClientD } -sal_Int32 DffPropertyReader::Fix16ToAngle( sal_Int32 nContent ) +Degree100 DffPropertyReader::Fix16ToAngle( sal_Int32 nContent ) { - sal_Int32 nAngle = 0; + Degree100 nAngle(0); if ( nContent ) { - nAngle = ( static_cast<sal_Int16>( nContent >> 16) * 100L ) + ( ( ( nContent & 0x0000ffff) * 100L ) >> 16 ); + nAngle = Degree100(( static_cast<sal_Int16>( nContent >> 16) * 100L ) + ( ( ( nContent & 0x0000ffff) * 100L ) >> 16 )); nAngle = NormAngle36000( -nAngle ); } return nAngle; @@ -1150,7 +1150,7 @@ static void GetShadeColors( const SvxMSDffManager& rManager, const DffPropertyRe rIn.Seek( nPos ); } -static void ApplyRectangularGradientAsBitmap( const SvxMSDffManager& rManager, SvStream& rIn, SfxItemSet& rSet, const std::vector< ShadeColor >& rShadeColors, const DffObjData& rObjData, sal_Int32 nFix16Angle ) +static void ApplyRectangularGradientAsBitmap( const SvxMSDffManager& rManager, SvStream& rIn, SfxItemSet& rSet, const std::vector< ShadeColor >& rShadeColors, const DffObjData& rObjData, Degree100 nFix16Angle ) { Size aBitmapSizePixel( static_cast< sal_Int32 >( ( rObjData.aBoundRect.GetWidth() / 2540.0 ) * 90.0 ), // we will create a bitmap with 90 dpi static_cast< sal_Int32 >( ( rObjData.aBoundRect.GetHeight() / 2540.0 ) * 90.0 ) ); @@ -1293,7 +1293,7 @@ static void ApplyRectangularGradientAsBitmap( const SvxMSDffManager& rManager, S if ( bRotateWithShape ) { // convert from 100th to 10th degrees - aBitmapEx.Rotate( Degree10(nFix16Angle * 10), rShadeColors[ 0 ].aColor ); + aBitmapEx.Rotate( toDegree10(nFix16Angle), rShadeColors[ 0 ].aColor ); BmpMirrorFlags nMirrorFlags = BmpMirrorFlags::NONE; if ( rObjData.nSpFlags & ShapeFlag::FlipV ) @@ -2770,7 +2770,7 @@ void DffPropertyReader::CheckAndCorrectExcelTextRotation( SvStream& rIn, SfxItem *pAny >>= fExtraTextRotateAngle; if ( rManager.mnFix16Angle ) - fExtraTextRotateAngle += mnFix16Angle / 100.0; + fExtraTextRotateAngle += mnFix16Angle.get() / 100.0; if ( rObjData.nSpFlags & ShapeFlag::FlipV ) fExtraTextRotateAngle -= 180.0; @@ -2788,15 +2788,15 @@ void DffPropertyReader::ImportGradientColor( SfxItemSet& aSet, sal_uInt32 eMSO_F //support this prop. So need some swap for the two color to keep fidelity with AOO and MS shape. //So below var is defined. sal_Int32 nChgColors = 0; - sal_Int32 nAngle = GetPropertyValue( DFF_Prop_fillAngle, 0 ); - if(nAngle >= 0) + sal_Int32 nAngleFix16 = GetPropertyValue( DFF_Prop_fillAngle, 0 ); + if(nAngleFix16 >= 0) nChgColors ^= 1; //Translate a MS clockwise(+) or count clockwise angle(-) into an AOO count clock wise angle - nAngle=3600 - ( ( Fix16ToAngle(nAngle) + 5 ) / 10 ); + Degree10 nAngle( 3600 - ( ( Fix16ToAngle(nAngleFix16).get() + 5 ) / 10 ) ); //Make sure this angle belongs to 0~3600 - while ( nAngle >= 3600 ) nAngle -= 3600; - while ( nAngle < 0 ) nAngle += 3600; + while ( nAngle >= Degree10(3600) ) nAngle -= Degree10(3600); + while ( nAngle < Degree10(0) ) nAngle += Degree10(3600); //Rotate angle if ( mbRotateGranientFillWithAngle ) @@ -2807,10 +2807,10 @@ void DffPropertyReader::ImportGradientColor( SfxItemSet& aSet, sal_uInt32 eMSO_F nRotateAngle = ( nRotateAngle + 5 ) / 10 ;//round up //nAngle is a clockwise angle. If nRotateAngle is a clockwise angle, then gradient needs to be rotated a little less //or it needs to be rotated a little more - nAngle -= nRotateAngle; + nAngle -= Degree10(nRotateAngle); } - while ( nAngle >= 3600 ) nAngle -= 3600; - while ( nAngle < 0 ) nAngle += 3600; + while ( nAngle >= Degree10(3600) ) nAngle -= Degree10(3600); + while ( nAngle < Degree10(0) ) nAngle += Degree10(3600); css::awt::GradientStyle eGrad = css::awt::GradientStyle_LINEAR; @@ -2870,7 +2870,7 @@ void DffPropertyReader::ImportGradientColor( SfxItemSet& aSet, sal_uInt32 eMSO_F } //Construct gradient item - XGradient aGrad( aCol2, aCol1, eGrad, Degree10(nAngle), nFocusX, nFocusY ); + XGradient aGrad( aCol2, aCol1, eGrad, nAngle, nFocusX, nFocusY ); //Intensity has been merged into color. So here just set is as 100 aGrad.SetStartIntens( 100 ); aGrad.SetEndIntens( 100 ); @@ -2883,7 +2883,7 @@ void DffPropertyReader::ImportGradientColor( SfxItemSet& aSet, sal_uInt32 eMSO_F aCol1 = Color(nStartCol, nStartCol, nStartCol); aCol2 = Color(nEndCol, nEndCol, nEndCol); - XGradient aGrad2( aCol2 , aCol1 , eGrad, Degree10(nAngle), nFocusX, nFocusY ); + XGradient aGrad2( aCol2 , aCol1 , eGrad, nAngle, nFocusX, nFocusY ); aSet.Put( XFillFloatTransparenceItem( OUString(), aGrad2 ) ); } } @@ -4054,13 +4054,13 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r bool bOk = ReadDffRecordHeader(rSt, aRecHd); if (bOk && aRecHd.nRecType == DFF_msofbtSpContainer) { - mnFix16Angle = 0; + mnFix16Angle = 0_deg100; if (!aRecHd.SeekToBegOfRecord(rSt)) return pRet; pRet = ImportObj( rSt, rClientData, rClientRect, rGlobalChildRect, nCalledByGroup + 1, pShapeId ); if ( pRet ) { - sal_Int32 nGroupRotateAngle = 0; + Degree100 nGroupRotateAngle(0); ShapeFlag nSpFlags = nGroupShapeFlags; nGroupRotateAngle = mnFix16Angle; @@ -4072,8 +4072,8 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r else aGlobalChildRect = rGlobalChildRect; - if ( ( nGroupRotateAngle > 4500 && nGroupRotateAngle <= 13500 ) - || ( nGroupRotateAngle > 22500 && nGroupRotateAngle <= 31500 ) ) + if ( ( nGroupRotateAngle > 4500_deg100 && nGroupRotateAngle <= 13500_deg100 ) + || ( nGroupRotateAngle > 22500_deg100 && nGroupRotateAngle <= 31500_deg100 ) ) { sal_Int32 nHalfWidth = ( aClientRect.GetWidth() + 1 ) >> 1; sal_Int32 nHalfHeight = ( aClientRect.GetHeight() + 1 ) >> 1; @@ -4237,7 +4237,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r else { InitializePropSet( DFF_msofbtOPT ); // get the default PropSet - static_cast<DffPropertyReader*>(this)->mnFix16Angle = 0; + static_cast<DffPropertyReader*>(this)->mnFix16Angle = 0_deg100; } aObjData.bOpt2 = maShapeRecords.SeekToContent( rSt, DFF_msofbtUDefProp, SEEK_FROM_CURRENT_AND_RESTART ); @@ -4287,8 +4287,8 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r { // apply rotation to the BoundingBox BEFORE an object has been generated if( mnFix16Angle ) { - tools::Long nAngle = mnFix16Angle; - if ( ( nAngle > 4500 && nAngle <= 13500 ) || ( nAngle > 22500 && nAngle <= 31500 ) ) + Degree100 nAngle = mnFix16Angle; + if ( ( nAngle > 4500_deg100 && nAngle <= 13500_deg100 ) || ( nAngle > 22500_deg100 && nAngle <= 31500_deg100 ) ) { sal_Int32 nHalfWidth = ( aObjData.aBoundRect.GetWidth() + 1 ) >> 1; sal_Int32 nHalfHeight = ( aObjData.aBoundRect.GetHeight() + 1 ) >> 1; @@ -4320,7 +4320,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r SfxItemSet aSet( pSdrModel->GetItemPool() ); bool bIsConnector = ( ( aObjData.eShapeType >= mso_sptStraightConnector1 ) && ( aObjData.eShapeType <= mso_sptCurvedConnector5 ) ); - sal_Int32 nObjectRotation = mnFix16Angle; + Degree100 nObjectRotation = mnFix16Angle; ShapeFlag nSpFlags = aObjData.nSpFlags; if ( bGraphic ) @@ -4679,12 +4679,12 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r // sj: taking care of the different rotation points, since the new arc is having a bigger snaprect if ( mnFix16Angle ) { - sal_Int32 nAngle = mnFix16Angle; + Degree100 nAngle = mnFix16Angle; if ( nSpFlags & ShapeFlag::FlipH ) - nAngle = 36000 - nAngle; + nAngle = 36000_deg100 - nAngle; if ( nSpFlags & ShapeFlag::FlipV ) nAngle = -nAngle; - double a = nAngle * F_PI18000; + double a = nAngle.get() * F_PI18000; double ss = sin( a ); double cc = cos( a ); Point aP1( aOldBoundRect.TopLeft() ); @@ -4759,7 +4759,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r // pay attention to the rotations if ( nObjectRotation ) { - double a = nObjectRotation * F_PI18000; + double a = nObjectRotation.get() * F_PI18000; Point aCenter( aObjData.aBoundRect.Center() ); double ss = sin(a); double cc = cos(a); @@ -4768,7 +4768,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r RotatePoint(aPoint2, aCenter, ss, cc); // #i120437# reset rotation, it is part of the path and shall not be applied again - nObjectRotation = 0; + nObjectRotation = 0_deg100; } // rotate/mirror line within the area as we need it @@ -5220,7 +5220,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt, ScaleEmu( nTextTop ); ScaleEmu( nTextBottom ); - sal_Int32 nTextRotationAngle=0; + Degree100 nTextRotationAngle(0); bool bVerticalText = false; if ( IsProperty( DFF_Prop_txflTextFlow ) ) { @@ -5228,18 +5228,18 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt, switch( eTextFlow ) { case mso_txflBtoT: - nTextRotationAngle = 9000; + nTextRotationAngle = 9000_deg100; break; case mso_txflVertN: case mso_txflTtoBN: - nTextRotationAngle = 27000; + nTextRotationAngle = 27000_deg100; break; case mso_txflTtoBA: bVerticalText = true; break; case mso_txflHorzA: bVerticalText = true; - nTextRotationAngle = 9000; + nTextRotationAngle = 9000_deg100; break; case mso_txflHorzN: default : @@ -5249,7 +5249,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt, if (nTextRotationAngle) { - switch (nTextRotationAngle) + switch (nTextRotationAngle.get()) { case 9000: { @@ -5436,7 +5436,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt, // rotate text with shape? if ( mnFix16Angle ) { - double a = mnFix16Angle * F_PI18000; + double a = mnFix16Angle.get() * F_PI18000; pTextObj->NbcRotate( rObjData.aBoundRect.Center(), mnFix16Angle, sin( a ), cos( a ) ); } diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index 545afd68514d..7da1450799c6 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -814,14 +814,14 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, Svx bool bVerticalText = false; // and if the text object is not empty, it must be applied to pRet, the object we // initially got from our escher import - sal_Int32 nTextRotationAngle = 0; + Degree100 nTextRotationAngle(0); if ( IsProperty( DFF_Prop_txflTextFlow ) ) { auto eTextFlow = GetPropertyValue(DFF_Prop_txflTextFlow, 0) & 0xFFFF; switch( eTextFlow ) { case mso_txflBtoT : // Bottom to Top non-@ - nTextRotationAngle += 9000; + nTextRotationAngle += 9000_deg100; break; case mso_txflTtoBA : /* #68110# */ // Top to Bottom @-font case mso_txflTtoBN : // Top to Bottom non-@ @@ -840,7 +840,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, Svx } const bool bFail = o3tl::checked_multiply<sal_Int32>(nFontDirection, 9000, nFontDirection); if (!bFail) - nTextRotationAngle -= nFontDirection; + nTextRotationAngle -= Degree100(nFontDirection); else SAL_WARN("filter.ms", "Parsing error: bad fontdirection: " << nFontDirection); aTextObj.SetVertical( bVerticalText ); @@ -1174,7 +1174,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, Svx } } // rotate text with shape? - sal_Int32 nAngle = ( rObjData.nSpFlags & ShapeFlag::FlipV ) ? -mnFix16Angle : mnFix16Angle; // #72116# vertical flip -> rotate by using the other way + Degree100 nAngle = ( rObjData.nSpFlags & ShapeFlag::FlipV ) ? -mnFix16Angle : mnFix16Angle; // #72116# vertical flip -> rotate by using the other way nAngle += nTextRotationAngle; if ( dynamic_cast< const SdrObjCustomShape* >(pTObj) == nullptr ) @@ -1182,10 +1182,10 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, Svx if ( rObjData.nSpFlags & ShapeFlag::FlipV ) { double a = 18000 * F_PI18000; - pTObj->Rotate( rTextRect.Center(), 18000, sin( a ), cos( a ) ); + pTObj->Rotate( rTextRect.Center(), 18000_deg100, sin( a ), cos( a ) ); } if ( rObjData.nSpFlags & ShapeFlag::FlipH ) - nAngle = 36000 - nAngle; + nAngle = 36000_deg100 - nAngle; if ( nAngle ) pTObj->NbcRotate( rObjData.aBoundRect.Center(), nAngle ); } diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx index 3561d4ad9468..d3c6657c7b90 100644 --- a/include/filter/msfilter/msdffimp.hxx +++ b/include/filter/msfilter/msdffimp.hxx @@ -40,6 +40,7 @@ #include <sal/types.h> #include <svx/msdffdef.hxx> #include <vcl/errcode.hxx> +#include <tools/degree.hxx> #include <tools/gen.hxx> #include <tools/ref.hxx> #include <tools/solar.h> @@ -93,7 +94,7 @@ class MSFILTER_DLLPUBLIC DffPropertyReader : public DffPropSet void ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, const DffObjData& rObjData ) const; public: - sal_Int32 mnFix16Angle; + Degree100 mnFix16Angle; bool mbRotateGranientFillWithAngle; explicit DffPropertyReader( const SvxMSDffManager& rManager ); @@ -102,7 +103,7 @@ public: DffPropertyReader& operator=( DffPropertyReader const & ) = delete; // MSVC2015 workaround DffPropertyReader( DffPropertyReader const & ) = delete; // MSVC2015 workaround - static sal_Int32 Fix16ToAngle( sal_Int32 nAngle ); + static Degree100 Fix16ToAngle( sal_Int32 nAngle ); #ifdef DBG_CUSTOMSHAPE void ReadPropSet( SvStream& rIn, SvxMSDffClientData* pClientData, sal_uInt32 nShapeType = 0 ) const; diff --git a/include/o3tl/strong_int.hxx b/include/o3tl/strong_int.hxx index 3db958212229..82107955897f 100644 --- a/include/o3tl/strong_int.hxx +++ b/include/o3tl/strong_int.hxx @@ -113,10 +113,16 @@ public: strong_int& operator+=(strong_int const & other) { m_value += other.m_value; return *this; } strong_int& operator-=(strong_int const & other) { m_value -= other.m_value; return *this; } strong_int& operator%=(strong_int const & other) { m_value %= other.m_value; return *this; } + strong_int& operator*=(strong_int const & other) { m_value *= other.m_value; return *this; } + strong_int& operator/=(strong_int const & other) { m_value /= other.m_value; return *this; } [[nodiscard]] strong_int operator%(strong_int const & other) const { return strong_int(m_value % other.m_value); } [[nodiscard]] strong_int operator-() const { return strong_int(-m_value); } + [[nodiscard]] + strong_int operator*(strong_int const & other) const { return strong_int(m_value * other.m_value); } + [[nodiscard]] + strong_int operator/(strong_int const & other) const { return strong_int(m_value / other.m_value); } bool anyOf(strong_int v) const { return *this == v; diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 022a0df00e4e..2cd17e6defb0 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -111,9 +111,9 @@ public: // Our rotation is counter-clockwise and is in 100ths of a degree. // drawingML rotation is clockwise and is in 60000ths of a degree. -template <typename T> T ExportRotateClockwisify(T input) +inline sal_Int32 ExportRotateClockwisify(Degree100 input) { - return ((21600000 - input * 600) % 21600000); + return ((21600000 - input.get() * 600) % 21600000); } /// Interface to be implemented by the parent exporter that knows how to handle shape text. diff --git a/include/oox/vml/vmlformatting.hxx b/include/oox/vml/vmlformatting.hxx index 3d6cdc5ab87b..4bdabbffb97b 100644 --- a/include/oox/vml/vmlformatting.hxx +++ b/include/oox/vml/vmlformatting.hxx @@ -32,6 +32,7 @@ #include <oox/helper/helper.hxx> #include <rtl/ustring.hxx> #include <sal/types.h> +#include <tools/degree.hxx> namespace com::sun::star { namespace awt { struct Point; } @@ -87,7 +88,7 @@ namespace ConversionHelper point value will be returned unmodified. If the 'fd' suffix is present, the value will be divided by 65536. */ - OOX_DLLPUBLIC sal_Int32 decodeRotation( const OUString& rValue ); + OOX_DLLPUBLIC Degree100 decodeRotation( const OUString& rValue ); /** Converts the passed VML measure string to EMU (English Metric Units). diff --git a/include/svx/EnhancedCustomShape2d.hxx b/include/svx/EnhancedCustomShape2d.hxx index 8976b2bdb106..67b0d06a7d64 100644 --- a/include/svx/EnhancedCustomShape2d.hxx +++ b/include/svx/EnhancedCustomShape2d.hxx @@ -22,6 +22,7 @@ #include <svx/msdffdef.hxx> #include <svx/sdasitm.hxx> +#include <tools/degree.hxx> #include <com/sun/star/awt/Size.hpp> #include <com/sun/star/uno/Sequence.h> #include <com/sun/star/beans/PropertyValues.hpp> @@ -122,7 +123,7 @@ class SVXCORE_DLLPUBLIC EnhancedCustomShape2d : public SfxItemSet bool bFlipH; bool bFlipV; - sal_Int32 nRotateAngle; + Degree100 nRotateAngle; SAL_DLLPRIVATE bool SetAdjustValueAsDouble( const double& rValue, const sal_Int32 nIndex ); SAL_DLLPRIVATE sal_Int32 GetLuminanceChange( sal_uInt32 nIndex ) const; @@ -183,7 +184,7 @@ class SVXCORE_DLLPUBLIC EnhancedCustomShape2d : public SfxItemSet SAL_DLLPRIVATE bool IsFlipVert() const { return bFlipV; }; SAL_DLLPRIVATE bool IsFlipHorz() const { return bFlipH; }; - SAL_DLLPRIVATE sal_Int32 GetRotateAngle() const { return nRotateAngle; }; + SAL_DLLPRIVATE Degree100 GetRotateAngle() const { return nRotateAngle; }; SdrObject* CreateLineGeometry(); SdrObject* CreateObject( bool bLineGeometryNeededOnly ); diff --git a/include/svx/algitem.hxx b/include/svx/algitem.hxx index cb37a21ba869..c778735436ee 100644 --- a/include/svx/algitem.hxx +++ b/include/svx/algitem.hxx @@ -25,6 +25,7 @@ #include <svl/poolitem.hxx> #include <svl/eitem.hxx> #include <svx/svxdllapi.h> +#include <tools/degree.hxx> class IntlWrapper; class SfxItemPool; @@ -37,7 +38,7 @@ public: const sal_uInt16 nId ); SvxOrientationItem( - sal_Int32 nRotation, bool bStacked, + Degree100 nRotation, bool bStacked, const sal_uInt16 nId ); virtual bool GetPresentation( SfxItemPresentation ePres, @@ -55,7 +56,7 @@ public: /** Returns sal_True, if the item represents STACKED state. */ bool IsStacked() const; /** Returns the rotation this item represents (returns nStdAngle for STANDARD and STACKED state). */ - sal_Int32 GetRotation( sal_Int32 nStdAngle ) const; + Degree100 GetRotation( Degree100 nStdAngle ) const; }; class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxMarginItem final : public SfxPoolItem diff --git a/include/svx/dialcontrol.hxx b/include/svx/dialcontrol.hxx index 3c5435bb9787..75d7d7fffa78 100644 --- a/include/svx/dialcontrol.hxx +++ b/include/svx/dialcontrol.hxx @@ -24,6 +24,7 @@ #include <vcl/customweld.hxx> #include <vcl/virdev.hxx> #include <svx/svxdllapi.h> +#include <svx/svdtrans.hxx> class Edit; @@ -40,7 +41,7 @@ public: void CopyBackground( const DialControlBmp& rSrc ); void DrawBackground( const Size& rSize, bool bEnabled ); void DrawBackground(); - void DrawElements( const OUString& rText, sal_Int32 nAngle ); + void DrawElements( const OUString& rText, Degree100 nAngle ); Color GetBackgroundColor() const override; private: @@ -90,9 +91,9 @@ public: virtual void Resize() override; /** Returns the current rotation angle in 1/100 degrees. */ - sal_Int32 GetRotation() const; + Degree100 GetRotation() const; /** Sets the rotation to the passed value (in 1/100 degrees). */ - void SetRotation( sal_Int32 nAngle ); + void SetRotation( Degree100 nAngle ); /** Returns true, if the control is not in "don't care" state. */ bool HasRotation() const; /** Sets the control to "don't care" state. */ @@ -138,9 +139,9 @@ private: sal_Int32 mnLinkedFieldValueMultiplyer; Size maWinSize; vcl::Font maWinFont; - sal_Int32 mnAngle; - sal_Int32 mnInitialAngle; - sal_Int32 mnOldAngle; + Degree100 mnAngle; + Degree100 mnInitialAngle; + Degree100 mnOldAngle; tools::Long mnCenterX; tools::Long mnCenterY; bool mbNoRot; @@ -154,7 +155,7 @@ private: void HandleMouseEvent( const Point& rPos, bool bInitial ); void HandleEscapeEvent(); - void SetRotation( sal_Int32 nAngle, bool bBroadcast ); + void SetRotation( Degree100 nAngle, bool bBroadcast ); void Init( const Size& rWinSize, const vcl::Font& rWinFont ); diff --git a/include/svx/obj3d.hxx b/include/svx/obj3d.hxx index b9f43315d730..e786cbbfbcbd 100644 --- a/include/svx/obj3d.hxx +++ b/include/svx/obj3d.hxx @@ -116,7 +116,7 @@ public: // which is vertical to the screen, plus a shift of the scene. // This means that also the scene (E3dScene) must define this // routine as virtual in its class. - virtual void NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs) override; + virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override; // get wireframe polygon for local object. No transform is applied. basegfx::B3DPolyPolygon CreateWireframe() const; diff --git a/include/svx/scene3d.hxx b/include/svx/scene3d.hxx index 3ff3a5562e44..13d4157d3449 100644 --- a/include/svx/scene3d.hxx +++ b/include/svx/scene3d.hxx @@ -137,7 +137,7 @@ public: virtual void NbcSetTransform(const basegfx::B3DHomMatrix& rMatrix) override; virtual void SetTransform(const basegfx::B3DHomMatrix& rMatrix) override; - virtual void NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs) override; + virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override; void RotateScene(const Point& rRef, double sn, double cs); // TakeObjName...() is for the display in the UI, for example "3 frames selected". diff --git a/include/svx/sdangitm.hxx b/include/svx/sdangitm.hxx index 81897d43c810..61770899b951 100644 --- a/include/svx/sdangitm.hxx +++ b/include/svx/sdangitm.hxx @@ -21,12 +21,13 @@ #include <svl/intitem.hxx> #include <svx/svxdllapi.h> +#include <tools/degree.hxx> class SVXCORE_DLLPUBLIC SdrAngleItem: public SfxInt32Item { public: - SdrAngleItem(sal_uInt16 nId, sal_Int32 nAngle): SfxInt32Item(nId,nAngle) {} + SdrAngleItem(sal_uInt16 nId, Degree100 nAngle): SfxInt32Item(nId,nAngle.get()) {} virtual SdrAngleItem* Clone(SfxItemPool* pPool=nullptr) const override; virtual bool GetPresentation(SfxItemPresentation ePres, @@ -34,6 +35,9 @@ public: MapUnit ePresMetric, OUString& rText, const IntlWrapper& rIntlWrapper) const override; + + Degree100 GetValue() const { return Degree100(SfxInt32Item::GetValue()); } + void SetValue(Degree100 nTheValue) { SfxInt32Item::SetValue(nTheValue.get()); } }; diff --git a/include/svx/svdedtv.hxx b/include/svx/svdedtv.hxx index b215108c24c8..560f4cf19fa5 100644 --- a/include/svx/svdedtv.hxx +++ b/include/svx/svdedtv.hxx @@ -212,13 +212,13 @@ public: void MoveMarkedObj(const Size& rSiz, bool bCopy=false); void ResizeMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy=false); void ResizeMultMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, const bool bWdh, const bool bHgt); - tools::Long GetMarkedObjRotate() const; - void RotateMarkedObj(const Point& rRef, tools::Long nAngle, bool bCopy=false); + Degree100 GetMarkedObjRotate() const; + void RotateMarkedObj(const Point& rRef, Degree100 nAngle, bool bCopy=false); void MirrorMarkedObj(const Point& rRef1, const Point& rRef2, bool bCopy=false); void MirrorMarkedObjHorizontal(); void MirrorMarkedObjVertical(); - tools::Long GetMarkedObjShear() const; - void ShearMarkedObj(const Point& rRef, tools::Long nAngle, bool bVShear=false, bool bCopy=false); + Degree100 GetMarkedObjShear() const; + void ShearMarkedObj(const Point& rRef, Degree100 nAngle, bool bVShear=false, bool bCopy=false); void CrookMarkedObj(const Point& rRef, const Point& rRad, SdrCrookMode eMode, bool bVertical, bool bNoContortion, bool bCopy=false); void DistortMarkedObj(const tools::Rectangle& rRef, const XPolygon& rDistortedRect, bool bNoContortion, bool bCopy=false); @@ -227,7 +227,7 @@ public: void SetAllMarkedRect(const tools::Rectangle& rRect) { SetMarkedObjRect(rRect); } void MoveAllMarked(const Size& rSiz, bool bCopy=false) { MoveMarkedObj(rSiz,bCopy); } void ResizeAllMarked(const Point& rRef, const Fraction& xFact, const Fraction& yFact) { ResizeMarkedObj(rRef,xFact,yFact); } - void RotateAllMarked(const Point& rRef, tools::Long nAngle) { RotateMarkedObj(rRef,nAngle); } + void RotateAllMarked(const Point& rRef, Degree100 nAngle) { RotateMarkedObj(rRef,nAngle); } void MirrorAllMarkedHorizontal() { MirrorMarkedObjHorizontal(); } void MirrorAllMarkedVertical() { MirrorMarkedObjVertical(); } void CopyMarked() { CopyMarkedObj(); } diff --git a/include/svx/svdglev.hxx b/include/svx/svdglev.hxx index 7469444a743b..5a7d3a2ebd38 100644 --- a/include/svx/svdglev.hxx +++ b/include/svx/svdglev.hxx @@ -77,7 +77,7 @@ public: void MoveMarkedGluePoints (const Size& rSiz, bool bCopy); void ResizeMarkedGluePoints(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy); - void RotateMarkedGluePoints(const Point& rRef, tools::Long nAngle, bool bCopy); + void RotateMarkedGluePoints(const Point& rRef, Degree100 nAngle, bool bCopy); }; #endif // INCLUDED_SVX_SVDGLEV_HXX diff --git a/include/svx/svdglue.hxx b/include/svx/svdglue.hxx index a7eb9b9d76b2..7065b34766a4 100644 --- a/include/svx/svdglue.hxx +++ b/include/svx/svdglue.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SVX_SVDGLUE_HXX #include <tools/gen.hxx> +#include <tools/degree.hxx> #include <svx/svxdllapi.h> #include <memory> #include <vector> @@ -104,12 +105,12 @@ public: void Invalidate(vcl::Window& rWin, const SdrObject* pObj) const; Point GetAbsolutePos(const SdrObject& rObj) const; void SetAbsolutePos(const Point& rNewPos, const SdrObject& rObj); - tools::Long GetAlignAngle() const; - void SetAlignAngle(tools::Long nAngle); - static tools::Long EscDirToAngle(SdrEscapeDirection nEsc); - static SdrEscapeDirection EscAngleToDir(tools::Long nAngle); - void Rotate(const Point& rRef, tools::Long nAngle, double sn, double cs, const SdrObject* pObj); - void Mirror(const Point& rRef1, const Point& rRef2, tools::Long nAngle, const SdrObject* pObj); + Degree100 GetAlignAngle() const; + void SetAlignAngle(Degree100 nAngle); + static Degree100 EscDirToAngle(SdrEscapeDirection nEsc); + static SdrEscapeDirection EscAngleToDir(Degree100 nAngle); + void Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs, const SdrObject* pObj); + void Mirror(const Point& rRef1, const Point& rRef2, Degree100 nAngle, const SdrObject* pObj); void Shear (const Point& rRef, double tn, bool bVShear, const SdrObject* pObj); }; @@ -137,9 +138,9 @@ public: void Invalidate(vcl::Window& rWin, const SdrObject* pObj) const; // temp for transformations on the reference object void SetReallyAbsolute(bool bOn, const SdrObject& rObj); - void Rotate(const Point& rRef, tools::Long nAngle, double sn, double cs, const SdrObject* pObj); + void Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs, const SdrObject* pObj); void Mirror(const Point& rRef1, const Point& rRef2, const SdrObject* pObj); - void Mirror(const Point& rRef1, const Point& rRef2, tools::Long nAngle, const SdrObject* pObj); + void Mirror(const Point& rRef1, const Point& rRef2, Degree100 nAngle, const SdrObject* pObj); void Shear (const Point& rRef, double tn, bool bVShear, const SdrObject* pObj); }; diff --git a/include/svx/svdhdl.hxx b/include/svx/svdhdl.hxx index e5cc1379ab94..707c1ddc5a48 100644 --- a/include/svx/svdhdl.hxx +++ b/include/svx/svdhdl.hxx @@ -143,7 +143,7 @@ protected: SdrHdlKind eKind; - tools::Long nRotationAngle; // turn handle or mousepointer + Degree100 nRotationAngle; // turn handle or mousepointer sal_uInt32 nObjHdlNum; // required by MarkView sal_uInt32 nPolyNum; // Polygonpoint sal_uInt32 nPPntNum; // Point number of the polygon @@ -207,7 +207,7 @@ public: void SetSelected(bool bJa=true); void Set1PixMore(bool bJa=true); - void SetRotationAngle(tools::Long n); + void SetRotationAngle(Degree100 n); bool IsCornerHdl() const { return eKind==SdrHdlKind::UpperLeft || eKind==SdrHdlKind::UpperRight || eKind==SdrHdlKind::LowerLeft || eKind==SdrHdlKind::LowerRight; } bool IsVertexHdl() const { return eKind==SdrHdlKind::Upper || eKind==SdrHdlKind::Lower || eKind==SdrHdlKind::Left || eKind==SdrHdlKind::Right; } diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx index 6f4581d1618a..1d849acd71cd 100644 --- a/include/svx/svdmodel.hxx +++ b/include/svx/svdmodel.hxx @@ -27,6 +27,7 @@ #include <rtl/ustring.hxx> #include <tools/weakbase.h> #include <svl/SfxBroadcaster.hxx> +#include <tools/degree.hxx> #include <tools/fldunit.hxx> #include <tools/fract.hxx> #include <svl/hint.hxx> @@ -385,7 +386,7 @@ public: static OUString GetUnitString(FieldUnit eUnit); OUString GetMetricString(tools::Long nVal, bool bNoUnitChars = false, sal_Int32 nNumDigits = -1) const; - static OUString GetAngleString(tools::Long nAngle); + static OUString GetAngleString(Degree100 nAngle); static OUString GetPercentString(const Fraction& rVal); // RecalcPageNums is ordinarily only called by the Page. diff --git a/include/svx/svdoashp.hxx b/include/svx/svdoashp.hxx index 2014e0998c2d..070cb2111dfd 100644 --- a/include/svx/svdoashp.hxx +++ b/include/svx/svdoashp.hxx @@ -168,16 +168,16 @@ public: virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; virtual void Move(const Size& rSiz) override; - virtual void Shear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear) override; + virtual void Shear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override; virtual void SetSnapRect(const tools::Rectangle& rRect) override; virtual void SetLogicRect(const tools::Rectangle& rRect) override; virtual void AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrinkOnly = false ) override; virtual void NbcMove(const Size& rSiz) override; virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override; - virtual void NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs) override; + virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override; virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override; - virtual void NbcShear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear) override; + virtual void NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override; virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override; virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override; diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index 335eb3d4dcb2..5beb682c6b32 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -27,6 +27,7 @@ #include <svl/lstner.hxx> #include <svl/poolitem.hxx> #include <svl/typedwhich.hxx> +#include <tools/degree.hxx> #include <svx/DiagramDataInterface.hxx> #include <svx/svdtypes.hxx> #include <svx/svdobjkind.hxx> @@ -536,18 +537,18 @@ public: virtual void NbcMove (const Size& rSiz); virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact); virtual void NbcCrop (const basegfx::B2DPoint& rRef, double fxFact, double fyFact); - virtual void NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs); + virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs); // Utility for call sites that don't have sin and cos handy - void NbcRotate(const Point& rRef, tools::Long nAngle); + void NbcRotate(const Point& rRef, Degree100 nAngle); virtual void NbcMirror(const Point& rRef1, const Point& rRef2); - virtual void NbcShear (const Point& rRef, tools::Long nAngle, double tn, bool bVShear); + virtual void NbcShear (const Point& rRef, Degree100 nAngle, double tn, bool bVShear); virtual void Move (const Size& rSiz); virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true); virtual void Crop (const basegfx::B2DPoint& rRef, double fxFact, double fyFact); - virtual void Rotate(const Point& rRef, tools::Long nAngle, double sn, double cs); + virtual void Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs); virtual void Mirror(const Point& rRef1, const Point& rRef2); - virtual void Shear (const Point& rRef, tools::Long nAngle, double tn, bool bVShear); + virtual void Shear (const Point& rRef, Degree100 nAngle, double tn, bool bVShear); /// The relative position of a SdrObject is the distance of the upper /// left corner of the logic bounding rectangle (SnapRect) to the anchor. @@ -580,8 +581,8 @@ public: virtual void AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrinkOnly = false ); // rotation and shear angle - virtual tools::Long GetRotateAngle() const; - virtual tools::Long GetShearAngle(bool bVertical = false) const; + virtual Degree100 GetRotateAngle() const; + virtual Degree100 GetShearAngle(bool bVertical = false) const; /// snap to special points of an Object (polygon points, center of circle) virtual sal_uInt32 GetSnapPointCount() const; @@ -678,7 +679,7 @@ public: // to be set temporarily when transforming related object(?) void SetGlueReallyAbsolute(bool bOn); - void NbcRotateGluePoints(const Point& rRef, tools::Long nAngle, double sn, double cs); + void NbcRotateGluePoints(const Point& rRef, Degree100 nAngle, double sn, double cs); void NbcMirrorGluePoints(const Point& rRef1, const Point& rRef2); void NbcShearGluePoints (const Point& rRef, double tn, bool bVShear); diff --git a/include/svx/svdocirc.hxx b/include/svx/svdocirc.hxx index 15c27ddbe10f..32ecc1f661b0 100644 --- a/include/svx/svdocirc.hxx +++ b/include/svx/svdocirc.hxx @@ -32,8 +32,8 @@ namespace sdr::properties { class SdrCircObjGeoData final : public SdrTextObjGeoData { public: - tools::Long nStartAngle; - tools::Long nEndAngle; + Degree100 nStartAngle; + Degree100 nEndAngle; }; enum class SdrCircKind { Full, Section, Cut, Arc }; @@ -51,10 +51,10 @@ private: virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override; SdrCircKind meCircleKind; - tools::Long nStartAngle; - tools::Long nEndAngle; + Degree100 nStartAngle; + Degree100 nEndAngle; - SVX_DLLPRIVATE basegfx::B2DPolygon ImpCalcXPolyCirc(const SdrCircKind eKind, const tools::Rectangle& rRect1, tools::Long nStart, tools::Long nEnd) const; + SVX_DLLPRIVATE basegfx::B2DPolygon ImpCalcXPolyCirc(const SdrCircKind eKind, const tools::Rectangle& rRect1, Degree100 nStart, Degree100 nEnd) const; SVX_DLLPRIVATE static void ImpSetCreateParams(SdrDragStat& rStat); SVX_DLLPRIVATE void ImpSetAttrToCircInfo(); // copy values from pool SVX_DLLPRIVATE void ImpSetCircInfoToAttr(); // copy values into pool @@ -86,8 +86,8 @@ public: SdrModel& rSdrModel, SdrCircKind eNewKind, const tools::Rectangle& rRect, - tools::Long nNewStartAngle, - tools::Long nNewEndWink); + Degree100 nNewStartAngle, + Degree100 nNewEndAngle); SdrCircKind GetCircleKind() const { return meCircleKind; } @@ -129,7 +129,7 @@ public: virtual void NbcMove(const Size& aSiz) override; virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override; virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override; - virtual void NbcShear (const Point& rRef, tools::Long nAngle, double tn, bool bVShear) override; + virtual void NbcShear (const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override; virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override; private: @@ -137,8 +137,8 @@ private: virtual void SaveGeoData(SdrObjGeoData& rGeo) const override; virtual void RestGeoData(const SdrObjGeoData& rGeo) override; public: - tools::Long GetStartAngle() const { return nStartAngle; } - tools::Long GetEndAngle() const { return nEndAngle; } + Degree100 GetStartAngle() const { return nStartAngle; } + Degree100 GetEndAngle() const { return nEndAngle; } }; diff --git a/include/svx/svdoedge.hxx b/include/svx/svdoedge.hxx index 5d0116cb97d8..0bda2fece64d 100644 --- a/include/svx/svdoedge.hxx +++ b/include/svx/svdoedge.hxx @@ -242,9 +242,9 @@ public: virtual void NbcResize(const Point& rRefPnt, const Fraction& aXFact, const Fraction& aYFact) override; // #i54102# added rotate, mirror and shear support - virtual void NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs) override; + virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override; virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override; - virtual void NbcShear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear) override; + virtual void NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override; // #102344# Added missing implementation virtual void NbcSetAnchorPos(const Point& rPnt) override; diff --git a/include/svx/svdogrp.hxx b/include/svx/svdogrp.hxx index 355b19242400..2083c8839438 100644 --- a/include/svx/svdogrp.hxx +++ b/include/svx/svdogrp.hxx @@ -80,15 +80,15 @@ public: virtual bool BegCreate(SdrDragStat& rStat) override; - virtual tools::Long GetRotateAngle() const override; - virtual tools::Long GetShearAngle(bool bVertical = false) const override; + virtual Degree100 GetRotateAngle() const override; + virtual Degree100 GetShearAngle(bool bVertical = false) const override; virtual void Move(const Size& rSiz) override; virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true) override; - virtual void Rotate(const Point& rRef, tools::Long nAngle, double sn, double cs) override; + virtual void Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override; virtual void Mirror(const Point& rRef1, const Point& rRef2) override; - virtual void Shear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear) override; + virtual void Shear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override; virtual void SetAnchorPos(const Point& rPnt) override; virtual void SetRelativePos(const Point& rPnt) override; virtual void SetSnapRect(const tools::Rectangle& rRect) override; @@ -97,9 +97,9 @@ public: virtual void NbcMove(const Size& rSiz) override; virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override; - virtual void NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs) override; + virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override; virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override; - virtual void NbcShear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear) override; + virtual void NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override; virtual void NbcSetAnchorPos(const Point& rPnt) override; virtual void NbcSetRelativePos(const Point& rPnt) override; virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override; diff --git a/include/svx/svdomeas.hxx b/include/svx/svdomeas.hxx index d72798e23111..ccc7d2a2f16b 100644 --- a/include/svx/svdomeas.hxx +++ b/include/svx/svdomeas.hxx @@ -113,10 +113,10 @@ public: virtual void NbcMove(const Size& rSiz) override; virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override; - virtual void NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs) override; + virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override; virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override; - virtual void NbcShear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear) override; - virtual tools::Long GetRotateAngle() const override; + virtual void NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override; + virtual Degree100 GetRotateAngle() const override; virtual void RecalcSnapRect() override; virtual sal_uInt32 GetSnapPointCount() const override; diff --git a/include/svx/svdopath.hxx b/include/svx/svdopath.hxx index 5f56fd38e5ae..f1a5b1b2b2aa 100644 --- a/include/svx/svdopath.hxx +++ b/include/svx/svdopath.hxx @@ -108,9 +108,9 @@ public: virtual void NbcMove(const Size& aSize) override; virtual void NbcResize(const Point& rRefPnt, const Fraction& aXFact, const Fraction& aYFact) override; - virtual void NbcRotate(const Point& rRefPnt, tools::Long nAngle, double fSin, double fCos) override; + virtual void NbcRotate(const Point& rRefPnt, Degree100 nAngle, double fSin, double fCos) override; virtual void NbcMirror(const Point& rRefPnt1, const Point& rRefPnt2) override; - virtual void NbcShear(const Point& rRefPnt, tools::Long nAngle, double fTan, bool bVShear) override; + virtual void NbcShear(const Point& rRefPnt, Degree100 nAngle, double fTan, bool bVShear) override; virtual sal_uInt32 GetSnapPointCount() const override; virtual Point GetSnapPoint(sal_uInt32 i) const override; diff --git a/include/svx/svdorect.hxx b/include/svx/svdorect.hxx index 9480acdb103a..930fb01ff626 100644 --- a/include/svx/svdorect.hxx +++ b/include/svx/svdorect.hxx @@ -112,9 +112,9 @@ public: virtual void NbcMove(const Size& rSiz) override; virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override; - virtual void NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs) override; + virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override; virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override; - virtual void NbcShear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear) override; + virtual void NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override; virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const override; virtual SdrGluePoint GetCornerGluePoint(sal_uInt16 nNum) const override; diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx index 9d74bffec93e..fc7a817b543a 100644 --- a/include/svx/svdotext.hxx +++ b/include/svx/svdotext.hxx @@ -454,8 +454,8 @@ public: virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override; virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override; virtual const tools::Rectangle& GetLogicRect() const override; - virtual tools::Long GetRotateAngle() const override; - virtual tools::Long GetShearAngle(bool bVertical = false) const override; + virtual Degree100 GetRotateAngle() const override; + virtual Degree100 GetShearAngle(bool bVertical = false) const override; virtual sal_uInt32 GetSnapPointCount() const override; virtual Point GetSnapPoint(sal_uInt32 i) const override; @@ -478,9 +478,9 @@ public: virtual void NbcMove(const Size& rSiz) override; virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override; - virtual void NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs) override; + virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override; virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override; - virtual void NbcShear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear) override; + virtual void NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override; virtual bool HasTextEdit() const override; // returns true if TextEditMode started diff --git a/include/svx/svdovirt.hxx b/include/svx/svdovirt.hxx index b47bc03ce3f3..12cd04095517 100644 --- a/include/svx/svdovirt.hxx +++ b/include/svx/svdovirt.hxx @@ -100,16 +100,16 @@ public: virtual void NbcMove(const Size& rSiz) override; virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override; - virtual void NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs) override; + virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override; virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override; - virtual void NbcShear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear) override; + virtual void NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override; virtual void Move(const Size& rSiz) override; virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true) override; - virtual void Rotate(const Point& rRef, tools::Long nAngle, double sn, double cs) override; + virtual void Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override; virtual void Mirror(const Point& rRef1, const Point& rRef2) override; - virtual void Shear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear) override; + virtual void Shear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override; virtual void RecalcSnapRect() override; virtual const tools::Rectangle& GetSnapRect() const override; @@ -120,8 +120,8 @@ public: virtual void SetLogicRect(const tools::Rectangle& rRect) override; virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override; - virtual tools::Long GetRotateAngle() const override; - virtual tools::Long GetShearAngle(bool bVertical = false) const override; + virtual Degree100 GetRotateAngle() const override; + virtual Degree100 GetShearAngle(bool bVertical = false) const override; virtual sal_uInt32 GetSnapPointCount() const override; virtual Point GetSnapPoint(sal_uInt32 i) const override; diff --git a/include/svx/svdpoev.hxx b/include/svx/svdpoev.hxx index 538e1012bf49..0ad7addd3a63 100644 --- a/include/svx/svdpoev.hxx +++ b/include/svx/svdpoev.hxx @@ -66,7 +66,7 @@ public: void MoveMarkedPoints(const Size& rSiz); void ResizeMarkedPoints(const Point& rRef, const Fraction& xFact, const Fraction& yFact); - void RotateMarkedPoints(const Point& rRef, tools::Long nAngle); + void RotateMarkedPoints(const Point& rRef, Degree100 nAngle); // This probably creates an arbitrary amount of new objects void RipUpAtMarkedPoints() override; diff --git a/include/svx/svdsnpv.hxx b/include/svx/svdsnpv.hxx index 19305837bcc4..b7b06e499590 100644 --- a/include/svx/svdsnpv.hxx +++ b/include/svx/svdsnpv.hxx @@ -23,6 +23,7 @@ #include <svx/svdpntv.hxx> #include <svx/svdhlpln.hxx> #include <svx/svxdllapi.h> +#include <tools/degree.hxx> #include <o3tl/typed_flags_set.hxx> /** @@ -104,8 +105,8 @@ protected: Fraction aSnapWdtY; sal_uInt16 nMagnSizPix; - tools::Long nSnapAngle; - tools::Long nEliminatePolyPointLimitAngle; + Degree100 nSnapAngle; + Degree100 nEliminatePolyPointLimitAngle; SdrCrookMode eCrookMode; @@ -220,8 +221,8 @@ public: // persistent. void SetAngleSnapEnabled(bool bOn) { bAngleSnapEnab=bOn; } bool IsAngleSnapEnabled() const { return bAngleSnapEnab; } - void SetSnapAngle(tools::Long nAngle) { nSnapAngle=nAngle; } - tools::Long GetSnapAngle() const { return nSnapAngle; } + void SetSnapAngle(Degree100 nAngle) { nSnapAngle=nAngle; } + Degree100 GetSnapAngle() const { return nSnapAngle; } // different effects from Ortho (depending on the context): // - Create @@ -280,8 +281,8 @@ public: // if its adjacent lines are almost a solid line. void SetEliminatePolyPoints(bool bOn) { bEliminatePolyPoints=bOn; } bool IsEliminatePolyPoints() const { return bEliminatePolyPoints; } - void SetEliminatePolyPointLimitAngle(tools::Long nAngle) { nEliminatePolyPointLimitAngle=nAngle; } - tools::Long GetEliminatePolyPointLimitAngle() const { return nEliminatePolyPointLimitAngle; } + void SetEliminatePolyPointLimitAngle(Degree100 nAngle) { nEliminatePolyPointLimitAngle=nAngle; } + Degree100 GetEliminatePolyPointLimitAngle() const { return nEliminatePolyPointLimitAngle; } }; #endif // INCLUDED_SVX_SVDSNPV_HXX diff --git a/include/svx/svdtrans.hxx b/include/svx/svdtrans.hxx index a5bd1e640bbf..ccc6308fc018 100644 --- a/include/svx/svdtrans.hxx +++ b/include/svx/svdtrans.hxx @@ -22,6 +22,7 @@ #include <rtl/ustring.hxx> #include <svx/svxdllapi.h> +#include <tools/degree.hxx> #include <tools/fldunit.hxx> #include <tools/fract.hxx> #include <tools/gen.hxx> @@ -43,7 +44,7 @@ // To convert it back, we use division. // That maximum shear angle -#define SDRMAXSHEAR 8900 +constexpr Degree100 SDRMAXSHEAR(8900); class XPolygon; class XPolyPolygon; @@ -159,13 +160,13 @@ inline double GetCrookAngle(Point& rPnt, const Point& rCenter, const Point& rRad * @return the returned value is in the range of -180.00..179.99 deg * and is in 1/100 deg units */ -SVXCORE_DLLPUBLIC tools::Long GetAngle(const Point& rPnt); +SVXCORE_DLLPUBLIC Degree100 GetAngle(const Point& rPnt); -tools::Long NormAngle18000(tools::Long a); /// Normalize angle to -180.00..179.99 +Degree100 NormAngle18000(Degree100 a); /// Normalize angle to -180.00..179.99 -SVXCORE_DLLPUBLIC tools::Long NormAngle36000(tools::Long a); /// Normalize angle to 0.00..359.99 +SVXCORE_DLLPUBLIC Degree100 NormAngle36000(Degree100 a); /// Normalize angle to 0.00..359.99 -sal_uInt16 GetAngleSector(tools::Long nAngle); /// Determine sector within the cartesian coordinate system +sal_uInt16 GetAngleSector(Degree100 nAngle); /// Determine sector within the cartesian coordinate system /** * Calculates the length of (0,0) via a^2 + b^2 = c^2 @@ -213,8 +214,8 @@ tools::Long GetLen(const Point& rPnt); class GeoStat { // Geometric state for a rect public: - tools::Long nRotationAngle; - tools::Long nShearAngle; + Degree100 nRotationAngle; + Degree100 nShearAngle; double mfTanShearAngle; // tan(nShearAngle) double mfSinRotationAngle; // sin(nRotationAngle) double mfCosRotationAngle; // cos(nRotationAngle) diff --git a/include/svx/sxciaitm.hxx b/include/svx/sxciaitm.hxx index f14ba75288e7..9d77c18e37b3 100644 --- a/include/svx/sxciaitm.hxx +++ b/include/svx/sxciaitm.hxx @@ -22,12 +22,12 @@ #include <svx/svddef.hxx> #include <svx/sdangitm.hxx> -inline SdrAngleItem makeSdrCircStartAngleItem(tools::Long nAngle) +inline SdrAngleItem makeSdrCircStartAngleItem(Degree100 nAngle) { return SdrAngleItem(SDRATTR_CIRCSTARTANGLE, nAngle); } -inline SdrAngleItem makeSdrCircEndAngleItem(tools::Long nAngle) +inline SdrAngleItem makeSdrCircEndAngleItem(Degree100 nAngle) { return SdrAngleItem(SDRATTR_CIRCENDANGLE, nAngle); } diff --git a/include/svx/sxmtfitm.hxx b/include/svx/sxmtfitm.hxx index 6591ff2eb40a..2e89ebebd127 100644 --- a/include/svx/sxmtfitm.hxx +++ b/include/svx/sxmtfitm.hxx @@ -42,7 +42,7 @@ public: //Angle of the text in 1/100deg. 0=horizontal; read from left to right. (n.i.) class SdrMeasureTextFixedAngleItem: public SdrAngleItem { public: - SdrMeasureTextFixedAngleItem(tools::Long nVal=0): SdrAngleItem(SDRATTR_MEASURETEXTFIXEDANGLE,nVal) {} + SdrMeasureTextFixedAngleItem(Degree100 nVal=0_deg100): SdrAngleItem(SDRATTR_MEASURETEXTFIXEDANGLE,nVal) {} virtual ~SdrMeasureTextFixedAngleItem() override; virtual SdrMeasureTextFixedAngleItem* Clone(SfxItemPool* pPool=nullptr) const override; diff --git a/include/tools/degree.hxx b/include/tools/degree.hxx index 27bdffaa5de1..47dc7a8d98a7 100644 --- a/include/tools/degree.hxx +++ b/include/tools/degree.hxx @@ -10,6 +10,7 @@ #include <sal/types.h> #include <o3tl/strong_int.hxx> +#include <cstdlib> #include <math.h> /** tenths of a Degree, normally rotation */ @@ -18,10 +19,27 @@ typedef o3tl::strong_int<sal_Int16, struct Degree10Tag> Degree10; /** custom literal */ constexpr Degree10 operator""_deg10(unsigned long long n) { return Degree10{ n }; } +/** hundredths of a Degree, normally rotation */ +typedef o3tl::strong_int<sal_Int32, struct Degree100Tag> Degree100; + +// Android has trouble calling the correct overload of std::abs +#ifdef ANDROID +inline Degree100 abs(Degree100 x) { return Degree100(std::abs(static_cast<int>(x.get()))); } +#else +inline Degree100 abs(Degree100 x) { return Degree100(std::abs(x.get())); } +#endif + +/** custom literal */ +constexpr Degree100 operator""_deg100(unsigned long long n) { return Degree100{ n }; } + /** conversion functions */ -inline sal_Int32 toDegree100(Degree10 x) { return x.get() * 10; } -inline double toRadians(Degree10 x) { return x.get() * M_PI / 1800.0; } +inline Degree100 toDegree100(Degree10 x) { return Degree100(x.get() * 10); } +inline double toRadians(Degree10 x) { return x.get() * (M_PI / 1800.0); } inline double toDegrees(Degree10 x) { return x.get() / 10.0; } +inline Degree10 toDegree10(Degree100 x) { return Degree10((x.get() + 5) / 10); } +inline double toRadians(Degree100 x) { return x.get() * (M_PI / 18000.0); } +inline double toDegrees(Degree100 x) { return x.get() / 100.0; } + /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index ce30b436ffec..98ef5de040b7 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1048,7 +1048,7 @@ Reference< XShape > const & Shape::createAndInsert( aShapeProps.assignUsed( getShapeProperties() ); aShapeProps.assignUsed( maDefaultShapeProperties ); if(mnRotation != 0 && bIsCustomShape) - aShapeProps.setProperty( PROP_RotateAngle, sal_Int32( NormAngle36000( mnRotation / -600 ) )); + aShapeProps.setProperty( PROP_RotateAngle, sal_Int32( NormAngle36000( Degree100(mnRotation / -600) ) )); if ( bIsEmbMedia || aServiceName == "com.sun.star.drawing.GraphicObjectShape" || aServiceName == "com.sun.star.drawing.OLE2Shape" || bIsCustomShape ) mpGraphicPropertiesPtr->pushToPropMap( aShapeProps, rGraphicHelper ); if ( mpTablePropertiesPtr && aServiceName == "com.sun.star.drawing.TableShape" ) @@ -1486,7 +1486,8 @@ Reference< XShape > const & Shape::createAndInsert( if ( !bUseRotationTransform && (mnRotation != 0 || nCameraRotation != 0) ) { // use the same logic for rotation from VML exporter (SimpleShape::implConvertAndInsert at vmlshape.cxx) - aPropertySet.setAnyProperty( PROP_RotateAngle, makeAny( sal_Int32( NormAngle36000( (mnRotation - nCameraRotation) / -600 ) ) ) ); + Degree100 nAngle = NormAngle36000( Degree100((mnRotation - nCameraRotation) / -600) ); + aPropertySet.setAnyProperty( PROP_RotateAngle, makeAny( sal_Int32( nAngle.get() ) ) ); aPropertySet.setAnyProperty( PROP_HoriOrientPosition, makeAny( maPosition.X ) ); aPropertySet.setAnyProperty( PROP_VertOrientPosition, makeAny( maPosition.Y ) ); } diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 0571aeed7d93..da3edf2169c7 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1717,8 +1717,8 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa { SAL_INFO("oox.shape", "write shape transformation"); - sal_Int32 nRotation = 0; - sal_Int32 nCameraRotation = 0; + Degree100 nRotation; + Degree100 nCameraRotation; awt::Point aPos = rXShape->getPosition(); awt::Size aSize = rXShape->getSize(); @@ -1741,22 +1741,26 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa if (!bSuppressRotation) { SdrObject* pShape = GetSdrObjectFromXShape( rXShape ); - nRotation = pShape ? pShape->GetRotateAngle() : 0; + nRotation = pShape ? pShape->GetRotateAngle() : 0_deg100; if ( GetDocumentType() != DOCUMENT_DOCX ) { int faccos=bFlipV ? -1 : 1; int facsin=bFlipH ? -1 : 1; - aPos.X-=(1-faccos*cos(nRotation*F_PI18000))*aSize.Width/2-facsin*sin(nRotation*F_PI18000)*aSize.Height/2; - aPos.Y-=(1-faccos*cos(nRotation*F_PI18000))*aSize.Height/2+facsin*sin(nRotation*F_PI18000)*aSize.Width/2; + aPos.X-=(1-faccos*cos(nRotation.get()*F_PI18000))*aSize.Width/2-facsin*sin(nRotation.get()*F_PI18000)*aSize.Height/2; + aPos.Y-=(1-faccos*cos(nRotation.get()*F_PI18000))*aSize.Height/2+facsin*sin(nRotation.get()*F_PI18000)*aSize.Width/2; } // The RotateAngle property's value is independent from any flipping, and that's exactly what we need here. uno::Reference<beans::XPropertySet> xPropertySet(rXShape, uno::UNO_QUERY); uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo(); if (xPropertySetInfo->hasPropertyByName("RotateAngle")) - xPropertySet->getPropertyValue("RotateAngle") >>= nRotation; + { + sal_Int32 nTmp; + if (xPropertySet->getPropertyValue("RotateAngle") >>= nTmp) + nRotation = Degree100(nTmp); + } // tdf#133037: restore original rotate angle before output - if (nRotation != 0 && xPropertySetInfo->hasPropertyByName(UNO_NAME_MISC_OBJ_INTEROPGRABBAG)) + if (nRotation && xPropertySetInfo->hasPropertyByName(UNO_NAME_MISC_OBJ_INTEROPGRABBAG)) { uno::Sequence<beans::PropertyValue> aGrabBagProps; xPropertySet->getPropertyValue(UNO_NAME_MISC_OBJ_INTEROPGRABBAG) >>= aGrabBagProps; @@ -1776,8 +1780,9 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa [](const PropertyValue& rProp) { return rProp.Name == "rotRev"; }); if (pZRotationProp != std::cend(aCameraProps)) { - pZRotationProp->Value >>= nCameraRotation; - nCameraRotation = NormAngle36000(nCameraRotation / -600); + sal_Int32 nTmp; + pZRotationProp->Value >>= nTmp; + nCameraRotation = NormAngle36000(Degree100(nTmp / -600)); } } } @@ -1786,7 +1791,7 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa // OOXML flips shapes before rotating them. if(bFlipH != bFlipV) - nRotation = nRotation * -1 + 36000; + nRotation = Degree100(nRotation.get() * -1 + 36000); WriteTransformation(tools::Rectangle(Point(aPos.X, aPos.Y), Size(aSize.Width, aSize.Height)), nXmlNamespace, bFlipHWrite, bFlipVWrite, ExportRotateClockwisify(nRotation + nCameraRotation), IsGroupShape( rXShape )); @@ -4981,8 +4986,8 @@ void DrawingML::WriteFromTo(const uno::Reference<css::drawing::XShape>& rXShape, SdrObject* pObj = SdrObject::getSdrObjectFromXShape(rXShape.get()); if (pObj) { - sal_Int32 nRotation = pObj->GetRotateAngle(); - if (nRotation != 0) + Degree100 nRotation = pObj->GetRotateAngle(); + if (nRotation) { sal_Int16 nHalfWidth = aSize.Width / 2; sal_Int16 nHalfHeight = aSize.Height / 2; @@ -4997,7 +5002,7 @@ void DrawingML::WriteFromTo(const uno::Reference<css::drawing::XShape>& rXShape, // MSO changes the anchor positions at these angles and that does an extra 90 degrees // rotation on our shapes, so we output it in such position that MSO // can draw this shape correctly. - if ((nRotation >= 45 * 100 && nRotation < 135 * 100) || (nRotation >= 225 * 100 && nRotation < 315 * 100)) + if ((nRotation >= 4500_deg100 && nRotation < 13500_deg100) || (nRotation >= 22500_deg100 && nRotation < 31500_deg100)) { aTopLeft.X = aTopLeft.X - nHalfHeight + nHalfWidth; aTopLeft.Y = aTopLeft.Y - nHalfWidth + nHalfHeight; diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx index 5a4210572e51..834dc9f5a730 100644 --- a/oox/source/shape/WpsContext.cxx +++ b/oox/source/shape/WpsContext.cxx @@ -84,8 +84,8 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken // If the text is not rotated the way the shape wants it already, set the angle. const sal_Int32 nRotation = nVert == XML_vert270 ? -270 : -90; - if (static_cast<tools::Long>(basegfx::rad2deg(fRotate)) - != NormAngle36000(static_cast<tools::Long>(nRotation) * 100) / 100) + if (static_cast<sal_Int32>(basegfx::rad2deg(fRotate)) + != NormAngle36000(Degree100(nRotation * 100)).get() / 100) { comphelper::SequenceAsHashMap aCustomShapeGeometry( xPropertySet->getPropertyValue("CustomShapeGeometry")); diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index 62da5dedf10f..60ef7f900d15 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -118,16 +118,16 @@ double ConversionHelper::decodePercent( const OUString& rValue, double fDefValue return fDefValue; } -sal_Int32 ConversionHelper::decodeRotation( const OUString& rValue ) +Degree100 ConversionHelper::decodeRotation( const OUString& rValue ) { if( rValue.isEmpty() ) - return 0; + return 0_deg100; double fValue = 0.0; double fRotation = 0.0; sal_Int32 nEndPos = 0; if( !lclExtractDouble(fValue, nEndPos, rValue) ) - return 0; + return 0_deg100; if( nEndPos == rValue.getLength() ) fRotation = fValue; @@ -136,10 +136,10 @@ sal_Int32 ConversionHelper::decodeRotation( const OUString& rValue ) else { OSL_FAIL("ConversionHelper::decodeRotation - unknown measure unit"); - return 0; + return 0_deg100; } - return NormAngle36000(fRotation * -100); + return NormAngle36000(Degree100(static_cast<sal_Int32>(fRotation * -100))); } sal_Int64 ConversionHelper::decodeMeasureToEmu( const GraphicHelper& rGraphicHelper, diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 5b081660148d..32c1ec93ed49 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -405,7 +405,7 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS } if(!maTypeModel.maRotation.isEmpty()) - aGrabBag.push_back(comphelper::makePropertyValue("mso-rotation-angle", ConversionHelper::decodeRotation(maTypeModel.maRotation))); + aGrabBag.push_back(comphelper::makePropertyValue("mso-rotation-angle", ConversionHelper::decodeRotation(maTypeModel.maRotation).get())); propertySet->setPropertyValue("FrameInteropGrabBag", uno::makeAny(comphelper::containerToSequence(aGrabBag))); sal_Int32 backColorTransparency = 0; propertySet->getPropertyValue("BackColorTransparency") @@ -685,7 +685,7 @@ static void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rType Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const { awt::Rectangle aShapeRect(rShapeRect); - std::optional<sal_Int32> oRotation; + std::optional<Degree100> oRotation; bool bFlipX = false, bFlipY = false; // tdf#137765: skip this rotation for line shapes if (!maTypeModel.maRotation.isEmpty() && maService != "com.sun.star.drawing.LineShape") @@ -840,7 +840,7 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes { if (oRotation) { - aPropertySet.setAnyProperty(PROP_RotateAngle, makeAny(*oRotation)); + aPropertySet.setAnyProperty(PROP_RotateAngle, makeAny((*oRotation).get())); uno::Reference<lang::XServiceInfo> xServiceInfo(rxShapes, uno::UNO_QUERY); if (!xServiceInfo->supportsService("com.sun.star.drawing.GroupShape")) { @@ -947,7 +947,7 @@ Reference< XShape > SimpleShape::createPictureObject(const Reference< XShapes >& } // fdo#70457: preserve rotation information if ( !maTypeModel.maRotation.isEmpty() ) - aPropSet.setAnyProperty(PROP_RotateAngle, makeAny(ConversionHelper::decodeRotation(maTypeModel.maRotation))); + aPropSet.setAnyProperty(PROP_RotateAngle, makeAny(ConversionHelper::decodeRotation(maTypeModel.maRotation).get())); const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper(); lcl_SetAnchorType(aPropSet, maTypeModel, rGraphicHelper); @@ -1082,7 +1082,7 @@ namespace // -1 is required because the direction of MSO rotation is the opposite of ours // 100 is required because in this part of the code the angle is in a hundredth of // degrees. - auto nAngle = -1 * 100.0 * rTypeModel.maRotation.toDouble(); + Degree100 nAngle( static_cast<sal_Int32>(-1 * 100.0 * rTypeModel.maRotation.toDouble()) ); pShape->NbcRotate(pShape->GetSnapRect().Center(), nAngle); } } @@ -1535,7 +1535,7 @@ Reference< XShape > GroupShape::implConvertAndInsert( const Reference< XShapes > const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper(); lcl_SetAnchorType(aPropertySet, maTypeModel, rGraphicHelper); if (!maTypeModel.maRotation.isEmpty()) - aPropertySet.setAnyProperty(PROP_RotateAngle, makeAny(ConversionHelper::decodeRotation(maTypeModel.maRotation))); + aPropertySet.setAnyProperty(PROP_RotateAngle, makeAny(ConversionHelper::decodeRotation(maTypeModel.maRotation).get())); return xGroupShape; } diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx index d0618c234c58..a1ea65141ae2 100644 --- a/reportdesign/source/ui/report/ReportSection.cxx +++ b/reportdesign/source/ui/report/ReportSection.cxx @@ -604,7 +604,7 @@ void OReportSection::createDefault(const OUString& _sType,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/sc/inc/attrib.hxx b/sc/inc/attrib.hxx index 4c9206af40aa..63025d90de30 100644 --- a/sc/inc/attrib.hxx +++ b/sc/inc/attrib.hxx @@ -288,7 +288,7 @@ private: class SC_DLLPUBLIC ScRotateValueItem final : public SdrAngleItem { public: - ScRotateValueItem(sal_Int32 nAngle); + ScRotateValueItem(Degree100 nAngle); virtual ScRotateValueItem* Clone(SfxItemPool* pPool=nullptr) const override; virtual bool GetPresentation( SfxItemPresentation ePresentation, diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx index 63e854edffbb..bfc162bfb657 100644 --- a/sc/inc/patattr.hxx +++ b/sc/inc/patattr.hxx @@ -23,6 +23,7 @@ #include <svl/poolitem.hxx> #include <svl/itemset.hxx> #include <svl/languageoptions.hxx> +#include <tools/degree.hxx> #include <editeng/svxenum.hxx> #include "scdllapi.h" #include "fonthelper.hxx" @@ -139,7 +140,7 @@ public: sal_uInt32 GetNumberFormat( SvNumberFormatter* pFormatter, const SfxItemSet* pCondSet ) const; - tools::Long GetRotateVal( const SfxItemSet* pCondSet ) const; + Degree100 GetRotateVal( const SfxItemSet* pCondSet ) const; ScRotateDir GetRotateDir( const SfxItemSet* pCondSet ) const; void SetKey(sal_uInt64 nKey); diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx index 14dc129e6951..344a26e28901 100644 --- a/sc/qa/unit/scshapetest.cxx +++ b/sc/qa/unit/scshapetest.cxx @@ -234,16 +234,17 @@ void ScShapeTest::testTdf137033_RotShear_ResizeHide() // Verify hiding has changed shape geometry as expected tools::Rectangle aSnapRect(pObj->GetSnapRect()); - tools::Long aRotateAngle(pObj->GetRotateAngle()); - tools::Long aShearAngle(pObj->GetShearAngle()); + Degree100 aRotateAngle(pObj->GetRotateAngle()); + Degree100 aShearAngle(pObj->GetShearAngle()); // mathematical exact would be Point(3868, 4795), Size(9763, 1909) // current values as of LO 7.2 const tools::Rectangle aExpectRect(Point(3871, 4796), Size(9764, 1910)); - const tools::Long aExpectRotateAngle(20923); - const tools::Long aExpectShearAngle(-6572); - CPPUNIT_ASSERT_MESSAGE("Hide rows, shear angle: ", abs(aShearAngle - aExpectShearAngle) <= 1); + const Degree100 aExpectRotateAngle(20923_deg100); + const Degree100 aExpectShearAngle(-6572_deg100); + CPPUNIT_ASSERT_MESSAGE("Hide rows, shear angle: ", + abs(aShearAngle - aExpectShearAngle) <= 1_deg100); CPPUNIT_ASSERT_MESSAGE("Hide rows, rotate angle: ", - abs(aRotateAngle - aExpectRotateAngle) <= 1); + abs(aRotateAngle - aExpectRotateAngle) <= 1_deg100); lcl_AssertRectEqualWithTolerance("Reload: wrong pos or size", aExpectRect, aSnapRect, 1); // Save and reload. @@ -269,8 +270,10 @@ void ScShapeTest::testTdf137033_RotShear_ResizeHide() aSnapRect = pObj->GetSnapRect(); aRotateAngle = pObj->GetRotateAngle(); aShearAngle = pObj->GetShearAngle(); - CPPUNIT_ASSERT_MESSAGE("Reload, shear angle: ", abs(aShearAngle - aExpectShearAngle) <= 3); - CPPUNIT_ASSERT_MESSAGE("Reload, rotate angle: ", abs(aRotateAngle - aExpectRotateAngle) <= 3); + CPPUNIT_ASSERT_MESSAGE("Reload, shear angle: ", + abs(aShearAngle - aExpectShearAngle) <= 3_deg100); + CPPUNIT_ASSERT_MESSAGE("Reload, rotate angle: ", + abs(aRotateAngle - aExpectRotateAngle) <= 3_deg100); lcl_AssertRectEqualWithTolerance("Reload: wrong pos or size", aExpectRect, aSnapRect, 4); pDocSh->DoClose(); diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 774f3eb7069a..cbf2267ce07e 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -5715,9 +5715,9 @@ void Test::testAnchoredRotatedShape() SdrRectObj *pObj = new SdrRectObj(*pDrawLayer, aRect); pPage->InsertObject(pObj); Point aRef1(pObj->GetSnapRect().Center()); - int nAngle = 9000; //90 deg. - double nSin = sin(nAngle * F_PI18000); - double nCos = cos(nAngle * F_PI18000); + Degree100 nAngle = 9000_deg100; //90 deg. + double nSin = sin(nAngle.get() * F_PI18000); + double nCos = cos(nAngle.get() * F_PI18000); pObj->Rotate(aRef1,nAngle,nSin,nCos); ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *m_pDoc, 0, true); diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index a44f00243ce4..da8490b72f99 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -1355,8 +1355,8 @@ bool ScAttrArray::HasAttrib_Impl(const ScPatternAttr* pPattern, HasAttrFlags nMa const ScRotateValueItem* pRotate = &pPattern->GetItem( ATTR_ROTATE_VALUE ); // 90 or 270 degrees is former SvxOrientationItem - only look for other values // (see ScPatternAttr::GetCellOrientation) - sal_Int32 nAngle = pRotate->GetValue(); - if ( nAngle != 0 && nAngle != 9000 && nAngle != 27000 ) + Degree100 nAngle = pRotate->GetValue(); + if ( nAngle && nAngle != 9000_deg100 && nAngle != 27000_deg100 ) bFound = true; } if ( nMask & HasAttrFlags::NeedHeight ) diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx index 1a155a8fa13d..cb39fec0b2f0 100644 --- a/sc/source/core/data/attrib.cxx +++ b/sc/source/core/data/attrib.cxx @@ -729,7 +729,7 @@ void ScCondFormatItem::dumpAsXml(xmlTextWriterPtr pWriter) const xmlTextWriterEndElement(pWriter); } -ScRotateValueItem::ScRotateValueItem(sal_Int32 nAngle) +ScRotateValueItem::ScRotateValueItem(Degree100 nAngle) : SdrAngleItem(ATTR_ROTATE_VALUE, nAngle) { } diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index d3d9910d9326..22d5a16de895 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -211,7 +211,7 @@ tools::Long ScColumn::GetNeededSize( if ( bWidth && bBreak ) // after determining bAsianVertical (bBreak may be reset) return 0; - tools::Long nRotate = 0; + Degree100 nRotate(0); SvxRotateMode eRotMode = SVX_ROTATE_MODE_STANDARD; if ( eOrient == SvxCellOrientation::Standard ) { @@ -228,7 +228,7 @@ tools::Long ScColumn::GetNeededSize( else eRotMode = pPattern->GetItem(ATTR_ROTATE_MODE).GetValue(); - if ( nRotate == 18000 ) + if ( nRotate == 18000_deg100 ) eRotMode = SVX_ROTATE_MODE_STANDARD; // no overflow } } @@ -237,7 +237,7 @@ tools::Long ScColumn::GetNeededSize( { // ignore orientation/rotation if "repeat" is active eOrient = SvxCellOrientation::Standard; - nRotate = 0; + nRotate = 0_deg100; bAsianVertical = false; } @@ -301,7 +301,7 @@ tools::Long ScColumn::GetNeededSize( { //TODO: take different X/Y scaling into consideration - double nRealOrient = nRotate * F_PI18000; // nRotate is in 1/100 Grad + double nRealOrient = nRotate.get() * F_PI18000; // nRotate is in 1/100 Grad double nCosAbs = fabs( cos( nRealOrient ) ); double nSinAbs = fabs( sin( nRealOrient ) ); tools::Long nHeight = static_cast<tools::Long>( aSize.Height() * nCosAbs + aSize.Width() * nSinAbs ); @@ -482,7 +482,7 @@ tools::Long ScColumn::GetNeededSize( //TODO: take different X/Y scaling into consideration Size aSize( pEngine->CalcTextWidth(), pEngine->GetTextHeight() ); - double nRealOrient = nRotate * F_PI18000; // nRotate is in 1/100 Grad + double nRealOrient = nRotate.get() * F_PI18000; // nRotate is in 1/100 Grad double nCosAbs = fabs( cos( nRealOrient ) ); double nSinAbs = fabs( sin( nRealOrient ) ); tools::Long nHeight = static_cast<tools::Long>( aSize.Height() * nCosAbs + aSize.Width() * nSinAbs ); diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx index 011b59613689..0a96c3b4ee5d 100644 --- a/sc/source/core/data/docpool.cxx +++ b/sc/source/core/data/docpool.cxx @@ -249,7 +249,7 @@ ScDocumentPool::ScDocumentPool() mvPoolDefaults[ ATTR_VER_JUSTIFY - ATTR_STARTINDEX ] = new SvxVerJustifyItem( SvxCellVerJustify::Standard, ATTR_VER_JUSTIFY); mvPoolDefaults[ ATTR_VER_JUSTIFY_METHOD - ATTR_STARTINDEX ] = new SvxJustifyMethodItem( SvxCellJustifyMethod::Auto, ATTR_VER_JUSTIFY_METHOD); mvPoolDefaults[ ATTR_STACKED - ATTR_STARTINDEX ] = new ScVerticalStackCell(false); - mvPoolDefaults[ ATTR_ROTATE_VALUE - ATTR_STARTINDEX ] = new ScRotateValueItem( 0 ); + mvPoolDefaults[ ATTR_ROTATE_VALUE - ATTR_STARTINDEX ] = new ScRotateValueItem( 0_deg100 ); mvPoolDefaults[ ATTR_ROTATE_MODE - ATTR_STARTINDEX ] = new SvxRotateModeItem( SVX_ROTATE_MODE_BOTTOM, ATTR_ROTATE_MODE ); mvPoolDefaults[ ATTR_VERTICAL_ASIAN - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_VERTICAL_ASIAN ); // The default for the ATTR_WRITINGDIR cell attribute must by SvxFrameDirection::Environment, diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index cb3212ece075..5bbdd06266ee 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -5184,8 +5184,8 @@ bool ScDocument::HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1, { // 90 or 270 degrees is former SvxOrientationItem - only look for other values // (see ScPatternAttr::GetCellOrientation) - sal_Int32 nAngle = static_cast<const ScRotateValueItem*>(pItem)->GetValue(); - if ( nAngle != 0 && nAngle != 9000 && nAngle != 27000 ) + Degree100 nAngle = static_cast<const ScRotateValueItem*>(pItem)->GetValue(); + if ( nAngle && nAngle != 9000_deg100 && nAngle != 27000_deg100 ) { bAnyItem = true; break; diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index 0a3433ba3d25..2f77588165d2 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -165,10 +165,10 @@ SvxCellOrientation ScPatternAttr::GetCellOrientation( const SfxItemSet& rItemSet } else { - sal_Int32 nAngle = GetItem( ATTR_ROTATE_VALUE, rItemSet, pCondSet ).GetValue(); - if( nAngle == 9000 ) + Degree100 nAngle = GetItem( ATTR_ROTATE_VALUE, rItemSet, pCondSet ).GetValue(); + if( nAngle == 9000_deg100 ) eOrient = SvxCellOrientation::BottomUp; - else if( nAngle == 27000 ) + else if( nAngle == 27000_deg100 ) eOrient = SvxCellOrientation::TopBottom; } @@ -1312,9 +1312,9 @@ const SfxPoolItem& ScPatternAttr::GetItem( sal_uInt16 nSubWhich, const SfxItemSe // GetRotateVal is tested before ATTR_ORIENTATION -tools::Long ScPatternAttr::GetRotateVal( const SfxItemSet* pCondSet ) const +Degree100 ScPatternAttr::GetRotateVal( const SfxItemSet* pCondSet ) const { - tools::Long nAttrRotate = 0; + Degree100 nAttrRotate(0); if ( GetCellOrientation() == SvxCellOrientation::Standard ) { bool bRepeat = ( GetItem(ATTR_HOR_JUSTIFY, pCondSet). @@ -1330,22 +1330,22 @@ ScRotateDir ScPatternAttr::GetRotateDir( const SfxItemSet* pCondSet ) const { ScRotateDir nRet = ScRotateDir::NONE; - tools::Long nAttrRotate = GetRotateVal( pCondSet ); + Degree100 nAttrRotate = GetRotateVal( pCondSet ); if ( nAttrRotate ) { SvxRotateMode eRotMode = GetItem(ATTR_ROTATE_MODE, pCondSet).GetValue(); - if ( eRotMode == SVX_ROTATE_MODE_STANDARD || nAttrRotate == 18000 ) + if ( eRotMode == SVX_ROTATE_MODE_STANDARD || nAttrRotate == 18000_deg100 ) nRet = ScRotateDir::Standard; else if ( eRotMode == SVX_ROTATE_MODE_CENTER ) nRet = ScRotateDir::Center; else if ( eRotMode == SVX_ROTATE_MODE_TOP || eRotMode == SVX_ROTATE_MODE_BOTTOM ) { - tools::Long nRot180 = nAttrRotate % 18000; // 1/100 degrees - if ( nRot180 == 9000 ) + Degree100 nRot180 = nAttrRotate % 18000_deg100; // 1/100 degrees + if ( nRot180 == 9000_deg100 ) nRet = ScRotateDir::Center; - else if ( ( eRotMode == SVX_ROTATE_MODE_TOP && nRot180 < 9000 ) || - ( eRotMode == SVX_ROTATE_MODE_BOTTOM && nRot180 > 9000 ) ) + else if ( ( eRotMode == SVX_ROTATE_MODE_TOP && nRot180 < 9000_deg100 ) || + ( eRotMode == SVX_ROTATE_MODE_BOTTOM && nRot180 > 9000_deg100 ) ) nRet = ScRotateDir::Left; else nRet = ScRotateDir::Right; diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index d8fb7fac5b0f..1ddf2993b170 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -2172,9 +2172,9 @@ SCSIZE ScTable::FillMaxRot( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCO double nFactor = 0.0; if ( nCol > nX2+1 ) { - tools::Long nRotVal = pPattern-> + Degree100 nRotVal = pPattern-> GetItem( ATTR_ROTATE_VALUE, pCondSet ).GetValue(); - double nRealOrient = nRotVal * F_PI18000; // 1/100 degree + double nRealOrient = nRotVal.get() * F_PI18000; // 1/100 degree double nCos = cos( nRealOrient ); double nSin = sin( nRealOrient ); //TODO: limit !!! diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx index f8bb63325318..c7d70f4ac82e 100644 --- a/sc/source/core/tool/autoform.cxx +++ b/sc/source/core/tool/autoform.cxx @@ -189,7 +189,7 @@ ScAutoFormatDataField::ScAutoFormatDataField() m_aStacked = std::make_unique<ScVerticalStackCell>(); m_aMargin = std::make_unique<SvxMarginItem>(ATTR_MARGIN); m_aLinebreak = std::make_unique<ScLineBreakCell>(); - m_aRotateAngle = std::make_unique<ScRotateValueItem>(0); + m_aRotateAngle = std::make_unique<ScRotateValueItem>(0_deg100); m_aRotateMode = std::make_unique<SvxRotateModeItem>(SVX_ROTATE_MODE_STANDARD, ATTR_ROTATE_MODE); } diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index 48bc5df23dc9..7a5626047c99 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -1489,7 +1489,7 @@ bool XclExpCellAlign::FillFromItemSet( else { // rotation - sal_Int32 nScRot = rItemSet.Get( ATTR_ROTATE_VALUE ).GetValue(); + Degree100 nScRot = rItemSet.Get( ATTR_ROTATE_VALUE ).GetValue(); mnRotation = XclTools::GetXclRotation( nScRot ); bUsed |= ScfTools::CheckItem( rItemSet, ATTR_ROTATE_VALUE, bStyle ); } diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index 16b64c8f2e0c..81cee0d9df63 100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -1202,18 +1202,18 @@ void XclImpChText::ConvertTitlePosition( const XclChTextKey& rTitleKey ) const // the call to XShape.getSize() may recalc the chart view css::awt::Size aTitleSize = xTitleShape->getSize(); // rotated titles need special handling... - sal_Int32 nScRot = XclTools::GetScRotation( GetRotation(), 0 ); - double fRad = nScRot * F_PI18000; + Degree100 nScRot = XclTools::GetScRotation( GetRotation(), 0_deg100 ); + double fRad = nScRot.get() * F_PI18000; double fSin = fabs( sin( fRad ) ); // calculate the title position from the values in the CHTEXT record css::awt::Point aTitlePos( CalcHmmFromChartX( maData.maRect.mnX ), CalcHmmFromChartY( maData.maRect.mnY ) ); // add part of height to X direction, if title is rotated down (clockwise) - if( nScRot > 18000 ) + if( nScRot > 18000_deg100 ) aTitlePos.X += static_cast< sal_Int32 >( fSin * aTitleSize.Height + 0.5 ); // add part of width to Y direction, if title is rotated up (counterclockwise) - else if( nScRot > 0 ) + else if( nScRot > 0_deg100 ) aTitlePos.Y += static_cast< sal_Int32 >( fSin * aTitleSize.Width + 0.5 ); // set the resulting position at the title shape xTitleShape->setPosition( aTitlePos ); diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index a4ceae554be5..0e46318a6838 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -1289,32 +1289,32 @@ void XclImpArcObj::DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal_uIn SdrObjectUniquePtr XclImpArcObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const tools::Rectangle& rAnchorRect ) const { tools::Rectangle aNewRect = rAnchorRect; - tools::Long nStartAngle = 0; - tools::Long nEndAngle = 0; + Degree100 nStartAngle; + Degree100 nEndAngle; switch( mnQuadrant ) { default: case EXC_OBJ_ARC_TR: - nStartAngle = 0; - nEndAngle = 9000; + nStartAngle = 0_deg100; + nEndAngle = 9000_deg100; aNewRect.AdjustLeft( -(rAnchorRect.GetWidth()) ); aNewRect.AdjustBottom(rAnchorRect.GetHeight() ); break; case EXC_OBJ_ARC_TL: - nStartAngle = 9000; - nEndAngle = 18000; + nStartAngle = 9000_deg100; + nEndAngle = 18000_deg100; aNewRect.AdjustRight(rAnchorRect.GetWidth() ); aNewRect.AdjustBottom(rAnchorRect.GetHeight() ); break; case EXC_OBJ_ARC_BL: - nStartAngle = 18000; - nEndAngle = 27000; + nStartAngle = 18000_deg100; + nEndAngle = 27000_deg100; aNewRect.AdjustRight(rAnchorRect.GetWidth() ); aNewRect.AdjustTop( -(rAnchorRect.GetHeight()) ); break; case EXC_OBJ_ARC_BR: - nStartAngle = 27000; - nEndAngle = 0; + nStartAngle = 27000_deg100; + nEndAngle = 0_deg100; aNewRect.AdjustLeft( -(rAnchorRect.GetWidth()) ); aNewRect.AdjustTop( -(rAnchorRect.GetHeight()) ); break; diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index 7a263bc9ed21..5a0ca78592d3 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -834,7 +834,7 @@ void XclImpCellAlign::FillToItemSet( SfxItemSet& rItemSet, const XclImpFont* pFo bool bStacked = (nXclRot == EXC_ROT_STACKED); ScfTools::PutItem( rItemSet, ScVerticalStackCell( bStacked ), bSkipPoolDefs ); // set an angle in the range from -90 to 90 degrees - sal_Int32 nAngle = XclTools::GetScRotation( nXclRot, 0 ); + Degree100 nAngle = XclTools::GetScRotation( nXclRot, 0_deg100 ); ScfTools::PutItem( rItemSet, ScRotateValueItem( nAngle ), bSkipPoolDefs ); // set "Use asian vertical layout", if cell is stacked and font contains CKJ characters bool bAsianVert = bStacked && pFont && pFont->HasAsianChars(); diff --git a/sc/source/filter/excel/xlchart.cxx b/sc/source/filter/excel/xlchart.cxx index 0355a56afafd..3503ba9567fe 100644 --- a/sc/source/filter/excel/xlchart.cxx +++ b/sc/source/filter/excel/xlchart.cxx @@ -897,7 +897,7 @@ sal_uInt16 XclChPropSetHelper::ReadRotationProperties( const ScfPropertySet& rPr rPropSet.GetProperty( fAngle, EXC_CHPROP_TEXTROTATION ); bool bStacked = bSupportsStacked && rPropSet.GetBoolProperty( EXC_CHPROP_STACKCHARACTERS ); return bStacked ? EXC_ROT_STACKED : - XclTools::GetXclRotation( static_cast< sal_Int32 >( fAngle * 100.0 + 0.5 ) ); + XclTools::GetXclRotation( Degree100(static_cast< sal_Int32 >( fAngle * 100.0 + 0.5 )) ); } // write properties ----------------------------------------------------------- @@ -1097,7 +1097,7 @@ void XclChPropSetHelper::WriteRotationProperties( if( nRotation != EXC_CHART_AUTOROTATION ) { // chart2 handles rotation as double in the range [0,360) - double fAngle = XclTools::GetScRotation( nRotation, 0 ) / 100.0; + double fAngle = XclTools::GetScRotation( nRotation, 0_deg100 ).get() / 100.0; rPropSet.SetProperty( EXC_CHPROP_TEXTROTATION, fAngle ); if( bSupportsStacked ) rPropSet.SetProperty( EXC_CHPROP_STACKCHARACTERS, nRotation == EXC_ROT_STACKED ); diff --git a/sc/source/filter/excel/xltools.cxx b/sc/source/filter/excel/xltools.cxx index ca0aeb278e1b..1c56279cdd63 100644 --- a/sc/source/filter/excel/xltools.cxx +++ b/sc/source/filter/excel/xltools.cxx @@ -150,17 +150,17 @@ bool XclTools::GetRKFromDouble( sal_Int32& rnRKValue, double fValue ) return false; } -sal_Int32 XclTools::GetScRotation( sal_uInt16 nXclRot, sal_Int32 nRotForStacked ) +Degree100 XclTools::GetScRotation( sal_uInt16 nXclRot, Degree100 nRotForStacked ) { if( nXclRot == EXC_ROT_STACKED ) return nRotForStacked; OSL_ENSURE( nXclRot <= 180, "XclTools::GetScRotation - illegal rotation angle" ); - return static_cast< sal_Int32 >( (nXclRot <= 180) ? (100 * ((nXclRot > 90) ? (450 - nXclRot) : nXclRot)) : 0 ); + return Degree100(static_cast< sal_Int32 >( (nXclRot <= 180) ? (100 * ((nXclRot > 90) ? (450 - nXclRot) : nXclRot)) : 0 )); } -sal_uInt8 XclTools::GetXclRotation( sal_Int32 nScRot ) +sal_uInt8 XclTools::GetXclRotation( Degree100 nScRot ) { - sal_Int32 nXclRot = nScRot / 100; + sal_Int32 nXclRot = nScRot.get() / 100; if( (0 <= nXclRot) && (nXclRot <= 90) ) return static_cast< sal_uInt8 >( nXclRot ); if( nXclRot < 180 ) diff --git a/sc/source/filter/html/htmlexp2.cxx b/sc/source/filter/html/htmlexp2.cxx index af00eddd462d..3ec4796e102b 100644 --- a/sc/source/filter/html/htmlexp2.cxx +++ b/sc/source/filter/html/htmlexp2.cxx @@ -133,7 +133,7 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE ) { const SdrGrafObj* pSGO = static_cast<SdrGrafObj*>(pObject); const SdrGrafObjGeoData* pGeo = static_cast<SdrGrafObjGeoData*>(pSGO->GetGeoData()); - sal_uInt16 nMirrorCase = (pGeo->aGeo.nRotationAngle == 18000 ? + sal_uInt16 nMirrorCase = (pGeo->aGeo.nRotationAngle == 18000_deg100 ? ( pGeo->bMirrored ? 3 : 4 ) : ( pGeo->bMirrored ? 2 : 1 )); bool bHMirr = ( ( nMirrorCase == 2 ) || ( nMirrorCase == 4 ) ); bool bVMirr = ( ( nMirrorCase == 3 ) || ( nMirrorCase == 4 ) ); diff --git a/sc/source/filter/inc/stylesbuffer.hxx b/sc/source/filter/inc/stylesbuffer.hxx index f52cad55f863..bb786d0963b6 100644 --- a/sc/source/filter/inc/stylesbuffer.hxx +++ b/sc/source/filter/inc/stylesbuffer.hxx @@ -290,7 +290,7 @@ struct ApiAlignmentData sal_Int32 mnVerJustify; /// Vertical alignment. sal_Int32 mnVerJustifyMethod; css::table::CellOrientation meOrientation; /// Normal or stacked text. - sal_Int32 mnRotation; /// Text rotation angle. + Degree100 mnRotation; /// Text rotation angle. sal_Int16 mnWritingMode; /// CTL text direction. sal_Int16 mnIndent; /// Indentation. bool mbWrapText; /// True = multi-line text. diff --git a/sc/source/filter/inc/xltools.hxx b/sc/source/filter/inc/xltools.hxx index 51f86fe8c44b..9b77c88e636f 100644 --- a/sc/source/filter/inc/xltools.hxx +++ b/sc/source/filter/inc/xltools.hxx @@ -24,6 +24,7 @@ #include "ftools.hxx" #include <tools/long.hxx> +#include <tools/degree.hxx> class SfxObjectShell; enum class FormulaError : sal_uInt16; @@ -108,9 +109,9 @@ public: /** Calculates an angle (in 1/100 of degrees) from an Excel angle value. @param nRotForStacked This value will be returned, if nXclRot contains 'stacked'. */ - static sal_Int32 GetScRotation( sal_uInt16 nXclRot, sal_Int32 nRotForStacked ); + static Degree100 GetScRotation( sal_uInt16 nXclRot, Degree100 nRotForStacked ); /** Calculates the Excel angle value from an angle in 1/100 of degrees. */ - static sal_uInt8 GetXclRotation( sal_Int32 nScRot ); + static sal_uInt8 GetXclRotation( Degree100 nScRot ); /** Calculates BIFF8 rotation angle from BIFF2-BIFF5 text orientation. */ static sal_uInt8 GetXclRotFromOrient( sal_uInt8 nXclOrient ); diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx index 21fef5944e61..e688a5221e48 100644 --- a/sc/source/filter/oox/stylesbuffer.cxx +++ b/sc/source/filter/oox/stylesbuffer.cxx @@ -1196,9 +1196,9 @@ void Alignment::finalizeImport() // rotation: 0-90 means 0 to 90 degrees ccw, 91-180 means 1 to 90 degrees cw, 255 means stacked sal_Int32 nOoxRot = maModel.mnRotation; - maApiData.mnRotation = ((0 <= nOoxRot) && (nOoxRot <= 90)) ? + maApiData.mnRotation = Degree100(((0 <= nOoxRot) && (nOoxRot <= 90)) ? (100 * nOoxRot) : - (((91 <= nOoxRot) && (nOoxRot <= 180)) ? (100 * (450 - nOoxRot)) : 0); + (((91 <= nOoxRot) && (nOoxRot <= 180)) ? (100 * (450 - nOoxRot)) : 0)); // "Orientation" property used for character stacking maApiData.meOrientation = (nOoxRot == OOX_XF_ROTATION_STACKED) ? @@ -2203,7 +2203,7 @@ Xf::createPattern( bool bSkipPoolDefs ) sal_Int32 nBorderId = maModel.mbBorderUsed ? maModel.mnBorderId : (pStyleXf ? pStyleXf->maModel.mnBorderId : -1); if( const Border* pBorder = rStyles.getBorder( nBorderId ).get() ) { - if( (pAlignment->getApiData().mnRotation != 0) && pBorder->getApiData().hasAnyOuterBorder() ) + if( (pAlignment->getApiData().mnRotation) && pBorder->getApiData().hasAnyOuterBorder() ) { meRotationRef = css::table::CellVertJustify2::BOTTOM; eRotateMode = SVX_ROTATE_MODE_BOTTOM; diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index da087a93c2f4..fa374c486ac2 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -866,10 +866,10 @@ XclTxo::XclTxo( const XclExpRoot& rRoot, const SdrTextObj& rTextObj ) : SetVerAlign( lcl_GetVerAlignFromItemSet( rItemSet ) ); // rotation - tools::Long nAngle = rTextObj.GetRotateAngle(); - if( (4500 < nAngle) && (nAngle < 13500) ) + Degree100 nAngle = rTextObj.GetRotateAngle(); + if( (4500_deg100 < nAngle) && (nAngle < 13500_deg100) ) mnRotation = EXC_OBJ_ORIENT_90CCW; - else if( (22500 < nAngle) && (nAngle < 31500) ) + else if( (22500_deg100 < nAngle) && (nAngle < 31500_deg100) ) mnRotation = EXC_OBJ_ORIENT_90CW; else mnRotation = EXC_OBJ_ORIENT_NONE; @@ -1095,8 +1095,8 @@ void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& SdrObject* pObj = SdrObject::getSdrObjectFromXShape(rShape.get()); if (pObj) { - sal_Int32 nRotation = pObj->GetRotateAngle(); - if (nRotation != 0) + Degree100 nRotation = pObj->GetRotateAngle(); + if (nRotation) { sal_Int16 nHalfWidth = aSize.Width / 2; sal_Int16 nHalfHeight = aSize.Height / 2; @@ -1111,7 +1111,7 @@ void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& // MSO changes the anchor positions at these angles and that does an extra 90 degrees // rotation on our shapes, so we output it in such position that MSO // can draw this shape correctly. - if ((nRotation >= 45 * 100 && nRotation < 135 * 100) || (nRotation >= 225 * 100 && nRotation < 315 * 100)) + if ((nRotation >= 4500_deg100 && nRotation < 13500_deg100) || (nRotation >= 22500_deg100 && nRotation < 31500_deg100)) { aTopLeft.X = aTopLeft.X - nHalfHeight + nHalfWidth; aTopLeft.Y = aTopLeft.Y - nHalfWidth + nHalfHeight; diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 5bc1ff24f0e8..768e42d4e279 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -3511,7 +3511,7 @@ void ScXMLExport::WriteShapes(const ScMyCell& rMyCell) if (pObj) { pObjData = ScDrawLayer::GetObjData(pObj); - bIsShapeTransformed = pObj->GetRotateAngle() != 0 || pObj->GetShearAngle() != 0; + bIsShapeTransformed = pObj->GetRotateAngle() != 0_deg100 || pObj->GetShearAngle() != 0_deg100; } if (bIsShapeTransformed && pObjData) aSnapStartAddress = pObjData->maStart; diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx index 0f6fd86a20ba..734e9e085302 100644 --- a/sc/source/ui/Accessibility/AccessibleCell.cxx +++ b/sc/source/ui/Accessibility/AccessibleCell.cxx @@ -190,7 +190,7 @@ tools::Rectangle ScAccessibleCell::GetBoundingBox() const if (mpDoc) { const ScRotateValueItem* pItem = mpDoc->GetAttr( maCellAddress, ATTR_ROTATE_VALUE ); - if( pItem && (pItem->GetValue() != 0) ) + if( pItem && (pItem->GetValue() != 0_deg100) ) { tools::Rectangle aParaRect = GetParagraphBoundingBox(); if( !aParaRect.IsEmpty() && (aCellRect.GetWidth() < aParaRect.GetWidth()) ) diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx index 3166fbd513a4..31f8586e1054 100644 --- a/sc/source/ui/Accessibility/AccessibleText.cxx +++ b/sc/source/ui/Accessibility/AccessibleText.cxx @@ -536,7 +536,7 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder() the cell bounding box in ScAccessibleCell::GetBoundingBox() (see sc/source/ui/Accessibility/AccessibleCell.cxx). */ const ScRotateValueItem* pItem = rDoc.GetAttr( aCellPos, ATTR_ROTATE_VALUE ); - if( pItem && (pItem->GetValue() != 0) ) + if( pItem && (pItem->GetValue() != 0_deg100) ) { pEditEngine->SetPaperSize( Size( LONG_MAX, aSize.getHeight() ) ); tools::Long nTxtWidth = static_cast< tools::Long >( pEditEngine->CalcTextWidth() ); diff --git a/sc/source/ui/drawfunc/fuconarc.cxx b/sc/source/ui/drawfunc/fuconarc.cxx index 368a1fd68c06..5d85181eb300 100644 --- a/sc/source/ui/drawfunc/fuconarc.cxx +++ b/sc/source/ui/drawfunc/fuconarc.cxx @@ -136,8 +136,8 @@ SdrObjectUniquePtr FuConstArc::CreateDefaultObject(const sal_uInt16 nID, const t pObj->SetLogicRect(aRect); SfxItemSet aAttr(pDrDoc->GetItemPool()); - aAttr.Put(makeSdrCircStartAngleItem(9000)); - aAttr.Put(makeSdrCircEndAngleItem(0)); + aAttr.Put(makeSdrCircStartAngleItem(9000_deg100)); + aAttr.Put(makeSdrCircEndAngleItem(0_deg100)); pObj->SetMergedItemSet(aAttr); } diff --git a/sc/source/ui/drawfunc/fuconcustomshape.cxx b/sc/source/ui/drawfunc/fuconcustomshape.cxx index 75edd8be6a6f..e73c6d99327e 100644 --- a/sc/source/ui/drawfunc/fuconcustomshape.cxx +++ b/sc/source/ui/drawfunc/fuconcustomshape.cxx @@ -180,7 +180,7 @@ void FuConstCustomShape::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/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx index 528b4ef770f4..f278d257552f 100644 --- a/sc/source/ui/inc/output.hxx +++ b/sc/source/ui/inc/output.hxx @@ -27,6 +27,7 @@ #include <tools/gen.hxx> #include <editeng/svxenum.hxx> #include <vcl/outdev.hxx> +#include <tools/degree.hxx> #include <o3tl/deleter.hxx> #include <optional> @@ -256,7 +257,7 @@ private: void ShrinkEditEngine( EditEngine& rEngine, const tools::Rectangle& rAlignRect, tools::Long nLeftM, tools::Long nTopM, tools::Long nRightM, tools::Long nBottomM, - bool bWidth, SvxCellOrientation nOrient, tools::Long nAttrRotate, bool bPixelToLogic, + bool bWidth, SvxCellOrientation nOrient, Degree100 nAttrRotate, bool bPixelToLogic, tools::Long& rEngineWidth, tools::Long& rEngineHeight, tools::Long& rNeededPixel, bool& rLeftClip, bool& rRightClip ); diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx index 7c51f5db9a2c..24396c7c6ae6 100644 --- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx @@ -155,7 +155,7 @@ IMPL_LINK(AlignmentPropertyPanel, ReferenceEdgeHdl, weld::ToggleButton&, rToggle IMPL_LINK_NOARG( AlignmentPropertyPanel, AngleModifiedHdl, weld::MetricSpinButton&, void ) { - sal_uInt32 nAngle = mxMtrAngle->get_value(FieldUnit::DEGREE) * 100; + Degree100 nAngle(mxMtrAngle->get_value(FieldUnit::DEGREE) * 100); ScRotateValueItem aAngleItem(nAngle); GetBindings()->GetDispatcher()->ExecuteList( @@ -345,8 +345,8 @@ void AlignmentPropertyPanel::NotifyItemUpdate( case SID_ATTR_ALIGN_DEGREES: if (eState >= SfxItemState::DEFAULT) { - tools::Long nTmp = static_cast<const ScRotateValueItem*>(pState)->GetValue(); - mxMtrAngle->set_value(nTmp / 100, FieldUnit::DEGREE); + Degree100 nTmp = static_cast<const ScRotateValueItem*>(pState)->GetValue(); + mxMtrAngle->set_value(nTmp.get() / 100, FieldUnit::DEGREE); } else { diff --git a/sc/source/ui/unoobj/afmtuno.cxx b/sc/source/ui/unoobj/afmtuno.cxx index 6dbf2c5e82d6..d56c6d545d0c 100644 --- a/sc/source/ui/unoobj/afmtuno.cxx +++ b/sc/source/ui/unoobj/afmtuno.cxx @@ -594,11 +594,11 @@ void SAL_CALL ScAutoFormatFieldObj::setPropertyValue( break; case table::CellOrientation_TOPBOTTOM: pData->PutItem( nFieldIndex, ScVerticalStackCell( false ) ); - pData->PutItem( nFieldIndex, ScRotateValueItem( 27000 ) ); + pData->PutItem( nFieldIndex, ScRotateValueItem( 27000_deg100 ) ); break; case table::CellOrientation_BOTTOMTOP: pData->PutItem( nFieldIndex, ScVerticalStackCell( false ) ); - pData->PutItem( nFieldIndex, ScRotateValueItem( 9000 ) ); + pData->PutItem( nFieldIndex, ScRotateValueItem( 9000_deg100 ) ); break; case table::CellOrientation_STACKED: pData->PutItem( nFieldIndex, ScVerticalStackCell( true ) ); @@ -684,7 +684,7 @@ uno::Any SAL_CALL ScAutoFormatFieldObj::getPropertyValue( const OUString& aPrope case ATTR_STACKED: { const ScRotateValueItem* pRotItem = pData->GetItem( nFieldIndex, ATTR_ROTATE_VALUE ); - sal_Int32 nRot = pRotItem ? pRotItem->GetValue() : 0; + Degree100 nRot = pRotItem ? pRotItem->GetValue() : 0_deg100; bool bStacked = static_cast<const ScVerticalStackCell*>(pItem)->GetValue(); SvxOrientationItem( nRot, bStacked, 0 ).QueryValue( aVal ); } diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 5ab47983f385..4647b2bd3b4e 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -2109,7 +2109,7 @@ static void lcl_SetCellProperty( const SfxItemPropertySimpleEntry& rEntry, const if ( nRotVal < 0 ) nRotVal += 36000; - rSet.Put( ScRotateValueItem( nRotVal ) ); + rSet.Put( ScRotateValueItem( Degree100(nRotVal) ) ); } break; @@ -2125,12 +2125,12 @@ static void lcl_SetCellProperty( const SfxItemPropertySimpleEntry& rEntry, const break; case table::CellOrientation_TOPBOTTOM: rSet.Put( ScVerticalStackCell( false ) ); - rSet.Put( ScRotateValueItem( 27000 ) ); + rSet.Put( ScRotateValueItem( 27000_deg100 ) ); rSecondItemId = ATTR_ROTATE_VALUE; break; case table::CellOrientation_BOTTOMTOP: rSet.Put( ScVerticalStackCell( false ) ); - rSet.Put( ScRotateValueItem( 9000 ) ); + rSet.Put( ScRotateValueItem( 9000_deg100 ) ); rSecondItemId = ATTR_ROTATE_VALUE; break; case table::CellOrientation_STACKED: @@ -2412,7 +2412,7 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE break; case ATTR_STACKED: { - sal_Int32 nRot = pDataSet->Get(ATTR_ROTATE_VALUE).GetValue(); + Degree100 nRot = pDataSet->Get(ATTR_ROTATE_VALUE).GetValue(); bool bStacked = static_cast<const ScVerticalStackCell&>(pDataSet->Get(pEntry->nWID)).GetValue(); SvxOrientationItem( nRot, bStacked, 0 ).QueryValue( rAny ); } diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx index 81db396a5f6f..8df4b3518314 100644 --- a/sc/source/ui/unoobj/styleuno.cxx +++ b/sc/source/ui/unoobj/styleuno.cxx @@ -1551,7 +1551,7 @@ void ScStyleObj::setPropertyValue_Impl( std::u16string_view rPropertyName, const nRotVal %= 36000; if (nRotVal < 0) nRotVal += 36000; - rSet.Put(ScRotateValueItem(nRotVal)); + rSet.Put(ScRotateValueItem(Degree100(nRotVal))); } } break; @@ -1567,11 +1567,11 @@ void ScStyleObj::setPropertyValue_Impl( std::u16string_view rPropertyName, const break; case table::CellOrientation_TOPBOTTOM: rSet.Put(ScVerticalStackCell(false)); - rSet.Put(ScRotateValueItem(27000)); + rSet.Put(ScRotateValueItem(27000_deg100)); break; case table::CellOrientation_BOTTOMTOP: rSet.Put(ScVerticalStackCell(false)); - rSet.Put(ScRotateValueItem(9000)); + rSet.Put(ScRotateValueItem(9000_deg100)); break; case table::CellOrientation_STACKED: rSet.Put(ScVerticalStackCell(true)); @@ -1811,7 +1811,7 @@ uno::Any ScStyleObj::getPropertyValue_Impl( std::u16string_view aPropertyName ) break; case ATTR_STACKED: { - sal_Int32 nRot = pItemSet->Get(ATTR_ROTATE_VALUE).GetValue(); + Degree100 nRot = pItemSet->Get(ATTR_ROTATE_VALUE).GetValue(); bool bStacked = static_cast<const ScVerticalStackCell&>(pItemSet->Get(nWhich)).GetValue(); SvxOrientationItem( nRot, bStacked, 0 ).QueryValue( aAny ); } diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index d46c996a4bd1..1da5dff9a3f8 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -650,9 +650,9 @@ void ScOutputData::SetCellRotations() if(nTargetX >= 0 && nTargetY >= 0) { // add rotation info to Array information - const tools::Long nAttrRotate(pPattern->GetRotateVal(pCondSet)); + const Degree100 nAttrRotate(pPattern->GetRotateVal(pCondSet)); const SvxRotateMode eRotMode(pPattern->GetItem(ATTR_ROTATE_MODE, pCondSet).GetValue()); - const double fOrient((bLayoutRTL ? -1.0 : 1.0) * nAttrRotate * F_PI18000); // 1/100th degrees -> [0..2PI] + const double fOrient((bLayoutRTL ? -1.0 : 1.0) * toRadians(nAttrRotate)); // 1/100th degrees -> [0..2PI] svx::frame::Array& rArray = mrTabInfo.maArray; rArray.SetCellRotation(nTargetX, nTargetY, eRotMode, fOrient); @@ -671,7 +671,7 @@ static ScRotateDir lcl_GetRotateDir( const ScDocument* pDoc, SCCOL nCol, SCROW n ScRotateDir nRet = ScRotateDir::NONE; - tools::Long nAttrRotate = pPattern->GetRotateVal( pCondSet ); + Degree100 nAttrRotate = pPattern->GetRotateVal( pCondSet ); if ( nAttrRotate ) { SvxRotateMode eRotMode = @@ -683,7 +683,7 @@ static ScRotateDir lcl_GetRotateDir( const ScDocument* pDoc, SCCOL nCol, SCROW n nRet = ScRotateDir::Center; else if ( eRotMode == SVX_ROTATE_MODE_TOP || eRotMode == SVX_ROTATE_MODE_BOTTOM ) { - tools::Long nRot180 = nAttrRotate % 18000; // 1/100 degree + tools::Long nRot180 = nAttrRotate.get() % 18000; // 1/100 degree if ( nRot180 == 9000 ) nRet = ScRotateDir::Center; else if ( ( eRotMode == SVX_ROTATE_MODE_TOP && nRot180 < 9000 ) || @@ -1549,7 +1549,7 @@ void ScOutputData::DrawRotatedFrame(vcl::RenderContext& rRenderContext) //! LastPattern etc. - tools::Long nAttrRotate = pPattern->GetRotateVal( pCondSet ); + Degree100 nAttrRotate = pPattern->GetRotateVal( pCondSet ); SvxRotateMode eRotMode = pPattern->GetItem(ATTR_ROTATE_MODE, pCondSet).GetValue(); @@ -1578,7 +1578,7 @@ void ScOutputData::DrawRotatedFrame(vcl::RenderContext& rRenderContext) // inclusion of the sign here hasn't been decided yet // (if not, the extension of the non-rotated background must also be changed) - double nRealOrient = nLayoutSign * nAttrRotate * F_PI18000; // 1/100th degrees + double nRealOrient = nLayoutSign * toRadians(nAttrRotate); // 1/100th degrees double nCos = cos(nRealOrient); double nSin = sin(nRealOrient); //! restrict !!! diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index a790cb8c4a17..764919b9d37a 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -360,7 +360,7 @@ void ScDrawStringsVars::SetPattern( { case SvxCellOrientation::Standard: nRot = 0; - bRotated = pPattern->GetItem( ATTR_ROTATE_VALUE, pCondSet ).GetValue() != 0 && + bRotated = pPattern->GetItem( ATTR_ROTATE_VALUE, pCondSet ).GetValue() != 0_deg100 && !bRepeat; break; case SvxCellOrientation::Stacked: @@ -2209,7 +2209,7 @@ static void lcl_ScaleFonts( EditEngine& rEngine, tools::Long nPercent ) rEngine.SetUpdateMode( true ); } -static tools::Long lcl_GetEditSize( EditEngine& rEngine, bool bWidth, bool bSwap, tools::Long nAttrRotate ) +static tools::Long lcl_GetEditSize( EditEngine& rEngine, bool bWidth, bool bSwap, Degree100 nAttrRotate ) { if ( bSwap ) bWidth = !bWidth; @@ -2221,7 +2221,7 @@ static tools::Long lcl_GetEditSize( EditEngine& rEngine, bool bWidth, bool bSwap // assuming standard mode, otherwise width isn't used - double nRealOrient = nAttrRotate * F_PI18000; // 1/100th degrees + double nRealOrient = toRadians(nAttrRotate); // 1/100th degrees double nAbsCos = fabs( cos( nRealOrient ) ); double nAbsSin = fabs( sin( nRealOrient ) ); if ( bWidth ) @@ -2237,7 +2237,7 @@ static tools::Long lcl_GetEditSize( EditEngine& rEngine, bool bWidth, bool bSwap void ScOutputData::ShrinkEditEngine( EditEngine& rEngine, const tools::Rectangle& rAlignRect, tools::Long nLeftM, tools::Long nTopM, tools::Long nRightM, tools::Long nBottomM, - bool bWidth, SvxCellOrientation nOrient, tools::Long nAttrRotate, bool bPixelToLogic, + bool bWidth, SvxCellOrientation nOrient, Degree100 nAttrRotate, bool bPixelToLogic, tools::Long& rEngineWidth, tools::Long& rEngineHeight, tools::Long& rNeededPixel, bool& rLeftClip, bool& rRightClip ) { if ( !bWidth ) @@ -2815,13 +2815,13 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam) bool bRepeat = (rParam.meHorJustAttr == SvxCellHorJustify::Repeat && !rParam.mbBreak); bool bShrink = !rParam.mbBreak && !bRepeat && lcl_GetBoolValue(*rParam.mpPattern, ATTR_SHRINKTOFIT, rParam.mpCondSet); - tools::Long nAttrRotate = lcl_GetValue<ScRotateValueItem, long>(*rParam.mpPattern, ATTR_ROTATE_VALUE, rParam.mpCondSet); + Degree100 nAttrRotate = lcl_GetValue<ScRotateValueItem, Degree100>(*rParam.mpPattern, ATTR_ROTATE_VALUE, rParam.mpCondSet); if ( rParam.meHorJustAttr == SvxCellHorJustify::Repeat ) { // ignore orientation/rotation if "repeat" is active rParam.meOrient = SvxCellOrientation::Standard; - nAttrRotate = 0; + nAttrRotate = 0_deg100; // #i31843# "repeat" with "line breaks" is treated as default alignment // (but rotation is still disabled). @@ -2937,7 +2937,7 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam) { ShrinkEditEngine( *rParam.mpEngine, aAreaParam.maAlignRect, nLeftM, nTopM, nRightM, nBottomM, true, - rParam.meOrient, 0, rParam.mbPixelToLogic, + rParam.meOrient, 0_deg100, rParam.mbPixelToLogic, nEngineWidth, nEngineHeight, nNeededPixel, aAreaParam.mbLeftClip, aAreaParam.mbRightClip ); } @@ -3307,7 +3307,7 @@ void ScOutputData::DrawEditBottomTop(DrawEditParam& rParam) { ShrinkEditEngine( *rParam.mpEngine, aAreaParam.maAlignRect, nLeftM, nTopM, nRightM, nBottomM, false, - (rParam.meOrient), 0, rParam.mbPixelToLogic, + (rParam.meOrient), 0_deg100, rParam.mbPixelToLogic, nEngineWidth, nEngineHeight, nNeededPixel, aAreaParam.mbLeftClip, aAreaParam.mbRightClip ); } @@ -3550,7 +3550,7 @@ void ScOutputData::DrawEditTopBottom(DrawEditParam& rParam) { ShrinkEditEngine( *rParam.mpEngine, aAreaParam.maAlignRect, nLeftM, nTopM, nRightM, nBottomM, false, - rParam.meOrient, 0, rParam.mbPixelToLogic, + rParam.meOrient, 0_deg100, rParam.mbPixelToLogic, nEngineWidth, nEngineHeight, nNeededPixel, aAreaParam.mbLeftClip, aAreaParam.mbRightClip ); } @@ -3805,7 +3805,7 @@ void ScOutputData::DrawEditStacked(DrawEditParam& rParam) ShrinkEditEngine( *rParam.mpEngine, aAreaParam.maAlignRect, nLeftM, nTopM, nRightM, nBottomM, true, - rParam.meOrient, 0, rParam.mbPixelToLogic, + rParam.meOrient, 0_deg100, rParam.mbPixelToLogic, nEngineWidth, nEngineHeight, nNeededPixel, aAreaParam.mbLeftClip, aAreaParam.mbRightClip ); @@ -3990,7 +3990,7 @@ void ScOutputData::DrawEditAsianVertical(DrawEditParam& rParam) bool bHidden = false; bool bShrink = !rParam.mbBreak && lcl_GetBoolValue(*rParam.mpPattern, ATTR_SHRINKTOFIT, rParam.mpCondSet); - tools::Long nAttrRotate = lcl_GetValue<ScRotateValueItem, long>(*rParam.mpPattern, ATTR_ROTATE_VALUE, rParam.mpCondSet); + Degree100 nAttrRotate = lcl_GetValue<ScRotateValueItem, Degree100>(*rParam.mpPattern, ATTR_ROTATE_VALUE, rParam.mpCondSet); if (nAttrRotate) { @@ -4104,7 +4104,7 @@ void ScOutputData::DrawEditAsianVertical(DrawEditParam& rParam) { ShrinkEditEngine( *rParam.mpEngine, aAreaParam.maAlignRect, nLeftM, nTopM, nRightM, nBottomM, false, - rParam.meOrient, 0, rParam.mbPixelToLogic, + rParam.meOrient, 0_deg100, rParam.mbPixelToLogic, nEngineWidth, nEngineHeight, nNeededPixel, aAreaParam.mbLeftClip, aAreaParam.mbRightClip ); } @@ -4633,7 +4633,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) nOutHeight -= nTopM + nBottomM; // rotate here already, to adjust paper size for page breaks - tools::Long nAttrRotate = 0; + Degree100 nAttrRotate; double nSin = 0.0; double nCos = 1.0; SvxRotateMode eRotMode = SVX_ROTATE_MODE_STANDARD; @@ -4645,13 +4645,13 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) { eRotMode = pPattern->GetItem(ATTR_ROTATE_MODE, pCondSet).GetValue(); - if ( nAttrRotate == 18000 ) + if ( nAttrRotate == 18000_deg100 ) eRotMode = SVX_ROTATE_MODE_STANDARD; // no overflow if ( bLayoutRTL ) nAttrRotate = -nAttrRotate; - double nRealOrient = nAttrRotate * F_PI18000; // 1/100 degree + double nRealOrient = toRadians(nAttrRotate); // 1/100 degree nCos = cos( nRealOrient ); nSin = sin( nRealOrient ); } @@ -4998,11 +4998,11 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) OSL_ENSURE( eOrient == SvxCellOrientation::Standard && nAttrRotate, "DrawRotated: no rotation" ); - sal_Int16 nOriVal = 0; + Degree10 nOriVal = 0_deg10; if ( nAttrRotate ) { // attribute is 1/100, Font 1/10 degrees - nOriVal = nAttrRotate / 10; + nOriVal = toDegree10(nAttrRotate); double nAddX = 0.0; double nAddY = 0.0; @@ -5054,7 +5054,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) // bSimClip is not used here (because nOriVal is set) - pEngine->Draw( mpDev, aLogicStart, Degree10(nOriVal) ); + pEngine->Draw( mpDev, aLogicStart, nOriVal ); if (bMetaFile) mpDev->Pop(); 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 ) 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; } diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx index 1082ebc70d94..07114eedf59d 100644 --- a/sw/inc/dcontact.hxx +++ b/sw/inc/dcontact.hxx @@ -264,14 +264,14 @@ class SwDrawVirtObj final : public SdrVirtObj virtual void AddToHdlList(SdrHdlList& rHdlList) const override; virtual void NbcMove(const Size& rSiz) override; virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override; - virtual void NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs) override; + virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override; virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override; - virtual void NbcShear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear) override; + virtual void NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override; virtual void Move(const Size& rSiz) override; virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true) override; - virtual void Rotate(const Point& rRef, tools::Long nAngle, double sn, double cs) override; + virtual void Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override; virtual void Mirror(const Point& rRef1, const Point& rRef2) override; - virtual void Shear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear) override; + virtual void Shear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override; virtual void RecalcSnapRect() override; virtual const tools::Rectangle& GetSnapRect() const override; virtual void SetSnapRect(const tools::Rectangle& rRect) override; diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 3ae40ccde5a2..3d7fdc18120d 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -2393,7 +2393,7 @@ void SwDrawVirtObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fr SetRectsDirty(); } -void SwDrawVirtObj::NbcRotate(const Point& rRef, tools::Long nAngle, double sn, double cs) +void SwDrawVirtObj::NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) { rRefObj.NbcRotate(rRef - GetOffset(), nAngle, sn, cs); SetRectsDirty(); @@ -2405,7 +2405,7 @@ void SwDrawVirtObj::NbcMirror(const Point& rRef1, const Point& rRef2) SetRectsDirty(); } -void SwDrawVirtObj::NbcShear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear) +void SwDrawVirtObj::NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) { rRefObj.NbcShear(rRef - GetOffset(), nAngle, tn, bVShear); SetRectsDirty(); @@ -2427,7 +2427,7 @@ void SwDrawVirtObj::Resize(const Point& rRef, const Fraction& xFact, const Fract } } -void SwDrawVirtObj::Rotate(const Point& rRef, tools::Long nAngle, double sn, double cs) +void SwDrawVirtObj::Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs) { if(nAngle) { @@ -2446,7 +2446,7 @@ void SwDrawVirtObj::Mirror(const Point& rRef1, const Point& rRef2) SendUserCall(SdrUserCallType::Resize, aBoundRect0); } -void SwDrawVirtObj::Shear(const Point& rRef, tools::Long nAngle, double tn, bool bVShear) +void SwDrawVirtObj::Shear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) { if(nAngle) { diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index 31ddcf4dd727..a06f0e8415c3 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -378,20 +378,20 @@ bool SwVirtFlyDrawObj::HasLimitedRotation() const return ContainsSwGrfNode(); } -void SwVirtFlyDrawObj::Rotate(const Point& rRef, tools::Long nAngle, double sn, double cs) +void SwVirtFlyDrawObj::Rotate(const Point& rRef, Degree100 nAngle100, double sn, double cs) { if(ContainsSwGrfNode()) { // RotGrfFlyFrame: Here is where the positively completed rotate interaction is executed. // Rotation is in 1/100th degree and may be signed (!) - nAngle /= 10; + Degree10 nAngle10 = toDegree10(nAngle100); - while(nAngle < 0) + while(nAngle10 < 0_deg10) { - nAngle += 3600; + nAngle10 += 3600_deg10; } - SwWrtShell *pShForAngle = nAngle ? dynamic_cast<SwWrtShell*>(GetFlyFrame()->getRootFrame()->GetCurrShell()) : nullptr; + SwWrtShell *pShForAngle = nAngle10 ? dynamic_cast<SwWrtShell*>(GetFlyFrame()->getRootFrame()->GetCurrShell()) : nullptr; if (pShForAngle) { // RotGrfFlyFrame: Add transformation to placeholder object @@ -399,13 +399,13 @@ void SwVirtFlyDrawObj::Rotate(const Point& rRef, tools::Long nAngle, double sn, const Degree10 nOldRot(SwVirtFlyDrawObj::getPossibleRotationFromFraphicFrame(aSize)); SwFlyFrameAttrMgr aMgr(false, pShForAngle, Frmmgr_Type::NONE, nullptr); - aMgr.SetRotation(nOldRot, (nOldRot + Degree10(nAngle)) % 3600_deg10, aSize); + aMgr.SetRotation(nOldRot, (nOldRot + nAngle10) % 3600_deg10, aSize); } } else { // call parent - SdrVirtObj::Rotate(rRef, nAngle, sn, cs); + SdrVirtObj::Rotate(rRef, nAngle100, sn, cs); } } @@ -1167,7 +1167,7 @@ Degree10 SwVirtFlyDrawObj::getPossibleRotationFromFraphicFrame(Size& rSize) cons return nRetval; } -tools::Long SwVirtFlyDrawObj::GetRotateAngle() const +Degree100 SwVirtFlyDrawObj::GetRotateAngle() const { if(ContainsSwGrfNode()) { diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 767e4e7f16e8..4250a11f8684 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -2975,8 +2975,8 @@ void SwFEShell::CreateDefaultShape( SdrObjKind eSdrObjectKind, const tools::Rect if(dynamic_cast<const SdrCircObj*>( pObj) != nullptr) { SfxItemSet aAttr(pDrawModel->GetItemPool()); - aAttr.Put(makeSdrCircStartAngleItem(9000)); - aAttr.Put(makeSdrCircEndAngleItem(0)); + aAttr.Put(makeSdrCircStartAngleItem(9000_deg100)); + aAttr.Put(makeSdrCircEndAngleItem(0_deg100)); pObj->SetMergedItemSet(aAttr); } else if(dynamic_cast<const SdrPathObj*>( pObj) != nullptr) diff --git a/sw/source/core/inc/dflyobj.hxx b/sw/source/core/inc/dflyobj.hxx index e05fe4ec5526..55d87f674c81 100644 --- a/sw/source/core/inc/dflyobj.hxx +++ b/sw/source/core/inc/dflyobj.hxx @@ -97,7 +97,7 @@ public: // we treat the size calculation completely on ourself here virtual const tools::Rectangle& GetCurrentBoundRect() const override; virtual const tools::Rectangle& GetLastBoundRect() const override; - virtual tools::Long GetRotateAngle() const override; + virtual Degree100 GetRotateAngle() const override; virtual void RecalcBoundRect() override; virtual void RecalcSnapRect() override; virtual const tools::Rectangle& GetSnapRect() const override; @@ -116,7 +116,7 @@ public: const Fraction& yFact, bool bUnsetRelative = true) override; virtual void Crop(const basegfx::B2DPoint& rRef, double fxFact, double fyFact) override; virtual void addCropHandles(SdrHdlList& rTarget) const override; - virtual void Rotate(const Point& rRef, tools::Long nAngle, double sn, double cs) override; + virtual void Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override; // FullDrag support virtual SdrObjectUniquePtr getFullDragClone() const override; diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 1134900df65e..0b20b982812e 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -5030,7 +5030,7 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size if (Degree10 nRot = rSet.Get(RES_GRFATR_ROTATION).GetValue()) { // RES_GRFATR_ROTATION is in 10ths of degree; convert to 100ths for macro - sal_uInt32 mOOXMLRot = oox::drawingml::ExportRotateClockwisify(nRot.get()*10); + sal_uInt32 mOOXMLRot = oox::drawingml::ExportRotateClockwisify(toDegree100(nRot)); xFrameAttributes->add(XML_rot, OString::number(mOOXMLRot)); } } diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index 54ae41500552..edba8dfaf8f4 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -77,14 +77,14 @@ OUString lclGetAnchorIdFromGrabBag(const SdrObject* pObj) return aResult; } -void lclMovePositionWithRotation(awt::Point& aPos, const Size& rSize, sal_Int64 nRotation) +void lclMovePositionWithRotation(awt::Point& aPos, const Size& rSize, Degree100 nRotation100) { // code from ImplEESdrWriter::ImplFlipBoundingBox (filter/source/msfilter/eschesdo.cxx) // TODO: refactor - if (nRotation == 0) + if (nRotation100 == 0_deg100) return; - + sal_Int64 nRotation = nRotation100.get(); if (nRotation < 0) nRotation = (36000 + nRotation) % 36000; if (nRotation % 18000 == 0) @@ -147,7 +147,7 @@ private: bool m_bDMLAndVMLDrawingOpen; /// List of TextBoxes in this document: they are exported as part of their shape, never alone. /// Preserved rotation for TextFrames. - sal_Int32 m_nDMLandVMLTextFrameRotation; + Degree100 m_nDMLandVMLTextFrameRotation; public: bool m_bFlyFrameGraphic = false; @@ -166,7 +166,6 @@ public: , m_pFlyWrapAttrList(nullptr) , m_pBodyPrAttrList(nullptr) , m_bDMLAndVMLDrawingOpen(false) - , m_nDMLandVMLTextFrameRotation(0) { } @@ -269,12 +268,12 @@ public: DocxExport& getExport() const { return m_rExport; } - void setDMLandVMLTextFrameRotation(sal_Int32 nDMLandVMLTextFrameRotation) + void setDMLandVMLTextFrameRotation(Degree100 nDMLandVMLTextFrameRotation) { m_nDMLandVMLTextFrameRotation = nDMLandVMLTextFrameRotation; } - sal_Int32& getDMLandVMLTextFrameRotation() { return m_nDMLandVMLTextFrameRotation; } + Degree100& getDMLandVMLTextFrameRotation() { return m_nDMLandVMLTextFrameRotation; } }; DocxSdrExport::DocxSdrExport(DocxExport& rExport, const sax_fastparser::FSHelperPtr& pSerializer, @@ -426,7 +425,7 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons awt::Point aPos(pFrameFormat->GetHoriOrient().GetPos(), pFrameFormat->GetVertOrient().GetPos()); const SdrObject* pObj = pFrameFormat->FindRealSdrObject(); - tools::Long nRotation = 0; + Degree100 nRotation(0); if (pObj != nullptr) { // SdrObjects know their layer, consider that instead of the frame format. @@ -1274,7 +1273,7 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho pFS->singleElementNS(XML_wps, XML_cNvSpPr, XML_txBox, "1"); uno::Any aRotation; - m_pImpl->setDMLandVMLTextFrameRotation(0); + m_pImpl->setDMLandVMLTextFrameRotation(0_deg100); if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName("FrameInteropGrabBag")) { uno::Sequence<beans::PropertyValue> propList; @@ -1286,7 +1285,9 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho if (pProp != propList.end()) aRotation = pProp->Value; } - aRotation >>= m_pImpl->getDMLandVMLTextFrameRotation(); + sal_Int32 nTmp; + if (aRotation >>= nTmp) + m_pImpl->getDMLandVMLTextFrameRotation() = Degree100(nTmp); OString sRotation(OString::number( oox::drawingml::ExportRotateClockwisify(m_pImpl->getDMLandVMLTextFrameRotation()))); // Shape properties @@ -1526,7 +1527,7 @@ void DocxSdrExport::writeVMLTextFrame(ww8::Frame const* pParentFrame, bool bText m_pImpl->getTextFrameStyle() = "position:absolute"; if (!bTextBoxOnly) { - OString sRotation(OString::number(m_pImpl->getDMLandVMLTextFrameRotation() / -100)); + OString sRotation(OString::number(m_pImpl->getDMLandVMLTextFrameRotation().get() / -100)); m_pImpl->getExport() .SdrExporter() .getTextFrameStyle() diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx index 87a559ed60f9..3ad34049f247 100644 --- a/sw/source/filter/ww8/rtfsdrexport.cxx +++ b/sw/source/filter/ww8/rtfsdrexport.cxx @@ -669,7 +669,7 @@ sal_Int32 RtfSdrExport::StartShape() // RTF angle: 0-360 * 2^16 clockwise // LO angle: 0-360 * 100 counter-clockwise sal_Int32 nRotation - = -1 * pTextObj->GetGeoStat().nRotationAngle * RTF_MULTIPLIER / 100; + = -1 * pTextObj->GetGeoStat().nRotationAngle.get() * RTF_MULTIPLIER / 100; lcl_AppendSP(m_rAttrOutput.RunText(), "rotation", msfilter::rtfutil::OutString(OUString::number(nRotation), m_rExport.GetCurrentEncoding())); diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 73960cbd8f73..8b514baa59a4 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -676,9 +676,9 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const aRect = pObj->GetLogicRect(); // rotating to vertical means swapping height and width as seen in SvxMSDffManager::ImportShape - const tools::Long nAngle = NormAngle36000( pObj->GetRotateAngle() ); + const Degree100 nAngle = NormAngle36000( pObj->GetRotateAngle() ); const bool bAllowSwap = pObj->GetObjIdentifier() != OBJ_LINE && pObj->GetObjIdentifier() != OBJ_GRUP; - if ( bAllowSwap && (( nAngle > 4500 && nAngle <= 13500 ) || ( nAngle > 22500 && nAngle <= 31500 )) ) + if ( bAllowSwap && (( nAngle > 4500_deg100 && nAngle <= 13500_deg100 ) || ( nAngle > 22500_deg100 && nAngle <= 31500_deg100 )) ) { const tools::Long nWidth = aRect.getWidth(); const tools::Long nHeight = aRect.getHeight(); diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index d76614290239..c2efe73c3830 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -415,8 +415,8 @@ SdrObject* SwWW8ImplReader::ReadArc(WW8_DPHEAD const * pHd, SfxAllItemSet &rSet) *m_pDrawModel, SdrCircKind::Section, tools::Rectangle(aP0, aP1), - nW * 9000, - ( ( nW + 1 ) & 3 ) * 9000); + Degree100(nW * 9000), + Degree100(( ( nW + 1 ) & 3 ) * 9000)); SetStdAttr( rSet, aArc.aLnt, aArc.aShd ); SetFill( rSet, aArc.aFill ); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index c8e52560564c..91b8f84557ae 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -719,7 +719,7 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, ScaleEmu( nTextTop ); ScaleEmu( nTextBottom ); - sal_Int32 nTextRotationAngle=0; + Degree100 nTextRotationAngle; bool bVerticalText = false; if ( IsProperty( DFF_Prop_txflTextFlow ) ) { @@ -728,18 +728,18 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, switch( eTextFlow ) { case mso_txflBtoT: - nTextRotationAngle = 9000; + nTextRotationAngle = 9000_deg100; break; case mso_txflVertN: case mso_txflTtoBN: - nTextRotationAngle = 27000; + nTextRotationAngle = 27000_deg100; break; case mso_txflTtoBA: bVerticalText = true; break; case mso_txflHorzA: bVerticalText = true; - nTextRotationAngle = 9000; + nTextRotationAngle = 9000_deg100; break; case mso_txflHorzN: default : @@ -749,7 +749,7 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, if (nTextRotationAngle) { - if (nTextRotationAngle == 9000) + if (nTextRotationAngle == 9000_deg100) { tools::Long nWidth = rTextRect.GetWidth(); rTextRect.SetRight( rTextRect.Left() + rTextRect.GetHeight() ); @@ -765,7 +765,7 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, nTextTop = nOldTextLeft; nTextBottom = nOldTextRight; } - else if (nTextRotationAngle == 27000) + else if (nTextRotationAngle == 27000_deg100) { tools::Long nWidth = rTextRect.GetWidth(); rTextRect.SetRight( rTextRect.Left() + rTextRect.GetHeight() ); @@ -942,13 +942,13 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, double fExtraTextRotation = 0.0; if ( mnFix16Angle && !( GetPropertyValue( DFF_Prop_FitTextToShape, 0 ) & 4 ) ) { // text is already rotated, we have to take back the object rotation if DFF_Prop_RotateText is false - fExtraTextRotation = -mnFix16Angle; + fExtraTextRotation = -mnFix16Angle.get(); } if ( rObjData.nSpFlags & ShapeFlag::FlipV ) // sj: in ppt the text is flipped, whereas in word the text { // remains unchanged, so we have to take back the flipping here fExtraTextRotation += 18000.0; // because our core will flip text if the shape is flipped. } - fExtraTextRotation += nTextRotationAngle; + fExtraTextRotation += nTextRotationAngle.get(); if ( !::basegfx::fTools::equalZero( fExtraTextRotation ) ) { fExtraTextRotation /= 100.0; @@ -964,9 +964,7 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, else if ( mnFix16Angle ) { // rotate text with shape ? - double a = mnFix16Angle * F_PI18000; - pObj->NbcRotate( rObjData.aBoundRect.Center(), mnFix16Angle, - sin( a ), cos( a ) ); + pObj->NbcRotate( rObjData.aBoundRect.Center(), mnFix16Angle ); } } } diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index b8eedd8100ae..2581e70eb272 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -2358,7 +2358,7 @@ void SwGrfExtPage::Reset(const SfxItemSet *rSet) } else { - m_xCtlAngle->SetRotation(0); + m_xCtlAngle->SetRotation(0_deg100); } m_xCtlAngle->SaveValue(); diff --git a/sw/source/uibase/ribbar/concustomshape.cxx b/sw/source/uibase/ribbar/concustomshape.cxx index be3820dab9b1..97914c8003b5 100644 --- a/sw/source/uibase/ribbar/concustomshape.cxx +++ b/sw/source/uibase/ribbar/concustomshape.cxx @@ -137,7 +137,7 @@ void ConstCustomShape::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/sw/source/uibase/shells/beziersh.cxx b/sw/source/uibase/shells/beziersh.cxx index 4764decede3b..73bbc88acbc8 100644 --- a/sw/source/uibase/shells/beziersh.cxx +++ b/sw/source/uibase/shells/beziersh.cxx @@ -54,7 +54,7 @@ SwBezierShell::SwBezierShell(SwView &_rView): SwWrtShell *pSh = &GetShell(); SdrView* pSdrView = pSh->GetDrawView(); - pSdrView->SetEliminatePolyPointLimitAngle(1500); + pSdrView->SetEliminatePolyPointLimitAngle(1500_deg100); SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Draw)); } diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index 10476553c9f7..6e990cd632b6 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -400,7 +400,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) if (pArgs && SfxItemState::SET == pArgs->GetItemState(SID_ATTR_TRANSFORM_DELTA_ANGLE, false, &pItem)) { - const Degree10 nDeltaRot(static_cast<const SdrAngleItem*>(pItem)->GetValue() / 10); + const Degree10 nDeltaRot = toDegree10(static_cast<const SdrAngleItem*>(pItem)->GetValue()); aMgr.SetRotation(nOldRot, nOldRot + nDeltaRot, rRotation.GetUnrotatedSize()); } @@ -410,7 +410,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) // 100th degrees in SID_ATTR_TRANSFORM_ANGLE to 10th degrees in RES_GRFATR_ROTATION if (pArgs && SfxItemState::SET == pArgs->GetItemState(SID_ATTR_TRANSFORM_ANGLE, false, &pItem)) { - const Degree10 nNewRot(static_cast<const SdrAngleItem*>(pItem)->GetValue() / 10); + const Degree10 nNewRot = toDegree10(static_cast<const SdrAngleItem*>(pItem)->GetValue()); // RotGrfFlyFrame: Rotation change here, SwFlyFrameAttrMgr aMgr is available aMgr.SetRotation(nOldRot, nNewRot, rRotation.GetUnrotatedSize()); diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx index c3eedb17a7d6..d4197cba5c85 100644 --- a/sw/source/uibase/shells/grfsh.cxx +++ b/sw/source/uibase/shells/grfsh.cxx @@ -511,7 +511,7 @@ void SwGrfShell::Execute(SfxRequest &rReq) // RotGrfFlyFrame: Get and process evtl. changed RotationAngle if ( SfxItemState::SET == pSet->GetItemState(SID_ATTR_TRANSFORM_ANGLE, false, &pItem )) { - const Degree10 aNewRotation((static_cast<const SdrAngleItem*>(pItem)->GetValue() / 10) % 3600); + const Degree10 aNewRotation = toDegree10(static_cast<const SdrAngleItem*>(pItem)->GetValue() % 36000_deg100); // RotGrfFlyFrame: Possible rotation change here, SwFlyFrameAttrMgr aMgr is available aMgr.SetRotation(nCurrentRotation, aNewRotation, aUnrotatedSize); diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 59c972ec8429..02c348a05693 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -792,7 +792,7 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) if (m_pImpl->isYSizeValis()) aSize.Height = m_pImpl->getYSize(); - sal_Int32 nRotation = 0; + Degree100 nRotation; if (bKeepRotation) { // Use internal API, getPropertyValue(RotateAngle) @@ -804,8 +804,8 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) m_xShape->setSize(aSize); if (bKeepRotation) { - xShapeProps->setPropertyValue("RotateAngle", uno::makeAny(nRotation)); - if (nRotation == 0) + xShapeProps->setPropertyValue("RotateAngle", uno::makeAny(nRotation.get())); + if (nRotation == 0_deg100) { // Include effect extent in the margin to bring Writer layout closer // to Word. But do this for non-rotated shapes only, where effect diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index be403b01f4e9..bf94d9cf8097 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -250,8 +250,7 @@ void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> const& xShape, uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY); if (!xServiceInfo->supportsService("com.sun.star.text.TextFrame")) xPropertySet->setPropertyValue( - "RotateAngle", - uno::makeAny(sal_Int32(NormAngle36000(static_cast<tools::Long>(nRotation) * -1)))); + "RotateAngle", uno::makeAny(NormAngle36000(Degree100(nRotation * -1)).get())); } if (nHoriOrient != 0 && xPropertySet.is()) |