diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-11-22 09:08:46 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-11-22 11:25:38 +0100 |
commit | de4cb026b5fe3ecd1c9557817565cff4ca4e8408 (patch) | |
tree | 90072778d17ffc45e394760dc765f5e8d79bffd6 /sw/source | |
parent | 003b2d0c36c62800257c688c65109bf2fc7d4f32 (diff) |
Generalize DegreeN
This potentially allows to introduce other degree fractions easily,
like Degree<sal_Int64, 60000>, with automatically defined conversion
functions.
Change-Id: Id1c32d9e029943844bdc833178c1f99387ff87fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125640
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/draw/dflyobj.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/shells/frmsh.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/shells/grfsh.cxx | 6 |
4 files changed, 8 insertions, 8 deletions
diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index d5497f9f2098..5298f1a296ba 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -386,7 +386,7 @@ void SwVirtFlyDrawObj::Rotate(const Point& rRef, Degree100 nAngle100, double sn, { // RotGrfFlyFrame: Here is where the positively completed rotate interaction is executed. // Rotation is in 1/100th degree and may be signed (!) - Degree10 nAngle10 = toDegree10(nAngle100); + Degree10 nAngle10 = to<Degree10>(nAngle100); while(nAngle10 < 0_deg10) { @@ -1174,7 +1174,7 @@ Degree100 SwVirtFlyDrawObj::GetRotateAngle() const if(ContainsSwGrfNode()) { Size aSize; - return toDegree100(getPossibleRotationFromFraphicFrame(aSize)); + return to<Degree100>(getPossibleRotationFromFraphicFrame(aSize)); } else { diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 40656f6e3bf7..bcdd1af1af4f 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -5143,7 +5143,7 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size if (Degree10 nRot = rSet.Get(RES_GRFATR_ROTATION).GetValue()) { // RES_GRFATR_ROTATION is in 10ths of degree; convert to 100ths for macro - sal_uInt32 mOOXMLRot = oox::drawingml::ExportRotateClockwisify(toDegree100(nRot)); + sal_uInt32 mOOXMLRot = oox::drawingml::ExportRotateClockwisify(to<Degree100>(nRot)); xFrameAttributes->add(XML_rot, OString::number(mOOXMLRot)); } } diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index 05187b5964dc..4463908f4b22 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -400,7 +400,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) if (pArgs && SfxItemState::SET == pArgs->GetItemState(SID_ATTR_TRANSFORM_DELTA_ANGLE, false, &pItem)) { - const Degree10 nDeltaRot = toDegree10(static_cast<const SdrAngleItem*>(pItem)->GetValue()); + const Degree10 nDeltaRot = to<Degree10>(static_cast<const SdrAngleItem*>(pItem)->GetValue()); aMgr.SetRotation(nOldRot, nOldRot + nDeltaRot, rRotation.GetUnrotatedSize()); } @@ -410,7 +410,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) // 100th degrees in SID_ATTR_TRANSFORM_ANGLE to 10th degrees in RES_GRFATR_ROTATION if (pArgs && SfxItemState::SET == pArgs->GetItemState(SID_ATTR_TRANSFORM_ANGLE, false, &pItem)) { - const Degree10 nNewRot = toDegree10(static_cast<const SdrAngleItem*>(pItem)->GetValue()); + const Degree10 nNewRot = to<Degree10>(static_cast<const SdrAngleItem*>(pItem)->GetValue()); // RotGrfFlyFrame: Rotation change here, SwFlyFrameAttrMgr aMgr is available aMgr.SetRotation(nOldRot, nNewRot, rRotation.GetUnrotatedSize()); diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx index 1aa4b210a8a2..fa293272d0b9 100644 --- a/sw/source/uibase/shells/grfsh.cxx +++ b/sw/source/uibase/shells/grfsh.cxx @@ -392,7 +392,7 @@ void SwGrfShell::Execute(SfxRequest &rReq) const SwRotationGrf& rRotation = aTmpSet.Get(RES_GRFATR_ROTATION); nCurrentRotation = rRotation.GetValue(); aUnrotatedSize = rRotation.GetUnrotatedSize(); - aSet.Put(SdrAngleItem(SID_ATTR_TRANSFORM_ANGLE, toDegree100(nCurrentRotation))); + aSet.Put(SdrAngleItem(SID_ATTR_TRANSFORM_ANGLE, to<Degree100>(nCurrentRotation))); } SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); @@ -507,7 +507,7 @@ void SwGrfShell::Execute(SfxRequest &rReq) // RotGrfFlyFrame: Get and process evtl. changed RotationAngle if ( SfxItemState::SET == pSet->GetItemState(SID_ATTR_TRANSFORM_ANGLE, false, &pItem )) { - const Degree10 aNewRotation = toDegree10(static_cast<const SdrAngleItem*>(pItem)->GetValue() % 36000_deg100); + const Degree10 aNewRotation = to<Degree10>(static_cast<const SdrAngleItem*>(pItem)->GetValue() % 36000_deg100); // RotGrfFlyFrame: Possible rotation change here, SwFlyFrameAttrMgr aMgr is available aMgr.SetRotation(nCurrentRotation, aNewRotation, aUnrotatedSize); @@ -984,7 +984,7 @@ void SwGrfShell::GetAttrStateForRotation(SfxItemSet &rSet) SfxItemSetFixed<RES_GRFATR_ROTATION, RES_GRFATR_ROTATION> aSet( rShell.GetAttrPool() ); rShell.GetCurAttr( aSet ); const SwRotationGrf& rRotation = aSet.Get(RES_GRFATR_ROTATION); - rSet.Put(SdrAngleItem(SID_ATTR_TRANSFORM_ANGLE, toDegree100(rRotation.GetValue()))); + rSet.Put(SdrAngleItem(SID_ATTR_TRANSFORM_ANGLE, to<Degree100>(rRotation.GetValue()))); break; } default: |