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/08/01 19:14:32 UTC
svn commit: r1509334 [3/4] - in /openoffice/branches/alg/aw080/main:
basegfx/inc/basegfx/matrix/ basegfx/inc/basegfx/polygon/
basegfx/source/inc/ basegfx/source/matrix/ basegfx/source/polygon/
basegfx/source/tools/ sd/source/ui/animations/ svx/inc/svx/...
Modified: openoffice/branches/alg/aw080/main/xmloff/source/draw/xexptran.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/xmloff/source/draw/xexptran.cxx?rev=1509334&r1=1509333&r2=1509334&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/xmloff/source/draw/xexptran.cxx (original)
+++ openoffice/branches/alg/aw080/main/xmloff/source/draw/xexptran.cxx Thu Aug 1 17:14:31 2013
@@ -1242,21 +1242,21 @@ void SdXMLImExTransform3D::GetFullTransf
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
-SdXMLImExViewBox::SdXMLImExViewBox(sal_Int32 nX, sal_Int32 nY, sal_Int32 nW, sal_Int32 nH)
-: mnX( nX ),
- mnY( nY ),
- mnW( nW ),
- mnH( nH )
+SdXMLImExViewBox::SdXMLImExViewBox(double fX, double fY, double fW, double fH)
+: mfX( fX ),
+ mfY( fY ),
+ mfW( fW ),
+ mfH( fH )
{
}
// #100617# Asked vincent hardy: svg:viewBox values may be double precision.
SdXMLImExViewBox::SdXMLImExViewBox(const OUString& rNew, const SvXMLUnitConverter& rConv)
: msString(rNew),
- mnX( 0L ),
- mnY( 0L ),
- mnW( 1000L ),
- mnH( 1000L )
+ mfX( 0.0 ),
+ mfY( 0.0 ),
+ mfW( 1000.0 ),
+ mfH( 1000.0 )
{
if(msString.getLength())
{
@@ -1268,25 +1268,25 @@ SdXMLImExViewBox::SdXMLImExViewBox(const
Imp_SkipSpaces(aStr, nPos, nLen);
// get mX, #100617# be prepared for doubles
- mnX = FRound(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, (double)mnX));
+ mfX = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, mfX);
// skip spaces and commas
Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
// get mY, #100617# be prepared for doubles
- mnY = FRound(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, (double)mnY));
+ mfY = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, mfY);
// skip spaces and commas
Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
// get mW, #100617# be prepared for doubles
- mnW = FRound(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, (double)mnW));
+ mfW = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, mfW);
// skip spaces and commas
Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
// get mH, #100617# be prepared for doubles
- mnH = FRound(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, (double)mnH));
+ mfH = Imp_GetDoubleChar(aStr, nPos, nLen, rConv, mfH);
}
}
@@ -1295,16 +1295,16 @@ const OUString& SdXMLImExViewBox::GetExp
OUString aNewString;
OUString aEmptySpace(sal_Unicode(' '));
- Imp_PutNumberChar(aNewString, mnX);
+ Imp_PutNumberChar(aNewString, mfX);
aNewString += aEmptySpace;
- Imp_PutNumberChar(aNewString, mnY);
+ Imp_PutNumberChar(aNewString, mfY);
aNewString += aEmptySpace;
- Imp_PutNumberChar(aNewString, mnW);
+ Imp_PutNumberChar(aNewString, mfW);
aNewString += aEmptySpace;
- Imp_PutNumberChar(aNewString, mnH);
+ Imp_PutNumberChar(aNewString, mfH);
// set new string
msString = aNewString;
@@ -1314,1776 +1314,1776 @@ const OUString& SdXMLImExViewBox::GetExp
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
-
-SdXMLImExPointsElement::SdXMLImExPointsElement(drawing::PointSequence* pPoints,
- const SdXMLImExViewBox& rViewBox,
- const awt::Point& rObjectPos,
- const awt::Size& rObjectSize,
- const bool bClosed)
-: maPoly( 0L )
-{
- DBG_ASSERT(pPoints, "Empty PointSequence handed over to SdXMLImExPointsElement(!)");
-
- // add polygon to string
- sal_Int32 nCnt(pPoints->getLength());
-
- // #104076# Convert to string only when at last one point included
- if(nCnt > 0)
- {
- OUString aNewString;
- awt::Point* pArray = pPoints->getArray();
-
- // last point same? Ignore it.
- // #96328# ...but only when polygon is CLOSED
- if(bClosed && (pArray->X == (pArray + (nCnt - 1))->X) && (pArray->Y == (pArray + (nCnt - 1))->Y))
- nCnt--;
-
- // object size and ViewBox size different?
- bool bScale(rObjectSize.Width != rViewBox.GetWidth()
- || rObjectSize.Height != rViewBox.GetHeight());
- bool bTranslate(rViewBox.GetX() != 0L || rViewBox.GetY() != 0L);
-
- for(sal_Int32 a(0L); a < nCnt; a++)
- {
- // prepare coordinates
- sal_Int32 nX( pArray->X - rObjectPos.X );
- sal_Int32 nY( pArray->Y - rObjectPos.Y );
-
- if(bScale && rObjectSize.Width && rObjectSize.Height)
- {
- nX = (nX * rViewBox.GetWidth()) / rObjectSize.Width;
- nY = (nY * rViewBox.GetHeight()) / rObjectSize.Height;
- }
-
- if(bTranslate)
- {
- nX += rViewBox.GetX();
- nY += rViewBox.GetY();
- }
-
- // X and comma
- Imp_PutNumberChar(aNewString, nX);
- aNewString += String(sal_Unicode(','));
-
- // Y and space (not for last)
- Imp_PutNumberChar(aNewString, nY);
- if(a + 1 != nCnt)
- aNewString += String(sal_Unicode(' '));
-
- // next point
- pArray++;
- }
-
- // set new string
- msString = aNewString;
- }
-}
-
-// #100617# svg:polyline or svg:polygon values may be double precision.
-SdXMLImExPointsElement::SdXMLImExPointsElement(const OUString& rNew,
- const SdXMLImExViewBox& rViewBox,
- const awt::Point& rObjectPos,
- const awt::Size& rObjectSize,
- const SvXMLUnitConverter& rConv,
- const bool bClosed)
-: msString( rNew ),
- maPoly( 0L )
-{
- // convert string to polygon
- const OUString aStr(msString.getStr(), (sal_uInt16)msString.getLength());
- const sal_Int32 nLen(aStr.getLength());
- sal_Int32 nPos(0);
- sal_Int32 nNumPoints(0L);
-
- // skip starting spaces
- Imp_SkipSpaces(aStr, nPos, nLen);
-
- // count points in first loop
- while(nPos < nLen)
- {
- // skip number, #100617# be prepared for doubles
- Imp_SkipDouble(aStr, nPos, nLen);
-
- // skip spaces and commas
- Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
-
- // skip number, #100617# be prepared for doubles
- Imp_SkipDouble(aStr, nPos, nLen);
-
- // skip spaces and commas
- Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
-
- // one more point
- nNumPoints++;
- }
-
- // second loop
- if(nNumPoints)
- {
- nPos = 0;
- maPoly.realloc(1);
- drawing::PointSequence* pOuterSequence = maPoly.getArray();
- pOuterSequence->realloc(nNumPoints + (bClosed ? 1 : 0));
- awt::Point* pInnerSequence = pOuterSequence->getArray();
-
- // object size and ViewBox size different?
- bool bScale(rObjectSize.Width != rViewBox.GetWidth()
- || rObjectSize.Height != rViewBox.GetHeight());
- bool bTranslate(rViewBox.GetX() != 0L || rViewBox.GetY() != 0L);
-
- // skip starting spaces
- Imp_SkipSpaces(aStr, nPos, nLen);
-
- while(nPos < nLen)
- {
- // prepare new parameter pair
- sal_Int32 nX(0L);
- sal_Int32 nY(0L);
-
- // get mX, #100617# be prepared for doubles
- nX = FRound(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, (double)nX));
-
- // skip spaces and commas
- Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
-
- // get mY, #100617# be prepared for doubles
- nY = FRound(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, (double)nY));
-
- // skip spaces and commas
- Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
-
- // prepare parameters
- if(bTranslate)
- {
- nX -= rViewBox.GetX();
- nY -= rViewBox.GetY();
- }
-
- if(bScale && rViewBox.GetWidth() && rViewBox.GetHeight() )
- {
- nX = (nX * rObjectSize.Width) / rViewBox.GetWidth();
- nY = (nY * rObjectSize.Height) / rViewBox.GetHeight();
- }
-
- nX += rObjectPos.X;
- nY += rObjectPos.Y;
-
- // add new point
- *pInnerSequence = awt::Point( nX, nY );
- pInnerSequence++;
- }
-
- if(bClosed)
- {
- *pInnerSequence = *pOuterSequence->getArray();
- }
- }
-}
-
+//
+//SdXMLImExPointsElement::SdXMLImExPointsElement(drawing::PointSequence* pPoints,
+// const SdXMLImExViewBox& rViewBox,
+// const awt::Point& rObjectPos,
+// const awt::Size& rObjectSize,
+// const bool bClosed)
+//: maPoly( 0L )
+//{
+// DBG_ASSERT(pPoints, "Empty PointSequence handed over to SdXMLImExPointsElement(!)");
+//
+// // add polygon to string
+// sal_Int32 nCnt(pPoints->getLength());
+//
+// // #104076# Convert to string only when at last one point included
+// if(nCnt > 0)
+// {
+// OUString aNewString;
+// awt::Point* pArray = pPoints->getArray();
+//
+// // last point same? Ignore it.
+// // #96328# ...but only when polygon is CLOSED
+// if(bClosed && (pArray->X == (pArray + (nCnt - 1))->X) && (pArray->Y == (pArray + (nCnt - 1))->Y))
+// nCnt--;
+//
+// // object size and ViewBox size different?
+// bool bScale(rObjectSize.Width != rViewBox.GetWidth()
+// || rObjectSize.Height != rViewBox.GetHeight());
+// bool bTranslate(rViewBox.GetX() != 0L || rViewBox.GetY() != 0L);
+//
+// for(sal_Int32 a(0L); a < nCnt; a++)
+// {
+// // prepare coordinates
+// sal_Int32 nX( pArray->X - rObjectPos.X );
+// sal_Int32 nY( pArray->Y - rObjectPos.Y );
+//
+// if(bScale && rObjectSize.Width && rObjectSize.Height)
+// {
+// nX = (nX * rViewBox.GetWidth()) / rObjectSize.Width;
+// nY = (nY * rViewBox.GetHeight()) / rObjectSize.Height;
+// }
+//
+// if(bTranslate)
+// {
+// nX += rViewBox.GetX();
+// nY += rViewBox.GetY();
+// }
+//
+// // X and comma
+// Imp_PutNumberChar(aNewString, nX);
+// aNewString += String(sal_Unicode(','));
+//
+// // Y and space (not for last)
+// Imp_PutNumberChar(aNewString, nY);
+// if(a + 1 != nCnt)
+// aNewString += String(sal_Unicode(' '));
+//
+// // next point
+// pArray++;
+// }
+//
+// // set new string
+// msString = aNewString;
+// }
+//}
+//
+//// #100617# svg:polyline or svg:polygon values may be double precision.
+//SdXMLImExPointsElement::SdXMLImExPointsElement(const OUString& rNew,
+// const SdXMLImExViewBox& rViewBox,
+// const awt::Point& rObjectPos,
+// const awt::Size& rObjectSize,
+// const SvXMLUnitConverter& rConv,
+// const bool bClosed)
+//: msString( rNew ),
+// maPoly( 0L )
+//{
+// // convert string to polygon
+// const OUString aStr(msString.getStr(), (sal_uInt16)msString.getLength());
+// const sal_Int32 nLen(aStr.getLength());
+// sal_Int32 nPos(0);
+// sal_Int32 nNumPoints(0L);
+//
+// // skip starting spaces
+// Imp_SkipSpaces(aStr, nPos, nLen);
+//
+// // count points in first loop
+// while(nPos < nLen)
+// {
+// // skip number, #100617# be prepared for doubles
+// Imp_SkipDouble(aStr, nPos, nLen);
+//
+// // skip spaces and commas
+// Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+//
+// // skip number, #100617# be prepared for doubles
+// Imp_SkipDouble(aStr, nPos, nLen);
+//
+// // skip spaces and commas
+// Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+//
+// // one more point
+// nNumPoints++;
+// }
+//
+// // second loop
+// if(nNumPoints)
+// {
+// nPos = 0;
+// maPoly.realloc(1);
+// drawing::PointSequence* pOuterSequence = maPoly.getArray();
+// pOuterSequence->realloc(nNumPoints + (bClosed ? 1 : 0));
+// awt::Point* pInnerSequence = pOuterSequence->getArray();
+//
+// // object size and ViewBox size different?
+// bool bScale(rObjectSize.Width != rViewBox.GetWidth()
+// || rObjectSize.Height != rViewBox.GetHeight());
+// bool bTranslate(rViewBox.GetX() != 0L || rViewBox.GetY() != 0L);
+//
+// // skip starting spaces
+// Imp_SkipSpaces(aStr, nPos, nLen);
+//
+// while(nPos < nLen)
+// {
+// // prepare new parameter pair
+// sal_Int32 nX(0L);
+// sal_Int32 nY(0L);
+//
+// // get mX, #100617# be prepared for doubles
+// nX = FRound(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, (double)nX));
+//
+// // skip spaces and commas
+// Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+//
+// // get mY, #100617# be prepared for doubles
+// nY = FRound(Imp_GetDoubleChar(aStr, nPos, nLen, rConv, (double)nY));
+//
+// // skip spaces and commas
+// Imp_SkipSpacesAndCommas(aStr, nPos, nLen);
+//
+// // prepare parameters
+// if(bTranslate)
+// {
+// nX -= rViewBox.GetX();
+// nY -= rViewBox.GetY();
+// }
+//
+// if(bScale && rViewBox.GetWidth() && rViewBox.GetHeight() )
+// {
+// nX = (nX * rObjectSize.Width) / rViewBox.GetWidth();
+// nY = (nY * rObjectSize.Height) / rViewBox.GetHeight();
+// }
+//
+// nX += rObjectPos.X;
+// nY += rObjectPos.Y;
+//
+// // add new point
+// *pInnerSequence = awt::Point( nX, nY );
+// pInnerSequence++;
+// }
+//
+// if(bClosed)
+// {
+// *pInnerSequence = *pOuterSequence->getArray();
+// }
+// }
+//}
+//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
-
-SdXMLImExSvgDElement::SdXMLImExSvgDElement(const SdXMLImExViewBox& rViewBox)
-: mrViewBox( rViewBox ),
- mbIsClosed( false ),
- mbIsCurve( false ),
- mnLastX( 0L ),
- mnLastY( 0L ),
- maPoly( 0L ),
- maFlag( 0L )
-{
-}
-
-void Imp_GetPrevPos(awt::Point*& pPrevPos1,
- drawing::PolygonFlags& aPrevFlag1,
- const bool bClosed, awt::Point* pPoints,
- drawing::PolygonFlags* pFlags, const sal_Int32 nPos,
- const sal_Int32 nCnt, const sal_Int32 nAdd)
-{
- if(bClosed)
- {
- pPrevPos1 = pPoints + ((nPos + nCnt - nAdd) % nCnt);
- aPrevFlag1 = *(pFlags + ((nPos + nCnt - nAdd) % nCnt));
- }
- else if(nPos > (nAdd - 1))
- {
- pPrevPos1 = pPoints + (nPos - nAdd);
- aPrevFlag1 = *(pFlags + (nPos - nAdd));
- }
- else
- pPrevPos1 = 0L;
-}
-
-void Imp_PrepareCoorExport(sal_Int32& nX, sal_Int32& nY,
- const awt::Point* pPointArray, const awt::Point& rObjectPos,
- const awt::Size& rObjectSize, const SdXMLImExViewBox& mrViewBox,
- const bool bScale, const bool bTranslate)
-{
- nX = pPointArray->X - rObjectPos.X;
- nY = pPointArray->Y - rObjectPos.Y;
-
- if(bScale && rObjectSize.Width && rObjectSize.Height )
- {
- nX = (nX * mrViewBox.GetWidth()) / rObjectSize.Width;
- nY = (nY * mrViewBox.GetHeight()) / rObjectSize.Height;
- }
-
- if(bTranslate)
- {
- nX += mrViewBox.GetX();
- nY += mrViewBox.GetY();
- }
-}
-
-//#define TEST_QUADRATIC_CURVES
-#ifdef TEST_QUADRATIC_CURVES
-// To be able to test quadratic curve code: The code concerning to
-// bDoTestHere can be used (see below). Construct shapes which have their control
-// points on equal coordinates. When these are written, they can be
-// forced to create correct 'Q' and 'T' statements using this flag.
-// These may then be tested for import/exporting.
-static bool bDoTestHere(true);
-#endif // TEST_QUADRATIC_CURVES
-
-void SdXMLImExSvgDElement::AddPolygon(
- drawing::PointSequence* pPoints,
- drawing::FlagSequence* pFlags,
- const awt::Point& rObjectPos,
- const awt::Size& rObjectSize,
- bool bClosed, bool bRelative)
-{
- DBG_ASSERT(pPoints, "Empty PointSequence handed over to SdXMLImExSvgDElement(!)");
-
- sal_Int32 nCnt(pPoints->getLength());
-
- // #104076# Convert to string only when at last one point included
- if(nCnt > 0)
- {
- // append polygon to string
- OUString aNewString;
- sal_Unicode aLastCommand = ' ';
- awt::Point* pPointArray = pPoints->getArray();
-
- // are the flags used at all? If not forget about them
- if(pFlags)
- {
- sal_Int32 nFlagCnt(pFlags->getLength());
-
- if(nFlagCnt)
- {
- bool bFlagsUsed(false);
- drawing::PolygonFlags* pFlagArray = pFlags->getArray();
-
- for(sal_Int32 a(0); !bFlagsUsed && a < nFlagCnt; a++)
- if(drawing::PolygonFlags_NORMAL != *pFlagArray++)
- bFlagsUsed = true;
-
- if(!bFlagsUsed)
- pFlags = 0L;
- }
- else
- {
- pFlags = 0L;
- }
- }
-
- // object size and ViewBox size different?
- bool bScale(rObjectSize.Width != mrViewBox.GetWidth()
- || rObjectSize.Height != mrViewBox.GetHeight());
- bool bTranslate(mrViewBox.GetX() != 0L || mrViewBox.GetY() != 0L);
-
- // #87202# rework of point reduction:
- // Test for Last point same -> closed, ignore last point. Take
- // some more circumstances in account when looking at curve segments.
- drawing::PolygonFlags* pFlagArray = (pFlags) ? pFlags->getArray() : 0L;
-
- // #121090# only reduce double start/end points if polygon *is* closed
- if(bClosed && (pPointArray->X == (pPointArray + (nCnt - 1))->X) && (pPointArray->Y == (pPointArray + (nCnt - 1))->Y))
- {
- if(pFlags)
- {
- // point needs to be ignored if point before it is
- // NO control point. Else the last point is needed
- // for exporting the last segment of the curve. That means
- // that the last and the first point will be saved double,
- // but SVG does not support a better solution here.
- if(nCnt >= 2 && drawing::PolygonFlags_CONTROL != *(pFlagArray + (nCnt - 2)))
- {
- nCnt--;
- }
- }
- else
- {
- // no curve, ignore last point
- nCnt--;
- }
- }
-
- // bezier poly, handle curves
- bool bDidWriteStart(false);
-
- for(sal_Int32 a(0L); a < nCnt; a++)
- {
- if(!pFlags || drawing::PolygonFlags_CONTROL != *pFlagArray)
- {
- bool bDidWriteAsCurve(false);
-
- if(bDidWriteStart)
- {
- if(pFlags)
- {
- // real curve point, get previous to see if it's a control point
- awt::Point* pPrevPos1;
- drawing::PolygonFlags aPrevFlag1;
-
- Imp_GetPrevPos(pPrevPos1, aPrevFlag1, bClosed, pPoints->getArray(),
- pFlags->getArray(), a, nCnt, 1);
-
- if(pPrevPos1 && drawing::PolygonFlags_CONTROL == aPrevFlag1)
- {
- // get previous2 to see if it's a control point, too
- awt::Point* pPrevPos2;
- drawing::PolygonFlags aPrevFlag2;
-
- Imp_GetPrevPos(pPrevPos2, aPrevFlag2, bClosed, pPoints->getArray(),
- pFlags->getArray(), a, nCnt, 2);
-
- if(pPrevPos2 && drawing::PolygonFlags_CONTROL == aPrevFlag2)
- {
- // get previous3 to see if it's a curve point and if,
- // if it is fully symmetric or not
- awt::Point* pPrevPos3;
- drawing::PolygonFlags aPrevFlag3;
-
- Imp_GetPrevPos(pPrevPos3, aPrevFlag3, bClosed, pPoints->getArray(),
- pFlags->getArray(), a, nCnt, 3);
-
- if(pPrevPos3)
- {
- // prepare coordinates
- sal_Int32 nX, nY;
-
- Imp_PrepareCoorExport(nX, nY, pPointArray, rObjectPos, rObjectSize,
- mrViewBox, bScale, bTranslate);
-
- // #100617# test if this curve segment may be written as
- // a quadratic bezier
- // 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
- bool bIsQuadratic(false);
- const bool bEnableSaveQuadratic(false);
-
- sal_Int32 nPX_L(FRound((double)((3 * pPrevPos2->X) - pPrevPos3->X) / 2.0));
- sal_Int32 nPY_L(FRound((double)((3 * pPrevPos2->Y) - pPrevPos3->Y) / 2.0));
- sal_Int32 nPX_R(FRound((double)((3 * pPrevPos1->X) - pPointArray->X) / 2.0));
- sal_Int32 nPY_R(FRound((double)((3 * pPrevPos1->Y) - pPointArray->Y) / 2.0));
- sal_Int32 nDist(0);
-
- if(nPX_L != nPX_R)
- {
- nDist += abs(nPX_L - nPX_R);
- }
-
- if(nPY_L != nPY_R)
- {
- nDist += abs(nPY_L - nPY_R);
- }
-
- if(nDist <= BORDER_INTEGERS_ARE_EQUAL)
- {
- if(bEnableSaveQuadratic)
- {
- bIsQuadratic = true;
- }
- }
-
-#ifdef TEST_QUADRATIC_CURVES
- if(bDoTestHere)
- {
- bIsQuadratic = false;
-
- if(pPrevPos1->X == pPrevPos2->X && pPrevPos1->Y == pPrevPos2->Y)
- bIsQuadratic = true;
- }
-#endif // TEST_QUADRATIC_CURVES
-
- if(bIsQuadratic)
- {
-#ifdef TEST_QUADRATIC_CURVES
- if(bDoTestHere)
- {
- bool bPrevPointIsSymmetric(false);
-
- if(drawing::PolygonFlags_SYMMETRIC == aPrevFlag3)
- {
- // get previous4 to see if it's a control point
- awt::Point* pPrevPos4;
- drawing::PolygonFlags aPrevFlag4;
-
- Imp_GetPrevPos(pPrevPos4, aPrevFlag4, bClosed, pPoints->getArray(),
- pFlags->getArray(), a, nCnt, 4);
-
- if(drawing::PolygonFlags_CONTROL == aPrevFlag4)
- {
- // okay, prevPos3 is symmetric (c2) and prevPos4
- // is existing control point, the 's' statement can be used
- bPrevPointIsSymmetric = true;
- }
- }
-
- if(bPrevPointIsSymmetric)
- {
- // write a shorthand/smooth quadratic curveto entry (T)
- if(bRelative)
- {
- if(aLastCommand != sal_Unicode('t'))
- aNewString += OUString(sal_Unicode('t'));
-
- Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
- Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
-
- aLastCommand = sal_Unicode('t');
- }
- else
- {
- if(aLastCommand != sal_Unicode('T'))
- aNewString += OUString(sal_Unicode('T'));
-
- Imp_PutNumberCharWithSpace(aNewString, nX);
- Imp_PutNumberCharWithSpace(aNewString, nY);
-
- aLastCommand = sal_Unicode('T');
- }
- }
- else
- {
- // prepare coordinates
- sal_Int32 nX1, nY1;
-
- Imp_PrepareCoorExport(nX1, nY1, pPrevPos1, rObjectPos, rObjectSize,
- mrViewBox, bScale, bTranslate);
-
- // write a quadratic curveto entry (Q)
- if(bRelative)
- {
- if(aLastCommand != sal_Unicode('q'))
- aNewString += OUString(sal_Unicode('q'));
-
- Imp_PutNumberCharWithSpace(aNewString, nX1 - mnLastX);
- Imp_PutNumberCharWithSpace(aNewString, nY1 - mnLastY);
- Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
- Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
-
- aLastCommand = sal_Unicode('q');
- }
- else
- {
- if(aLastCommand != sal_Unicode('Q'))
- aNewString += OUString(sal_Unicode('Q'));
-
- Imp_PutNumberCharWithSpace(aNewString, nX1);
- Imp_PutNumberCharWithSpace(aNewString, nY1);
- Imp_PutNumberCharWithSpace(aNewString, nX);
- Imp_PutNumberCharWithSpace(aNewString, nY);
-
- aLastCommand = sal_Unicode('Q');
- }
- }
- }
- else
- {
-#endif // TEST_QUADRATIC_CURVES
- awt::Point aNewPoint(nPX_L, nPY_L);
- bool bPrevPointIsSmooth(false);
-
- if(drawing::PolygonFlags_SMOOTH == aPrevFlag3)
- {
- // get previous4 to see if it's a control point
- awt::Point* pPrevPos4;
- drawing::PolygonFlags aPrevFlag4;
-
- Imp_GetPrevPos(pPrevPos4, aPrevFlag4, bClosed, pPoints->getArray(),
- pFlags->getArray(), a, nCnt, 4);
-
- if(drawing::PolygonFlags_CONTROL == aPrevFlag4)
- {
- // okay, prevPos3 is smooth (c1) and prevPos4
- // is existing control point. Test if it's even symmetric
- // and thus the 'T' statement may be used.
- ::basegfx::B2DVector aVec1(pPrevPos4->X - pPrevPos3->X, pPrevPos4->Y - pPrevPos3->Y);
- ::basegfx::B2DVector aVec2(aNewPoint.X - pPrevPos3->X, aNewPoint.Y - pPrevPos3->Y);
- bool bSameLength(false);
- bool bSameDirection(false);
-
- // get vector values
- Imp_CalcVectorValues(aVec1, aVec2, bSameLength, bSameDirection);
-
- if(bSameLength && bSameDirection)
- bPrevPointIsSmooth = true;
- }
- }
-
- if(bPrevPointIsSmooth)
- {
- // write a shorthand/smooth quadratic curveto entry (T)
- if(bRelative)
- {
- if(aLastCommand != sal_Unicode('t'))
- aNewString += String(sal_Unicode('t'));
-
- Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
- Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
-
- aLastCommand = sal_Unicode('t');
- }
- else
- {
- if(aLastCommand != sal_Unicode('T'))
- aNewString += String(sal_Unicode('T'));
-
- Imp_PutNumberCharWithSpace(aNewString, nX);
- Imp_PutNumberCharWithSpace(aNewString, nY);
-
- aLastCommand = sal_Unicode('T');
- }
- }
- else
- {
- // prepare coordinates
- sal_Int32 nX1, nY1;
-
- Imp_PrepareCoorExport(nX1, nY1, &aNewPoint, rObjectPos, rObjectSize,
- mrViewBox, bScale, bTranslate);
-
- // write a quadratic curveto entry (Q)
- if(bRelative)
- {
- if(aLastCommand != sal_Unicode('q'))
- aNewString += String(sal_Unicode('q'));
-
- Imp_PutNumberCharWithSpace(aNewString, nX1 - mnLastX);
- Imp_PutNumberCharWithSpace(aNewString, nY1 - mnLastY);
- Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
- Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
-
- aLastCommand = sal_Unicode('q');
- }
- else
- {
- if(aLastCommand != sal_Unicode('Q'))
- aNewString += String(sal_Unicode('Q'));
-
- Imp_PutNumberCharWithSpace(aNewString, nX1);
- Imp_PutNumberCharWithSpace(aNewString, nY1);
- Imp_PutNumberCharWithSpace(aNewString, nX);
- Imp_PutNumberCharWithSpace(aNewString, nY);
-
- aLastCommand = sal_Unicode('Q');
- }
- }
-#ifdef TEST_QUADRATIC_CURVES
- }
-#endif // TEST_QUADRATIC_CURVES
- }
- else
- {
- bool bPrevPointIsSymmetric(false);
-
- if(drawing::PolygonFlags_SYMMETRIC == aPrevFlag3)
- {
- // get previous4 to see if it's a control point
- awt::Point* pPrevPos4;
- drawing::PolygonFlags aPrevFlag4;
-
- Imp_GetPrevPos(pPrevPos4, aPrevFlag4, bClosed, pPoints->getArray(),
- pFlags->getArray(), a, nCnt, 4);
-
- if(drawing::PolygonFlags_CONTROL == aPrevFlag4)
- {
- // okay, prevPos3 is symmetric (c2) and prevPos4
- // is existing control point, the 's' statement can be used
- bPrevPointIsSymmetric = true;
- }
- }
-
- // prepare coordinates
- sal_Int32 nX2, nY2;
-
- Imp_PrepareCoorExport(nX2, nY2, pPrevPos1, rObjectPos, rObjectSize,
- mrViewBox, bScale, bTranslate);
-
- if(bPrevPointIsSymmetric)
- {
- // write a shorthand/smooth curveto entry (S)
- if(bRelative)
- {
- if(aLastCommand != sal_Unicode('s'))
- aNewString += String(sal_Unicode('s'));
-
- Imp_PutNumberCharWithSpace(aNewString, nX2 - mnLastX);
- Imp_PutNumberCharWithSpace(aNewString, nY2 - mnLastY);
- Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
- Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
-
- aLastCommand = sal_Unicode('s');
- }
- else
- {
- if(aLastCommand != sal_Unicode('S'))
- aNewString += String(sal_Unicode('S'));
-
- Imp_PutNumberCharWithSpace(aNewString, nX2);
- Imp_PutNumberCharWithSpace(aNewString, nY2);
- Imp_PutNumberCharWithSpace(aNewString, nX);
- Imp_PutNumberCharWithSpace(aNewString, nY);
-
- aLastCommand = sal_Unicode('S');
- }
- }
- else
- {
- // prepare coordinates
- sal_Int32 nX1, nY1;
-
- Imp_PrepareCoorExport(nX1, nY1, pPrevPos2, rObjectPos, rObjectSize,
- mrViewBox, bScale, bTranslate);
-
- // write a curveto entry (C)
- if(bRelative)
- {
- if(aLastCommand != sal_Unicode('c'))
- aNewString += String(sal_Unicode('c'));
-
- Imp_PutNumberCharWithSpace(aNewString, nX1 - mnLastX);
- Imp_PutNumberCharWithSpace(aNewString, nY1 - mnLastY);
- Imp_PutNumberCharWithSpace(aNewString, nX2 - mnLastX);
- Imp_PutNumberCharWithSpace(aNewString, nY2 - mnLastY);
- Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
- Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
-
- aLastCommand = sal_Unicode('c');
- }
- else
- {
- if(aLastCommand != sal_Unicode('C'))
- aNewString += String(sal_Unicode('C'));
-
- Imp_PutNumberCharWithSpace(aNewString, nX1);
- Imp_PutNumberCharWithSpace(aNewString, nY1);
- Imp_PutNumberCharWithSpace(aNewString, nX2);
- Imp_PutNumberCharWithSpace(aNewString, nY2);
- Imp_PutNumberCharWithSpace(aNewString, nX);
- Imp_PutNumberCharWithSpace(aNewString, nY);
-
- aLastCommand = sal_Unicode('C');
- }
- }
- }
-
- // remember that current point IS written
- bDidWriteAsCurve = true;
-
- // remember new last position
- mnLastX = nX;
- mnLastY = nY;
- }
- }
- }
- }
- }
-
- if(!bDidWriteAsCurve)
- {
- // current point not yet written, prepare coordinates
- sal_Int32 nX, nY;
-
- Imp_PrepareCoorExport(nX, nY, pPointArray, rObjectPos, rObjectSize,
- mrViewBox, bScale, bTranslate);
-
- if(bDidWriteStart)
- {
- // write as normal point
- if(mnLastX == nX)
- {
- if(bRelative)
- {
- if(aLastCommand != sal_Unicode('v'))
- aNewString += String(sal_Unicode('v'));
-
- Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
-
- aLastCommand = sal_Unicode('v');
- }
- else
- {
- if(aLastCommand != sal_Unicode('V'))
- aNewString += String(sal_Unicode('V'));
-
- Imp_PutNumberCharWithSpace(aNewString, nY);
-
- aLastCommand = sal_Unicode('V');
- }
- }
- else if(mnLastY == nY)
- {
- if(bRelative)
- {
- if(aLastCommand != sal_Unicode('h'))
- aNewString += String(sal_Unicode('h'));
-
- Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
-
- aLastCommand = sal_Unicode('h');
- }
- else
- {
- if(aLastCommand != sal_Unicode('H'))
- aNewString += String(sal_Unicode('H'));
-
- Imp_PutNumberCharWithSpace(aNewString, nX);
-
- aLastCommand = sal_Unicode('H');
- }
- }
- else
- {
- if(bRelative)
- {
- if(aLastCommand != sal_Unicode('l'))
- aNewString += String(sal_Unicode('l'));
-
- Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
- Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
-
- aLastCommand = sal_Unicode('l');
- }
- else
- {
- if(aLastCommand != sal_Unicode('L'))
- aNewString += String(sal_Unicode('L'));
-
- Imp_PutNumberCharWithSpace(aNewString, nX);
- Imp_PutNumberCharWithSpace(aNewString, nY);
-
- aLastCommand = sal_Unicode('L');
- }
- }
- }
- else
- {
- // write as start point
- if(bRelative)
- {
- aNewString += String(sal_Unicode('m'));
-
- Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
- Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
-
- aLastCommand = sal_Unicode('l');
- }
- else
- {
- aNewString += String(sal_Unicode('M'));
-
- Imp_PutNumberCharWithSpace(aNewString, nX);
- Imp_PutNumberCharWithSpace(aNewString, nY);
-
- aLastCommand = sal_Unicode('L');
- }
-
- // remember start written
- bDidWriteStart = true;
- }
-
- // remember new last position
- mnLastX = nX;
- mnLastY = nY;
- }
- }
-
- // next point
- pPointArray++;
- pFlagArray++;
- }
-
- // close path if closed poly
- if(bClosed)
- {
- if(bRelative)
- aNewString += String(sal_Unicode('z'));
- else
- aNewString += String(sal_Unicode('Z'));
- }
-
- // append new string
- msString += aNewString;
- }
-}
-
-// #100617# Linear double reader
-double Imp_ImportDoubleAndSpaces(
- double fRetval, const OUString& rStr, sal_Int32& rPos,
- const sal_Int32 nLen, const SvXMLUnitConverter& rConv)
-{
- fRetval = Imp_GetDoubleChar(rStr, rPos, nLen, rConv, fRetval);
- Imp_SkipSpacesAndCommas(rStr, rPos, nLen);
- return fRetval;
-}
-
-// #100617# Allow to read doubles, too. This will need to be changed to
-// the usage of Imp_ImportDoubleAndSpaces(...). For now, this is sufficient
-// since the interface cannot transport doubles.
-sal_Int32 Imp_ImportNumberAndSpaces(
- sal_Int32 nRetval, const OUString& rStr, sal_Int32& rPos,
- const sal_Int32 nLen, const SvXMLUnitConverter& rConv)
-{
- nRetval = FRound(Imp_ImportDoubleAndSpaces(double(nRetval), rStr, rPos, nLen, rConv));
- Imp_SkipSpacesAndCommas(rStr, rPos, nLen);
- return nRetval;
-}
-
-void Imp_PrepareCoorImport(sal_Int32& nX, sal_Int32& nY,
- const awt::Point& rObjectPos, const awt::Size& rObjectSize,
- const SdXMLImExViewBox& rViewBox, const bool bScale, const bool bTranslate)
-{
- if(bTranslate)
- {
- nX -= rViewBox.GetX();
- nY -= rViewBox.GetY();
- }
-
- if(bScale && rViewBox.GetWidth() && rViewBox.GetHeight())
- {
- nX = (nX * rObjectSize.Width) / rViewBox.GetWidth();
- nY = (nY * rObjectSize.Height) / rViewBox.GetHeight();
- }
-
- nX += rObjectPos.X;
- nY += rObjectPos.Y;
-}
-
-void Imp_AddExportPoints(sal_Int32 nX, sal_Int32 nY,
- awt::Point* pPoints, drawing::PolygonFlags* pFlags,
- const sal_Int32 nInnerIndex,
- drawing::PolygonFlags eFlag)
-{
- if(pPoints)
- pPoints[nInnerIndex] = awt::Point( nX, nY );
-
- if(pFlags)
- pFlags[nInnerIndex] = eFlag;
-}
-
-void Imp_CalcVectorValues(::basegfx::B2DVector& aVec1, ::basegfx::B2DVector& aVec2, bool& bSameLength, bool& bSameDirection)
-{
- const sal_Int32 nLen1(FRound(aVec1.getLength()));
- const sal_Int32 nLen2(FRound(aVec2.getLength()));
- aVec1.normalize();
- aVec2.normalize();
- aVec1 += aVec2;
- const sal_Int32 nLen3(FRound(aVec1.getLength() * ((nLen1 + nLen2) / 2.0)));
-
- bSameLength = (abs(nLen1 - nLen2) <= BORDER_INTEGERS_ARE_EQUAL);
- bSameDirection = (nLen3 <= BORDER_INTEGERS_ARE_EQUAL);
-}
-
-void Imp_CorrectPolygonFlag(const sal_uInt32 nInnerIndex, const awt::Point* const pInnerSequence,
- drawing::PolygonFlags* const pInnerFlags, const sal_Int32 nX1, const sal_Int32 nY1)
-{
- if(nInnerIndex)
- {
- const awt::Point aPPrev1 = pInnerSequence[nInnerIndex - 1];
-
- if(nInnerIndex > 1)
- {
- const awt::Point aPPrev2 = pInnerSequence[nInnerIndex - 2];
- const drawing::PolygonFlags aFPrev2 = pInnerFlags[nInnerIndex - 2];
- ::basegfx::B2DVector aVec1(aPPrev2.X - aPPrev1.X, aPPrev2.Y - aPPrev1.Y);
- ::basegfx::B2DVector aVec2(nX1 - aPPrev1.X, nY1 - aPPrev1.Y);
- bool bSameLength(false);
- bool bSameDirection(false);
-
- // get vector values
- Imp_CalcVectorValues(aVec1, aVec2, bSameLength, bSameDirection);
-
- if(drawing::PolygonFlags_CONTROL == aFPrev2)
- {
- // point before is a control point
- if(bSameDirection)
- {
- if(bSameLength)
- {
- // set to PolygonFlags_SYMMETRIC
- pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_SYMMETRIC;
- }
- else
- {
- // set to PolygonFlags_SMOOTH
- pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_SMOOTH;
- }
- }
- else
- {
- // set to PolygonFlags_NORMAL
- pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_NORMAL;
- }
- }
- else
- {
- // point before is a simple curve point
- if(bSameDirection)
- {
- // set to PolygonFlags_SMOOTH
- pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_SMOOTH;
- }
- else
- {
- // set to PolygonFlags_NORMAL
- pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_NORMAL;
- }
- }
- }
- else
- {
- // no point before starpoint, set type to PolygonFlags_NORMAL
- pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_NORMAL;
- }
- }
-}
-
-SdXMLImExSvgDElement::SdXMLImExSvgDElement(const OUString& rNew,
- const SdXMLImExViewBox& rViewBox,
- const awt::Point& rObjectPos,
- const awt::Size& rObjectSize,
- const SvXMLUnitConverter& rConv)
-: msString( rNew ),
- mrViewBox( rViewBox ),
- mbIsClosed( false ),
- mbIsCurve( false ),
- mnLastX( 0L ),
- mnLastY( 0L ),
- maPoly( 0L ),
- maFlag( 0L )
-{
- // convert string to polygon
- const OUString aStr(msString.getStr(), msString.getLength());
- const sal_Int32 nLen(aStr.getLength());
- sal_Int32 nPos(0);
- sal_Int32 nNumPolys(0L);
- bool bEllipticalArc(false);
-
- // object size and ViewBox size different?
- bool bScale(rObjectSize.Width != mrViewBox.GetWidth()
- || rObjectSize.Height != mrViewBox.GetHeight());
- bool bTranslate(mrViewBox.GetX() != 0L || mrViewBox.GetY() != 0L);
-
- // first loop: count polys and get flags
- Imp_SkipSpaces(aStr, nPos, nLen);
-
- while(nPos < nLen)
- {
- switch(aStr[nPos++])
- {
- case 'Z' :
- case 'z' :
- {
- break;
- }
- case 'M' :
- case 'm' :
- {
- nNumPolys++;
- break;
- }
- case 'S' :
- case 's' :
- case 'C' :
- case 'c' :
- case 'Q' :
- case 'q' :
- case 'T' :
- case 't' :
- {
- mbIsCurve = true;
- break;
- }
- case 'L' :
- case 'l' :
- case 'H' :
- case 'h' :
- case 'V' :
- case 'v' :
- {
- // normal, interpreted values. All okay.
- break;
- }
- case 'A' :
- case 'a' :
- {
- // Not yet interpreted value.
- bEllipticalArc = true;
- break;
- }
- }
- }
-
- DBG_ASSERT(!bEllipticalArc, "XMLIMP: non-interpreted tags in svg:d element!");
-
- if(nNumPolys)
- {
- // alloc arrays
- maPoly.realloc(nNumPolys);
- if(IsCurve())
- maFlag.realloc(nNumPolys);
-
- // get outer sequences
- drawing::PointSequence* pOuterSequence = maPoly.getArray();
- drawing::FlagSequence* pOuterFlags = (IsCurve()) ? maFlag.getArray() : 0L;
-
- // prepare new loop, count
- sal_uInt32 nPointCount(0L);
- nPos = 0;
- Imp_SkipSpaces(aStr, nPos, nLen);
-
- // #104076# reset closed flag for next to be started polygon
- mbIsClosed = false;
-
- while(nPos < nLen)
- {
- switch(aStr[nPos])
- {
- case 'z' :
- case 'Z' :
- {
- nPos++;
- Imp_SkipSpaces(aStr, nPos, nLen);
-
- // #104076# remember closed state of current polygon
- mbIsClosed = true;
-
- break;
- }
- case 'm' :
- case 'M' :
- {
- // new poly starts, end-process current poly
- if(nPointCount)
- {
- // #104076# If this partial polygon is closed, use one more point
- // to represent that
- if(mbIsClosed)
- {
- nPointCount++;
- }
-
- pOuterSequence->realloc(nPointCount);
- pOuterSequence++;
-
- if(pOuterFlags)
- {
- pOuterFlags->realloc(nPointCount);
- pOuterFlags++;
- }
-
- // reset point count for next polygon
- nPointCount = 0L;
- }
-
- // #104076# reset closed flag for next to be started polygon
- mbIsClosed = false;
-
- // NO break, continue in next case
- }
- case 'L' :
- case 'l' :
- {
- nPos++;
- Imp_SkipSpaces(aStr, nPos, nLen);
-
- while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
- {
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- nPointCount++;
- }
- break;
- }
- case 'H' :
- case 'h' :
- case 'V' :
- case 'v' :
- {
- nPos++;
- Imp_SkipSpaces(aStr, nPos, nLen);
-
- while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
- {
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- nPointCount++;
- }
- break;
- }
- case 'S' :
- case 's' :
- {
- nPos++;
- Imp_SkipSpaces(aStr, nPos, nLen);
-
- while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
- {
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- nPointCount += 3;
- }
- break;
- }
- case 'C' :
- case 'c' :
- {
- nPos++;
- Imp_SkipSpaces(aStr, nPos, nLen);
-
- while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
- {
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- nPointCount += 3;
- }
- break;
- }
-
- // #100617# quadratic beziers, supported as cubic ones
- case 'Q' :
- case 'q' :
- {
- nPos++;
- Imp_SkipSpaces(aStr, nPos, nLen);
-
- while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
- {
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
-
- // use three points since quadratic is imported as cubic
- nPointCount += 3;
- }
- break;
- }
-
- // #100617# relative quadratic beziers, supported as cubic ones
- case 'T' :
- case 't' :
- {
- nPos++;
- Imp_SkipSpaces(aStr, nPos, nLen);
-
- while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
- {
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
-
- // use three points since quadratic is imported as cubic
- nPointCount += 3;
- }
- break;
- }
-
- // #100617# not yet supported: elliptical arc
- case 'A' :
- case 'a' :
- {
- DBG_ERROR("XMLIMP: non-interpreted tags in svg:d element (elliptical arc)!");
- nPos++;
- Imp_SkipSpaces(aStr, nPos, nLen);
-
- while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
- {
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipNumberAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipNumberAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- }
- break;
- }
-
- default:
- {
- nPos++;
- DBG_ERROR("XMLIMP: non-interpreted tags in svg:d element (unknown)!");
- break;
- }
- }
- }
-
- // alloc last poly (when points used)
- if(nPointCount)
- {
- // #104076# If this partial polygon is closed, use one more point
- // to represent that
- if(mbIsClosed)
- {
- nPointCount++;
- }
-
- pOuterSequence->realloc(nPointCount);
- pOuterSequence++;
-
- if(pOuterFlags)
- {
- pOuterFlags->realloc(nPointCount);
- pOuterFlags++;
- }
- }
-
- // set pointers back
- pOuterSequence = maPoly.getArray();
- pOuterFlags = (IsCurve()) ? maFlag.getArray() : 0L;
- awt::Point* pNotSoInnerSequence = 0L;
- drawing::PolygonFlags* pNotSoInnerFlags = 0L;
- sal_uInt32 nInnerIndex(0L);
-
- // prepare new loop, read points
- nPos = 0;
- Imp_SkipSpaces(aStr, nPos, nLen);
-
- // #104076# reset closed flag for next to be started polygon
- mbIsClosed = false;
-
- while(nPos < nLen)
- {
- bool bRelative(false);
-
- switch(aStr[nPos])
- {
- case 'z' :
- case 'Z' :
- {
- nPos++;
- Imp_SkipSpaces(aStr, nPos, nLen);
-
- // #104076# remember closed state of current polygon
- mbIsClosed = true;
-
- // closed: add first point again
- // sal_Int32 nX(pInnerSequence[0].X);
- // sal_Int32 nY(pInnerSequence[0].Y);
- // Imp_AddExportPoints(nX, nY, pInnerSequence, pInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL);
-
- break;
- }
-
- case 'm' :
- {
- bRelative = true;
- }
- case 'M' :
- {
- // #104076# end-process current poly
- if(mbIsClosed)
- {
- if(pNotSoInnerSequence)
- {
- // closed: add first point again
- sal_Int32 nX(pNotSoInnerSequence[0].X);
- sal_Int32 nY(pNotSoInnerSequence[0].Y);
- Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL);
- }
-
- // reset closed flag for next to be started polygon
- mbIsClosed = false;
- }
-
- // next poly
- pNotSoInnerSequence = pOuterSequence->getArray();
- pOuterSequence++;
-
- if(pOuterFlags)
- {
- pNotSoInnerFlags = pOuterFlags->getArray();
- pOuterFlags++;
- }
-
- nInnerIndex = 0L;
-
- nPos++;
- Imp_SkipSpaces(aStr, nPos, nLen);
-
- while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
- {
- sal_Int32 nX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
- sal_Int32 nY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
-
- if(bRelative)
- {
- nX += mnLastX;
- nY += mnLastY;
- }
-
- // set last position
- mnLastX = nX;
- mnLastY = nY;
-
- // calc transform and add point and flag
- Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
- Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL);
- }
- break;
- }
-
- case 'l' :
- {
- bRelative = true;
- }
- case 'L' :
- {
- nPos++;
- Imp_SkipSpaces(aStr, nPos, nLen);
-
- while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
- {
- sal_Int32 nX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
- sal_Int32 nY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
-
- if(bRelative)
- {
- nX += mnLastX;
- nY += mnLastY;
- }
-
- // set last position
- mnLastX = nX;
- mnLastY = nY;
-
- // calc transform and add point and flag
- Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
- Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL);
- }
- break;
- }
-
- case 'h' :
- {
- bRelative = true;
- }
- case 'H' :
- {
- nPos++;
- Imp_SkipSpaces(aStr, nPos, nLen);
-
- while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
- {
- sal_Int32 nX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
- sal_Int32 nY(mnLastY);
-
- if(bRelative)
- nX += mnLastX;
-
- // set last position
- mnLastX = nX;
-
- // calc transform and add point and flag
- Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
- Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL);
- }
- break;
- }
-
- case 'v' :
- {
- bRelative = true;
- }
- case 'V' :
- {
- nPos++;
- Imp_SkipSpaces(aStr, nPos, nLen);
-
- while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
- {
- sal_Int32 nX(mnLastX);
- sal_Int32 nY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
-
- if(bRelative)
- nY += mnLastY;
-
- // set last position
- mnLastY = nY;
-
- // calc transform and add point and flag
- Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
- Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL);
- }
- break;
- }
-
- case 's' :
- {
- bRelative = true;
- }
- case 'S' :
- {
- nPos++;
- Imp_SkipSpaces(aStr, nPos, nLen);
-
- while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
- {
- sal_Int32 nX1;
- sal_Int32 nY1;
- sal_Int32 nX2(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
- sal_Int32 nY2(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
- sal_Int32 nX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
- sal_Int32 nY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
-
- if(bRelative)
- {
- nX2 += mnLastX;
- nY2 += mnLastY;
- nX += mnLastX;
- nY += mnLastY;
- }
-
- // set last position
- mnLastX = nX;
- mnLastY = nY;
-
- // calc transform for new points
- Imp_PrepareCoorImport(nX2, nY2, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
- Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
-
- // one more thing is known: the previous real point is PolygonFlags_SYMMETRIC
- // and the Point X1,Y1 can be constructed by mirroring the point before it.
- nX1 = nX2;
- nY1 = nY2;
- if(nInnerIndex)
- {
- awt::Point aPPrev1 = pNotSoInnerSequence[nInnerIndex - 1];
-
- if(nInnerIndex > 1)
- {
- awt::Point aPPrev2 = pNotSoInnerSequence[nInnerIndex - 2];
- nX1 = aPPrev1.X -(aPPrev2.X - aPPrev1.X);
- nY1 = aPPrev1.Y -(aPPrev2.Y - aPPrev1.Y);
- }
-
- // set curve point to symmetric
- pNotSoInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_SYMMETRIC;
- }
-
- // add calculated control point
- Imp_AddExportPoints(nX1, nY1, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
-
- // add new points and set flags
- Imp_AddExportPoints(nX2, nY2, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
- Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_SMOOTH);
- }
- break;
- }
-
- case 'c' :
- {
- bRelative = true;
- }
- case 'C' :
- {
- nPos++;
- Imp_SkipSpaces(aStr, nPos, nLen);
-
- while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
- {
- sal_Int32 nX1(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
- sal_Int32 nY1(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
- sal_Int32 nX2(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
- sal_Int32 nY2(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
- sal_Int32 nX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
- sal_Int32 nY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
-
- if(bRelative)
- {
- nX1 += mnLastX;
- nY1 += mnLastY;
- nX2 += mnLastX;
- nY2 += mnLastY;
- nX += mnLastX;
- nY += mnLastY;
- }
-
- // set last position
- mnLastX = nX;
- mnLastY = nY;
-
- // calc transform for new points
- Imp_PrepareCoorImport(nX1, nY1, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
- Imp_PrepareCoorImport(nX2, nY2, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
- Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
-
- // correct polygon flag for previous point
- Imp_CorrectPolygonFlag(nInnerIndex, pNotSoInnerSequence, pNotSoInnerFlags, nX1, nY1);
-
- // add new points and set flags
- Imp_AddExportPoints(nX1, nY1, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
- Imp_AddExportPoints(nX2, nY2, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
- Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_SMOOTH);
- }
- break;
- }
-
- // #100617# quadratic beziers are imported as cubic
- case 'q' :
- {
- bRelative = true;
- }
- case 'Q' :
- {
- nPos++;
- Imp_SkipSpaces(aStr, nPos, nLen);
-
- while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
- {
- sal_Int32 nXX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
- sal_Int32 nYY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
- sal_Int32 nX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
- sal_Int32 nY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
-
- if(bRelative)
- {
- nXX += mnLastX;
- nYY += mnLastY;
- nX += mnLastX;
- nY += mnLastY;
- }
-
- // set last position
- mnLastX = nX;
- mnLastY = nY;
-
- // calc transform for new points
- Imp_PrepareCoorImport(nXX, nYY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
- Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
-
- // calculate X1,X2
- awt::Point aPPrev1 = (nInnerIndex) ? pNotSoInnerSequence[nInnerIndex-1] : pNotSoInnerSequence[0];
- sal_Int32 nX1 = FRound((double)((nXX * 2) + aPPrev1.X) / 3.0);
- sal_Int32 nY1 = FRound((double)((nYY * 2) + aPPrev1.Y) / 3.0);
- sal_Int32 nX2 = FRound((double)((nXX * 2) + nX) / 3.0);
- sal_Int32 nY2 = FRound((double)((nYY * 2) + nY) / 3.0);
-
- // correct polygon flag for previous point
- Imp_CorrectPolygonFlag(nInnerIndex, pNotSoInnerSequence, pNotSoInnerFlags, nX1, nY1);
-
- // add new points and set flags
- Imp_AddExportPoints(nX1, nY1, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
- Imp_AddExportPoints(nX2, nY2, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
- Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_SMOOTH);
- }
- break;
- }
-
- // #100617# relative quadratic beziers are imported as cubic
- case 't' :
- {
- bRelative = true;
- }
- case 'T' :
- {
- nPos++;
- Imp_SkipSpaces(aStr, nPos, nLen);
-
- while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
- {
- sal_Int32 nXX;
- sal_Int32 nYY;
- sal_Int32 nX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
- sal_Int32 nY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv));
-
- if(bRelative)
- {
- nX += mnLastX;
- nY += mnLastY;
- }
-
- // set last position
- mnLastX = nX;
- mnLastY = nY;
-
- // calc transform for new points
- Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate);
-
- // one more thing is known: the previous real point is PolygonFlags_SYMMETRIC
- // and the Point X1,Y1 can be constructed by mirroring the point before it.
- nXX = nX;
- nYY = nY;
- awt::Point aPPrev1 = pNotSoInnerSequence[0];
-
- if(nInnerIndex)
- {
- aPPrev1 = pNotSoInnerSequence[nInnerIndex - 1];
-
- if(nInnerIndex > 1)
- {
- awt::Point aPPrev2 = pNotSoInnerSequence[nInnerIndex - 2];
- nXX = aPPrev1.X -(aPPrev2.X - aPPrev1.X);
- nYY = aPPrev1.Y -(aPPrev2.Y - aPPrev1.Y);
- }
-
- // set curve point to smooth here, since length
- // is changed and thus only c1 can be used.
- pNotSoInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_SMOOTH;
- }
-
- // calculate X1,X2
- sal_Int32 nX1 = FRound((double)((nXX * 2) + aPPrev1.X) / 3.0);
- sal_Int32 nY1 = FRound((double)((nYY * 2) + aPPrev1.Y) / 3.0);
- sal_Int32 nX2 = FRound((double)((nXX * 2) + nX) / 3.0);
- sal_Int32 nY2 = FRound((double)((nYY * 2) + nY) / 3.0);
-
- // correct polygon flag for previous point
- Imp_CorrectPolygonFlag(nInnerIndex, pNotSoInnerSequence, pNotSoInnerFlags, nX1, nY1);
-
- // add new points and set flags
- Imp_AddExportPoints(nX1, nY1, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
- Imp_AddExportPoints(nX2, nY2, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL);
- Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_SMOOTH);
- }
- break;
- }
-
- // #100617# not yet supported: elliptical arc
- case 'A' :
- case 'a' :
- {
- DBG_ERROR("XMLIMP: non-interpreted tags in svg:d element (elliptical arc)!");
- nPos++;
- Imp_SkipSpaces(aStr, nPos, nLen);
-
- while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
- {
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipNumberAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipNumberAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
- }
- break;
- }
-
- default:
- {
- nPos++;
- DBG_ERROR("XMLIMP: non-interpreted tags in svg:d element (unknown)!");
- break;
- }
- }
- }
-
- // #104076# end-process closed state of last poly
- if(mbIsClosed)
- {
- if(pNotSoInnerSequence)
- {
- // closed: add first point again
- sal_Int32 nX(pNotSoInnerSequence[0].X);
- sal_Int32 nY(pNotSoInnerSequence[0].Y);
- Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL);
- }
- }
-
- // #87202# If it's a curve and it's closed the last point maybe too much
- // and just exported since SVG does not allow special handling of same
- // start and end point, remove this last point.
- // Evtl. correct the last curve flags, too.
- if(IsCurve() && IsClosed())
- {
- // make one more loop over the PolyPolygon
- pOuterSequence = maPoly.getArray();
- pOuterFlags = maFlag.getArray();
- sal_Int32 nOuterCnt(maPoly.getLength());
-
- for(sal_Int32 a(0); a < nOuterCnt; a++)
- {
- // get Polygon pointers
- awt::Point* pInnerSequence = pOuterSequence->getArray();
- drawing::PolygonFlags* pInnerFlags = pOuterFlags->getArray();
- sal_Int32 nInnerCnt(pOuterSequence->getLength());
-
- while( nInnerCnt >= 2
- && ((pInnerSequence + (nInnerCnt - 2))->X == (pInnerSequence + (nInnerCnt - 1))->X)
- && ((pInnerSequence + (nInnerCnt - 2))->Y == (pInnerSequence + (nInnerCnt - 1))->Y)
- && drawing::PolygonFlags_CONTROL != *(pInnerFlags + (nInnerCnt - 2)))
- {
- // remove last point from array
- pOuterSequence->realloc(nInnerCnt - 1);
- pOuterFlags->realloc(nInnerCnt - 1);
-
- // get new pointers
- pInnerSequence = pOuterSequence->getArray();
- pInnerFlags = pOuterFlags->getArray();
- nInnerCnt = pOuterSequence->getLength();
- }
-
- // now evtl. correct the last curve flags
- if(nInnerCnt >= 4)
- {
- if( pInnerSequence->X == (pInnerSequence + (nInnerCnt - 1))->X
- && pInnerSequence->Y == (pInnerSequence + (nInnerCnt - 1))->Y
- && drawing::PolygonFlags_CONTROL == *(pInnerFlags + 1)
- && drawing::PolygonFlags_CONTROL == *(pInnerFlags + (nInnerCnt - 2)))
- {
- awt::Point aPrev = *(pInnerSequence + (nInnerCnt - 2));
- awt::Point aCurr = *pInnerSequence;
- awt::Point aNext = *(pInnerSequence + 1);
- ::basegfx::B2DVector aVec1(aPrev.X - aCurr.X, aPrev.Y - aCurr.Y);
- ::basegfx::B2DVector aVec2(aNext.X - aCurr.X, aNext.Y - aCurr.Y);
- bool bSameLength(false);
- bool bSameDirection(false);
-
- // get vector values
- Imp_CalcVectorValues(aVec1, aVec2, bSameLength, bSameDirection);
-
- // set correct flag value
- if(bSameDirection)
- {
- if(bSameLength)
- {
- // set to PolygonFlags_SYMMETRIC
- *pInnerFlags = drawing::PolygonFlags_SYMMETRIC;
- *(pInnerFlags + (nInnerCnt - 1)) = drawing::PolygonFlags_SYMMETRIC;
- }
- else
- {
- // set to PolygonFlags_SMOOTH
- *pInnerFlags = drawing::PolygonFlags_SMOOTH;
- *(pInnerFlags + (nInnerCnt - 1)) = drawing::PolygonFlags_SMOOTH;
- }
- }
- else
- {
- // set to PolygonFlags_NORMAL
- *pInnerFlags = drawing::PolygonFlags_NORMAL;
- *(pInnerFlags + (nInnerCnt - 1)) = drawing::PolygonFlags_NORMAL;
- }
- }
- }
-
- // switch to next Polygon
- pOuterSequence++;
- pOuterFlags++;
- }
- }
- }
-}
+//
+//SdXMLImExSvgDElement::SdXMLImExSvgDElement(const SdXMLImExViewBox& rViewBox)
+//: mrViewBox( rViewBox ),
+// mbIsClosed( false ),
+// mbIsCurve( false ),
+// mnLastX( 0L ),
+// mnLastY( 0L ),
+// maPoly( 0L ),
+// maFlag( 0L )
+//{
+//}
+//
+//void Imp_GetPrevPos(awt::Point*& pPrevPos1,
+// drawing::PolygonFlags& aPrevFlag1,
+// const bool bClosed, awt::Point* pPoints,
+// drawing::PolygonFlags* pFlags, const sal_Int32 nPos,
+// const sal_Int32 nCnt, const sal_Int32 nAdd)
+//{
+// if(bClosed)
+// {
+// pPrevPos1 = pPoints + ((nPos + nCnt - nAdd) % nCnt);
+// aPrevFlag1 = *(pFlags + ((nPos + nCnt - nAdd) % nCnt));
+// }
+// else if(nPos > (nAdd - 1))
+// {
+// pPrevPos1 = pPoints + (nPos - nAdd);
+// aPrevFlag1 = *(pFlags + (nPos - nAdd));
+// }
+// else
+// pPrevPos1 = 0L;
+//}
+//
+//void Imp_PrepareCoorExport(sal_Int32& nX, sal_Int32& nY,
+// const awt::Point* pPointArray, const awt::Point& rObjectPos,
+// const awt::Size& rObjectSize, const SdXMLImExViewBox& mrViewBox,
+// const bool bScale, const bool bTranslate)
+//{
+// nX = pPointArray->X - rObjectPos.X;
+// nY = pPointArray->Y - rObjectPos.Y;
+//
+// if(bScale && rObjectSize.Width && rObjectSize.Height )
+// {
+// nX = (nX * mrViewBox.GetWidth()) / rObjectSize.Width;
+// nY = (nY * mrViewBox.GetHeight()) / rObjectSize.Height;
+// }
+//
+// if(bTranslate)
+// {
+// nX += mrViewBox.GetX();
+// nY += mrViewBox.GetY();
+// }
+//}
+//
+////#define TEST_QUADRATIC_CURVES
+//#ifdef TEST_QUADRATIC_CURVES
+//// To be able to test quadratic curve code: The code concerning to
+//// bDoTestHere can be used (see below). Construct shapes which have their control
+//// points on equal coordinates. When these are written, they can be
+//// forced to create correct 'Q' and 'T' statements using this flag.
+//// These may then be tested for import/exporting.
+//static bool bDoTestHere(true);
+//#endif // TEST_QUADRATIC_CURVES
+//
+//void SdXMLImExSvgDElement::AddPolygon(
+// drawing::PointSequence* pPoints,
+// drawing::FlagSequence* pFlags,
+// const awt::Point& rObjectPos,
+// const awt::Size& rObjectSize,
+// bool bClosed, bool bRelative)
+//{
+// DBG_ASSERT(pPoints, "Empty PointSequence handed over to SdXMLImExSvgDElement(!)");
+//
+// sal_Int32 nCnt(pPoints->getLength());
+//
+// // #104076# Convert to string only when at last one point included
+// if(nCnt > 0)
+// {
+// // append polygon to string
+// OUString aNewString;
+// sal_Unicode aLastCommand = ' ';
+// awt::Point* pPointArray = pPoints->getArray();
+//
+// // are the flags used at all? If not forget about them
+// if(pFlags)
+// {
+// sal_Int32 nFlagCnt(pFlags->getLength());
+//
+// if(nFlagCnt)
+// {
+// bool bFlagsUsed(false);
+// drawing::PolygonFlags* pFlagArray = pFlags->getArray();
+//
+// for(sal_Int32 a(0); !bFlagsUsed && a < nFlagCnt; a++)
+// if(drawing::PolygonFlags_NORMAL != *pFlagArray++)
+// bFlagsUsed = true;
+//
+// if(!bFlagsUsed)
+// pFlags = 0L;
+// }
+// else
+// {
+// pFlags = 0L;
+// }
+// }
+//
+// // object size and ViewBox size different?
+// bool bScale(rObjectSize.Width != mrViewBox.GetWidth()
+// || rObjectSize.Height != mrViewBox.GetHeight());
+// bool bTranslate(mrViewBox.GetX() != 0L || mrViewBox.GetY() != 0L);
+//
+// // #87202# rework of point reduction:
+// // Test for Last point same -> closed, ignore last point. Take
+// // some more circumstances in account when looking at curve segments.
+// drawing::PolygonFlags* pFlagArray = (pFlags) ? pFlags->getArray() : 0L;
+//
+// // #121090# only reduce double start/end points if polygon *is* closed
+// if(bClosed && (pPointArray->X == (pPointArray + (nCnt - 1))->X) && (pPointArray->Y == (pPointArray + (nCnt - 1))->Y))
+// {
+// if(pFlags)
+// {
+// // point needs to be ignored if point before it is
+// // NO control point. Else the last point is needed
+// // for exporting the last segment of the curve. That means
+// // that the last and the first point will be saved double,
+// // but SVG does not support a better solution here.
+// if(nCnt >= 2 && drawing::PolygonFlags_CONTROL != *(pFlagArray + (nCnt - 2)))
+// {
+// nCnt--;
+// }
+// }
+// else
+// {
+// // no curve, ignore last point
+// nCnt--;
+// }
+// }
+//
+// // bezier poly, handle curves
+// bool bDidWriteStart(false);
+//
+// for(sal_Int32 a(0L); a < nCnt; a++)
+// {
+// if(!pFlags || drawing::PolygonFlags_CONTROL != *pFlagArray)
+// {
+// bool bDidWriteAsCurve(false);
+//
+// if(bDidWriteStart)
+// {
+// if(pFlags)
+// {
+// // real curve point, get previous to see if it's a control point
+// awt::Point* pPrevPos1;
+// drawing::PolygonFlags aPrevFlag1;
+//
+// Imp_GetPrevPos(pPrevPos1, aPrevFlag1, bClosed, pPoints->getArray(),
+// pFlags->getArray(), a, nCnt, 1);
+//
+// if(pPrevPos1 && drawing::PolygonFlags_CONTROL == aPrevFlag1)
+// {
+// // get previous2 to see if it's a control point, too
+// awt::Point* pPrevPos2;
+// drawing::PolygonFlags aPrevFlag2;
+//
+// Imp_GetPrevPos(pPrevPos2, aPrevFlag2, bClosed, pPoints->getArray(),
+// pFlags->getArray(), a, nCnt, 2);
+//
+// if(pPrevPos2 && drawing::PolygonFlags_CONTROL == aPrevFlag2)
+// {
+// // get previous3 to see if it's a curve point and if,
+// // if it is fully symmetric or not
+// awt::Point* pPrevPos3;
+// drawing::PolygonFlags aPrevFlag3;
+//
+// Imp_GetPrevPos(pPrevPos3, aPrevFlag3, bClosed, pPoints->getArray(),
+// pFlags->getArray(), a, nCnt, 3);
+//
+// if(pPrevPos3)
+// {
+// // prepare coordinates
+// sal_Int32 nX, nY;
+//
+// Imp_PrepareCoorExport(nX, nY, pPointArray, rObjectPos, rObjectSize,
+// mrViewBox, bScale, bTranslate);
+//
+// // #100617# test if this curve segment may be written as
+// // a quadratic bezier
+// // 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
+// bool bIsQuadratic(false);
+// const bool bEnableSaveQuadratic(false);
+//
+// sal_Int32 nPX_L(FRound((double)((3 * pPrevPos2->X) - pPrevPos3->X) / 2.0));
+// sal_Int32 nPY_L(FRound((double)((3 * pPrevPos2->Y) - pPrevPos3->Y) / 2.0));
+// sal_Int32 nPX_R(FRound((double)((3 * pPrevPos1->X) - pPointArray->X) / 2.0));
+// sal_Int32 nPY_R(FRound((double)((3 * pPrevPos1->Y) - pPointArray->Y) / 2.0));
+// sal_Int32 nDist(0);
+//
+// if(nPX_L != nPX_R)
+// {
+// nDist += abs(nPX_L - nPX_R);
+// }
+//
+// if(nPY_L != nPY_R)
+// {
+// nDist += abs(nPY_L - nPY_R);
+// }
+//
+// if(nDist <= BORDER_INTEGERS_ARE_EQUAL)
+// {
+// if(bEnableSaveQuadratic)
+// {
+// bIsQuadratic = true;
+// }
+// }
+//
+//#ifdef TEST_QUADRATIC_CURVES
+// if(bDoTestHere)
+// {
+// bIsQuadratic = false;
+//
+// if(pPrevPos1->X == pPrevPos2->X && pPrevPos1->Y == pPrevPos2->Y)
+// bIsQuadratic = true;
+// }
+//#endif // TEST_QUADRATIC_CURVES
+//
+// if(bIsQuadratic)
+// {
+//#ifdef TEST_QUADRATIC_CURVES
+// if(bDoTestHere)
+// {
+// bool bPrevPointIsSymmetric(false);
+//
+// if(drawing::PolygonFlags_SYMMETRIC == aPrevFlag3)
+// {
+// // get previous4 to see if it's a control point
+// awt::Point* pPrevPos4;
+// drawing::PolygonFlags aPrevFlag4;
+//
+// Imp_GetPrevPos(pPrevPos4, aPrevFlag4, bClosed, pPoints->getArray(),
+// pFlags->getArray(), a, nCnt, 4);
+//
+// if(drawing::PolygonFlags_CONTROL == aPrevFlag4)
+// {
+// // okay, prevPos3 is symmetric (c2) and prevPos4
+// // is existing control point, the 's' statement can be used
+// bPrevPointIsSymmetric = true;
+// }
+// }
+//
+// if(bPrevPointIsSymmetric)
+// {
+// // write a shorthand/smooth quadratic curveto entry (T)
+// if(bRelative)
+// {
+// if(aLastCommand != sal_Unicode('t'))
+// aNewString += OUString(sal_Unicode('t'));
+//
+// Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+// Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+//
+// aLastCommand = sal_Unicode('t');
+// }
+// else
+// {
+// if(aLastCommand != sal_Unicode('T'))
+// aNewString += OUString(sal_Unicode('T'));
+//
+// Imp_PutNumberCharWithSpace(aNewString, nX);
+// Imp_PutNumberCharWithSpace(aNewString, nY);
+//
+// aLastCommand = sal_Unicode('T');
+// }
+// }
+// else
+// {
+// // prepare coordinates
+// sal_Int32 nX1, nY1;
+//
+// Imp_PrepareCoorExport(nX1, nY1, pPrevPos1, rObjectPos, rObjectSize,
+// mrViewBox, bScale, bTranslate);
+//
+// // write a quadratic curveto entry (Q)
+// if(bRelative)
+// {
+// if(aLastCommand != sal_Unicode('q'))
+// aNewString += OUString(sal_Unicode('q'));
+//
+// Imp_PutNumberCharWithSpace(aNewString, nX1 - mnLastX);
+// Imp_PutNumberCharWithSpace(aNewString, nY1 - mnLastY);
+// Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+// Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+//
+// aLastCommand = sal_Unicode('q');
+// }
+// else
+// {
+// if(aLastCommand != sal_Unicode('Q'))
+// aNewString += OUString(sal_Unicode('Q'));
+//
+// Imp_PutNumberCharWithSpace(aNewString, nX1);
+// Imp_PutNumberCharWithSpace(aNewString, nY1);
+// Imp_PutNumberCharWithSpace(aNewString, nX);
+// Imp_PutNumberCharWithSpace(aNewString, nY);
+//
+// aLastCommand = sal_Unicode('Q');
+// }
+// }
+// }
+// else
+// {
+//#endif // TEST_QUADRATIC_CURVES
+// awt::Point aNewPoint(nPX_L, nPY_L);
+// bool bPrevPointIsSmooth(false);
+//
+// if(drawing::PolygonFlags_SMOOTH == aPrevFlag3)
+// {
+// // get previous4 to see if it's a control point
+// awt::Point* pPrevPos4;
+// drawing::PolygonFlags aPrevFlag4;
+//
+// Imp_GetPrevPos(pPrevPos4, aPrevFlag4, bClosed, pPoints->getArray(),
+// pFlags->getArray(), a, nCnt, 4);
+//
+// if(drawing::PolygonFlags_CONTROL == aPrevFlag4)
+// {
+// // okay, prevPos3 is smooth (c1) and prevPos4
+// // is existing control point. Test if it's even symmetric
+// // and thus the 'T' statement may be used.
+// ::basegfx::B2DVector aVec1(pPrevPos4->X - pPrevPos3->X, pPrevPos4->Y - pPrevPos3->Y);
+// ::basegfx::B2DVector aVec2(aNewPoint.X - pPrevPos3->X, aNewPoint.Y - pPrevPos3->Y);
+// bool bSameLength(false);
+// bool bSameDirection(false);
+//
+// // get vector values
+// Imp_CalcVectorValues(aVec1, aVec2, bSameLength, bSameDirection);
+//
+// if(bSameLength && bSameDirection)
+// bPrevPointIsSmooth = true;
+// }
+// }
+//
+// if(bPrevPointIsSmooth)
+// {
+// // write a shorthand/smooth quadratic curveto entry (T)
+// if(bRelative)
+// {
+// if(aLastCommand != sal_Unicode('t'))
+// aNewString += String(sal_Unicode('t'));
+//
+// Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+// Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+//
+// aLastCommand = sal_Unicode('t');
+// }
+// else
+// {
+// if(aLastCommand != sal_Unicode('T'))
+// aNewString += String(sal_Unicode('T'));
+//
+// Imp_PutNumberCharWithSpace(aNewString, nX);
+// Imp_PutNumberCharWithSpace(aNewString, nY);
+//
+// aLastCommand = sal_Unicode('T');
+// }
+// }
+// else
+// {
+// // prepare coordinates
+// sal_Int32 nX1, nY1;
+//
+// Imp_PrepareCoorExport(nX1, nY1, &aNewPoint, rObjectPos, rObjectSize,
+// mrViewBox, bScale, bTranslate);
+//
+// // write a quadratic curveto entry (Q)
+// if(bRelative)
+// {
+// if(aLastCommand != sal_Unicode('q'))
+// aNewString += String(sal_Unicode('q'));
+//
+// Imp_PutNumberCharWithSpace(aNewString, nX1 - mnLastX);
+// Imp_PutNumberCharWithSpace(aNewString, nY1 - mnLastY);
+// Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+// Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+//
+// aLastCommand = sal_Unicode('q');
+// }
+// else
+// {
+// if(aLastCommand != sal_Unicode('Q'))
+// aNewString += String(sal_Unicode('Q'));
+//
+// Imp_PutNumberCharWithSpace(aNewString, nX1);
+// Imp_PutNumberCharWithSpace(aNewString, nY1);
+// Imp_PutNumberCharWithSpace(aNewString, nX);
+// Imp_PutNumberCharWithSpace(aNewString, nY);
+//
+// aLastCommand = sal_Unicode('Q');
+// }
+// }
+//#ifdef TEST_QUADRATIC_CURVES
+// }
+//#endif // TEST_QUADRATIC_CURVES
+// }
+// else
+// {
+// bool bPrevPointIsSymmetric(false);
+//
+// if(drawing::PolygonFlags_SYMMETRIC == aPrevFlag3)
+// {
+// // get previous4 to see if it's a control point
+// awt::Point* pPrevPos4;
+// drawing::PolygonFlags aPrevFlag4;
+//
+// Imp_GetPrevPos(pPrevPos4, aPrevFlag4, bClosed, pPoints->getArray(),
+// pFlags->getArray(), a, nCnt, 4);
+//
+// if(drawing::PolygonFlags_CONTROL == aPrevFlag4)
+// {
+// // okay, prevPos3 is symmetric (c2) and prevPos4
+// // is existing control point, the 's' statement can be used
+// bPrevPointIsSymmetric = true;
+// }
+// }
+//
+// // prepare coordinates
+// sal_Int32 nX2, nY2;
+//
+// Imp_PrepareCoorExport(nX2, nY2, pPrevPos1, rObjectPos, rObjectSize,
+// mrViewBox, bScale, bTranslate);
+//
+// if(bPrevPointIsSymmetric)
+// {
+// // write a shorthand/smooth curveto entry (S)
+// if(bRelative)
+// {
+// if(aLastCommand != sal_Unicode('s'))
+// aNewString += String(sal_Unicode('s'));
+//
+// Imp_PutNumberCharWithSpace(aNewString, nX2 - mnLastX);
+// Imp_PutNumberCharWithSpace(aNewString, nY2 - mnLastY);
+// Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+// Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+//
+// aLastCommand = sal_Unicode('s');
+// }
+// else
+// {
+// if(aLastCommand != sal_Unicode('S'))
+// aNewString += String(sal_Unicode('S'));
+//
+// Imp_PutNumberCharWithSpace(aNewString, nX2);
+// Imp_PutNumberCharWithSpace(aNewString, nY2);
+// Imp_PutNumberCharWithSpace(aNewString, nX);
+// Imp_PutNumberCharWithSpace(aNewString, nY);
+//
+// aLastCommand = sal_Unicode('S');
+// }
+// }
+// else
+// {
+// // prepare coordinates
+// sal_Int32 nX1, nY1;
+//
+// Imp_PrepareCoorExport(nX1, nY1, pPrevPos2, rObjectPos, rObjectSize,
+// mrViewBox, bScale, bTranslate);
+//
+// // write a curveto entry (C)
+// if(bRelative)
+// {
+// if(aLastCommand != sal_Unicode('c'))
+// aNewString += String(sal_Unicode('c'));
+//
+// Imp_PutNumberCharWithSpace(aNewString, nX1 - mnLastX);
+// Imp_PutNumberCharWithSpace(aNewString, nY1 - mnLastY);
+// Imp_PutNumberCharWithSpace(aNewString, nX2 - mnLastX);
+// Imp_PutNumberCharWithSpace(aNewString, nY2 - mnLastY);
+// Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+// Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+//
+// aLastCommand = sal_Unicode('c');
+// }
+// else
+// {
+// if(aLastCommand != sal_Unicode('C'))
+// aNewString += String(sal_Unicode('C'));
+//
+// Imp_PutNumberCharWithSpace(aNewString, nX1);
+// Imp_PutNumberCharWithSpace(aNewString, nY1);
+// Imp_PutNumberCharWithSpace(aNewString, nX2);
+// Imp_PutNumberCharWithSpace(aNewString, nY2);
+// Imp_PutNumberCharWithSpace(aNewString, nX);
+// Imp_PutNumberCharWithSpace(aNewString, nY);
+//
+// aLastCommand = sal_Unicode('C');
+// }
+// }
+// }
+//
+// // remember that current point IS written
+// bDidWriteAsCurve = true;
+//
+// // remember new last position
+// mnLastX = nX;
+// mnLastY = nY;
+// }
+// }
+// }
+// }
+// }
+//
+// if(!bDidWriteAsCurve)
+// {
+// // current point not yet written, prepare coordinates
+// sal_Int32 nX, nY;
+//
+// Imp_PrepareCoorExport(nX, nY, pPointArray, rObjectPos, rObjectSize,
+// mrViewBox, bScale, bTranslate);
+//
+// if(bDidWriteStart)
+// {
+// // write as normal point
+// if(mnLastX == nX)
+// {
+// if(bRelative)
+// {
+// if(aLastCommand != sal_Unicode('v'))
+// aNewString += String(sal_Unicode('v'));
+//
+// Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+//
+// aLastCommand = sal_Unicode('v');
+// }
+// else
+// {
+// if(aLastCommand != sal_Unicode('V'))
+// aNewString += String(sal_Unicode('V'));
+//
+// Imp_PutNumberCharWithSpace(aNewString, nY);
+//
+// aLastCommand = sal_Unicode('V');
+// }
+// }
+// else if(mnLastY == nY)
+// {
+// if(bRelative)
+// {
+// if(aLastCommand != sal_Unicode('h'))
+// aNewString += String(sal_Unicode('h'));
+//
+// Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+//
+// aLastCommand = sal_Unicode('h');
+// }
+// else
+// {
+// if(aLastCommand != sal_Unicode('H'))
+// aNewString += String(sal_Unicode('H'));
+//
+// Imp_PutNumberCharWithSpace(aNewString, nX);
+//
+// aLastCommand = sal_Unicode('H');
+// }
+// }
+// else
+// {
+// if(bRelative)
+// {
+// if(aLastCommand != sal_Unicode('l'))
+// aNewString += String(sal_Unicode('l'));
+//
+// Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+// Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+//
+// aLastCommand = sal_Unicode('l');
+// }
+// else
+// {
+// if(aLastCommand != sal_Unicode('L'))
+// aNewString += String(sal_Unicode('L'));
+//
+// Imp_PutNumberCharWithSpace(aNewString, nX);
+// Imp_PutNumberCharWithSpace(aNewString, nY);
+//
+// aLastCommand = sal_Unicode('L');
+// }
+// }
+// }
+// else
+// {
+// // write as start point
+// if(bRelative)
+// {
+// aNewString += String(sal_Unicode('m'));
+//
+// Imp_PutNumberCharWithSpace(aNewString, nX - mnLastX);
+// Imp_PutNumberCharWithSpace(aNewString, nY - mnLastY);
+//
+// aLastCommand = sal_Unicode('l');
+// }
+// else
+// {
+// aNewString += String(sal_Unicode('M'));
+//
+// Imp_PutNumberCharWithSpace(aNewString, nX);
+// Imp_PutNumberCharWithSpace(aNewString, nY);
+//
+// aLastCommand = sal_Unicode('L');
+// }
+//
+// // remember start written
+// bDidWriteStart = true;
+// }
+//
+// // remember new last position
+// mnLastX = nX;
+// mnLastY = nY;
+// }
+// }
+//
+// // next point
+// pPointArray++;
+// pFlagArray++;
+// }
+//
+// // close path if closed poly
+// if(bClosed)
+// {
+// if(bRelative)
+// aNewString += String(sal_Unicode('z'));
+// else
+// aNewString += String(sal_Unicode('Z'));
+// }
+//
+// // append new string
+// msString += aNewString;
+// }
+//}
+//
+//// #100617# Linear double reader
+//double Imp_ImportDoubleAndSpaces(
+// double fRetval, const OUString& rStr, sal_Int32& rPos,
+// const sal_Int32 nLen, const SvXMLUnitConverter& rConv)
+//{
+// fRetval = Imp_GetDoubleChar(rStr, rPos, nLen, rConv, fRetval);
+// Imp_SkipSpacesAndCommas(rStr, rPos, nLen);
+// return fRetval;
+//}
+//
+//// #100617# Allow to read doubles, too. This will need to be changed to
+//// the usage of Imp_ImportDoubleAndSpaces(...). For now, this is sufficient
+//// since the interface cannot transport doubles.
+//sal_Int32 Imp_ImportNumberAndSpaces(
+// sal_Int32 nRetval, const OUString& rStr, sal_Int32& rPos,
+// const sal_Int32 nLen, const SvXMLUnitConverter& rConv)
+//{
+// nRetval = FRound(Imp_ImportDoubleAndSpaces(double(nRetval), rStr, rPos, nLen, rConv));
+// Imp_SkipSpacesAndCommas(rStr, rPos, nLen);
+// return nRetval;
+//}
+//
+//void Imp_PrepareCoorImport(sal_Int32& nX, sal_Int32& nY,
+// const awt::Point& rObjectPos, const awt::Size& rObjectSize,
+// const SdXMLImExViewBox& rViewBox, const bool bScale, const bool bTranslate)
+//{
+// if(bTranslate)
+// {
+// nX -= rViewBox.GetX();
+// nY -= rViewBox.GetY();
+// }
+//
+// if(bScale && rViewBox.GetWidth() && rViewBox.GetHeight())
+// {
+// nX = (nX * rObjectSize.Width) / rViewBox.GetWidth();
+// nY = (nY * rObjectSize.Height) / rViewBox.GetHeight();
+// }
+//
+// nX += rObjectPos.X;
+// nY += rObjectPos.Y;
+//}
+//
+//void Imp_AddExportPoints(sal_Int32 nX, sal_Int32 nY,
+// awt::Point* pPoints, drawing::PolygonFlags* pFlags,
+// const sal_Int32 nInnerIndex,
+// drawing::PolygonFlags eFlag)
+//{
+// if(pPoints)
+// pPoints[nInnerIndex] = awt::Point( nX, nY );
+//
+// if(pFlags)
+// pFlags[nInnerIndex] = eFlag;
+//}
+//
+//void Imp_CalcVectorValues(::basegfx::B2DVector& aVec1, ::basegfx::B2DVector& aVec2, bool& bSameLength, bool& bSameDirection)
+//{
+// const sal_Int32 nLen1(FRound(aVec1.getLength()));
+// const sal_Int32 nLen2(FRound(aVec2.getLength()));
+// aVec1.normalize();
+// aVec2.normalize();
+// aVec1 += aVec2;
+// const sal_Int32 nLen3(FRound(aVec1.getLength() * ((nLen1 + nLen2) / 2.0)));
+//
+// bSameLength = (abs(nLen1 - nLen2) <= BORDER_INTEGERS_ARE_EQUAL);
+// bSameDirection = (nLen3 <= BORDER_INTEGERS_ARE_EQUAL);
+//}
+//
+//void Imp_CorrectPolygonFlag(const sal_uInt32 nInnerIndex, const awt::Point* const pInnerSequence,
+// drawing::PolygonFlags* const pInnerFlags, const sal_Int32 nX1, const sal_Int32 nY1)
+//{
+// if(nInnerIndex)
+// {
+// const awt::Point aPPrev1 = pInnerSequence[nInnerIndex - 1];
+//
+// if(nInnerIndex > 1)
+// {
+// const awt::Point aPPrev2 = pInnerSequence[nInnerIndex - 2];
+// const drawing::PolygonFlags aFPrev2 = pInnerFlags[nInnerIndex - 2];
+// ::basegfx::B2DVector aVec1(aPPrev2.X - aPPrev1.X, aPPrev2.Y - aPPrev1.Y);
+// ::basegfx::B2DVector aVec2(nX1 - aPPrev1.X, nY1 - aPPrev1.Y);
+// bool bSameLength(false);
+// bool bSameDirection(false);
+//
+// // get vector values
+// Imp_CalcVectorValues(aVec1, aVec2, bSameLength, bSameDirection);
+//
+// if(drawing::PolygonFlags_CONTROL == aFPrev2)
+// {
+// // point before is a control point
+// if(bSameDirection)
+// {
+// if(bSameLength)
+// {
+// // set to PolygonFlags_SYMMETRIC
+// pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_SYMMETRIC;
+// }
+// else
+// {
+// // set to PolygonFlags_SMOOTH
+// pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_SMOOTH;
+// }
+// }
+// else
+// {
+// // set to PolygonFlags_NORMAL
+// pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_NORMAL;
+// }
+// }
+// else
+// {
+// // point before is a simple curve point
+// if(bSameDirection)
+// {
+// // set to PolygonFlags_SMOOTH
+// pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_SMOOTH;
+// }
+// else
+// {
+// // set to PolygonFlags_NORMAL
+// pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_NORMAL;
+// }
+// }
+// }
+// else
+// {
+// // no point before starpoint, set type to PolygonFlags_NORMAL
+// pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_NORMAL;
+// }
+// }
+//}
+//
+//SdXMLImExSvgDElement::SdXMLImExSvgDElement(const OUString& rNew,
+// const SdXMLImExViewBox& rViewBox,
+// const awt::Point& rObjectPos,
+// const awt::Size& rObjectSize,
+// const SvXMLUnitConverter& rConv)
+//: msString( rNew ),
+// mrViewBox( rViewBox ),
+// mbIsClosed( false ),
+// mbIsCurve( false ),
+// mnLastX( 0L ),
+// mnLastY( 0L ),
+// maPoly( 0L ),
+// maFlag( 0L )
+//{
+// // convert string to polygon
+// const OUString aStr(msString.getStr(), msString.getLength());
+// const sal_Int32 nLen(aStr.getLength());
+// sal_Int32 nPos(0);
+// sal_Int32 nNumPolys(0L);
+// bool bEllipticalArc(false);
+//
+// // object size and ViewBox size different?
+// bool bScale(rObjectSize.Width != mrViewBox.GetWidth()
+// || rObjectSize.Height != mrViewBox.GetHeight());
+// bool bTranslate(mrViewBox.GetX() != 0L || mrViewBox.GetY() != 0L);
+//
+// // first loop: count polys and get flags
+// Imp_SkipSpaces(aStr, nPos, nLen);
+//
+// while(nPos < nLen)
+// {
+// switch(aStr[nPos++])
+// {
+// case 'Z' :
+// case 'z' :
+// {
+// break;
+// }
+// case 'M' :
+// case 'm' :
+// {
+// nNumPolys++;
+// break;
+// }
+// case 'S' :
+// case 's' :
+// case 'C' :
+// case 'c' :
+// case 'Q' :
+// case 'q' :
+// case 'T' :
+// case 't' :
+// {
+// mbIsCurve = true;
+// break;
+// }
+// case 'L' :
+// case 'l' :
+// case 'H' :
+// case 'h' :
+// case 'V' :
+// case 'v' :
+// {
+// // normal, interpreted values. All okay.
+// break;
+// }
+// case 'A' :
+// case 'a' :
+// {
+// // Not yet interpreted value.
+// bEllipticalArc = true;
+// break;
+// }
+// }
+// }
+//
+// DBG_ASSERT(!bEllipticalArc, "XMLIMP: non-interpreted tags in svg:d element!");
+//
+// if(nNumPolys)
+// {
+// // alloc arrays
+// maPoly.realloc(nNumPolys);
+// if(IsCurve())
+// maFlag.realloc(nNumPolys);
+//
+// // get outer sequences
+// drawing::PointSequence* pOuterSequence = maPoly.getArray();
+// drawing::FlagSequence* pOuterFlags = (IsCurve()) ? maFlag.getArray() : 0L;
+//
+// // prepare new loop, count
+// sal_uInt32 nPointCount(0L);
+// nPos = 0;
+// Imp_SkipSpaces(aStr, nPos, nLen);
+//
+// // #104076# reset closed flag for next to be started polygon
+// mbIsClosed = false;
+//
+// while(nPos < nLen)
+// {
+// switch(aStr[nPos])
+// {
+// case 'z' :
+// case 'Z' :
+// {
+// nPos++;
+// Imp_SkipSpaces(aStr, nPos, nLen);
+//
+// // #104076# remember closed state of current polygon
+// mbIsClosed = true;
+//
+// break;
+// }
+// case 'm' :
+// case 'M' :
+// {
+// // new poly starts, end-process current poly
+// if(nPointCount)
+// {
+// // #104076# If this partial polygon is closed, use one more point
+// // to represent that
+// if(mbIsClosed)
+// {
+// nPointCount++;
+// }
+//
+// pOuterSequence->realloc(nPointCount);
+// pOuterSequence++;
+//
+// if(pOuterFlags)
+// {
+// pOuterFlags->realloc(nPointCount);
+// pOuterFlags++;
+// }
+//
+// // reset point count for next polygon
+// nPointCount = 0L;
+// }
+//
+// // #104076# reset closed flag for next to be started polygon
+// mbIsClosed = false;
+//
+// // NO break, continue in next case
+// }
+// case 'L' :
+// case 'l' :
+// {
+// nPos++;
+// Imp_SkipSpaces(aStr, nPos, nLen);
+//
+// while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos))
+// {
+// Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen);
[... 683 lines stripped ...]