diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-01-04 18:50:01 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-01-06 07:15:48 +0100 |
commit | 0b0934056b47485527442b6366d7fd3274a4601f (patch) | |
tree | a997a63ebdd694ad0d22a989a476a757ad11e64c /svx | |
parent | ea545653e17e687c9069543897975b3726dc6a2b (diff) |
bypass SvxShape when creating rectangles in chart2
Change-Id: I461449959fffa8948bf4321a6c3114505d87a149
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127997
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svdobj.cxx | 18 | ||||
-rw-r--r-- | svx/source/unodraw/unoshape.cxx | 14 |
2 files changed, 19 insertions, 13 deletions
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index e6582e597864..9cd2d1b5cde0 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -123,6 +123,7 @@ #include <svx/scene3d.hxx> #include <rtl/character.hxx> +#include <tools/UnitConversion.hxx> using namespace ::com::sun::star; @@ -3149,6 +3150,23 @@ void SdrObject::MakeNameUnique(std::unordered_set<OUString>& rNameSet) SetName(sName); } +void SdrObject::ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const noexcept +{ + MapUnit eMapUnit(getSdrModelFromSdrObject().GetItemPool().GetMetric(0)); + if(eMapUnit == MapUnit::Map100thMM) + return; + + if (const auto eTo = MapToO3tlLength(eMapUnit); eTo != o3tl::Length::invalid) + { + const double fConvert(o3tl::convert(1.0, o3tl::Length::mm100, eTo)); + rPolyPolygon.transform(basegfx::utils::createScaleB2DHomMatrix(fConvert, fConvert)); + } + else + { + OSL_FAIL("Missing unit translation to PoolMetric!"); + } +} + SdrObject* SdrObjFactory::CreateObjectFromFactory(SdrModel& rSdrModel, SdrInventor nInventor, SdrObjKind nObjIdentifier) { SdrObjCreatorParams aParams { nInventor, nObjIdentifier, rSdrModel }; diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 94a7b2540ec6..0b2535831d39 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -465,19 +465,7 @@ void SvxShape::ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon if(!HasSdrObject()) return; - MapUnit eMapUnit(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0)); - if(eMapUnit == MapUnit::Map100thMM) - return; - - if (const auto eTo = MapToO3tlLength(eMapUnit); eTo != o3tl::Length::invalid) - { - const double fConvert(o3tl::convert(1.0, o3tl::Length::mm100, eTo)); - rPolyPolygon.transform(basegfx::utils::createScaleB2DHomMatrix(fConvert, fConvert)); - } - else - { - OSL_FAIL("Missing unit translation to PoolMetric!"); - } + GetSdrObject()->ForceMetricToItemPoolMetric(rPolyPolygon); } void SvxShape::ForceMetricToItemPoolMetric(basegfx::B2DHomMatrix& rB2DHomMatrix) const noexcept |