chart2/source/controller/dialogs/res_DataLabel.cxx | 6 chart2/source/controller/dialogs/tp_AxisLabel.cxx | 4 chart2/source/controller/dialogs/tp_AxisLabel.hxx | 3 chart2/source/controller/dialogs/tp_PolarOptions.cxx | 2 chart2/source/controller/dialogs/tp_TitleRotation.cxx | 4 chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx | 6 chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx | 6 chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx | 4 chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx | 4 chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx | 6 chart2/source/controller/main/DrawCommandDispatch.cxx | 2 chart2/source/view/main/ChartItemPool.cxx | 4 cui/source/tabpages/transfrm.cxx | 7 filter/source/msfilter/escherex.cxx | 8 filter/source/msfilter/msdffimp.cxx | 70 ++-- filter/source/msfilter/svdfppt.cxx | 12 include/filter/msfilter/msdffimp.hxx | 5 include/o3tl/strong_int.hxx | 6 include/oox/export/drawingml.hxx | 4 include/oox/vml/vmlformatting.hxx | 3 include/svx/EnhancedCustomShape2d.hxx | 5 include/svx/algitem.hxx | 5 include/svx/dialcontrol.hxx | 15 - include/svx/obj3d.hxx | 2 include/svx/scene3d.hxx | 2 include/svx/sdangitm.hxx | 6 include/svx/svdedtv.hxx | 10 include/svx/svdglev.hxx | 2 include/svx/svdglue.hxx | 17 - include/svx/svdhdl.hxx | 4 include/svx/svdmodel.hxx | 3 include/svx/svdoashp.hxx | 6 include/svx/svdobj.hxx | 17 - include/svx/svdocirc.hxx | 20 - include/svx/svdoedge.hxx | 4 include/svx/svdogrp.hxx | 12 include/svx/svdomeas.hxx | 6 include/svx/svdopath.hxx | 4 include/svx/svdorect.hxx | 4 include/svx/svdotext.hxx | 8 include/svx/svdovirt.hxx | 12 include/svx/svdpoev.hxx | 2 include/svx/svdsnpv.hxx | 13 include/svx/svdtrans.hxx | 15 - include/svx/sxciaitm.hxx | 4 include/svx/sxmtfitm.hxx | 2 include/tools/degree.hxx | 22 + oox/source/drawingml/shape.cxx | 5 oox/source/export/drawingml.cxx | 31 +- oox/source/shape/WpsContext.cxx | 4 oox/source/vml/vmlformatting.cxx | 10 oox/source/vml/vmlshape.cxx | 12 reportdesign/source/ui/report/ReportSection.cxx | 2 sc/inc/attrib.hxx | 2 sc/inc/patattr.hxx | 3 sc/qa/unit/scshapetest.cxx | 19 - sc/qa/unit/ucalc.cxx | 6 sc/source/core/data/attarray.cxx | 4 sc/source/core/data/attrib.cxx | 2 sc/source/core/data/column2.cxx | 10 sc/source/core/data/docpool.cxx | 2 sc/source/core/data/document.cxx | 4 sc/source/core/data/patattr.cxx | 22 - sc/source/core/data/table2.cxx | 4 sc/source/core/tool/autoform.cxx | 2 sc/source/filter/excel/xestyle.cxx | 2 sc/source/filter/excel/xichart.cxx | 8 sc/source/filter/excel/xiescher.cxx | 20 - sc/source/filter/excel/xistyle.cxx | 2 sc/source/filter/excel/xlchart.cxx | 4 sc/source/filter/excel/xltools.cxx | 8 sc/source/filter/html/htmlexp2.cxx | 2 sc/source/filter/inc/stylesbuffer.hxx | 2 sc/source/filter/inc/xltools.hxx | 5 sc/source/filter/oox/stylesbuffer.cxx | 6 sc/source/filter/xcl97/xcl97rec.cxx | 12 sc/source/filter/xml/xmlexprt.cxx | 2 sc/source/ui/Accessibility/AccessibleCell.cxx | 2 sc/source/ui/Accessibility/AccessibleText.cxx | 2 sc/source/ui/drawfunc/fuconarc.cxx | 4 sc/source/ui/drawfunc/fuconcustomshape.cxx | 2 sc/source/ui/inc/output.hxx | 3 sc/source/ui/sidebar/AlignmentPropertyPanel.cxx | 6 sc/source/ui/unoobj/afmtuno.cxx | 6 sc/source/ui/unoobj/cellsuno.cxx | 8 sc/source/ui/unoobj/styleuno.cxx | 8 sc/source/ui/view/output.cxx | 12 sc/source/ui/view/output2.cxx | 36 +- sd/qa/unit/uiimpress.cxx | 2 sd/source/ui/app/optsitem.cxx | 4 sd/source/ui/dlg/copydlg.cxx | 4 sd/source/ui/dlg/tpoption.cxx | 4 sd/source/ui/func/fuconarc.cxx | 8 sd/source/ui/func/fuconcs.cxx | 2 sd/source/ui/func/fucopy.cxx | 3 sd/source/ui/func/fusel.cxx | 12 sd/source/ui/inc/optsitem.hxx | 1 sd/source/ui/view/frmview.cxx | 8 svx/inc/dragmt3d.hxx | 4 svx/inc/sxcaitm.hxx | 2 svx/inc/sxmtaitm.hxx | 2 svx/inc/sxroaitm.hxx | 2 svx/inc/sxrooitm.hxx | 2 svx/inc/sxsaitm.hxx | 2 svx/inc/sxsalitm.hxx | 4 svx/inc/sxsoitm.hxx | 4 svx/qa/unit/customshapes.cxx | 2 svx/source/customshapes/EnhancedCustomShape2d.cxx | 6 svx/source/customshapes/EnhancedCustomShape3d.cxx | 4 svx/source/customshapes/EnhancedCustomShapeEngine.cxx | 10 svx/source/dialog/dialcontrol.cxx | 23 - svx/source/dialog/imapwnd.cxx | 8 svx/source/engine3d/dragmt3d.cxx | 8 svx/source/engine3d/obj3d.cxx | 4 svx/source/engine3d/scene3d.cxx | 4 svx/source/items/algitem.cxx | 12 svx/source/items/autoformathelper.cxx | 4 svx/source/sdr/contact/viewcontactofgraphic.cxx | 6 svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx | 2 svx/source/sdr/contact/viewcontactofsdrcircobj.cxx | 2 svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx | 4 svx/source/sdr/contact/viewcontactofsdrole2obj.cxx | 2 svx/source/sdr/contact/viewcontactofsdrpathobj.cxx | 2 svx/source/sdr/contact/viewcontactofsdrrectobj.cxx | 2 svx/source/sdr/properties/circleproperties.cxx | 2 svx/source/sidebar/possize/PosSizePropertyPanel.cxx | 11 svx/source/svdraw/svdattr.cxx | 6 svx/source/svdraw/svddrgm1.hxx | 12 svx/source/svdraw/svddrgmt.cxx | 144 +++++----- svx/source/svdraw/svdedtv1.cxx | 58 ++-- svx/source/svdraw/svdedxv.cxx | 2 svx/source/svdraw/svdfmtf.cxx | 17 - svx/source/svdraw/svdglev.cxx | 6 svx/source/svdraw/svdglue.cxx | 90 +++--- svx/source/svdraw/svdhdl.cxx | 30 +- svx/source/svdraw/svdmodel.cxx | 4 svx/source/svdraw/svdmrkv.cxx | 4 svx/source/svdraw/svdoashp.cxx | 49 +-- svx/source/svdraw/svdobj.cxx | 46 +-- svx/source/svdraw/svdocirc.cxx | 143 ++++----- svx/source/svdraw/svdoedge.cxx | 4 svx/source/svdraw/svdograf.cxx | 12 svx/source/svdraw/svdogrp.cxx | 20 - svx/source/svdraw/svdomeas.cxx | 34 +- svx/source/svdraw/svdopath.cxx | 92 +++--- svx/source/svdraw/svdorect.cxx | 28 - svx/source/svdraw/svdotext.cxx | 44 +-- svx/source/svdraw/svdotxdr.cxx | 8 svx/source/svdraw/svdotxed.cxx | 2 svx/source/svdraw/svdotxtr.cxx | 60 ++-- svx/source/svdraw/svdouno.cxx | 8 svx/source/svdraw/svdovirt.cxx | 16 - svx/source/svdraw/svdpdf.cxx | 5 svx/source/svdraw/svdpoev.cxx | 6 svx/source/svdraw/svdtrans.cxx | 75 ++--- svx/source/table/viewcontactoftableobj.cxx | 4 svx/source/tbxctrls/grafctrl.cxx | 6 svx/source/uitest/sdrobject.cxx | 4 svx/source/unodraw/unoshape.cxx | 28 + sw/inc/dcontact.hxx | 8 sw/source/core/draw/dcontact.cxx | 8 sw/source/core/draw/dflyobj.cxx | 16 - sw/source/core/frmedt/feshview.cxx | 4 sw/source/core/inc/dflyobj.hxx | 4 sw/source/filter/ww8/docxattributeoutput.cxx | 2 sw/source/filter/ww8/docxsdrexport.cxx | 23 - sw/source/filter/ww8/rtfsdrexport.cxx | 2 sw/source/filter/ww8/wrtw8esh.cxx | 4 sw/source/filter/ww8/ww8graf.cxx | 4 sw/source/filter/ww8/ww8par.cxx | 20 - sw/source/ui/frmdlg/frmpage.cxx | 2 sw/source/uibase/ribbar/concustomshape.cxx | 2 sw/source/uibase/shells/beziersh.cxx | 2 sw/source/uibase/shells/frmsh.cxx | 4 sw/source/uibase/shells/grfsh.cxx | 2 writerfilter/source/dmapper/GraphicImport.cxx | 6 writerfilter/source/rtftok/rtfsdrimport.cxx | 3 177 files changed, 1053 insertions(+), 1012 deletions(-)
New commits: commit 11e52fe2979b0947814a49b9c17ec373795cbf8e Author: Noel <[email protected]> AuthorDate: Tue Dec 22 15:42:08 2020 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sat Jan 2 15:26:38 2021 +0100 introduce Degree100 strong_int type Change-Id: I78f837a1340be0ca5c49097f543a481b7b43a632 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108367 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> 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, { ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
