sd/source/ui/app/sdxfer.cxx | 2 +- svx/source/customshapes/EnhancedCustomShape3d.cxx | 7 ------- svx/source/svdraw/svdmodel.cxx | 2 +- svx/source/svdraw/svdograf.cxx | 12 ++---------- svx/source/svdraw/svdotext.cxx | 6 +----- svx/source/svdraw/svdxcgv.cxx | 18 +++++------------- 6 files changed, 10 insertions(+), 37 deletions(-)
New commits: commit f4804a8fb60cc999c9b08bf451732749b44eb355 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Tue Jan 31 09:42:50 2023 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Tue Jan 31 09:30:16 2023 +0000 Some simplification after 743dd1d3c1142c1c99b0844cc26dd0be91a1de40 MapMode ctor taking origin and scales sets mbSimple to false, so avoid calling it when these are the defaults. Some calculations become unneeded when the fraction is (1, 1). Change-Id: I19a98ad2cac0a66b9bd7b72620180addb3f7fec4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146375 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index 95d9e9aa1cee..e7fb0ff357f9 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -251,7 +251,7 @@ void SdTransferable::CreateData() CreateObjectReplacement( pPage->GetObj( 0 ) ); mpVDev = VclPtr<VirtualDevice>::Create( *Application::GetDefaultDevice() ); - mpVDev->SetMapMode(MapMode(mpSdDrawDocumentIntern->GetScaleUnit(), Point(), Fraction(1,1), Fraction(1,1))); + mpVDev->SetMapMode(MapMode(mpSdDrawDocumentIntern->GetScaleUnit())); mpSdViewIntern = new ::sd::View( *mpSdDrawDocumentIntern, mpVDev ); mpSdViewIntern->EndListening(*mpSdDrawDocumentIntern ); mpSdViewIntern->hideMarkHandles(); diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx index 9a0ef6bebf92..468a1c66fa93 100644 --- a/svx/source/customshapes/EnhancedCustomShape3d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx @@ -238,13 +238,6 @@ rtl::Reference<SdrObject> EnhancedCustomShape3d::Create3DObject( rtl::Reference<SdrObject> pRet; const SdrCustomShapeGeometryItem& rGeometryItem(rSdrObjCustomShape.GetMergedItem(SDRATTR_CUSTOMSHAPE_GEOMETRY)); double fMap(1.0), *pMap = nullptr; - Fraction aFraction(1, 1); - - if ( aFraction.GetNumerator() != 1 || aFraction.GetDenominator() != 1 ) - { - fMap *= double(aFraction); - pMap = &fMap; - } if ( rSdrObjCustomShape.getSdrModelFromSdrObject().GetScaleUnit() != MapUnit::Map100thMM ) { diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 73d99b29d5ad..eb971b7f6b30 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -682,7 +682,7 @@ void SdrModel::ImpSetOutlinerDefaults( SdrOutliner* pOutliner, bool bInit ) if ( !GetRefDevice() ) { - MapMode aMapMode(m_eObjUnit, Point(0,0), Fraction(1,1), Fraction(1,1)); + MapMode aMapMode(m_eObjUnit); pOutliner->SetRefMapMode(aMapMode); } } diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 9ac5536c5716..d9becdfdb80d 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -387,11 +387,7 @@ Graphic SdrGrafObj::GetTransformedGraphic( SdrGrafObjTransformsAttrs nTransformF { // Refactored most of the code to GraphicObject, where // everybody can use e.g. the cropping functionality - MapMode aDestMap( - getSdrModelFromSdrObject().GetScaleUnit(), - Point(), - Fraction(1,1), - Fraction(1,1)); + MapMode aDestMap(getSdrModelFromSdrObject().GetScaleUnit()); const Size aDestSize( GetLogicRect().GetSize() ); GraphicAttr aActAttr = GetGraphicAttr(nTransformFlags); @@ -869,11 +865,7 @@ GDIMetaFile SdrGrafObj::getMetafileFromEmbeddedVectorGraphicData() const { ScopedVclPtrInstance< VirtualDevice > pOut; const tools::Rectangle aBoundRect(GetCurrentBoundRect()); - const MapMode aMap( - getSdrModelFromSdrObject().GetScaleUnit(), - Point(), - Fraction(1,1), - Fraction(1,1)); + const MapMode aMap(getSdrModelFromSdrObject().GetScaleUnit()); pOut->EnableOutput(false); pOut->SetMapMode(aMap); diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index ad27f101c6cb..078e067aa14e 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -1324,11 +1324,7 @@ void SdrTextObj::UpdateOutlinerFormatting( SdrOutliner& rOutl, tools::Rectangle& Fraction aFitXCorrection(1,1); const bool bContourFrame(IsContourTextFrame()); - const MapMode aMapMode( - getSdrModelFromSdrObject().GetScaleUnit(), - Point(0,0), - Fraction(1,1), - Fraction(1,1)); + const MapMode aMapMode(getSdrModelFromSdrObject().GetScaleUnit()); rOutl.SetRefMapMode(aMapMode); ImpSetupDrawOutlinerForPaint( diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 4c425a627bc5..19b06a9d4ca0 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -163,8 +163,7 @@ bool SdrExchangeView::Paste(const OUString& rStr, const Point& rPos, SdrObjList* pObj->FitFrameToTextSize(); Size aSiz(pObj->GetLogicRect().GetSize()); MapUnit eMap = GetModel().GetScaleUnit(); - Fraction aMap(1,1); - ImpPasteObject(pObj.get(),*pLst,aPos,aSiz,MapMode(eMap,Point(0,0),aMap,aMap),nOptions); + ImpPasteObject(pObj.get(), *pLst, aPos, aSiz, MapMode(eMap), nOptions); return true; } @@ -203,8 +202,7 @@ bool SdrExchangeView::Paste(SvStream& rInput, EETextFormat eFormat, const Point& pObj->FitFrameToTextSize(); Size aSiz(pObj->GetLogicRect().GetSize()); MapUnit eMap = GetModel().GetScaleUnit(); - Fraction aMap(1,1); - ImpPasteObject(pObj.get(),*pLst,aPos,aSiz,MapMode(eMap,Point(0,0),aMap,aMap),nOptions); + ImpPasteObject(pObj.get(), *pLst, aPos, aSiz, MapMode(eMap), nOptions); // b4967543 if(pObj->GetOutlinerParaObject()) @@ -401,11 +399,8 @@ void SdrExchangeView::ImpPasteObject(SdrObject* pObj, SdrObjList& rLst, const Po MapUnit eSrcMU=rMap.GetMapUnit(); MapUnit eDstMU = GetModel().GetScaleUnit(); FrPair aMapFact(GetMapFactor(eSrcMU,eDstMU)); - Fraction aDstFr(1,1); - nSizX *= double(aMapFact.X() * rMap.GetScaleX() * aDstFr); - nSizX *= aDstFr.GetDenominator(); + nSizX *= double(aMapFact.X() * rMap.GetScaleX()); nSizY *= double(aMapFact.Y() * rMap.GetScaleY()); - nSizY /= aDstFr.GetNumerator(); tools::Long xs=nSizX; tools::Long ys=nSizY; // set the pos to 0, 0 for online case @@ -530,7 +525,7 @@ GDIMetaFile SdrExchangeView::GetMarkedObjMetaFile(bool bNoVDevIfOneMtfMarked) co { tools::Rectangle aBound( GetMarkedObjBoundRect() ); Size aBoundSize( aBound.GetWidth(), aBound.GetHeight() ); - MapMode aMap(GetModel().GetScaleUnit(), Point(), Fraction(1,1), Fraction(1,1)); + MapMode aMap(GetModel().GetScaleUnit()); if( bNoVDevIfOneMtfMarked ) { @@ -648,10 +643,7 @@ Graphic SdrExchangeView::GetObjGraphic(const SdrObject& rSdrObject) ScopedVclPtrInstance< VirtualDevice > pOut; GDIMetaFile aMtf; const tools::Rectangle aBoundRect(rSdrObject.GetCurrentBoundRect()); - const MapMode aMap(rSdrObject.getSdrModelFromSdrObject().GetScaleUnit(), - Point(), - Fraction(1,1), - Fraction(1,1)); + const MapMode aMap(rSdrObject.getSdrModelFromSdrObject().GetScaleUnit()); pOut->EnableOutput(false); pOut->SetMapMode(aMap);