summaryrefslogtreecommitdiff
path: root/svx/source/unodraw/unoshape.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/unodraw/unoshape.cxx')
-rw-r--r--svx/source/unodraw/unoshape.cxx90
1 files changed, 84 insertions, 6 deletions
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 396b3e45f4..a6a6ca22e8 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -358,7 +358,7 @@ const ::com::sun::star::uno::Sequence< sal_Int8 > & SvxShape::getUnoTunnelId() t
}
//----------------------------------------------------------------------
-SvxShape* SvxShape::getImplementation( const uno::Reference< uno::XInterface >& xInt )
+SvxShape* SvxShape::getImplementation( const uno::Reference< uno::XInterface >& xInt )
{
uno::Reference< lang::XUnoTunnel > xUT( xInt, ::com::sun::star::uno::UNO_QUERY );
if( xUT.is() )
@@ -577,6 +577,37 @@ void SvxShape::ForceMetricToItemPoolMetric(Pair& rPoint) const throw()
}
//----------------------------------------------------------------------
+// --> OD 2010-02-19 #i108851# - reintroduction of fix for issue i59051
+void SvxShape::ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const throw()
+{
+ DBG_TESTSOLARMUTEX();
+ if(mpModel)
+ {
+ SfxMapUnit eMapUnit = mpModel->GetItemPool().GetMetric(0);
+ if(eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ switch(eMapUnit)
+ {
+ case SFX_MAPUNIT_TWIP :
+ {
+ basegfx::B2DHomMatrix aTransform;
+ const double fMMToTWIPS(72.0 / 127.0);
+
+ aTransform.scale(fMMToTWIPS, fMMToTWIPS);
+ rPolyPolygon.transform(aTransform);
+ break;
+ }
+ default:
+ {
+ DBG_ERROR("Missing unit translation to PoolMetric!");
+ }
+ }
+ }
+ }
+}
+// <--
+
+//----------------------------------------------------------------------
void SvxShape::ForceMetricTo100th_mm(Pair& rPoint) const throw()
{
DBG_TESTSOLARMUTEX();
@@ -604,6 +635,38 @@ void SvxShape::ForceMetricTo100th_mm(Pair& rPoint) const throw()
}
//----------------------------------------------------------------------
+// --> OD 2010-02-19 #i108851# - reintroduction of fix for issue i59051
+void SvxShape::ForceMetricTo100th_mm(basegfx::B2DPolyPolygon& rPolyPolygon) const throw()
+{
+ DBG_TESTSOLARMUTEX();
+ SfxMapUnit eMapUnit = SFX_MAPUNIT_100TH_MM;
+ if(mpModel)
+ {
+ eMapUnit = mpModel->GetItemPool().GetMetric(0);
+ if(eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ switch(eMapUnit)
+ {
+ case SFX_MAPUNIT_TWIP :
+ {
+ basegfx::B2DHomMatrix aTransform;
+ const double fTWIPSToMM(127.0 / 72.0);
+ aTransform.scale(fTWIPSToMM, fTWIPSToMM);
+ rPolyPolygon.transform(aTransform);
+ break;
+ }
+ default:
+ {
+ DBG_ERROR("Missing unit translation to 100th mm!");
+ }
+ }
+ }
+ }
+}
+// <--
+//----------------------------------------------------------------------
+
+
//----------------------------------------------------------------------
void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet,
SfxItemSet& rSet, uno::Reference< beans::XPropertySet > xSet, const SfxItemPropertyMap* pMap )
@@ -635,7 +698,6 @@ void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet&
{
if(rSet.GetPool()->IsWhich(pEntry->nWID))
rSet.Put(rSet.GetPool()->GetDefaultItem(pEntry->nWID));
-
// setzen
SvxItemPropertySet_setPropertyValue(rPropSet, pEntry, *pUsrAny, rSet);
}
@@ -650,7 +712,6 @@ void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet&
}
-
void SvxShape::ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet)
{
DBG_TESTSOLARMUTEX();
@@ -2505,10 +2566,15 @@ bool SvxShape::setPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper
if( rValue >>= aUnoPoint )
{
Point aPoint( aUnoPoint.X, aUnoPoint.Y );
+
+ // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue i59051
+ // perform metric change before applying anchor position,
+ // because the anchor position is in pool metric.
+ ForceMetricToItemPoolMetric( aPoint );
+ // <--
if( mpModel->IsWriter() )
aPoint += mpObj->GetAnchorPos();
- ForceMetricToItemPoolMetric( aPoint );
pEdgeObj->SetTailPoint( pProperty->nWID == OWN_ATTR_EDGE_START_POS, aPoint );
return true;
}
@@ -2532,6 +2598,9 @@ bool SvxShape::setPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper
if ( rValue >>= aPolyPoly )
{
basegfx::B2DPolyPolygon aNewPolyPolygon( SvxConvertPolyPolygonBezierToB2DPolyPolygon( &aPolyPoly ) );
+ // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue i59051
+ ForceMetricToItemPoolMetric( aNewPolyPolygon );
+ // <--
if( mpModel->IsWriter() )
{
Point aPoint( mpObj->GetAnchorPos() );
@@ -2554,6 +2623,9 @@ bool SvxShape::setPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper
{
Point aPoint( aUnoPoint.X, aUnoPoint.Y );
+ // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue i59051
+ ForceMetricToItemPoolMetric( aPoint );
+ // <--
if( mpModel->IsWriter() )
aPoint += mpObj->GetAnchorPos();
@@ -2797,7 +2869,7 @@ bool SvxShape::getPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper
basegfx::B2DPolyPolygon aNewPolyPolygon;
basegfx::B2DHomMatrix aNewHomogenMatrix;
mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
-
+
aVclPoint.X() -= basegfx::fround(aNewHomogenMatrix.get(0, 2));
aVclPoint.Y() -= basegfx::fround(aNewHomogenMatrix.get(1, 2));
@@ -2970,6 +3042,9 @@ bool SvxShape::getPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper
Point aPoint( mpObj->GetAnchorPos() );
aPolyPoly.transform(basegfx::tools::createTranslateB2DHomMatrix(-aPoint.X(), -aPoint.Y()));
}
+ // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue 59051
+ ForceMetricTo100th_mm( aPolyPoly );
+ // <--
drawing::PolyPolygonBezierCoords aRetval;
SvxConvertB2DPolyPolygonToPolyPolygonBezier( aPolyPoly, aRetval);
rValue <<= aRetval;
@@ -2990,6 +3065,9 @@ bool SvxShape::getPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper
if( mpModel->IsWriter() )
aPoint -= mpObj->GetAnchorPos();
+ // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue 59051
+ ForceMetricTo100th_mm( aPoint );
+ // <--
awt::Point aUnoPoint( aPoint.X(), aPoint.Y() );
rValue <<= aUnoPoint;