summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2018-06-28 19:48:59 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-09-12 18:03:58 +0200
commit6bb5303467309fdcdb04a81597fa494d5221df8b (patch)
tree0120795ff7cca4887368546c44fcbd12ac2df3f3
parentf2b264077ea7e5e944de16580a30c2eecfadf50d (diff)
tdf106792 Get rid of SvxShapePolyPolygonBezier
SvxShapePolyPolygonBezier was an implementation for the UNO Shape group of polygons with bezier parts (filled/unfilled/ closed/open), e.g. com.sun.star.drawing.OpenBezierShape. It was differing from SvxShapePolyPolygon just by supporting drawing::PolyPolygonBezierCoords instead of the simple drawing::PointSequenceSequence and some details. This leads to problems - the ShapeType *does change* e.g. when you edit a non-bezier Shape in Draw/Impress and change parts to curve (also when closing, see ShapeTypes above). This is why SvxShape::getShapeType() already detects this identifier by using thze internal ShapePolyType (e.g. OBJ_PATHLINE). So there is no reason to have two separate UNO API imple- mentations for sthe same type of SvxShape at all. Get rid of the extra one and unify this implementation detail. Also cleaned up double basegfx tooling for conversions of UNO API Poly/bezier data and B2DPolygon. Adapted test for "tdf113946.docx", see comment there. Adapted test for "tdf90097.rtf", see comment there. Also needed to use the Linux values, also check comment there. Adapted test for "tdf105127.docx", see comment there. Adapted test for "tdf85232.docx", see comment there. Had to fic a problem with test for "tdf96674.docx"- the adaption of the RotateAngle for line objects goes havoc together with the UNO API when scaling is involved. That old aGeo rotate stuff just kills the existing rotation due to numerical inprecise stuff. The UNP API - in trying not just to apply a rptation, but manipulate the existing one then goes wrong in not re-getting the current rotation value anymore. ARGH! This is the original reason for the ols tdf#96674 task - i doubt that the additional code to make a line not exactly hor/ver is needed. Checked and it is not needed, thus removed the change from tdf#96674 in shape.cxx. Change-Id: I2bb8d4cfe33fee3671f3dad60e5c18609a394f9d Reviewed-on: https://gerrit.libreoffice.org/56614 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de> (cherry picked from commit 36bade04d3780bc54c51b46bb0b63e69789658a5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102370 Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--basegfx/Library_basegfx.mk1
-rw-r--r--basegfx/source/tools/unotools.cxx256
-rw-r--r--include/basegfx/utils/unotools.hxx38
-rw-r--r--include/svx/unoprov.hxx43
-rw-r--r--include/svx/unoshape.hxx34
-rw-r--r--oox/source/drawingml/shape.cxx13
-rw-r--r--qadevOOo/Jar_OOoRunner.mk1
-rw-r--r--solenv/clang-format/blacklist1
-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
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx21
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport2.cxx7
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx20
-rw-r--r--xmloff/source/draw/xexptran.cxx1
21 files changed, 212 insertions, 631 deletions
diff --git a/basegfx/Library_basegfx.mk b/basegfx/Library_basegfx.mk
index de744b5a15ce..76d06b777668 100644
--- a/basegfx/Library_basegfx.mk
+++ b/basegfx/Library_basegfx.mk
@@ -74,7 +74,6 @@ $(eval $(call gb_Library_add_exception_objects,basegfx,\
basegfx/source/tools/stringconversiontools \
basegfx/source/tools/tools \
basegfx/source/tools/unopolypolygon \
- basegfx/source/tools/unotools \
basegfx/source/tools/zoomtools \
basegfx/source/tuple/b2dtuple \
basegfx/source/tuple/b2i64tuple \
diff --git a/basegfx/source/tools/unotools.cxx b/basegfx/source/tools/unotools.cxx
deleted file mode 100644
index a80b6b9994a3..000000000000
--- a/basegfx/source/tools/unotools.cxx
+++ /dev/null
@@ -1,256 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
-#include <com/sun/star/drawing/PointSequence.hpp>
-#include <com/sun/star/drawing/FlagSequence.hpp>
-#include <com/sun/star/lang/IllegalArgumentException.hpp>
-#include <basegfx/polygon/b2dpolypolygontools.hxx>
-#include <basegfx/polygon/b2dpolygontools.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
-#include <basegfx/curve/b2dcubicbezier.hxx>
-
-#include <basegfx/utils/unotools.hxx>
-#include <comphelper/sequence.hxx>
-
-using namespace ::com::sun::star;
-
-namespace basegfx
-{
-namespace unotools
-{
-
- B2DPolyPolygon polyPolygonBezierToB2DPolyPolygon(const drawing::PolyPolygonBezierCoords& rSourcePolyPolygon)
- {
- const sal_Int32 nOuterSequenceCount(rSourcePolyPolygon.Coordinates.getLength());
- B2DPolyPolygon aNewPolyPolygon;
-
- if(rSourcePolyPolygon.Flags.getLength() != nOuterSequenceCount)
- throw lang::IllegalArgumentException();
-
- // get pointers to inner sequence
- const drawing::PointSequence* pInnerSequence = rSourcePolyPolygon.Coordinates.getConstArray();
- const drawing::FlagSequence* pInnerSequenceFlags = rSourcePolyPolygon.Flags.getConstArray();
-
- for(sal_Int32 a(0); a < nOuterSequenceCount; a++)
- {
- const sal_Int32 nInnerSequenceCount(pInnerSequence->getLength());
-
- if (!nInnerSequenceCount)
- throw lang::IllegalArgumentException();
-
- if (pInnerSequenceFlags->getLength() != nInnerSequenceCount)
- throw lang::IllegalArgumentException();
-
- // prepare new polygon
- basegfx::B2DPolygon aNewPolygon;
- const awt::Point* pArray = pInnerSequence->getConstArray();
- const drawing::PolygonFlags* pArrayFlags = pInnerSequenceFlags->getConstArray();
-
- // get first point and flag
- basegfx::B2DPoint aNewCoordinatePair(pArray->X, pArray->Y); pArray++;
- drawing::PolygonFlags ePolyFlag(*pArrayFlags); pArrayFlags++;
- basegfx::B2DPoint aControlA;
- basegfx::B2DPoint aControlB;
-
- // first point is not allowed to be a control point
- if(ePolyFlag == drawing::PolygonFlags_CONTROL)
- throw lang::IllegalArgumentException();
-
- // add first point as start point
- aNewPolygon.append(aNewCoordinatePair);
- for(sal_Int32 b(1); b < nInnerSequenceCount;)
- {
- // prepare loop
- bool bControlA(false);
- bool bControlB(false);
-
- // get next point and flag
- aNewCoordinatePair = basegfx::B2DPoint(pArray->X, pArray->Y);
- ePolyFlag = *pArrayFlags;
- pArray++; pArrayFlags++; b++;
-
- if(b < nInnerSequenceCount && ePolyFlag == drawing::PolygonFlags_CONTROL)
- {
- aControlA = aNewCoordinatePair;
- bControlA = true;
-
- // get next point and flag
- aNewCoordinatePair = basegfx::B2DPoint(pArray->X, pArray->Y);
- ePolyFlag = *pArrayFlags;
- pArray++; pArrayFlags++; b++;
- }
-
- if(b < nInnerSequenceCount && ePolyFlag == drawing::PolygonFlags_CONTROL)
- {
- aControlB = aNewCoordinatePair;
- bControlB = true;
-
- // get next point and flag
- aNewCoordinatePair = basegfx::B2DPoint(pArray->X, pArray->Y);
- ePolyFlag = *pArrayFlags;
- pArray++; pArrayFlags++; b++;
- }
-
- // two or no control points are consumed, another one would be an error.
- // It's also an error if only one control point was read
- if(ePolyFlag == drawing::PolygonFlags_CONTROL || bControlA != bControlB)
- throw lang::IllegalArgumentException();
-
- // the previous writes used the B2DPolyPoygon -> utils::PolyPolygon converter
- // which did not create minimal PolyPolygons, but created all control points
- // as null vectors (identical points). Because of the former P(CA)(CB)-norm of
- // B2DPolygon and it's unused sign of being the zero-vector and CA and CB being
- // relative to P, an empty edge was exported as P == CA == CB. Luckily, the new
- // export format can be read without errors by the old OOo-versions, so we need only
- // to correct here at read and do not need to export a wrong but compatible version
- // for the future.
- if(bControlA
- && aControlA.equal(aControlB)
- && aControlA.equal(aNewPolygon.getB2DPoint(aNewPolygon.count() - 1)))
- {
- bControlA = bControlB = false;
- }
-
- if(bControlA)
- {
- // add bezier edge
- aNewPolygon.appendBezierSegment(aControlA, aControlB, aNewCoordinatePair);
- }
- else
- {
- // add edge
- aNewPolygon.append(aNewCoordinatePair);
- }
- }
-
- // next sequence
- pInnerSequence++;
- pInnerSequenceFlags++;
-
- // #i72807# API import uses old line start/end-equal definition for closed,
- // so we need to correct this to closed state here
- basegfx::utils::checkClosed(aNewPolygon);
-
- // add new subpolygon
- aNewPolyPolygon.append(aNewPolygon);
- }
-
- return aNewPolyPolygon;
- }
-
- void b2DPolyPolygonToPolyPolygonBezier( const basegfx::B2DPolyPolygon& rPolyPoly,
- drawing::PolyPolygonBezierCoords& rRetval )
- {
- rRetval.Coordinates.realloc(rPolyPoly.count());
- rRetval.Flags.realloc(rPolyPoly.count());
-
- drawing::PointSequence* pOuterSequence = rRetval.Coordinates.getArray();
- drawing::FlagSequence* pOuterFlags = rRetval.Flags.getArray();
-
- for(sal_uInt32 a=0;a<rPolyPoly.count();a++)
- {
- const B2DPolygon& rPoly = rPolyPoly.getB2DPolygon(a);
- sal_uInt32 nCount(rPoly.count());
- const bool bClosed(rPoly.isClosed());
-
- // calculate input vertex count
- const sal_uInt32 nLoopCount(bClosed ? nCount : (nCount ? nCount - 1 : 0 ));
-
- std::vector<awt::Point> aPoints; aPoints.reserve(nLoopCount);
- std::vector<drawing::PolygonFlags> aFlags; aFlags.reserve(nLoopCount);
-
- if( nCount )
- {
- // prepare insert index and current point
- basegfx::B2DCubicBezier aBezier;
- aBezier.setStartPoint(rPoly.getB2DPoint(0));
-
- for(sal_uInt32 b(0); b<nLoopCount; b++)
- {
- // add current point (always) and remember StartPointIndex for evtl. later corrections
- const awt::Point aStartPoint(fround(aBezier.getStartPoint().getX()),
- fround(aBezier.getStartPoint().getY()));
- const sal_uInt32 nStartPointIndex(aPoints.size());
- aPoints.push_back(aStartPoint);
- aFlags.push_back(drawing::PolygonFlags_NORMAL);
-
- // prepare next segment
- const sal_uInt32 nNextIndex((b + 1) % nCount);
- aBezier.setEndPoint(rPoly.getB2DPoint(nNextIndex));
- aBezier.setControlPointA(rPoly.getNextControlPoint(b));
- aBezier.setControlPointB(rPoly.getPrevControlPoint(nNextIndex));
-
- if(aBezier.isBezier())
- {
- // if one is used, add always two control points due to the old schema
- aPoints.emplace_back(fround(aBezier.getControlPointA().getX()),
- fround(aBezier.getControlPointA().getY()) );
- aFlags.push_back(drawing::PolygonFlags_CONTROL);
-
- aPoints.emplace_back(fround(aBezier.getControlPointB().getX()),
- fround(aBezier.getControlPointB().getY()) );
- aFlags.push_back(drawing::PolygonFlags_CONTROL);
- }
-
- // test continuity with previous control point to set flag value
- if(aBezier.getControlPointA() != aBezier.getStartPoint() && (bClosed || b))
- {
- const basegfx::B2VectorContinuity eCont(rPoly.getContinuityInPoint(b));
-
- if(eCont == basegfx::B2VectorContinuity::C1)
- {
- aFlags[nStartPointIndex] = drawing::PolygonFlags_SMOOTH;
- }
- else if(eCont == basegfx::B2VectorContinuity::C2)
- {
- aFlags[nStartPointIndex] = drawing::PolygonFlags_SYMMETRIC;
- }
- }
-
- // prepare next polygon step
- aBezier.setStartPoint(aBezier.getEndPoint());
- }
-
- if(bClosed)
- {
- // add first point again as closing point due to old definition
- aPoints.push_back( aPoints[0] );
- aFlags.push_back(drawing::PolygonFlags_NORMAL);
- }
- else
- {
- // add last point as closing point
- const basegfx::B2DPoint aClosingPoint(rPoly.getB2DPoint(nCount - 1));
- const awt::Point aEnd(fround(aClosingPoint.getX()),
- fround(aClosingPoint.getY()));
- aPoints.push_back(aEnd);
- aFlags.push_back(drawing::PolygonFlags_NORMAL);
- }
- }
-
- *pOuterSequence++ = comphelper::containerToSequence(aPoints);
- *pOuterFlags++ = comphelper::containerToSequence(aFlags);
- }
- }
-
-}
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/utils/unotools.hxx b/include/basegfx/utils/unotools.hxx
deleted file mode 100644
index 3a58a2068fd9..000000000000
--- a/include/basegfx/utils/unotools.hxx
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#ifndef INCLUDED_BASEGFX_UTILS_UNOTOOLS_HXX
-#define INCLUDED_BASEGFX_UTILS_UNOTOOLS_HXX
-
-#include <cppuhelper/basemutex.hxx>
-#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/rendering/FillRule.hpp>
-#include <com/sun/star/rendering/XLinePolyPolygon2D.hpp>
-#include <com/sun/star/rendering/XBezierPolyPolygon2D.hpp>
-#include <basegfx/polygon/b2dpolypolygon.hxx>
-
-
-namespace basegfx
-{
-class B2DPolyPolygon;
-
-namespace unotools
-{
- /// @throws css::lang::IllegalArgumentException
- BASEGFX_DLLPUBLIC B2DPolyPolygon polyPolygonBezierToB2DPolyPolygon(const css::drawing::PolyPolygonBezierCoords& rSourcePolyPolygon);
-
- BASEGFX_DLLPUBLIC void b2DPolyPolygonToPolyPolygonBezier( const B2DPolyPolygon& rPolyPoly,
- css::drawing::PolyPolygonBezierCoords& rRetval );
-}
-}
-
-#endif // INCLUDED_BASEGFX_UTILS_UNOTOOLS_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/unoprov.hxx b/include/svx/unoprov.hxx
index 8a2d7d977f51..0fa155c252e8 100644
--- a/include/svx/unoprov.hxx
+++ b/include/svx/unoprov.hxx
@@ -55,28 +55,27 @@ public:
#define SVXMAP_DIMENSIONING 2
#define SVXMAP_CIRCLE 3
#define SVXMAP_POLYPOLYGON 4
-#define SVXMAP_POLYPOLYGONBEZIER 5
-#define SVXMAP_GRAPHICOBJECT 6
-#define SVXMAP_3DSCENEOBJECT 7
-#define SVXMAP_3DCUBEOBJECT 8
-#define SVXMAP_3DSPHEREOBJECT 9
-#define SVXMAP_3DLATHEOBJECT 10
-#define SVXMAP_3DEXTRUDEOBJECT 11
-#define SVXMAP_3DPOLYGONOBJECT 12
-#define SVXMAP_ALL 13
-#define SVXMAP_GROUP 14
-#define SVXMAP_CAPTION 15
-#define SVXMAP_OLE2 16
-#define SVXMAP_PLUGIN 17
-#define SVXMAP_FRAME 18
-#define SVXMAP_APPLET 19
-#define SVXMAP_CONTROL 20
-#define SVXMAP_TEXT 21
-#define SVXMAP_CUSTOMSHAPE 22
-#define SVXMAP_MEDIA 23
-#define SVXMAP_TABLE 24
-#define SVXMAP_PAGE 25
-#define SVXMAP_END 26 // last+1 !
+#define SVXMAP_GRAPHICOBJECT 5
+#define SVXMAP_3DSCENEOBJECT 6
+#define SVXMAP_3DCUBEOBJECT 7
+#define SVXMAP_3DSPHEREOBJECT 8
+#define SVXMAP_3DLATHEOBJECT 9
+#define SVXMAP_3DEXTRUDEOBJECT 10
+#define SVXMAP_3DPOLYGONOBJECT 11
+#define SVXMAP_ALL 12
+#define SVXMAP_GROUP 13
+#define SVXMAP_CAPTION 14
+#define SVXMAP_OLE2 15
+#define SVXMAP_PLUGIN 16
+#define SVXMAP_FRAME 17
+#define SVXMAP_APPLET 18
+#define SVXMAP_CONTROL 19
+#define SVXMAP_TEXT 20
+#define SVXMAP_CUSTOMSHAPE 21
+#define SVXMAP_MEDIA 22
+#define SVXMAP_TABLE 23
+#define SVXMAP_PAGE 24
+#define SVXMAP_END 25 // last+1 !
/**
* SvxUnoPropertyMapProvider
diff --git a/include/svx/unoshape.hxx b/include/svx/unoshape.hxx
index d015d8f39820..bbc7740a1725 100644
--- a/include/svx/unoshape.hxx
+++ b/include/svx/unoshape.hxx
@@ -615,9 +615,6 @@ public:
***********************************************************************/
class SvxShapePolyPolygon : public SvxShapeText
{
-private:
- css::drawing::PolygonKind mePolygonKind;
-
protected:
using SvxUnoTextRangeBase::setPropertyValue;
using SvxUnoTextRangeBase::getPropertyValue;
@@ -626,10 +623,13 @@ protected:
virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue ) override;
virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue ) override;
+ // local helper to detect PolygonKind from SdrObject::GetObjIdentifier()
+ css::drawing::PolygonKind GetPolygonKind() const;
+
public:
/// @throws css::lang::IllegalArgumentException
/// @throws css::beans::PropertyVetoException
- SvxShapePolyPolygon( SdrObject* pObj , css::drawing::PolygonKind eNew );
+ SvxShapePolyPolygon( SdrObject* pObj );
virtual ~SvxShapePolyPolygon() throw() override;
// Local support functions
@@ -642,32 +642,6 @@ public:
* *
***********************************************************************/
-class SvxShapePolyPolygonBezier : public SvxShapeText
-{
-private:
- css::drawing::PolygonKind mePolygonKind;
-
-protected:
- using SvxUnoTextRangeBase::setPropertyValue;
- using SvxUnoTextRangeBase::getPropertyValue;
-
-public:
- // override these for special property handling in subcasses. Return true if property is handled
- virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue ) override;
- virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, css::uno::Any& rValue ) override;
-
- SvxShapePolyPolygonBezier(SdrObject* pObj, css::drawing::PolygonKind eNew);
- virtual ~SvxShapePolyPolygonBezier() throw() override;
-
- // Local support functions
- /// @throws css::uno::RuntimeException
- void SetPolygon(const basegfx::B2DPolyPolygon & rNew);
- basegfx::B2DPolyPolygon GetPolygon() const throw();
-};
-
-/***********************************************************************
-* *
-***********************************************************************/
class SvxGraphicObject : public SvxShapeText
{
protected:
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 4c552194b08a..42fdc5be5b45 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -778,17 +778,10 @@ Reference< XShape > const & Shape::createAndInsert(
bool bIsWriter = xModelInfo->supportsService("com.sun.star.text.TextDocument");
for( i = 0; i < nNumPoints; ++i )
{
- basegfx::B2DPoint aPoint( aPoly.getB2DPoint( i ) );
+ const basegfx::B2DPoint aPoint( aPoly.getB2DPoint( i ) );
- // Guard against zero width or height.
- if (i)
- {
- const basegfx::B2DPoint& rPreviousPoint = aPoly.getB2DPoint(i - 1);
- if (aPoint.getX() - rPreviousPoint.getX() == 0)
- aPoint.setX(aPoint.getX() + 1);
- if (aPoint.getY() - rPreviousPoint.getY() == 0)
- aPoint.setY(aPoint.getY() + 1);
- }
+ // tdf#106792 Not needed anymore due to the change in SdrPathObj::NbcResize:
+ // tdf#96674: Guard against zero width or height.
if (bIsWriter && bInGroup)
// Writer's draw page is in twips, and these points get passed
diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk
index 409785f35ef8..cd9aac96df45 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -1158,7 +1158,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/mod/_svx/SvxShapeDimensioning \
qadevOOo/tests/java/mod/_svx/SvxShapeGroup \
qadevOOo/tests/java/mod/_svx/SvxShapePolyPolygon \
- qadevOOo/tests/java/mod/_svx/SvxShapePolyPolygonBezier \
qadevOOo/tests/java/mod/_svx/SvxUnoNumberingRules \
qadevOOo/tests/java/mod/_svx/SvxUnoText \
qadevOOo/tests/java/mod/_svx/SvxUnoTextContent \
diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index d50429d727a3..107d59b1f668 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -5882,7 +5882,6 @@ include/basegfx/utils/lerp.hxx
include/basegfx/utils/rectcliptools.hxx
include/basegfx/utils/tools.hxx
include/basegfx/utils/unopolypolygon.hxx
-include/basegfx/utils/unotools.hxx
include/basegfx/utils/zoomtools.hxx
include/basegfx/vector/b2dsize.hxx
include/basegfx/vector/b2dvector.hxx
diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
index 2a62c0ac1daf..0af26801cd4d 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>
@@ -483,7 +482,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 23308b4eaf40..f9ec9f6a879b 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 dd4b02e4bb8b..f31cd683fd47 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -2320,6 +2320,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 8f252456b107..e039633d903a 100644
--- a/svx/source/unodraw/unopage.cxx
+++ b/svx/source/unodraw/unopage.cxx
@@ -653,7 +653,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 );
@@ -665,24 +665,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 );
@@ -758,10 +758,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 ccd37a7250ce..02c3e6f9b1be 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,8 +60,8 @@
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
-#include <basegfx/utils/unotools.hxx>
#include <comphelper/servicehelper.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <com/sun/star/awt/XBitmap.hpp>
#include <svx/svdograf.hxx>
#include <sfx2/docfile.hxx>
@@ -917,59 +918,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;
}
@@ -977,7 +969,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() )
{
@@ -985,7 +980,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
@@ -995,6 +990,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:
@@ -1016,8 +1028,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;
@@ -1029,61 +1045,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;
@@ -1091,38 +1081,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();
@@ -1139,7 +1137,7 @@ bool SvxShapePolyPolygon::getPropertyValueImpl( const OUString& rName, const Sfx
}
case OWN_ATTR_VALUE_POLYGONKIND:
{
- rValue <<= mePolygonKind;
+ rValue <<= GetPolygonKind();
break;
}
default:
@@ -1149,129 +1147,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;
@@ -1280,7 +1179,7 @@ void SvxShapePolyPolygonBezier::SetPolygon(const basegfx::B2DPolyPolygon& rNew)
}
-basegfx::B2DPolyPolygon SvxShapePolyPolygonBezier::GetPolygon() const throw()
+basegfx::B2DPolyPolygon SvxShapePolyPolygon::GetPolygon() const throw()
{
::SolarMutexGuard aGuard;
@@ -1294,6 +1193,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 1a187f773d64..636ff7159d35 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>
@@ -2734,7 +2733,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);
}
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 300bc3a70499..fd1d10af2794 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -651,8 +651,12 @@ DECLARE_OOXMLIMPORT_TEST(testBnc779620, "bnc779620.docx")
DECLARE_OOXMLIMPORT_TEST(testTdf105127, "tdf105127.docx")
{
auto aPolyPolygon = getProperty<drawing::PolyPolygonBezierCoords>(getShape(1), "PolyPolygonBezier");
- // This was 1910, the shape was rendered upside down.
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3257), aPolyPolygon.Coordinates[0][0].Y);
+ // tdf#106792 These values were wrong all the time due to a missing
+ // conversion in SvxShapePolyPolygon::getPropertyValueImpl. There was no
+ // ForceMetricTo100th_mm -> the old results were in twips due to the
+ // object residing in Writer. The UNO API by definition is in 100thmm,
+ // thus I will correct the value here.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(5744), aPolyPolygon.Coordinates[0][0].Y); // was: 3257
}
DECLARE_OOXMLIMPORT_TEST(testTdf105143, "tdf105143.docx")
@@ -1069,8 +1073,17 @@ DECLARE_OOXMLIMPORT_TEST(testTdf85232, "tdf85232.docx")
uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(xShape, uno::UNO_QUERY);
// Make sure we're not testing the ellipse child.
CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.LineShape"), xShapeDescriptor->getShapeType());
- // This was 2900: horizontal position of the line was incorrect, the 3 children were not connected visually.
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2267), xShape->getPosition().X);
+
+ // tdf#106792 checked that during load of tdf85232.docx the method
+ // SvxShapePolyPolygon::setPropertyValueImpl is used three times. In
+ // that method, a call to ForceMetricToItemPoolMetric was missing so
+ // that the import did not convert the input values from 100thmm
+ // to twips what is needed due to the object residing in Writer. The
+ // UNO API by definition is in 100thmm. Result is that in SwXShape::getPosition
+ // the offset (aOffset) now is (0, 0) instead of an existing offset in
+ // the load of the document before (what is plausible for a GroupObject).
+ // Thus, I will adapt the result value here to the now (hopefully) correct one.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1630), xShape->getPosition().X); // was: 2267
}
DECLARE_OOXMLIMPORT_TEST(testTdf95755, "tdf95755.docx")
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index a5271cd6332e..ab7faf20c2e9 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -206,7 +206,12 @@ DECLARE_OOXMLIMPORT_TEST(testTdf113182, "tdf113182.docx") { CPPUNIT_ASSERT_EQUAL
DECLARE_OOXMLIMPORT_TEST(testTdf113946, "tdf113946.docx")
{
OUString aTop = parseDump("/root/page/body/txt/anchored/SwAnchoredDrawObject/bounds", "top");
- CPPUNIT_ASSERT_EQUAL(OUString("1696"), aTop);
+ // tdf#106792 Checked loading of tdf113946.docx. Before the change, the expected
+ // value of this test was "1696". Opening the file shows a single short line anchored
+ // at the doc start. Only diff is that in 'old' version it is slightly rotated, in 'new'
+ // version line is strict hiorizontal. Checked against MSWord2013, there the line
+ // is also not rotated -> the change is to the better, correct the expected result here.
+ CPPUNIT_ASSERT_EQUAL(OUString("1695"), aTop);
}
DECLARE_OOXMLIMPORT_TEST(testTdf121804, "tdf121804.docx")
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 87fbbb51989b..114cae4d8170 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1258,13 +1258,21 @@ DECLARE_RTFIMPORT_TEST(testTdf90097, "tdf90097.rtf")
uno::Sequence<uno::Sequence<awt::Point>> aPolyPolySequence;
xShape->getPropertyValue("PolyPolygon") >>= aPolyPolySequence;
uno::Sequence<awt::Point>& rPolygon = aPolyPolySequence[0];
+
+ // tdf#106792 These values were wrong all the time due to a missing
+ // conversion in SvxShapePolyPolygon::getPropertyValueImpl. There was no
+ // ForceMetricTo100th_mm -> the old results were in twips due to the
+ // object residing in Writer. The UNO API by definition is in 100thmm,
+ // thus I will correct the values here.
+ // Indeed need to use the Linux values, I have no idea why these differ
+ // from Mac/Win ones, but the disable above hints to that (maybe a problem
+ // of it's own). Factor between Twips and 100thmm is ca. 1.76 -> stable change
+
// Vertical flip for the line shape was ignored, so Y coordinates were swapped.
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2819), rPolygon[0].X);
- // This was 1619.
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1963), rPolygon[0].Y);
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3181), rPolygon[1].X);
- // This was 1962.
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1620), rPolygon[1].Y);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4972), rPolygon[0].X); // was: 2819, win is 10927
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3463), rPolygon[0].Y); // was: 1963
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(5617), rPolygon[1].X); // was: 3181, win is 11572
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2852), rPolygon[1].Y); // was: 1620
}
#endif
diff --git a/xmloff/source/draw/xexptran.cxx b/xmloff/source/draw/xexptran.cxx
index 54f7f70631a1..fc4a4a30fc38 100644
--- a/xmloff/source/draw/xexptran.cxx
+++ b/xmloff/source/draw/xexptran.cxx
@@ -32,7 +32,6 @@
#include <basegfx/numeric/ftools.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
-#include <basegfx/utils/unotools.hxx>
#include <basegfx/matrix/b3dhommatrixtools.hxx>
using namespace ::com::sun::star;