diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-10-20 07:27:44 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-10-21 08:13:05 +0200 |
commit | 0fb58a1ff168ae122e9c8993a3136658e3b0e3f0 (patch) | |
tree | 908983b02f466e0a49599edc70aaa1baaa240371 /cui | |
parent | b84afd2188d6993c91081885dc24664bd3f1cc73 (diff) |
new tools::Degree10 strong typedef
partly to flush some use of "long" out the codebase,
but also to make it obvious which units are being used
for angle values.
Change-Id: I1dc22494ca42c4677a63f685d5903f2b89886dc2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104548
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/tabpages/chardlg.cxx | 4 | ||||
-rw-r--r-- | cui/source/tabpages/tpgradnt.cxx | 12 | ||||
-rw-r--r-- | cui/source/tabpages/tphatch.cxx | 10 | ||||
-rw-r--r-- | cui/source/tabpages/tptrans.cxx | 6 |
4 files changed, 16 insertions, 16 deletions
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); |