chart2/source/view/main/DrawModelWrapper.cxx | 2 - include/svx/svdetc.hxx | 3 -- include/svx/svdmodel.hxx | 6 ----- sd/source/core/drawdoc.cxx | 1 svx/source/dialog/graphctl.cxx | 3 -- svx/source/svdraw/svdmodel.cxx | 31 ++------------------------- 6 files changed, 5 insertions(+), 41 deletions(-)
New commits: commit 3209bcd03fa2753e26b5fcd7b8772165f55b46d8 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Mon Jan 30 14:44:01 2023 +0900 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Jan 30 18:54:15 2023 +0900 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 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..fcb146db1568 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,7 @@ 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); + Fraction GetScaleFraction() const { return Fraction(1,1); } // 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 f5eb37bcbd6d..adb5f3a6a227 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/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx index 23ed146d53b1..b560a25c514a 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) {