chart2/source/view/main/DrawModelWrapper.cxx | 2 - include/svx/svdetc.hxx | 3 -- include/svx/svdmodel.hxx | 5 --- sd/source/core/drawdoc.cxx | 1 sd/source/ui/app/sdxfer.cxx | 2 - svx/source/customshapes/EnhancedCustomShape3d.cxx | 2 - svx/source/dialog/graphctl.cxx | 3 -- svx/source/svdraw/svdmodel.cxx | 31 ++-------------------- svx/source/svdraw/svdograf.cxx | 8 ++--- svx/source/svdraw/svdotext.cxx | 4 +- svx/source/svdraw/svdxcgv.cxx | 14 ++++----- svx/source/unodraw/UnoGraphicExporter.cxx | 17 ++++-------- 12 files changed, 25 insertions(+), 67 deletions(-)
New commits: commit 743dd1d3c1142c1c99b0844cc26dd0be91a1de40 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Mon Jan 30 14:44:01 2023 +0900 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Tue Jan 31 05:47:27 2023 +0000 SdrModel: we never set scale fraction to anything else than 1/1 This removes the scale fraction on SdrModel - SetScaleFraction and the m_aObjUnit instance variable, as it is never set to anything else than 1/1 (and don't see it usefult to set it to anything else than this). Change-Id: I990d20f110b3be00e6770b68e39df212f9c576be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146348 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/chart2/source/view/main/DrawModelWrapper.cxx b/chart2/source/view/main/DrawModelWrapper.cxx index 6a6488435f97..1767d2ccdb6b 100644 --- a/chart2/source/view/main/DrawModelWrapper.cxx +++ b/chart2/source/view/main/DrawModelWrapper.cxx @@ -48,8 +48,6 @@ DrawModelWrapper::DrawModelWrapper() { m_xChartItemPool = ChartItemPool::CreateChartItemPool(); - SetScaleUnit(MapUnit::Map100thMM); - SetScaleFraction(Fraction(1, 1)); SetDefaultFontHeight(423); // 12pt SfxItemPool* pMasterPool = &GetItemPool(); diff --git a/include/svx/svdetc.hxx b/include/svx/svdetc.hxx index e6d448bfb691..266fba753f97 100644 --- a/include/svx/svdetc.hxx +++ b/include/svx/svdetc.hxx @@ -77,9 +77,6 @@ namespace SdrEngineDefaults // Incidentally, every newly instantiated SdrModel is assigned this MapMode by default. // Default MapUnit is MapUnit::Map100thMM inline MapUnit GetMapUnit() { return MapUnit::Map100thMM; } - - // Default MapFraction is 1/1. - inline Fraction GetMapFraction() { return Fraction(1, 1); } }; class SfxItemSet; diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx index 3eac3de05489..76c63a40d351 100644 --- a/include/svx/svdmodel.hxx +++ b/include/svx/svdmodel.hxx @@ -173,7 +173,6 @@ protected: std::vector<rtl::Reference<SdrPage>> maPages; std::function<void(std::unique_ptr<SdrUndoAction>)> m_aUndoLink; // link to a NotifyUndo-Handler Size m_aMaxObjSize; // e.g. for auto-growing text - Fraction m_aObjUnit; // description of the coordinate units for ClipBoard, Drag&Drop, ... MapUnit m_eObjUnit; // see above FieldUnit m_eUIUnit; // unit, scale (e.g. 1/1000) for the UI (status bar) is set by ImpSetUIUnit() Fraction m_aUIScale; // see above @@ -370,10 +369,6 @@ public: // with the correct sizes. MapUnit GetScaleUnit() const { return m_eObjUnit; } void SetScaleUnit(MapUnit eMap); - const Fraction& GetScaleFraction() const { return m_aObjUnit; } - void SetScaleFraction(const Fraction& rFrac); - // Setting both simultaneously performs a little better - void SetScaleUnit(MapUnit eMap, const Fraction& rFrac); // maximal size e.g. for auto growing texts const Size& GetMaxObjSize() const { return m_aMaxObjSize; } diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index d3d5b1063694..90033352f1c9 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -165,7 +165,6 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh) SetUIUnit( static_cast<FieldUnit>(pOptions->GetMetric()), Fraction( 1, 1 ) ); // default SetScaleUnit(MapUnit::Map100thMM); - SetScaleFraction(Fraction(1, 1)); SetDefaultFontHeight(o3tl::convert(24, o3tl::Length::pt, o3tl::Length::mm100)); m_pItemPool->SetDefaultMetric(MapUnit::Map100thMM); diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index 7e7d42dacd92..d9345cc3de95 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(), mpSdDrawDocumentIntern->GetScaleFraction(), mpSdDrawDocumentIntern->GetScaleFraction() ) ); + mpVDev->SetMapMode(MapMode(mpSdDrawDocumentIntern->GetScaleUnit(), Point(), Fraction(1,1), Fraction(1,1))); 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 baaf37a4162c..9a0ef6bebf92 100644 --- a/svx/source/customshapes/EnhancedCustomShape3d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx @@ -238,7 +238,7 @@ 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( rSdrObjCustomShape.getSdrModelFromSdrObject().GetScaleFraction() ); + Fraction aFraction(1, 1); if ( aFraction.GetNumerator() != 1 || aFraction.GetDenominator() != 1 ) { diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx index 136eae27b52c..12416b6beaa6 100644 --- a/svx/source/dialog/graphctl.cxx +++ b/svx/source/dialog/graphctl.cxx @@ -122,8 +122,7 @@ void GraphCtrl::InitSdrModel() // Creating a Model pModel.reset(new SdrModel(nullptr, nullptr, true)); pModel->GetItemPool().FreezeIdRanges(); - pModel->SetScaleUnit( aMap100.GetMapUnit() ); - pModel->SetScaleFraction( Fraction( 1, 1 ) ); + pModel->SetScaleUnit(aMap100.GetMapUnit()); pModel->SetDefaultFontHeight( 500 ); pPage = new SdrPage( *pModel ); diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 28ec1e556f23..73d99b29d5ad 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -96,8 +96,7 @@ struct SdrModelImpl SdrModel::SdrModel(SfxItemPool* pPool, comphelper::IEmbeddedHelper* pEmbeddedHelper, bool bDisablePropertyFiles) - : m_aObjUnit(SdrEngineDefaults::GetMapFraction()) - , m_eObjUnit(SdrEngineDefaults::GetMapUnit()) + : m_eObjUnit(SdrEngineDefaults::GetMapUnit()) , m_eUIUnit(FieldUnit::MM) , m_aUIScale(Fraction(1,1)) , m_nUIUnitDecimalMark(0) @@ -582,7 +581,7 @@ void SdrModel::ClearModel(bool bCalledFromDestructor) SdrModel* SdrModel::AllocModel() const { SdrModel* pModel=new SdrModel(); - pModel->SetScaleUnit(m_eObjUnit,m_aObjUnit); + pModel->SetScaleUnit(m_eObjUnit); return pModel; } @@ -683,7 +682,7 @@ void SdrModel::ImpSetOutlinerDefaults( SdrOutliner* pOutliner, bool bInit ) if ( !GetRefDevice() ) { - MapMode aMapMode(m_eObjUnit, Point(0,0), m_aObjUnit, m_aObjUnit); + MapMode aMapMode(m_eObjUnit, Point(0,0), Fraction(1,1), Fraction(1,1)); pOutliner->SetRefMapMode(aMapMode); } } @@ -871,19 +870,6 @@ void SdrModel::ImpSetUIUnit() m_aUIUnitStr = GetUnitString(m_eUIUnit); } -void SdrModel::SetScaleUnit(MapUnit eMap, const Fraction& rFrac) -{ - if (m_eObjUnit!=eMap || m_aObjUnit!=rFrac) { - m_eObjUnit=eMap; - m_aObjUnit=rFrac; - m_pItemPool->SetDefaultMetric(m_eObjUnit); - ImpSetUIUnit(); - ImpSetOutlinerDefaults( m_pDrawOutliner.get() ); - ImpSetOutlinerDefaults( m_pHitTestOutliner.get() ); - ImpReformatAllTextObjects(); - } -} - void SdrModel::SetScaleUnit(MapUnit eMap) { if (m_eObjUnit!=eMap) { @@ -896,17 +882,6 @@ void SdrModel::SetScaleUnit(MapUnit eMap) } } -void SdrModel::SetScaleFraction(const Fraction& rFrac) -{ - if (m_aObjUnit!=rFrac) { - m_aObjUnit=rFrac; - ImpSetUIUnit(); - ImpSetOutlinerDefaults( m_pDrawOutliner.get() ); - ImpSetOutlinerDefaults( m_pHitTestOutliner.get() ); - ImpReformatAllTextObjects(); - } -} - void SdrModel::SetUIUnit(FieldUnit eUnit) { if (m_eUIUnit!=eUnit) { diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 1c1be8a7a69a..9ac5536c5716 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -390,8 +390,8 @@ Graphic SdrGrafObj::GetTransformedGraphic( SdrGrafObjTransformsAttrs nTransformF MapMode aDestMap( getSdrModelFromSdrObject().GetScaleUnit(), Point(), - getSdrModelFromSdrObject().GetScaleFraction(), - getSdrModelFromSdrObject().GetScaleFraction()); + Fraction(1,1), + Fraction(1,1)); const Size aDestSize( GetLogicRect().GetSize() ); GraphicAttr aActAttr = GetGraphicAttr(nTransformFlags); @@ -872,8 +872,8 @@ GDIMetaFile SdrGrafObj::getMetafileFromEmbeddedVectorGraphicData() const const MapMode aMap( getSdrModelFromSdrObject().GetScaleUnit(), Point(), - getSdrModelFromSdrObject().GetScaleFraction(), - getSdrModelFromSdrObject().GetScaleFraction()); + Fraction(1,1), + Fraction(1,1)); pOut->EnableOutput(false); pOut->SetMapMode(aMap); diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index 6e47273fe175..ad27f101c6cb 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -1327,8 +1327,8 @@ void SdrTextObj::UpdateOutlinerFormatting( SdrOutliner& rOutl, tools::Rectangle& const MapMode aMapMode( getSdrModelFromSdrObject().GetScaleUnit(), Point(0,0), - getSdrModelFromSdrObject().GetScaleFraction(), - getSdrModelFromSdrObject().GetScaleFraction()); + Fraction(1,1), + Fraction(1,1)); rOutl.SetRefMapMode(aMapMode); ImpSetupDrawOutlinerForPaint( diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index f579a50911e4..3ae384d344d8 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -162,8 +162,8 @@ bool SdrExchangeView::Paste(const OUString& rStr, const Point& rPos, SdrObjList* pObj->FitFrameToTextSize(); Size aSiz(pObj->GetLogicRect().GetSize()); - MapUnit eMap=mpModel->GetScaleUnit(); - Fraction aMap=mpModel->GetScaleFraction(); + MapUnit eMap = mpModel->GetScaleUnit(); + Fraction aMap(1,1); ImpPasteObject(pObj.get(),*pLst,aPos,aSiz,MapMode(eMap,Point(0,0),aMap,aMap),nOptions); return true; } @@ -203,7 +203,7 @@ bool SdrExchangeView::Paste(SvStream& rInput, EETextFormat eFormat, const Point& pObj->FitFrameToTextSize(); Size aSiz(pObj->GetLogicRect().GetSize()); MapUnit eMap=mpModel->GetScaleUnit(); - Fraction aMap=mpModel->GetScaleFraction(); + Fraction aMap(1,1); ImpPasteObject(pObj.get(),*pLst,aPos,aSiz,MapMode(eMap,Point(0,0),aMap,aMap),nOptions); // b4967543 @@ -401,7 +401,7 @@ void SdrExchangeView::ImpPasteObject(SdrObject* pObj, SdrObjList& rLst, const Po MapUnit eSrcMU=rMap.GetMapUnit(); MapUnit eDstMU=mpModel->GetScaleUnit(); FrPair aMapFact(GetMapFactor(eSrcMU,eDstMU)); - Fraction aDstFr(mpModel->GetScaleFraction()); + Fraction aDstFr(1,1); nSizX *= double(aMapFact.X() * rMap.GetScaleX() * aDstFr); nSizX *= aDstFr.GetDenominator(); nSizY *= double(aMapFact.Y() * rMap.GetScaleY()); @@ -530,7 +530,7 @@ GDIMetaFile SdrExchangeView::GetMarkedObjMetaFile(bool bNoVDevIfOneMtfMarked) co { tools::Rectangle aBound( GetMarkedObjBoundRect() ); Size aBoundSize( aBound.GetWidth(), aBound.GetHeight() ); - MapMode aMap( mpModel->GetScaleUnit(), Point(), mpModel->GetScaleFraction(), mpModel->GetScaleFraction() ); + MapMode aMap(mpModel->GetScaleUnit(), Point(), Fraction(1,1), Fraction(1,1)); if( bNoVDevIfOneMtfMarked ) { @@ -650,8 +650,8 @@ Graphic SdrExchangeView::GetObjGraphic(const SdrObject& rSdrObject) const tools::Rectangle aBoundRect(rSdrObject.GetCurrentBoundRect()); const MapMode aMap(rSdrObject.getSdrModelFromSdrObject().GetScaleUnit(), Point(), - rSdrObject.getSdrModelFromSdrObject().GetScaleFraction(), - rSdrObject.getSdrModelFromSdrObject().GetScaleFraction()); + Fraction(1,1), + Fraction(1,1)); pOut->EnableOutput(false); pOut->SetMapMode(aMap); diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index 66af82d6baac..6698dd0e34a8 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -112,24 +112,19 @@ namespace { TriState meAntiAliasing = TRISTATE_INDET; - explicit ExportSettings(const SdrModel* pSdrModel); + explicit ExportSettings(); }; - ExportSettings::ExportSettings(const SdrModel* pSdrModel) + ExportSettings::ExportSettings() : mnWidth( 0 ) ,mnHeight( 0 ) ,mbExportOnlyBackground( false ) ,mbScrollText( false ) ,mbUseHighContrast( false ) ,mbTranslucent( false ) - ,maScaleX( 1, 1 ) - ,maScaleY( 1, 1 ) + ,maScaleX(1, 1) + ,maScaleY(1, 1) { - if (pSdrModel) - { - maScaleX = pSdrModel->GetScaleFraction(); - maScaleY = pSdrModel->GetScaleFraction(); - } } /** implements a component to export shapes or pages to external graphic formats. @@ -1012,7 +1007,7 @@ sal_Bool SAL_CALL GraphicExporter::filter( const Sequence< PropertyValue >& aDes GraphicFilter &rFilter = GraphicFilter::GetGraphicFilter(); // get the arguments from the descriptor - ExportSettings aSettings(mpDoc); + ExportSettings aSettings; ParseSettings(aDescriptor, aSettings); const sal_uInt16 nFilter = !aSettings.maMediaType.isEmpty() @@ -1300,7 +1295,7 @@ Graphic SvxGetGraphicForShape( SdrObject& rShape ) rtl::Reference< GraphicExporter > xExporter( new GraphicExporter() ); Reference< XComponent > xComp( rShape.getUnoShape(), UNO_QUERY_THROW ); xExporter->setSourceDocument( xComp ); - ExportSettings aSettings(&rShape.getSdrModelFromSdrObject()); + ExportSettings aSettings; xExporter->GetGraphic( aSettings, aGraphic, true/*bVector*/ ); } catch( Exception& )