summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
Diffstat (limited to 'svx')
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeEngine.cxx3
-rw-r--r--svx/source/svdraw/svdoashp.cxx3
-rw-r--r--svx/source/svdraw/svdopath.cxx14
-rw-r--r--svx/source/unodraw/XPropertyTable.cxx6
-rw-r--r--svx/source/unodraw/unopage.cxx18
-rw-r--r--svx/source/unodraw/unoprov.cxx27
-rw-r--r--svx/source/unodraw/unoshap2.cxx323
-rw-r--r--svx/source/unodraw/unoshape.cxx3
-rw-r--r--svx/source/xoutdev/xattr.cxx10
9 files changed, 147 insertions, 260 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
index 39d1f83cde8c..de998eb422e5 100644
--- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
@@ -49,7 +49,6 @@
#include <svx/svditer.hxx>
#include <uno/mapping.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
-#include <basegfx/utils/unotools.hxx>
#include <com/sun/star/document/XActionLockable.hpp>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -484,7 +483,7 @@ drawing::PolyPolygonBezierCoords SAL_CALL EnhancedCustomShapeEngine::getLineGeom
SdrObject::Free( pNewObj );
}
SdrObject::Free( pObj );
- basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier( aPolyPolygon,
+ basegfx::utils::B2DPolyPolygonToUnoPolyPolygonBezierCoords( aPolyPolygon,
aPolyPolygonBezierCoords );
}
}
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 3ff61483d2b3..5f448b6fb53b 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -81,7 +81,6 @@
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
-#include <basegfx/utils/unotools.hxx>
#include <svdobjplusdata.hxx>
using namespace ::com::sun::star;
@@ -562,7 +561,7 @@ basegfx::B2DPolyPolygon SdrObjCustomShape::GetLineGeometry( const bool bBezierAl
css::drawing::PolyPolygonBezierCoords aBezierCoords = xCustomShapeEngine->getLineGeometry();
try
{
- aRetval = basegfx::unotools::polyPolygonBezierToB2DPolyPolygon( aBezierCoords );
+ aRetval = basegfx::utils::UnoPolyPolygonBezierCoordsToB2DPolyPolygon( aBezierCoords );
if ( !bBezierAllowed && aRetval.areControlPointsUsed())
{
aRetval = basegfx::utils::adaptiveSubdivideByAngle(aRetval);
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index 631c35a41407..4c5ad7e7bffa 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -2312,6 +2312,20 @@ void SdrPathObj::NbcMove(const Size& rSiz)
void SdrPathObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
{
+ const double fResizeX(xFact);
+ const double fResizeY(yFact);
+
+ if(basegfx::fTools::equal(fResizeX, 1.0) && basegfx::fTools::equal(fResizeY, 1.0))
+ {
+ // tdf#106792 avoid numerical unprecisions: If both scale factors are 1.0, do not
+ // manipulate at all - that may change aGeo rapidly (and wrongly) in
+ // SdrTextObj::NbcResize. Combined with the UNO API trying to not 'apply'
+ // a rotation but to manipulate the existing one, this is fatal. So just
+ // avoid this error as long as we have to deal with unprecise geometry
+ // manipulations
+ return;
+ }
+
basegfx::B2DHomMatrix aTrans(basegfx::utils::createTranslateB2DHomMatrix(-rRef.X(), -rRef.Y()));
aTrans = basegfx::utils::createScaleTranslateB2DHomMatrix(
double(xFact), double(yFact), rRef.X(), rRef.Y()) * aTrans;
diff --git a/svx/source/unodraw/XPropertyTable.cxx b/svx/source/unodraw/XPropertyTable.cxx
index 5b1f20f1902d..c26dc9b2d41a 100644
--- a/svx/source/unodraw/XPropertyTable.cxx
+++ b/svx/source/unodraw/XPropertyTable.cxx
@@ -39,7 +39,7 @@
#include <svx/unoapi.hxx>
#include <editeng/unoprnms.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
-#include <basegfx/utils/unotools.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
using namespace com::sun::star;
using namespace ::cppu;
@@ -315,7 +315,7 @@ uno::Reference< uno::XInterface > SvxUnoXLineEndTable_createInstance( XPropertyL
uno::Any SvxUnoXLineEndTable::getAny( const XPropertyEntry* pEntry ) const throw()
{
drawing::PolyPolygonBezierCoords aBezier;
- basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier( static_cast<const XLineEndEntry*>(pEntry)->GetLineEnd(),
+ basegfx::utils::B2DPolyPolygonToUnoPolyPolygonBezierCoords( static_cast<const XLineEndEntry*>(pEntry)->GetLineEnd(),
aBezier );
return uno::Any(aBezier);
}
@@ -328,7 +328,7 @@ std::unique_ptr<XPropertyEntry> SvxUnoXLineEndTable::createEntry(const OUString&
basegfx::B2DPolyPolygon aPolyPolygon;
if( pCoords->Coordinates.getLength() > 0 )
- aPolyPolygon = basegfx::unotools::polyPolygonBezierToB2DPolyPolygon( *pCoords );
+ aPolyPolygon = basegfx::utils::UnoPolyPolygonBezierCoordsToB2DPolyPolygon( *pCoords );
// #86265# make sure polygon is closed
aPolyPolygon.setClosed(true);
diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx
index 15a3b01c5635..7dc51166c3b5 100644
--- a/svx/source/unodraw/unopage.cxx
+++ b/svx/source/unodraw/unopage.cxx
@@ -649,7 +649,7 @@ SvxShape* SvxDrawPage::CreateShapeByTypeAndInventor( sal_uInt16 nType, SdrInvent
pRet = new SvxShapeGroup( pObj, mpPage );
break;
case OBJ_LINE:
- pRet = new SvxShapePolyPolygon( pObj , PolygonKind_LINE );
+ pRet = new SvxShapePolyPolygon( pObj );
break;
case OBJ_RECT:
pRet = new SvxShapeRect( pObj );
@@ -661,24 +661,24 @@ SvxShape* SvxDrawPage::CreateShapeByTypeAndInventor( sal_uInt16 nType, SdrInvent
pRet = new SvxShapeCircle( pObj );
break;
case OBJ_POLY:
- pRet = new SvxShapePolyPolygon( pObj , PolygonKind_POLY );
+ pRet = new SvxShapePolyPolygon( pObj );
break;
case OBJ_PLIN:
- pRet = new SvxShapePolyPolygon( pObj , PolygonKind_PLIN );
+ pRet = new SvxShapePolyPolygon( pObj );
break;
case OBJ_SPLNLINE:
case OBJ_PATHLINE:
- pRet = new SvxShapePolyPolygonBezier( pObj , PolygonKind_PATHLINE );
+ pRet = new SvxShapePolyPolygon( pObj );
break;
case OBJ_SPLNFILL:
case OBJ_PATHFILL:
- pRet = new SvxShapePolyPolygonBezier( pObj , PolygonKind_PATHFILL );
+ pRet = new SvxShapePolyPolygon( pObj );
break;
case OBJ_FREELINE:
- pRet = new SvxShapePolyPolygonBezier( pObj , PolygonKind_FREELINE );
+ pRet = new SvxShapePolyPolygon( pObj );
break;
case OBJ_FREEFILL:
- pRet = new SvxShapePolyPolygonBezier( pObj , PolygonKind_FREEFILL );
+ pRet = new SvxShapePolyPolygon( pObj );
break;
case OBJ_CAPTION:
pRet = new SvxShapeCaption( pObj );
@@ -754,10 +754,10 @@ SvxShape* SvxDrawPage::CreateShapeByTypeAndInventor( sal_uInt16 nType, SdrInvent
pRet = new SvxShapeConnector( pObj );
break;
case OBJ_PATHPOLY:
- pRet = new SvxShapePolyPolygon( pObj , PolygonKind_PATHPOLY );
+ pRet = new SvxShapePolyPolygon( pObj );
break;
case OBJ_PATHPLIN:
- pRet = new SvxShapePolyPolygon( pObj , PolygonKind_PATHPLIN );
+ pRet = new SvxShapePolyPolygon( pObj );
break;
case OBJ_PAGE:
{
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
index 84c72e467373..0d6c32e8a0cf 100644
--- a/svx/source/unodraw/unoprov.cxx
+++ b/svx/source/unodraw/unoprov.cxx
@@ -175,30 +175,6 @@ SfxItemPropertyMapEntry const * ImplGetSvxPolyPolygonPropertyMap()
{ OUString("Geometry"), OWN_ATTR_BASE_GEOMETRY, cppu::UnoType<css::drawing::PointSequenceSequence>::get(), 0, 0 },
SPECIAL_POLYGON_PROPERTIES
SPECIAL_POLYPOLYGON_PROPERTIES
- FILL_PROPERTIES
- LINE_PROPERTIES
- LINE_PROPERTIES_START_END
- SHAPE_DESCRIPTOR_PROPERTIES
- MISC_OBJ_PROPERTIES
- LINKTARGET_PROPERTIES
- SHADOW_PROPERTIES
- TEXT_PROPERTIES
- // #FontWork#
- FONTWORK_PROPERTIES
- { OUString("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, cppu::UnoType<css::container::XNameContainer>::get(), 0, 0},
- { OUString("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, cppu::UnoType<css::container::XNameContainer>::get(), 0, 0},
- { OUString(), 0, css::uno::Type(), 0, 0 }
- };
-
- return aPolyPolygonPropertyMap_Impl;
-}
-
-SfxItemPropertyMapEntry const * ImplGetSvxPolyPolygonBezierPropertyMap()
-{
- static SfxItemPropertyMapEntry const aPolyPolygonBezierPropertyMap_Impl[] =
- {
- { OUString("Geometry"), OWN_ATTR_BASE_GEOMETRY, cppu::UnoType<css::drawing::PolyPolygonBezierCoords>::get(), 0, 0 },
- SPECIAL_POLYGON_PROPERTIES
SPECIAL_POLYPOLYGONBEZIER_PROPERTIES
FILL_PROPERTIES
LINE_PROPERTIES
@@ -215,7 +191,7 @@ SfxItemPropertyMapEntry const * ImplGetSvxPolyPolygonBezierPropertyMap()
{ OUString(), 0, css::uno::Type(), 0, 0 }
};
- return aPolyPolygonBezierPropertyMap_Impl;
+ return aPolyPolygonPropertyMap_Impl;
}
SfxItemPropertyMapEntry const * ImplGetSvxGraphicObjectPropertyMap()
@@ -916,7 +892,6 @@ const SfxItemPropertyMapEntry* SvxUnoPropertyMapProvider::GetMap(sal_uInt16 nPro
case SVXMAP_DIMENSIONING: aMapArr[SVXMAP_DIMENSIONING]=ImplGetSvxDimensioningPropertyMap(); break;
case SVXMAP_CIRCLE: aMapArr[SVXMAP_CIRCLE]=ImplGetSvxCirclePropertyMap(); break;
case SVXMAP_POLYPOLYGON: aMapArr[SVXMAP_POLYPOLYGON]=ImplGetSvxPolyPolygonPropertyMap(); break;
- case SVXMAP_POLYPOLYGONBEZIER: aMapArr[SVXMAP_POLYPOLYGONBEZIER]=ImplGetSvxPolyPolygonBezierPropertyMap(); break;
case SVXMAP_GRAPHICOBJECT: aMapArr[SVXMAP_GRAPHICOBJECT]=ImplGetSvxGraphicObjectPropertyMap(); break;
case SVXMAP_3DSCENEOBJECT: aMapArr[SVXMAP_3DSCENEOBJECT]=ImplGetSvx3DSceneObjectPropertyMap(); break;
case SVXMAP_3DCUBEOBJECT: aMapArr[SVXMAP_3DCUBEOBJECT]=ImplGetSvx3DCubeObjectPropertyMap(); break;
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index 9de0da13904f..4aad6e1ec6ee 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -29,6 +29,7 @@
#include <com/sun/star/style/ParagraphAdjust.hpp>
#include <com/sun/star/drawing/PointSequenceSequence.hpp>
#include <com/sun/star/drawing/PointSequence.hpp>
+#include <com/sun/star/drawing/PolygonKind.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
#include <o3tl/any.hxx>
#include <tools/urlobj.hxx>
@@ -59,7 +60,7 @@
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
-#include <basegfx/utils/unotools.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <com/sun/star/awt/XBitmap.hpp>
#include <svx/svdograf.hxx>
#include <sfx2/docfile.hxx>
@@ -916,59 +917,50 @@ SvxShapeCircle::~SvxShapeCircle() throw()
{
}
-SvxShapePolyPolygon::SvxShapePolyPolygon( SdrObject* pObj , drawing::PolygonKind eNew )
-: SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_POLYPOLYGON), getSvxMapProvider().GetPropertySet(SVXMAP_POLYPOLYGON, SdrObject::GetGlobalDrawObjectItemPool()) )
-, mePolygonKind( eNew )
+//////////////////////////////////////////////////////////////////////////////
+
+SvxShapePolyPolygon::SvxShapePolyPolygon(
+ SdrObject* pObj)
+: SvxShapeText(
+ pObj,
+ getSvxMapProvider().GetMap(SVXMAP_POLYPOLYGON),
+ getSvxMapProvider().GetPropertySet(SVXMAP_POLYPOLYGON, SdrObject::GetGlobalDrawObjectItemPool()))
{
}
-
SvxShapePolyPolygon::~SvxShapePolyPolygon() throw()
{
}
-basegfx::B2DPolyPolygon ImplSvxPointSequenceSequenceToB2DPolyPolygon( const drawing::PointSequenceSequence* pOuterSequence) throw()
+bool SvxShapePolyPolygon::setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue )
{
- basegfx::B2DPolyPolygon aRetval;
-
- // get pointer to internal sequences
- const drawing::PointSequence* pInnerSequence = pOuterSequence->getConstArray();
- const drawing::PointSequence* pInnerSeqEnd = pInnerSequence + pOuterSequence->getLength();
-
- for(;pInnerSequence != pInnerSeqEnd; ++pInnerSequence)
+ switch( pProperty->nWID )
{
- // prepare new polygon
- basegfx::B2DPolygon aNewPolygon;
-
- // get pointer to arrays
- const awt::Point* pArray = pInnerSequence->getConstArray();
- const awt::Point* pArrayEnd = pArray + pInnerSequence->getLength();
-
- for(;pArray != pArrayEnd;++pArray)
+ case OWN_ATTR_VALUE_POLYPOLYGONBEZIER:
+ {
+ if( auto s = o3tl::tryAccess<drawing::PolyPolygonBezierCoords>(rValue) )
{
- aNewPolygon.append(basegfx::B2DPoint(pArray->X, pArray->Y));
- }
+ basegfx::B2DPolyPolygon aNewPolyPolygon(
+ basegfx::utils::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(*s));
- // check for closed state flag
- basegfx::utils::checkClosed(aNewPolygon);
+ // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm
+ ForceMetricToItemPoolMetric(aNewPolyPolygon);
- // add new subpolygon
- aRetval.append(aNewPolygon);
+ SetPolygon(aNewPolyPolygon);
+ return true;
+ }
+ break;
}
-
- return aRetval;
-}
-
-
-bool SvxShapePolyPolygon::setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue )
-{
- switch( pProperty->nWID )
- {
case OWN_ATTR_VALUE_POLYPOLYGON:
{
if( auto s = o3tl::tryAccess<drawing::PointSequenceSequence>(rValue) )
{
- basegfx::B2DPolyPolygon aNewPolyPolygon(ImplSvxPointSequenceSequenceToB2DPolyPolygon(s));
+ basegfx::B2DPolyPolygon aNewPolyPolygon(
+ basegfx::utils::UnoPointSequenceSequenceToB2DPolyPolygon(*s));
+
+ // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm
+ ForceMetricToItemPoolMetric(aNewPolyPolygon);
+
SetPolygon(aNewPolyPolygon);
return true;
}
@@ -976,7 +968,10 @@ bool SvxShapePolyPolygon::setPropertyValueImpl( const OUString& rName, const Sfx
}
case OWN_ATTR_BASE_GEOMETRY:
{
- if( auto s = o3tl::tryAccess<drawing::PointSequenceSequence>(rValue) )
+ drawing::PointSequenceSequence aPointSequenceSequence;
+ drawing::PolyPolygonBezierCoords aPolyPolygonBezierCoords;
+
+ if( rValue >>= aPointSequenceSequence)
{
if( HasSdrObject() )
{
@@ -984,7 +979,7 @@ bool SvxShapePolyPolygon::setPropertyValueImpl( const OUString& rName, const Sfx
basegfx::B2DHomMatrix aNewHomogenMatrix;
GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
- aNewPolyPolygon = ImplSvxPointSequenceSequenceToB2DPolyPolygon(s);
+ aNewPolyPolygon = basegfx::utils::UnoPointSequenceSequenceToB2DPolyPolygon(aPointSequenceSequence);
// tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm
// Need to adapt aNewPolyPolygon from 100thmm to app-specific
@@ -994,6 +989,23 @@ bool SvxShapePolyPolygon::setPropertyValueImpl( const OUString& rName, const Sfx
}
return true;
}
+ else if( rValue >>= aPolyPolygonBezierCoords)
+ {
+ if( HasSdrObject() )
+ {
+ basegfx::B2DPolyPolygon aNewPolyPolygon;
+ basegfx::B2DHomMatrix aNewHomogenMatrix;
+
+ GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
+ aNewPolyPolygon = basegfx::utils::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(aPolyPolygonBezierCoords);
+
+ // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm
+ ForceMetricToItemPoolMetric(aNewPolyPolygon);
+
+ GetSdrObject()->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
+ }
+ return true;
+ }
break;
}
case OWN_ATTR_VALUE_POLYGON:
@@ -1015,8 +1027,12 @@ bool SvxShapePolyPolygon::setPropertyValueImpl( const OUString& rName, const Sfx
// check for closed state flag
basegfx::utils::checkClosed(aNewPolygon);
+ // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm
+ basegfx::B2DPolyPolygon aNewPolyPolygon(aNewPolygon);
+ ForceMetricToItemPoolMetric(aNewPolyPolygon);
+
// set polygon
- SetPolygon(basegfx::B2DPolyPolygon(aNewPolygon));
+ SetPolygon(aNewPolyPolygon);
return true;
}
break;
@@ -1028,61 +1044,35 @@ bool SvxShapePolyPolygon::setPropertyValueImpl( const OUString& rName, const Sfx
throw lang::IllegalArgumentException();
}
-void B2DPolyPolygonToSvxPointSequenceSequence( const basegfx::B2DPolyPolygon& rPolyPoly, drawing::PointSequenceSequence& rRetval )
+bool SvxShapePolyPolygon::getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty,
+ css::uno::Any& rValue )
{
- if( static_cast<sal_uInt32>(rRetval.getLength()) != rPolyPoly.count() )
- rRetval.realloc( rPolyPoly.count() );
-
- // get pointer to external arrays
- drawing::PointSequence* pOuterSequence = rRetval.getArray();
-
- for(sal_uInt32 a(0); a < rPolyPoly.count(); a++)
+ switch( pProperty->nWID )
{
- // get single polygon
- const basegfx::B2DPolygon aPoly(rPolyPoly.getB2DPolygon(a));
-
- // #i75974# take closed state into account, the API polygon still uses the old closed definition
- // with last/first point are identical (cannot hold information about open polygons with identical
- // first and last point, though)
- const sal_uInt32 nPointCount(aPoly.count());
- const bool bIsClosed(aPoly.isClosed());
-
- // create space in arrays
- pOuterSequence->realloc(bIsClosed ? nPointCount + 1 : nPointCount);
-
- // get pointer to arrays
- awt::Point* pInnerSequence = pOuterSequence->getArray();
+ case OWN_ATTR_VALUE_POLYPOLYGONBEZIER:
+ {
+ // pack a tools::PolyPolygon in a struct tools::PolyPolygon
+ basegfx::B2DPolyPolygon aPolyPoly(GetPolygon());
- for(sal_uInt32 b(0); b < nPointCount; b++)
- {
- const basegfx::B2DPoint aPoint(aPoly.getB2DPoint(b));
- *pInnerSequence = awt::Point( basegfx::fround(aPoint.getX()), basegfx::fround(aPoint.getY()) );
- pInnerSequence++;
- }
+ // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm
+ ForceMetricTo100th_mm(aPolyPoly);
- // #i75974# copy first point
- if(bIsClosed)
- {
- *pInnerSequence = *pOuterSequence->getArray();
- }
+ drawing::PolyPolygonBezierCoords aRetval;
+ basegfx::utils::B2DPolyPolygonToUnoPolyPolygonBezierCoords(aPolyPoly, aRetval);
- pOuterSequence++;
+ rValue <<= aRetval;
+ break;
}
-}
-
-
-bool SvxShapePolyPolygon::getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty,
- css::uno::Any& rValue )
-{
- switch( pProperty->nWID )
- {
case OWN_ATTR_VALUE_POLYPOLYGON:
{
// pack a tools::PolyPolygon in a struct tools::PolyPolygon
- const basegfx::B2DPolyPolygon& rPolyPoly = GetPolygon();
- drawing::PointSequenceSequence aRetval( rPolyPoly.count() );
+ basegfx::B2DPolyPolygon aPolyPoly(GetPolygon());
+
+ // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm
+ ForceMetricTo100th_mm(aPolyPoly);
- B2DPolyPolygonToSvxPointSequenceSequence( rPolyPoly, aRetval );
+ drawing::PointSequenceSequence aRetval( aPolyPoly.count() );
+ basegfx::utils::B2DPolyPolygonToUnoPointSequenceSequence(aPolyPoly, aRetval);
rValue <<= aRetval;
break;
@@ -1090,38 +1080,46 @@ bool SvxShapePolyPolygon::getPropertyValueImpl( const OUString& rName, const Sfx
case OWN_ATTR_BASE_GEOMETRY:
{
// pack a tools::PolyPolygon in struct PolyPolygon
- basegfx::B2DPolyPolygon aNewPolyPolygon;
+ basegfx::B2DPolyPolygon aPolyPoly;
basegfx::B2DHomMatrix aNewHomogenMatrix;
if(HasSdrObject())
{
- GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
+ GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aPolyPoly);
// 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);
+ ForceMetricTo100th_mm(aPolyPoly);
}
- drawing::PointSequenceSequence aRetval(aNewPolyPolygon.count());
- B2DPolyPolygonToSvxPointSequenceSequence(aNewPolyPolygon, aRetval);
- rValue <<= aRetval;
+ if(aPolyPoly.areControlPointsUsed())
+ {
+ drawing::PolyPolygonBezierCoords aRetval;
+ basegfx::utils::B2DPolyPolygonToUnoPolyPolygonBezierCoords(aPolyPoly, aRetval);
+ rValue <<= aRetval;
+ }
+ else
+ {
+ drawing::PointSequenceSequence aRetval(aPolyPoly.count());
+ basegfx::utils::B2DPolyPolygonToUnoPointSequenceSequence(aPolyPoly, aRetval);
+ rValue <<= aRetval;
+ }
break;
}
case OWN_ATTR_VALUE_POLYGON:
{
// pack a tools::PolyPolygon in a struct tools::PolyPolygon
- const basegfx::B2DPolyPolygon& rPolyPoly = GetPolygon();
+ basegfx::B2DPolyPolygon aPolyPoly(GetPolygon());
- sal_Int32 nCount = 0;
- if( rPolyPoly.count() > 0 )
- nCount = rPolyPoly.getB2DPolygon(0).count();
+ // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm
+ ForceMetricTo100th_mm(aPolyPoly);
+ const sal_Int32 nCount(0 == aPolyPoly.count() ? 0 : aPolyPoly.getB2DPolygon(0).count());
drawing::PointSequence aRetval( nCount );
if( nCount > 0 )
{
// get single polygon
- const basegfx::B2DPolygon aPoly(rPolyPoly.getB2DPolygon(0));
+ const basegfx::B2DPolygon aPoly(aPolyPoly.getB2DPolygon(0));
// get pointer to arrays
awt::Point* pSequence = aRetval.getArray();
@@ -1138,7 +1136,7 @@ bool SvxShapePolyPolygon::getPropertyValueImpl( const OUString& rName, const Sfx
}
case OWN_ATTR_VALUE_POLYGONKIND:
{
- rValue <<= mePolygonKind;
+ rValue <<= GetPolygonKind();
break;
}
default:
@@ -1148,129 +1146,30 @@ bool SvxShapePolyPolygon::getPropertyValueImpl( const OUString& rName, const Sfx
return true;
}
-
-void SvxShapePolyPolygon::SetPolygon(const basegfx::B2DPolyPolygon& rNew)
+drawing::PolygonKind SvxShapePolyPolygon::GetPolygonKind() const
{
::SolarMutexGuard aGuard;
+ drawing::PolygonKind aRetval(drawing::PolygonKind_LINE);
if(HasSdrObject())
- static_cast<SdrPathObj*>(GetSdrObject())->SetPathPoly(rNew);
-}
-
-
-basegfx::B2DPolyPolygon SvxShapePolyPolygon::GetPolygon() const throw()
-{
- ::SolarMutexGuard aGuard;
-
- if(HasSdrObject())
- {
- return static_cast<SdrPathObj*>(GetSdrObject())->GetPathPoly();
- }
- else
- {
- return basegfx::B2DPolyPolygon();
- }
-}
-
-SvxShapePolyPolygonBezier::SvxShapePolyPolygonBezier(SdrObject* pObj , drawing::PolygonKind eNew)
- : SvxShapeText(pObj, getSvxMapProvider().GetMap(SVXMAP_POLYPOLYGONBEZIER), getSvxMapProvider().GetPropertySet(SVXMAP_POLYPOLYGONBEZIER, SdrObject::GetGlobalDrawObjectItemPool()))
- , mePolygonKind(eNew)
-{
-}
-
-SvxShapePolyPolygonBezier::~SvxShapePolyPolygonBezier() throw()
-{
-}
-
-bool SvxShapePolyPolygonBezier::setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue )
-{
- switch( pProperty->nWID )
- {
- case OWN_ATTR_VALUE_POLYPOLYGONBEZIER:
- {
- if( auto s = o3tl::tryAccess<drawing::PolyPolygonBezierCoords>(rValue) )
- {
- basegfx::B2DPolyPolygon aNewPolyPolygon(
- basegfx::unotools::polyPolygonBezierToB2DPolyPolygon(*s));
- SetPolygon(aNewPolyPolygon);
- return true;
- }
- break;
- }
- case OWN_ATTR_BASE_GEOMETRY:
{
- if( auto s = o3tl::tryAccess<drawing::PolyPolygonBezierCoords>(rValue) )
+ switch(GetSdrObject()->GetObjIdentifier())
{
- if( HasSdrObject() )
- {
- basegfx::B2DPolyPolygon aNewPolyPolygon;
- basegfx::B2DHomMatrix aNewHomogenMatrix;
-
- GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
- 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;
+ case OBJ_POLY: aRetval = drawing::PolygonKind_POLY; break;
+ case OBJ_PLIN: aRetval = drawing::PolygonKind_PLIN; break;
+ case OBJ_SPLNLINE:
+ case OBJ_PATHLINE: aRetval = drawing::PolygonKind_PATHLINE; break;
+ case OBJ_SPLNFILL:
+ case OBJ_PATHFILL: aRetval = drawing::PolygonKind_PATHFILL; break;
+ case OBJ_FREELINE: aRetval = drawing::PolygonKind_FREELINE; break;
+ case OBJ_FREEFILL: aRetval = drawing::PolygonKind_FREEFILL; break;
}
- break;
- }
- default:
- return SvxShapeText::setPropertyValueImpl( rName, pProperty, rValue );
}
- throw IllegalArgumentException();
-}
-
-
-bool SvxShapePolyPolygonBezier::getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue )
-{
- switch( pProperty->nWID )
- {
- case OWN_ATTR_VALUE_POLYPOLYGONBEZIER:
- {
- // pack a tools::PolyPolygon in a struct tools::PolyPolygon
- const basegfx::B2DPolyPolygon& rPolyPoly = GetPolygon();
- drawing::PolyPolygonBezierCoords aRetval;
- basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier(rPolyPoly, aRetval);
-
- rValue <<= aRetval;
- break;
- }
- case OWN_ATTR_BASE_GEOMETRY:
- {
- // pack a tools::PolyPolygon in a struct tools::PolyPolygon
- 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);
-
- rValue <<= aRetval;
- break;
- }
- case OWN_ATTR_VALUE_POLYGONKIND:
- {
- rValue <<= mePolygonKind;
- break;
- }
- default:
- return SvxShapeText::getPropertyValueImpl( rName, pProperty, rValue );
- }
- return true;
+ return aRetval;
}
-
-void SvxShapePolyPolygonBezier::SetPolygon(const basegfx::B2DPolyPolygon& rNew)
+void SvxShapePolyPolygon::SetPolygon(const basegfx::B2DPolyPolygon& rNew)
{
::SolarMutexGuard aGuard;
@@ -1279,7 +1178,7 @@ void SvxShapePolyPolygonBezier::SetPolygon(const basegfx::B2DPolyPolygon& rNew)
}
-basegfx::B2DPolyPolygon SvxShapePolyPolygonBezier::GetPolygon() const throw()
+basegfx::B2DPolyPolygon SvxShapePolyPolygon::GetPolygon() const throw()
{
::SolarMutexGuard aGuard;
@@ -1293,6 +1192,8 @@ basegfx::B2DPolyPolygon SvxShapePolyPolygonBezier::GetPolygon() const throw()
}
}
+//////////////////////////////////////////////////////////////////////////////
+
SvxGraphicObject::SvxGraphicObject(SdrObject* pObj)
: SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_GRAPHICOBJECT), getSvxMapProvider().GetPropertySet(SVXMAP_GRAPHICOBJECT, SdrObject::GetGlobalDrawObjectItemPool()) )
{
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index dfffb6c9babe..a8fbab8db6c7 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -79,7 +79,6 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
-#include <basegfx/utils/unotools.hxx>
#include "gluepts.hxx"
#include "shapeimpl.hxx"
#include <sal/log.hxx>
@@ -2729,7 +2728,7 @@ bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertySimpl
// Reintroduction of fix for issue #i59051# (#i108851#)
ForceMetricTo100th_mm( aPolyPoly );
drawing::PolyPolygonBezierCoords aRetval;
- basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier( aPolyPoly, aRetval);
+ basegfx::utils::B2DPolyPolygonToUnoPolyPolygonBezierCoords( aPolyPoly, aRetval);
rValue <<= aRetval;
break;
}
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index 8e48a60b47c7..305c9fe410fd 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -57,7 +57,7 @@
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/vector/b2dvector.hxx>
-#include <basegfx/utils/unotools.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <unotools/intlwrapper.hxx>
#include <vcl/gradient.hxx>
@@ -1020,7 +1020,7 @@ bool XLineStartItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) cons
else
{
css::drawing::PolyPolygonBezierCoords aBezier;
- basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier( maPolyPolygon, aBezier );
+ basegfx::utils::B2DPolyPolygonToUnoPolyPolygonBezierCoords( maPolyPolygon, aBezier );
rVal <<= aBezier;
}
@@ -1047,7 +1047,7 @@ bool XLineStartItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
if( pCoords->Coordinates.getLength() > 0 )
{
- maPolyPolygon = basegfx::unotools::polyPolygonBezierToB2DPolyPolygon( *pCoords );
+ maPolyPolygon = basegfx::utils::UnoPolyPolygonBezierCoordsToB2DPolyPolygon( *pCoords );
// #i72807# close line start/end polygons hard
// maPolyPolygon.setClosed(true);
}
@@ -1551,7 +1551,7 @@ bool XLineEndItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const
else
{
css::drawing::PolyPolygonBezierCoords aBezier;
- basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier( maPolyPolygon, aBezier );
+ basegfx::utils::B2DPolyPolygonToUnoPolyPolygonBezierCoords( maPolyPolygon, aBezier );
rVal <<= aBezier;
}
return true;
@@ -1577,7 +1577,7 @@ bool XLineEndItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
if( pCoords->Coordinates.getLength() > 0 )
{
- maPolyPolygon = basegfx::unotools::polyPolygonBezierToB2DPolyPolygon( *pCoords );
+ maPolyPolygon = basegfx::utils::UnoPolyPolygonBezierCoordsToB2DPolyPolygon( *pCoords );
// #i72807# close line start/end polygons hard
// maPolyPolygon.setClosed(true);
}