diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2022-07-23 23:48:24 +1000 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2022-08-24 10:55:15 +0200 |
commit | 59210b075b79e4fc58f86542d9947d6ed0073abd (patch) | |
tree | af9f6c1a8d5de2d2ccde0e8671f9b320775a5f98 /svx | |
parent | 51d2e734099e5c5c56393ef9f08007a7df441794 (diff) |
tools: rename Rectangle::Justify() to Rectangle::Normalize()
Jusify() normalizes the rectangle so both the Width and Height are
positive, without changing the location of the rectangle. It ensures
that the x and y coordinates will be moved to the top left of the
rectangle.
The name is strange, so renaming Justify() to Normalize().
Change-Id: Idbf163e65e52a798e38f785b8961b8042cf0cf2a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137379
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShape2d.cxx | 6 | ||||
-rw-r--r-- | svx/source/dialog/contwnd.cxx | 2 | ||||
-rw-r--r-- | svx/source/engine3d/scene3d.cxx | 6 | ||||
-rw-r--r-- | svx/source/svdraw/svdmrkv.cxx | 8 | ||||
-rw-r--r-- | svx/source/svdraw/svdoashp.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdobj.cxx | 14 | ||||
-rw-r--r-- | svx/source/svdraw/svdocirc.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdomeas.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdopath.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdorect.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdotext.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdotxdr.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdotxtr.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdtrans.cxx | 2 | ||||
-rw-r--r-- | svx/source/table/svdotable.cxx | 4 |
15 files changed, 31 insertions, 31 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 8ce8c83b07a9..6e9ee5ecce12 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -1139,7 +1139,7 @@ tools::Rectangle EnhancedCustomShape2d::GetTextRect() const if( aRect.GetWidth() <= 1 || aRect.GetHeight() <= 1 ) return aLogicRect; aRect.Move( aLogicRect.Left(), aLogicRect.Top() ); - aRect.Justify(); + aRect.Normalize(); return aRect; } @@ -1989,7 +1989,7 @@ static basegfx::B2DPolygon CreateArc( const tools::Rectangle& rRect, const Point bSwapStartEndAngle ^= 0x11; if ( bSwapStartEndAngle ) { - aRect.Justify(); + aRect.Normalize(); if ( bSwapStartEndAngle & 1 ) { Point aTmp( aStart ); @@ -2370,7 +2370,7 @@ void EnhancedCustomShape2d::CreateSubPath( } aNewB2DPolygon.clear(); } - tools::Rectangle aRect = tools::Rectangle::Justify( GetPoint( seqCoordinates[ rSrcPt ], true, true ), GetPoint( seqCoordinates[ rSrcPt + 1 ], true, true ) ); + tools::Rectangle aRect = tools::Rectangle::Normalize( GetPoint( seqCoordinates[ rSrcPt ], true, true ), GetPoint( seqCoordinates[ rSrcPt + 1 ], true, true ) ); if ( aRect.GetWidth() && aRect.GetHeight() ) { Point aStart( GetPoint( seqCoordinates[ static_cast<sal_uInt16>( rSrcPt + nXor ) ], true, true ) ); diff --git a/svx/source/dialog/contwnd.cxx b/svx/source/dialog/contwnd.cxx index 0043f7f0a920..1c68b5324732 100644 --- a/svx/source/dialog/contwnd.cxx +++ b/svx/source/dialog/contwnd.cxx @@ -200,7 +200,7 @@ bool ContourWindow::MouseButtonUp(const MouseEvent& rMEvt) aWorkRect.SetRight( aLogPt.X() ); aWorkRect.SetBottom( aLogPt.Y() ); aWorkRect.Intersection( aGraphRect ); - aWorkRect.Justify(); + aWorkRect.Normalize(); if ( aWorkRect.Left() != aWorkRect.Right() && aWorkRect.Top() != aWorkRect.Bottom() ) { diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index 07aa9c718f81..dcad0e7603e6 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -686,7 +686,7 @@ bool E3dScene::BegCreate(SdrDragStat& rStat) { rStat.SetOrtho4Possible(); tools::Rectangle aRect1(rStat.GetStart(), rStat.GetNow()); - aRect1.Justify(); + aRect1.Normalize(); rStat.SetActionRect(aRect1); NbcSetSnapRect(aRect1); return true; @@ -696,7 +696,7 @@ bool E3dScene::MovCreate(SdrDragStat& rStat) { tools::Rectangle aRect1; rStat.TakeCreateRect(aRect1); - aRect1.Justify(); + aRect1.Normalize(); rStat.SetActionRect(aRect1); NbcSetSnapRect(aRect1); SetBoundRectDirty(); @@ -708,7 +708,7 @@ bool E3dScene::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) { tools::Rectangle aRect1; rStat.TakeCreateRect(aRect1); - aRect1.Justify(); + aRect1.Normalize(); NbcSetSnapRect(aRect1); SetBoundAndSnapRectsDirty(); return (eCmd==SdrCreateCmd::ForceEnd || rStat.GetPointCount()>=2); diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index c298e1925191..3e1b7bee169a 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -421,7 +421,7 @@ bool SdrMarkView::EndMarkObj() if(maDragStat.IsMinMoved()) { tools::Rectangle aRect(maDragStat.GetStart(), maDragStat.GetNow()); - aRect.Justify(); + aRect.Normalize(); MarkObj(aRect, mpMarkObjOverlay->IsUnmarking()); bRetval = true; } @@ -484,7 +484,7 @@ bool SdrMarkView::EndMarkPoints() if(maDragStat.IsMinMoved()) { tools::Rectangle aRect(maDragStat.GetStart(), maDragStat.GetNow()); - aRect.Justify(); + aRect.Normalize(); MarkPoints(&aRect, mpMarkPointsOverlay->IsUnmarking()); bRetval = true; @@ -546,7 +546,7 @@ void SdrMarkView::EndMarkGluePoints() if(maDragStat.IsMinMoved()) { tools::Rectangle aRect(maDragStat.GetStart(),maDragStat.GetNow()); - aRect.Justify(); + aRect.Normalize(); MarkGluePoints(&aRect, mpMarkGluePointsOverlay->IsUnmarking()); } @@ -1094,7 +1094,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S tools::Rectangle aNegatedRect(aSelection); aNegatedRect.SetLeft(-aNegatedRect.Left()); aNegatedRect.SetRight(-aNegatedRect.Right()); - aNegatedRect.Justify(); + aNegatedRect.Normalize(); sSelectionText = aNegatedRect.toString() + ", " + OString::number(nRotAngle.get()); } diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 7cd102252b60..886307f86b48 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -1923,7 +1923,7 @@ void SdrObjCustomShape::DragResizeCustomShape( const tools::Rectangle& rNewRect bool bOldMirroredY( IsMirroredY() ); tools::Rectangle aNewRect( rNewRect ); - aNewRect.Justify(); + aNewRect.Normalize(); std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles() ); diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 06566ab4ba93..c3c01eda713d 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -1319,7 +1319,7 @@ tools::Rectangle SdrObject::ImpDragCalcRect(const SdrDragStat& rDrag) const } } } - aTmpRect.Justify(); + aTmpRect.Normalize(); return aTmpRect; } @@ -1380,7 +1380,7 @@ bool SdrObject::BegCreate(SdrDragStat& rStat) { rStat.SetOrtho4Possible(); tools::Rectangle aRect1(rStat.GetStart(), rStat.GetNow()); - aRect1.Justify(); + aRect1.Normalize(); rStat.SetActionRect(aRect1); setOutRectangle(aRect1); return true; @@ -1391,7 +1391,7 @@ bool SdrObject::MovCreate(SdrDragStat& rStat) tools::Rectangle aRectangle; rStat.TakeCreateRect(aRectangle); rStat.SetActionRect(aRectangle); - aRectangle.Justify(); + aRectangle.Normalize(); setOutRectangle(aRectangle); return true; } @@ -1400,7 +1400,7 @@ bool SdrObject::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) { tools::Rectangle aRectangle; rStat.TakeCreateRect(aRectangle); - aRectangle.Justify(); + aRectangle.Normalize(); setOutRectangle(aRectangle); return (eCmd==SdrCreateCmd::ForceEnd || rStat.GetPointCount()>=2); @@ -1419,7 +1419,7 @@ basegfx::B2DPolyPolygon SdrObject::TakeCreatePoly(const SdrDragStat& rDrag) cons { tools::Rectangle aRect1; rDrag.TakeCreateRect(aRect1); - aRect1.Justify(); + aRect1.Normalize(); basegfx::B2DPolyPolygon aRetval; aRetval.append(basegfx::utils::createPolygonFromRect(vcl::unotools::b2DRectangleFromRectangle(aRect1))); @@ -1496,7 +1496,7 @@ tools::Rectangle lclRotateRectangle(tools::Rectangle const& rRectangle, Point co aRectangle.SetBottom(-R.Left() ); } aRectangle.Move(rRef.X(),rRef.Y()); - aRectangle.Justify(); // just in case + aRectangle.Normalize(); // just in case return aRectangle; } @@ -1525,7 +1525,7 @@ tools::Rectangle lclMirrorRectangle(tools::Rectangle const& rRectangle, Point co aRectangle.SetBottom(-R.Left() ); } aRectangle.Move(rRef1.X(),rRef1.Y()); - aRectangle.Justify(); // just in case + aRectangle.Normalize(); // just in case return aRectangle; } diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx index bf253ceeee39..514f07aba8e9 100644 --- a/svx/source/svdraw/svdocirc.cxx +++ b/svx/source/svdraw/svdocirc.cxx @@ -631,7 +631,7 @@ OUString SdrCircObj::getSpecialDragComment(const SdrDragStat& rDrag) const void ImpCircUser::SetCreateParams(SdrDragStat const & rStat) { rStat.TakeCreateRect(aR); - aR.Justify(); + aR.Normalize(); aCenter=aR.Center(); nWdt=aR.Right()-aR.Left(); nHgt=aR.Bottom()-aR.Top(); @@ -694,7 +694,7 @@ bool SdrCircObj::BegCreate(SdrDragStat& rStat) { rStat.SetOrtho4Possible(); tools::Rectangle aRect1(rStat.GetStart(), rStat.GetNow()); - aRect1.Justify(); + aRect1.Normalize(); rStat.SetActionRect(aRect1); maRect = aRect1; ImpSetCreateParams(rStat); diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx index da9959c846cc..b67add22bf8a 100644 --- a/svx/source/svdraw/svdomeas.cxx +++ b/svx/source/svdraw/svdomeas.cxx @@ -697,7 +697,7 @@ void SdrMeasureObj::TakeUnrotatedSnapRect(tools::Rectangle& rRect) const RotatePoint(aTextPos,aPt1b,aMPol.nLineSin,aMPol.nLineCos); aTextSize2.AdjustWidth( 1 ); aTextSize2.AdjustHeight( 1 ); // because of the Rect-Ctor's odd behavior rRect=tools::Rectangle(aTextPos,aTextSize2); - rRect.Justify(); + rRect.Normalize(); const_cast<SdrMeasureObj*>(this)->maRect=rRect; if (aMPol.nTextAngle != maGeo.nRotationAngle) { diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index f58e89d4996d..9c8f3ce98d31 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -1685,7 +1685,7 @@ void SdrPathObj::ImpForceLineAngle() maGeo.RecalcTan(); // for SdrTextObj, keep aRect up to date - maRect = tools::Rectangle::Justify(aPoint0, aPoint1); + maRect = tools::Rectangle::Normalize(aPoint0, aPoint1); } void SdrPathObj::ImpForceKind() diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx index 2674464d2168..7acf90b7bc94 100644 --- a/svx/source/svdraw/svdorect.cxx +++ b/svx/source/svdraw/svdorect.cxx @@ -429,7 +429,7 @@ basegfx::B2DPolyPolygon SdrRectObj::TakeCreatePoly(const SdrDragStat& rDrag) con { tools::Rectangle aRect1; rDrag.TakeCreateRect(aRect1); - aRect1.Justify(); + aRect1.Normalize(); basegfx::B2DPolyPolygon aRetval; aRetval.append(ImpCalcXPoly(aRect1,GetEckenradius()).getB2DPolygon()); diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index fe5e13446955..e80d29847a55 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -421,7 +421,7 @@ SdrTextVertAdjust SdrTextObj::GetTextVerticalAdjust(const SfxItemSet& rSet) cons void SdrTextObj::ImpJustifyRect(tools::Rectangle& rRect) { if (!rRect.IsEmpty()) { - rRect.Justify(); + rRect.Normalize(); if (rRect.Left()==rRect.Right()) rRect.AdjustRight( 1 ); if (rRect.Top()==rRect.Bottom()) rRect.AdjustBottom( 1 ); } diff --git a/svx/source/svdraw/svdotxdr.cxx b/svx/source/svdraw/svdotxdr.cxx index ad2f79933a3e..a64da65dd1e9 100644 --- a/svx/source/svdraw/svdotxdr.cxx +++ b/svx/source/svdraw/svdotxdr.cxx @@ -183,7 +183,7 @@ bool SdrTextObj::BegCreate(SdrDragStat& rStat) { rStat.SetOrtho4Possible(); tools::Rectangle aRect1(rStat.GetStart(), rStat.GetNow()); - aRect1.Justify(); + aRect1.Normalize(); rStat.SetActionRect(aRect1); maRect = aRect1; return true; @@ -231,7 +231,7 @@ basegfx::B2DPolyPolygon SdrTextObj::TakeCreatePoly(const SdrDragStat& rDrag) con { tools::Rectangle aRect1; rDrag.TakeCreateRect(aRect1); - aRect1.Justify(); + aRect1.Normalize(); basegfx::B2DPolyPolygon aRetval; const basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(aRect1); diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx index 7d1a54433dad..597bb8735a74 100644 --- a/svx/source/svdraw/svdotxtr.cxx +++ b/svx/source/svdraw/svdotxtr.cxx @@ -122,7 +122,7 @@ void SdrTextObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract if (maGeo.nRotationAngle==0_deg100 && maGeo.nShearAngle==0_deg100) { ResizeRect(maRect,rRef,xFact,yFact); if (bYMirr) { - maRect.Justify(); + maRect.Normalize(); maRect.Move(maRect.Right()-maRect.Left(),maRect.Bottom()-maRect.Top()); maGeo.nRotationAngle=18000_deg100; maGeo.RecalcSinCos(); diff --git a/svx/source/svdraw/svdtrans.cxx b/svx/source/svdraw/svdtrans.cxx index 201e9f86d58c..23ce4787427e 100644 --- a/svx/source/svdraw/svdtrans.cxx +++ b/svx/source/svdraw/svdtrans.cxx @@ -58,7 +58,7 @@ void ResizeRect(tools::Rectangle& rRect, const Point& rRef, const Fraction& rxFa rRect.SetTop( rRef.Y() + FRound( (rRect.Top() - rRef.Y()) * double(aYFact) ) ); rRect.SetBottom( rRef.Y() + FRound( (rRect.Bottom() - rRef.Y()) * double(aYFact) ) ); - rRect.Justify(); + rRect.Normalize(); } diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index b8ff8a35df46..8c9aad400b0b 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -2304,7 +2304,7 @@ bool SdrTableObj::BegCreate(SdrDragStat& rStat) { rStat.SetOrtho4Possible(); tools::Rectangle aRect1(rStat.GetStart(), rStat.GetNow()); - aRect1.Justify(); + aRect1.Normalize(); rStat.SetActionRect(aRect1); maRect = aRect1; return true; @@ -2346,7 +2346,7 @@ basegfx::B2DPolyPolygon SdrTableObj::TakeCreatePoly(const SdrDragStat& rDrag) co { tools::Rectangle aRect1; rDrag.TakeCreateRect(aRect1); - aRect1.Justify(); + aRect1.Normalize(); basegfx::B2DPolyPolygon aRetval; const basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(aRect1); |