You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2013/11/07 15:30:09 UTC
svn commit: r1539657 [31/50] - in /openoffice/branches/alg/aw080: ./
ext_sources/ extras/l10n/source/ast/ extras/l10n/source/bg/
extras/l10n/source/cs/ extras/l10n/source/da/ extras/l10n/source/de/
extras/l10n/source/el/ extras/l10n/source/en-GB/ extra...
Modified: openoffice/branches/alg/aw080/main/basegfx/source/polygon/b2dsvgpolypolygon.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/basegfx/source/polygon/b2dsvgpolypolygon.cxx?rev=1539657&r1=1539656&r2=1539657&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/basegfx/source/polygon/b2dsvgpolypolygon.cxx (original)
+++ openoffice/branches/alg/aw080/main/basegfx/source/polygon/b2dsvgpolypolygon.cxx Thu Nov 7 14:29:41 2013
@@ -36,76 +36,97 @@
namespace basegfx
{
- namespace tools
- {
- bool importFromSvgD(B2DPolyPolygon& o_rPolyPolygon, const ::rtl::OUString& rSvgDStatement)
+ namespace tools
+ {
+ bool PointIndex::operator<(const PointIndex& rComp) const
+ {
+ if(rComp.getPolygonIndex() == getPolygonIndex())
+ {
+ return rComp.getPointIndex() < getPointIndex();
+ }
+
+ return rComp.getPolygonIndex() < getPolygonIndex();
+ }
+
+ bool importFromSvgD(
+ B2DPolyPolygon& o_rPolyPolygon,
+ const ::rtl::OUString& rSvgDStatement,
+ bool bHandleRelativeNextPointCompatible,
+ PointIndexSet* pHelpPointIndexSet)
{
o_rPolyPolygon.clear();
const sal_Int32 nLen(rSvgDStatement.getLength());
sal_Int32 nPos(0);
- bool bIsClosed(false);
double nLastX( 0.0 );
double nLastY( 0.0 );
- B2DPolygon aCurrPoly;
+ B2DPolygon aCurrPoly;
- // skip initial whitespace
+ // skip initial whitespace
::basegfx::internal::lcl_skipSpaces(nPos, rSvgDStatement, nLen);
while(nPos < nLen)
{
bool bRelative(false);
- bool bMoveTo(false);
const sal_Unicode aCurrChar(rSvgDStatement[nPos]);
+ if(o_rPolyPolygon.count() && !aCurrPoly.count() && !('m' == aCurrChar || 'M' == aCurrChar))
+ {
+ // we have a new sub-polygon starting, but without a 'moveto' command.
+ // this requires to add the current point as start point to the polygon
+ // (see SVG1.1 8.3.3 The "closepath" command)
+ aCurrPoly.append(B2DPoint(nLastX, nLastY));
+ }
+
switch(aCurrChar)
{
case 'z' :
case 'Z' :
{
+ // consume CurrChar and whitespace
nPos++;
::basegfx::internal::lcl_skipSpaces(nPos, rSvgDStatement, nLen);
- // remember closed state of current polygon
- bIsClosed = true;
+ // create closed polygon and reset import values
+ if(aCurrPoly.count())
+ {
+ if(!bHandleRelativeNextPointCompatible)
+ {
+ // SVG defines that "the next subpath starts at the
+ // same initial point as the current subpath", so set the
+ // current point if we do not need to be compatible
+ nLastX = aCurrPoly.getB2DPoint(0).getX();
+ nLastY = aCurrPoly.getB2DPoint(0).getY();
+ }
+
+ aCurrPoly.setClosed(true);
+ o_rPolyPolygon.append(aCurrPoly);
+ aCurrPoly.clear();
+ }
+
break;
}
-
+
case 'm' :
case 'M' :
{
- bMoveTo = true;
- // FALLTHROUGH intended
+ // create non-closed polygon and reset import values
+ if(aCurrPoly.count())
+ {
+ o_rPolyPolygon.append(aCurrPoly);
+ aCurrPoly.clear();
+ }
+
+ // FALLTHROUGH intended to add coordinate data as 1st point of new polygon
}
case 'l' :
case 'L' :
{
if('m' == aCurrChar || 'l' == aCurrChar)
- {
- bRelative = true;
- }
-
- if(bMoveTo)
{
- // new polygon start, finish old one
- if(aCurrPoly.count())
- {
- // add current polygon
- if(bIsClosed)
- {
- // #123465# no need to do the old closeWithGeometryChange
- // corerection on SVG polygons; this even may lead to wrong
- // results e.g. for marker processing
- aCurrPoly.setClosed(true);
- }
-
- o_rPolyPolygon.append(aCurrPoly);
-
- // reset import values
- bIsClosed = false;
- aCurrPoly.clear();
- }
+ bRelative = true;
}
+ // consume CurrChar and whitespace
nPos++;
::basegfx::internal::lcl_skipSpaces(nPos, rSvgDStatement, nLen);
@@ -125,7 +146,7 @@ namespace basegfx
// set last position
nLastX = nX;
nLastY = nY;
-
+
// add point
aCurrPoly.append(B2DPoint(nX, nY));
}
@@ -149,19 +170,19 @@ namespace basegfx
if(!::basegfx::internal::lcl_importDoubleAndSpaces(nX, nPos, rSvgDStatement, nLen)) return false;
if(bRelative)
- {
+ {
nX += nLastX;
- }
+ }
// set last position
nLastX = nX;
-
+
// add point
aCurrPoly.append(B2DPoint(nX, nY));
}
break;
}
-
+
case 'v' :
{
bRelative = true;
@@ -179,19 +200,19 @@ namespace basegfx
if(!::basegfx::internal::lcl_importDoubleAndSpaces(nY, nPos, rSvgDStatement, nLen)) return false;
if(bRelative)
- {
+ {
nY += nLastY;
- }
+ }
// set last position
nLastY = nY;
-
+
// add point
aCurrPoly.append(B2DPoint(nX, nY));
}
break;
}
-
+
case 's' :
{
bRelative = true;
@@ -220,29 +241,29 @@ namespace basegfx
nY += nLastY;
}
- // ensure existance of start point
- if(!aCurrPoly.count())
- {
+ // ensure existance of start point
+ if(!aCurrPoly.count())
+ {
aCurrPoly.append(B2DPoint(nLastX, nLastY));
- }
+ }
- // get first control point. It's the reflection of the PrevControlPoint
- // of the last point. If not existent, use current point (see SVG)
- B2DPoint aPrevControl(B2DPoint(nLastX, nLastY));
- const sal_uInt32 nIndex(aCurrPoly.count() - 1);
-
- if(aCurrPoly.areControlPointsUsed() && aCurrPoly.isPrevControlPointUsed(nIndex))
- {
- const B2DPoint aPrevPoint(aCurrPoly.getB2DPoint(nIndex));
- const B2DPoint aPrevControlPoint(aCurrPoly.getPrevControlPoint(nIndex));
-
- // use mirrored previous control point
- aPrevControl.setX((2.0 * aPrevPoint.getX()) - aPrevControlPoint.getX());
- aPrevControl.setY((2.0 * aPrevPoint.getY()) - aPrevControlPoint.getY());
- }
+ // get first control point. It's the reflection of the PrevControlPoint
+ // of the last point. If not existent, use current point (see SVG)
+ B2DPoint aPrevControl(B2DPoint(nLastX, nLastY));
+ const sal_uInt32 nIndex(aCurrPoly.count() - 1);
- // append curved edge
- aCurrPoly.appendBezierSegment(aPrevControl, B2DPoint(nX2, nY2), B2DPoint(nX, nY));
+ if(aCurrPoly.areControlPointsUsed() && aCurrPoly.isPrevControlPointUsed(nIndex))
+ {
+ const B2DPoint aPrevPoint(aCurrPoly.getB2DPoint(nIndex));
+ const B2DPoint aPrevControlPoint(aCurrPoly.getPrevControlPoint(nIndex));
+
+ // use mirrored previous control point
+ aPrevControl.setX((2.0 * aPrevPoint.getX()) - aPrevControlPoint.getX());
+ aPrevControl.setY((2.0 * aPrevPoint.getY()) - aPrevControlPoint.getY());
+ }
+
+ // append curved edge
+ aCurrPoly.appendBezierSegment(aPrevControl, B2DPoint(nX2, nY2), B2DPoint(nX, nY));
// set last position
nLastX = nX;
@@ -250,7 +271,7 @@ namespace basegfx
}
break;
}
-
+
case 'c' :
{
bRelative = true;
@@ -284,14 +305,14 @@ namespace basegfx
nY += nLastY;
}
- // ensure existance of start point
- if(!aCurrPoly.count())
- {
+ // ensure existance of start point
+ if(!aCurrPoly.count())
+ {
aCurrPoly.append(B2DPoint(nLastX, nLastY));
- }
+ }
- // append curved edge
- aCurrPoly.appendBezierSegment(B2DPoint(nX1, nY1), B2DPoint(nX2, nY2), B2DPoint(nX, nY));
+ // append curved edge
+ aCurrPoly.appendBezierSegment(B2DPoint(nX1, nY1), B2DPoint(nX2, nY2), B2DPoint(nX, nY));
// set last position
nLastX = nX;
@@ -299,7 +320,7 @@ namespace basegfx
}
break;
}
-
+
// #100617# quadratic beziers are imported as cubic ones
case 'q' :
{
@@ -335,14 +356,14 @@ namespace basegfx
const double nX2Prime((nX1 * 2.0 + nX) / 3.0);
const double nY2Prime((nY1 * 2.0 + nY) / 3.0);
- // ensure existance of start point
- if(!aCurrPoly.count())
- {
+ // ensure existance of start point
+ if(!aCurrPoly.count())
+ {
aCurrPoly.append(B2DPoint(nLastX, nLastY));
- }
+ }
- // append curved edge
- aCurrPoly.appendBezierSegment(B2DPoint(nX1Prime, nY1Prime), B2DPoint(nX2Prime, nY2Prime), B2DPoint(nX, nY));
+ // append curved edge
+ aCurrPoly.appendBezierSegment(B2DPoint(nX1Prime, nY1Prime), B2DPoint(nX2Prime, nY2Prime), B2DPoint(nX, nY));
// set last position
nLastX = nX;
@@ -350,7 +371,7 @@ namespace basegfx
}
break;
}
-
+
// #100617# relative quadratic beziers are imported as cubic
case 't' :
{
@@ -375,49 +396,49 @@ namespace basegfx
nY += nLastY;
}
- // ensure existance of start point
- if(!aCurrPoly.count())
- {
+ // ensure existance of start point
+ if(!aCurrPoly.count())
+ {
aCurrPoly.append(B2DPoint(nLastX, nLastY));
- }
+ }
- // get first control point. It's the reflection of the PrevControlPoint
- // of the last point. If not existent, use current point (see SVG)
- B2DPoint aPrevControl(B2DPoint(nLastX, nLastY));
- const sal_uInt32 nIndex(aCurrPoly.count() - 1);
- const B2DPoint aPrevPoint(aCurrPoly.getB2DPoint(nIndex));
-
- if(aCurrPoly.areControlPointsUsed() && aCurrPoly.isPrevControlPointUsed(nIndex))
- {
- const B2DPoint aPrevControlPoint(aCurrPoly.getPrevControlPoint(nIndex));
-
- // use mirrored previous control point
- aPrevControl.setX((2.0 * aPrevPoint.getX()) - aPrevControlPoint.getX());
- aPrevControl.setY((2.0 * aPrevPoint.getY()) - aPrevControlPoint.getY());
- }
-
- if(!aPrevControl.equal(aPrevPoint))
- {
- // there is a prev control point, and we have the already mirrored one
- // in aPrevControl. We also need the quadratic control point for this
- // new quadratic segment to calculate the 2nd cubic control point
- const B2DPoint aQuadControlPoint(
- ((3.0 * aPrevControl.getX()) - aPrevPoint.getX()) / 2.0,
- ((3.0 * aPrevControl.getY()) - aPrevPoint.getY()) / 2.0);
-
- // calculate the cubic bezier coefficients from the quadratic ones.
- const double nX2Prime((aQuadControlPoint.getX() * 2.0 + nX) / 3.0);
- const double nY2Prime((aQuadControlPoint.getY() * 2.0 + nY) / 3.0);
-
- // append curved edge, use mirrored cubic control point directly
- aCurrPoly.appendBezierSegment(aPrevControl, B2DPoint(nX2Prime, nY2Prime), B2DPoint(nX, nY));
- }
- else
- {
- // when no previous control, SVG says to use current point -> straight line.
- // Just add end point
- aCurrPoly.append(B2DPoint(nX, nY));
- }
+ // get first control point. It's the reflection of the PrevControlPoint
+ // of the last point. If not existent, use current point (see SVG)
+ B2DPoint aPrevControl(B2DPoint(nLastX, nLastY));
+ const sal_uInt32 nIndex(aCurrPoly.count() - 1);
+ const B2DPoint aPrevPoint(aCurrPoly.getB2DPoint(nIndex));
+
+ if(aCurrPoly.areControlPointsUsed() && aCurrPoly.isPrevControlPointUsed(nIndex))
+ {
+ const B2DPoint aPrevControlPoint(aCurrPoly.getPrevControlPoint(nIndex));
+
+ // use mirrored previous control point
+ aPrevControl.setX((2.0 * aPrevPoint.getX()) - aPrevControlPoint.getX());
+ aPrevControl.setY((2.0 * aPrevPoint.getY()) - aPrevControlPoint.getY());
+ }
+
+ if(!aPrevControl.equal(aPrevPoint))
+ {
+ // there is a prev control point, and we have the already mirrored one
+ // in aPrevControl. We also need the quadratic control point for this
+ // new quadratic segment to calculate the 2nd cubic control point
+ const B2DPoint aQuadControlPoint(
+ ((3.0 * aPrevControl.getX()) - aPrevPoint.getX()) / 2.0,
+ ((3.0 * aPrevControl.getY()) - aPrevPoint.getY()) / 2.0);
+
+ // calculate the cubic bezier coefficients from the quadratic ones.
+ const double nX2Prime((aQuadControlPoint.getX() * 2.0 + nX) / 3.0);
+ const double nY2Prime((aQuadControlPoint.getY() * 2.0 + nY) / 3.0);
+
+ // append curved edge, use mirrored cubic control point directly
+ aCurrPoly.appendBezierSegment(aPrevControl, B2DPoint(nX2Prime, nY2Prime), B2DPoint(nX, nY));
+ }
+ else
+ {
+ // when no previous control, SVG says to use current point -> straight line.
+ // Just add end point
+ aCurrPoly.append(B2DPoint(nX, nY));
+ }
// set last position
nLastX = nX;
@@ -456,7 +477,7 @@ namespace basegfx
nY += nLastY;
}
- const B2DPoint aPrevPoint(aCurrPoly.getB2DPoint(aCurrPoly.count() - 1));
+ const B2DPoint aPrevPoint(aCurrPoly.getB2DPoint(aCurrPoly.count() - 1));
if( nX == nLastX && nY == nLastY )
continue; // start==end -> skip according to SVG spec
@@ -590,7 +611,22 @@ namespace basegfx
// if we swapped angles above
if( bFlipSegment )
aSegment.flip();
+
+ // remember PointIndex of evtl. added pure helper points
+ sal_uInt32 nPointIndex(aCurrPoly.count() + 1);
aCurrPoly.append(aSegment);
+
+ // if asked for, mark pure helper points by adding them to the index list of
+ // helper points
+ if(pHelpPointIndexSet && aCurrPoly.count() > 1)
+ {
+ const sal_uInt32 nPolyIndex(o_rPolyPolygon.count());
+
+ for(;nPointIndex + 1 < aCurrPoly.count(); nPointIndex++)
+ {
+ pHelpPointIndexSet->insert(PointIndex(nPolyIndex, nPointIndex));
+ }
+ }
}
// set last position
@@ -610,18 +646,10 @@ namespace basegfx
}
}
+ // if there is polygon data, create non-closed polygon
if(aCurrPoly.count())
{
- // end-process last poly
- if(bIsClosed)
- {
- // #123465# no need to do the old closeWithGeometryChange
- // corerection on SVG polygons; this even may lead to wrong
- // results e.g. for marker processing
- aCurrPoly.setClosed(true);
- }
-
- o_rPolyPolygon.append(aCurrPoly);
+ o_rPolyPolygon.append(aCurrPoly);
}
return true;
@@ -677,9 +705,10 @@ namespace basegfx
}
::rtl::OUString exportToSvgD(
- const B2DPolyPolygon& rPolyPolygon,
- bool bUseRelativeCoordinates,
- bool bDetectQuadraticBeziers)
+ const B2DPolyPolygon& rPolyPolygon,
+ bool bUseRelativeCoordinates,
+ bool bDetectQuadraticBeziers,
+ bool bHandleRelativeNextPointCompatible)
{
const sal_uInt32 nCount(rPolyPolygon.count());
::rtl::OUStringBuffer aResult;
@@ -690,217 +719,235 @@ namespace basegfx
const B2DPolygon aPolygon(rPolyPolygon.getB2DPolygon(i));
const sal_uInt32 nPointCount(aPolygon.count());
- if(nPointCount)
- {
- const bool bPolyUsesControlPoints(aPolygon.areControlPointsUsed());
- const sal_uInt32 nEdgeCount(aPolygon.isClosed() ? nPointCount : nPointCount - 1);
- sal_Unicode aLastSVGCommand(' '); // last SVG command char
- B2DPoint aLeft, aRight; // for quadratic bezier test
-
- // handle polygon start point
- B2DPoint aEdgeStart(aPolygon.getB2DPoint(0));
- aResult.append(::basegfx::internal::lcl_getCommand('M', 'm', bUseRelativeCoordinates));
- ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeStart.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
- ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeStart.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
- aLastSVGCommand = ::basegfx::internal::lcl_getCommand('L', 'l', bUseRelativeCoordinates);
- aCurrentSVGPosition = aEdgeStart;
-
- for(sal_uInt32 nIndex(0); nIndex < nEdgeCount; nIndex++)
- {
- // prepare access to next point
- const sal_uInt32 nNextIndex((nIndex + 1) % nPointCount);
- const B2DPoint aEdgeEnd(aPolygon.getB2DPoint(nNextIndex));
-
- // handle edge from (aEdgeStart, aEdgeEnd) using indices (nIndex, nNextIndex)
- const bool bEdgeIsBezier(bPolyUsesControlPoints
- && (aPolygon.isNextControlPointUsed(nIndex) || aPolygon.isPrevControlPointUsed(nNextIndex)));
-
- if(bEdgeIsBezier)
- {
- // handle bezier edge
- const B2DPoint aControlEdgeStart(aPolygon.getNextControlPoint(nIndex));
- const B2DPoint aControlEdgeEnd(aPolygon.getPrevControlPoint(nNextIndex));
- bool bIsQuadraticBezier(false);
-
- // check continuity at current edge's start point. For SVG, do NOT use an
- // existing continuity since no 'S' or 's' statement should be written. At
- // import, that 'previous' control vector is not available. SVG documentation
- // says for interpretation:
- //
- // "(If there is no previous command or if the previous command was
- // not an C, c, S or s, assume the first control point is coincident
- // with the current point.)"
- //
- // That's what is done from our import, so avoid exporting it as first statement
- // is necessary.
- const bool bSymmetricAtEdgeStart(
- 0 != nIndex
- && CONTINUITY_C2 == aPolygon.getContinuityInPoint(nIndex));
-
- if(bDetectQuadraticBeziers)
- {
- // check for quadratic beziers - that's
- // the case if both control points are in
- // the same place when they are prolonged
- // to the common quadratic control point
- //
- // Left: P = (3P1 - P0) / 2
- // Right: P = (3P2 - P3) / 2
- aLeft = B2DPoint((3.0 * aControlEdgeStart - aEdgeStart) / 2.0);
- aRight= B2DPoint((3.0 * aControlEdgeEnd - aEdgeEnd) / 2.0);
- bIsQuadraticBezier = aLeft.equal(aRight);
- }
-
- if(bIsQuadraticBezier)
- {
- // approximately equal, export as quadratic bezier
- if(bSymmetricAtEdgeStart)
- {
- const sal_Unicode aCommand(::basegfx::internal::lcl_getCommand('T', 't', bUseRelativeCoordinates));
+ if(nPointCount)
+ {
+ const bool bPolyUsesControlPoints(aPolygon.areControlPointsUsed());
+ const sal_uInt32 nEdgeCount(aPolygon.isClosed() ? nPointCount : nPointCount - 1);
+ sal_Unicode aLastSVGCommand(' '); // last SVG command char
+ B2DPoint aLeft, aRight; // for quadratic bezier test
+
+ // handle polygon start point
+ B2DPoint aEdgeStart(aPolygon.getB2DPoint(0));
+ bool bUseRelativeCoordinatesForFirstPoint(bUseRelativeCoordinates);
+
+ if(bHandleRelativeNextPointCompatible)
+ {
+ // To get around the error that the start point for the next polygon is the
+ // start point of the current one (and not the last as it was handled up to now)
+ // do force to write an absolute 'M' command as start for the next polygon
+ bUseRelativeCoordinatesForFirstPoint = false;
+ }
+
+ // Write 'moveto' and the 1st coordinates, set aLastSVGCommand to 'lineto'
+ aResult.append(::basegfx::internal::lcl_getCommand('M', 'm', bUseRelativeCoordinatesForFirstPoint));
+ ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeStart.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinatesForFirstPoint);
+ ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeStart.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinatesForFirstPoint);
+ aLastSVGCommand = ::basegfx::internal::lcl_getCommand('L', 'l', bUseRelativeCoordinatesForFirstPoint);
+ aCurrentSVGPosition = aEdgeStart;
+
+ for(sal_uInt32 nIndex(0); nIndex < nEdgeCount; nIndex++)
+ {
+ // prepare access to next point
+ const sal_uInt32 nNextIndex((nIndex + 1) % nPointCount);
+ const B2DPoint aEdgeEnd(aPolygon.getB2DPoint(nNextIndex));
+
+ // handle edge from (aEdgeStart, aEdgeEnd) using indices (nIndex, nNextIndex)
+ const bool bEdgeIsBezier(bPolyUsesControlPoints
+ && (aPolygon.isNextControlPointUsed(nIndex) || aPolygon.isPrevControlPointUsed(nNextIndex)));
+
+ if(bEdgeIsBezier)
+ {
+ // handle bezier edge
+ const B2DPoint aControlEdgeStart(aPolygon.getNextControlPoint(nIndex));
+ const B2DPoint aControlEdgeEnd(aPolygon.getPrevControlPoint(nNextIndex));
+ bool bIsQuadraticBezier(false);
+
+ // check continuity at current edge's start point. For SVG, do NOT use an
+ // existing continuity since no 'S' or 's' statement should be written. At
+ // import, that 'previous' control vector is not available. SVG documentation
+ // says for interpretation:
+ //
+ // "(If there is no previous command or if the previous command was
+ // not an C, c, S or s, assume the first control point is coincident
+ // with the current point.)"
+ //
+ // That's what is done from our import, so avoid exporting it as first statement
+ // is necessary.
+ const bool bSymmetricAtEdgeStart(
+ 0 != nIndex
+ && CONTINUITY_C2 == aPolygon.getContinuityInPoint(nIndex));
+
+ if(bDetectQuadraticBeziers)
+ {
+ // check for quadratic beziers - that's
+ // the case if both control points are in
+ // the same place when they are prolonged
+ // to the common quadratic control point
+ //
+ // Left: P = (3P1 - P0) / 2
+ // Right: P = (3P2 - P3) / 2
+ aLeft = B2DPoint((3.0 * aControlEdgeStart - aEdgeStart) / 2.0);
+ aRight= B2DPoint((3.0 * aControlEdgeEnd - aEdgeEnd) / 2.0);
+ bIsQuadraticBezier = aLeft.equal(aRight);
+ }
- if(aLastSVGCommand != aCommand)
- {
+ if(bIsQuadraticBezier)
+ {
+ // approximately equal, export as quadratic bezier
+ if(bSymmetricAtEdgeStart)
+ {
+ const sal_Unicode aCommand(::basegfx::internal::lcl_getCommand('T', 't', bUseRelativeCoordinates));
+
+ if(aLastSVGCommand != aCommand)
+ {
aResult.append(aCommand);
- aLastSVGCommand = aCommand;
- }
+ aLastSVGCommand = aCommand;
+ }
- ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
- ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
- aLastSVGCommand = aCommand;
- aCurrentSVGPosition = aEdgeEnd;
- }
- else
- {
- const sal_Unicode aCommand(::basegfx::internal::lcl_getCommand('Q', 'q', bUseRelativeCoordinates));
+ ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
+ ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
+ aLastSVGCommand = aCommand;
+ aCurrentSVGPosition = aEdgeEnd;
+ }
+ else
+ {
+ const sal_Unicode aCommand(::basegfx::internal::lcl_getCommand('Q', 'q', bUseRelativeCoordinates));
- if(aLastSVGCommand != aCommand)
- {
+ if(aLastSVGCommand != aCommand)
+ {
aResult.append(aCommand);
- aLastSVGCommand = aCommand;
- }
+ aLastSVGCommand = aCommand;
+ }
- ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aLeft.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
- ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aLeft.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
- ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
- ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
- aLastSVGCommand = aCommand;
- aCurrentSVGPosition = aEdgeEnd;
- }
- }
- else
- {
- // export as cubic bezier
- if(bSymmetricAtEdgeStart)
- {
- const sal_Unicode aCommand(::basegfx::internal::lcl_getCommand('S', 's', bUseRelativeCoordinates));
+ ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aLeft.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
+ ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aLeft.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
+ ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
+ ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
+ aLastSVGCommand = aCommand;
+ aCurrentSVGPosition = aEdgeEnd;
+ }
+ }
+ else
+ {
+ // export as cubic bezier
+ if(bSymmetricAtEdgeStart)
+ {
+ const sal_Unicode aCommand(::basegfx::internal::lcl_getCommand('S', 's', bUseRelativeCoordinates));
- if(aLastSVGCommand != aCommand)
- {
+ if(aLastSVGCommand != aCommand)
+ {
aResult.append(aCommand);
- aLastSVGCommand = aCommand;
- }
+ aLastSVGCommand = aCommand;
+ }
- ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aControlEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
- ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aControlEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
- ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
- ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
- aLastSVGCommand = aCommand;
- aCurrentSVGPosition = aEdgeEnd;
- }
- else
- {
- const sal_Unicode aCommand(::basegfx::internal::lcl_getCommand('C', 'c', bUseRelativeCoordinates));
+ ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aControlEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
+ ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aControlEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
+ ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
+ ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
+ aLastSVGCommand = aCommand;
+ aCurrentSVGPosition = aEdgeEnd;
+ }
+ else
+ {
+ const sal_Unicode aCommand(::basegfx::internal::lcl_getCommand('C', 'c', bUseRelativeCoordinates));
- if(aLastSVGCommand != aCommand)
- {
+ if(aLastSVGCommand != aCommand)
+ {
aResult.append(aCommand);
- aLastSVGCommand = aCommand;
- }
+ aLastSVGCommand = aCommand;
+ }
- ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aControlEdgeStart.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
- ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aControlEdgeStart.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
- ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aControlEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
- ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aControlEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
- ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
- ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
- aLastSVGCommand = aCommand;
- aCurrentSVGPosition = aEdgeEnd;
- }
- }
- }
- else
- {
- // straight edge
- if(0 == nNextIndex)
- {
- // it's a closed polygon's last edge and it's not a bezier edge, so there is
- // no need to write it
- }
- else
- {
- const bool bXEqual(aEdgeStart.getX() == aEdgeEnd.getX());
- const bool bYEqual(aEdgeStart.getY() == aEdgeEnd.getY());
-
- if(bXEqual && bYEqual)
- {
- // point is a double point; do not export at all
- }
- else if(bXEqual)
- {
- // export as vertical line
- const sal_Unicode aCommand(::basegfx::internal::lcl_getCommand('V', 'v', bUseRelativeCoordinates));
+ ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aControlEdgeStart.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
+ ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aControlEdgeStart.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
+ ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aControlEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
+ ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aControlEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
+ ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
+ ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
+ aLastSVGCommand = aCommand;
+ aCurrentSVGPosition = aEdgeEnd;
+ }
+ }
+ }
+ else
+ {
+ // straight edge
+ if(0 == nNextIndex)
+ {
+ // it's a closed polygon's last edge and it's not a bezier edge, so there is
+ // no need to write it
+ }
+ else
+ {
+ const bool bXEqual(aEdgeStart.getX() == aEdgeEnd.getX());
+ const bool bYEqual(aEdgeStart.getY() == aEdgeEnd.getY());
+
+ if(bXEqual && bYEqual)
+ {
+ // point is a double point; do not export at all
+ }
+ else if(bXEqual)
+ {
+ // export as vertical line
+ const sal_Unicode aCommand(::basegfx::internal::lcl_getCommand('V', 'v', bUseRelativeCoordinates));
- if(aLastSVGCommand != aCommand)
- {
+ if(aLastSVGCommand != aCommand)
+ {
aResult.append(aCommand);
- aLastSVGCommand = aCommand;
- }
+ aLastSVGCommand = aCommand;
+ }
- ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
- aCurrentSVGPosition = aEdgeEnd;
- }
- else if(bYEqual)
- {
- // export as horizontal line
- const sal_Unicode aCommand(::basegfx::internal::lcl_getCommand('H', 'h', bUseRelativeCoordinates));
+ ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
+ aCurrentSVGPosition = aEdgeEnd;
+ }
+ else if(bYEqual)
+ {
+ // export as horizontal line
+ const sal_Unicode aCommand(::basegfx::internal::lcl_getCommand('H', 'h', bUseRelativeCoordinates));
- if(aLastSVGCommand != aCommand)
- {
+ if(aLastSVGCommand != aCommand)
+ {
aResult.append(aCommand);
- aLastSVGCommand = aCommand;
- }
+ aLastSVGCommand = aCommand;
+ }
- ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
- aCurrentSVGPosition = aEdgeEnd;
- }
- else
- {
- // export as line
- const sal_Unicode aCommand(::basegfx::internal::lcl_getCommand('L', 'l', bUseRelativeCoordinates));
+ ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
+ aCurrentSVGPosition = aEdgeEnd;
+ }
+ else
+ {
+ // export as line
+ const sal_Unicode aCommand(::basegfx::internal::lcl_getCommand('L', 'l', bUseRelativeCoordinates));
- if(aLastSVGCommand != aCommand)
- {
+ if(aLastSVGCommand != aCommand)
+ {
aResult.append(aCommand);
- aLastSVGCommand = aCommand;
- }
+ aLastSVGCommand = aCommand;
+ }
+
+ ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
+ ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
+ aCurrentSVGPosition = aEdgeEnd;
+ }
+ }
+ }
- ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates);
- ::basegfx::internal::lcl_putNumberCharWithSpace(aResult, aEdgeEnd.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates);
- aCurrentSVGPosition = aEdgeEnd;
- }
- }
- }
-
- // prepare edge start for next loop step
- aEdgeStart = aEdgeEnd;
- }
-
- // close path if closed poly (Z and z are equivalent here, but looks nicer when case is matched)
- if(aPolygon.isClosed())
- {
+ // prepare edge start for next loop step
+ aEdgeStart = aEdgeEnd;
+ }
+
+ // close path if closed poly (Z and z are equivalent here, but looks nicer when case is matched)
+ if(aPolygon.isClosed())
+ {
aResult.append(::basegfx::internal::lcl_getCommand('Z', 'z', bUseRelativeCoordinates));
- }
- }
+ }
+
+ if(!bHandleRelativeNextPointCompatible)
+ {
+ // SVG defines that "the next subpath starts at the same initial point as the current subpath",
+ // so set aCurrentSVGPosition to the 1st point of the current, now ended and written path
+ aCurrentSVGPosition = aPolygon.getB2DPoint(0);
+ }
+ }
}
return aResult.makeStringAndClear();
Modified: openoffice/branches/alg/aw080/main/basegfx/source/polygon/b3dpolypolygontools.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/basegfx/source/polygon/b3dpolypolygontools.cxx?rev=1539657&r1=1539656&r2=1539657&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/basegfx/source/polygon/b3dpolypolygontools.cxx (original)
+++ openoffice/branches/alg/aw080/main/basegfx/source/polygon/b3dpolypolygontools.cxx Thu Nov 7 14:29:41 2013
@@ -665,7 +665,7 @@ namespace basegfx
}
}
- } // end of namespace tools
+ } // end of namespace tools
} // end of namespace basegfx
//////////////////////////////////////////////////////////////////////////////
Modified: openoffice/branches/alg/aw080/main/basegfx/test/basegfx2d.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/basegfx/test/basegfx2d.cxx?rev=1539657&r1=1539656&r2=1539657&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/basegfx/test/basegfx2d.cxx (original)
+++ openoffice/branches/alg/aw080/main/basegfx/test/basegfx2d.cxx Thu Nov 7 14:29:41 2013
@@ -150,23 +150,20 @@ public:
::rtl::OUString aExport;
CPPUNIT_ASSERT_MESSAGE("importing simple rectangle from SVG-D",
- tools::importFromSvgD( aPoly,
- aPath0 ));
- aExport = tools::exportToSvgD( aPoly );
+ tools::importFromSvgD( aPoly, aPath0, false, 0 ));
+ aExport = tools::exportToSvgD( aPoly, true, true, false );
const char* sExportString = "m10 10h-20v-20h20z";
CPPUNIT_ASSERT_MESSAGE("exporting rectangle to SVG-D",
!aExport.compareToAscii(sExportString) );
CPPUNIT_ASSERT_MESSAGE("importing simple rectangle from SVG-D (round-trip",
- tools::importFromSvgD( aPoly,
- aExport ));
- aExport = tools::exportToSvgD( aPoly );
+ tools::importFromSvgD( aPoly, aExport, false, 0 ));
+ aExport = tools::exportToSvgD( aPoly, true, true, false );
CPPUNIT_ASSERT_MESSAGE("exporting rectangle to SVG-D (round-trip)",
!aExport.compareToAscii(sExportString));
CPPUNIT_ASSERT_MESSAGE("importing simple bezier polygon from SVG-D",
- tools::importFromSvgD( aPoly,
- aPath1 ));
- aExport = tools::exportToSvgD( aPoly );
+ tools::importFromSvgD( aPoly, aPath1, false, 0 ));
+ aExport = tools::exportToSvgD( aPoly, true, true, false );
// Adaptions for B2DPolygon bezier change (see #i77162#):
//
@@ -193,11 +190,11 @@ public:
// a 2nd good test is that re-importing of aExport has to create the same
// B2DPolPolygon again:
B2DPolyPolygon aReImport;
- CPPUNIT_ASSERT_MESSAGE("importing simple bezier polygon from SVG-D", tools::importFromSvgD( aReImport, aExport));
+ CPPUNIT_ASSERT_MESSAGE("importing simple bezier polygon from SVG-D", tools::importFromSvgD( aReImport, aExport, false, 0));
CPPUNIT_ASSERT_MESSAGE("re-imported polygon needs to be identical", aReImport == aPoly);
- CPPUNIT_ASSERT_MESSAGE("importing '@' from SVG-D", tools::importFromSvgD( aPoly, aPath2 ));
- aExport = tools::exportToSvgD( aPoly );
+ CPPUNIT_ASSERT_MESSAGE("importing '@' from SVG-D", tools::importFromSvgD( aPoly, aPath2, , false, 0));
+ aExport = tools::exportToSvgD( aPoly, true, true, false );
// Adaptions for B2DPolygon bezier change (see #i77162#):
//
@@ -213,22 +210,20 @@ public:
"8 752-224 1128-21 101-31 183-31 245 0 39 9 70 26 93 17 24 39 36 67 36 145 0 279-80 400-240s182-365 182-615c0-2"
"88-107-533-322-734s-487-301-816-301c-395 0-715 124-960 373s-368 569-368 958q0 577.5 357 900c237 216 557 324 95"
"8 325 189-1 389-27 600-77 211-52 378-110 503-174q40.5 105 81 210z";
- CPPUNIT_ASSERT_MESSAGE("re-importing '@' from SVG-D", tools::importFromSvgD( aReImport, aExport));
+ CPPUNIT_ASSERT_MESSAGE("re-importing '@' from SVG-D", tools::importFromSvgD( aReImport, aExport, false, 0));
CPPUNIT_ASSERT_MESSAGE("re-imported '@' needs to be identical", aReImport == aPoly);
CPPUNIT_ASSERT_MESSAGE("exporting '@' to SVG-D", !aExport.compareToAscii(sExportString1));
CPPUNIT_ASSERT_MESSAGE("importing '@' from SVG-D (round-trip",
- tools::importFromSvgD( aPoly,
- aExport ));
- aExport = tools::exportToSvgD( aPoly );
+ tools::importFromSvgD( aPoly, aExport, false, 0 ));
+ aExport = tools::exportToSvgD( aPoly, true, true, false );
CPPUNIT_ASSERT_MESSAGE("exporting '@' to SVG-D (round-trip)",
!aExport.compareToAscii(sExportString1));
CPPUNIT_ASSERT_MESSAGE("importing complex polygon from SVG-D",
- tools::importFromSvgD( aPoly,
- aPath3 ));
- aExport = tools::exportToSvgD( aPoly );
+ tools::importFromSvgD( aPoly, aPath3, false, 0 ));
+ aExport = tools::exportToSvgD( aPoly, true, true, false );
const char* sExportString2 =
"m1598 125h306v2334h-306v-1105h-1293v1105h-305v-2334h305v973h1293"
"zm2159 1015 78-44 85 235-91 47-91 40-90 34-90 29-89 21-88 16-88 10-88 3-102-4-97"
@@ -253,15 +248,14 @@ public:
CPPUNIT_ASSERT_MESSAGE("exporting complex polygon to SVG-D",
!aExport.compareToAscii(sExportString2));
CPPUNIT_ASSERT_MESSAGE("importing complex polygon from SVG-D (round-trip",
- tools::importFromSvgD( aPoly,
- aExport ));
- aExport = tools::exportToSvgD( aPoly );
+ tools::importFromSvgD( aPoly, aExport, false, 0 ));
+ aExport = tools::exportToSvgD( aPoly, true, true, false );
CPPUNIT_ASSERT_MESSAGE("exporting complex polygon to SVG-D (round-trip)",
!aExport.compareToAscii(sExportString2));
const B2DPolygon aRect(
tools::createPolygonFromRect( B2DRange(0.0,0.0,4000.0,4000.0) ));
- aExport = tools::exportToSvgD( B2DPolyPolygon(aRect), false, false);
+ aExport = tools::exportToSvgD( B2DPolyPolygon(aRect), false, false, false );
const char* sExportStringRect = "M0 0H4000V4000H0Z";
CPPUNIT_ASSERT_MESSAGE("exporting to rectangle svg-d string",
Modified: openoffice/branches/alg/aw080/main/basegfx/test/boxclipper.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/basegfx/test/boxclipper.cxx?rev=1539657&r1=1539656&r2=1539657&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/basegfx/test/boxclipper.cxx (original)
+++ openoffice/branches/alg/aw080/main/basegfx/test/boxclipper.cxx Thu Nov 7 14:29:41 2013
@@ -175,7 +175,7 @@ public:
B2DPolyPolygon randomPoly;
tools::importFromSvgD(
randomPoly,
- rtl::OUString::createFromAscii(randomSvg));
+ rtl::OUString::createFromAscii(randomSvg), false, 0);
std::for_each(randomPoly.begin(),
randomPoly.end(),
boost::bind(
@@ -243,16 +243,14 @@ public:
B2DPolyPolygon aTmp1;
CPPUNIT_ASSERT_MESSAGE(sName,
tools::importFromSvgD(
- aTmp1,
- rtl::OUString::createFromAscii(sSvg)));
+ aTmp1, rtl::OUString::createFromAscii(sSvg), false, 0));
const rtl::OUString aSvg=
- tools::exportToSvgD(toTest.solveCrossovers());
+ tools::exportToSvgD(toTest.solveCrossovers(), , true, true, false);
B2DPolyPolygon aTmp2;
CPPUNIT_ASSERT_MESSAGE(sName,
tools::importFromSvgD(
- aTmp2,
- aSvg));
+ aTmp2, aSvg, false, 0));
CPPUNIT_ASSERT_MESSAGE(
sName,
@@ -303,7 +301,7 @@ public:
#if defined(VERBOSE)
fprintf(stderr, "%s - svg:d=\"%s\"\n",
pName, rtl::OUStringToOString(
- basegfx::tools::exportToSvgD(rPoly),
+ basegfx::tools::exportToSvgD(rPoly, , true, true, false),
RTL_TEXTENCODING_UTF8).getStr() );
#endif
}
@@ -347,15 +345,14 @@ public:
fprintf(stderr, "%s input - svg:d=\"%s\"\n",
pName, rtl::OUStringToOString(
basegfx::tools::exportToSvgD(
- genericClip),
+ genericClip, , true, true, false),
RTL_TEXTENCODING_UTF8).getStr() );
#endif
const B2DPolyPolygon boxClipResult=rRange.solveCrossovers();
const rtl::OUString boxClipSvg(
basegfx::tools::exportToSvgD(
- normalizePoly(
- boxClipResult)));
+ normalizePoly(boxClipResult)), true, true, false);
#if defined(VERBOSE)
fprintf(stderr, "%s boxclipper - svg:d=\"%s\"\n",
pName, rtl::OUStringToOString(
@@ -366,8 +363,7 @@ public:
genericClip = tools::solveCrossovers(genericClip);
const rtl::OUString genericClipSvg(
basegfx::tools::exportToSvgD(
- normalizePoly(
- genericClip)));
+ normalizePoly(genericClip)), true, true, false);
#if defined(VERBOSE)
fprintf(stderr, "%s genclipper - svg:d=\"%s\"\n",
pName, rtl::OUStringToOString(
Modified: openoffice/branches/alg/aw080/main/basegfx/test/clipstate.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/basegfx/test/clipstate.cxx?rev=1539657&r1=1539656&r2=1539657&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/basegfx/test/clipstate.cxx (original)
+++ openoffice/branches/alg/aw080/main/basegfx/test/clipstate.cxx Thu Nov 7 14:29:41 2013
@@ -107,23 +107,21 @@ public:
#if defined(VERBOSE)
fprintf(stderr, "%s - svg:d=\"%s\"\n",
sName, rtl::OUStringToOString(
- basegfx::tools::exportToSvgD(toTest.getClipPoly()),
+ basegfx::tools::exportToSvgD(toTest.getClipPoly(), true, true, false),
RTL_TEXTENCODING_UTF8).getStr() );
#endif
B2DPolyPolygon aTmp1;
CPPUNIT_ASSERT_MESSAGE(sName,
tools::importFromSvgD(
- aTmp1,
- rtl::OUString::createFromAscii(sSvg)));
+ aTmp1, rtl::OUString::createFromAscii(sSvg), false, 0));
const rtl::OUString aSvg=
- tools::exportToSvgD(toTest.getClipPoly());
+ tools::exportToSvgD(toTest.getClipPoly(), true, true, false);
B2DPolyPolygon aTmp2;
CPPUNIT_ASSERT_MESSAGE(sName,
tools::importFromSvgD(
- aTmp2,
- aSvg));
+ aTmp2, aSvg, false, 0));
CPPUNIT_ASSERT_MESSAGE(
sName,
@@ -153,8 +151,7 @@ public:
B2DPolyPolygon aTmp1;
tools::importFromSvgD(
- aTmp1,
- rtl::OUString::createFromAscii(unionSvg));
+ aTmp1, rtl::OUString::createFromAscii(unionSvg), false, 0);
aMixedClip.intersectPolyPolygon(aTmp1);
aMixedClip.subtractRange(B2DRange(-20,-150,20,0));
Modified: openoffice/branches/alg/aw080/main/basegfx/test/genericclipper.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/basegfx/test/genericclipper.cxx?rev=1539657&r1=1539656&r2=1539657&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/basegfx/test/genericclipper.cxx (original)
+++ openoffice/branches/alg/aw080/main/basegfx/test/genericclipper.cxx Thu Nov 7 14:29:41 2013
@@ -91,12 +91,12 @@ public:
fprintf(stderr, "%s input LHS - svg:d=\"%s\"\n",
pName, rtl::OUStringToOString(
basegfx::tools::exportToSvgD(
- aSelfIntersect),
+ aSelfIntersect, true, true, false),
RTL_TEXTENCODING_UTF8).getStr() );
fprintf(stderr, "%s input RHS - svg:d=\"%s\"\n",
pName, rtl::OUStringToOString(
basegfx::tools::exportToSvgD(
- aRect),
+ aRect, true, true, false),
RTL_TEXTENCODING_UTF8).getStr() );
#endif
@@ -106,14 +106,14 @@ public:
#if defined(VERBOSE)
fprintf(stderr, "%s - svg:d=\"%s\"\n",
pName, rtl::OUStringToOString(
- basegfx::tools::exportToSvgD(aRes),
+ basegfx::tools::exportToSvgD(aRes, true, true, false),
RTL_TEXTENCODING_UTF8).getStr() );
#endif
rtl::OUString aValid=rtl::OUString::createFromAscii(pValidSvgD);
CPPUNIT_ASSERT_MESSAGE(pName,
- basegfx::tools::exportToSvgD(aRes) == aValid);
+ basegfx::tools::exportToSvgD(aRes, true, true, false) == aValid);
}
void validateOr()
Modified: openoffice/branches/alg/aw080/main/boost/boost_1_48_0.patch
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/boost/boost_1_48_0.patch?rev=1539657&r1=1539656&r2=1539657&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/boost/boost_1_48_0.patch (original)
+++ openoffice/branches/alg/aw080/main/boost/boost_1_48_0.patch Thu Nov 7 14:29:41 2013
@@ -198,3 +198,126 @@ diff -ru misc/boost_1_48_0/boost/unorder
+ BOOST_PP_CAT(a, n)(BOOST_PP_CAT(b, n))
#endif
+--- misc/boost_1_48_0/boost/unordered/detail/buckets.hpp 2011-10-09 20:30:10.000000000 +0200
++++ misc/build/boost_1_48_0/boost/unordered/detail/buckets.hpp 2012-06-21 10:22:36.000000000 +0000
+@@ -477,22 +477,22 @@
+
+ // This is called after erasing a node or group of nodes to fix up
+ // the bucket pointers.
+- void fix_buckets(bucket_pointer bucket,
++ void fix_buckets(bucket_pointer bucket_arg,
+ previous_pointer prev, node_pointer next)
+ {
+ if (!next)
+ {
+- if (bucket->next_ == prev) bucket->next_ = node_pointer();
++ if (bucket_arg->next_ == prev) bucket_arg->next_ = node_pointer();
+ }
+ else
+ {
+ bucket_pointer next_bucket = this->get_bucket(
+ next->hash_ % this->bucket_count_);
+
+- if (next_bucket != bucket)
++ if (next_bucket != bucket_arg)
+ {
+ next_bucket->next_ = prev;
+- if (bucket->next_ == prev) bucket->next_ = node_pointer();
++ if (bucket_arg->next_ == prev) bucket_arg->next_ = node_pointer();
+ }
+ }
+ }
+--- misc/boost_1_48_0/boost/unordered/detail/equivalent.hpp 2011-11-04 03:31:36.000000000 +0100
++++ misc/build/boost_1_48_0/boost/unordered/detail/equivalent.hpp 2012-06-21 10:23:12.000000000 +0000
+@@ -246,14 +246,14 @@
+ node_pointer n = this->find_node(k);
+ if (!n) return 0;
+
+- std::size_t count = 0;
++ std::size_t lcl_count = 0;
+ node_pointer it = n;
+ do {
+ it = static_cast<node_pointer>(it->group_prev_);
+- ++count;
++ ++lcl_count;
+ } while(it != n);
+
+- return count;
++ return lcl_count;
+ }
+
+ std::pair<iterator, iterator>
+@@ -523,9 +523,9 @@
+
+ std::size_t hash = this->hash_function()(k);
+ std::size_t bucket_index = hash % this->bucket_count_;
+- bucket_pointer bucket = this->get_bucket(bucket_index);
++ bucket_pointer lcl_bucket = this->get_bucket(bucket_index);
+
+- previous_pointer prev = bucket->next_;
++ previous_pointer prev = lcl_bucket->next_;
+ if (!prev) return 0;
+
+ for (;;)
+@@ -548,7 +548,7 @@
+ static_cast<node_pointer>(pos->group_prev_)->next_;
+ node_pointer end = static_cast<node_pointer>(end1);
+ prev->next_ = end1;
+- this->fix_buckets(bucket, prev, end);
++ this->fix_buckets(lcl_bucket, prev, end);
+ return this->delete_nodes(pos, end);
+ }
+
+@@ -557,11 +557,11 @@
+ BOOST_ASSERT(r);
+ node_pointer next = static_cast<node_pointer>(r->next_);
+
+- bucket_pointer bucket = this->get_bucket(
++ bucket_pointer lcl_bucket = this->get_bucket(
+ r->hash_ % this->bucket_count_);
+- previous_pointer prev = unlink_node(*bucket, r);
++ previous_pointer prev = unlink_node(*lcl_bucket, r);
+
+- this->fix_buckets(bucket, prev, next);
++ this->fix_buckets(lcl_bucket, prev, next);
+
+ this->delete_node(r);
+
+--- misc/boost_1_48_0/boost/unordered/detail/unique.hpp 2011-11-04 03:31:36.000000000 +0100
++++ misc/build/boost_1_48_0/boost/unordered/detail/unique.hpp 2012-06-21 10:23:00.000000000 +0000
+@@ -523,9 +523,9 @@
+
+ std::size_t hash = this->hash_function()(k);
+ std::size_t bucket_index = hash % this->bucket_count_;
+- bucket_pointer bucket = this->get_bucket(bucket_index);
++ bucket_pointer lcl_bucket = this->get_bucket(bucket_index);
+
+- previous_pointer prev = bucket->next_;
++ previous_pointer prev = lcl_bucket->next_;
+ if (!prev) return 0;
+
+ for (;;)
+@@ -545,7 +545,7 @@
+ node_pointer pos = static_cast<node_pointer>(prev->next_);
+ node_pointer end = static_cast<node_pointer>(pos->next_);
+ prev->next_ = pos->next_;
+- this->fix_buckets(bucket, prev, end);
++ this->fix_buckets(lcl_bucket, prev, end);
+ return this->delete_nodes(pos, end);
+ }
+
+@@ -554,11 +554,11 @@
+ BOOST_ASSERT(r);
+ node_pointer next = static_cast<node_pointer>(r->next_);
+
+- bucket_pointer bucket = this->get_bucket(
++ bucket_pointer lcl_bucket = this->get_bucket(
+ r->hash_ % this->bucket_count_);
+- previous_pointer prev = unlink_node(*bucket, r);
++ previous_pointer prev = unlink_node(*lcl_bucket, r);
+
+- this->fix_buckets(bucket, prev, next);
++ this->fix_buckets(lcl_bucket, prev, next);
+
+ this->delete_node(r);
+
Modified: openoffice/branches/alg/aw080/main/canvas/source/tools/surfaceproxy.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/canvas/source/tools/surfaceproxy.cxx?rev=1539657&r1=1539656&r2=1539657&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/canvas/source/tools/surfaceproxy.cxx (original)
+++ openoffice/branches/alg/aw080/main/canvas/source/tools/surfaceproxy.cxx Thu Nov 7 14:29:41 2013
@@ -156,11 +156,11 @@ namespace canvas
OSL_TRACE( "Original clip polygon: %s\n"
"Triangulated polygon: %s\n",
rtl::OUStringToOString(
- basegfx::tools::exportToSvgD( rClipPoly ),
+ basegfx::tools::exportToSvgD( rClipPoly, true, true, false ),
RTL_TEXTENCODING_ASCII_US).getStr(),
rtl::OUStringToOString(
basegfx::tools::exportToSvgD(
- basegfx::B2DPolyPolygon(rTriangulatedPolygon) ),
+ basegfx::B2DPolyPolygon(rTriangulatedPolygon), true, true, false ),
RTL_TEXTENCODING_ASCII_US).getStr() );
#endif
Modified: openoffice/branches/alg/aw080/main/cli_ure/source/native/native_bootstrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/cli_ure/source/native/native_bootstrap.cxx?rev=1539657&r1=1539656&r2=1539657&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/cli_ure/source/native/native_bootstrap.cxx (original)
+++ openoffice/branches/alg/aw080/main/cli_ure/source/native/native_bootstrap.cxx Thu Nov 7 14:29:41 2013
@@ -56,9 +56,6 @@ namespace cli_ure {
// in main\scp2\source\ooo\registryitem_ooo.scp
#define INSTALL_PATH L"Software\\OpenOffice\\UNO\\InstallPath"
#define INSTALL_PATH_64 L"Software\\Wow6432Node\\OpenOffice\\UNO\\InstallPath"
-#define BASIS_LINK L"\\basis-link"
-#define URE_LINK L"\\ure-link"
-#define URE_BIN L"\\bin"
#define UNO_PATH L"UNO_PATH"
namespace
@@ -110,23 +107,6 @@ WCHAR* getPathFromRegistryKey( HKEY hroo
return data;
}
-/* If the path does not end with '\' the las segment will be removed.
- path: C:\a\b
- -> C:\a
- @param io_path
- in/out parameter. The string is not reallocated. Simply a '\0'
- will be inserted to shorten the string.
-*/
-void oneDirUp(LPTSTR io_path)
-{
- WCHAR * pEnd = io_path + lstrlen(io_path) - 1;
- while (pEnd > io_path //prevent crashing if provided string does not contain a backslash
- && *pEnd != L'\\')
- pEnd --;
- *pEnd = L'\0';
-}
-
-
/* Returns the path to the program folder of the brand layer,
for example c:/openoffice.org 3/program
This path is either obtained from the environment variable UNO_PATH
@@ -142,8 +122,8 @@ WCHAR * getInstallPath()
DWORD cChars = GetEnvironmentVariable(UNO_PATH, NULL, 0);
if (cChars > 0)
{
- szInstallPath = new WCHAR[cChars];
- cChars = GetEnvironmentVariable(UNO_PATH, szInstallPath, cChars);
+ szInstallPath = new WCHAR[cChars+1];
+ cChars = GetEnvironmentVariable(UNO_PATH, szInstallPath, cChars+1);
//If PATH is not set then it is no error
if (cChars == 0)
{
@@ -158,14 +138,14 @@ WCHAR * getInstallPath()
if ( szInstallPath == NULL )
{
/* read the key's default value from HKEY_LOCAL_USER */
- szInstallPath = getPathFromRegistryKey( HKEY_LOCAL_MACHINE, INSTALL_PATH_64 );
+ szInstallPath = getPathFromRegistryKey( HKEY_CURRENT_USER, INSTALL_PATH_64 );
}
- else if ( szInstallPath == NULL )
+ if ( szInstallPath == NULL )
{
/* read the key's default value from HKEY_LOCAL_MACHINE */
szInstallPath = getPathFromRegistryKey( HKEY_LOCAL_MACHINE, INSTALL_PATH );
}
- else if ( szInstallPath == NULL )
+ if ( szInstallPath == NULL )
{
/* read the key's default value from HKEY_LOCAL_MACHINE */
szInstallPath = getPathFromRegistryKey( HKEY_LOCAL_MACHINE, INSTALL_PATH_64 );
@@ -174,67 +154,6 @@ WCHAR * getInstallPath()
return szInstallPath;
}
-/* Returns the path to the URE/bin path, where cppuhelper lib resides.
- The returned string must be freed with delete[]
-*/
-WCHAR* getUnoPath()
-{
- WCHAR * szLinkPath = NULL;
- WCHAR * szUrePath = NULL;
- WCHAR * szUreBin = NULL; //the return value
-
- WCHAR * szInstallPath = getInstallPath();
- if (szInstallPath)
- {
- //build the path tho the basis-link file
- oneDirUp(szInstallPath);
- int sizeLinkPath = lstrlen(szInstallPath) + lstrlen(INSTALL_PATH) + 1;
- if (sizeLinkPath < MAX_PATH)
- sizeLinkPath = MAX_PATH;
- szLinkPath = new WCHAR[sizeLinkPath];
- szLinkPath[0] = L'\0';
- lstrcat(szLinkPath, szInstallPath);
- lstrcat(szLinkPath, BASIS_LINK);
-
- //get the path to the actual Basis folder
- if (cli_ure::resolveLink(szLinkPath))
- {
- //build the path to the ure-link file
- int sizeUrePath = lstrlen(szLinkPath) + lstrlen(URE_LINK) + 1;
- if (sizeUrePath < MAX_PATH)
- sizeUrePath = MAX_PATH;
- szUrePath = new WCHAR[sizeUrePath];
- szUrePath[0] = L'\0';
- lstrcat(szUrePath, szLinkPath);
- lstrcat(szUrePath, URE_LINK);
-
- //get the path to the actual Ure folder
- if (cli_ure::resolveLink(szUrePath))
- {
- //build the path to the URE/bin directory
- szUreBin = new WCHAR[lstrlen(szUrePath) + lstrlen(URE_BIN) + 1];
- szUreBin[0] = L'\0';
- lstrcat(szUreBin, szUrePath);
- lstrcat(szUreBin, URE_BIN);
- }
- }
- }
-#if OSL_DEBUG_LEVEL >=2
- if (szUreBin)
- {
- fwprintf(stdout,L"[cli_cppuhelper]: Path to URE libraries:\n %s \n", szUreBin);
- }
- else
- {
- fwprintf(stdout,L"[cli_cppuhelper]: Failed to determine location of URE.\n");
- }
-#endif
- delete[] szInstallPath;
- delete[] szLinkPath;
- delete[] szUrePath;
- return szUreBin;
-}
-
/*We extend the path to contain the Ure/bin folder,
so that components can use osl_loadModule with arguments, such as
@@ -280,7 +199,6 @@ HMODULE loadFromPath(LPCWSTR sLibName)
if (sLibName == NULL)
return NULL;
-// WCHAR * szUreBinPath = getUnoPath();
WCHAR * szUreBinPath = getInstallPath();
if (!szUreBinPath)
return NULL;
@@ -344,10 +262,10 @@ namespace util
Bootstrapping requires the existence of many libraries which are contained
in an URE installation. To find and load these libraries the Windows
- registry keys HKEY_CURRENT_USER\Software\OpenOffice\Layer\URE\1
- and HKEY_LOCAL_MACHINE\Software\OpenOffice\Layer\URE\1 are examined.
- These contain a named value UREINSTALLLOCATION which holds a path to the URE
- installation folder.
+ registry keys HKEY_CURRENT_USER\Software\OpenOffice\UNO\InstallPath
+ and HKEY_LOCAL_MACHINE\Software\OpenOffice\UNO\InstallPath are examined.
+ The default value contain the path to the office prgoram dir. No seaparate URE
+ anymore.
*/
public __sealed __gc class Bootstrap
{
Modified: openoffice/branches/alg/aw080/main/cli_ure/version/version.txt
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/cli_ure/version/version.txt?rev=1539657&r1=1539656&r2=1539657&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/cli_ure/version/version.txt (original)
+++ openoffice/branches/alg/aw080/main/cli_ure/version/version.txt Thu Nov 7 14:29:41 2013
@@ -19,23 +19,23 @@
#
#**************************************************************
-CLI_URETYPES_NEW_VERSION=1.0.8.0
-CLI_URETYPES_OLD_VERSION=1.0.0.0-1.0.7.0
-CLI_URETYPES_POLICY_VERSION=8.0.0.0
+CLI_URETYPES_NEW_VERSION=1.0.9.0
+CLI_URETYPES_OLD_VERSION=1.0.0.0-1.0.8.0
+CLI_URETYPES_POLICY_VERSION=9.0.0.0
CLI_URETYPES_POLICY_ASSEMBLY=policy.1.0.cli_uretypes
-CLI_BASETYPES_NEW_VERSION=1.0.19.0
-CLI_BASETYPES_OLD_VERSION=1.0.0.0-1.0.18.0
-CLI_BASETYPES_POLICY_VERSION=19.0.0.0
+CLI_BASETYPES_NEW_VERSION=1.0.20.0
+CLI_BASETYPES_OLD_VERSION=1.0.0.0-1.0.19.0
+CLI_BASETYPES_POLICY_VERSION=20.0.0.0
CLI_BASETYPES_POLICY_ASSEMBLY=policy.1.0.cli_basetypes
-CLI_URE_NEW_VERSION=1.0.22.0
-CLI_URE_OLD_VERSION=1.0.0.0-1.0.21.0
-CLI_URE_POLICY_VERSION=22.0.0.0
+CLI_URE_NEW_VERSION=1.0.23.0
+CLI_URE_OLD_VERSION=1.0.0.0-1.0.22.0
+CLI_URE_POLICY_VERSION=23.0.0.0
CLI_URE_POLICY_ASSEMBLY=policy.1.0.cli_ure
-CLI_CPPUHELPER_NEW_VERSION=1.0.22.0
-CLI_CPPUHELPER_OLD_VERSION=1.0.0.0-1.0.21.0
-CLI_CPPUHELPER_POLICY_VERSION=22.0.0.0
+CLI_CPPUHELPER_NEW_VERSION=1.0.23.0
+CLI_CPPUHELPER_OLD_VERSION=1.0.0.0-1.0.22.0
+CLI_CPPUHELPER_POLICY_VERSION=23.0.0.0
CLI_CPPUHELPER_POLICY_ASSEMBLY=policy.1.0.cli_cppuhelper
Modified: openoffice/branches/alg/aw080/main/comphelper/inc/comphelper/evtmethodhelper.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/comphelper/inc/comphelper/evtmethodhelper.hxx?rev=1539657&r1=1539656&r2=1539657&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/comphelper/inc/comphelper/evtmethodhelper.hxx (original)
+++ openoffice/branches/alg/aw080/main/comphelper/inc/comphelper/evtmethodhelper.hxx Thu Nov 7 14:29:41 2013
@@ -20,15 +20,15 @@
*************************************************************/
-#ifndef COMPHELPER_EVENTMEHODHELPER_HXX
-#define COMPHELPER_EVENMETHODHELPER_HXX
+#ifndef COMPHELPER_EVENTMETHODHELPER_HXX
+#define COMPHELPER_EVENTMETHODHELPER_HXX
#include <comphelper/sequence.hxx>
-//........................................................................
+
namespace comphelper
{
COMPHELPER_DLLPUBLIC ::com::sun::star::uno::Sequence< ::rtl::OUString> getEventMethodsForType(const ::com::sun::star::uno::Type& type);
-//........................................................................
-} // namespace comphelper
-//........................................................................
-#endif // COMPHELPER_EVENTMEHODHELPER_HXX
+}
+
+#endif // COMPHELPER_EVENTMETHODHELPER_HXX
+