diff options
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svddrgmt.cxx | 20 | ||||
-rw-r--r-- | svx/source/svdraw/svdobj.cxx | 10 | ||||
-rw-r--r-- | svx/source/uitest/sdrobject.cxx | 16 |
3 files changed, 20 insertions, 26 deletions
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index 714d4e66a334..1e3344c26410 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -3766,25 +3766,17 @@ bool SdrDragCrop::EndSdrDrag(bool /*bCopy*/) if(bExternal) { - // With Ref point (opposed to dragged point), X scale and Y scale, + // With aLocalStart point (opposed to dragged point), X scale and Y scale, // we call crop (virtual method) on pSdrObject which calls VirtFlyDrawObj - // crop. aRef needs to be adapted to concrete Object's boundaries which - // is different from Crop-Ranges. This is because the Graphic and it's - // SdrObject representation is inside the FlyFrame, but not identical - // with it. - const tools::Rectangle& rOutRect(pExternalSdrObject->GetCurrentBoundRect()); - const basegfx::B2DHomMatrix aExternalTransform( - basegfx::utils::createScaleTranslateB2DHomMatrix( - rOutRect.getWidth(), rOutRect.getHeight(), - rOutRect.Left(), rOutRect.Top())); - const basegfx::B2DPoint aRef(aExternalTransform * aLocalStart); + // crop. Use aLocalStart unchanged, so being relative to the Crop-Action, + // the called instance knows best how to use it const double fScaleX(aRangeNewNoShearNoRotate.getWidth() / aRangeOriginalNoShearNoRotate.getWidth()); const double fScaleY(aRangeNewNoShearNoRotate.getHeight() / aRangeOriginalNoShearNoRotate.getHeight()); pExternalSdrObject->Crop( - Point(basegfx::fround(aRef.getX()), basegfx::fround(aRef.getY())), - Fraction(fScaleX), - Fraction(fScaleY)); + aLocalStart, + fScaleX, + fScaleY); } else { diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index d5ef63b3c842..020c75655be8 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -1485,8 +1485,10 @@ void SdrObject::Move(const Size& rSiz) } } -void SdrObject::NbcCrop(const Point& /*rRef*/, const Fraction& /*xFact*/, const Fraction& /*yFact*/) { - // Default: does nothing. Real behaviour in SwVirtFlyDrawObj and SdrGrafObj +void SdrObject::NbcCrop(const basegfx::B2DPoint& /*aRef*/, double /*fxFact*/, double /*fyFact*/) +{ + // Default: does nothing. Real behaviour in SwVirtFlyDrawObj and SdrDragCrop::EndSdrDrag. + // Where SwVirtFlyDrawObj is the only real user of it to do something local } void SdrObject::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative) @@ -1507,10 +1509,10 @@ void SdrObject::Resize(const Point& rRef, const Fraction& xFact, const Fraction& } } -void SdrObject::Crop(const Point& rRef, const Fraction& xFact, const Fraction& yFact) +void SdrObject::Crop(const basegfx::B2DPoint& rRef, double fxFact, double fyFact) { tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect(); - NbcCrop(rRef, xFact, yFact); + NbcCrop(rRef, fxFact, fyFact); SetChanged(); BroadcastObjectChange(); SendUserCall(SdrUserCallType::Resize,aBoundRect0); diff --git a/svx/source/uitest/sdrobject.cxx b/svx/source/uitest/sdrobject.cxx index f70cb2e3c511..4fdd4c315764 100644 --- a/svx/source/uitest/sdrobject.cxx +++ b/svx/source/uitest/sdrobject.cxx @@ -99,6 +99,8 @@ void SdrUIObject::execute(const OUString& rAction, } else if (rAction == "CROP") { + // RotateFlyFrame3: Note: Crop does nothing at SdrObject + // anymore, see comment at SdrObject::NbcCrop auto itrNX = rParameters.find("X"); if (itrNX == rParameters.end()) throw css::uno::RuntimeException("missing parameter X"); @@ -107,23 +109,21 @@ void SdrUIObject::execute(const OUString& rAction, if (itrNY == rParameters.end()) throw css::uno::RuntimeException("missing parameter Y"); - long nX = itrNX->second.toInt32(); - long nY = itrNY->second.toInt32(); - Point aPos(nX, nY); + const double fX(itrNX->second.toDouble()); + const double fY(itrNY->second.toDouble()); + const basegfx::B2DPoint aPos(fX, fY); auto itrFracX = rParameters.find("FRAC_X"); if (itrFracX == rParameters.end()) throw css::uno::RuntimeException("missing parameter FRAC_X"); - double nFracX = itrFracX->second.toDouble(); - Fraction aFracX(nFracX); + const double fFracX(itrFracX->second.toDouble()); auto itrFracY = rParameters.find("FRAC_Y"); if (itrFracY == rParameters.end()) throw css::uno::RuntimeException("missing parameter FRAC_Y"); - double nFracY = itrFracY->second.toDouble(); - Fraction aFracY(nFracY); + const double fFracY(itrFracY->second.toDouble()); - pObj->Crop(aPos, aFracX, aFracY); + pObj->Crop(aPos, fFracX, fFracY); } else if (rAction == "ROTATE") { |