diff options
185 files changed, 626 insertions, 600 deletions
diff --git a/canvas/source/cairo/cairo_canvashelper_text.cxx b/canvas/source/cairo/cairo_canvashelper_text.cxx index 258ba6a3166f..912e3b678ca8 100644 --- a/canvas/source/cairo/cairo_canvashelper_text.cxx +++ b/canvas/source/cairo/cairo_canvashelper_text.cxx @@ -100,7 +100,7 @@ namespace cairocanvas io_rVCLFont.SetFontHeight( ::basegfx::fround(nFontHeight * aScale.getY()) ); } - io_rVCLFont.SetOrientation( static_cast< short >( ::basegfx::fround(-fmod(nRotate, 2*M_PI)*(1800.0/M_PI)) ) ); + io_rVCLFont.SetOrientation( Degree10(static_cast< sal_Int16 >( ::basegfx::fround(-fmod(nRotate, 2*M_PI)*(1800.0/M_PI)) )) ); // TODO(F2): Missing functionality in VCL: shearing o_rPoint.setX( ::basegfx::fround(aTranslate.getX()) ); diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx index 0e759d4fbe61..e56a273a1fe1 100644 --- a/canvas/source/vcl/canvashelper.cxx +++ b/canvas/source/vcl/canvashelper.cxx @@ -773,7 +773,7 @@ namespace vclcanvas // (3600,0]. Note that the original angle may have // values outside the [0,2Pi) interval. const double nAngleInTenthOfDegrees (3600.0 - nRotate * 3600.0 / (2*M_PI)); - aGrfAttr.SetRotation( static_cast< sal_uInt16 >(::basegfx::fround(nAngleInTenthOfDegrees)) ); + aGrfAttr.SetRotation( Degree10(::basegfx::fround(nAngleInTenthOfDegrees)) ); pGrfObj = std::make_shared<GraphicObject>( aBmpEx ); } diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx index 9cb8dd8abd99..81d97138b22c 100644 --- a/canvas/source/vcl/canvashelper_texturefill.cxx +++ b/canvas/source/vcl/canvashelper_texturefill.cxx @@ -754,7 +754,7 @@ namespace vclcanvas // (3600,0]. Note that the original angle may have // values outside the [0,2Pi) interval. const double nAngleInTenthOfDegrees (3600.0 - nRotate * 3600.0 / (2*M_PI)); - aGrfAttr.SetRotation( static_cast< sal_uInt16 >(::basegfx::fround(nAngleInTenthOfDegrees)) ); + aGrfAttr.SetRotation( Degree10(::basegfx::fround(nAngleInTenthOfDegrees)) ); pGrfObj = std::make_shared<GraphicObject>( aBmpEx ); } diff --git a/canvas/source/vcl/impltools.cxx b/canvas/source/vcl/impltools.cxx index a76fefcb40c7..800ad3128342 100644 --- a/canvas/source/vcl/impltools.cxx +++ b/canvas/source/vcl/impltools.cxx @@ -126,7 +126,7 @@ namespace vclcanvas::tools io_rVCLFont.SetFontHeight( ::basegfx::fround(nFontHeight * aScale.getY()) ); } - io_rVCLFont.SetOrientation( static_cast< short >( ::basegfx::fround(-fmod(nRotate, 2*M_PI)*(1800.0/M_PI)) ) ); + io_rVCLFont.SetOrientation( Degree10( ::basegfx::fround(-fmod(nRotate, 2*M_PI)*(1800.0/M_PI)) ) ); // TODO(F2): Missing functionality in VCL: shearing o_rPoint.setX( ::basegfx::fround(aTranslate.getX()) ); diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index efd276991370..c78b958f31f5 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -574,7 +574,7 @@ namespace cppcanvas::internal const ::basegfx::B2DVector aOffset( rGradient.GetOfsX() / 100.0, rGradient.GetOfsY() / 100.0); - double fRotation( rGradient.GetAngle() * M_PI / 1800.0 ); + double fRotation( rGradient.GetAngle().get() * M_PI / 1800.0 ); const double fBorder( rGradient.GetBorder() / 100.0 ); basegfx::B2DHomMatrix aRot90; diff --git a/cppcanvas/source/mtfrenderer/textaction.cxx b/cppcanvas/source/mtfrenderer/textaction.cxx index 42621e819455..408b180ecf58 100644 --- a/cppcanvas/source/mtfrenderer/textaction.cxx +++ b/cppcanvas/source/mtfrenderer/textaction.cxx @@ -2005,7 +2005,7 @@ namespace cppcanvas::internal // will be rotated twice) const vcl::Font aOrigFont( rVDev.GetFont() ); vcl::Font aUnrotatedFont( aOrigFont ); - aUnrotatedFont.SetOrientation(0); + aUnrotatedFont.SetOrientation(Degree10(0)); rVDev.SetFont( aUnrotatedFont ); // TODO(F3): Don't understand parameter semantics of diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index a7162eca0817..b7f9b17165fc 100644 --- a/cui/source/tabpages/chardlg.cxx +++ b/cui/source/tabpages/chardlg.cxx @@ -2830,7 +2830,7 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet ) m_x270degRB->set_active(true); else { - DBG_ASSERT( 0 == rItem.GetValue(), "incorrect value" ); + DBG_ASSERT( Degree10(0) == rItem.GetValue(), "incorrect value" ); m_x0degRB->set_active(true); } m_xFitToLineCB->set_active(rItem.IsFitToLine()); @@ -2977,7 +2977,7 @@ bool SvxCharPositionPage::FillItemSet( SfxItemSet* rSet ) m_x270degRB->get_state_changed_from_saved() || m_xFitToLineCB->get_state_changed_from_saved() ) { - SvxCharRotateItem aItem( 0, m_xFitToLineCB->get_active(), nWhich ); + SvxCharRotateItem aItem( Degree10(0), m_xFitToLineCB->get_active(), nWhich ); if (m_x90degRB->get_active()) aItem.SetBottomToTop(); else if (m_x270degRB->get_active()) diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx index 6540dfde1a5e..32deb5ae8fd2 100644 --- a/cui/source/tabpages/tpgradnt.cxx +++ b/cui/source/tabpages/tpgradnt.cxx @@ -193,7 +193,7 @@ bool SvxGradientTabPage::FillItemSet( SfxItemSet* rSet ) pXGradient.reset(new XGradient( m_xLbColorFrom->GetSelectEntryColor(), m_xLbColorTo->GetSelectEntryColor(), static_cast<css::awt::GradientStyle>(m_xLbGradientType->get_active()), - static_cast<long>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10), // should be changed in resource + Degree10(static_cast<sal_Int16>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10)), // should be changed in resource static_cast<sal_uInt16>(m_xMtrCenterX->get_value(FieldUnit::NONE)), static_cast<sal_uInt16>(m_xMtrCenterY->get_value(FieldUnit::NONE)), static_cast<sal_uInt16>(m_xMtrBorder->get_value(FieldUnit::NONE)), @@ -291,7 +291,7 @@ void SvxGradientTabPage::ModifiedHdl_Impl( void const * pControl ) XGradient aXGradient( m_xLbColorFrom->GetSelectEntryColor(), m_xLbColorTo->GetSelectEntryColor(), eXGS, - static_cast<long>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10), // should be changed in resource + Degree10(static_cast<sal_Int16>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10)), // should be changed in resource static_cast<sal_uInt16>(m_xMtrCenterX->get_value(FieldUnit::NONE)), static_cast<sal_uInt16>(m_xMtrCenterY->get_value(FieldUnit::NONE)), static_cast<sal_uInt16>(m_xMtrBorder->get_value(FieldUnit::NONE)), @@ -358,7 +358,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickAddHdl_Impl, weld::Button&, void) XGradient aXGradient( m_xLbColorFrom->GetSelectEntryColor(), m_xLbColorTo->GetSelectEntryColor(), static_cast<css::awt::GradientStyle>(m_xLbGradientType->get_active()), - static_cast<long>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10), // should be changed in resource + Degree10(static_cast<sal_Int16>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10)), // should be changed in resource static_cast<sal_uInt16>(m_xMtrCenterX->get_value(FieldUnit::NONE)), static_cast<sal_uInt16>(m_xMtrCenterY->get_value(FieldUnit::NONE)), static_cast<sal_uInt16>(m_xMtrBorder->get_value(FieldUnit::NONE)), @@ -398,7 +398,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickModifyHdl_Impl, weld::Button&, void) XGradient aXGradient( m_xLbColorFrom->GetSelectEntryColor(), m_xLbColorTo->GetSelectEntryColor(), static_cast<css::awt::GradientStyle>(m_xLbGradientType->get_active()), - static_cast<long>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10), // should be changed in resource + Degree10(static_cast<sal_Int16>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10)), // should be changed in resource static_cast<sal_uInt16>(m_xMtrCenterX->get_value(FieldUnit::NONE)), static_cast<sal_uInt16>(m_xMtrCenterY->get_value(FieldUnit::NONE)), static_cast<sal_uInt16>(m_xMtrBorder->get_value(FieldUnit::NONE)), @@ -543,8 +543,8 @@ void SvxGradientTabPage::ChangeGradientHdl_Impl() m_xLbColorTo->SetNoSelection(); m_xLbColorTo->SelectEntry( pGradient->GetEndColor() ); - m_xMtrAngle->set_value(pGradient->GetAngle() / 10, FieldUnit::NONE); // should be changed in resource - m_xSliderAngle->set_value(pGradient->GetAngle() / 10); + m_xMtrAngle->set_value(pGradient->GetAngle().get() / 10, FieldUnit::NONE); // should be changed in resource + m_xSliderAngle->set_value(pGradient->GetAngle().get() / 10); m_xMtrBorder->set_value(pGradient->GetBorder(), FieldUnit::NONE); m_xSliderBorder->set_value(pGradient->GetBorder()); m_xMtrCenterX->set_value(pGradient->GetXOffset(), FieldUnit::NONE); diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx index b0a6753db997..3be0005ef62a 100644 --- a/cui/source/tabpages/tphatch.cxx +++ b/cui/source/tabpages/tphatch.cxx @@ -232,7 +232,7 @@ bool SvxHatchTabPage::FillItemSet( SfxItemSet* rSet ) pXHatch.reset(new XHatch( m_xLbLineColor->GetSelectEntryColor(), static_cast<css::drawing::HatchStyle>(m_xLbLineType->get_active()), GetCoreValue( *m_xMtrDistance, m_ePoolUnit ), - static_cast<long>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10) )); + Degree10(static_cast<sal_Int16>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10)) )); } assert( pXHatch && "XHatch couldn't be created" ); rSet->Put( XFillStyleItem( drawing::FillStyle_HATCH ) ); @@ -332,7 +332,7 @@ void SvxHatchTabPage::ModifiedHdl_Impl( void const * p ) XHatch aXHatch( m_xLbLineColor->GetSelectEntryColor(), static_cast<css::drawing::HatchStyle>(m_xLbLineType->get_active()), GetCoreValue( *m_xMtrDistance, m_ePoolUnit ), - static_cast<long>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10) ); + Degree10(static_cast<sal_Int16>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10)) ); m_rXFSet.Put( XFillHatchItem( OUString(), aXHatch ) ); @@ -378,7 +378,7 @@ void SvxHatchTabPage::ChangeHatchHdl_Impl() m_xLbLineColor->SetNoSelection(); m_xLbLineColor->SelectEntry( pHatch->GetColor() ); SetMetricValue( *m_xMtrDistance, pHatch->GetDistance(), m_ePoolUnit ); - long nHatchAngle = pHatch->GetAngle() / 10; + long nHatchAngle = pHatch->GetAngle().get() / 10; m_xMtrAngle->set_value(nHatchAngle, FieldUnit::NONE); m_xSliderAngle->set_value(nHatchAngle); @@ -440,7 +440,7 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickAddHdl_Impl, weld::Button&, void) XHatch aXHatch( m_xLbLineColor->GetSelectEntryColor(), static_cast<css::drawing::HatchStyle>(m_xLbLineType->get_active()), GetCoreValue( *m_xMtrDistance, m_ePoolUnit ), - static_cast<long>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10) ); + Degree10(static_cast<sal_Int16>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10)) ); m_pHatchingList->Insert(std::make_unique<XHatchEntry>(aXHatch, aName), nCount); @@ -469,7 +469,7 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickModifyHdl_Impl, weld::Button&, void) XHatch aXHatch( m_xLbLineColor->GetSelectEntryColor(), static_cast<css::drawing::HatchStyle>(m_xLbLineType->get_active()), GetCoreValue( *m_xMtrDistance, m_ePoolUnit ), - static_cast<long>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10) ); + Degree10(static_cast<sal_Int16>(m_xMtrAngle->get_value(FieldUnit::NONE) * 10)) ); m_pHatchingList->Replace(std::make_unique<XHatchEntry>(aXHatch, aName), nPos); diff --git a/cui/source/tabpages/tptrans.cxx b/cui/source/tabpages/tptrans.cxx index ac950ceb3a2e..6aa38b8df941 100644 --- a/cui/source/tabpages/tptrans.cxx +++ b/cui/source/tabpages/tptrans.cxx @@ -130,7 +130,7 @@ void SvxTransparenceTabPage::ModifiedTrgrHdl_Impl(const weld::ComboBox* pControl Color(nStartCol, nStartCol, nStartCol), Color(nEndCol, nEndCol, nEndCol), static_cast<css::awt::GradientStyle>(m_xLbTrgrGradientType->get_active()), - static_cast<sal_uInt16>(m_xMtrTrgrAngle->get_value(FieldUnit::DEGREE)) * 10, + Degree10(static_cast<sal_Int16>(m_xMtrTrgrAngle->get_value(FieldUnit::DEGREE)) * 10), static_cast<sal_uInt16>(m_xMtrTrgrCenterX->get_value(FieldUnit::PERCENT)), static_cast<sal_uInt16>(m_xMtrTrgrCenterY->get_value(FieldUnit::PERCENT)), static_cast<sal_uInt16>(m_xMtrTrgrBorder->get_value(FieldUnit::PERCENT)), @@ -301,7 +301,7 @@ bool SvxTransparenceTabPage::FillItemSet(SfxItemSet* rAttrs) Color(nStartCol, nStartCol, nStartCol), Color(nEndCol, nEndCol, nEndCol), static_cast<css::awt::GradientStyle>(m_xLbTrgrGradientType->get_active()), - static_cast<sal_uInt16>(m_xMtrTrgrAngle->get_value(FieldUnit::DEGREE)) * 10, + Degree10(static_cast<sal_Int16>(m_xMtrTrgrAngle->get_value(FieldUnit::DEGREE)) * 10), static_cast<sal_uInt16>(m_xMtrTrgrCenterX->get_value(FieldUnit::PERCENT)), static_cast<sal_uInt16>(m_xMtrTrgrCenterY->get_value(FieldUnit::PERCENT)), static_cast<sal_uInt16>(m_xMtrTrgrBorder->get_value(FieldUnit::PERCENT)), @@ -368,7 +368,7 @@ void SvxTransparenceTabPage::Reset(const SfxItemSet* rAttrs) const XGradient& rGradient = static_cast<const XFillFloatTransparenceItem*>(pGradientItem)->GetGradientValue(); css::awt::GradientStyle eXGS(rGradient.GetGradientStyle()); m_xLbTrgrGradientType->set_active(sal::static_int_cast< sal_Int32 >(eXGS)); - m_xMtrTrgrAngle->set_value(rGradient.GetAngle() / 10, FieldUnit::DEGREE); + m_xMtrTrgrAngle->set_value(rGradient.GetAngle().get() / 10, FieldUnit::DEGREE); m_xMtrTrgrBorder->set_value(rGradient.GetBorder(), FieldUnit::PERCENT); m_xMtrTrgrCenterX->set_value(rGradient.GetXOffset(), FieldUnit::PERCENT); m_xMtrTrgrCenterY->set_value(rGradient.GetYOffset(), FieldUnit::PERCENT); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index a05da99d47a6..34a9893bb134 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -5284,7 +5284,7 @@ unsigned char* doc_renderFontOrientation(SAL_UNUSED_PARAMETER LibreOfficeKitDocu ::tools::Rectangle aRect; vcl::Font aFont(rFontMetric); aFont.SetFontSize(Size(0, nDefaultFontSize)); - aFont.SetOrientation(pOrientation); + aFont.SetOrientation(Degree10(pOrientation)); aDevice->SetFont(aFont); aDevice->GetTextBoundRect(aRect, aText); if (aRect.IsEmpty()) diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx index f86b1585b13f..9de4b8a80e64 100644 --- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx @@ -68,7 +68,7 @@ void GraphicPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, GraphicAttr aSuppressGraphicAttr(getGraphicAttr()); aSuppressGraphicAttr.SetCrop(0, 0, 0, 0); - aSuppressGraphicAttr.SetRotation(0); + aSuppressGraphicAttr.SetRotation(Degree10(0)); aSuppressGraphicAttr.SetMirrorFlags(BmpMirrorFlags::NONE); aSuppressGraphicAttr.SetTransparency(0); diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index b8ac0bf73c85..e34fe1822fa4 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -431,7 +431,7 @@ namespace drawinglayer::primitive2d if(!basegfx::fTools::equalZero(fFontRotation)) { sal_Int16 aRotate10th(static_cast<sal_Int16>(fFontRotation * (-1800.0/F_PI))); - aRetval.SetOrientation(aRotate10th % 3600); + aRetval.SetOrientation(Degree10(aRotate10th % 3600)); } return aRetval; diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 70c4f2ab561e..13883b50412f 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -276,7 +276,8 @@ void VclMetafileProcessor2D::impConvertFillGradientAttributeToVCLGradient( Color(maBColorModifierStack.getModifiedColor(rFiGrAtt.getEndColor()))); } - o_rVCLGradient.SetAngle(static_cast<sal_uInt16>(rFiGrAtt.getAngle() * (1.0 / F_PI1800))); + o_rVCLGradient.SetAngle( + Degree10(static_cast<sal_uInt16>(rFiGrAtt.getAngle() * (1.0 / F_PI1800)))); o_rVCLGradient.SetBorder(static_cast<sal_uInt16>(rFiGrAtt.getBorder() * 100.0)); o_rVCLGradient.SetOfsX(static_cast<sal_uInt16>(rFiGrAtt.getOffsetX() * 100.0)); o_rVCLGradient.SetOfsY(static_cast<sal_uInt16>(rFiGrAtt.getOffsetY() * 100.0)); @@ -1860,7 +1861,7 @@ void VclMetafileProcessor2D::processPolyPolygonHatchPrimitive2D( Hatch(aHatchStyle, Color(maBColorModifierStack.getModifiedColor(rFillHatchAttribute.getColor())), basegfx::fround(rFillHatchAttribute.getDistance()), - basegfx::fround(rFillHatchAttribute.getAngle() / F_PI1800))); + Degree10(basegfx::fround(rFillHatchAttribute.getAngle() / F_PI1800)))); impEndSvtGraphicFill(pSvtGraphicFill.get()); } @@ -2131,7 +2132,7 @@ void VclMetafileProcessor2D::processUnifiedTransparencePrimitive2D( aVCLGradient.SetStyle(GradientStyle::Linear); aVCLGradient.SetStartColor(aTransColor); aVCLGradient.SetEndColor(aTransColor); - aVCLGradient.SetAngle(0); + aVCLGradient.SetAngle(Degree10(0)); aVCLGradient.SetBorder(0); aVCLGradient.SetOfsX(0); aVCLGradient.SetOfsY(0); diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index ac1efe4d95b3..1e5a04baf30d 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -840,7 +840,8 @@ void VclPixelProcessor2D::processFillHatchPrimitive2D( const sal_uInt32 nDistance(basegfx::fround(aDiscreteDistance.getLength())); const sal_uInt16 nAngle10( static_cast<sal_uInt16>(basegfx::fround(rFillHatchAttributes.getAngle() / F_PI1800))); - ::Hatch aVCLHatch(eHatchStyle, Color(rFillHatchAttributes.getColor()), nDistance, nAngle10); + ::Hatch aVCLHatch(eHatchStyle, Color(rFillHatchAttributes.getColor()), nDistance, + Degree10(nAngle10)); // draw hatch using VCL mpOutputDevice->DrawHatch(::tools::PolyPolygon(::tools::Polygon(aHatchPolygon)), aVCLHatch); @@ -1206,7 +1207,7 @@ void VclPixelProcessor2D::processFillGradientPrimitive2D( Gradient aGradient(eGradientStyle, Color(rFillGradient.getStartColor()), Color(rFillGradient.getEndColor())); - aGradient.SetAngle(rFillGradient.getAngle() / F_PI1800); + aGradient.SetAngle(Degree10(static_cast<int>(rFillGradient.getAngle() / F_PI1800))); aGradient.SetBorder(rFillGradient.getBorder() * 100); aGradient.SetOfsX(rFillGradient.getOffsetX() * 100.0); aGradient.SetOfsY(rFillGradient.getOffsetY() * 100.0); diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx index 7fd3d8c9a2a8..60bf9ea6ae9f 100644 --- a/drawinglayer/source/tools/wmfemfhelper.cxx +++ b/drawinglayer/source/tools/wmfemfhelper.cxx @@ -753,7 +753,7 @@ namespace wmfemfhelper static_cast<double>(rGradient.GetBorder()) * 0.01, static_cast<double>(rGradient.GetOfsX()) * 0.01, static_cast<double>(rGradient.GetOfsY()) * 0.01, - static_cast<double>(rGradient.GetAngle()) * F_PI1800, + static_cast<double>(rGradient.GetAngle().get()) * F_PI1800, aStart, aEnd, rGradient.GetSteps()); @@ -788,7 +788,7 @@ namespace wmfemfhelper return drawinglayer::attribute::FillHatchAttribute( aHatchStyle, static_cast<double>(rHatch.GetDistance()), - static_cast<double>(rHatch.GetAngle()) * F_PI1800, + static_cast<double>(rHatch.GetAngle().get()) * F_PI1800, rHatch.GetColor().getBColor(), 3, // same default as VCL, a minimum of three discrete units (pixels) offset false); @@ -1102,7 +1102,7 @@ namespace wmfemfhelper // add FontRotation (if used) if(rFont.GetOrientation()) { - rTextTransform.rotate(-rFont.GetOrientation() * F_PI1800); + rTextTransform.rotate(-rFont.GetOrientation().get() * F_PI1800); } } @@ -1265,7 +1265,7 @@ namespace wmfemfhelper if(rFont.GetOrientation()) { - aTextTransform.rotate(-rFont.GetOrientation() * F_PI1800); + aTextTransform.rotate(-rFont.GetOrientation().get() * F_PI1800); } aTextTransform.translate(rTextStartPosition.X(), rTextStartPosition.Y()); diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 454fc460849a..b26142224a1f 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -2038,7 +2038,7 @@ void EditDoc::CreateDefFont( bool bUseStyles ) SfxItemSet aTmpSet( GetItemPool(), svl::Items<EE_PARA_START, EE_CHAR_END>{} ); CreateFont( aDefFont, aTmpSet ); aDefFont.SetVertical( IsVertical() ); - aDefFont.SetOrientation( IsVertical() ? (IsTopToBottom() ? 2700 : 900) : 0 ); + aDefFont.SetOrientation( Degree10(IsVertical() ? (IsTopToBottom() ? 2700 : 900) : 0) ); for ( sal_Int32 nNode = 0; nNode < Count(); nNode++ ) { diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 071f78947b2f..91bb8217ec3f 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -200,7 +200,7 @@ void EditEngine::Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect ) Draw( pOutDev, rOutRect, Point( 0, 0 ) ); } -void EditEngine::Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation ) +void EditEngine::Draw( OutputDevice* pOutDev, const Point& rStartPos, Degree10 nOrientation ) { // Create with 2 points, as with positive points it will end up with // LONGMAX as Size, Bottom and Right in the range > LONGMAX. @@ -2462,7 +2462,7 @@ void EditEngine::DrawingTab( const Point& /*rStartPos*/, tools::Long /*nWidth*/, { } -void EditEngine::PaintingFirstLine( sal_Int32, const Point&, tools::Long, const Point&, short, OutputDevice* ) +void EditEngine::PaintingFirstLine( sal_Int32, const Point&, tools::Long, const Point&, Degree10, OutputDevice* ) { } diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 411a63766020..2c18762e1f9d 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -1282,7 +1282,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor ) aCursorSz.setWidth( aOldSz.Height() ); aCursorSz.setHeight( aOldSz.Width() ); GetCursor()->SetPos( aCursorRect.TopRight() ); - GetCursor()->SetOrientation( IsTopToBottom() ? 2700 : 900 ); + GetCursor()->SetOrientation( Degree10(IsTopToBottom() ? 2700 : 900) ); } else // #i32593# Reset correct orientation in horizontal layout diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index a6ebf55c7ccc..9ab6c7fdfe88 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -834,7 +834,7 @@ public: void FormatFullDoc(); void UpdateViews( EditView* pCurView = nullptr ); void Paint( ImpEditView* pView, const tools::Rectangle& rRect, OutputDevice* pTargetDevice ); - void Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Point aStartPos, bool bStripOnly = false, short nOrientation = 0 ); + void Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Point aStartPos, bool bStripOnly = false, Degree10 nOrientation = Degree10(0) ); bool MouseButtonUp( const MouseEvent& rMouseEvent, EditView* pView ); bool MouseButtonDown( const MouseEvent& rMouseEvent, EditView* pView ); @@ -1292,7 +1292,7 @@ inline vcl::Cursor* ImpEditView::GetCursor() void ConvertItem( std::unique_ptr<SfxPoolItem>& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit ); void ConvertAndPutItems( SfxItemSet& rDest, const SfxItemSet& rSource, const MapUnit* pSourceUnit = nullptr, const MapUnit* pDestUnit = nullptr ); AsianCompressionFlags GetCharTypeForCompression( sal_Unicode cChar ); -Point Rotate( const Point& rPoint, short nOrientation, const Point& rOrigin ); +Point Rotate( const Point& rPoint, Degree10 nOrientation, const Point& rOrigin ); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 23d00bb7dc1b..d070ec660786 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -105,9 +105,9 @@ struct TabInfo } -Point Rotate( const Point& rPoint, short nOrientation, const Point& rOrigin ) +Point Rotate( const Point& rPoint, Degree10 nOrientation, const Point& rOrigin ) { - double nRealOrientation = nOrientation*F_PI1800; + double nRealOrientation = nOrientation.get() * F_PI1800; double nCos = cos( nRealOrientation ); double nSin = sin( nRealOrientation ); @@ -158,7 +158,7 @@ static void lcl_DrawRedLines( OutputDevice* pOutDev, size_t nMaxEnd, const tools::Long* pDXArray, WrongList const * pWrongs, - short nOrientation, + Degree10 nOrientation, const Point& rOrigin, bool bVertical, bool bIsRightToLeft ) @@ -2952,7 +2952,7 @@ void ImpEditEngine::RecalcFormatterFontMetrics( FormatterFontMetric& rCurMetrics } } -void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Point aStartPos, bool bStripOnly, short nOrientation ) +void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Point aStartPos, bool bStripOnly, Degree10 nOrientation ) { if ( !GetUpdateMode() && !bStripOnly ) return; @@ -2978,7 +2978,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po double nCos = 0.0, nSin = 0.0; if ( nOrientation ) { - double nRealOrientation = nOrientation*F_PI1800; + double nRealOrientation = nOrientation.get()*F_PI1800; nCos = cos( nRealOrientation ); nSin = sin( nRealOrientation ); } diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index 8b856d6e7497..e1700df6e254 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -99,7 +99,7 @@ SfxPoolItem* SvxEscapementItem::CreateDefault() {return new SvxEscapementItem(0) SfxPoolItem* SvxLanguageItem::CreateDefault() {return new SvxLanguageItem(LANGUAGE_GERMAN, 0);} SfxPoolItem* SvxBlinkItem::CreateDefault() {return new SvxBlinkItem(false, 0);} SfxPoolItem* SvxEmphasisMarkItem::CreateDefault() {return new SvxEmphasisMarkItem(FontEmphasisMark::NONE, 0);} -SfxPoolItem* SvxCharRotateItem::CreateDefault() {return new SvxCharRotateItem(0, false, 0);} +SfxPoolItem* SvxCharRotateItem::CreateDefault() {return new SvxCharRotateItem(Degree10(0), false, 0);} SfxPoolItem* SvxCharScaleWidthItem::CreateDefault() {return new SvxCharScaleWidthItem(100, 0);} SfxPoolItem* SvxCharReliefItem::CreateDefault() {return new SvxCharReliefItem(FontRelief::NONE, 0);} @@ -2153,8 +2153,8 @@ bool SvxTwoLinesItem::GetPresentation( SfxItemPresentation /*ePres*/, |* class SvxTextRotateItem *************************************************************************/ -SvxTextRotateItem::SvxTextRotateItem(sal_uInt16 nValue, const sal_uInt16 nW) - : SfxUInt16Item(nW, nValue) +SvxTextRotateItem::SvxTextRotateItem(Degree10 nValue, const sal_uInt16 nW) + : SfxUInt16Item(nW, nValue.get()) { } @@ -2174,7 +2174,7 @@ bool SvxTextRotateItem::GetPresentation( { rText = EditResId(RID_SVXITEMS_TEXTROTATE); rText = rText.replaceFirst("$(ARG1)", - OUString::number(GetValue() / 10)); + OUString::number(GetValue().get() / 10)); } return true; } @@ -2206,7 +2206,7 @@ bool SvxTextRotateItem::PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) { sal_Int16 nVal = 0; if ((rVal >>= nVal) && (0 == nVal || 900 == nVal || 2700 == nVal)) - SetValue(static_cast<sal_uInt16>(nVal)); + SetValue(Degree10(nVal)); else bRet = false; break; @@ -2221,7 +2221,7 @@ void SvxTextRotateItem::dumpAsXml(xmlTextWriterPtr pWriter) const { xmlTextWriterStartElement(pWriter, BAD_CAST("SvxTextRotateItem")); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr())); - xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::number(GetValue()).getStr())); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::number(GetValue().get()).getStr())); xmlTextWriterEndElement(pWriter); } @@ -2230,7 +2230,7 @@ void SvxTextRotateItem::dumpAsXml(xmlTextWriterPtr pWriter) const |* class SvxCharRotateItem *************************************************************************/ -SvxCharRotateItem::SvxCharRotateItem( sal_uInt16 nValue, +SvxCharRotateItem::SvxCharRotateItem( Degree10 nValue, bool bFitIntoLine, const sal_uInt16 nW ) : SvxTextRotateItem(nValue, nW), bFitToLine( bFitIntoLine ) @@ -2253,7 +2253,7 @@ bool SvxCharRotateItem::GetPresentation( { rText = EditResId( RID_SVXITEMS_CHARROTATE ); rText = rText.replaceFirst( "$(ARG1)", - OUString::number( GetValue() / 10 )); + OUString::number( GetValue().get() / 10 )); if( IsFitToLine() ) rText += EditResId( RID_SVXITEMS_CHARROTATE_FITLINE ); } @@ -2311,7 +2311,7 @@ void SvxCharRotateItem::dumpAsXml(xmlTextWriterPtr pWriter) const { xmlTextWriterStartElement(pWriter, BAD_CAST("SvxCharRotateItem")); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr())); - xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::number(GetValue()).getStr())); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::number(GetValue().get()).getStr())); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("fitToLine"), BAD_CAST(OString::boolean(IsFitToLine()).getStr())); xmlTextWriterEndElement(pWriter); } diff --git a/editeng/source/outliner/outleeng.cxx b/editeng/source/outliner/outleeng.cxx index 645ecdb7fce2..116fec186fc3 100644 --- a/editeng/source/outliner/outleeng.cxx +++ b/editeng/source/outliner/outleeng.cxx @@ -38,7 +38,7 @@ OutlinerEditEng::~OutlinerEditEng() { } -void OutlinerEditEng::PaintingFirstLine( sal_Int32 nPara, const Point& rStartPos, tools::Long /*nBaseLineY*/, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev ) +void OutlinerEditEng::PaintingFirstLine( sal_Int32 nPara, const Point& rStartPos, tools::Long /*nBaseLineY*/, const Point& rOrigin, Degree10 nOrientation, OutputDevice* pOutDev ) { if( GetControlWord() & EEControlBits::OUTLINER ) { diff --git a/editeng/source/outliner/outleeng.hxx b/editeng/source/outliner/outleeng.hxx index 6830460204a0..fa6ae0da381b 100644 --- a/editeng/source/outliner/outleeng.hxx +++ b/editeng/source/outliner/outleeng.hxx @@ -37,7 +37,7 @@ public: OutlinerEditEng( Outliner* pOwner, SfxItemPool* pPool ); virtual ~OutlinerEditEng() override; - virtual void PaintingFirstLine( sal_Int32 nPara, const Point& rStartPos, tools::Long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev ) override; + virtual void PaintingFirstLine( sal_Int32 nPara, const Point& rStartPos, tools::Long nBaseLineY, const Point& rOrigin, Degree10 nOrientation, OutputDevice* pOutDev ) override; virtual void ParagraphInserted( sal_Int32 nNewParagraph ) override; virtual void ParagraphDeleted( sal_Int32 nDeletedParagraph ) override; diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index 411cc62a2158..73c62414bd53 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -864,7 +864,7 @@ vcl::Font Outliner::ImpCalcBulletFont( sal_Int32 nPara ) const aBulletFont.SetFontSize( Size( 0, nScaledLineHeight ) ); bool bVertical = IsVertical(); aBulletFont.SetVertical( bVertical ); - aBulletFont.SetOrientation( bVertical ? (IsTopToBottom() ? 2700 : 900) : 0 ); + aBulletFont.SetOrientation( Degree10(bVertical ? (IsTopToBottom() ? 2700 : 900) : 0) ); Color aColor( COL_AUTO ); if( !pEditEngine->IsFlatMode() && !( pEditEngine->GetControlWord() & EEControlBits::NOCOLORS ) ) @@ -880,7 +880,7 @@ vcl::Font Outliner::ImpCalcBulletFont( sal_Int32 nPara ) const } void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos, - const Point& rOrigin, short nOrientation, OutputDevice* pOutDev ) + const Point& rOrigin, Degree10 nOrientation, OutputDevice* pOutDev ) { bool bDrawBullet = false; @@ -949,7 +949,7 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos, { // Both TopLeft and bottom left is not quite correct, // since in EditEngine baseline ... - double nRealOrientation = nOrientation*F_PI1800; + double nRealOrientation = nOrientation.get() * F_PI1800; double nCos = cos( nRealOrientation ); double nSin = sin( nRealOrientation ); Point aRotatedPos; diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx index 790085b4031b..5be9b0a7493e 100644 --- a/editeng/source/rtf/rtfitem.cxx +++ b/editeng/source/rtf/rtfitem.cxx @@ -1039,7 +1039,7 @@ ATTR_SETEMPHASIS: if( aPlainMap.nHorzVert ) { // RTF knows only 90deg - pSet->Put( SvxCharRotateItem( 900, 1 == nTokenValue, + pSet->Put( SvxCharRotateItem( Degree10(900), 1 == nTokenValue, aPlainMap.nHorzVert )); } break; diff --git a/editeng/source/uno/unofdesc.cxx b/editeng/source/uno/unofdesc.cxx index a7042726c41f..0cfd7a710dcf 100644 --- a/editeng/source/uno/unofdesc.cxx +++ b/editeng/source/uno/unofdesc.cxx @@ -48,7 +48,7 @@ void SvxUnoFontDescriptor::ConvertToFont( const awt::FontDescriptor& rDesc, vcl: rFont.SetFamily( static_cast<FontFamily>(rDesc.Family) ); rFont.SetCharSet( static_cast<rtl_TextEncoding>(rDesc.CharSet) ); rFont.SetPitch( static_cast<FontPitch>(rDesc.Pitch) ); - rFont.SetOrientation( static_cast<short>(rDesc.Orientation*10) ); + rFont.SetOrientation( Degree10(static_cast<sal_Int16>(rDesc.Orientation*10)) ); rFont.SetKerning( rDesc.Kerning ? FontKerning::FontSpecific : FontKerning::NONE ); rFont.SetWeight( vcl::unohelper::ConvertFontWeight(rDesc.Weight) ); rFont.SetItalic( static_cast<FontItalic>(rDesc.Slant) ); @@ -66,7 +66,7 @@ void SvxUnoFontDescriptor::ConvertFromFont( const vcl::Font& rFont, awt::FontDes rDesc.Family = sal::static_int_cast< sal_Int16 >(rFont.GetFamilyType()); rDesc.CharSet = rFont.GetCharSet(); rDesc.Pitch = sal::static_int_cast< sal_Int16 >(rFont.GetPitch()); - rDesc.Orientation = static_cast< float >(rFont.GetOrientation() / 10); + rDesc.Orientation = static_cast< float >(rFont.GetOrientation().get() / 10); rDesc.Kerning = rFont.IsKerning(); rDesc.Weight = vcl::unohelper::ConvertFontWeight( rFont.GetWeight() ); rDesc.Slant = vcl::unohelper::ConvertFontSlant( rFont.GetItalic() ); diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx index a903bf99aa99..080521ed0523 100644 --- a/emfio/source/reader/mtftools.cxx +++ b/emfio/source/reader/mtftools.cxx @@ -254,7 +254,7 @@ namespace emfio if( rFont.lfStrikeOut ) aFont.SetStrikeout( STRIKEOUT_SINGLE ); - aFont.SetOrientation( static_cast<short>(rFont.lfEscapement) ); + aFont.SetOrientation( Degree10(static_cast<sal_Int16>(rFont.lfEscapement)) ); Size aFontSize( Size( rFont.lfWidth, rFont.lfHeight ) ); if ( rFont.lfHeight > 0 ) @@ -504,7 +504,7 @@ namespace emfio sal_Int32 nResult; const bool bFail = o3tl::checked_multiply(mnWinExtX, mnWinExtY, nResult); if (!bFail && nResult < 0) - rFont.SetOrientation( 3600 - rFont.GetOrientation() ); + rFont.SetOrientation( Degree10(3600) - rFont.GetOrientation() ); } tools::Polygon& MtfTools::ImplMap( tools::Polygon& rPolygon ) @@ -1514,8 +1514,7 @@ namespace emfio fOrientation = 360 - fOrientation; fOrientation += 90; fOrientation *= 10; - fOrientation += aTmp.GetOrientation(); - aTmp.SetOrientation( sal_Int16( fOrientation ) ); + aTmp.SetOrientation( aTmp.GetOrientation() + Degree10( static_cast<sal_Int16>(fOrientation) ) ); } } diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx index 61502b06c503..e8cca292467c 100644 --- a/filter/source/graphicfilter/eps/eps.cxx +++ b/filter/source/graphicfilter/eps/eps.cxx @@ -2002,14 +2002,14 @@ void PSWriter::ImplText( const OUString& rUniString, const Point& rPos, const lo if ( mnTextMode == 0 ) // using glyph outlines { vcl::Font aNotRotatedFont( maFont ); - aNotRotatedFont.SetOrientation( 0 ); + aNotRotatedFont.SetOrientation( Degree10(0) ); ScopedVclPtrInstance< VirtualDevice > pVirDev(DeviceFormat::BITMASK); pVirDev->SetMapMode( rVDev.GetMapMode() ); pVirDev->SetFont( aNotRotatedFont ); pVirDev->SetTextAlign( eTextAlign ); - sal_Int16 nRotation = maFont.GetOrientation(); + Degree10 nRotation = maFont.GetOrientation(); tools::Polygon aPolyDummy( 1 ); Point aPos( rPos ); @@ -2031,7 +2031,7 @@ void PSWriter::ImplText( const OUString& rUniString, const Point& rPos, const lo ImplWriteLine( "t" ); if ( nRotation ) { - ImplWriteF( nRotation, 1 ); + ImplWriteF( nRotation.get(), 1 ); mpPS->WriteCharPtr( "r " ); } for (auto const& elem : aPolyPolyVec) @@ -2057,7 +2057,7 @@ void PSWriter::ImplSetAttrForText( const Point& rPoint ) { Point aPoint( rPoint ); - long nRotation = maFont.GetOrientation(); + Degree10 nRotation = maFont.GetOrientation(); ImplWriteTextColor(PS_RET); Size aSize = maFont.GetFontSize(); @@ -2089,7 +2089,7 @@ void PSWriter::ImplSetAttrForText( const Point& rPoint ) if ( nRotation ) { mpPS->WriteCharPtr( "gs " ); - ImplWriteF( nRotation, 1 ); + ImplWriteF( nRotation.get(), 1 ); mpPS->WriteCharPtr( "r " ); } } diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.cxx b/filter/source/graphicfilter/idxf/dxf2mtf.cxx index 3d9e6c9ed463..f6fc91ae792d 100644 --- a/filter/source/graphicfilter/idxf/dxf2mtf.cxx +++ b/filter/source/graphicfilter/idxf/dxf2mtf.cxx @@ -206,7 +206,7 @@ bool DXF2GDIMetaFile::SetFontAttribute(const DXFBasicEntity & rE, short nAngle, aFont.SetFamily(FAMILY_SWISS); aFont.SetFontSize(Size(0,nHeight)); aFont.SetAlignment(ALIGN_BASELINE); - aFont.SetOrientation(nAngle); + aFont.SetOrientation(Degree10(nAngle)); if (aActFont!=aFont) { aActFont=aFont; pVirDev->SetFont(aActFont); diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx b/filter/source/graphicfilter/ios2met/ios2met.cxx index 7746b579df1d..cdf18abc66e4 100644 --- a/filter/source/graphicfilter/ios2met/ios2met.cxx +++ b/filter/source/graphicfilter/ios2met/ios2met.cxx @@ -286,7 +286,7 @@ struct OSAttr RasterOp eImgMix; RasterOp eImgBgMix; sal_Int32 nArcP, nArcQ, nArcR, nArcS; - short nChrAng; + Degree10 nChrAng; Size aChrCellSize; sal_uInt32 nChrSet; Point aCurPos; @@ -1013,7 +1013,7 @@ void OS2METReader::ReadChrStr(bool bGivenPos, bool bMove, bool bExtra, sal_uInt1 aFont = pF->aFont; aFont.SetColor(aAttr.aChrCol); aFont.SetFontSize(Size(0,aAttr.aChrCellSize.Height())); - if ( aAttr.nChrAng != 0 ) + if ( aAttr.nChrAng ) aFont.SetOrientation(aAttr.nChrAng); if (bGivenPos) @@ -1049,7 +1049,7 @@ void OS2METReader::ReadChrStr(bool bGivenPos, bool bMove, bool bExtra, sal_uInt1 pVirDev->DrawText(aP0,aStr); aSize = Size( pVirDev->GetTextWidth(aStr), pVirDev->GetTextHeight() ); - if ( aAttr.nChrAng == 0 ) + if ( !aAttr.nChrAng ) { aCalcBndRect.Union(tools::Rectangle( Point(aP0.X(),aP0.Y()-aSize.Height()), Size(aSize.Width(),aSize.Height()*2))); @@ -2037,11 +2037,11 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, sal_uInt16 nOrderLen) case GOrdSChAng: { sal_Int32 nX = ReadCoord(bCoord32); sal_Int32 nY = ReadCoord(bCoord32); - if (nX>=0 && nY==0) aAttr.nChrAng=0; + if (nX>=0 && nY==0) aAttr.nChrAng=Degree10(0); else { - aAttr.nChrAng=static_cast<short>(atan2(static_cast<double>(nY),static_cast<double>(nX))/3.1415926539*1800.0); - while (aAttr.nChrAng<0) aAttr.nChrAng+=3600; - aAttr.nChrAng%=3600; + aAttr.nChrAng = Degree10(static_cast<short>(atan2(static_cast<double>(nY),static_cast<double>(nX))/3.1415926539*1800.0)); + while (aAttr.nChrAng < Degree10(0)) aAttr.nChrAng += Degree10(3600); + aAttr.nChrAng %= Degree10(3600); } break; } @@ -2689,7 +2689,7 @@ void OS2METReader::ReadOS2MET( SvStream & rStreamOS2MET, GDIMetaFile & rGDIMetaF aDefAttr.nArcQ =1; aDefAttr.nArcR =0; aDefAttr.nArcS =0; - aDefAttr.nChrAng =0; + aDefAttr.nChrAng =Degree10(0); aDefAttr.aChrCellSize=Size(12,12); aDefAttr.nChrSet =0; aDefAttr.aCurPos =Point(0,0); diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index f9f3f7197f21..ce03064a89c0 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -1452,7 +1452,8 @@ Graphic lclDrawHatch( const drawing::Hatch& rHatch, const Color& rBackColor, boo pVDev->SetLineColor(); pVDev->SetFillColor(bFillBackground ? rBackColor : COL_TRANSPARENT); pVDev->DrawRect(rRect); - pVDev->DrawHatch(tools::PolyPolygon(rRect), Hatch(static_cast<HatchStyle>(rHatch.Style), Color(rHatch.Color), rHatch.Distance, static_cast<sal_uInt16>(rHatch.Angle))); + pVDev->DrawHatch(tools::PolyPolygon(rRect), Hatch(static_cast<HatchStyle>(rHatch.Style), Color(rHatch.Color), rHatch.Distance, + Degree10(rHatch.Angle))); aMtf.Stop(); aMtf.WindStart(); aMtf.SetPrefMapMode(MapMode(MapUnit::Map100thMM)); @@ -3926,7 +3927,7 @@ EscherBlibEntry::EscherBlibEntry( sal_uInt32 nPictureOffset, const GraphicObject .WriteInt32( pGraphicAttr->GetTopCrop() ) .WriteInt32( pGraphicAttr->GetRightCrop() ) .WriteInt32( pGraphicAttr->GetBottomCrop() ) - .WriteUInt16( pGraphicAttr->GetRotation() ) + .WriteUInt16( pGraphicAttr->GetRotation().get() ) .WriteInt16( pGraphicAttr->GetLuminance() ) .WriteInt16( pGraphicAttr->GetContrast() ) .WriteInt16( pGraphicAttr->GetChannelR() ) @@ -4622,7 +4623,7 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( bool bFirst ) sal_Int32 nAngle = ( EscherPropertyValueHelper::GetPropertyValue( aAny, aPropertySet, "RotateAngle", true ) ) ? *o3tl::doAccess<sal_Int32>(aAny) : 0; if ( nAngle ) - aPoly.Rotate( aRect.TopLeft(), static_cast<sal_uInt16>( ( nAngle + 5 ) / 10 ) ); + aPoly.Rotate( aRect.TopLeft(), Degree10(static_cast<sal_Int16>( ( nAngle + 5 ) / 10 )) ); nRule = GetClosestPoint( aPoly, aRefPoint ); if (aType == OString( "drawing.Ellipse" )) diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx index 5619e1e09fa9..7132b8067e98 100644 --- a/filter/source/msfilter/eschesdo.cxx +++ b/filter/source/msfilter/eschesdo.cxx @@ -364,7 +364,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj, tools::Polygon aPolygon( rRect, aStart, aEnd, ePolyKind ); if( rObj.GetAngle() ) { - aPolygon.Rotate( rRect.TopLeft(), static_cast<sal_uInt16>( rObj.GetAngle() / 10 ) ); + aPolygon.Rotate( rRect.TopLeft(), Degree10(static_cast<sal_Int16>( rObj.GetAngle() / 10 )) ); rObj.SetAngle( 0 ); } mpEscherEx->OpenContainer( ESCHER_SpContainer ); diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index bd29942a6931..a32eed5a017d 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -1288,7 +1288,7 @@ static void ApplyRectangularGradientAsBitmap( const SvxMSDffManager& rManager, S rIn.Seek( nPos ); if ( bRotateWithShape ) { - aBitmapEx.Rotate( nFix16Angle / 10, rShadeColors[ 0 ].aColor ); + aBitmapEx.Rotate( Degree10(nFix16Angle / 10), rShadeColors[ 0 ].aColor ); BmpMirrorFlags nMirrorFlags = BmpMirrorFlags::NONE; if ( rObjData.nSpFlags & ShapeFlag::FlipV ) @@ -2865,7 +2865,7 @@ void DffPropertyReader::ImportGradientColor( SfxItemSet& aSet, sal_uInt32 eMSO_F } //Construct gradient item - XGradient aGrad( aCol2, aCol1, eGrad, nAngle, nFocusX, nFocusY ); + XGradient aGrad( aCol2, aCol1, eGrad, Degree10(nAngle), nFocusX, nFocusY ); //Intensity has been merged into color. So here just set is as 100 aGrad.SetStartIntens( 100 ); aGrad.SetEndIntens( 100 ); @@ -2878,7 +2878,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, nAngle, nFocusX, nFocusY ); + XGradient aGrad2( aCol2 , aCol1 , eGrad, Degree10(nAngle), nFocusX, nFocusY ); aSet.Put( XFillFloatTransparenceItem( OUString(), aGrad2 ) ); } } diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 6a0794e94f15..7fa83e05bc75 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -1117,7 +1117,7 @@ void PDFExport::ImplWriteWatermark( vcl::PDFWriter& rWriter, const Size& rPageSi if( rPageSize.Width() < rPageSize.Height() ) { nTextWidth = rPageSize.Height(); - aFont.SetOrientation( 2700 ); + aFont.SetOrientation( Degree10(2700) ); } // adjust font height for text to fit @@ -1185,7 +1185,7 @@ void PDFExport::ImplWriteTiledWatermark( vcl::PDFWriter& rWriter, const Size& rP aFont.SetWeight( WEIGHT_NORMAL ); aFont.SetAlignment( ALIGN_BOTTOM ); aFont.SetFontHeight(40); - aFont.SetOrientation(450); + aFont.SetOrientation(Degree10(450)); OutputDevice* pDev = rWriter.GetReferenceDevice(); pDev->SetFont(aFont); diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index 7998d56754d0..37c301f2a3bf 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -221,7 +221,7 @@ void SVGAttributeWriter::AddGradientDef( const tools::Rectangle& rObjRect, const { SvXMLElementExport aDesc( mrExport, XML_NAMESPACE_NONE, aXMLElemDefs, true, true ); Color aStartColor( rGradient.GetStartColor() ), aEndColor( rGradient.GetEndColor() ); - sal_uInt16 nAngle = rGradient.GetAngle() % 3600; + Degree10 nAngle = rGradient.GetAngle() % Degree10(3600); Point aObjRectCenter( rObjRect.Center() ); tools::Polygon aPoly( rObjRect ); static sal_Int32 nCurGradientId = 1; @@ -1252,7 +1252,7 @@ void SVGTextWriter::startTextShape() { Point aRot( maTextPos ); OUString aTransform = "rotate(" + - OUString::number( rFont.GetOrientation() * -0.1 ) + " " + + OUString::number( rFont.GetOrientation().get() * -0.1 ) + " " + OUString::number( aRot.X() ) + " " + OUString::number( aRot.Y() ) + ")"; mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTransform, aTransform ); @@ -2249,7 +2249,7 @@ void SVGActionWriter::ImplWriteGradientLinear( const tools::PolyPolygon& rPolyPo rGradient.GetBoundRect( rPolyPoly.GetBoundRect(), aTmpRect, aTmpCenter ); ImplMap( aTmpRect, aRect ); ImplMap( aTmpCenter, aCenter ); - const sal_uInt16 nAngle = rGradient.GetAngle() % 3600; + const Degree10 nAngle = rGradient.GetAngle() % Degree10(3600); tools::Polygon aPoly( 2 ); // Setting x value of a gradient vector to rotation center to @@ -2601,7 +2601,7 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText, { Point aRot( aPos ); OUString aTransform = "rotate(" + - OUString::number( rFont.GetOrientation() * -0.1 ) + " " + + OUString::number( rFont.GetOrientation().get() * -0.1 ) + " " + OUString::number( aRot.X() ) + " " + OUString::number( aRot.Y() ) + ")"; mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTransform, aTransform ); diff --git a/include/editeng/charrotateitem.hxx b/include/editeng/charrotateitem.hxx index 0ce60bb1a05b..093c84224fe5 100644 --- a/include/editeng/charrotateitem.hxx +++ b/include/editeng/charrotateitem.hxx @@ -20,6 +20,7 @@ #define INCLUDED_EDITENG_CHARROTATEITEM_HXX #include <svl/intitem.hxx> +#include <tools/degree.hxx> #include <editeng/editengdllapi.h> // class SvxTextRotateItem ---------------------------------------------- @@ -34,7 +35,7 @@ class EDITENG_DLLPUBLIC SvxTextRotateItem : public SfxUInt16Item { public: - SvxTextRotateItem(sal_uInt16 nValue, const sal_uInt16 nId); + SvxTextRotateItem(Degree10 nValue, const sal_uInt16 nId); virtual SvxTextRotateItem* Clone(SfxItemPool *pPool = nullptr) const override; @@ -47,11 +48,14 @@ public: virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override; + Degree10 GetValue() const { return Degree10(SfxUInt16Item::GetValue()); } + void SetValue(Degree10 val) { SfxUInt16Item::SetValue(val.get()); } + // our currently only degree values - void SetTopToBottom() { SetValue(2700); } - void SetBottomToTop() { SetValue(900); } - bool IsTopToBottom() const { return 2700 == GetValue(); } - bool IsBottomToTop() const { return 900 == GetValue(); } + void SetTopToBottom() { SetValue(Degree10(2700)); } + void SetBottomToTop() { SetValue(Degree10(900)); } + bool IsTopToBottom() const { return Degree10(2700) == GetValue(); } + bool IsBottomToTop() const { return Degree10(900) == GetValue(); } bool IsVertical() const { return IsTopToBottom() || IsBottomToTop(); } void dumpAsXml(xmlTextWriterPtr pWriter) const override; @@ -75,7 +79,7 @@ class EDITENG_DLLPUBLIC SvxCharRotateItem final : public SvxTextRotateItem public: static SfxPoolItem* CreateDefault(); - SvxCharRotateItem( sal_uInt16 nValue /*= 0*/, + SvxCharRotateItem( Degree10 nValue /*= 0*/, bool bFitIntoLine /*= false*/, const sal_uInt16 nId ); diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx index 3f896f09a23c..871acf2f43b5 100644 --- a/include/editeng/editeng.hxx +++ b/include/editeng/editeng.hxx @@ -37,6 +37,7 @@ #include <i18nlangtag/lang.h> #include <tools/lineend.hxx> +#include <tools/degree.hxx> #include <editeng/eedata.hxx> #include <o3tl/typed_flags_set.hxx> @@ -373,7 +374,7 @@ public: void Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect ); void Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect, const Point& rStartDocPos ); void Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect, const Point& rStartDocPos, bool bClip ); - void Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation = 0 ); + void Draw( OutputDevice* pOutDev, const Point& rStartPos, Degree10 nOrientation = Degree10(0) ); ErrCode Read( SvStream& rInput, const OUString& rBaseURL, EETextFormat, SvKeyValueIterator* pHTTPHeaderAttrs = nullptr ); void Write( SvStream& rOutput, EETextFormat ); @@ -480,7 +481,7 @@ public: void SetBeginPasteOrDropHdl( const Link<PasteOrDropInfos&,void>& rLink ); void SetEndPasteOrDropHdl( const Link<PasteOrDropInfos&,void>& rLink ); - virtual void PaintingFirstLine( sal_Int32 nPara, const Point& rStartPos, tools::Long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev ); + virtual void PaintingFirstLine( sal_Int32 nPara, const Point& rStartPos, tools::Long nBaseLineY, const Point& rOrigin, Degree10 nOrientation, OutputDevice* pOutDev ); virtual void ParagraphInserted( sal_Int32 nNewParagraph ); virtual void ParagraphDeleted( sal_Int32 nDeletedParagraph ); virtual void ParagraphConnected( sal_Int32 nLeftParagraph, sal_Int32 nRightParagraph ); diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 083cee135e99..3ea2fd9b2631 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -635,7 +635,7 @@ protected: void InvalidateBullet(sal_Int32 nPara); void PaintBullet( sal_Int32 nPara, const Point& rStartPos, - const Point& rOrigin, short nOrientation, + const Point& rOrigin, Degree10 nOrientation, OutputDevice* pOutDev ); // used by OutlinerEditEng. Allows Outliner objects to provide diff --git a/include/o3tl/strong_int.hxx b/include/o3tl/strong_int.hxx index 006a36c8900f..3db958212229 100644 --- a/include/o3tl/strong_int.hxx +++ b/include/o3tl/strong_int.hxx @@ -112,6 +112,11 @@ public: strong_int operator--(int) { UNDERLYING_TYPE nOldValue = m_value; --m_value; return strong_int(nOldValue); } 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); } bool anyOf(strong_int v) const { return *this == v; diff --git a/include/svl/imageitm.hxx b/include/svl/imageitm.hxx index c135216cc482..2340230fb4a4 100644 --- a/include/svl/imageitm.hxx +++ b/include/svl/imageitm.hxx @@ -23,11 +23,11 @@ #include <svl/svldllapi.h> #include <svl/intitem.hxx> #include <memory> +#include <tools/degree.hxx> struct SfxImageItem_Impl; class SVL_DLLPUBLIC SfxImageItem final : public SfxInt16Item { - std::unique_ptr<SfxImageItem_Impl> pImpl; public: static SfxPoolItem* CreateDefault(); SfxImageItem( sal_uInt16 nWhich = 0 ); @@ -39,10 +39,15 @@ public: virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; - void SetRotation( tools::Long nValue ); - tools::Long GetRotation() const; - void SetMirrored( bool bSet ); - bool IsMirrored() const; + void SetRotation( Degree10 nValue ) { mnAngle = nValue; } + Degree10 GetRotation() const { return mnAngle; } + void SetMirrored( bool bSet ) { mbMirrored = bSet; } + bool IsMirrored() const { return mbMirrored; } + +private: + OUString maURL; + Degree10 mnAngle; + bool mbMirrored; }; #endif // _SFX_IMAGEITM_HXX diff --git a/include/svx/xgrad.hxx b/include/svx/xgrad.hxx index f8ef9dbe9f98..6e372ec2dbfb 100644 --- a/include/svx/xgrad.hxx +++ b/include/svx/xgrad.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SVX_XGRAD_HXX #include <tools/color.hxx> +#include <tools/degree.hxx> #include <svx/svxdllapi.h> #include <com/sun/star/awt/GradientStyle.hpp> #include <boost/property_tree/ptree_fwd.hpp> @@ -32,7 +33,7 @@ class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC XGradient final css::awt::GradientStyle eStyle; Color aStartColor; Color aEndColor; - long nAngle; + Degree10 nAngle; sal_uInt16 nBorder; sal_uInt16 nOfsX; sal_uInt16 nOfsY; @@ -45,7 +46,7 @@ class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC XGradient final public: XGradient(); XGradient( const Color& rStart, const Color& rEnd, - css::awt::GradientStyle eStyle = css::awt::GradientStyle_LINEAR, long nAngle = 0, + css::awt::GradientStyle eStyle = css::awt::GradientStyle_LINEAR, Degree10 nAngle = Degree10(0), sal_uInt16 nXOfs = 50, sal_uInt16 nYOfs = 50, sal_uInt16 nBorder = 0, sal_uInt16 nStartIntens = 100, sal_uInt16 nEndIntens = 100, sal_uInt16 nSteps = 0 ); @@ -55,7 +56,7 @@ public: void SetGradientStyle(css::awt::GradientStyle eNewStyle) { eStyle = eNewStyle; } void SetStartColor(const Color& rColor) { aStartColor = rColor; } void SetEndColor(const Color& rColor) { aEndColor = rColor; } - void SetAngle(long nNewAngle) { nAngle = nNewAngle; } + void SetAngle(Degree10 nNewAngle) { nAngle = nNewAngle; } void SetBorder(sal_uInt16 nNewBorder) { nBorder = nNewBorder; } void SetXOffset(sal_uInt16 nNewOffset) { nOfsX = nNewOffset; } void SetYOffset(sal_uInt16 nNewOffset) { nOfsY = nNewOffset; } @@ -66,7 +67,7 @@ public: css::awt::GradientStyle GetGradientStyle() const { return eStyle; } const Color& GetStartColor() const { return aStartColor; } const Color& GetEndColor() const { return aEndColor; } - long GetAngle() const { return nAngle; } + Degree10 GetAngle() const { return nAngle; } sal_uInt16 GetBorder() const { return nBorder; } sal_uInt16 GetXOffset() const { return nOfsX; } sal_uInt16 GetYOffset() const { return nOfsY; } diff --git a/include/svx/xhatch.hxx b/include/svx/xhatch.hxx index 79b5f624e338..0ef791c64caf 100644 --- a/include/svx/xhatch.hxx +++ b/include/svx/xhatch.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SVX_XHATCH_HXX #include <tools/color.hxx> +#include <tools/degree.hxx> #include <svx/svxdllapi.h> #include <com/sun/star/drawing/HatchStyle.hpp> @@ -32,24 +33,24 @@ class SVXCORE_DLLPUBLIC XHatch final css::drawing::HatchStyle eStyle; Color aColor; long nDistance; - long nAngle; + Degree10 nAngle; public: XHatch() : eStyle(css::drawing::HatchStyle_SINGLE), nDistance(0), nAngle(0) {} XHatch(const Color& rCol, css::drawing::HatchStyle eStyle = css::drawing::HatchStyle_SINGLE, - long nDistance = 20, long nAngle = 0); + long nDistance = 20, Degree10 nAngle = Degree10(0)); bool operator==(const XHatch& rHatch) const; void SetHatchStyle(css::drawing::HatchStyle eNewStyle) { eStyle = eNewStyle; } void SetColor(const Color& rColor) { aColor = rColor; } void SetDistance(long nNewDistance) { nDistance = nNewDistance; } - void SetAngle(long nNewAngle) { nAngle = nNewAngle; } + void SetAngle(Degree10 nNewAngle) { nAngle = nNewAngle; } css::drawing::HatchStyle GetHatchStyle() const { return eStyle; } const Color& GetColor() const { return aColor; } long GetDistance() const { return nDistance; } - long GetAngle() const { return nAngle; } + Degree10 GetAngle() const { return nAngle; } }; #endif diff --git a/include/tools/degree.hxx b/include/tools/degree.hxx new file mode 100644 index 000000000000..7151abccb228 --- /dev/null +++ b/include/tools/degree.hxx @@ -0,0 +1,18 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#pragma once + +#include <sal/types.h> +#include <o3tl/strong_int.hxx> + +/** tenths of a Degree, normally rotation */ + +typedef o3tl::strong_int<sal_Int16, struct Degree10Tag> Degree10; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx index b357d2198de1..1198b8dbaab4 100644 --- a/include/tools/gen.hxx +++ b/include/tools/gen.hxx @@ -22,6 +22,7 @@ #include <tools/toolsdllapi.h> #include <tools/long.hxx> +#include <tools/degree.hxx> #include <limits.h> #include <algorithm> #include <ostream> @@ -83,8 +84,8 @@ public: tools::Long AdjustX( tools::Long nHorzMove ) { nA += nHorzMove; return nA; } tools::Long AdjustY( tools::Long nVertMove ) { nB += nVertMove; return nB; } - void RotateAround( tools::Long& rX, tools::Long& rY, short nOrientation ) const; - void RotateAround( Point&, short nOrientation ) const; + void RotateAround( tools::Long& rX, tools::Long& rY, Degree10 nOrientation ) const; + void RotateAround( Point&, Degree10 nOrientation ) const; Point& operator += ( const Point& rPoint ); Point& operator -= ( const Point& rPoint ); diff --git a/include/tools/poly.hxx b/include/tools/poly.hxx index d9f39fb080f4..de03619eaf31 100644 --- a/include/tools/poly.hxx +++ b/include/tools/poly.hxx @@ -21,6 +21,7 @@ #include <tools/toolsdllapi.h> #include <tools/gen.hxx> +#include <tools/degree.hxx> #include <o3tl/typed_flags_set.hxx> #include <o3tl/cow_wrapper.hxx> @@ -145,7 +146,7 @@ public: void Translate( const Point& rTrans ); void Scale( double fScaleX, double fScaleY ); void Rotate( const Point& rCenter, double fSin, double fCos ); - void Rotate( const Point& rCenter, sal_uInt16 nAngle10 ); + void Rotate( const Point& rCenter, Degree10 nAngle10 ); void Insert( sal_uInt16 nPos, const Point& rPt ); void Insert( sal_uInt16 nPos, const tools::Polygon& rPoly ); @@ -236,7 +237,7 @@ public: void Translate( const Point& rTrans ); void Scale( double fScaleX, double fScaleY ); void Rotate( const Point& rCenter, double fSin, double fCos ); - void Rotate( const Point& rCenter, sal_uInt16 nAngle10 ); + void Rotate( const Point& rCenter, Degree10 nAngle10 ); const tools::Polygon& operator[]( sal_uInt16 nPos ) const { return GetObject( nPos ); } tools::Polygon& operator[]( sal_uInt16 nPos ); diff --git a/include/vcl/GraphicAttributes.hxx b/include/vcl/GraphicAttributes.hxx index a26f59edc890..5216d2934166 100644 --- a/include/vcl/GraphicAttributes.hxx +++ b/include/vcl/GraphicAttributes.hxx @@ -19,6 +19,7 @@ #pragma once +#include <tools/degree.hxx> #include <vcl/dllapi.h> #include <vcl/bitmap.hxx> @@ -39,7 +40,7 @@ private: tools::Long mnTopCrop; tools::Long mnRightCrop; tools::Long mnBottomCrop; - sal_uInt16 mnRotate10; + Degree10 mnRotate10; short mnContPercent; short mnLumPercent; short mnRPercent; @@ -74,8 +75,8 @@ public: tools::Long GetRightCrop() const { return mnRightCrop; } tools::Long GetBottomCrop() const { return mnBottomCrop; } - void SetRotation(sal_uInt16 nRotate10) { mnRotate10 = nRotate10; } - sal_uInt16 GetRotation() const { return mnRotate10; } + void SetRotation(Degree10 nRotate10) { mnRotate10 = nRotate10; } + Degree10 GetRotation() const { return mnRotate10; } void SetLuminance(short nLuminancePercent) { mnLumPercent = nLuminancePercent; } short GetLuminance() const { return mnLumPercent; } @@ -107,7 +108,7 @@ public: { return (mnLeftCrop != 0 || mnTopCrop != 0 || mnRightCrop != 0 || mnBottomCrop != 0); } - bool IsRotated() const { return ((mnRotate10 % 3600) != 0); } + bool IsRotated() const { return ((mnRotate10 % Degree10(3600)) != Degree10(0)); } bool IsTransparent() const { return (mcTransparency > 0); } bool IsAdjusted() const { diff --git a/include/vcl/GraphicNativeMetadata.hxx b/include/vcl/GraphicNativeMetadata.hxx index 3dbd7ff8a7d2..7cc8b663f18a 100644 --- a/include/vcl/GraphicNativeMetadata.hxx +++ b/include/vcl/GraphicNativeMetadata.hxx @@ -21,10 +21,11 @@ #include <vcl/graph.hxx> #include <tools/stream.hxx> +#include <tools/degree.hxx> class VCL_DLLPUBLIC GraphicNativeMetadata final { - sal_uInt16 mRotation; + Degree10 mRotation; public: GraphicNativeMetadata(); @@ -33,8 +34,8 @@ public: bool read(Graphic const& rGraphic); bool read(SvStream& rStream); - // counter-clock-wise rotation in permille - sal_uInt16 getRotation() const { return mRotation; } + // counter-clock-wise rotation 10ths of a degree + Degree10 getRotation() const { return mRotation; } }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/GraphicNativeTransform.hxx b/include/vcl/GraphicNativeTransform.hxx index b4d71f2d53d0..3b05ac323232 100644 --- a/include/vcl/GraphicNativeTransform.hxx +++ b/include/vcl/GraphicNativeTransform.hxx @@ -20,6 +20,7 @@ #pragma once #include <rtl/ustring.hxx> +#include <tools/degree.hxx> #include <sal/types.h> #include <vcl/dllapi.h> @@ -29,15 +30,15 @@ class VCL_DLLPUBLIC GraphicNativeTransform final { Graphic& mrGraphic; - bool rotateBitmapOnly(sal_uInt16 aRotation); - void rotateJPEG(sal_uInt16 aRotation); - bool rotateGeneric(sal_uInt16 aRotation, const OUString& aType); + bool rotateBitmapOnly(Degree10 aRotation); + void rotateJPEG(Degree10 aRotation); + bool rotateGeneric(Degree10 aRotation, const OUString& aType); public: GraphicNativeTransform(Graphic& rGraphic); ~GraphicNativeTransform(); - void rotate(sal_uInt16 aRotation); + void rotate(Degree10 aRotation); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index 932bab285784..74d3a2e11724 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -21,6 +21,7 @@ #define INCLUDED_VCL_BITMAP_HXX #include <tools/solar.h> +#include <tools/degree.hxx> #include <vcl/checksum.hxx> #include <vcl/dllapi.h> #include <vcl/mapmod.hxx> @@ -349,7 +350,7 @@ public: @return true, if the operation was completed successfully. */ - bool Rotate( tools::Long nAngle10, const Color& rFillColor ); + bool Rotate( Degree10 nAngle10, const Color& rFillColor ); /** Create on-off mask from bitmap diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx index 7c9eb69383c1..dc9f8a837502 100644 --- a/include/vcl/bitmapex.hxx +++ b/include/vcl/bitmapex.hxx @@ -24,6 +24,7 @@ #include <vcl/alpha.hxx> #include <vcl/Scanline.hxx> #include <tools/color.hxx> +#include <tools/degree.hxx> #include <sal/types.h> @@ -233,7 +234,7 @@ public: @return true, if the operation was completed successfully. */ bool Rotate( - tools::Long nAngle10, + Degree10 nAngle10, const Color& rFillColor ); /** Replace all pixel having the search color with the specified color diff --git a/include/vcl/cursor.hxx b/include/vcl/cursor.hxx index 3937c0e48c4e..ff66326d90b9 100644 --- a/include/vcl/cursor.hxx +++ b/include/vcl/cursor.hxx @@ -50,7 +50,7 @@ private: VclPtr<vcl::Window> mpWindow; // only for shadow cursor Size maSize; Point maPos; - short mnOrientation; + Degree10 mnOrientation; sal_uInt16 mnStyle; bool mbVisible; CursorDirection mnDirection; @@ -87,7 +87,7 @@ public: tools::Long GetWidth() const { return maSize.Width(); } tools::Long GetHeight() const { return maSize.Height(); } - void SetOrientation( short nOrientation = 0 ); + void SetOrientation( Degree10 nOrientation = Degree10(0) ); void SetDirection( CursorDirection nDirection = CursorDirection::NONE ); diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx index 02f4a6d3f264..2d437c5b3da0 100644 --- a/include/vcl/font.hxx +++ b/include/vcl/font.hxx @@ -26,6 +26,7 @@ #include <tools/color.hxx> #include <tools/fontenum.hxx> #include <tools/long.hxx> +#include <tools/degree.hxx> #include <i18nlangtag/lang.h> #include <vcl/fntstyle.hxx> #include <o3tl/cow_wrapper.hxx> @@ -122,8 +123,8 @@ public: void SetCJKContextLanguage( LanguageType ); LanguageType GetCJKContextLanguage() const; - void SetOrientation( short nLineOrientation ); - short GetOrientation() const; + void SetOrientation( Degree10 nLineOrientation ); + Degree10 GetOrientation() const; void SetVertical( bool bVertical ); bool IsVertical() const; void SetKerning( FontKerning nKerning ); diff --git a/include/vcl/gdimtf.hxx b/include/vcl/gdimtf.hxx index bb20b618719a..202480faa818 100644 --- a/include/vcl/gdimtf.hxx +++ b/include/vcl/gdimtf.hxx @@ -116,7 +116,7 @@ public: void Move( tools::Long nX, tools::Long nY, tools::Long nDPIX, tools::Long nDPIY ); void Scale( double fScaleX, double fScaleY ); void Scale( const Fraction& rScaleX, const Fraction& rScaleY ); - void Rotate( tools::Long nAngle10 ); + void Rotate( Degree10 nAngle10 ); void Clip( const tools::Rectangle& ); bool HasTransparentActions() const; diff --git a/include/vcl/gradient.hxx b/include/vcl/gradient.hxx index aee89e06b50e..f2336d797703 100644 --- a/include/vcl/gradient.hxx +++ b/include/vcl/gradient.hxx @@ -23,6 +23,7 @@ #include <sal/types.h> #include <vcl/dllapi.h> #include <tools/color.hxx> +#include <tools/degree.hxx> #include <vcl/vclenum.hxx> #include <o3tl/cow_wrapper.hxx> @@ -56,8 +57,8 @@ public: void SetEndColor( const Color& rColor ); const Color& GetEndColor() const; - void SetAngle( sal_uInt16 nAngle ); - sal_uInt16 GetAngle() const; + void SetAngle( Degree10 nAngle ); + Degree10 GetAngle() const; void SetBorder( sal_uInt16 nBorder ); sal_uInt16 GetBorder() const; diff --git a/include/vcl/hatch.hxx b/include/vcl/hatch.hxx index 92afd57b6126..713f22b95dd1 100644 --- a/include/vcl/hatch.hxx +++ b/include/vcl/hatch.hxx @@ -22,6 +22,7 @@ #include <tools/color.hxx> #include <tools/long.hxx> +#include <tools/degree.hxx> #include <vcl/dllapi.h> #include <vcl/vclenum.hxx> @@ -35,7 +36,7 @@ struct ImplHatch Color maColor; HatchStyle meStyle; tools::Long mnDistance; - sal_uInt16 mnAngle; + Degree10 mnAngle; ImplHatch(); @@ -48,7 +49,7 @@ public: Hatch(); Hatch( const Hatch& rHatch ); - Hatch( HatchStyle eStyle, const Color& rHatchColor, tools::Long nDistance, sal_uInt16 nAngle10 ); + Hatch( HatchStyle eStyle, const Color& rHatchColor, tools::Long nDistance, Degree10 nAngle10 ); ~Hatch(); Hatch& operator=( const Hatch& rHatch ); @@ -63,8 +64,8 @@ public: void SetDistance( tools::Long nDistance ); tools::Long GetDistance() const { return mpImplHatch->mnDistance; } - void SetAngle( sal_uInt16 nAngle10 ); - sal_uInt16 GetAngle() const { return mpImplHatch->mnAngle; } + void SetAngle( Degree10 nAngle10 ); + Degree10 GetAngle() const { return mpImplHatch->mnAngle; } friend SvStream& ReadHatch( SvStream& rIStm, Hatch& rHatch ); friend SvStream& WriteHatch( SvStream& rOStm, const Hatch& rHatch ); diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index e1f6b17c47a0..60664ce3de02 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -959,7 +959,7 @@ public: private: - SAL_DLLPRIVATE void CalcHatchValues( const tools::Rectangle& rRect, tools::Long nDist, sal_uInt16 nAngle10, Point& rPt1, Point& rPt2, Size& rInc, Point& rEndPt1 ); + SAL_DLLPRIVATE void CalcHatchValues( const tools::Rectangle& rRect, tools::Long nDist, Degree10 nAngle10, Point& rPt1, Point& rPt2, Size& rInc, Point& rEndPt1 ); SAL_DLLPRIVATE void DrawHatchLine( const tools::Line& rLine, const tools::PolyPolygon& rPolyPoly, Point* pPtBuffer, bool bMtf ); ///@} @@ -1207,9 +1207,9 @@ private: SAL_DLLPRIVATE void ImplDrawSpecialText( SalLayout& ); SAL_DLLPRIVATE void ImplDrawTextRect( tools::Long nBaseX, tools::Long nBaseY, tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ); - SAL_DLLPRIVATE static void ImplDrawWavePixel( tools::Long nOriginX, tools::Long nOriginY, tools::Long nCurX, tools::Long nCurY, short nOrientation, SalGraphics* pGraphics, OutputDevice const * pOutDev, + SAL_DLLPRIVATE static void ImplDrawWavePixel( tools::Long nOriginX, tools::Long nOriginY, tools::Long nCurX, tools::Long nCurY, Degree10 nOrientation, SalGraphics* pGraphics, OutputDevice const * pOutDev, bool bDrawPixAsRect, tools::Long nPixWidth, tools::Long nPixHeight ); - SAL_DLLPRIVATE void ImplDrawWaveLine( tools::Long nBaseX, tools::Long nBaseY, tools::Long nStartX, tools::Long nStartY, tools::Long nWidth, tools::Long nHeight, tools::Long nLineWidth, short nOrientation, const Color& rColor ); + SAL_DLLPRIVATE void ImplDrawWaveLine( tools::Long nBaseX, tools::Long nBaseY, tools::Long nStartX, tools::Long nStartY, tools::Long nWidth, tools::Long nHeight, tools::Long nLineWidth, Degree10 nOrientation, const Color& rColor ); SAL_DLLPRIVATE void ImplDrawWaveTextLine( tools::Long nBaseX, tools::Long nBaseY, tools::Long nX, tools::Long nY, tools::Long nWidth, FontLineStyle eTextLine, Color aColor, bool bIsAbove ); SAL_DLLPRIVATE void ImplDrawStraightTextLine( tools::Long nBaseX, tools::Long nBaseY, tools::Long nX, tools::Long nY, tools::Long nWidth, FontLineStyle eTextLine, Color aColor, bool bIsAbove ); SAL_DLLPRIVATE void ImplDrawStrikeoutLine( tools::Long nBaseX, tools::Long nBaseY, tools::Long nX, tools::Long nY, tools::Long nWidth, FontStrikeout eStrikeout, Color aColor ); diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx index 8a5b9d2f502b..8546e3870418 100644 --- a/include/vcl/toolbox.hxx +++ b/include/vcl/toolbox.hxx @@ -26,6 +26,7 @@ #include <vcl/image.hxx> #include <vcl/keycod.hxx> #include <o3tl/typed_flags_set.hxx> +#include <tools/degree.hxx> #include <limits> #include <memory> @@ -114,7 +115,7 @@ private: tools::Long mnBottomBorder; tools::Long mnLastResizeDY; tools::Long mnActivateCount; - tools::Long mnImagesRotationAngle; + Degree10 mnImagesRotationAngle; sal_uInt16 mnLastFocusItemId; sal_uInt16 mnOutStyle; sal_uInt16 mnHighItemId; @@ -369,7 +370,7 @@ public: void* GetItemData( sal_uInt16 nItemId ) const; void SetItemImage( sal_uInt16 nItemId, const Image& rImage ); Image GetItemImage( sal_uInt16 nItemId ) const; - void SetItemImageAngle( sal_uInt16 nItemId, tools::Long nAngle10 ); + void SetItemImageAngle( sal_uInt16 nItemId, Degree10 nAngle10 ); void SetItemImageMirrorMode( sal_uInt16 nItemId, bool bMirror ); void SetItemText( sal_uInt16 nItemId, const OUString& rText ); const OUString& GetItemText( sal_uInt16 nItemId ) const; diff --git a/include/vcl/vcllayout.hxx b/include/vcl/vcllayout.hxx index ea8da12b7a9d..7d53d12bd40b 100644 --- a/include/vcl/vcllayout.hxx +++ b/include/vcl/vcllayout.hxx @@ -22,6 +22,7 @@ #include <basegfx/polygon/b2dpolypolygon.hxx> #include <tools/gen.hxx> +#include <tools/degree.hxx> #include <vcl/devicecoordinate.hxx> #include <vcl/dllapi.h> @@ -78,7 +79,7 @@ public: virtual void DrawText( SalGraphics& ) const = 0; int GetUnitsPerPixel() const { return mnUnitsPerPixel; } - int GetOrientation() const { return mnOrientation; } + Degree10 GetOrientation() const { return mnOrientation; } // methods using string indexing virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const = 0; @@ -108,7 +109,7 @@ protected: int mnEndCharPos; int mnUnitsPerPixel; - int mnOrientation; + Degree10 mnOrientation; mutable Point maDrawOffset; Point maDrawBase; diff --git a/offapi/com/sun/star/drawing/Hatch.idl b/offapi/com/sun/star/drawing/Hatch.idl index 99c1da0b029f..d7802bdb9379 100644 --- a/offapi/com/sun/star/drawing/Hatch.idl +++ b/offapi/com/sun/star/drawing/Hatch.idl @@ -47,6 +47,7 @@ published struct Hatch long Distance; /** You can rotate the lines of the hatch with this angle. + * Specificied in tenths of a degree. */ long Angle; diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 655e177d94f3..5b68eb3e60ea 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -72,7 +72,7 @@ Reference< XGraphic > lclCheckAndApplyDuotoneTransform(const BlipFillProperties& return xGraphic; } -Reference< XGraphic > lclRotateGraphic(uno::Reference<graphic::XGraphic> const & xGraphic, long nRotation) +Reference< XGraphic > lclRotateGraphic(uno::Reference<graphic::XGraphic> const & xGraphic, Degree10 nRotation) { ::Graphic aGraphic(xGraphic); ::Graphic aReturnGraphic; @@ -771,7 +771,7 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe if(rPropMap.hasProperty(PROP_RotateAngle)) { long nAngle = rPropMap.getProperty(PROP_RotateAngle).get<long>(); - xGraphic = lclRotateGraphic(xGraphic, nAngle/10 ); + xGraphic = lclRotateGraphic(xGraphic, Degree10(nAngle/10) ); } rPropMap.setProperty(PROP_FillBitmap, xGraphic); diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 2b1251660cee..00f94294f1fe 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -844,7 +844,7 @@ ShapeExport& ShapeExport::WriteCustomShape( const Reference< XShape >& xShape ) // Remove rotation bool bInvertRotation = bFlipH != bFlipV; if (nRotation != 0) - aPolyPolygon.Rotate(Point(0,0), static_cast<sal_uInt16>(bInvertRotation ? nRotation/10 : 3600-nRotation/10)); + aPolyPolygon.Rotate(Point(0,0), Degree10(static_cast<sal_Int16>(bInvertRotation ? nRotation/10 : 3600-nRotation/10))); WritePolyPolygon(xShape, aPolyPolygon, false); } else if (bCustGeom) diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index 718354514e91..019d3b5c4746 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -351,7 +351,7 @@ namespace _rItemSet.Put(SvxEmphasisMarkItem(static_cast<FontEmphasisMark>(_rxReportControlFormat->getCharEmphasis()),ITEMID_EMPHASISMARK)); _rItemSet.Put(SvxCharReliefItem(static_cast<FontRelief>(_rxReportControlFormat->getCharRelief()),ITEMID_CHARRELIEF)); _rItemSet.Put(SvxColorItem(::Color(_rxReportControlFormat->getCharColor()),ITEMID_COLOR)); - _rItemSet.Put(SvxCharRotateItem(_rxReportControlFormat->getCharRotation(),false,ITEMID_CHARROTATE)); + _rItemSet.Put(SvxCharRotateItem(Degree10(_rxReportControlFormat->getCharRotation()),false,ITEMID_CHARROTATE)); _rItemSet.Put(SvxCharScaleWidthItem(_rxReportControlFormat->getCharScaleWidth(),ITEMID_CHARSCALE_W)); SvxHorJustifyItem aHorJustifyItem(ITEMID_HORJUSTIFY); @@ -723,7 +723,7 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep new SvxBlinkItem(false,ITEMID_BLINK), new SvxEmphasisMarkItem(FontEmphasisMark::NONE,ITEMID_EMPHASISMARK), new SvxTwoLinesItem(true,0,0,ITEMID_TWOLINES), - new SvxCharRotateItem(0,false,ITEMID_CHARROTATE), + new SvxCharRotateItem(Degree10(0),false,ITEMID_CHARROTATE), new SvxCharScaleWidthItem(100,ITEMID_CHARSCALE_W), new SvxCharReliefItem(FontRelief::NONE,ITEMID_CHARRELIEF), new SvxCharHiddenItem(false,ITEMID_CHARHIDDEN), diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx index 617532f7e434..4187300e3428 100644 --- a/sc/source/ui/drawfunc/fuins1.cxx +++ b/sc/source/ui/drawfunc/fuins1.cxx @@ -108,8 +108,8 @@ static void lcl_InsertGraphic( const Graphic& rGraphic, GraphicNativeMetadata aMetadata; if ( aMetadata.read(rGraphic1) ) { - const sal_uInt16 aRotation = aMetadata.getRotation(); - if (aRotation != 0) + const Degree10 aRotation = aMetadata.getRotation(); + if (aRotation) { std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(nullptr, VclMessageType::Question,VclButtonsType::YesNo,ScResId(STR_QUERYROTATION))); if (xQueryBox->run() == RET_YES) diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index 65e89742b7bc..c44ae0e2c095 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -862,9 +862,9 @@ void drawDataBars(vcl::RenderContext& rRenderContext, const ScDataBarInfo* pOldD aGradient.SetSteps(255); if(pOldDataBarInfo->mnLength < 0) - aGradient.SetAngle(2700); + aGradient.SetAngle(Degree10(2700)); else - aGradient.SetAngle(900); + aGradient.SetAngle(Degree10(900)); rRenderContext.DrawGradient(aPaintRect, aGradient); diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index c25d8abb908f..50fbbd2070c1 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -356,7 +356,7 @@ void ScDrawStringsVars::SetPattern( eAttrHorJust = SvxCellHorJustify::Standard; } - short nRot; + sal_Int16 nRot; switch (eAttrOrient) { case SvxCellOrientation::Standard: @@ -382,7 +382,7 @@ void ScDrawStringsVars::SetPattern( bRotated = false; break; } - aFont.SetOrientation( nRot ); + aFont.SetOrientation( Degree10(nRot) ); // syntax mode @@ -3453,7 +3453,7 @@ void ScOutputData::DrawEditBottomTop(DrawEditParam& rParam) } } - rParam.mpEngine->Draw(mpDev, aLogicStart, 900); + rParam.mpEngine->Draw(mpDev, aLogicStart, Degree10(900)); } rParam.adjustForHyperlinkInPDF(aURLStart, mpDev); @@ -3690,7 +3690,7 @@ void ScOutputData::DrawEditTopBottom(DrawEditParam& rParam) // bMoveClipped handling has been replaced by complete alignment // handling (also extending to the left). - rParam.mpEngine->Draw(mpDev, aLogicStart, 2700); + rParam.mpEngine->Draw(mpDev, aLogicStart, Degree10(2700)); } rParam.adjustForHyperlinkInPDF(aURLStart, mpDev); @@ -4999,10 +4999,10 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) OSL_ENSURE( eOrient == SvxCellOrientation::Standard && nAttrRotate, "DrawRotated: no rotation" ); - tools::Long nOriVal = 0; + sal_Int16 nOriVal = 0; if ( nAttrRotate ) { - // attribute is 1/100, Font 1/10 Grad + // attribute is 1/100, Font 1/10 degrees nOriVal = nAttrRotate / 10; double nAddX = 0.0; @@ -5055,7 +5055,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) // bSimClip is not used here (because nOriVal is set) - pEngine->Draw( mpDev, aLogicStart, static_cast<short>(nOriVal) ); + pEngine->Draw( mpDev, aLogicStart, Degree10(nOriVal) ); if (bMetaFile) mpDev->Pop(); diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx index f23ae2024a9e..db487a74471a 100644 --- a/sd/source/core/drawdoc4.cxx +++ b/sd/source/core/drawdoc4.cxx @@ -396,7 +396,7 @@ void SdDrawDocument::CreateLayoutTemplates() pISet = &pSheet->GetItemSet(); pISet->Put(XFillStyleItem(drawing::FillStyle_GRADIENT)); // fill with gradient aGradient.SetGradientStyle( ::awt::GradientStyle_RECT); // square type - aGradient.SetAngle( 0 ); // 0° angle + aGradient.SetAngle( Degree10(0) ); // 0° angle aGradient.SetStartColor( Color(0xcccccc) ); // white aGradient.SetEndColor( COL_WHITE ); // light gray 3 aFillGradient.SetName( aShapesName ); @@ -416,7 +416,7 @@ void SdDrawDocument::CreateLayoutTemplates() pISet = &pSheet->GetItemSet(); aGradient.SetGradientStyle( ::awt::GradientStyle_LINEAR ); - aGradient.SetAngle( 300 ); + aGradient.SetAngle( Degree10(300) ); aGradient.SetStartColor( COL_WHITE ); // white aGradient.SetEndColor( Color(0xcccccc) ); // light gray 3 aFillGradient.SetName( aName ); diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index 8f767df2e581..f775e1fbd063 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -1872,7 +1872,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a bool bNeedText = true; if ( mnAngle ) { - aPolygon.Rotate( aRect.TopLeft(), static_cast<sal_uInt16>( mnAngle / 10 ) ); + aPolygon.Rotate( aRect.TopLeft(), Degree10(static_cast<sal_Int16>( mnAngle / 10 )) ); if ( ImplGetText() ) { // #i119551# PPT does not support groups of polygons and text (MS patch KB2289187) diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index be254381b54f..ce0d45082b3f 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -145,8 +145,8 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq ) GraphicNativeMetadata aMetadata; if ( aMetadata.read(aGraphic) ) { - const sal_uInt16 aRotation = aMetadata.getRotation(); - if (aRotation != 0) + const Degree10 aRotation = aMetadata.getRotation(); + if (aRotation) { std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(nullptr, VclMessageType::Question,VclButtonsType::YesNo,SdResId(STR_QUERYROTATION))); if (xQueryBox->run() == RET_YES) diff --git a/sd/source/ui/view/drviews9.cxx b/sd/source/ui/view/drviews9.cxx index 9fc1ddfa47e0..baeda924d957 100644 --- a/sd/source/ui/view/drviews9.cxx +++ b/sd/source/ui/view/drviews9.cxx @@ -545,7 +545,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) XGradient aGradient(pEntry->GetGradient()); aGradient.SetGradientStyle (static_cast<css::awt::GradientStyle>(pStyle->GetValue ())); - aGradient.SetAngle (pAngle->GetValue () * 10); + aGradient.SetAngle (Degree10(pAngle->GetValue () * 10)); aGradient.SetBorder (static_cast<short>(pBorder->GetValue ())); aGradient.SetXOffset (static_cast<short>(pCenterX->GetValue ())); aGradient.SetYOffset (static_cast<short>(pCenterY->GetValue ())); @@ -566,7 +566,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) { Color aBlack (0, 0, 0); XGradient aGradient (aBlack, aBlack, static_cast<css::awt::GradientStyle>(pStyle->GetValue ()), - pAngle->GetValue () * 10, static_cast<short>(pCenterX->GetValue ()), + Degree10(pAngle->GetValue () * 10), static_cast<short>(pCenterX->GetValue ()), static_cast<short>(pCenterY->GetValue ()), static_cast<short>(pBorder->GetValue ()), static_cast<short>(pStart->GetValue ()), static_cast<short>(pEnd->GetValue ())); @@ -623,7 +623,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) aHatch.SetHatchStyle (static_cast<css::drawing::HatchStyle>(pStyle->GetValue ())); aHatch.SetDistance (pDistance->GetValue ()); - aHatch.SetAngle (pAngle->GetValue () * 10); + aHatch.SetAngle (Degree10(pAngle->GetValue () * 10)); XFillStyleItem aStyleItem(drawing::FillStyle_HATCH); aStyleItem.SetWhich(XATTR_FILLSTYLE); @@ -638,7 +638,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) if (i >= nCounts) { XHatch aHatch (Color(0), static_cast<css::drawing::HatchStyle>(pStyle->GetValue ()), pDistance->GetValue (), - pAngle->GetValue () * 10); + Degree10(pAngle->GetValue () * 10)); pHatchList->Insert(std::make_unique<XHatchEntry>(aHatch, pName->GetValue())); XFillStyleItem aStyleItem(drawing::FillStyle_HATCH); diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx index 544dca087d9e..11a7d332da8b 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -1588,7 +1588,7 @@ IMPL_LINK(OutlineView, PaintingFirstLineHdl, PaintFirstLineInfo*, pInfo, void) vcl::Font aNewFont( OutputDevice::GetDefaultFont( DefaultFontType::SANS_UNICODE, eLang, GetDefaultFontFlags::NONE ) ); aNewFont.SetFontSize( aFontSz ); aNewFont.SetVertical( bVertical ); - aNewFont.SetOrientation( bVertical ? 2700 : 0 ); + aNewFont.SetOrientation( Degree10(bVertical ? 2700 : 0) ); aNewFont.SetColor( COL_AUTO ); pInfo->mpOutDev->SetFont( aNewFont ); OUString aPageText = OUString::number( nPage ); diff --git a/sfx2/source/sidebar/Tools.cxx b/sfx2/source/sidebar/Tools.cxx index eb936c4ff412..382914d8baba 100644 --- a/sfx2/source/sidebar/Tools.cxx +++ b/sfx2/source/sidebar/Tools.cxx @@ -67,7 +67,7 @@ css::awt::Gradient Tools::VclToAwtGradient (const Gradient& rVclGradient) awt::GradientStyle(rVclGradient.GetStyle()), sal_Int32(rVclGradient.GetStartColor().GetRGBColor()), sal_Int32(rVclGradient.GetEndColor().GetRGBColor()), - rVclGradient.GetAngle(), + rVclGradient.GetAngle().get(), rVclGradient.GetBorder(), rVclGradient.GetOfsX(), rVclGradient.GetOfsY(), @@ -83,7 +83,7 @@ Gradient Tools::AwtToVclGradient (const css::awt::Gradient& rAwtGradient) GradientStyle(rAwtGradient.Style), Color(rAwtGradient.StartColor), Color(rAwtGradient.EndColor)); - aVclGradient.SetAngle(rAwtGradient.Angle); + aVclGradient.SetAngle(Degree10(rAwtGradient.Angle)); aVclGradient.SetBorder(rAwtGradient.Border); aVclGradient.SetOfsX(rAwtGradient.XOffset); aVclGradient.SetOfsY(rAwtGradient.YOffset); diff --git a/slideshow/source/engine/shapes/shapeimporter.cxx b/slideshow/source/engine/shapes/shapeimporter.cxx index b1b1b3417269..6d5b668efb00 100644 --- a/slideshow/source/engine/shapes/shapeimporter.cxx +++ b/slideshow/source/engine/shapes/shapeimporter.cxx @@ -296,7 +296,7 @@ ShapeSharedPtr ShapeImporter::createShape( aGraphAttrs.SetChannelB( nBlue ); aGraphAttrs.SetGamma( nGamma ); aGraphAttrs.SetTransparency( static_cast<sal_uInt8>(nTransparency) ); - aGraphAttrs.SetRotation( static_cast<sal_uInt16>(nRotation*10) ); + aGraphAttrs.SetRotation( Degree10(static_cast<sal_Int16>(nRotation*10)) ); text::GraphicCrop aGraphCrop; if( getPropertyValue( aGraphCrop, xPropSet, "GraphicCrop" )) diff --git a/svl/source/items/imageitm.cxx b/svl/source/items/imageitm.cxx index 0fa250fc043b..7a2d528c1fce 100644 --- a/svl/source/items/imageitm.cxx +++ b/svl/source/items/imageitm.cxx @@ -24,27 +24,14 @@ SfxPoolItem* SfxImageItem::CreateDefault() { return new SfxImageItem; } -struct SfxImageItem_Impl -{ - OUString aURL; - tools::Long nAngle; - bool bMirrored; - bool operator == ( const SfxImageItem_Impl& rOther ) const - { return nAngle == rOther.nAngle && bMirrored == rOther.bMirrored; } -}; - - SfxImageItem::SfxImageItem( sal_uInt16 which ) - : SfxInt16Item( which, 0 ), - pImpl( new SfxImageItem_Impl) + : SfxInt16Item( which, 0 ), mnAngle(0), mbMirrored(false) { - pImpl->nAngle = 0; - pImpl->bMirrored = false; } SfxImageItem::SfxImageItem( const SfxImageItem& rItem ) : SfxInt16Item( rItem ), - pImpl( new SfxImageItem_Impl( *rItem.pImpl ) ) + mnAngle(rItem.mnAngle), mbMirrored(rItem.mbMirrored) { } @@ -59,17 +46,19 @@ SfxImageItem* SfxImageItem::Clone( SfxItemPool* ) const bool SfxImageItem::operator==( const SfxPoolItem& rItem ) const { - return SfxInt16Item::operator==(rItem) && - *pImpl == *static_cast<const SfxImageItem&>(rItem).pImpl; + if (!SfxInt16Item::operator==(rItem)) + return false; + const SfxImageItem& rOther = static_cast<const SfxImageItem&>(rItem); + return mnAngle == rOther.mnAngle && mbMirrored == rOther.mbMirrored; } bool SfxImageItem::QueryValue( css::uno::Any& rVal, sal_uInt8 ) const { css::uno::Sequence< css::uno::Any > aSeq( 4 ); aSeq[0] <<= GetValue(); - aSeq[1] <<= pImpl->nAngle; - aSeq[2] <<= pImpl->bMirrored; - aSeq[3] <<= pImpl->aURL; + aSeq[1] <<= sal_Int16(mnAngle); + aSeq[2] <<= mbMirrored; + aSeq[3] <<= maURL; rVal <<= aSeq; return true; @@ -81,37 +70,17 @@ bool SfxImageItem::PutValue( const css::uno::Any& rVal, sal_uInt8 ) if (( rVal >>= aSeq ) && ( aSeq.getLength() == 4 )) { sal_Int16 nVal = sal_Int16(); - OUString aURL; if ( aSeq[0] >>= nVal ) SetValue( nVal ); - aSeq[1] >>= pImpl->nAngle; - aSeq[2] >>= pImpl->bMirrored; - if ( aSeq[3] >>= aURL ) - pImpl->aURL = aURL; + sal_Int16 nTmp; + aSeq[1] >>= nTmp; + mnAngle = Degree10(nTmp); + aSeq[2] >>= mbMirrored; + aSeq[3] >>= maURL; return true; } return false; } -void SfxImageItem::SetRotation( tools::Long nValue ) -{ - pImpl->nAngle = nValue; -} - -tools::Long SfxImageItem::GetRotation() const -{ - return pImpl->nAngle; -} - -void SfxImageItem::SetMirrored( bool bSet ) -{ - pImpl->bMirrored = bSet; -} - -bool SfxImageItem::IsMirrored() const -{ - return pImpl->bMirrored; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx index 20d40364f0a3..09c442bee020 100644 --- a/svtools/source/control/ruler.cxx +++ b/svtools/source/control/ruler.cxx @@ -467,9 +467,9 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, tools::Long nMin, { vcl::Font aFont = rRenderContext.GetFont(); if (mnWinStyle & WB_RIGHT_ALIGNED) - aFont.SetOrientation(2700); + aFont.SetOrientation(Degree10(2700)); else - aFont.SetOrientation(900); + aFont.SetOrientation(Degree10(900)); rRenderContext.SetFont(aFont); nTickWidth = aPixSize.Height(); } @@ -1033,7 +1033,7 @@ void Ruler::ImplInitSettings(bool bFont, bool bForeground, bool bBackground) vcl::Font aFont = GetFont(); if (mnWinStyle & WB_VERT) - aFont.SetOrientation(900); + aFont.SetOrientation(Degree10(900)); maVirDev->SetFont(aFont); maVirDev->SetTextColor(GetTextColor()); diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx index 8ccc0337389c..f25fee8d3a4d 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx @@ -189,7 +189,7 @@ static void CalculateHorizontalScalingFactor( const SvxWeightItem& rWeightItem = rSdrObjCustomShape.GetMergedItem( EE_CHAR_WEIGHT ); aFont.SetWeight( rWeightItem.GetWeight() ); - aFont.SetOrientation( 0 ); + aFont.SetOrientation( Degree10(0) ); // initializing virtual device ScopedVclPtrInstance< VirtualDevice > pVirDev(DeviceFormat::BITMASK); @@ -294,7 +294,7 @@ static void GetTextAreaOutline( aFont.SetFamilyName( rFontItem.GetFamilyName() ); aFont.SetFamily( rFontItem.GetFamily() ); aFont.SetStyleName( rFontItem.GetStyleName() ); - aFont.SetOrientation( 0 ); + aFont.SetOrientation( Degree10(0) ); const SvxPostureItem& rPostureItem = rSdrObjCustomShape.GetMergedItem( EE_CHAR_ITALIC ); aFont.SetItalic( rPostureItem.GetPosture() ); @@ -338,7 +338,7 @@ static void GetTextAreaOutline( for ( auto& rOutline : aCharacterData.vOutlines ) { // rotating - rOutline.Rotate( Point( nTextWidth / 2, rFWData.nSingleLineHeight / 2 ), 900 ); + rOutline.Rotate( Point( nTextWidth / 2, rFWData.nSingleLineHeight / 2 ), Degree10(900) ); aCharacterData.aBoundRect.Union( rOutline.GetBoundRect() ); } for ( auto& rOutline : aCharacterData.vOutlines ) diff --git a/svx/source/dialog/dialcontrol.cxx b/svx/source/dialog/dialcontrol.cxx index 7faf0d9852e9..527bd4f47883 100644 --- a/svx/source/dialog/dialcontrol.cxx +++ b/svx/source/dialog/dialcontrol.cxx @@ -76,7 +76,7 @@ void DialControlBmp::DrawElements( const OUString& rText, sal_Int32 nAngle ) // rotated text vcl::Font aFont( GetFont() ); aFont.SetColor( GetTextColor() ); - aFont.SetOrientation( static_cast< short >( (nAngle + 5) / 10 ) ); // Font uses 1/10 degrees + aFont.SetOrientation( Degree10(static_cast< sal_Int16 >( (nAngle + 5) / 10 )) ); // Font uses 1/10 degrees aFont.SetWeight( WEIGHT_BOLD ); SetFont( aFont ); diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx index f4161b37fe9c..06dd3fdc6751 100644 --- a/svx/source/dialog/rubydialog.cxx +++ b/svx/source/dialog/rubydialog.cxx @@ -779,7 +779,7 @@ void RubyPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang bRubyStretch = true; aRubyFont.SetVertical(true); - aRubyFont.SetOrientation(2700); + aRubyFont.SetOrientation(Degree10(2700)); } long nYOutput; diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index a944d591d8c9..d70a853b3f91 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -97,7 +97,7 @@ static css::awt::FontDescriptor ImplCreateFontDescriptor( const vcl::Font& rFont aFD.Slant = vcl::unohelper::ConvertFontSlant( rFont.GetItalic() ); aFD.Underline = static_cast<sal_Int16>(rFont.GetUnderline()); aFD.Strikeout = static_cast<sal_Int16>(rFont.GetStrikeout()); - aFD.Orientation = rFont.GetOrientation() / 10.0; + aFD.Orientation = rFont.GetOrientation().get() / 10.0; aFD.Kerning = rFont.IsKerning(); aFD.WordLineMode = rFont.IsWordLineMode(); aFD.Type = 0; // ??? => only to metric... @@ -119,7 +119,7 @@ static vcl::Font ImplCreateFont( const css::awt::FontDescriptor& rDescr ) aFont.SetItalic( static_cast<FontItalic>(rDescr.Slant) ); aFont.SetUnderline( static_cast<::FontLineStyle>(rDescr.Underline) ); aFont.SetStrikeout( static_cast<::FontStrikeout>(rDescr.Strikeout) ); - aFont.SetOrientation( static_cast<sal_Int16>(rDescr.Orientation * 10) ); + aFont.SetOrientation( Degree10(static_cast<sal_Int16>(rDescr.Orientation * 10)) ); aFont.SetKerning( static_cast<FontKerning>(rDescr.Kerning) ); aFont.SetWordLineMode( rDescr.WordLineMode ); return aFont; diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 391f1f69cb8b..c3cad4f96209 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -483,7 +483,7 @@ namespace drawinglayer::primitive2d static_cast<double>(aXGradient.GetBorder()) * 0.01, static_cast<double>(aXGradient.GetXOffset()) * 0.01, static_cast<double>(aXGradient.GetYOffset()) * 0.01, - static_cast<double>(aXGradient.GetAngle()) * F_PI1800, + static_cast<double>(aXGradient.GetAngle().get()) * F_PI1800, aStart, aEnd, rSet.Get(XATTR_GRADIENTSTEPCOUNT).GetValue()); @@ -498,7 +498,7 @@ namespace drawinglayer::primitive2d aHatch = attribute::FillHatchAttribute( XHatchStyleToHatchStyle(rHatch.GetHatchStyle()), static_cast<double>(rHatch.GetDistance()), - static_cast<double>(rHatch.GetAngle()) * F_PI1800, + static_cast<double>(rHatch.GetAngle().get()) * F_PI1800, aColorB.getBColor(), 3, // same default as VCL, a minimum of three discrete units (pixels) offset rSet.Get(XATTR_FILLBACKGROUND).GetValue()); @@ -644,7 +644,7 @@ namespace drawinglayer::primitive2d static_cast<double>(rGradient.GetBorder()) * 0.01, static_cast<double>(rGradient.GetXOffset()) * 0.01, static_cast<double>(rGradient.GetYOffset()) * 0.01, - static_cast<double>(rGradient.GetAngle()) * F_PI1800, + static_cast<double>(rGradient.GetAngle().get()) * F_PI1800, basegfx::BColor(fStartLum, fStartLum, fStartLum), basegfx::BColor(fEndLum, fEndLum, fEndLum), 0); diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx index 8f8925201e26..6284e1e1b0cf 100644 --- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx @@ -148,7 +148,7 @@ namespace drawinglayer::primitive2d maGraphicAttr(rGraphicAttr) { // reset some values from GraphicAttr which are part of transformation already - maGraphicAttr.SetRotation(0); + maGraphicAttr.SetRotation(Degree10(0)); } bool SdrGrafPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx index 60f9290aac59..cb8a6fc1ccda 100644 --- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx @@ -145,7 +145,7 @@ void AreaPropertyPanelBase::Initialize() maGradientLinear.SetXOffset(DEFAULT_CENTERX); maGradientLinear.SetYOffset(DEFAULT_CENTERY); - maGradientLinear.SetAngle(DEFAULT_ANGLE); + maGradientLinear.SetAngle(Degree10(DEFAULT_ANGLE)); maGradientLinear.SetStartColor(Color(DEFAULT_STARTVALUE)); maGradientLinear.SetEndColor(Color(DEFAULT_ENDVALUE)); maGradientLinear.SetBorder(DEFAULT_BORDER); @@ -328,7 +328,7 @@ IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillTypeHdl, weld::ComboBox&, void) mxLbFillGradFrom->SelectEntry(aGradient.GetStartColor()); mxLbFillGradTo->SelectEntry(aGradient.GetEndColor()); - mxMTRAngle->set_value(aGradient.GetAngle() / 10, FieldUnit::DEGREE); + mxMTRAngle->set_value(aGradient.GetAngle().get() / 10, FieldUnit::DEGREE); css::awt::GradientStyle eXGS = aGradient.GetGradientStyle(); mxGradientStyle->set_active(sal::static_int_cast< sal_Int32 >( eXGS )); } @@ -507,7 +507,7 @@ void AreaPropertyPanelBase::SelectFillAttrHdl_Impl() if(pSh && pSh->GetItem(SID_COLOR_TABLE)) { XGradient aGradient; - aGradient.SetAngle(mxMTRAngle->get_value(FieldUnit::DEGREE) * 10); + aGradient.SetAngle(Degree10(mxMTRAngle->get_value(FieldUnit::DEGREE) * 10)); aGradient.SetGradientStyle(static_cast<css::awt::GradientStyle>(mxGradientStyle->get_active())); aGradient.SetStartColor(mxLbFillGradFrom->GetSelectEntryColor()); aGradient.SetEndColor(mxLbFillGradTo->GetSelectEntryColor()); @@ -1174,7 +1174,7 @@ void AreaPropertyPanelBase::Update() if(mxGradientStyle->get_active() == sal_Int32(GradientStyle::Radial)) mxMTRAngle->set_sensitive(false); else - mxMTRAngle->set_value(aGradient.GetAngle() / 10, FieldUnit::DEGREE); + mxMTRAngle->set_value(aGradient.GetAngle().get() / 10, FieldUnit::DEGREE); } else { diff --git a/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx b/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx index a6330f03f644..7c4a8dc59962 100644 --- a/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx +++ b/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx @@ -64,7 +64,7 @@ void AreaTransparencyGradientPopup::InitStatus(XFillFloatTransparenceItem const if (rGradient.GetXOffset() == AreaPropertyPanelBase::DEFAULT_CENTERX && rGradient.GetYOffset() == AreaPropertyPanelBase::DEFAULT_CENTERY - && (rGradient.GetAngle() / 10) == AreaPropertyPanelBase::DEFAULT_ANGLE + && (rGradient.GetAngle().get() / 10) == AreaPropertyPanelBase::DEFAULT_ANGLE && static_cast<sal_uInt16>(((static_cast<sal_uInt16>(rGradient.GetStartColor().GetRed()) + 1) * 100) / 255) == AreaPropertyPanelBase::DEFAULT_STARTVALUE && static_cast<sal_uInt16>(((static_cast<sal_uInt16>(rGradient.GetEndColor().GetRed()) + 1) * 100) / 255) @@ -79,7 +79,7 @@ void AreaTransparencyGradientPopup::InitStatus(XFillFloatTransparenceItem const } mxMtrTrgrCenterX->set_value(aGradient.GetXOffset(), FieldUnit::PERCENT); mxMtrTrgrCenterY->set_value(aGradient.GetYOffset(), FieldUnit::PERCENT); - mxMtrTrgrAngle->set_value(aGradient.GetAngle() / 10, FieldUnit::DEGREE); + mxMtrTrgrAngle->set_value(aGradient.GetAngle().get() / 10, FieldUnit::DEGREE); mxMtrTrgrStartValue->set_value(static_cast<sal_uInt16>(((static_cast<sal_uInt16>(aGradient.GetStartColor().GetRed()) + 1) * 100) / 255), FieldUnit::PERCENT); mxMtrTrgrEndValue->set_value(static_cast<sal_uInt16>(((static_cast<sal_uInt16>(aGradient.GetEndColor().GetRed()) + 1) * 100) / 255), FieldUnit::PERCENT); mxMtrTrgrBorder->set_value(aGradient.GetBorder(), FieldUnit::PERCENT); @@ -127,7 +127,7 @@ void AreaTransparencyGradientPopup::ExecuteValueModify(sal_uInt8 nStartCol, sal_ Color(nStartCol, nStartCol, nStartCol), Color(nEndCol, nEndCol, nEndCol), static_cast<css::awt::GradientStyle>(mrAreaPropertyPanel.GetSelectedTransparencyTypeIndex()-2), - static_cast<sal_uInt16>(mxMtrTrgrAngle->get_value(FieldUnit::DEGREE)) * 10, + Degree10(static_cast<sal_Int16>(mxMtrTrgrAngle->get_value(FieldUnit::DEGREE)) * 10), static_cast<sal_uInt16>(mxMtrTrgrCenterX->get_value(FieldUnit::PERCENT)), static_cast<sal_uInt16>(mxMtrTrgrCenterY->get_value(FieldUnit::PERCENT)), static_cast<sal_uInt16>(mxMtrTrgrBorder->get_value(FieldUnit::PERCENT)), diff --git a/svx/source/svdraw/gradtrns.cxx b/svx/source/svdraw/gradtrns.cxx index ecb219836d31..faf44656183b 100644 --- a/svx/source/svdraw/gradtrns.cxx +++ b/svx/source/svdraw/gradtrns.cxx @@ -68,7 +68,7 @@ void GradTransformer::GradToVec(GradTransGradient const & rG, GradTransVector& r if(rG.aGradient.GetAngle()) { - const double fAngle = basegfx::deg2rad(rG.aGradient.GetAngle() / 10.0); + const double fAngle = basegfx::deg2rad(rG.aGradient.GetAngle().get() / 10.0); const basegfx::B2DHomMatrix aTransformation(basegfx::utils::createRotateAroundPoint(aCenter, -fAngle)); aStartPos *= aTransformation; @@ -91,7 +91,7 @@ void GradTransformer::GradToVec(GradTransGradient const & rG, GradTransVector& r if(rG.aGradient.GetAngle()) { - const double fAngle = basegfx::deg2rad(rG.aGradient.GetAngle() / 10.0); + const double fAngle = basegfx::deg2rad(rG.aGradient.GetAngle().get() / 10.0); const basegfx::B2DHomMatrix aTransformation(basegfx::utils::createRotateAroundPoint(aCenter, -fAngle)); aStartPos *= aTransformation; @@ -115,7 +115,7 @@ void GradTransformer::GradToVec(GradTransGradient const & rG, GradTransVector& r if(rG.aGradient.GetAngle()) { - const double fAngle = basegfx::deg2rad(rG.aGradient.GetAngle() / 10.0); + const double fAngle = basegfx::deg2rad(rG.aGradient.GetAngle().get() / 10.0); const basegfx::B2DHomMatrix aTransformation(basegfx::utils::createRotateAroundPoint(aEndPos, -fAngle)); aStartPos *= aTransformation; @@ -150,7 +150,7 @@ void GradTransformer::GradToVec(GradTransGradient const & rG, GradTransVector& r if(rG.aGradient.GetAngle()) { - const double fAngle = basegfx::deg2rad(rG.aGradient.GetAngle() / 10.0); + const double fAngle = basegfx::deg2rad(rG.aGradient.GetAngle().get() / 10.0); const basegfx::B2DHomMatrix aTransformation(basegfx::utils::createRotateAroundPoint(aEndPos, -fAngle)); aStartPos *= aTransformation; @@ -235,7 +235,7 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r } // to int and set - sal_Int32 nNewAngle = FRound(fNewFullAngle); + Degree10 nNewAngle( FRound(fNewFullAngle)); if(nNewAngle != rGOld.aGradient.GetAngle()) { @@ -319,7 +319,7 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r } // to int and set - const sal_Int32 nNewAngle(FRound(fNewFullAngle)); + const Degree10 nNewAngle(FRound(fNewFullAngle)); if(nNewAngle != rGOld.aGradient.GetAngle()) { @@ -414,7 +414,7 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r } // to int and set - const sal_Int32 nNewAngle(FRound(fNewFullAngle)); + const Degree10 nNewAngle(FRound(fNewFullAngle)); if(nNewAngle != rGOld.aGradient.GetAngle()) { @@ -509,7 +509,7 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r } // to int and set - const sal_Int32 nNewAngle(FRound(fNewFullAngle)); + const Degree10 nNewAngle(FRound(fNewFullAngle)); if(nNewAngle != rGOld.aGradient.GetAngle()) { diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index 005676d47e83..158a1ab762b4 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -327,7 +327,7 @@ SdrItemPool::SdrItemPool( rPoolDefaults[ SDRATTR_TABLE_BORDER_INNER - SDRATTR_START ] = pBoxInfoItem; rPoolDefaults[ SDRATTR_TABLE_BORDER_TLBR - SDRATTR_START ] = new SvxLineItem( SDRATTR_TABLE_BORDER_TLBR ); rPoolDefaults[ SDRATTR_TABLE_BORDER_BLTR - SDRATTR_START ] = new SvxLineItem( SDRATTR_TABLE_BORDER_BLTR ); - rPoolDefaults[ SDRATTR_TABLE_TEXT_ROTATION - SDRATTR_START ] = new SvxTextRotateItem(0, SDRATTR_TABLE_TEXT_ROTATION); + rPoolDefaults[ SDRATTR_TABLE_TEXT_ROTATION - SDRATTR_START ] = new SvxTextRotateItem(Degree10(0), SDRATTR_TABLE_TEXT_ROTATION); rPoolDefaults[ SDRATTR_GLOW_RADIUS - SDRATTR_START ] = new SdrMetricItem(SDRATTR_GLOW_RADIUS, 0); rPoolDefaults[ SDRATTR_GLOW_COLOR - SDRATTR_START ] = new XColorItem(SDRATTR_GLOW_COLOR, aNullCol); diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index 1555951984c1..b9fdcacbe2ac 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -1053,7 +1053,7 @@ void ImpSdrGDIMetaFileImport::ImportText( const Point& rPos, const OUString& rSt aAttr.Put(XFillColorItem(OUString(), aFnt.GetFillColor())); pText->SetMergedItemSet(aAttr); } - sal_uInt32 nAngle = aFnt.GetOrientation(); + sal_Int32 nAngle = aFnt.GetOrientation().get(); if ( nAngle ) { nAngle*=10; diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 4a3910174f6f..8728c67a9b2c 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -1732,7 +1732,7 @@ void SdrObjCustomShape::ImpCheckCustomGluePointsAreAdded() ShearPoint(aPoly[i],maRect.Center(), fTan ); } if ( aGeo.nRotationAngle ) - aPoly.Rotate( maRect.Center(), aGeo.nRotationAngle / 10 ); + aPoly.Rotate( maRect.Center(), Degree10(aGeo.nRotationAngle / 10) ); tools::Rectangle aBoundRect( aPoly.GetBoundRect() ); sal_Int32 nXDiff = aBoundRect.Left() - maRect.Left(); diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 2f2c4886f86d..9d719839334d 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -382,7 +382,7 @@ GraphicAttr SdrGrafObj::GetGraphicAttr( SdrGrafObjTransformsAttrs nTransformFlag } if( bRotate ) - aActAttr.SetRotation( sal_uInt16(aGeo.nRotationAngle / 10) ); + aActAttr.SetRotation( Degree10(aGeo.nRotationAngle / 10) ); } return aActAttr; diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index aacc10bf4b7b..23e5279b4c1d 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -184,7 +184,7 @@ namespace // apply font rotate if(rInfo.mrFont.GetOrientation()) { - aNewTransform.rotate(-rInfo.mrFont.GetOrientation() * F_PI1800); + aNewTransform.rotate(-rInfo.mrFont.GetOrientation().get() * F_PI1800); } // look for escapement, if necessary, translate accordingly diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx index 97c59fd94ae8..3a8b60951d4a 100644 --- a/svx/source/svdraw/svdpdf.cxx +++ b/svx/source/svdraw/svdpdf.cxx @@ -842,7 +842,7 @@ void ImpSdrPdfImport::InsertTextObject(const Point& rPos, const Size& rSize, con aAttr.Put(XFillColorItem(OUString(), aFont.GetFillColor())); pText->SetMergedItemSet(aAttr); } - sal_uInt32 nAngle = aFont.GetOrientation(); + sal_uInt32 nAngle = aFont.GetOrientation().get(); if (nAngle) { nAngle *= 10; diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx index 71be1f2ecd94..0a7844817c61 100644 --- a/svx/source/table/cell.cxx +++ b/svx/source/table/cell.cxx @@ -1115,7 +1115,7 @@ void SAL_CALL Cell::setPropertyValue( const OUString& rPropertyName, const Any& if (nRotVal != 27000 && nRotVal != 9000 && nRotVal != 0) throw IllegalArgumentException(); - mpProperties->SetObjectItem(SvxTextRotateItem(nRotVal/10, SDRATTR_TABLE_TEXT_ROTATION)); + mpProperties->SetObjectItem(SvxTextRotateItem(Degree10(nRotVal/10), SDRATTR_TABLE_TEXT_ROTATION)); return; } default: @@ -1236,7 +1236,7 @@ Any SAL_CALL Cell::getPropertyValue( const OUString& PropertyName ) case SDRATTR_TABLE_TEXT_ROTATION: { const SvxTextRotateItem& rTextRotate = mpProperties->GetItem(SDRATTR_TABLE_TEXT_ROTATION); - return Any(sal_Int32(rTextRotate.GetValue() * 10)); + return Any(sal_Int32(rTextRotate.GetValue().get() * 10)); } default: { diff --git a/svx/source/unodraw/XPropertyTable.cxx b/svx/source/unodraw/XPropertyTable.cxx index 01e9e1dc4430..8068feee8ce9 100644 --- a/svx/source/unodraw/XPropertyTable.cxx +++ b/svx/source/unodraw/XPropertyTable.cxx @@ -472,7 +472,7 @@ uno::Any SvxUnoXHatchTable::getAny( const XPropertyEntry* pEntry ) const throw() aUnoHatch.Style = aHatch.GetHatchStyle(); aUnoHatch.Color = sal_Int32(aHatch.GetColor()); aUnoHatch.Distance = aHatch.GetDistance(); - aUnoHatch.Angle = aHatch.GetAngle(); + aUnoHatch.Angle = aHatch.GetAngle().get(); return uno::Any(aUnoHatch); } @@ -487,7 +487,7 @@ std::unique_ptr<XPropertyEntry> SvxUnoXHatchTable::createEntry(const OUString& r aXHatch.SetHatchStyle( aUnoHatch.Style ); aXHatch.SetColor( Color(aUnoHatch.Color) ); aXHatch.SetDistance( aUnoHatch.Distance ); - aXHatch.SetAngle( aUnoHatch.Angle ); + aXHatch.SetAngle( Degree10(aUnoHatch.Angle) ); return std::make_unique<XHatchEntry>(aXHatch, rName); } @@ -566,7 +566,7 @@ std::unique_ptr<XPropertyEntry> SvxUnoXGradientTable::createEntry(const OUString aXGradient.SetGradientStyle( aGradient.Style ); aXGradient.SetStartColor( Color(aGradient.StartColor) ); aXGradient.SetEndColor( Color(aGradient.EndColor) ); - aXGradient.SetAngle( aGradient.Angle ); + aXGradient.SetAngle( Degree10(aGradient.Angle) ); aXGradient.SetBorder( aGradient.Border ); aXGradient.SetXOffset( aGradient.XOffset ); aXGradient.SetYOffset( aGradient.YOffset ); diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index 9e244fb14c15..f391a3fc9a34 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -2024,7 +2024,7 @@ namespace aGradient.SetStartColor(rMap["startcolor"].toInt32(16)); aGradient.SetEndColor(rMap["endcolor"].toInt32(16)); aGradient.SetGradientStyle(lcl_getStyleFromString(rMap["style"])); - aGradient.SetAngle(rMap["angle"].toInt32()); + aGradient.SetAngle(Degree10(rMap["angle"].toInt32())); return aGradient; } @@ -2051,7 +2051,7 @@ XGradient::XGradient() : } XGradient::XGradient(const Color& rStart, const Color& rEnd, - css::awt::GradientStyle eTheStyle, long nTheAngle, sal_uInt16 nXOfs, + css::awt::GradientStyle eTheStyle, Degree10 nTheAngle, sal_uInt16 nXOfs, sal_uInt16 nYOfs, sal_uInt16 nTheBorder, sal_uInt16 nStartIntens, sal_uInt16 nEndIntens, sal_uInt16 nSteps) : @@ -2089,7 +2089,7 @@ boost::property_tree::ptree XGradient::dumpAsJSON() const aTree.put("style", XGradient::GradientStyleToString(eStyle)); aTree.put("startcolor",aStartColor.AsRGBHexString()); aTree.put("endcolor", aEndColor.AsRGBHexString()); - aTree.put("angle", std::to_string(nAngle)); + aTree.put("angle", std::to_string(nAngle.get())); aTree.put("border", std::to_string(nBorder)); aTree.put("x", std::to_string(nOfsX)); aTree.put("y", std::to_string(nOfsY)); @@ -2268,7 +2268,7 @@ bool XFillGradientItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId aXGradient.SetGradientStyle( aGradient2.Style ); aXGradient.SetStartColor( Color(aGradient2.StartColor) ); aXGradient.SetEndColor( Color(aGradient2.EndColor) ); - aXGradient.SetAngle( aGradient2.Angle ); + aXGradient.SetAngle( Degree10(aGradient2.Angle) ); aXGradient.SetBorder( aGradient2.Border ); aXGradient.SetXOffset( aGradient2.XOffset ); aXGradient.SetYOffset( aGradient2.YOffset ); @@ -2305,7 +2305,7 @@ bool XFillGradientItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId aXGradient.SetGradientStyle( aGradient2.Style ); aXGradient.SetStartColor( Color(aGradient2.StartColor) ); aXGradient.SetEndColor( Color(aGradient2.EndColor) ); - aXGradient.SetAngle( aGradient2.Angle ); + aXGradient.SetAngle( Degree10(aGradient2.Angle) ); aXGradient.SetBorder( aGradient2.Border ); aXGradient.SetXOffset( aGradient2.XOffset ); aXGradient.SetYOffset( aGradient2.YOffset ); @@ -2354,7 +2354,7 @@ bool XFillGradientItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId case MID_GRADIENT_STYLE: aXGradient.SetGradientStyle( static_cast<css::awt::GradientStyle>(nVal) ); break; case MID_GRADIENT_ANGLE: - aXGradient.SetAngle( nVal ); break; + aXGradient.SetAngle( Degree10(nVal) ); break; case MID_GRADIENT_BORDER: aXGradient.SetBorder( nVal ); break; case MID_GRADIENT_STARTINTENSITY: @@ -2532,7 +2532,7 @@ boost::property_tree::ptree XFillFloatTransparenceItem::dumpAsJSON() const } XHatch::XHatch(const Color& rCol, css::drawing::HatchStyle eTheStyle, long nTheDistance, - long nTheAngle) : + Degree10 nTheAngle) : eStyle(eTheStyle), aColor(rCol), nDistance(nTheDistance), @@ -2618,7 +2618,7 @@ bool XFillHatchItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) cons aUnoHatch.Style = aHatch.GetHatchStyle(); aUnoHatch.Color = sal_Int32(aHatch.GetColor()); aUnoHatch.Distance = aHatch.GetDistance(); - aUnoHatch.Angle = aHatch.GetAngle(); + aUnoHatch.Angle = aHatch.GetAngle().get(); aPropSeq[0].Name = "Name"; aPropSeq[0].Value <<= SvxUnogetApiNameForItem(Which(), GetName()); @@ -2635,7 +2635,7 @@ bool XFillHatchItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) cons aUnoHatch.Style = aHatch.GetHatchStyle(); aUnoHatch.Color = sal_Int32(aHatch.GetColor()); aUnoHatch.Distance = aHatch.GetDistance(); - aUnoHatch.Angle = aHatch.GetAngle(); + aUnoHatch.Angle = aHatch.GetAngle().get(); rVal <<= aUnoHatch; break; } @@ -2653,7 +2653,7 @@ bool XFillHatchItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) cons case MID_HATCH_DISTANCE: rVal <<= aHatch.GetDistance(); break; case MID_HATCH_ANGLE: - rVal <<= aHatch.GetAngle(); break; + rVal <<= aHatch.GetAngle().get(); break; default: OSL_FAIL("Wrong MemberId!"); return false; } @@ -2692,7 +2692,7 @@ bool XFillHatchItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) aHatch.SetHatchStyle( aUnoHatch.Style ); aHatch.SetColor( Color(aUnoHatch.Color) ); aHatch.SetDistance( aUnoHatch.Distance ); - aHatch.SetAngle( aUnoHatch.Angle ); + aHatch.SetAngle( Degree10(aUnoHatch.Angle) ); } return true; @@ -2710,7 +2710,7 @@ bool XFillHatchItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) aHatch.SetHatchStyle( aUnoHatch.Style ); aHatch.SetColor( Color(aUnoHatch.Color) ); aHatch.SetDistance( aUnoHatch.Distance ); - aHatch.SetAngle( aUnoHatch.Angle ); + aHatch.SetAngle( Degree10(aUnoHatch.Angle) ); break; } @@ -2745,7 +2745,7 @@ bool XFillHatchItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) else if ( nMemberId == MID_HATCH_DISTANCE ) aHatch.SetDistance( nVal ); else - aHatch.SetAngle( nVal ); + aHatch.SetAngle( Degree10(nVal) ); break; } diff --git a/svx/source/xoutdev/xtabgrdt.cxx b/svx/source/xoutdev/xtabgrdt.cxx index 1a29fbcaca86..990bed31172e 100644 --- a/svx/source/xoutdev/xtabgrdt.cxx +++ b/svx/source/xoutdev/xtabgrdt.cxx @@ -69,17 +69,17 @@ bool XGradientList::Create() OUStringBuffer aStr(SvxResId(RID_SVXSTR_GRADIENT)); aStr.append(" 1"); sal_Int32 nLen = aStr.getLength() - 1; - Insert(std::make_unique<XGradientEntry>(XGradient(COL_BLACK, COL_WHITE, css::awt::GradientStyle_LINEAR , 0,10,10, 0,100,100),aStr.toString())); + Insert(std::make_unique<XGradientEntry>(XGradient(COL_BLACK, COL_WHITE, css::awt::GradientStyle_LINEAR , Degree10(0),10,10, 0,100,100),aStr.toString())); aStr[nLen] = '2'; - Insert(std::make_unique<XGradientEntry>(XGradient(COL_BLUE, COL_RED, css::awt::GradientStyle_AXIAL , 300,20,20,10,100,100),aStr.toString())); + Insert(std::make_unique<XGradientEntry>(XGradient(COL_BLUE, COL_RED, css::awt::GradientStyle_AXIAL , Degree10(300),20,20,10,100,100),aStr.toString())); aStr[nLen] = '3'; - Insert(std::make_unique<XGradientEntry>(XGradient(COL_RED, COL_YELLOW,css::awt::GradientStyle_RADIAL , 600,30,30,20,100,100),aStr.toString())); + Insert(std::make_unique<XGradientEntry>(XGradient(COL_RED, COL_YELLOW,css::awt::GradientStyle_RADIAL , Degree10(600),30,30,20,100,100),aStr.toString())); aStr[nLen] = '4'; - Insert(std::make_unique<XGradientEntry>(XGradient(COL_YELLOW , COL_GREEN, css::awt::GradientStyle_ELLIPTICAL, 900,40,40,30,100,100),aStr.toString())); + Insert(std::make_unique<XGradientEntry>(XGradient(COL_YELLOW , COL_GREEN, css::awt::GradientStyle_ELLIPTICAL, Degree10(900),40,40,30,100,100),aStr.toString())); aStr[nLen] = '5'; - Insert(std::make_unique<XGradientEntry>(XGradient(COL_GREEN , COL_MAGENTA,css::awt::GradientStyle_SQUARE , 1200,50,50,40,100,100),aStr.toString())); + Insert(std::make_unique<XGradientEntry>(XGradient(COL_GREEN , COL_MAGENTA,css::awt::GradientStyle_SQUARE , Degree10(1200),50,50,40,100,100),aStr.toString())); aStr[nLen] = '6'; - Insert(std::make_unique<XGradientEntry>(XGradient(COL_MAGENTA, COL_YELLOW ,css::awt::GradientStyle_RECT , 1900,60,60,50,100,100),aStr.toString())); + Insert(std::make_unique<XGradientEntry>(XGradient(COL_MAGENTA, COL_YELLOW ,css::awt::GradientStyle_RECT , Degree10(1900),60,60,50,100,100),aStr.toString())); return true; } @@ -159,7 +159,7 @@ BitmapEx XGradientList::CreateBitmap( long nIndex, const Size& rSize ) const static_cast<double>(rGradient.GetBorder()) * 0.01, static_cast<double>(rGradient.GetXOffset()) * 0.01, static_cast<double>(rGradient.GetYOffset()) * 0.01, - static_cast<double>(rGradient.GetAngle()) * F_PI1800, + static_cast<double>(rGradient.GetAngle().get()) * F_PI1800, aStart, aEnd, nSteps); diff --git a/svx/source/xoutdev/xtabhtch.cxx b/svx/source/xoutdev/xtabhtch.cxx index 3b84601fac27..ded1bba8a5d2 100644 --- a/svx/source/xoutdev/xtabhtch.cxx +++ b/svx/source/xoutdev/xtabhtch.cxx @@ -67,11 +67,11 @@ bool XHatchList::Create() aStr.append(" 1"); sal_Int32 nLen = aStr.getLength() - 1; - Insert(std::make_unique<XHatchEntry>(XHatch(COL_BLACK,css::drawing::HatchStyle_SINGLE,100, 0),aStr.toString())); + Insert(std::make_unique<XHatchEntry>(XHatch(COL_BLACK,css::drawing::HatchStyle_SINGLE,100, Degree10(0)),aStr.toString())); aStr[nLen] = '2'; - Insert(std::make_unique<XHatchEntry>(XHatch(COL_RED ,css::drawing::HatchStyle_DOUBLE, 80,450),aStr.toString())); + Insert(std::make_unique<XHatchEntry>(XHatch(COL_RED ,css::drawing::HatchStyle_DOUBLE, 80,Degree10(450)),aStr.toString())); aStr[nLen] = '3'; - Insert(std::make_unique<XHatchEntry>(XHatch(COL_BLUE ,css::drawing::HatchStyle_TRIPLE,120, 0),aStr.toString())); + Insert(std::make_unique<XHatchEntry>(XHatch(COL_BLUE ,css::drawing::HatchStyle_TRIPLE,120, Degree10(0)),aStr.toString())); return true; } @@ -119,7 +119,7 @@ BitmapEx XHatchList::CreateBitmap( long nIndex, const Size& rSize) const const drawinglayer::attribute::FillHatchAttribute aFillHatch( aHatchStyle, static_cast<double>(rHatch.GetDistance()) * fScaleValue, - static_cast<double>(rHatch.GetAngle()) * F_PI1800, + static_cast<double>(rHatch.GetAngle().get()) * F_PI1800, rHatch.GetColor().getBColor(), 3, // same default as VCL, a minimum of three discrete units (pixels) offset false); diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 1c5c1da46120..1d59814cd810 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -493,7 +493,7 @@ void InitCore() aAttrTab[ RES_CHRATR_CTL_POSTURE - POOLATTR_BEGIN ] = new SvxPostureItem(ITALIC_NONE, RES_CHRATR_CTL_POSTURE ); aAttrTab[ RES_CHRATR_CTL_WEIGHT - POOLATTR_BEGIN ] = new SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_CTL_WEIGHT ); - aAttrTab[ RES_CHRATR_ROTATE - POOLATTR_BEGIN ] = new SvxCharRotateItem( 0, false, RES_CHRATR_ROTATE ); + aAttrTab[ RES_CHRATR_ROTATE - POOLATTR_BEGIN ] = new SvxCharRotateItem( Degree10(0), false, RES_CHRATR_ROTATE ); aAttrTab[ RES_CHRATR_EMPHASIS_MARK - POOLATTR_BEGIN ] = new SvxEmphasisMarkItem( FontEmphasisMark::NONE, RES_CHRATR_EMPHASIS_MARK ); aAttrTab[ RES_CHRATR_TWO_LINES - POOLATTR_BEGIN ] = new SvxTwoLinesItem( false, 0, 0, RES_CHRATR_TWO_LINES ); aAttrTab[ RES_CHRATR_SCALEW - POOLATTR_BEGIN ] = new SvxCharScaleWidthItem( 100, RES_CHRATR_SCALEW ); diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index a72e4836b3ca..92dbbdb29f49 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -133,7 +133,7 @@ void SwVisibleCursor::SetPosAndShow(SfxViewShell const * pViewShell) if( 0 > nTmpY ) { nTmpY = -nTmpY; - m_aTextCursor.SetOrientation( 900 ); + m_aTextCursor.SetOrientation( Degree10(900) ); aRect = SwRect( m_pCursorShell->m_aCharRect.Pos(), Size( m_pCursorShell->m_aCharRect.Height(), nTmpY ) ); aRect.Pos().setX(aRect.Pos().getX() + m_pCursorShell->m_aCursorHeight.getX()); diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx index 5c2fdf4cf16e..68f122f443de 100644 --- a/sw/source/core/doc/DocumentStylePoolManager.cxx +++ b/sw/source/core/doc/DocumentStylePoolManager.cxx @@ -1604,7 +1604,7 @@ SwFormat* DocumentStylePoolManager::GetFormatFromPool( sal_uInt16 nId ) } break; case RES_POOLCHR_VERT_NUM: - aSet.Put( SvxCharRotateItem( 900, false, RES_CHRATR_ROTATE ) ); + aSet.Put( SvxCharRotateItem( Degree10(900), false, RES_CHRATR_ROTATE ) ); break; case RES_POOLFRM_FRAME: diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index 5114516c82fc..2e607b83093a 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -771,7 +771,7 @@ GraphicAttr& SwGrfNode::GetGraphicAttr( GraphicAttr& rGA, convertTwipToMm100( rCrop.GetBottom() )); const SwRotationGrf& rRotation = rSet.GetRotationGrf(); - rGA.SetRotation( rRotation.GetValue() ); + rGA.SetRotation( Degree10(rRotation.GetValue()) ); rGA.SetLuminance( rSet.GetLuminanceGrf().GetValue() ); rGA.SetContrast( rSet.GetContrastGrf().GetValue() ); diff --git a/sw/source/core/inc/drawfont.hxx b/sw/source/core/inc/drawfont.hxx index 08152e3c7181..64739ef6d114 100644 --- a/sw/source/core/inc/drawfont.hxx +++ b/sw/source/core/inc/drawfont.hxx @@ -584,7 +584,7 @@ public: m_bPosMatchesBounds = bNew; } - void Shift( sal_uInt16 nDir ); + void Shift( Degree10 nDir ); // sets a new color at the output device if necessary if a font is passed // as argument, the change if made to the font otherwise the font at the diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx index 96d1fbe187b5..f58a65ac9455 100644 --- a/sw/source/core/inc/swfont.hxx +++ b/sw/source/core/inc/swfont.hxx @@ -48,7 +48,7 @@ const sal_Unicode CH_FULL_BLANK = 0x3000; const sal_Unicode CH_NB_SPACE = 0xA0; const sal_Unicode CH_SIX_PER_EM = 0x2006; // six-per-em space -sal_uInt16 UnMapDirection( sal_uInt16 nDir, const bool bVertFormat, const bool bVertFormatLRBT ); +Degree10 UnMapDirection( Degree10 nDir, const bool bVertFormat, const bool bVertFormatLRBT ); class SwSubFont : public SvxFont { @@ -92,7 +92,7 @@ class SwSubFont : public SvxFont inline void SetStrikeout( const FontStrikeout eStrikeout ); inline void SetItalic( const FontItalic eItalic ); inline void SetOutline( const bool bOutline ); - inline void SetVertical( const sal_uInt16 nDir, const bool bVertFormat ); + inline void SetVertical( const Degree10 nDir, const bool bVertFormat ); inline void SetShadow( const bool bShadow ); inline void SetAutoKern( FontKerning nAutoKern ); inline void SetWordLineMode( const bool bWordLineMode ); @@ -216,7 +216,7 @@ public: void SetOverColor( const Color &rColor ) { m_aOverColor = rColor; } inline void SetStrikeout( const FontStrikeout eStrikeout ); inline void SetOutline( const bool bOutline ); - void SetVertical(sal_uInt16 nDir, const bool bVertLayout = false, + void SetVertical(Degree10 nDir, const bool bVertLayout = false, const bool bVertLayoutLRBT = false); inline void SetShadow( const bool bShadow ); inline void SetAutoKern( FontKerning nAutoKern ); @@ -281,7 +281,7 @@ public: FontWeight GetWeight() const { return m_aSub[m_nActual].GetWeight(); } FontEmphasisMark GetEmphasisMark() const { return m_aSub[m_nActual].GetEmphasisMark(); } - sal_uInt16 GetOrientation(const bool bVertLayout = false, + Degree10 GetOrientation(const bool bVertLayout = false, const bool bVertFormatLRBT = false) const; const OUString& GetName( const SwFontScript nWhich ) const @@ -817,7 +817,7 @@ inline void SwFont::SetGreyWave( const bool bNew ) m_bGreyWave = bNew; } -inline void SwSubFont::SetVertical( const sal_uInt16 nDir, const bool bVertFormat ) +inline void SwSubFont::SetVertical( const Degree10 nDir, const bool bVertFormat ) { m_nFontCacheId = nullptr; Font::SetVertical( bVertFormat ); diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index fdfe346772f7..ffd391d0d13c 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -4775,7 +4775,7 @@ void PaintCharacterBorder( bool bLeft = true; bool bRight = true; - switch (rFont.GetOrientation(bVerticalLayout, bVerticalLayoutLRBT)) + switch (rFont.GetOrientation(bVerticalLayout, bVerticalLayoutLRBT).get()) { case 0 : bLeft = !bJoinWithPrev; diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx index aa1b9f67e728..8bac38c92c7e 100644 --- a/sw/source/core/text/atrstck.cxx +++ b/sw/source/core/text/atrstck.cxx @@ -773,7 +773,7 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, bool bPush ) // 2. attribute is active if ( !bRuby && static_cast<const SvxTwoLinesItem&>(rItem).GetValue() ) { - rFnt.SetVertical( 0, m_bVertLayout ); + rFnt.SetVertical( Degree10(0), m_bVertLayout ); break; } @@ -799,7 +799,7 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, bool bPush ) break; } case RES_TXTATR_CJK_RUBY : - rFnt.SetVertical( 0, m_bVertLayout ); + rFnt.SetVertical( Degree10(0), m_bVertLayout ); break; case RES_TXTATR_REFMARK : if ( bPush ) diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx index 2a24b76dd1a5..2d46fec51020 100644 --- a/sw/source/core/text/frmpaint.cxx +++ b/sw/source/core/text/frmpaint.cxx @@ -131,7 +131,7 @@ SwExtraPainter::SwExtraPainter( const SwTextFrame *pFrame, SwViewShell *pVwSh, m_pFnt.reset( new SwFont(&pFormat->GetAttrSet(), &pFrame->GetDoc().getIDocumentSettingAccess()) ); m_pFnt->Invalidate(); m_pFnt->ChgPhysFnt( m_pSh, *m_pSh->GetOut() ); - m_pFnt->SetVertical( 0, pFrame->IsVertical() ); + m_pFnt->SetVertical( Degree10(0), pFrame->IsVertical() ); } if( bLineNum ) @@ -538,7 +538,7 @@ bool SwTextFrame::PaintEmpty( const SwRect &rRect, bool bCheck ) const pFnt->SetStyleName(OUString(), SwFontScript::Latin); pFnt->SetCharSet( RTL_TEXTENCODING_SYMBOL, SwFontScript::Latin ); } - pFnt->SetVertical( 0, IsVertical() ); + pFnt->SetVertical( Degree10(0), IsVertical() ); SwFrameSwapper aSwapper( this, true ); SwLayoutModeModifier aLayoutModeModifier( *pSh->GetOut() ); aLayoutModeModifier.Modify( IsRightToLeft() ); diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index f3ebd605d918..846701fd240b 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -607,7 +607,7 @@ SwTransparentTextGuard::~SwTransparentTextGuard() aVCLGradient.SetStyle(GradientStyle::Linear); aVCLGradient.SetStartColor(aTransColor); aVCLGradient.SetEndColor(aTransColor); - aVCLGradient.SetAngle(0); + aVCLGradient.SetAngle(Degree10(0)); aVCLGradient.SetBorder(0); aVCLGradient.SetOfsX(0); aVCLGradient.SetOfsY(0); @@ -690,7 +690,7 @@ void SwTextPaintInfo::DrawText_( const OUString &rText, const SwLinePortion &rPo } else { - switch( m_pFnt->GetOrientation(GetTextFrame()->IsVertical()) ) + switch( m_pFnt->GetOrientation(GetTextFrame()->IsVertical()).get() ) { case 0 : aFontPos.AdjustX(nLeftBorderSpace ); @@ -880,7 +880,7 @@ static void lcl_DrawSpecial( const SwTextPaintInfo& rTextPaintInfo, const SwLine // Some of the current values are set at the font: if ( ! bRotate ) - s_aFnt.SetVertical( 0, rTextPaintInfo.GetTextFrame()->IsVertical() ); + s_aFnt.SetVertical( Degree10(0), rTextPaintInfo.GetTextFrame()->IsVertical() ); else s_aFnt.SetVertical( pOldFnt->GetOrientation() ); @@ -894,13 +894,13 @@ static void lcl_DrawSpecial( const SwTextPaintInfo& rTextPaintInfo, const SwLine rNonConstTextPaintInfo.SetFont( &s_aFnt ); // The maximum width depends on the current orientation - const sal_uInt16 nDir = s_aFnt.GetOrientation( rTextPaintInfo.GetTextFrame()->IsVertical() ); + const Degree10 nDir = s_aFnt.GetOrientation( rTextPaintInfo.GetTextFrame()->IsVertical() ); SwTwips nMaxWidth; - if (nDir == 900 || nDir == 2700) + if (nDir == Degree10(900) || nDir == Degree10(2700)) nMaxWidth = rRect.Height(); else { - assert(nDir == 0); //Unknown direction set at font + assert(nDir == Degree10(0)); //Unknown direction set at font nMaxWidth = rRect.Width(); } @@ -933,7 +933,7 @@ static void lcl_DrawSpecial( const SwTextPaintInfo& rTextPaintInfo, const SwLine // adjust values so that tab is vertically and horizontally centered SwTwips nX = rRect.Left(); SwTwips nY = rRect.Top(); - switch ( nDir ) + switch ( nDir.get() ) { case 0 : if ( bCenter ) @@ -1058,7 +1058,7 @@ void SwTextPaintInfo::DrawPostIts( bool bScript ) const const sal_uInt16 nFontHeight = m_pFnt->GetHeight( m_pVsh, *GetOut() ); const sal_uInt16 nFontAscent = m_pFnt->GetAscent( m_pVsh, *GetOut() ); - switch ( m_pFnt->GetOrientation( GetTextFrame()->IsVertical() ) ) + switch ( m_pFnt->GetOrientation( GetTextFrame()->IsVertical() ).get() ) { case 0 : aSize.setWidth( nPostItsWidth ); diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 42a43d4ca744..aae48722464f 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -1495,16 +1495,16 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf ) const SwAttrSet& rSet = pInfo->GetAnchorCharFormat(const_cast<SwDoc&>(*pDoc))->GetAttrSet(); const SfxPoolItem* pItem; - sal_uInt16 nDir = 0; + Degree10 nDir(0); if( SfxItemState::SET == rSet.GetItemState( RES_CHRATR_ROTATE, true, &pItem )) nDir = static_cast<const SvxCharRotateItem*>(pItem)->GetValue(); - if ( 0 != nDir ) + if ( nDir ) { delete pPor; pPor = new SwRotatedPortion(rInf.GetIdx() + TextFrameIndex(1), - 900 == nDir + Degree10(900) == nDir ? DIR_BOTTOM2TOP : DIR_TOP2BOTTOM ); } @@ -1516,11 +1516,11 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf ) if ( pNumFnt ) { - sal_uInt16 nDir = pNumFnt->GetOrientation( rInf.GetTextFrame()->IsVertical() ); - if ( 0 != nDir ) + Degree10 nDir = pNumFnt->GetOrientation( rInf.GetTextFrame()->IsVertical() ); + if ( nDir ) { delete pPor; - pPor = new SwRotatedPortion(TextFrameIndex(0), 900 == nDir + pPor = new SwRotatedPortion(TextFrameIndex(0), Degree10(900) == nDir ? DIR_BOTTOM2TOP : DIR_TOP2BOTTOM ); diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx index ab48848c7510..3a6177ef384e 100644 --- a/sw/source/core/text/porlin.cxx +++ b/sw/source/core/text/porlin.cxx @@ -96,15 +96,15 @@ void SwLinePortion::PrePaint( const SwTextPaintInfo& rInf, const bool bBidiPor = rInf.GetTextFrame()->IsRightToLeft() != bool( ComplexTextLayoutFlags::BiDiRtl & rInf.GetOut()->GetLayoutMode() ); - sal_uInt16 nDir = bBidiPor ? - 1800 : + Degree10 nDir = bBidiPor ? + Degree10(1800) : rInf.GetFont()->GetOrientation( rInf.GetTextFrame()->IsVertical() ); // pLast == this *only* for the 1st portion in the line so nLastWidth is 0; // allow this too, will paint outside the frame but might look better... if (nLastWidth > nHalfView || pLast == this) { - switch (nDir) + switch (nDir.get()) { case 0: nPos = sal_uInt16( rInf.X() ); diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx index 59cff49d2f69..e61c52b295aa 100644 --- a/sw/source/core/text/pormulti.cxx +++ b/sw/source/core/text/pormulti.cxx @@ -786,7 +786,7 @@ static bool lcl_CheckRotation(const SfxPoolItem *const pItem, { if ( pItem ) { - rValue = static_cast<const SvxCharRotateItem*>(pItem)->GetValue(); + rValue = static_cast<const SvxCharRotateItem*>(pItem)->GetValue() != Degree10(0); if( !rpRef ) rpRef = static_cast<const SvxCharRotateItem*>(pItem); else if( static_cast<const SvxCharRotateItem*>(pItem)->GetValue() != @@ -1731,7 +1731,7 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint, { // we do not allow any rotation inside a bidi portion SwFont* pTmpFont = GetInfo().GetFont(); - pTmpFont->SetVertical( 0, GetInfo().GetTextFrame()->IsVertical() ); + pTmpFont->SetVertical( Degree10(0), GetInfo().GetTextFrame()->IsVertical() ); } if( pPor->IsMultiPortion() && static_cast<SwMultiPortion*>(pPor)->IsBidi() ) diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index 3d220f42cf2f..a304958613a7 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -236,7 +236,7 @@ SwTwips SwTextFrame::EmptyHeight() const } if ( IsVertical() ) - pFnt->SetVertical( 2700 ); + pFnt->SetVertical( Degree10(2700) ); OutputDevice* pOut = pSh ? pSh->GetOut() : nullptr; if ( !pOut || !pSh->GetViewOptions()->getBrowseMode() || @@ -586,7 +586,7 @@ void SwControlCharPortion::Paint( const SwTextPaintInfo &rInf ) const Point aOldPos = rInf.GetPos(); Point aNewPos( aOldPos ); auto const deltaX((Width() / 2) - mnHalfCharWidth); - switch (rInf.GetFont()->GetOrientation(rInf.GetTextFrame()->IsVertical())) + switch (rInf.GetFont()->GetOrientation(rInf.GetTextFrame()->IsVertical()).get()) { case 0: aNewPos.AdjustX(deltaX); diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx index 023ffee1b32a..6a4847229a5e 100644 --- a/sw/source/core/text/txtdrop.cxx +++ b/sw/source/core/text/txtdrop.cxx @@ -405,7 +405,7 @@ void SwDropPortion::Paint( const SwTextPaintInfo &rInf ) const if ( rInf.GetFont()->GetOrientation( rInf.GetTextFrame()->IsVertical() ) ) { pTmpFont.reset(new SwFont( *rInf.GetFont() )); - pTmpFont->SetVertical( 0, rInf.GetTextFrame()->IsVertical() ); + pTmpFont->SetVertical( Degree10(0), rInf.GetTextFrame()->IsVertical() ); } SwFontSave aFontSave( rInf, pTmpFont.get() ); @@ -620,7 +620,7 @@ SwDropPortion *SwTextFormatter::NewDropPortion( SwTextFormatInfo &rInf ) } // we do not allow a vertical font for the drop portion - pTmpFnt->SetVertical( 0, rInf.GetTextFrame()->IsVertical() ); + pTmpFnt->SetVertical( Degree10(0), rInf.GetTextFrame()->IsVertical() ); // find next attribute change / script change const TextFrameIndex nTmpIdx = nNextChg; diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index 273dd5b688c1..e62fd8d17b87 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -356,9 +356,9 @@ bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf ) ( rInf.Width() <= rInf.X() + PrtWidth() && rInf.X() <= rInf.Width() ) ; // #95477# Rotated tab stops get the width of one blank - const sal_uInt16 nDir = rInf.GetFont()->GetOrientation( rInf.GetTextFrame()->IsVertical() ); + const Degree10 nDir = rInf.GetFont()->GetOrientation( rInf.GetTextFrame()->IsVertical() ); - if( ! bFull && 0 == nDir ) + if( ! bFull && Degree10(0) == nDir ) { const PortionType nWhich = GetWhichPor(); switch( nWhich ) diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 16b88d3fef39..34bb365233c3 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -296,11 +296,11 @@ static void lcl_calcLinePos( const CalcLinePosData &rData, sal_Int32 nKernStart = nStart ? rData.pKernArray[sal_Int32(nStart) - 1] : 0; sal_Int32 nKernEnd = rData.pKernArray[sal_Int32(nEnd) - 1]; - const sal_uInt16 nDir = rData.bBidiPor ? 1800 + const Degree10 nDir = rData.bBidiPor ? Degree10(1800) : UnMapDirection(rData.rFont.GetOrientation(), rData.bSwitchH2V, rData.bSwitchH2VLRBT); - switch ( nDir ) + switch ( nDir.get() ) { case 0 : rStart.AdjustX(nKernStart ); @@ -1735,12 +1735,12 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) Point aEnd; tools::Long nKernVal = pKernArray[sal_Int32(rInf.GetLen()) - 1]; - const sal_uInt16 nDir = bBidiPor - ? 1800 + const Degree10 nDir = bBidiPor + ? Degree10(1800) : UnMapDirection(GetFont().GetOrientation(), bSwitchH2V, bSwitchH2VLRBT); - switch ( nDir ) + switch ( nDir.get() ) { case 0 : aEnd.setX( rInf.GetPos().X() + nKernVal ); diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx index a67b8922b49d..e2f0b0b71d6c 100644 --- a/sw/source/core/txtnode/swfont.cxx +++ b/sw/source/core/txtnode/swfont.cxx @@ -124,7 +124,7 @@ void SwFont::SetLeftBorder( const editeng::SvxBorderLine* pLeftBorder ) const std::optional<editeng::SvxBorderLine>& SwFont::GetAbsTopBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const { - switch (GetOrientation(bVertLayout, bVertLayoutLRBT)) + switch (GetOrientation(bVertLayout, bVertLayoutLRBT).get()) { case 0 : return m_aTopBorder; @@ -148,7 +148,7 @@ SwFont::GetAbsTopBorder(const bool bVertLayout, const bool bVertLayoutLRBT) cons const std::optional<editeng::SvxBorderLine>& SwFont::GetAbsBottomBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const { - switch (GetOrientation(bVertLayout, bVertLayoutLRBT)) + switch (GetOrientation(bVertLayout, bVertLayoutLRBT).get()) { case 0 : return m_aBottomBorder; @@ -172,7 +172,7 @@ SwFont::GetAbsBottomBorder(const bool bVertLayout, const bool bVertLayoutLRBT) c const std::optional<editeng::SvxBorderLine>& SwFont::GetAbsLeftBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const { - switch (GetOrientation(bVertLayout, bVertLayoutLRBT)) + switch (GetOrientation(bVertLayout, bVertLayoutLRBT).get()) { case 0 : return m_aLeftBorder; @@ -196,7 +196,7 @@ SwFont::GetAbsLeftBorder(const bool bVertLayout, const bool bVertLayoutLRBT) con const std::optional<editeng::SvxBorderLine>& SwFont::GetAbsRightBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const { - switch (GetOrientation(bVertLayout, bVertLayoutLRBT)) + switch (GetOrientation(bVertLayout, bVertLayoutLRBT).get()) { case 0 : return m_aRightBorder; @@ -221,7 +221,7 @@ SvxShadowLocation SwFont::GetAbsShadowLocation(const bool bVertLayout, const bool bVertLayoutLRBT) const { SvxShadowLocation aLocation = SvxShadowLocation::NONE; - switch (GetOrientation(bVertLayout, bVertLayoutLRBT)) + switch (GetOrientation(bVertLayout, bVertLayoutLRBT).get()) { case 0: aLocation = m_aShadowLocation; @@ -305,16 +305,16 @@ sal_uInt16 SwFont::CalcShadowSpace(const SvxShadowItemSide nShadow, const bool b const bool bSkipRight) const { sal_uInt16 nSpace = 0; - const sal_uInt16 nOrient = GetOrientation(bVertLayout, bVertLayoutLRBT); + const Degree10 nOrient = GetOrientation(bVertLayout, bVertLayoutLRBT); const SvxShadowLocation aLoc = GetAbsShadowLocation(bVertLayout, bVertLayoutLRBT); switch( nShadow ) { case SvxShadowItemSide::TOP: if(( aLoc == SvxShadowLocation::TopLeft || aLoc == SvxShadowLocation::TopRight ) && - ( nOrient == 0 || nOrient == 1800 || - ( nOrient == 900 && !bSkipRight ) || - ( nOrient == 2700 && !bSkipLeft ))) + ( nOrient == Degree10(0) || nOrient == Degree10(1800) || + ( nOrient == Degree10(900) && !bSkipRight ) || + ( nOrient == Degree10(2700) && !bSkipLeft ))) { nSpace = m_nShadowWidth; } @@ -323,9 +323,9 @@ sal_uInt16 SwFont::CalcShadowSpace(const SvxShadowItemSide nShadow, const bool b case SvxShadowItemSide::BOTTOM: if(( aLoc == SvxShadowLocation::BottomLeft || aLoc == SvxShadowLocation::BottomRight ) && - ( nOrient == 0 || nOrient == 1800 || - ( nOrient == 900 && !bSkipLeft ) || - ( nOrient == 2700 && !bSkipRight ))) + ( nOrient == Degree10(0) || nOrient == Degree10(1800) || + ( nOrient == Degree10(900) && !bSkipLeft ) || + ( nOrient == Degree10(2700) && !bSkipRight ))) { nSpace = m_nShadowWidth; } @@ -334,9 +334,9 @@ sal_uInt16 SwFont::CalcShadowSpace(const SvxShadowItemSide nShadow, const bool b case SvxShadowItemSide::LEFT: if(( aLoc == SvxShadowLocation::TopLeft || aLoc == SvxShadowLocation::BottomLeft ) && - ( nOrient == 900 || nOrient == 2700 || - ( nOrient == 0 && !bSkipLeft ) || - ( nOrient == 1800 && !bSkipRight ))) + ( nOrient == Degree10(900) || nOrient == Degree10(2700) || + ( nOrient == Degree10(0) && !bSkipLeft ) || + ( nOrient == Degree10(1800) && !bSkipRight ))) { nSpace = m_nShadowWidth; } @@ -345,9 +345,9 @@ sal_uInt16 SwFont::CalcShadowSpace(const SvxShadowItemSide nShadow, const bool b case SvxShadowItemSide::RIGHT: if(( aLoc == SvxShadowLocation::TopRight || aLoc == SvxShadowLocation::BottomRight ) && - ( nOrient == 900 || nOrient == 2700 || - ( nOrient == 0 && !bSkipRight ) || - ( nOrient == 1800 && !bSkipLeft ))) + ( nOrient == Degree10(900) || nOrient == Degree10(2700) || + ( nOrient == Degree10(0) && !bSkipRight ) || + ( nOrient == Degree10(1800) && !bSkipLeft ))) { nSpace = m_nShadowWidth; } @@ -361,23 +361,23 @@ sal_uInt16 SwFont::CalcShadowSpace(const SvxShadowItemSide nShadow, const bool b } // maps directions for vertical layout -static sal_uInt16 MapDirection(sal_uInt16 nDir, const bool bVertFormat, const bool bVertFormatLRBT) +static Degree10 MapDirection(Degree10 nDir, const bool bVertFormat, const bool bVertFormatLRBT) { if ( bVertFormat ) { - switch ( nDir ) + switch ( nDir.get() ) { case 0 : if (bVertFormatLRBT) - nDir = 900; + nDir = Degree10(900); else - nDir = 2700; + nDir = Degree10(2700); break; case 900 : - nDir = 0; + nDir = Degree10(0); break; case 2700 : - nDir = 1800; + nDir = Degree10(1800); break; #if OSL_DEBUG_LEVEL > 0 default : @@ -391,14 +391,14 @@ static sal_uInt16 MapDirection(sal_uInt16 nDir, const bool bVertFormat, const bo // maps the absolute direction set at the font to its logical counterpart // in the rotated environment -sal_uInt16 UnMapDirection(sal_uInt16 nDir, const bool bVertFormat, const bool bVertFormatLRBT) +Degree10 UnMapDirection(Degree10 nDir, const bool bVertFormat, const bool bVertFormatLRBT) { if (bVertFormatLRBT) { - switch (nDir) + switch (nDir.get()) { case 900: - nDir = 0; + nDir = Degree10(0); break; default: SAL_WARN("sw.core", "unsupported direction for VertLRBT"); @@ -409,16 +409,16 @@ sal_uInt16 UnMapDirection(sal_uInt16 nDir, const bool bVertFormat, const bool bV if ( bVertFormat ) { - switch ( nDir ) + switch ( nDir.get() ) { case 0 : - nDir = 900; + nDir = Degree10(900); break; case 1800 : - nDir = 2700; + nDir = Degree10(2700); break; case 2700 : - nDir = 0; + nDir = Degree10(0); break; #if OSL_DEBUG_LEVEL > 0 default : @@ -430,12 +430,12 @@ sal_uInt16 UnMapDirection(sal_uInt16 nDir, const bool bVertFormat, const bool bV return nDir; } -sal_uInt16 SwFont::GetOrientation(const bool bVertFormat, const bool bVertFormatLRBT) const +Degree10 SwFont::GetOrientation(const bool bVertFormat, const bool bVertFormatLRBT) const { return UnMapDirection(m_aSub[m_nActual].GetOrientation(), bVertFormat, bVertFormatLRBT); } -void SwFont::SetVertical(sal_uInt16 nDir, const bool bVertFormat, const bool bVertLayoutLRBT) +void SwFont::SetVertical(Degree10 nDir, const bool bVertFormat, const bool bVertLayoutLRBT) { // map direction if frame has vertical layout nDir = MapDirection(nDir, bVertFormat, bVertLayoutLRBT); @@ -696,7 +696,7 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet, if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_TWO_LINES, true, &pTwoLinesItem )) if ( static_cast<const SvxTwoLinesItem*>(pTwoLinesItem)->GetValue() ) - SetVertical( 0 ); + SetVertical( Degree10(0) ); } else { @@ -883,7 +883,7 @@ SwFont::SwFont( const SwAttrSet* pAttrSet, if ( ! rTwoLinesItem.GetValue() ) SetVertical( pAttrSet->GetCharRotate().GetValue() ); else - SetVertical( 0 ); + SetVertical( Degree10(0) ); if( pIDocumentSettingAccess && pIDocumentSettingAccess->get( DocumentSettingId::SMALL_CAPS_PERCENTAGE_66 )) { m_aSub[ SwFontScript::Latin ].m_bSmallCapsPercentage66 = true; @@ -1397,7 +1397,7 @@ void SwSubFont::CalcEsc( SwDrawTextInfo const & rInf, Point& rPos ) bVert = rInf.GetFrame()->IsVertical(); bVertLRBT = rInf.GetFrame()->IsVertLRBT(); } - const sal_uInt16 nDir = UnMapDirection(GetOrientation(), bVert, bVertLRBT); + const Degree10 nDir = UnMapDirection(GetOrientation(), bVert, bVertLRBT); switch ( GetEscapement() ) { @@ -1406,7 +1406,7 @@ void SwSubFont::CalcEsc( SwDrawTextInfo const & rInf, Point& rPos ) pLastFont->GetFontHeight( rInf.GetShell(), rInf.GetOut() ) + pLastFont->GetFontAscent( rInf.GetShell(), rInf.GetOut() ); - switch ( nDir ) + switch ( nDir.get() ) { case 0 : rPos.AdjustY(nOfst ); @@ -1424,7 +1424,7 @@ void SwSubFont::CalcEsc( SwDrawTextInfo const & rInf, Point& rPos ) nOfst = pLastFont->GetFontAscent( rInf.GetShell(), rInf.GetOut() ) - m_nOrgAscent; - switch ( nDir ) + switch ( nDir.get() ) { case 0 : rPos.AdjustY(nOfst ); @@ -1441,7 +1441,7 @@ void SwSubFont::CalcEsc( SwDrawTextInfo const & rInf, Point& rPos ) default : nOfst = (static_cast<tools::Long>(m_nOrgHeight) * GetEscapement()) / 100; - switch ( nDir ) + switch ( nDir.get() ) { case 0 : rPos.AdjustY( -nOfst ); @@ -1457,7 +1457,7 @@ void SwSubFont::CalcEsc( SwDrawTextInfo const & rInf, Point& rPos ) } // used during painting of small capitals -void SwDrawTextInfo::Shift( sal_uInt16 nDir ) +void SwDrawTextInfo::Shift( Degree10 nDir ) { #ifdef DBG_UTIL OSL_ENSURE( m_bPos, "DrawTextInfo: Undefined Position" ); @@ -1474,9 +1474,9 @@ void SwDrawTextInfo::Shift( sal_uInt16 nDir ) bVert = GetFrame()->IsVertical(); bVertLRBT = GetFrame()->IsVertLRBT(); } - nDir = bBidiPor ? 1800 : UnMapDirection(nDir, bVert, bVertLRBT); + nDir = bBidiPor ? Degree10(1800) : UnMapDirection(nDir, bVert, bVertLRBT); - switch ( nDir ) + switch ( nDir.get() ) { case 0 : m_aPos.AdjustX(GetSize().Width() ); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 78e6bba0bde2..53f7462de3a9 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4686,7 +4686,7 @@ void DocxAttributeOutput::OutputDefaultItem(const SfxPoolItem& rHt) break; case RES_CHRATR_ROTATE: - bMustWrite = static_cast< const SvxCharRotateItem& >(rHt).GetValue() != 0; + bMustWrite = static_cast< const SvxCharRotateItem& >(rHt).GetValue() != Degree10(0); break; case RES_CHRATR_EMPHASIS_MARK: bMustWrite = static_cast< const SvxEmphasisMarkItem& >(rHt).GetEmphasisMark() != FontEmphasisMark::NONE; @@ -9095,7 +9095,7 @@ void DocxAttributeOutput::FormatFillGradient( const XFillGradientItem& rFillGrad // /oox/source/vml/vmlformatting.cxx :: FillModel::pushToPropMap // and also in // /oox/source/drawingml/fillproperties.cxx :: FillProperties::pushToPropMap - sal_Int32 nReverseAngle = 4500 - rGradient.GetAngle(); + sal_Int32 nReverseAngle = (Degree10(4500) - rGradient.GetAngle()).get(); nReverseAngle = nReverseAngle / 10; nReverseAngle = (270 - nReverseAngle) % 360; if (nReverseAngle != 0) diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index b28c2bd4d2cf..413ef854121d 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2076,11 +2076,11 @@ static sal_uInt16 lcl_TCFlags(SwDoc &rDoc, const SwTableBox * pBox, sal_Int32 nR if ( SfxItemState::SET == aCoreSet.GetItemState(RES_CHRATR_ROTATE, true, &pRotItem)) { const SvxCharRotateItem * pRotate = static_cast<const SvxCharRotateItem*>(pRotItem); - if(pRotate && pRotate->GetValue() == 900) + if(pRotate && pRotate->GetValue() == Degree10(900)) { nFlags = nFlags | 0x0004 | 0x0008; } - else if(pRotate && pRotate->GetValue() == 2700 ) + else if(pRotate && pRotate->GetValue() == Degree10(2700) ) { nFlags = nFlags | 0x0004 | 0x0010; } diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 849d68ca1dbb..59e5b6beb731 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -3559,7 +3559,7 @@ void SwWW8ImplReader::Read_DoubleLine_Rotate( sal_uInt16, const sal_uInt8* pData case 1: // rotated characters { bool bFitToLine = 0 != *(pData+1); - NewAttr( SvxCharRotateItem( 900, bFitToLine, RES_CHRATR_ROTATE )); + NewAttr( SvxCharRotateItem( Degree10(900), bFitToLine, RES_CHRATR_ROTATE )); } break; } diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index b41601be1ea5..da8c13e04caa 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -406,8 +406,8 @@ namespace if ( !aMetadata.read(aGraphic) ) return; - sal_uInt16 aRotation = aMetadata.getRotation(); - if (aRotation != 0) + Degree10 aRotation = aMetadata.getRotation(); + if (aRotation) { std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "modules/swriter/ui/queryrotateintostandarddialog.ui")); std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("QueryRotateIntoStandardOrientationDialog")); diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index b0ba28e53074..e0af002ba981 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -2246,7 +2246,7 @@ void SwBaseShell::GetTextFontCtrlState( SfxItemSet& rSet ) } bool bVertical = rSh.IsInVerticalText(); - aFont.SetOrientation(bVertical ? 2700 : 0); + aFont.SetOrientation(Degree10(bVertical ? 2700 : 0)); aFont.SetVertical(bVertical); GetView().GetEditWin().SetInputContext( InputContext( aFont, InputContextFlags::Text | InputContextFlags::ExtText ) ); diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index b0e133d92403..ff12532203b6 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -241,8 +241,8 @@ ErrCode SwView::InsertGraphic( const OUString &rPath, const OUString &rFilter, GraphicNativeMetadata aMetadata; if ( aMetadata.read(aGraphic) ) { - const sal_uInt16 aRotation = aMetadata.getRotation(); - if (aRotation != 0) + const Degree10 aRotation = aMetadata.getRotation(); + if (aRotation) { GraphicNativeTransform aTransform( aGraphic ); aTransform.rotate( aRotation ); diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx index 5849365ea243..904af3e672a4 100644 --- a/sw/source/uibase/uiview/viewstat.cxx +++ b/sw/source/uibase/uiview/viewstat.cxx @@ -456,7 +456,7 @@ void SwView::GetState(SfxItemSet &rSet) { SfxImageItem aImageItem(nWhich); if(m_pWrtShell->IsInVerticalText()) - aImageItem.SetRotation( 2700 ); + aImageItem.SetRotation( Degree10(2700) ); if(m_pWrtShell->IsInRightToLeftText()) aImageItem.SetMirrored( true ); rSet.Put(aImageItem); diff --git a/toolkit/source/awt/vclxgraphics.cxx b/toolkit/source/awt/vclxgraphics.cxx index 958817053663..72ce78fb4fd1 100644 --- a/toolkit/source/awt/vclxgraphics.cxx +++ b/toolkit/source/awt/vclxgraphics.cxx @@ -437,7 +437,7 @@ void VCLXGraphics::drawGradient( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_ InitOutputDevice( InitOutDevFlags::COLORS ); Gradient aGradient(static_cast<GradientStyle>(rGradient.Style), Color(rGradient.StartColor), Color(rGradient.EndColor)); - aGradient.SetAngle(rGradient.Angle); + aGradient.SetAngle(Degree10(rGradient.Angle)); aGradient.SetBorder(rGradient.Border); aGradient.SetOfsX(rGradient.XOffset); aGradient.SetOfsY(rGradient.YOffset); diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx index 238f148af910..20554df69812 100644 --- a/toolkit/source/helper/vclunohelper.cxx +++ b/toolkit/source/helper/vclunohelper.cxx @@ -211,7 +211,7 @@ css::awt::FontDescriptor VCLUnoHelper::CreateFontDescriptor( const vcl::Font& rF aFD.Slant = vcl::unohelper::ConvertFontSlant(rFont.GetItalic()); aFD.Underline = sal::static_int_cast< sal_Int16 >(rFont.GetUnderline()); aFD.Strikeout = sal::static_int_cast< sal_Int16 >(rFont.GetStrikeout()); - aFD.Orientation = rFont.GetOrientation() / 10.0; + aFD.Orientation = rFont.GetOrientation().get() / 10.0; aFD.Kerning = rFont.IsKerning(); aFD.WordLineMode = rFont.IsWordLineMode(); aFD.Type = 0; // ??? => Only in Metric... @@ -245,7 +245,7 @@ vcl::Font VCLUnoHelper::CreateFont( const css::awt::FontDescriptor& rDescr, cons aFont.SetStrikeout( static_cast<FontStrikeout>(rDescr.Strikeout) ); // Not DONTKNOW - aFont.SetOrientation( static_cast<short>(rDescr.Orientation * 10) ); + aFont.SetOrientation( Degree10(static_cast<sal_Int16>(rDescr.Orientation * 10)) ); aFont.SetKerning( static_cast<FontKerning>(rDescr.Kerning) ); aFont.SetWordLineMode( rDescr.WordLineMode ); diff --git a/tools/source/generic/point.cxx b/tools/source/generic/point.cxx index c38e0f183451..13171a070228 100644 --- a/tools/source/generic/point.cxx +++ b/tools/source/generic/point.cxx @@ -21,7 +21,7 @@ #include <basegfx/numeric/ftools.hxx> void Point::RotateAround( Point& rPoint, - short nOrientation ) const + Degree10 nOrientation ) const { tools::Long nX = rPoint.X(); tools::Long nY = rPoint.Y(); @@ -31,28 +31,28 @@ void Point::RotateAround( Point& rPoint, } void Point::RotateAround( tools::Long& rX, tools::Long& rY, - short nOrientation ) const + Degree10 nOrientation ) const { const tools::Long nOriginX = X(); const tools::Long nOriginY = Y(); - if ( (nOrientation >= 0) && !(nOrientation % 900) ) + if ( (nOrientation >= Degree10(0)) && !(nOrientation % Degree10(900)) ) { - if ( nOrientation >= 3600 ) - nOrientation %= 3600; + if ( nOrientation >= Degree10(3600) ) + nOrientation %= Degree10(3600); if ( nOrientation ) { rX -= nOriginX; rY -= nOriginY; - if ( nOrientation == 900 ) + if ( nOrientation == Degree10(900) ) { tools::Long nTemp = rX; rX = rY; rY = -nTemp; } - else if ( nOrientation == 1800 ) + else if ( nOrientation == Degree10(1800) ) { rX = -rX; rY = -rY; @@ -70,7 +70,7 @@ void Point::RotateAround( tools::Long& rX, tools::Long& rY, } else { - double nRealOrientation = nOrientation*F_PI1800; + double nRealOrientation = nOrientation.get() * F_PI1800; double nCos = cos( nRealOrientation ); double nSin = sin( nRealOrientation ); diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 7e972714ad2a..c25783764f27 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -1395,13 +1395,13 @@ void Polygon::Scale( double fScaleX, double fScaleY ) } } -void Polygon::Rotate( const Point& rCenter, sal_uInt16 nAngle10 ) +void Polygon::Rotate( const Point& rCenter, Degree10 nAngle10 ) { - nAngle10 %= 3600; + nAngle10 %= Degree10(3600); if( nAngle10 ) { - const double fAngle = F_PI1800 * nAngle10; + const double fAngle = F_PI1800 * nAngle10.get(); Rotate( rCenter, sin( fAngle ), cos( fAngle ) ); } } diff --git a/tools/source/generic/poly2.cxx b/tools/source/generic/poly2.cxx index a1c4fe0cbe69..2534fb63b029 100644 --- a/tools/source/generic/poly2.cxx +++ b/tools/source/generic/poly2.cxx @@ -254,13 +254,13 @@ void PolyPolygon::Scale( double fScaleX, double fScaleY ) mpImplPolyPolygon->mvPolyAry[ i ].Scale( fScaleX, fScaleY ); } -void PolyPolygon::Rotate( const Point& rCenter, sal_uInt16 nAngle10 ) +void PolyPolygon::Rotate( const Point& rCenter, Degree10 nAngle10 ) { - nAngle10 %= 3600; + nAngle10 %= Degree10(3600); if( nAngle10 ) { - const double fAngle = F_PI1800 * nAngle10; + const double fAngle = F_PI1800 * nAngle10.get(); Rotate( rCenter, sin( fAngle ), cos( fAngle ) ); } } diff --git a/vcl/backendtest/outputdevice/gradient.cxx b/vcl/backendtest/outputdevice/gradient.cxx index c0ed3fc1b717..e9b454660cbc 100644 --- a/vcl/backendtest/outputdevice/gradient.cxx +++ b/vcl/backendtest/outputdevice/gradient.cxx @@ -18,7 +18,7 @@ Bitmap OutputDeviceTestGradient::setupLinearGradient() initialSetup(12, 12, constBackgroundColor); Gradient aGradient(GradientStyle::Linear, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00)); - aGradient.SetAngle(900); + aGradient.SetAngle(Degree10(900)); tools::Rectangle aDrawRect(maVDRectangle.Left() + 1, maVDRectangle.Top() + 1, maVDRectangle.Right() - 1, maVDRectangle.Bottom() - 1); mpVirtualDevice->DrawGradient(aDrawRect, aGradient); @@ -31,7 +31,7 @@ Bitmap OutputDeviceTestGradient::setupLinearGradientAngled() initialSetup(12, 12, constBackgroundColor); Gradient aGradient(GradientStyle::Linear, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00)); - aGradient.SetAngle(450); + aGradient.SetAngle(Degree10(450)); tools::Rectangle aDrawRect(maVDRectangle.Left() + 1, maVDRectangle.Top() + 1, maVDRectangle.Right() - 1, maVDRectangle.Bottom() - 1); mpVirtualDevice->DrawGradient(aDrawRect, aGradient); @@ -70,7 +70,7 @@ Bitmap OutputDeviceTestGradient::setupLinearGradientSteps() initialSetup(12, 12, constBackgroundColor); Gradient aGradient(GradientStyle::Linear, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00)); - aGradient.SetAngle(900); + aGradient.SetAngle(Degree10(900)); aGradient.SetSteps(4); tools::Rectangle aDrawRect(maVDRectangle.Left() + 1, maVDRectangle.Top() + 1, maVDRectangle.Right() - 1, maVDRectangle.Bottom() - 1); @@ -84,7 +84,7 @@ Bitmap OutputDeviceTestGradient::setupAxialGradient() initialSetup(13, 13, constBackgroundColor); Gradient aGradient(GradientStyle::Axial, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00)); - aGradient.SetAngle(900); + aGradient.SetAngle(Degree10(900)); tools::Rectangle aDrawRect(maVDRectangle.Left() + 1, maVDRectangle.Top() + 1, maVDRectangle.Right() - 1, maVDRectangle.Bottom() - 1); mpVirtualDevice->DrawGradient(aDrawRect, aGradient); diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index edf0e061d0a6..7116cf70f7b2 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -1947,7 +1947,7 @@ bool SvpSalGraphics::drawGradient(const tools::PolyPolygon& rPolyPolygon, const tools::Rectangle aBoundRect; Point aCenter; - aGradient.SetAngle(aGradient.GetAngle() + 2700); + aGradient.SetAngle(aGradient.GetAngle() + Degree10(2700)); aGradient.GetBoundRect(aInputRect, aBoundRect, aCenter); Color aStartColor = aGradient.GetStartColor(); Color aEndColor = aGradient.GetEndColor(); @@ -1956,7 +1956,7 @@ bool SvpSalGraphics::drawGradient(const tools::PolyPolygon& rPolyPolygon, const if (rGradient.GetStyle() == GradientStyle::Linear) { tools::Polygon aPoly(aBoundRect); - aPoly.Rotate(aCenter, aGradient.GetAngle() % 3600); + aPoly.Rotate(aCenter, aGradient.GetAngle() % Degree10(3600)); pattern = cairo_pattern_create_linear(aPoly[0].X(), aPoly[0].Y(), aPoly[1].X(), aPoly[1].Y()); } else diff --git a/vcl/inc/fontinstance.hxx b/vcl/inc/fontinstance.hxx index f20c0abbdfe7..7dc78ac05533 100644 --- a/vcl/inc/fontinstance.hxx +++ b/vcl/inc/fontinstance.hxx @@ -28,6 +28,7 @@ #include <salhelper/simplereferenceobject.hxx> #include <tools/gen.hxx> #include <tools/fontenum.hxx> +#include <tools/degree.hxx> #include <vcl/glyphitem.hxx> #include <optional> @@ -56,8 +57,8 @@ public: // TODO: make data members private const ConvertChar* mpConversion; // used e.g. for StarBats->StarSymbol tools::Long mnLineHeight; - short mnOwnOrientation; // text angle if lower layers don't rotate text themselves - short mnOrientation; // text angle in 3600 system + Degree10 mnOwnOrientation; // text angle if lower layers don't rotate text themselves + Degree10 mnOrientation; // text angle in 3600 system bool mbInit; // true if maFontMetric member is valid void AddFallbackForUnicode( sal_UCS4, FontWeight eWeight, const OUString& rFontName ); diff --git a/vcl/inc/fontselect.hxx b/vcl/inc/fontselect.hxx index 7df7dd93072a..c517268763d4 100644 --- a/vcl/inc/fontselect.hxx +++ b/vcl/inc/fontselect.hxx @@ -21,6 +21,7 @@ #define INCLUDED_VCL_INC_FONTSELECT_HXX #include <i18nlangtag/lang.h> +#include <tools/degree.hxx> #include <vcl/vclenum.hxx> #include "fontattributes.hxx" @@ -59,7 +60,7 @@ public: int mnWidth; // width of font in pixel units int mnHeight; // height of font in pixel units float mfExactHeight; // requested height (in pixels with subpixel details) - int mnOrientation; // text orientation in 1/10 degree (0-3600) + Degree10 mnOrientation; // text orientation in 1/10 degree (0-3600) LanguageType meLanguage; // text language bool mbVertical; // vertical mode of requested font bool mbNonAntialiased; // true if antialiasing is disabled diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx index 7f4301d97778..caa917a751f0 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -126,7 +126,7 @@ private: bool mbWordLine:1; // TODO: metric data, should be migrated to ImplFontMetric - short mnOrientation; + Degree10 mnOrientation; int mnQuality; diff --git a/vcl/inc/impfontmetricdata.hxx b/vcl/inc/impfontmetricdata.hxx index ec1d98ccba41..a1d5db86bd8c 100644 --- a/vcl/inc/impfontmetricdata.hxx +++ b/vcl/inc/impfontmetricdata.hxx @@ -42,10 +42,10 @@ public: // font instance attributes from the font request tools::Long GetWidth() const { return mnWidth; } - short GetOrientation() const { return mnOrientation; } + Degree10 GetOrientation() const { return mnOrientation; } void SetWidth(tools::Long nWidth) { mnWidth=nWidth; } - void SetOrientation(short nOrientation) { mnOrientation=nOrientation; } + void SetOrientation(Degree10 nOrientation) { mnOrientation=nOrientation; } // font metrics measured for the font instance tools::Long GetAscent() const { return mnAscent; } @@ -102,7 +102,7 @@ private: // font instance attributes from the font request tools::Long mnHeight; // Font size tools::Long mnWidth; // Reference Width - short mnOrientation; // Rotation in 1/10 degrees + Degree10 mnOrientation; // Rotation in 1/10 degrees // font metrics measured for the font instance tools::Long mnAscent; // Ascent diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx index 6e8b2afb2854..bf93c0f64028 100644 --- a/vcl/inc/sallayout.hxx +++ b/vcl/inc/sallayout.hxx @@ -31,6 +31,7 @@ #include <basegfx/polygon/b2dpolypolygon.hxx> #include <i18nlangtag/languagetag.hxx> #include <tools/gen.hxx> +#include <tools/degree.hxx> #include <vcl/dllapi.h> #include <vcl/vclenum.hxx> // for typedef sal_UCS4 #include <vcl/devicecoordinate.hxx> @@ -88,7 +89,7 @@ public: // positioning related inputs const DeviceCoordinate* mpDXArray; // in pixel units DeviceCoordinate mnLayoutWidth; // in pixel units - int mnOrientation; // in 0-3600 system + Degree10 mnOrientation; // in 0-3600 system // data for bidi and glyph+script fallback ImplLayoutRuns maRuns; @@ -101,7 +102,7 @@ public: void SetLayoutWidth( DeviceCoordinate nWidth ) { mnLayoutWidth = nWidth; } void SetDXArray( const DeviceCoordinate* pDXArray ) { mpDXArray = pDXArray; } - void SetOrientation( int nOrientation ) { mnOrientation = nOrientation; } + void SetOrientation( Degree10 nOrientation ) { mnOrientation = nOrientation; } void ResetPos() { maRuns.ResetPos(); } diff --git a/vcl/inc/toolbox.h b/vcl/inc/toolbox.h index a1f0cd2aaf33..8aa6bb915fcb 100644 --- a/vcl/inc/toolbox.h +++ b/vcl/inc/toolbox.h @@ -38,7 +38,7 @@ struct ImplToolItem bool mbNonInteractiveWindow; void* mpUserData; Image maImage; - tools::Long mnImageAngle; + Degree10 mnImageAngle; bool mbMirrorMode; OUString maText; OUString maQuickHelpText; diff --git a/vcl/inc/unx/printergfx.hxx b/vcl/inc/unx/printergfx.hxx index fcb8a9241fd8..ff4b51cb04dc 100644 --- a/vcl/inc/unx/printergfx.hxx +++ b/vcl/inc/unx/printergfx.hxx @@ -183,7 +183,7 @@ private: std::vector< GlyphSet > maPS3Font; sal_Int32 mnFontID; - sal_Int32 mnTextAngle; + Degree10 mnTextAngle; bool mbTextVertical; PrintFontManager& mrFontMgr; @@ -243,7 +243,7 @@ public: void PSBinPath (const Point& rCurrent, Point& rOld, pspath_t eType, sal_Int32& nColumn); - void PSRotate (sal_Int32 nAngle); + void PSRotate (Degree10 nAngle); void PSTranslate (const Point& rPoint); void PSMoveTo (const Point& rPoint); void PSScale (double fScaleX, double fScaleY); @@ -315,7 +315,7 @@ public: sal_Int32 nFontID, sal_Int32 nPointHeight, sal_Int32 nPointWidth, - sal_Int32 nAngle, + Degree10 nAngle, bool bVertical, bool bArtItalic, bool bArtBold diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index 1c20a8ef9a46..d2218590091b 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -1430,7 +1430,7 @@ void OpenGLSalGraphicsImpl::DrawLinearGradient( const Gradient& rGradient, const Point aCenter; rGradient.GetBoundRect( rRect, aBoundRect, aCenter ); tools::Polygon aPoly( aBoundRect ); - aPoly.Rotate( aCenter, rGradient.GetAngle() % 3600 ); + aPoly.Rotate( aCenter, rGradient.GetAngle() % Degree10(3600) ); GLfloat aTexCoord[8] = { 0, 1, 1, 1, 1, 0, 0, 0 }; GLfloat fMin = 1.0 - 100.0 / (100.0 - rGradient.GetBorder()); @@ -1482,7 +1482,7 @@ void OpenGLSalGraphicsImpl::DrawAxialGradient( const Gradient& rGradient, const aPoly.SetPoint( aRect.BottomRight(), 4 ); aPoly.SetPoint( aRect.BottomLeft(), 5 ); aPoly.SetPoint( aPt0, 6 ); - aPoly.Rotate( aCenter, rGradient.GetAngle() % 3600 ); + aPoly.Rotate( aCenter, rGradient.GetAngle() % Degree10(3600) ); GLfloat aTexCoord[12] = { 0, 1, 1, 0, 2, 0, 3, 1, 4, 0, 5, 0 }; GLfloat fMin = 1.0 - 100.0 / (100.0 - rGradient.GetBorder()); diff --git a/vcl/qa/cppunit/GraphicNativeMetadataTest.cxx b/vcl/qa/cppunit/GraphicNativeMetadataTest.cxx index 7e5d1adcba66..42683a1a3f06 100644 --- a/vcl/qa/cppunit/GraphicNativeMetadataTest.cxx +++ b/vcl/qa/cppunit/GraphicNativeMetadataTest.cxx @@ -46,7 +46,7 @@ void GraphicNativeMetadataTest::testReadFromGraphic() { GraphicNativeMetadata aMetadata; aMetadata.read(aFileStream); - CPPUNIT_ASSERT_EQUAL(sal_uInt16(1800), aMetadata.getRotation()); + CPPUNIT_ASSERT_EQUAL(sal_Int16(1800), aMetadata.getRotation().get()); // just the metadata shouldn't make the graphic available CPPUNIT_ASSERT_EQUAL(false, aGraphic.isAvailable()); } @@ -58,7 +58,7 @@ void GraphicNativeMetadataTest::testReadFromGraphic() GraphicNativeMetadata aMetadata; aMetadata.read(aFileStream); - CPPUNIT_ASSERT_EQUAL(sal_uInt16(1800), aMetadata.getRotation()); + CPPUNIT_ASSERT_EQUAL(sal_Int16(1800), aMetadata.getRotation().get()); } } @@ -69,28 +69,28 @@ void GraphicNativeMetadataTest::testExifRotationJpeg() SvFileStream aFileStream(getFullUrl("Exif1.jpg"), StreamMode::READ); GraphicNativeMetadata aMetadata; aMetadata.read(aFileStream); - CPPUNIT_ASSERT_EQUAL(sal_uInt16(0), aMetadata.getRotation()); + CPPUNIT_ASSERT_EQUAL(sal_Int16(0), aMetadata.getRotation().get()); } { // Rotation 90 degree clock-wise = 270 degree counter-clock-wise SvFileStream aFileStream(getFullUrl("Exif1_090CW.jpg"), StreamMode::READ); GraphicNativeMetadata aMetadata; aMetadata.read(aFileStream); - CPPUNIT_ASSERT_EQUAL(sal_uInt16(2700), aMetadata.getRotation()); + CPPUNIT_ASSERT_EQUAL(sal_Int16(2700), aMetadata.getRotation().get()); } { // Rotation 180 degree SvFileStream aFileStream(getFullUrl("Exif1_180.jpg"), StreamMode::READ); GraphicNativeMetadata aMetadata; aMetadata.read(aFileStream); - CPPUNIT_ASSERT_EQUAL(sal_uInt16(1800), aMetadata.getRotation()); + CPPUNIT_ASSERT_EQUAL(sal_Int16(1800), aMetadata.getRotation().get()); } { // Rotation 270 degree clock-wise = 90 degree counter-clock-wise SvFileStream aFileStream(getFullUrl("Exif1_270CW.jpg"), StreamMode::READ); GraphicNativeMetadata aMetadata; aMetadata.read(aFileStream); - CPPUNIT_ASSERT_EQUAL(sal_uInt16(900), aMetadata.getRotation()); + CPPUNIT_ASSERT_EQUAL(sal_Int16(900), aMetadata.getRotation().get()); } } diff --git a/vcl/qa/cppunit/TypeSerializerTest.cxx b/vcl/qa/cppunit/TypeSerializerTest.cxx index 30966700a3a3..fd45662bdf20 100644 --- a/vcl/qa/cppunit/TypeSerializerTest.cxx +++ b/vcl/qa/cppunit/TypeSerializerTest.cxx @@ -87,7 +87,7 @@ TypeSerializerTest::~TypeSerializerTest() void TypeSerializerTest::testGradient() { Gradient aGradient(GradientStyle::Radial, Color(0xFF, 0x00, 0x00), Color(0x00, 0xFF, 0x00)); - aGradient.SetAngle(900); + aGradient.SetAngle(Degree10(900)); aGradient.SetBorder(5); aGradient.SetOfsX(11); aGradient.SetOfsY(12); @@ -105,7 +105,7 @@ void TypeSerializerTest::testGradient() CPPUNIT_ASSERT_EQUAL(GradientStyle::Radial, aReadGradient.GetStyle()); CPPUNIT_ASSERT_EQUAL(Color(0xFF, 0x00, 0x00), aReadGradient.GetStartColor()); CPPUNIT_ASSERT_EQUAL(Color(0x00, 0xFF, 0x00), aReadGradient.GetEndColor()); - CPPUNIT_ASSERT_EQUAL(sal_uInt16(900), aReadGradient.GetAngle()); + CPPUNIT_ASSERT_EQUAL(sal_Int16(900), aReadGradient.GetAngle().get()); CPPUNIT_ASSERT_EQUAL(sal_uInt16(5), aReadGradient.GetBorder()); CPPUNIT_ASSERT_EQUAL(sal_uInt16(11), aReadGradient.GetOfsX()); CPPUNIT_ASSERT_EQUAL(sal_uInt16(12), aReadGradient.GetOfsY()); diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx index 17878c0656e6..f3ed205b4d8f 100644 --- a/vcl/qa/cppunit/svm/svmtest.cxx +++ b/vcl/qa/cppunit/svm/svmtest.cxx @@ -1271,7 +1271,7 @@ void SvmTest::testGradient() aGradient2.SetStyle(GradientStyle::Radial); aGradient2.SetStartColor(COL_LIGHTRED); aGradient2.SetEndColor(COL_LIGHTGREEN); - aGradient2.SetAngle(55); + aGradient2.SetAngle(Degree10(55)); aGradient2.SetBorder(10); aGradient2.SetOfsX(22); aGradient2.SetOfsY(24); @@ -1323,7 +1323,7 @@ void SvmTest::testHatch() tools::PolyPolygon aPolyPolygon(1); aPolyPolygon.Insert(aPolygon); - Hatch aHatch(HatchStyle::Single, COL_YELLOW, 15, 900); + Hatch aHatch(HatchStyle::Single, COL_YELLOW, 15, Degree10(900)); pVirtualDev->DrawHatch(aPolyPolygon, aHatch); diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx index b9eb2864bb45..431ab4e32f3d 100644 --- a/vcl/qt5/Qt5Graphics_Text.cxx +++ b/vcl/qt5/Qt5Graphics_Text.cxx @@ -279,7 +279,7 @@ public: { } - void SetOrientation(int nOrientation) { mnOrientation = nOrientation; } + void SetOrientation(Degree10 nOrientation) { mnOrientation = nOrientation; } }; } @@ -304,9 +304,9 @@ void Qt5Graphics::DrawTextLayout(const GenericSalLayout& rLayout) // probably better to add a parameter to GetNextGlyphs? Qt5CommonSalLayout* pQt5Layout = static_cast<Qt5CommonSalLayout*>(const_cast<GenericSalLayout*>(&rLayout)); - int nOrientation = rLayout.GetOrientation(); + Degree10 nOrientation = rLayout.GetOrientation(); if (nOrientation) - pQt5Layout->SetOrientation(0); + pQt5Layout->SetOrientation(Degree10(0)); Point aPos; const GlyphItem* pGlyph; @@ -338,7 +338,7 @@ void Qt5Graphics::DrawTextLayout(const GenericSalLayout& rLayout) aPainter.setWindow(window); QTransform p; - p.rotate(-static_cast<qreal>(nOrientation) / 10.0); + p.rotate(-static_cast<qreal>(nOrientation.get()) / 10.0); p.translate(-positions[0].x(), -positions[0].y()); aPainter.setTransform(p); } diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index eb67d981fe95..20c05c98bbb1 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -56,7 +56,7 @@ CoreTextStyle::CoreTextStyle(const PhysicalFontFace& rPFF, const FontSelectPatte double fScaledFontHeight = rFSP.mfExactHeight; // convert font rotation to radian - mfFontRotation = toRadian(rFSP.mnOrientation); + mfFontRotation = toRadian(rFSP.mnOrientation.get()); // dummy matrix so we can use CGAffineTransformConcat() below CGAffineTransform aMatrix = CGAffineTransformMakeTranslation(0, 0); diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index 067348d364ed..d9440df0795d 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -1823,7 +1823,7 @@ bool SkiaSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolyPolygon, Gradient aGradient(rGradient); tools::Rectangle aBoundRect; Point aCenter; - aGradient.SetAngle(aGradient.GetAngle() + 2700); + aGradient.SetAngle(aGradient.GetAngle() + Degree10(2700)); aGradient.GetBoundRect(boundRect, aBoundRect, aCenter); SkColor startColor @@ -1834,7 +1834,7 @@ bool SkiaSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolyPolygon, if (rGradient.GetStyle() == GradientStyle::Linear) { tools::Polygon aPoly(aBoundRect); - aPoly.Rotate(aCenter, aGradient.GetAngle() % 3600); + aPoly.Rotate(aCenter, aGradient.GetAngle() % Degree10(3600)); SkPoint points[2] = { SkPoint::Make(toSkX(aPoly[0].X()), toSkY(aPoly[0].Y())), SkPoint::Make(toSkX(aPoly[1].X()), toSkY(aPoly[1].Y())) }; SkColor colors[2] = { startColor, endColor }; @@ -1893,9 +1893,9 @@ bool SkiaSalGraphicsImpl::implDrawGradient(const basegfx::B2DPolyPolygon& rPolyP return true; } -static double toRadian(int degree10th) { return (3600 - degree10th) * M_PI / 1800.0; } -static double toCos(int degree10th) { return SkScalarCos(toRadian(degree10th)); } -static double toSin(int degree10th) { return SkScalarSin(toRadian(degree10th)); } +static double toRadian(Degree10 degree10th) { return (3600 - degree10th.get()) * M_PI / 1800.0; } +static double toCos(Degree10 degree10th) { return SkScalarCos(toRadian(degree10th)); } +static double toSin(Degree10 degree10th) { return SkScalarSin(toRadian(degree10th)); } void SkiaSalGraphicsImpl::drawGenericLayout(const GenericSalLayout& layout, Color textColor, const SkFont& font, GlyphOrientation glyphOrientation) @@ -1911,12 +1911,12 @@ void SkiaSalGraphicsImpl::drawGenericLayout(const GenericSalLayout& layout, Colo while (layout.GetNextGlyph(&pGlyph, aPos, nStart)) { glyphIds.push_back(pGlyph->glyphId()); - int angle = 0; // 10th of degree + Degree10 angle(0); // 10th of degree if (glyphOrientation == GlyphOrientation::Apply) { angle = layout.GetOrientation(); if (pGlyph->IsVertical()) - angle += 900; // 90 degree + angle += Degree10(900); // 90 degree } SkRSXform form = SkRSXform::Make(toCos(angle), toSin(angle), aPos.X(), aPos.Y()); glyphForms.emplace_back(std::move(form)); diff --git a/vcl/source/bitmap/bitmappaint.cxx b/vcl/source/bitmap/bitmappaint.cxx index ebc7e1288ef5..f9dff4ee0b26 100644 --- a/vcl/source/bitmap/bitmappaint.cxx +++ b/vcl/source/bitmap/bitmappaint.cxx @@ -209,16 +209,16 @@ bool Bitmap::Mirror(BmpMirrorFlags nMirrorFlags) return bRet; } -bool Bitmap::Rotate(tools::Long nAngle10, const Color& rFillColor) +bool Bitmap::Rotate(Degree10 nAngle10, const Color& rFillColor) { bool bRet = false; - nAngle10 %= 3600; - nAngle10 = (nAngle10 < 0) ? (3599L + nAngle10) : nAngle10; + nAngle10 %= Degree10(3600); + nAngle10 = (nAngle10 < Degree10(0)) ? (Degree10(3599) + nAngle10) : nAngle10; if (!nAngle10) bRet = true; - else if (nAngle10 == 1800) + else if (nAngle10 == Degree10(1800)) bRet = Mirror(BmpMirrorFlags::Horizontal | BmpMirrorFlags::Vertical); else { @@ -229,7 +229,7 @@ bool Bitmap::Rotate(tools::Long nAngle10, const Color& rFillColor) { const Size aSizePix(GetSizePixel()); - if (nAngle10 == 900 || nAngle10 == 2700) + if (nAngle10 == Degree10(900) || nAngle10 == Degree10(2700)) { const Size aNewSizePix(aSizePix.Height(), aSizePix.Width()); Bitmap aNewBmp(aNewSizePix, GetBitCount(), &pReadAcc->GetPalette()); @@ -244,7 +244,7 @@ bool Bitmap::Rotate(tools::Long nAngle10, const Color& rFillColor) const tools::Long nNewWidth = aNewSizePix.Width(); const tools::Long nNewHeight = aNewSizePix.Height(); - if (nAngle10 == 900) + if (nAngle10 == Degree10(900)) { for (tools::Long nY = 0, nOtherX = nWidth1; nY < nNewHeight; nY++, nOtherX--) @@ -257,7 +257,7 @@ bool Bitmap::Rotate(tools::Long nAngle10, const Color& rFillColor) } } } - else if (nAngle10 == 2700) + else if (nAngle10 == Degree10(2700)) { for (tools::Long nY = 0, nOtherX = 0; nY < nNewHeight; nY++, nOtherX++) { @@ -280,7 +280,7 @@ bool Bitmap::Rotate(tools::Long nAngle10, const Color& rFillColor) Point aTmpPoint; tools::Rectangle aTmpRectangle(aTmpPoint, aSizePix); tools::Polygon aPoly(aTmpRectangle); - aPoly.Rotate(aTmpPoint, static_cast<sal_uInt16>(nAngle10)); + aPoly.Rotate(aTmpPoint, nAngle10); tools::Rectangle aNewBound(aPoly.GetBoundRect()); const Size aNewSizePix(aNewBound.GetSize()); @@ -290,8 +290,8 @@ bool Bitmap::Rotate(tools::Long nAngle10, const Color& rFillColor) if (pWriteAcc) { const BitmapColor aFillColor(pWriteAcc->GetBestMatchingColor(rFillColor)); - const double fCosAngle = cos(nAngle10 * F_PI1800); - const double fSinAngle = sin(nAngle10 * F_PI1800); + const double fCosAngle = cos(nAngle10.get() * F_PI1800); + const double fSinAngle = sin(nAngle10.get() * F_PI1800); const double fXMin = aNewBound.Left(); const double fYMin = aNewBound.Top(); const tools::Long nWidth = aSizePix.Width(); diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index 51688a092564..bb9831dcf425 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -507,7 +507,7 @@ void FixedLine::ImplDraw(vcl::RenderContext& rRenderContext) tools::Long nWidth = rRenderContext.GetTextWidth(aText); rRenderContext.Push(PushFlags::FONT); vcl::Font aFont(rRenderContext.GetFont()); - aFont.SetOrientation(900); + aFont.SetOrientation(Degree10(900)); SetFont(aFont); Point aStartPt(aOutSize.Width() / 2, aOutSize.Height() - 1); if (nWinStyle & WB_VCENTER) diff --git a/vcl/source/filter/GraphicNativeTransform.cxx b/vcl/source/filter/GraphicNativeTransform.cxx index b2d90f43e8d7..d6c77c71caba 100644 --- a/vcl/source/filter/GraphicNativeTransform.cxx +++ b/vcl/source/filter/GraphicNativeTransform.cxx @@ -35,16 +35,17 @@ GraphicNativeTransform::GraphicNativeTransform(Graphic& rGraphic) GraphicNativeTransform::~GraphicNativeTransform() {} -void GraphicNativeTransform::rotate(sal_uInt16 aInputRotation) +void GraphicNativeTransform::rotate(Degree10 aInputRotation) { // Rotation can be between 0 and 3600 - sal_uInt16 aRotation = aInputRotation % 3600; + Degree10 aRotation = aInputRotation % Degree10(3600); - if (aRotation == 0) + if (aRotation == Degree10(0)) { return; // No rotation is needed } - else if (aRotation != 900 && aRotation != 1800 && aRotation != 2700) + else if (aRotation != Degree10(900) && aRotation != Degree10(1800) + && aRotation != Degree10(2700)) { return; } @@ -68,7 +69,7 @@ void GraphicNativeTransform::rotate(sal_uInt16 aInputRotation) } } -bool GraphicNativeTransform::rotateBitmapOnly(sal_uInt16 aRotation) +bool GraphicNativeTransform::rotateBitmapOnly(Degree10 aRotation) { if (mrGraphic.IsAnimated()) { @@ -82,7 +83,7 @@ bool GraphicNativeTransform::rotateBitmapOnly(sal_uInt16 aRotation) return true; } -bool GraphicNativeTransform::rotateGeneric(sal_uInt16 aRotation, const OUString& aType) +bool GraphicNativeTransform::rotateGeneric(Degree10 aRotation, const OUString& aType) { // Can't rotate animations yet if (mrGraphic.IsAnimated()) @@ -117,7 +118,7 @@ bool GraphicNativeTransform::rotateGeneric(sal_uInt16 aRotation, const OUString& return true; } -void GraphicNativeTransform::rotateJPEG(sal_uInt16 aRotation) +void GraphicNativeTransform::rotateJPEG(Degree10 aRotation) { BitmapEx aBitmap = mrGraphic.GetBitmapEx(); diff --git a/vcl/source/filter/jpeg/Exif.cxx b/vcl/source/filter/jpeg/Exif.cxx index 4f773a48bc24..b8760b63aef7 100644 --- a/vcl/source/filter/jpeg/Exif.cxx +++ b/vcl/source/filter/jpeg/Exif.cxx @@ -49,21 +49,21 @@ exif::Orientation Exif::convertToOrientation(sal_Int32 value) return exif::TOP_LEFT; } -sal_Int32 Exif::getRotation() const +Degree10 Exif::getRotation() const { switch(maOrientation) { case exif::TOP_LEFT: - return 0; + return Degree10(0); case exif::BOTTOM_RIGHT: - return 1800; + return Degree10(1800); case exif::RIGHT_TOP: - return 2700; + return Degree10(2700); case exif::LEFT_BOTTOM: - return 900; + return Degree10(900); default: break; } - return 0; + return Degree10(0); } bool Exif::read(SvStream& rStream) diff --git a/vcl/source/filter/jpeg/Exif.hxx b/vcl/source/filter/jpeg/Exif.hxx index 6052a44842da..c39de1b08fdf 100644 --- a/vcl/source/filter/jpeg/Exif.hxx +++ b/vcl/source/filter/jpeg/Exif.hxx @@ -20,6 +20,7 @@ #pragma once #include <tools/stream.hxx> +#include <tools/degree.hxx> namespace exif { @@ -71,7 +72,7 @@ public: bool hasExif() const { return mbExifPresent;} exif::Orientation getOrientation() const { return maOrientation;} - sal_Int32 getRotation() const; + Degree10 getRotation() const; void setOrientation(exif::Orientation orientation); diff --git a/vcl/source/filter/jpeg/JpegTransform.cxx b/vcl/source/filter/jpeg/JpegTransform.cxx index f3b1e7723bdf..b1016c022272 100644 --- a/vcl/source/filter/jpeg/JpegTransform.cxx +++ b/vcl/source/filter/jpeg/JpegTransform.cxx @@ -37,7 +37,7 @@ void JpegTransform::perform() Transform( &mrInputStream, &mrOutputStream, maRotate ); } -void JpegTransform::setRotate(sal_uInt16 aRotate) +void JpegTransform::setRotate(Degree10 aRotate) { maRotate = aRotate; } diff --git a/vcl/source/filter/jpeg/JpegTransform.hxx b/vcl/source/filter/jpeg/JpegTransform.hxx index cb6d3acbcec1..ed5d550276fa 100644 --- a/vcl/source/filter/jpeg/JpegTransform.hxx +++ b/vcl/source/filter/jpeg/JpegTransform.hxx @@ -24,7 +24,7 @@ class JpegTransform final { - sal_uInt16 maRotate; + Degree10 maRotate; SvStream& mrInputStream; SvStream& mrOutputStream; @@ -33,7 +33,7 @@ public: JpegTransform(SvStream& rInputStream, SvStream& rOutputStream); ~JpegTransform(); - void setRotate(sal_uInt16 aRotate); + void setRotate(Degree10 aRotate); void perform(); }; diff --git a/vcl/source/filter/jpeg/jpeg.h b/vcl/source/filter/jpeg/jpeg.h index 908eee030d88..8a8e757a9719 100644 --- a/vcl/source/filter/jpeg/jpeg.h +++ b/vcl/source/filter/jpeg/jpeg.h @@ -50,7 +50,7 @@ void ReadJPEG( JPEGReader* pJPEGReader, void* pInputStream, tools::Long* pLin GraphicFilterImportFlags nImportFlags, BitmapScopedWriteAccess* ppAccess ); -void Transform(void* pInputStream, void* pOutputStream, tools::Long nAngle); +void Transform(void* pInputStream, void* pOutputStream, Degree10 nAngle); /* Expanded data source object for stdio input */ diff --git a/vcl/source/filter/jpeg/jpegc.cxx b/vcl/source/filter/jpeg/jpegc.cxx index 804278ec8300..4718ec94560c 100644 --- a/vcl/source/filter/jpeg/jpegc.cxx +++ b/vcl/source/filter/jpeg/jpegc.cxx @@ -425,7 +425,7 @@ bool WriteJPEG( JPEGWriter* pJPEGWriter, void* pOutputStream, return true; } -void Transform(void* pInputStream, void* pOutputStream, tools::Long nAngle) +void Transform(void* pInputStream, void* pOutputStream, Degree10 nAngle) { jpeg_transform_info aTransformOption; JCOPY_OPTION aCopyOption = JCOPYOPT_ALL; @@ -445,7 +445,7 @@ void Transform(void* pInputStream, void* pOutputStream, tools::Long nAngle) // Angle to transform option // 90 Clockwise = 270 Counterclockwise - switch (nAngle) + switch (nAngle.get()) { case 2700: aTransformOption.transform = JXFORM_ROT_90; diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx index 754f1d46386c..63026cd2e7dc 100644 --- a/vcl/source/filter/wmf/emfwr.cxx +++ b/vcl/source/filter/wmf/emfwr.cxx @@ -463,7 +463,7 @@ void EMFWriter::ImplCheckTextAttr() m_rStm.WriteUInt32( mnTextHandle ); ImplWriteExtent( -rFont.GetFontSize().Height() ); ImplWriteExtent( rFont.GetFontSize().Width() ); - m_rStm.WriteInt32( rFont.GetOrientation() ).WriteInt32( rFont.GetOrientation() ); + m_rStm.WriteInt32( rFont.GetOrientation().get() ).WriteInt32( rFont.GetOrientation().get() ); switch( rFont.GetWeight() ) { diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx index 0ecbbc9be36e..43463c10e62e 100644 --- a/vcl/source/filter/wmf/wmfwr.cxx +++ b/vcl/source/filter/wmf/wmfwr.cxx @@ -312,7 +312,7 @@ void WMFWriter::WMFRecord_CreateFontIndirect(const vcl::Font & rFont) WriteRecordHeader(0x00000000,W_META_CREATEFONTINDIRECT); WriteHeightWidth(Size(rFont.GetFontSize().Width(),-rFont.GetFontSize().Height())); - pWMF->WriteInt16( rFont.GetOrientation() ).WriteInt16( rFont.GetOrientation() ); + pWMF->WriteInt16( rFont.GetOrientation().get() ).WriteInt16( rFont.GetOrientation().get() ); switch (rFont.GetWeight()) { case WEIGHT_THIN: nWeight=W_FW_THIN; break; diff --git a/vcl/source/font/PhysicalFontFace.cxx b/vcl/source/font/PhysicalFontFace.cxx index b16488ddc88d..9610c1268057 100644 --- a/vcl/source/font/PhysicalFontFace.cxx +++ b/vcl/source/font/PhysicalFontFace.cxx @@ -161,7 +161,7 @@ bool PhysicalFontFace::IsBetterMatch( const FontSelectPattern& rFSD, FontMatchSt int nHeightMatch = 0; int nWidthMatch = 0; - if( rFSD.mnOrientation != 0 ) + if( rFSD.mnOrientation != Degree10(0) ) nMatch += 80; else if( rFSD.mnWidth != 0 ) nMatch += 25; diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx index f9ca44f061f9..2818e71e00ea 100644 --- a/vcl/source/font/font.cxx +++ b/vcl/source/font/font.cxx @@ -189,7 +189,7 @@ void Font::SetPitch( FontPitch ePitch ) mpImplFont->SetPitch( ePitch ); } -void Font::SetOrientation( short nOrientation ) +void Font::SetOrientation( Degree10 nOrientation ) { if (const_cast<const ImplType&>(mpImplFont)->mnOrientation != nOrientation) mpImplFont->mnOrientation = nOrientation; @@ -361,6 +361,7 @@ SvStream& ReadImplFont( SvStream& rIStm, ImplFont& rImplFont ) { VersionCompat aCompat( rIStm, StreamMode::READ ); sal_uInt16 nTmp16(0); + sal_Int16 nTmps16(0); bool bTmp(false); sal_uInt8 nTmp8(0); @@ -379,7 +380,7 @@ SvStream& ReadImplFont( SvStream& rIStm, ImplFont& rImplFont ) rIStm.ReadUInt16( nTmp16 ); rImplFont.maLanguageTag.reset( LanguageType(nTmp16) ); rIStm.ReadUInt16( nTmp16 ); rImplFont.meWidthType = static_cast<FontWidth>(nTmp16); - rIStm.ReadInt16( rImplFont.mnOrientation ); + rIStm.ReadInt16( nTmps16 ); rImplFont.mnOrientation = Degree10(nTmps16); rIStm.ReadCharAsBool( bTmp ); rImplFont.mbWordLine = bTmp; rIStm.ReadCharAsBool( bTmp ); rImplFont.mbOutline = bTmp; @@ -423,7 +424,7 @@ SvStream& WriteImplFont( SvStream& rOStm, const ImplFont& rImplFont ) rOStm.WriteUInt16( static_cast<sal_uInt16>(rImplFont.maLanguageTag.getLanguageType( false)) ); rOStm.WriteUInt16( rImplFont.GetWidthTypeNoAsk() ); - rOStm.WriteInt16( rImplFont.mnOrientation ); + rOStm.WriteInt16( rImplFont.mnOrientation.get() ); rOStm.WriteBool( rImplFont.mbWordLine ); rOStm.WriteBool( rImplFont.mbOutline ); @@ -683,7 +684,7 @@ const LanguageTag& Font::GetCJKContextLanguageTag() const { return mpImplFont->m LanguageType Font::GetLanguage() const { return mpImplFont->maLanguageTag.getLanguageType( false); } LanguageType Font::GetCJKContextLanguage() const { return mpImplFont->maCJKLanguageTag.getLanguageType( false); } -short Font::GetOrientation() const { return mpImplFont->mnOrientation; } +Degree10 Font::GetOrientation() const { return mpImplFont->mnOrientation; } bool Font::IsVertical() const { return mpImplFont->mbVertical; } FontKerning Font::GetKerning() const { return mpImplFont->meKerning; } diff --git a/vcl/source/font/fontselect.cxx b/vcl/source/font/fontselect.cxx index faafdb61b398..09fb90e8b15f 100644 --- a/vcl/source/font/fontselect.cxx +++ b/vcl/source/font/fontselect.cxx @@ -46,12 +46,12 @@ FontSelectPattern::FontSelectPattern( const vcl::Font& rFont, rFont.GetFontAttributes( *this ); // normalize orientation between 0 and 3600 - if( 3600 <= static_cast<unsigned>(mnOrientation) ) + if( mnOrientation < Degree10(0) || mnOrientation >= Degree10(3600) ) { - if( mnOrientation >= 0 ) - mnOrientation %= 3600; + if( mnOrientation >= Degree10(0) ) + mnOrientation %= Degree10(3600); else - mnOrientation = 3600 - (-mnOrientation % 3600); + mnOrientation = Degree10(3600) - (-mnOrientation % Degree10(3600)); } // normalize width and height @@ -99,7 +99,7 @@ size_t FontSelectPattern::hashCode() const nHash += 11U * mnHeight; nHash += 19 * GetWeight(); nHash += 29 * GetItalic(); - nHash += 37 * mnOrientation; + nHash += 37 * mnOrientation.get(); nHash += 41 * static_cast<sal_uInt16>(meLanguage); if( mbVertical ) nHash += 53; diff --git a/vcl/source/gdi/TypeSerializer.cxx b/vcl/source/gdi/TypeSerializer.cxx index ad5f3e3a6dc2..0b1b53372030 100644 --- a/vcl/source/gdi/TypeSerializer.cxx +++ b/vcl/source/gdi/TypeSerializer.cxx @@ -58,7 +58,7 @@ void TypeSerializer::readGradient(Gradient& rGradient) rGradient.SetStyle(static_cast<GradientStyle>(nStyle)); rGradient.SetStartColor(aStartColor); rGradient.SetEndColor(aEndColor); - rGradient.SetAngle(nAngle); + rGradient.SetAngle(Degree10(nAngle)); rGradient.SetBorder(nBorder); rGradient.SetOfsX(nOffsetX); rGradient.SetOfsY(nOffsetY); @@ -74,7 +74,7 @@ void TypeSerializer::writeGradient(const Gradient& rGradient) mrStream.WriteUInt16(static_cast<sal_uInt16>(rGradient.GetStyle())); writeColor(rGradient.GetStartColor()); writeColor(rGradient.GetEndColor()); - mrStream.WriteUInt16(rGradient.GetAngle()); + mrStream.WriteUInt16(rGradient.GetAngle().get()); mrStream.WriteUInt16(rGradient.GetBorder()); mrStream.WriteUInt16(rGradient.GetOfsX()); mrStream.WriteUInt16(rGradient.GetOfsY()); diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index 9e411aa02029..14733bf4b64a 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -383,7 +383,7 @@ bool BitmapEx::Scale( const Size& rNewSize, BmpScaleFlag nScaleFlag ) return bRet; } -bool BitmapEx::Rotate( tools::Long nAngle10, const Color& rFillColor ) +bool BitmapEx::Rotate( Degree10 nAngle10, const Color& rFillColor ) { bool bRet = false; diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 18a45ea92dad..40c1d7aba529 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -819,17 +819,17 @@ void GDIMetaFile::ImplAddGradientEx( GDIMetaFile& rMtf, } } -void GDIMetaFile::Rotate( tools::Long nAngle10 ) +void GDIMetaFile::Rotate( Degree10 nAngle10 ) { - nAngle10 %= 3600; - nAngle10 = ( nAngle10 < 0 ) ? ( 3599 + nAngle10 ) : nAngle10; + nAngle10 %= Degree10(3600); + nAngle10 = ( nAngle10 < Degree10(0) ) ? ( Degree10(3599) + nAngle10 ) : nAngle10; if( !nAngle10 ) return; GDIMetaFile aMtf; ScopedVclPtrInstance< VirtualDevice > aMapVDev; - const double fAngle = F_PI1800 * nAngle10; + const double fAngle = F_PI1800 * nAngle10.get(); const double fSin = sin( fAngle ); const double fCos = cos( fAngle ); tools::Rectangle aRect( Point(), GetPrefSize() ); @@ -1148,7 +1148,7 @@ void GDIMetaFile::Rotate( tools::Long nAngle10 ) MetaHatchAction* pAct = static_cast<MetaHatchAction*>(pAction); Hatch aHatch( pAct->GetHatch() ); - aHatch.SetAngle( aHatch.GetAngle() + static_cast<sal_uInt16>(nAngle10) ); + aHatch.SetAngle( aHatch.GetAngle() + nAngle10 ); aMtf.AddAction( new MetaHatchAction( ImplGetRotatedPolyPolygon( pAct->GetPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ), aHatch ) ); } @@ -1236,7 +1236,7 @@ void GDIMetaFile::Rotate( tools::Long nAngle10 ) MetaFontAction* pAct = static_cast<MetaFontAction*>(pAction); vcl::Font aFont( pAct->GetFont() ); - aFont.SetOrientation( aFont.GetOrientation() + static_cast<sal_uInt16>(nAngle10) ); + aFont.SetOrientation( aFont.GetOrientation() + nAngle10 ); aMtf.AddAction( new MetaFontAction( aFont ) ); } break; diff --git a/vcl/source/gdi/gradient.cxx b/vcl/source/gdi/gradient.cxx index ac826f985cdd..b5c331e6953c 100644 --- a/vcl/source/gdi/gradient.cxx +++ b/vcl/source/gdi/gradient.cxx @@ -26,7 +26,7 @@ public: GradientStyle meStyle; Color maStartColor; Color maEndColor; - sal_uInt16 mnAngle; + Degree10 mnAngle; sal_uInt16 mnBorder; sal_uInt16 mnOfsX; sal_uInt16 mnOfsY; @@ -125,12 +125,12 @@ void Gradient::SetEndColor( const Color& rColor ) mpImplGradient->maEndColor = rColor; } -sal_uInt16 Gradient::GetAngle() const +Degree10 Gradient::GetAngle() const { return mpImplGradient->mnAngle; } -void Gradient::SetAngle( sal_uInt16 nAngle ) +void Gradient::SetAngle( Degree10 nAngle ) { mpImplGradient->mnAngle = nAngle; } @@ -198,11 +198,11 @@ void Gradient::SetSteps( sal_uInt16 nSteps ) void Gradient::GetBoundRect( const tools::Rectangle& rRect, tools::Rectangle& rBoundRect, Point& rCenter ) const { tools::Rectangle aRect( rRect ); - sal_uInt16 nAngle = GetAngle() % 3600; + Degree10 nAngle = GetAngle() % Degree10(3600); if( GetStyle() == GradientStyle::Linear || GetStyle() == GradientStyle::Axial ) { - const double fAngle = nAngle * F_PI1800; + const double fAngle = nAngle.get() * F_PI1800; const double fWidth = aRect.GetWidth(); const double fHeight = aRect.GetHeight(); double fDX = fWidth * fabs( cos( fAngle ) ) + @@ -223,7 +223,7 @@ void Gradient::GetBoundRect( const tools::Rectangle& rRect, tools::Rectangle& rB { if( GetStyle() == GradientStyle::Square || GetStyle() == GradientStyle::Rect ) { - const double fAngle = nAngle * F_PI1800; + const double fAngle = nAngle.get() * F_PI1800; const double fWidth = aRect.GetWidth(); const double fHeight = aRect.GetHeight(); double fDX = fWidth * fabs( cos( fAngle ) ) + fHeight * fabs( sin( fAngle ) ); diff --git a/vcl/source/gdi/hatch.cxx b/vcl/source/gdi/hatch.cxx index 5d139b0a079e..353b8cbd01dd 100644 --- a/vcl/source/gdi/hatch.cxx +++ b/vcl/source/gdi/hatch.cxx @@ -43,7 +43,7 @@ Hatch::Hatch() = default; Hatch::Hatch( const Hatch& ) = default; Hatch::Hatch( HatchStyle eStyle, const Color& rColor, - tools::Long nDistance, sal_uInt16 nAngle10 ) : mpImplHatch() + tools::Long nDistance, Degree10 nAngle10 ) : mpImplHatch() { mpImplHatch->maColor = rColor; mpImplHatch->meStyle = eStyle; @@ -71,7 +71,7 @@ void Hatch::SetDistance( tools::Long nDistance ) mpImplHatch->mnDistance = nDistance; } -void Hatch::SetAngle( sal_uInt16 nAngle10 ) +void Hatch::SetAngle( Degree10 nAngle10 ) { mpImplHatch->mnAngle = nAngle10; } @@ -88,8 +88,9 @@ SvStream& ReadHatch( SvStream& rIStm, Hatch& rHatch ) tools::GenericTypeSerializer aSerializer(rIStm); aSerializer.readColor(rHatch.mpImplHatch->maColor); rIStm.ReadInt32(nTmp32); - rIStm.ReadUInt16(rHatch.mpImplHatch->mnAngle); rHatch.mpImplHatch->mnDistance = nTmp32; + rIStm.ReadUInt16(nTmp16); + rHatch.mpImplHatch->mnAngle = Degree10(nTmp16); return rIStm; } @@ -102,7 +103,7 @@ SvStream& WriteHatch( SvStream& rOStm, const Hatch& rHatch ) tools::GenericTypeSerializer aSerializer(rOStm); aSerializer.writeColor(rHatch.mpImplHatch->maColor); - rOStm.WriteInt32( rHatch.mpImplHatch->mnDistance ).WriteUInt16( rHatch.mpImplHatch->mnAngle ); + rOStm.WriteInt32( rHatch.mpImplHatch->mnDistance ).WriteUInt16( rHatch.mpImplHatch->mnAngle.get() ); return rOStm; } diff --git a/vcl/source/gdi/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx index 229cecda695a..5e80e3f229f5 100644 --- a/vcl/source/gdi/mtfxmldump.cxx +++ b/vcl/source/gdi/mtfxmldump.cxx @@ -485,7 +485,7 @@ void writeGradient(tools::XmlWriter& rWriter, Gradient const& rGradient) rWriter.attribute("style", convertGradientStyle(rGradient.GetStyle())); rWriter.attribute("startcolor", convertColorToString(rGradient.GetStartColor())); rWriter.attribute("endcolor", convertColorToString(rGradient.GetEndColor())); - rWriter.attribute("angle", rGradient.GetAngle()); + rWriter.attribute("angle", rGradient.GetAngle().get()); rWriter.attribute("border", rGradient.GetBorder()); rWriter.attribute("offsetx", rGradient.GetOfsX()); rWriter.attribute("offsety", rGradient.GetOfsY()); @@ -963,7 +963,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& r rWriter.attribute("style", convertHatchStyle(rHatch.GetStyle())); rWriter.attribute("color", convertColorToString(rHatch.GetColor())); rWriter.attribute("distance", sal_Int32(rHatch.GetDistance())); - rWriter.attribute("angle", sal_Int32(rHatch.GetAngle())); + rWriter.attribute("angle", sal_Int32(rHatch.GetAngle().get())); rWriter.endElement(); rWriter.endElement(); @@ -1144,7 +1144,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& r rWriter.attribute("stylename", aFont.GetStyleName()); rWriter.attribute("width", aFont.GetFontSize().Width()); rWriter.attribute("height", aFont.GetFontSize().Height()); - rWriter.attribute("orientation", aFont.GetOrientation()); + rWriter.attribute("orientation", aFont.GetOrientation().get()); rWriter.attribute("weight", convertFontWeightToString(aFont.GetWeight())); rWriter.attribute("vertical", aFont.IsVertical() ? "true" : "false"); diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index a3390cca44f7..592638222b2c 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -6060,12 +6060,12 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool fXScale *= double(m_aCurrentPDFState.m_aMapMode.GetScaleX()) / double(m_aCurrentPDFState.m_aMapMode.GetScaleY()); } - int nAngle = m_aCurrentPDFState.m_aFont.GetOrientation(); + Degree10 nAngle = m_aCurrentPDFState.m_aFont.GetOrientation(); // normalize angles - while( nAngle < 0 ) - nAngle += 3600; - nAngle = nAngle % 3600; - double fAngle = static_cast<double>(nAngle) * M_PI / 1800.0; + while( nAngle < Degree10(0) ) + nAngle += Degree10(3600); + nAngle = nAngle % Degree10(3600); + double fAngle = static_cast<double>(nAngle.get()) * M_PI / 1800.0; Matrix3 aRotScale; aRotScale.scale( fXScale, 1.0 ); @@ -7155,7 +7155,7 @@ void PDFWriterImpl::drawTextLine( const Point& rPos, tools::Long nWidth, FontStr aLine.append( "q " ); // rotate and translate matrix - double fAngle = static_cast<double>(m_aCurrentPDFState.m_aFont.GetOrientation()) * M_PI / 1800.0; + double fAngle = static_cast<double>(m_aCurrentPDFState.m_aFont.GetOrientation().get()) * M_PI / 1800.0; Matrix3 aMat; aMat.rotate( fAngle ); aMat.translate( aPos.X(), aPos.Y() ); @@ -8300,7 +8300,7 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit const & rObject ) tools::Rectangle aBoundRect; Point aCenter; - sal_uInt16 nAngle = rObject.m_aGradient.GetAngle() % 3600; + Degree10 nAngle = rObject.m_aGradient.GetAngle() % Degree10(3600); rObject.m_aGradient.GetBoundRect( aRect, aBoundRect, aCenter ); const bool bLinear = (rObject.m_aGradient.GetStyle() == GradientStyle::Linear); @@ -8326,7 +8326,7 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit const & rObject ) tools::Polygon aPoly( 2 ); aPoly[0] = aBoundRect.BottomCenter(); aPoly[1] = aBoundRect.TopCenter(); - aPoly.Rotate( aCenter, 3600 - nAngle ); + aPoly.Rotate( aCenter, Degree10(3600) - nAngle ); aLine.append( static_cast<sal_Int32>(aPoly[0].X()) ); aLine.append( " " ); diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 95cf5d891521..16fa84ab95d5 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -562,17 +562,17 @@ Point SalLayout::GetDrawPosition( const Point& rRelative ) const Point aPos = maDrawBase; Point aOfs = rRelative + maDrawOffset; - if( mnOrientation == 0 ) + if( mnOrientation == Degree10(0) ) aPos += aOfs; else { // cache trigonometric results - static int nOldOrientation = 0; + static Degree10 nOldOrientation(0); static double fCos = 1.0, fSin = 0.0; if( nOldOrientation != mnOrientation ) { nOldOrientation = mnOrientation; - double fRad = mnOrientation * (M_PI / 1800.0); + double fRad = mnOrientation.get() * (M_PI / 1800.0); fCos = cos( fRad ); fSin = sin( fRad ); } diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx index d0b1ac953d80..2af54eabf368 100644 --- a/vcl/source/gdi/svmconverter.cxx +++ b/vcl/source/gdi/svmconverter.cxx @@ -657,7 +657,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) aFont.SetItalic( bItalic ? ITALIC_NORMAL : ITALIC_NONE ); aFont.SetOutline( bOutline ); aFont.SetShadow( bShadow ); - aFont.SetOrientation( nLineOrient ); + aFont.SetOrientation( Degree10(nLineOrient) ); aFont.SetTransparent( bTransparent ); eActualCharSet = aFont.GetCharSet(); @@ -1055,7 +1055,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) Gradient aGrad( static_cast<GradientStyle>(nStyle), aStartCol, aEndCol ); - aGrad.SetAngle( nAngle ); + aGrad.SetAngle( Degree10(nAngle) ); aGrad.SetBorder( nBorder ); aGrad.SetOfsX( nOfsX ); aGrad.SetOfsY( nOfsY ); diff --git a/vcl/source/gdi/wall.cxx b/vcl/source/gdi/wall.cxx index 5170134cc24c..2300a8f8ad23 100644 --- a/vcl/source/gdi/wall.cxx +++ b/vcl/source/gdi/wall.cxx @@ -288,7 +288,7 @@ bool Wallpaper::IsGradient() const Gradient Wallpaper::ImplGetApplicationGradient() { Gradient g; - g.SetAngle( 900 ); + g.SetAngle( Degree10(900) ); g.SetStyle( GradientStyle::Linear ); g.SetStartColor( Application::GetSettings().GetStyleSettings().GetFaceColor() ); // no 'extreme' gradient when high contrast diff --git a/vcl/source/graphic/GraphicObject.cxx b/vcl/source/graphic/GraphicObject.cxx index 415e42e3313a..aa8b5a3169b7 100644 --- a/vcl/source/graphic/GraphicObject.cxx +++ b/vcl/source/graphic/GraphicObject.cxx @@ -110,7 +110,7 @@ bool lclDrawObj( OutputDevice* pOut, const Point& rPt, const Size& rSz, if( aGraphic.IsSupportedGraphic() ) { - const sal_uInt16 nRot10 = rAttr.GetRotation() % 3600; + const Degree10 nRot10 = rAttr.GetRotation() % Degree10(3600); if( nRot10 ) { @@ -353,7 +353,7 @@ bool GraphicObject::ImplGetCropParams( OutputDevice const * pOut, Point& rPt, Si if( GetType() != GraphicType::NONE ) { tools::Polygon aClipPoly( tools::Rectangle( rPt, rSz ) ); - const sal_uInt16 nRot10 = pAttr->GetRotation() % 3600; + const Degree10 nRot10 = pAttr->GetRotation() % Degree10(3600); const Point aOldOrigin( rPt ); const MapMode aMap100( MapUnit::Map100thMM ); Size aSize100; diff --git a/vcl/source/graphic/GraphicObject2.cxx b/vcl/source/graphic/GraphicObject2.cxx index d858b47b8f34..4153ff47a6ea 100644 --- a/vcl/source/graphic/GraphicObject2.cxx +++ b/vcl/source/graphic/GraphicObject2.cxx @@ -484,7 +484,7 @@ void GraphicObject::ImplTransformBitmap( BitmapEx& rBmpEx, const Size aSizePixel( rBmpEx.GetSizePixel() ); - if( rAttr.GetRotation() == 0 || IsAnimated() ) + if( rAttr.GetRotation() == Degree10(0) || IsAnimated() ) return; if( !(aSizePixel.Width() && aSizePixel.Height() && rDstSize.Width() && rDstSize.Height()) ) diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx index 10c7f0d164d2..6ba48c1699d5 100644 --- a/vcl/source/outdev/bitmap.cxx +++ b/vcl/source/outdev/bitmap.cxx @@ -1434,7 +1434,7 @@ void OutputDevice::DrawTransformedBitmapEx( { fFullRotate += F_2PI; } - tools::Long nAngle10 = basegfx::fround(basegfx::rad2deg(fFullRotate) * 10); + Degree10 nAngle10(basegfx::fround(basegfx::rad2deg(fFullRotate) * 10)); aTransformed.Rotate(nAngle10, COL_TRANSPARENT); } basegfx::B2DRange aTargetRange(0.0, 0.0, 1.0, 1.0); diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 9d4883ccea8d..a5301e3a594a 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -1033,7 +1033,7 @@ bool OutputDevice::ImplNewFont() const // get metric data from device layers pFontInstance->mbInit = true; - pFontInstance->mxFontMetric->SetOrientation( sal::static_int_cast<short>(mpFontInstance->GetFontSelectPattern().mnOrientation) ); + pFontInstance->mxFontMetric->SetOrientation( mpFontInstance->GetFontSelectPattern().mnOrientation ); mpGraphics->GetFontMetric( pFontInstance->mxFontMetric, 0 ); pFontInstance->mxFontMetric->ImplInitTextLineSize( this ); @@ -1123,7 +1123,7 @@ void OutputDevice::SetFontOrientation( LogicalFontInstance* const pFontInstance { if( pFontInstance->GetFontSelectPattern().mnOrientation && !pFontInstance->mxFontMetric->GetOrientation() ) { - pFontInstance->mnOwnOrientation = sal::static_int_cast<short>(pFontInstance->GetFontSelectPattern().mnOrientation); + pFontInstance->mnOwnOrientation = pFontInstance->GetFontSelectPattern().mnOrientation; pFontInstance->mnOrientation = pFontInstance->mnOwnOrientation; } else diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx index 0acd89dfdb18..d67430da187d 100644 --- a/vcl/source/outdev/gradient.cxx +++ b/vcl/source/outdev/gradient.cxx @@ -264,7 +264,7 @@ void OutputDevice::DrawLinearGradient( const tools::Rectangle& rRect, // get BoundRect of rotated rectangle tools::Rectangle aRect; Point aCenter; - sal_uInt16 nAngle = rGradient.GetAngle() % 3600; + Degree10 nAngle = rGradient.GetAngle() % Degree10(3600); rGradient.GetBoundRect( rRect, aRect, aCenter ); @@ -469,7 +469,7 @@ void OutputDevice::DrawComplexGradient( const tools::Rectangle& rRect, tools::Long nRedSteps = nEndRed - nStartRed; tools::Long nGreenSteps = nEndGreen - nStartGreen; tools::Long nBlueSteps = nEndBlue - nStartBlue; - sal_uInt16 nAngle = rGradient.GetAngle() % 3600; + Degree10 nAngle = rGradient.GetAngle() % Degree10(3600); rGradient.GetBoundRect( rRect, aRect, aCenter ); @@ -622,7 +622,7 @@ void OutputDevice::DrawLinearGradientToMetafile( const tools::Rectangle& rRect, // get BoundRect of rotated rectangle tools::Rectangle aRect; Point aCenter; - sal_uInt16 nAngle = rGradient.GetAngle() % 3600; + Degree10 nAngle = rGradient.GetAngle() % Degree10(3600); rGradient.GetBoundRect( rRect, aRect, aCenter ); @@ -819,7 +819,7 @@ void OutputDevice::DrawComplexGradientToMetafile( const tools::Rectangle& rRect, tools::Long nRedSteps = nEndRed - nStartRed; tools::Long nGreenSteps = nEndGreen - nStartGreen; tools::Long nBlueSteps = nEndBlue - nStartBlue; - sal_uInt16 nAngle = rGradient.GetAngle() % 3600; + Degree10 nAngle = rGradient.GetAngle() % Degree10(3600); rGradient.GetBoundRect( rRect, aRect, aCenter ); diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx index 4ee38bff1aa2..bb2cb67cb1ac 100644 --- a/vcl/source/outdev/hatch.cxx +++ b/vcl/source/outdev/hatch.cxx @@ -186,7 +186,7 @@ void OutputDevice::DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& if( ( rHatch.GetStyle() == HatchStyle::Double ) || ( rHatch.GetStyle() == HatchStyle::Triple ) ) { // Double hatch - CalcHatchValues( aRect, nWidth, rHatch.GetAngle() + 900, aPt1, aPt2, aInc, aEndPt1 ); + CalcHatchValues( aRect, nWidth, rHatch.GetAngle() + Degree10(900), aPt1, aPt2, aInc, aEndPt1 ); do { DrawHatchLine( tools::Line( aPt1, aPt2 ), rPolyPoly, pPtBuffer.get(), bMtf ); @@ -198,7 +198,7 @@ void OutputDevice::DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& if( rHatch.GetStyle() == HatchStyle::Triple ) { // Triple hatch - CalcHatchValues( aRect, nWidth, rHatch.GetAngle() + 450, aPt1, aPt2, aInc, aEndPt1 ); + CalcHatchValues( aRect, nWidth, rHatch.GetAngle() + Degree10(450), aPt1, aPt2, aInc, aEndPt1 ); do { DrawHatchLine( tools::Line( aPt1, aPt2 ), rPolyPoly, pPtBuffer.get(), bMtf ); @@ -211,19 +211,19 @@ void OutputDevice::DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& } } -void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long nDist, sal_uInt16 nAngle10, +void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long nDist, Degree10 nAngle10, Point& rPt1, Point& rPt2, Size& rInc, Point& rEndPt1 ) { Point aRef; - tools::Long nAngle = nAngle10 % 1800; + Degree10 nAngle = nAngle10 % Degree10(1800); tools::Long nOffset = 0; - if( nAngle > 900 ) - nAngle -= 1800; + if( nAngle > Degree10(900) ) + nAngle -= Degree10(1800); aRef = ( !IsRefPoint() ? rRect.TopLeft() : GetRefPoint() ); - if( 0 == nAngle ) + if( Degree10(0) == nAngle ) { rInc = Size( 0, nDist ); rPt1 = rRect.TopLeft(); @@ -238,7 +238,7 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long n rPt1.AdjustY( -nOffset ); rPt2.AdjustY( -nOffset ); } - else if( 900 == nAngle ) + else if( Degree10(900) == nAngle ) { rInc = Size( nDist, 0 ); rPt1 = rRect.TopLeft(); @@ -253,9 +253,9 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long n rPt1.AdjustX( -nOffset ); rPt2.AdjustX( -nOffset ); } - else if( nAngle >= -450 && nAngle <= 450 ) + else if( nAngle >= Degree10(-450) && nAngle <= Degree10(450) ) { - const double fAngle = F_PI1800 * labs( nAngle ); + const double fAngle = F_PI1800 * labs( nAngle.get() ); const double fTan = tan( fAngle ); const tools::Long nYOff = FRound( ( rRect.Right() - rRect.Left() ) * fTan ); tools::Long nPY; @@ -263,7 +263,7 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long n nDist = FRound( nDist / cos( fAngle ) ); rInc = Size( 0, nDist ); - if( nAngle > 0 ) + if( nAngle > Degree10(0) ) { rPt1 = rRect.TopLeft(); rPt2 = Point( rRect.Right(), rRect.Top() - nYOff ); @@ -288,7 +288,7 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long n } else { - const double fAngle = F_PI1800 * labs( nAngle ); + const double fAngle = F_PI1800 * labs( nAngle.get() ); const double fTan = tan( fAngle ); const tools::Long nXOff = FRound( ( rRect.Bottom() - rRect.Top() ) / fTan ); tools::Long nPX; @@ -296,7 +296,7 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long n nDist = FRound( nDist / sin( fAngle ) ); rInc = Size( nDist, 0 ); - if( nAngle > 0 ) + if( nAngle > Degree10(0) ) { rPt1 = rRect.TopLeft(); rPt2 = Point( rRect.Left() - nXOff, rRect.Bottom() ); diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 5c4b355c2536..8573affbae99 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -89,13 +89,13 @@ void OutputDevice::ImplDrawTextRect( tools::Long nBaseX, tools::Long nBaseY, tools::Long nX = nDistX; tools::Long nY = nDistY; - short nOrientation = mpFontInstance->mnOrientation; + Degree10 nOrientation = mpFontInstance->mnOrientation; if ( nOrientation ) { // Rotate rect without rounding problems for 90 degree rotations - if ( !(nOrientation % 900) ) + if ( !(nOrientation % Degree10(900)) ) { - if ( nOrientation == 900 ) + if ( nOrientation == Degree10(900) ) { tools::Long nTemp = nX; nX = nY; @@ -105,7 +105,7 @@ void OutputDevice::ImplDrawTextRect( tools::Long nBaseX, tools::Long nBaseY, nHeight = nTemp; nY -= nHeight; } - else if ( nOrientation == 1800 ) + else if ( nOrientation == Degree10(1800) ) { nX = -nX; nY = -nY; @@ -176,7 +176,7 @@ tools::Rectangle OutputDevice::ImplGetTextBoundRect( const SalLayout& rSalLayout if ( mpFontInstance->mnOrientation ) { tools::Long nBaseX = nX, nBaseY = nY; - if ( !(mpFontInstance->mnOrientation % 900) ) + if ( !(mpFontInstance->mnOrientation % Degree10(900)) ) { tools::Long nX2 = nX+nWidth; tools::Long nY2 = nY+nHeight; @@ -228,7 +228,7 @@ bool OutputDevice::ImplDrawRotateText( SalLayout& rSalLayout ) const FontSelectPattern& rPattern = mpFontInstance->GetFontSelectPattern(); vcl::Font aFont( GetFont() ); - aFont.SetOrientation( 0 ); + aFont.SetOrientation( Degree10(0) ); aFont.SetFontSize( Size( rPattern.mnWidth, rPattern.mnHeight ) ); pVDev->SetFont( aFont ); pVDev->SetTextColor( COL_BLACK ); @@ -1241,7 +1241,7 @@ ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( OUString& rStr, // set layout options ImplLayoutArgs aLayoutArgs(rStr, nMinIndex, nEndIndex, nLayoutFlags, maFont.GetLanguageTag(), pLayoutCache); - int nOrientation = mpFontInstance ? mpFontInstance->mnOrientation : 0; + Degree10 nOrientation = mpFontInstance ? mpFontInstance->mnOrientation : Degree10(0); aLayoutArgs.SetOrientation( nOrientation ); aLayoutArgs.SetLayoutWidth( nPixelWidth ); diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx index eb716ebdb49f..09ee52f6339a 100644 --- a/vcl/source/outdev/textline.cxx +++ b/vcl/source/outdev/textline.cxx @@ -49,7 +49,7 @@ void OutputDevice::ImplInitAboveTextLineSize() void OutputDevice::ImplDrawWavePixel( tools::Long nOriginX, tools::Long nOriginY, tools::Long nCurX, tools::Long nCurY, - short nOrientation, + Degree10 nOrientation, SalGraphics* pGraphics, OutputDevice const * pOutDev, bool bDrawPixAsRect, @@ -75,7 +75,7 @@ void OutputDevice::ImplDrawWavePixel( tools::Long nOriginX, tools::Long nOriginY void OutputDevice::ImplDrawWaveLine( tools::Long nBaseX, tools::Long nBaseY, tools::Long nDistX, tools::Long nDistY, tools::Long nWidth, tools::Long nHeight, - tools::Long nLineWidth, short nOrientation, + tools::Long nLineWidth, Degree10 nOrientation, const Color& rColor ) { if ( !nHeight ) @@ -678,7 +678,7 @@ void OutputDevice::ImplDrawTextLine( tools::Long nX, tools::Long nY, { tools::Long nXAdd = nWidth - nDistX; if( mpFontInstance->mnOrientation ) - nXAdd = FRound( nXAdd * cos( mpFontInstance->mnOrientation * F_PI1800 ) ); + nXAdd = FRound( nXAdd * cos( mpFontInstance->mnOrientation.get() * F_PI1800 ) ); nX += nXAdd - 1; } @@ -750,7 +750,7 @@ void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout, FontStrikeout eStri if( mpFontInstance->mnOrientation ) { const tools::Long nDY = aPos.Y() - aStartPt.Y(); - const double fRad = mpFontInstance->mnOrientation * F_PI1800; + const double fRad = mpFontInstance->mnOrientation.get() * F_PI1800; nDist = FRound( nDist*cos(fRad) - nDY*sin(fRad) ); } } @@ -972,7 +972,7 @@ void OutputDevice::DrawWaveLine(const Point& rStartPos, const Point& rEndPos, to fOrientation = std::atan2(nStartY - nEndY, (nLengthX == 0 ? 0.000000001 : nLengthX)); fOrientation /= F_PI180; // un-rotate the end point - aStartPt.RotateAround(nEndX, nEndY, -fOrientation * 10.0); + aStartPt.RotateAround(nEndX, nEndY, Degree10(static_cast<sal_Int16>(-fOrientation * 10.0))); } tools::Long nWaveHeight = 3; diff --git a/vcl/source/window/cursor.cxx b/vcl/source/window/cursor.cxx index e80ba8d42b52..18773be22698 100644 --- a/vcl/source/window/cursor.cxx +++ b/vcl/source/window/cursor.cxx @@ -36,7 +36,7 @@ struct ImplCursorData Point maPixPos; // Pixel-Position Point maPixRotOff; // Pixel-Offset-Position Size maPixSize; // Pixel-Size - short mnOrientation; // Pixel-Orientation + Degree10 mnOrientation; // Pixel-Orientation CursorDirection mnDirection; // indicates writing direction sal_uInt16 mnStyle; // Cursor-Style bool mbCurVisible; // Is cursor currently visible @@ -332,7 +332,7 @@ vcl::Cursor::Cursor() { mpData = nullptr; mpWindow = nullptr; - mnOrientation = 0; + mnOrientation = Degree10(0); mnDirection = CursorDirection::NONE; mnStyle = 0; mbVisible = false; @@ -419,7 +419,7 @@ void vcl::Cursor::SetWidth( tools::Long nNewWidth ) } } -void vcl::Cursor::SetOrientation( short nNewOrientation ) +void vcl::Cursor::SetOrientation( Degree10 nNewOrientation ) { if ( mnOrientation != nNewOrientation ) { diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 0212f7da0e5f..88516e9f320b 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -188,7 +188,7 @@ void PrintDialog::PrintPreviewWindow::Paint(vcl::RenderContext& rRenderContext, { rRenderContext.Push(PushFlags::FONT); vcl::Font aFont(rRenderContext.GetFont()); - aFont.SetOrientation(900); + aFont.SetOrientation(Degree10(900)); rRenderContext.SetFont(aFont); auto nLeft = aOffset.X() - nTextHeight; diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 344f60d175eb..ae9afe30250f 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -314,7 +314,7 @@ void ToolBox::ImplDrawGradientBackground(vcl::RenderContext& rRenderContext) startCol = endCol; Gradient g; - g.SetAngle(mbHorz ? 0 : 900); + g.SetAngle(Degree10(mbHorz ? 0 : 900)); g.SetStyle(GradientStyle::Linear); g.SetStartColor(startCol); @@ -1147,7 +1147,7 @@ void ToolBox::ImplInitToolBoxData() meTextPosition = ToolBoxTextPosition::Right; mnLastFocusItemId = 0; mnActivateCount = 0; - mnImagesRotationAngle = 0; + mnImagesRotationAngle = Degree10(0); mpStatusListener = new VclStatusListener<ToolBox>(this, ".uno:ImageOrientation"); mpStatusListener->startListening(); @@ -2716,7 +2716,7 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, ImplToolItems::si bRotate = true; vcl::Font aRotateFont = aOldFont; - aRotateFont.SetOrientation( 2700 ); + aRotateFont.SetOrientation( Degree10(2700) ); // center horizontally nTextOffX += aTxtSize.Height(); diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 59b7bbbbb01e..56abd3cea7ae 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -94,7 +94,7 @@ void ImplToolItem::init(sal_uInt16 nItemId, ToolBoxItemBits nItemBits, mbBreak = false; mnSepSize = TB_SEP_SIZE; mnDropDownArrowWidth = TB_DROPDOWNARROWWIDTH; - mnImageAngle = 0; + mnImageAngle = Degree10(0); mbMirrorMode = false; mbVisibleText = false; mbExpand = false; @@ -959,7 +959,7 @@ void ToolBox::SetItemImage( sal_uInt16 nItemId, const Image& rImage ) } } -static Image ImplRotImage( const Image& rImage, tools::Long nAngle10 ) +static Image ImplRotImage( const Image& rImage, Degree10 nAngle10 ) { BitmapEx aRotBitmapEx( rImage.GetBitmapEx() ); @@ -968,7 +968,7 @@ static Image ImplRotImage( const Image& rImage, tools::Long nAngle10 ) return Image( aRotBitmapEx ); } -void ToolBox::SetItemImageAngle( sal_uInt16 nItemId, tools::Long nAngle10 ) +void ToolBox::SetItemImageAngle( sal_uInt16 nItemId, Degree10 nAngle10 ) { ImplToolItems::size_type nPos = GetItemPos( nItemId ); @@ -978,9 +978,9 @@ void ToolBox::SetItemImageAngle( sal_uInt16 nItemId, tools::Long nAngle10 ) ImplToolItem* pItem = &mpData->m_aItems[nPos]; Size aOldSize = pItem->maImage.GetSizePixel(); - tools::Long nDeltaAngle = (nAngle10 - pItem->mnImageAngle) % 3600; - while( nDeltaAngle < 0 ) - nDeltaAngle += 3600; + Degree10 nDeltaAngle = (nAngle10 - pItem->mnImageAngle) % Degree10(3600); + while( nDeltaAngle < Degree10(0) ) + nDeltaAngle += Degree10(3600); pItem->mnImageAngle = nAngle10; if( nDeltaAngle && !!pItem->maImage ) diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx index 32e138457dd9..d3fd5f753983 100644 --- a/vcl/unx/generic/gdi/cairotextrender.cxx +++ b/vcl/unx/generic/gdi/cairotextrender.cxx @@ -89,9 +89,9 @@ namespace return nRotation != 0; } - double toRadian(int nDegree10th) + double toRadian(Degree10 nDegree10th) { - return (3600 - nDegree10th) * M_PI / 1800.0; + return (Degree10(3600) - nDegree10th).get() * M_PI / 1800.0; } cairo_t* syncCairoContext(cairo_t* cr) @@ -234,7 +234,7 @@ void CairoTextRender::DrawTextLayout(const GenericSalLayout& rLayout, const SalG if (nGlyphRotation) { - cairo_matrix_rotate(&m, toRadian(nGlyphRotation*900)); + cairo_matrix_rotate(&m, toRadian(Degree10(nGlyphRotation * 900))); cairo_matrix_t em_square; cairo_matrix_init_identity(&em_square); diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx index cbc8f7e1b4d5..cbca9eea1bac 100644 --- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx +++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx @@ -418,9 +418,9 @@ FreetypeFont::FreetypeFont(FreetypeFontInstance& rFontInstance, const std::share const FontSelectPattern& rFSD = rFontInstance.GetFontSelectPattern(); - if( rFSD.mnOrientation != 0 ) + if( rFSD.mnOrientation ) { - const double dRad = rFSD.mnOrientation * ( F_2PI / 3600.0 ); + const double dRad = rFSD.mnOrientation.get() * ( F_2PI / 3600.0 ); mnCos = static_cast<tools::Long>( 0x10000 * cos( dRad ) + 0.5 ); mnSin = static_cast<tools::Long>( 0x10000 * sin( dRad ) + 0.5 ); } diff --git a/vcl/unx/generic/print/common_gfx.cxx b/vcl/unx/generic/print/common_gfx.cxx index f43d38a76dbd..e39e4e331c76 100644 --- a/vcl/unx/generic/print/common_gfx.cxx +++ b/vcl/unx/generic/print/common_gfx.cxx @@ -125,7 +125,7 @@ PrinterGfx::Clear() mnDepth = 24; mnPSLevel = 2; mbColor = true; - mnTextAngle = 0; + mnTextAngle = Degree10(0); maClipRegion.clear(); maGraphicsStack.clear(); @@ -794,9 +794,9 @@ PrinterGfx::PSSetFont () } void -PrinterGfx::PSRotate (sal_Int32 nAngle) +PrinterGfx::PSRotate (Degree10 nAngle) { - sal_Int32 nPostScriptAngle = -nAngle; + sal_Int32 nPostScriptAngle = -nAngle.get(); while( nPostScriptAngle < 0 ) nPostScriptAngle += 3600; @@ -1007,7 +1007,7 @@ PrinterGfx::PSShowGlyph (const unsigned char nGlyphId) PSSetColor (); PSSetFont (); // rotate the user coordinate system - if (mnTextAngle != 0) + if (mnTextAngle) { PSGSave (); PSRotate (mnTextAngle); @@ -1036,7 +1036,7 @@ PrinterGfx::PSShowGlyph (const unsigned char nGlyphId) WritePS (mpPageBody, "show\n"); // restore the user coordinate system - if (mnTextAngle != 0) + if (mnTextAngle) PSGRestore (); } diff --git a/vcl/unx/generic/print/text_gfx.cxx b/vcl/unx/generic/print/text_gfx.cxx index d3153952b0a6..f87fe2176f20 100644 --- a/vcl/unx/generic/print/text_gfx.cxx +++ b/vcl/unx/generic/print/text_gfx.cxx @@ -33,7 +33,7 @@ void PrinterGfx::SetFont( sal_Int32 nFontID, sal_Int32 nHeight, sal_Int32 nWidth, - sal_Int32 nAngle, + Degree10 nAngle, bool bVertical, bool bArtItalic, bool bArtBold @@ -82,15 +82,15 @@ void PrinterGfx::DrawGlyph(const Point& rPoint, // move and rotate the user coordinate system // avoid the gsave/grestore for the simple cases since it allows // reuse of the current font if it hasn't changed - sal_Int32 nCurrentTextAngle = mnTextAngle; + Degree10 nCurrentTextAngle = mnTextAngle; Point aPoint( rPoint ); - if (nCurrentTextAngle != 0) + if (nCurrentTextAngle) { PSGSave (); PSTranslate (rPoint); PSRotate (nCurrentTextAngle); - mnTextAngle = 0; + mnTextAngle = Degree10(0); aPoint = Point( 0, 0 ); } @@ -114,7 +114,7 @@ void PrinterGfx::DrawGlyph(const Point& rPoint, maVirtualStatus.mnTextHeight = nTextWidth; if( aPoint.X() || aPoint.Y() ) PSTranslate( aPoint ); - PSRotate (900); + PSRotate (Degree10(900)); // draw the rotated glyph drawGlyph(aRotPoint, rGlyph.glyphId()); @@ -126,7 +126,7 @@ void PrinterGfx::DrawGlyph(const Point& rPoint, drawGlyph(aPoint, rGlyph.glyphId()); // restore the user coordinate system - if (nCurrentTextAngle != 0) + if (nCurrentTextAngle) { PSGRestore (); mnTextAngle = nCurrentTextAngle; diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx b/vcl/win/gdi/DWriteTextRenderer.cxx index 734b68b0780a..da8eab0e6ce0 100644 --- a/vcl/win/gdi/DWriteTextRenderer.cxx +++ b/vcl/win/gdi/DWriteTextRenderer.cxx @@ -397,13 +397,13 @@ WinFontTransformGuard::WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, f = aTransform * D2D1::Matrix3x2F::Scale(D2D1::Size(fHScale, 1.0f), D2D1::Point2F(0, 0)); } - if (rLayout.GetOrientation() != 0) + if (rLayout.GetOrientation()) { // DWrite angle is in clockwise degrees, our orientation is in counter-clockwise 10th // degrees. aTransform = aTransform * D2D1::Matrix3x2F::Rotation( - -static_cast<FLOAT>(rLayout.GetOrientation()) / 10, rBaseline); + -static_cast<FLOAT>(rLayout.GetOrientation().get()) / 10, rBaseline); } mpRenderTarget->SetTransform(aTransform); } diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx index f37ae89a00a8..7b4c0f042d9e 100644 --- a/vcl/win/gdi/salfont.cxx +++ b/vcl/win/gdi/salfont.cxx @@ -603,7 +603,7 @@ void ImplSalLogFontToFontW( HDC hDC, const LOGFONTW& rLogFont, Font& rFont ) nFontHeight += nDPIY/2; nFontHeight /= nDPIY; rFont.SetFontSize( Size( 0, nFontHeight ) ); - rFont.SetOrientation( static_cast<short>(rLogFont.lfEscapement) ); + rFont.SetOrientation( Degree10(static_cast<sal_Int16>(rLogFont.lfEscapement)) ); if ( rLogFont.lfItalic ) rFont.SetItalic( ITALIC_NORMAL ); else @@ -805,7 +805,7 @@ void ImplGetLogFontFromFontSelect( HDC hDC, rLogFont.lfUnderline = 0; rLogFont.lfStrikeOut = 0; rLogFont.lfItalic = BYTE(rFont.GetItalic() != ITALIC_NONE); - rLogFont.lfEscapement = rFont.mnOrientation; + rLogFont.lfEscapement = rFont.mnOrientation.get(); rLogFont.lfOrientation = rLogFont.lfEscapement; rLogFont.lfClipPrecision = CLIP_DEFAULT_PRECIS; rLogFont.lfQuality = nDefaultQuality; diff --git a/vcl/workben/svptest.cxx b/vcl/workben/svptest.cxx index 77c7ac3cb28b..1e67f17b1942 100644 --- a/vcl/workben/svptest.cxx +++ b/vcl/workben/svptest.cxx @@ -234,7 +234,7 @@ void MyWin::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rR FontMetric aFont = rRenderContext.GetDevFont((i * nFontCount) / nFontSamples); aFont.SetFontHeight(400 + (i % 7) * 100); - aFont.SetOrientation(i * (3600 / nFontSamples)); + aFont.SetOrientation(Degree10(i * (3600 / nFontSamples))); rRenderContext.SetFont(aFont); sal_uInt8 nRed = (i << 6) & 0xC0; @@ -265,7 +265,7 @@ void MyWin::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rR Color const aDarkGreen(0, 0x40, 0); Gradient aGradient(GradientStyle::Linear, aBlack, aWhite); - aGradient.SetAngle(900); + aGradient.SetAngle(Degree10(900)); rRenderContext.DrawGradient(tools::Rectangle(Point(1000, 4500), Size(aPaperSize.Width() - 2000, 500)), aGradient); diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index a089301db7cf..36711fc58084 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -475,7 +475,7 @@ public: aFontRect.AdjustTop(nHeight/2 ); aFontRect.AdjustBottom(nHeight ); - aFont.SetOrientation(45 * 10); // 45 degrees + aFont.SetOrientation(Degree10(450)); // 45 degrees rDev.SetFont(aFont); rDev.DrawText(aFontRect, aText); @@ -691,7 +691,7 @@ public: case 2: { tools::Polygon aPoly(aSub); - aPoly.Rotate(aSub.Center(), 450); + aPoly.Rotate(aSub.Center(), Degree10(450)); aPoly.Clip(aSmaller); aRegion = vcl::Region(aPoly); break; @@ -834,7 +834,7 @@ public: aGradient.SetStartColor(nStartCols[i]); aGradient.SetEndColor(nEndCols[i]); aGradient.SetStyle(eStyles[i]); - aGradient.SetAngle(nAngles[i]); + aGradient.SetAngle(Degree10(nAngles[i])); aGradient.SetBorder(nBorders[i]); rDev.DrawGradient(aSub, aGradient); } @@ -1047,7 +1047,7 @@ public: case 3: case 0: // 45degree rectangle. aPoly = tools::Polygon(aPieces[i]); - aPoly.Rotate(aPieces[i].Center(), 450); + aPoly.Rotate(aPieces[i].Center(), Degree10(450)); break; case 1: // arc aPoly = tools::Polygon(aPieces[i], @@ -1058,7 +1058,7 @@ public: aPoly = tools::Polygon(aPieces[i], aPieces[i].GetWidth()/5, aPieces[i].GetHeight()/5); - aPoly.Rotate(aPieces[i].Center(), 450); + aPoly.Rotate(aPieces[i].Center(), Degree10(450)); break; } aClipRegion = vcl::Region(aPoly); |