Fraction->double in SdrEditView::ResizeMarkedObj

Change-Id: I26ab911b680ded4d27a453154b6d8802a22154d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201734
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2026-03-16 14:44:47 +01:00
committed by Noel Grandin
parent dc4f4b85c5
commit ace2a49912
5 changed files with 19 additions and 19 deletions
+2 -2
View File
@@ -230,7 +230,7 @@ public:
// line has always a height of 0
void SetMarkedObjRect(const tools::Rectangle& rRect);
void MoveMarkedObj(const Size& rSiz, bool bCopy=false);
void ResizeMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy=false);
void ResizeMarkedObj(const Point& rRef, double xFact, double yFact, bool bCopy=false);
bool IsMarkedObjSizeValid(const Size& aTargetSize);
SAL_DLLPRIVATE void ResizeMultMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, const bool bWdh, const bool bHgt);
SAL_DLLPRIVATE Degree100 GetMarkedObjRotate() const;
@@ -247,7 +247,7 @@ public:
void CopyMarkedObj();
void SetAllMarkedRect(const tools::Rectangle& rRect) { SetMarkedObjRect(rRect); }
void MoveAllMarked(const Size& rSiz, bool bCopy=false) { MoveMarkedObj(rSiz,bCopy); }
void ResizeAllMarked(const Point& rRef, const Fraction& xFact, const Fraction& yFact) { ResizeMarkedObj(rRef,xFact,yFact); }
void ResizeAllMarked(const Point& rRef, double xFact, double yFact) { ResizeMarkedObj(rRef,xFact,yFact); }
void RotateAllMarked(const Point& rRef, Degree100 nAngle) { RotateMarkedObj(rRef,nAngle); }
void MirrorAllMarkedHorizontal() { MirrorMarkedObjHorizontal(); }
void MirrorAllMarkedVertical() { MirrorMarkedObjVertical(); }
+4 -4
View File
@@ -113,12 +113,12 @@ void ScTabViewShell::ExecuteObject( const SfxRequest& rReq )
pDrView->MoveMarkedObj( Size( 0, nNewVal - aRect.Top() ) );
else if ( nSlotId == SID_OBJECT_WIDTH )
pDrView->ResizeMarkedObj( aRect.TopLeft(),
Fraction( nNewVal, aRect.GetWidth() ),
Fraction( 1, 1 ) );
double(nNewVal) / aRect.GetWidth(),
1.0 );
else // if ( nSlotId == SID_OBJECT_HEIGHT )
pDrView->ResizeMarkedObj( aRect.TopLeft(),
Fraction( 1, 1 ),
Fraction( nNewVal, aRect.GetHeight() ) );
1.0,
double(nNewVal) / aRect.GetHeight() );
bDone = true;
}
}
+2 -2
View File
@@ -227,8 +227,8 @@ void FuCopy::DoExecute( SfxRequest& rReq )
}
}
Fraction aWidth( aRect.Right() - aRect.Left() + lWidth, aRect.Right() - aRect.Left() );
Fraction aHeight( aRect.Bottom() - aRect.Top() + lHeight, aRect.Bottom() - aRect.Top() );
double aWidth = double( aRect.Right() - aRect.Left() + lWidth ) / ( aRect.Right() - aRect.Left() );
double aHeight = double( aRect.Bottom() - aRect.Top() + lHeight ) / ( aRect.Bottom() - aRect.Top() );
if( mpView->IsResizeAllowed() )
mpView->ResizeAllMarked( aRect.TopLeft(), aWidth, aHeight );
+8 -8
View File
@@ -2036,7 +2036,7 @@ bool SdrDragResize::EndSdrDrag(bool bCopy)
}
else
{
getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),Fraction(m_aXFact),Fraction(m_aYFact),bCopy);
getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),m_aXFact,m_aYFact,bCopy);
}
return true;
@@ -2441,11 +2441,11 @@ bool SdrDragShear::EndSdrDrag(bool bCopy)
{
if (bVertical)
{
getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),aFact,Fraction(1,1),bCopy);
getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),double(aFact),1.0,bCopy);
}
else
{
getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),Fraction(1,1),aFact,bCopy);
getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),1.0,double(aFact),bCopy);
}
bCopy=false;
@@ -3338,14 +3338,14 @@ bool SdrDragCrook::EndSdrDrag(bool bCopy)
if (bResize)
{
Fraction aFact1(1,1);
double aFact1(1.0);
if (bContortion)
{
if (bVertical)
getSdrDragView().ResizeMarkedObj(aCenter,aFact1,aFact,bCopy);
getSdrDragView().ResizeMarkedObj(aCenter,aFact1,double(aFact),bCopy);
else
getSdrDragView().ResizeMarkedObj(aCenter,aFact,aFact1,bCopy);
getSdrDragView().ResizeMarkedObj(aCenter,double(aFact),aFact1,bCopy);
}
else
{
@@ -3363,9 +3363,9 @@ bool SdrDragCrook::EndSdrDrag(bool bCopy)
Point aCtr1(aCtr0);
if (bVertical)
ResizePoint(aCtr1,aCenter,aFact1,aFact);
ResizePoint(aCtr1,aCenter,aFact1,double(aFact));
else
ResizePoint(aCtr1,aCenter,aFact,aFact1);
ResizePoint(aCtr1,aCenter,double(aFact),aFact1);
Size aSiz(aCtr1.X()-aCtr0.X(),aCtr1.Y()-aCtr0.Y());
if( bUndo )
+3 -3
View File
@@ -239,7 +239,7 @@ bool SdrEditView::IsMarkedObjSizeValid(const Size& aTargetSize)
return false;
}
void SdrEditView::ResizeMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy)
void SdrEditView::ResizeMarkedObj(const Point& rRef, double xFact, double yFact, bool bCopy)
{
const bool bUndo = IsUndoEnabled();
if( bUndo )
@@ -777,12 +777,12 @@ void SdrEditView::SetNotPersistAttrToMarked(const SfxItemSet& rAttr)
if (const SdrResizeXAllItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_RESIZEXALL))
{
Fraction aXFact = pPoolItem->GetValue();
ResizeMarkedObj(aAllSnapRect.TopLeft(),aXFact,Fraction(1,1));
ResizeMarkedObj(aAllSnapRect.TopLeft(),double(aXFact),1.0);
}
if (const SdrResizeYAllItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_RESIZEYALL))
{
Fraction aYFact = pPoolItem->GetValue();
ResizeMarkedObj(aAllSnapRect.TopLeft(),Fraction(1,1),aYFact);
ResizeMarkedObj(aAllSnapRect.TopLeft(),1.0,double(aYFact));
}
if (const SdrRotateAllItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_ROTATEALL))
{