diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2018-05-02 18:24:09 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2018-05-03 00:27:37 +0200 |
commit | d57033ddf8eaa2f6992ac7d89c33dc47c7293492 (patch) | |
tree | e550e14925a64db3402fc993d6d55bbf8dc214e1 /svx | |
parent | 52b6e4c9e508af0db7f942b30735bec1bb184399 (diff) |
tdf#117145 Cleanup MapMode handling between SdrModel/UNO API
In current versions MapMode handling is done in ::TRSet/Get-
BaseGeometry methods. These belong to SdrModel level and
should not do any MapMode conversions (else all geometry
and Rectangle setters/getters should have to do these, too).
Instead, the UNO API implementation should do these, there
are already some done there and this is the level which offers
pure 100ThMM handling to the caller, independent from the
used application.
Change-Id: I3d7781440fc0fc6a20b5d4e79c747c988677483d
Reviewed-on: https://gerrit.libreoffice.org/53748
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svddrgmt.cxx | 15 | ||||
-rw-r--r-- | svx/source/svdraw/svdoashp.cxx | 50 | ||||
-rw-r--r-- | svx/source/svdraw/svdobj.cxx | 55 | ||||
-rw-r--r-- | svx/source/svdraw/svdocapt.cxx | 26 | ||||
-rw-r--r-- | svx/source/svdraw/svdomeas.cxx | 48 | ||||
-rw-r--r-- | svx/source/svdraw/svdopath.cxx | 62 | ||||
-rw-r--r-- | svx/source/svdraw/svdotext.cxx | 50 | ||||
-rw-r--r-- | svx/source/unodraw/unoshap2.cxx | 24 | ||||
-rw-r--r-- | svx/source/unodraw/unoshape.cxx | 84 |
9 files changed, 109 insertions, 305 deletions
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index 347724576bcb..be78cd90fc93 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -68,6 +68,7 @@ #include <basegfx/matrix/b2dhommatrixtools.hxx> #include <drawinglayer/attribute/sdrlineattribute.hxx> #include <drawinglayer/attribute/sdrlinestartendattribute.hxx> +#include <svl/itempool.hxx> #include <map> #include <vector> @@ -3804,17 +3805,23 @@ bool SdrDragCrop::EndSdrDrag(bool /*bCopy*/) return false; } - const GraphicObject& rGraphicObject = pObj->GetGraphicObject(); - const MapMode aMapMode100thmm(MapUnit::Map100thMM); + const GraphicObject& rGraphicObject(pObj->GetGraphicObject()); + // tdf#117145 Usually Writer will go the bExternal path (see above), but more correct for + // the future is to use the MapMode from the SdrModel/SfxItemPool if the Writer's current + // special handling should be unified to this path in the future. Usually it *should* be + // MapUnit::Map100thMM, but better do not mix up Units. + // Checked now what SwVirtFlyDrawObj::NbcCrop is doing - it calculates everything forced + // to MapUnit::Map100thMM, but extracts/packs Twips to the used SdrGrafCropItem in Writer. + const MapMode aMapModePool(pObj->getSdrModelFromSdrObject().GetItemPool().GetMetric(0)); Size aGraphicSize(rGraphicObject.GetPrefSize()); if(MapUnit::MapPixel == rGraphicObject.GetPrefMapMode().GetMapUnit()) { - aGraphicSize = Application::GetDefaultDevice()->PixelToLogic(aGraphicSize, aMapMode100thmm); + aGraphicSize = Application::GetDefaultDevice()->PixelToLogic(aGraphicSize, aMapModePool); } else { - aGraphicSize = OutputDevice::LogicToLogic(aGraphicSize, rGraphicObject.GetPrefMapMode(), aMapMode100thmm); + aGraphicSize = OutputDevice::LogicToLogic(aGraphicSize, rGraphicObject.GetPrefMapMode(), aMapModePool); } if(0 == aGraphicSize.Width() || 0 == aGraphicSize.Height()) diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 26a947a830cb..0479eb198dcd 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -2913,31 +2913,6 @@ void SdrObjCustomShape::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, aGeo.nShearAngle = 0; aGeo.RecalcTan(); - // force metric to pool metric - const MapUnit eMapUnit(GetObjectMapUnit()); - if(eMapUnit != MapUnit::Map100thMM) - { - switch(eMapUnit) - { - case MapUnit::MapTwip : - { - // position - aTranslate.setX(ImplMMToTwips(aTranslate.getX())); - aTranslate.setY(ImplMMToTwips(aTranslate.getY())); - - // size - aScale.setX(ImplMMToTwips(aScale.getX())); - aScale.setY(ImplMMToTwips(aScale.getY())); - - break; - } - default: - { - OSL_FAIL("TRSetBaseGeometry: Missing unit translation to PoolMetric!"); - } - } - } - // if anchor is used, make position relative to it if(getSdrModelFromSdrObject().IsWriter()) { @@ -3064,31 +3039,6 @@ bool SdrObjCustomShape::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegf } } - // force MapUnit to 100th mm - const MapUnit eMapUnit(GetObjectMapUnit()); - if(eMapUnit != MapUnit::Map100thMM) - { - switch(eMapUnit) - { - case MapUnit::MapTwip : - { - // position - aTranslate.setX(ImplTwipsToMM(aTranslate.getX())); - aTranslate.setY(ImplTwipsToMM(aTranslate.getY())); - - // size - aScale.setX(ImplTwipsToMM(aScale.getX())); - aScale.setY(ImplTwipsToMM(aScale.getY())); - - break; - } - default: - { - OSL_FAIL("TRGetBaseGeometry: Missing unit translation to 100th mm!"); - } - } - } - // build matrix rMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix( aScale, diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 83b627998226..dbe1b1b66c2e 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -1917,11 +1917,6 @@ const SfxPoolItem& SdrObject::GetObjectItem(const sal_uInt16 nWhich) const return GetObjectItemSet().Get(nWhich); } -MapUnit SdrObject::GetObjectMapUnit() const -{ - return GetObjectItemPool().GetMetric(0); -} - const SfxPoolItem& SdrObject::GetMergedItem(const sal_uInt16 nWhich) const { return GetMergedItemSet().Get(nWhich); @@ -2872,31 +2867,6 @@ bool SdrObject::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPo } } - // force MapUnit to 100th mm - const MapUnit eMapUnit(GetObjectMapUnit()); - if(eMapUnit != MapUnit::Map100thMM) - { - switch(eMapUnit) - { - case MapUnit::MapTwip : - { - // position - aTranslate.setX(ImplTwipsToMM(aTranslate.getX())); - aTranslate.setY(ImplTwipsToMM(aTranslate.getY())); - - // size - aScale.setX(ImplTwipsToMM(aScale.getX())); - aScale.setY(ImplTwipsToMM(aScale.getY())); - - break; - } - default: - { - OSL_FAIL("TRGetBaseGeometry: Missing unit translation to 100th mm!"); - } - } - } - // build matrix rMatrix = basegfx::utils::createScaleTranslateB2DHomMatrix(aScale, aTranslate); @@ -2922,31 +2892,6 @@ void SdrObject::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const ba aScale.setY(fabs(aScale.getY())); } - // force metric to pool metric - const MapUnit eMapUnit(GetObjectMapUnit()); - if(eMapUnit != MapUnit::Map100thMM) - { - switch(eMapUnit) - { - case MapUnit::MapTwip : - { - // position - aTranslate.setX(ImplMMToTwips(aTranslate.getX())); - aTranslate.setY(ImplMMToTwips(aTranslate.getY())); - - // size - aScale.setX(ImplMMToTwips(aScale.getX())); - aScale.setY(ImplMMToTwips(aScale.getY())); - - break; - } - default: - { - OSL_FAIL("TRSetBaseGeometry: Missing unit translation to PoolMetric!"); - } - } - } - // if anchor is used, make position relative to it if(getSdrModelFromSdrObject().IsWriter()) { diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx index 47d51561375e..035582dda722 100644 --- a/svx/source/svdraw/svdocapt.cxx +++ b/svx/source/svdraw/svdocapt.cxx @@ -758,32 +758,6 @@ void SdrCaptionObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, cons handleNegativeScale(aScale, &fRotate); - // force metric to pool metric - MapUnit eMapUnit(getSdrModelFromSdrObject().GetItemPool().GetMetric(0)); - - if(eMapUnit != MapUnit::Map100thMM) - { - switch(eMapUnit) - { - case MapUnit::MapTwip : - { - // position - aTranslate.setX(ImplMMToTwips(aTranslate.getX())); - aTranslate.setY(ImplMMToTwips(aTranslate.getY())); - - // size - aScale.setX(ImplMMToTwips(aScale.getX())); - aScale.setY(ImplMMToTwips(aScale.getY())); - - break; - } - default: - { - OSL_FAIL("TRSetBaseGeometry: Missing unit translation to PoolMetric!"); - } - } - } - // if anchor is used, make position relative to it if(getSdrModelFromSdrObject().IsWriter()) { diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx index 9cbb15df0e17..64b1db6891ae 100644 --- a/svx/source/svdraw/svdomeas.cxx +++ b/svx/source/svdraw/svdomeas.cxx @@ -1392,31 +1392,6 @@ bool SdrMeasureObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B } } - // force MapUnit to 100th mm - MapUnit eMapUnit = getSdrModelFromSdrObject().GetItemPool().GetMetric(0); - if(eMapUnit != MapUnit::Map100thMM) - { - switch(eMapUnit) - { - case MapUnit::MapTwip : - { - // position - aTranslate.setX(ImplTwipsToMM(aTranslate.getX())); - aTranslate.setY(ImplTwipsToMM(aTranslate.getY())); - - // size - aScale.setX(ImplTwipsToMM(aScale.getX())); - aScale.setY(ImplTwipsToMM(aScale.getY())); - - break; - } - default: - { - OSL_FAIL("TRGetBaseGeometry: Missing unit translation to 100th mm!"); - } - } - } - // build return value matrix rMatrix = basegfx::utils::createScaleTranslateB2DHomMatrix(aScale, aTranslate); @@ -1429,29 +1404,6 @@ void SdrMeasureObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, cons basegfx::B2DPoint aPosA(rMatrix * basegfx::B2DPoint(0.0, 0.0)); basegfx::B2DPoint aPosB(rMatrix * basegfx::B2DPoint(1.0, 0.0)); - // force metric to pool metric - MapUnit eMapUnit = getSdrModelFromSdrObject().GetItemPool().GetMetric(0); - if(eMapUnit != MapUnit::Map100thMM) - { - switch(eMapUnit) - { - case MapUnit::MapTwip : - { - // position - aPosA.setX(ImplMMToTwips(aPosA.getX())); - aPosA.setY(ImplMMToTwips(aPosA.getY())); - aPosB.setX(ImplMMToTwips(aPosB.getX())); - aPosB.setY(ImplMMToTwips(aPosB.getY())); - - break; - } - default: - { - OSL_FAIL("TRSetBaseGeometry: Missing unit translation to PoolMetric!"); - } - } - } - if( getSdrModelFromSdrObject().IsWriter() ) { // if anchor is used, make position relative to it diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index 5270b223dc77..01e5df703421 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -2894,37 +2894,6 @@ bool SdrPathObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DP } } - // force MapUnit to 100th mm - const MapUnit eMapUnit(GetObjectMapUnit()); - if(eMapUnit != MapUnit::Map100thMM) - { - switch(eMapUnit) - { - case MapUnit::MapTwip : - { - // position - aTranslate.setX(ImplTwipsToMM(aTranslate.getX())); - aTranslate.setY(ImplTwipsToMM(aTranslate.getY())); - - // size - aScale.setX(ImplTwipsToMM(aScale.getX())); - aScale.setY(ImplTwipsToMM(aScale.getY())); - - // polygon - basegfx::B2DHomMatrix aTwipsToMM; - const double fFactorTwipsToMM(127.0 / 72.0); - aTwipsToMM.scale(fFactorTwipsToMM, fFactorTwipsToMM); - rPolyPolygon.transform(aTwipsToMM); - - break; - } - default: - { - OSL_FAIL("TRGetBaseGeometry: Missing unit translation to 100th mm!"); - } - } - } - // build return value matrix rMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix( aScale, @@ -2964,37 +2933,6 @@ void SdrPathObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b aGeo.nShearAngle = 0; aGeo.RecalcTan(); - // force metric to pool metric - const MapUnit eMapUnit(GetObjectMapUnit()); - if(eMapUnit != MapUnit::Map100thMM) - { - switch(eMapUnit) - { - case MapUnit::MapTwip : - { - // position - aTranslate.setX(ImplMMToTwips(aTranslate.getX())); - aTranslate.setY(ImplMMToTwips(aTranslate.getY())); - - // size - aScale.setX(ImplMMToTwips(aScale.getX())); - aScale.setY(ImplMMToTwips(aScale.getY())); - - // polygon - basegfx::B2DHomMatrix aMMToTwips; - const double fFactorMMToTwips(72.0 / 127.0); - aMMToTwips.scale(fFactorMMToTwips, fFactorMMToTwips); - aNewPolyPolygon.transform(aMMToTwips); - - break; - } - default: - { - OSL_FAIL("TRSetBaseGeometry: Missing unit translation to PoolMetric!"); - } - } - } - if( getSdrModelFromSdrObject().IsWriter() ) { // if anchor is used, make position relative to it diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index d221d28b1530..d45af2c7b181 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -1643,31 +1643,6 @@ bool SdrTextObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DP } } - // force MapUnit to 100th mm - const MapUnit eMapUnit(GetObjectMapUnit()); - if(eMapUnit != MapUnit::Map100thMM) - { - switch(eMapUnit) - { - case MapUnit::MapTwip : - { - // position - aTranslate.setX(ImplTwipsToMM(aTranslate.getX())); - aTranslate.setY(ImplTwipsToMM(aTranslate.getY())); - - // size - aScale.setX(ImplTwipsToMM(aScale.getX())); - aScale.setY(ImplTwipsToMM(aScale.getY())); - - break; - } - default: - { - OSL_FAIL("TRGetBaseGeometry: Missing unit translation to 100th mm!"); - } - } - } - // build matrix rMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix( aScale, @@ -1708,31 +1683,6 @@ void SdrTextObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b aGeo.nShearAngle = 0; aGeo.RecalcTan(); - // force metric to pool metric - const MapUnit eMapUnit(GetObjectMapUnit()); - if(eMapUnit != MapUnit::Map100thMM) - { - switch(eMapUnit) - { - case MapUnit::MapTwip : - { - // position - aTranslate.setX(ImplMMToTwips(aTranslate.getX())); - aTranslate.setY(ImplMMToTwips(aTranslate.getY())); - - // size - aScale.setX(ImplMMToTwips(aScale.getX())); - aScale.setY(ImplMMToTwips(aScale.getY())); - - break; - } - default: - { - OSL_FAIL("TRSetBaseGeometry: Missing unit translation to PoolMetric!"); - } - } - } - // if anchor is used, make position relative to it if( getSdrModelFromSdrObject().IsWriter() ) { diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx index 2c4c2999a1cf..6a726a7deca0 100644 --- a/svx/source/unodraw/unoshap2.cxx +++ b/svx/source/unodraw/unoshap2.cxx @@ -985,6 +985,11 @@ bool SvxShapePolyPolygon::setPropertyValueImpl( const OUString& rName, const Sfx GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon); aNewPolyPolygon = ImplSvxPointSequenceSequenceToB2DPolyPolygon(s); + + // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm + // Need to adapt aNewPolyPolygon from 100thmm to app-specific + ForceMetricToItemPoolMetric(aNewPolyPolygon); + GetSdrObject()->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon); } return true; @@ -1089,8 +1094,14 @@ bool SvxShapePolyPolygon::getPropertyValueImpl( const OUString& rName, const Sfx basegfx::B2DHomMatrix aNewHomogenMatrix; if(HasSdrObject()) + { GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon); + // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm + // Need to adapt aNewPolyPolygon from app-specific to 100thmm + ForceMetricTo100th_mm(aNewPolyPolygon); + } + drawing::PointSequenceSequence aRetval(aNewPolyPolygon.count()); B2DPolyPolygonToSvxPointSequenceSequence(aNewPolyPolygon, aRetval); rValue <<= aRetval; @@ -1196,8 +1207,12 @@ bool SvxShapePolyPolygonBezier::setPropertyValueImpl( const OUString& rName, con basegfx::B2DHomMatrix aNewHomogenMatrix; GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon); - aNewPolyPolygon = basegfx::unotools::polyPolygonBezierToB2DPolyPolygon( - *s); + aNewPolyPolygon = basegfx::unotools::polyPolygonBezierToB2DPolyPolygon(*s); + + // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm + // Need to adapt aNewPolyPolygon from 100thmm to app-specific + ForceMetricToItemPoolMetric(aNewPolyPolygon); + GetSdrObject()->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon); } return true; @@ -1232,6 +1247,11 @@ bool SvxShapePolyPolygonBezier::getPropertyValueImpl( const OUString& rName, con basegfx::B2DPolyPolygon aNewPolyPolygon; basegfx::B2DHomMatrix aNewHomogenMatrix; GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon); + + // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm + // Need to adapt aNewPolyPolygon from app-specific to 100thmm + ForceMetricTo100th_mm(aNewPolyPolygon); + drawing::PolyPolygonBezierCoords aRetval; basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier(aNewPolyPolygon, aRetval); diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index e12bbf4c5c93..33299173e71e 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -471,7 +471,6 @@ void SvxShape::ForceMetricToItemPoolMetric(Pair& rPoint) const throw() } } -// Reintroduction of fix for issue i59051 (#i108851#) void SvxShape::ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const throw() { DBG_TESTSOLARMUTEX(); @@ -500,6 +499,35 @@ void SvxShape::ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon } } +void SvxShape::ForceMetricToItemPoolMetric(basegfx::B2DHomMatrix& rB2DHomMatrix) const throw() +{ + DBG_TESTSOLARMUTEX(); + if(HasSdrObject()) + { + MapUnit eMapUnit(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0)); + if(eMapUnit != MapUnit::Map100thMM) + { + switch(eMapUnit) + { + case MapUnit::MapTwip : + { + const double fMMToTWIPS(72.0 / 127.0); + const basegfx::utils::B2DHomMatrixBufferedDecompose aDecomposedTransform(rB2DHomMatrix); + rB2DHomMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix( + aDecomposedTransform.getScale() * fMMToTWIPS, + aDecomposedTransform.getShearX(), + aDecomposedTransform.getRotate(), + aDecomposedTransform.getTranslate() * fMMToTWIPS); + break; + } + default: + { + OSL_FAIL("Missing unit translation to PoolMetric!"); + } + } + } + } +} void SvxShape::ForceMetricTo100th_mm(Pair& rPoint) const throw() { @@ -527,7 +555,6 @@ void SvxShape::ForceMetricTo100th_mm(Pair& rPoint) const throw() } } -// Reintroduction of fix for issue i59051 (#i108851#) void SvxShape::ForceMetricTo100th_mm(basegfx::B2DPolyPolygon& rPolyPolygon) const throw() { DBG_TESTSOLARMUTEX(); @@ -556,6 +583,36 @@ void SvxShape::ForceMetricTo100th_mm(basegfx::B2DPolyPolygon& rPolyPolygon) cons } } +void SvxShape::ForceMetricTo100th_mm(basegfx::B2DHomMatrix& rB2DHomMatrix) const throw() +{ + DBG_TESTSOLARMUTEX(); + MapUnit eMapUnit = MapUnit::Map100thMM; + if(HasSdrObject()) + { + eMapUnit = GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0); + if(eMapUnit != MapUnit::Map100thMM) + { + switch(eMapUnit) + { + case MapUnit::MapTwip : + { + const double fTWIPSToMM(127.0 / 72.0); + const basegfx::utils::B2DHomMatrixBufferedDecompose aDecomposedTransform(rB2DHomMatrix); + rB2DHomMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix( + aDecomposedTransform.getScale() * fTWIPSToMM, + aDecomposedTransform.getShearX(), + aDecomposedTransform.getRotate(), + aDecomposedTransform.getTranslate() * fTWIPSToMM); + break; + } + default: + { + OSL_FAIL("Missing unit translation to 100th mm!"); + } + } + } + } +} void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet, SfxItemSet& rSet, const uno::Reference< beans::XPropertySet >& xSet, const SfxItemPropertyMap* pMap ) @@ -2031,6 +2088,10 @@ bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertySimpl { Point aVclPoint( aPnt.X, aPnt.Y ); + // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm + // Need to adapt aVclPoint from 100thmm to app-specific + ForceMetricToItemPoolMetric(aVclPoint); + // #90763# position is relative to top left, make it absolute basegfx::B2DPolyPolygon aNewPolyPolygon; basegfx::B2DHomMatrix aNewHomogenMatrix; @@ -2039,9 +2100,6 @@ bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertySimpl aVclPoint.AdjustX(basegfx::fround(aNewHomogenMatrix.get(0, 2)) ); aVclPoint.AdjustY(basegfx::fround(aNewHomogenMatrix.get(1, 2)) ); - // #88657# metric of pool maybe twips (writer) - ForceMetricToItemPoolMetric(aVclPoint); - // #88491# position relative to anchor if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() ) { @@ -2062,6 +2120,7 @@ bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertySimpl basegfx::B2DPolyPolygon aNewPolyPolygon; basegfx::B2DHomMatrix aNewHomogenMatrix; + // tdf#117145 SdrModel data is app-specific GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon); aNewHomogenMatrix.set(0, 0, aMatrix.Line1.Column1); @@ -2074,6 +2133,10 @@ bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertySimpl aNewHomogenMatrix.set(2, 1, aMatrix.Line3.Column2); aNewHomogenMatrix.set(2, 2, aMatrix.Line3.Column3); + // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm + // Need to adapt aNewHomogenMatrix from 100thmm to app-specific + ForceMetricToItemPoolMetric(aNewHomogenMatrix); + GetSdrObject()->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon); return true; } @@ -2474,9 +2537,6 @@ bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertySimpl aVclPoint -= GetSdrObject()->GetAnchorPos(); } - // #88657# metric of pool maybe twips (writer) - ForceMetricTo100th_mm(aVclPoint); - // #90763# pos is absolute, make it relative to top left basegfx::B2DPolyPolygon aNewPolyPolygon; basegfx::B2DHomMatrix aNewHomogenMatrix; @@ -2485,6 +2545,10 @@ bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertySimpl aVclPoint.AdjustX( -(basegfx::fround(aNewHomogenMatrix.get(0, 2))) ); aVclPoint.AdjustY( -(basegfx::fround(aNewHomogenMatrix.get(1, 2))) ); + // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm + // Need to adapt aVclPoint from app-specific to 100thmm + ForceMetricTo100th_mm(aVclPoint); + awt::Point aPnt( aVclPoint.X(), aVclPoint.Y() ); rValue <<= aPnt; break; @@ -2497,6 +2561,10 @@ bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertySimpl GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon); drawing::HomogenMatrix3 aMatrix; + // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm + // Need to adapt aNewHomogenMatrix from app-specific to 100thmm + ForceMetricTo100th_mm(aNewHomogenMatrix); + aMatrix.Line1.Column1 = aNewHomogenMatrix.get(0, 0); aMatrix.Line1.Column2 = aNewHomogenMatrix.get(0, 1); aMatrix.Line1.Column3 = aNewHomogenMatrix.get(0, 2); |