Modified: openoffice/trunk/main/basegfx/test/boxclipper.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/basegfx/test/boxclipper.cxx?rev=1536730&r1=1536729&r2=1536730&view=diff ============================================================================== --- openoffice/trunk/main/basegfx/test/boxclipper.cxx (original) +++ openoffice/trunk/main/basegfx/test/boxclipper.cxx Tue Oct 29 14:11:45 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/trunk/main/basegfx/test/clipstate.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/basegfx/test/clipstate.cxx?rev=1536730&r1=1536729&r2=1536730&view=diff ============================================================================== --- openoffice/trunk/main/basegfx/test/clipstate.cxx (original) +++ openoffice/trunk/main/basegfx/test/clipstate.cxx Tue Oct 29 14:11:45 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/trunk/main/basegfx/test/genericclipper.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/basegfx/test/genericclipper.cxx?rev=1536730&r1=1536729&r2=1536730&view=diff ============================================================================== --- openoffice/trunk/main/basegfx/test/genericclipper.cxx (original) +++ openoffice/trunk/main/basegfx/test/genericclipper.cxx Tue Oct 29 14:11:45 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/trunk/main/canvas/source/tools/surfaceproxy.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/canvas/source/tools/surfaceproxy.cxx?rev=1536730&r1=1536729&r2=1536730&view=diff ============================================================================== --- openoffice/trunk/main/canvas/source/tools/surfaceproxy.cxx (original) +++ openoffice/trunk/main/canvas/source/tools/surfaceproxy.cxx Tue Oct 29 14:11:45 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/trunk/main/sd/source/core/CustomAnimationEffect.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/core/CustomAnimationEffect.cxx?rev=1536730&r1=1536729&r2=1536730&view=diff ============================================================================== --- openoffice/trunk/main/sd/source/core/CustomAnimationEffect.cxx (original) +++ openoffice/trunk/main/sd/source/core/CustomAnimationEffect.cxx Tue Oct 29 14:11:45 2013 @@ -1706,7 +1706,7 @@ SdrPathObj* CustomAnimationEffect::creat void CustomAnimationEffect::updateSdrPathObjFromPath( SdrPathObj& rPathObj ) { ::basegfx::B2DPolyPolygon xPolyPoly; - if( ::basegfx::tools::importFromSvgD( xPolyPoly, getPath() ) ) + if( ::basegfx::tools::importFromSvgD( xPolyPoly, getPath(), true, 0 ) ) { SdrObject* pObj = GetSdrObjectFromXShape( getTargetShape() ); if( pObj ) @@ -1762,7 +1762,7 @@ void CustomAnimationEffect::updatePathFr } } - setPath( ::basegfx::tools::exportToSvgD( xPolyPoly ) ); + setPath( ::basegfx::tools::exportToSvgD( xPolyPoly, true, true, true) ); } // ==================================================================== Modified: openoffice/trunk/main/sdext/source/pdfimport/test/tests.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sdext/source/pdfimport/test/tests.cxx?rev=1536730&r1=1536729&r2=1536730&view=diff ============================================================================== --- openoffice/trunk/main/sdext/source/pdfimport/test/tests.cxx (original) +++ openoffice/trunk/main/sdext/source/pdfimport/test/tests.cxx Tue Oct 29 14:11:45 2013 @@ -246,7 +246,7 @@ namespace const char* sExportString = "m53570 7650-35430 24100"; CPPUNIT_ASSERT_MESSAGE( "Stroke is m535.7 518.5-354.3-241", - basegfx::tools::exportToSvgD( aPath ).compareToAscii(sExportString) == 0 ); + basegfx::tools::exportToSvgD( aPath, true, true, false ).compareToAscii(sExportString) == 0 ); m_bGreenStrokeSeen = true; } @@ -270,7 +270,7 @@ namespace const char* sExportString = "m49890 5670.00000000001-35430 24090"; CPPUNIT_ASSERT_MESSAGE( "Stroke is m49890 5670.00000000001-35430 24090", - basegfx::tools::exportToSvgD( aPath ).compareToAscii(sExportString) == 0 ); + basegfx::tools::exportToSvgD( aPath, true, true, false ).compareToAscii(sExportString) == 0 ); m_bDashedLineSeen = true; } @@ -328,7 +328,7 @@ namespace const char* sExportString = "m12050 49610c-4310 0-7800-3490-7800-7800 0-4300 " "3490-7790 7800-7790 4300 0 7790 3490 7790 7790 0 4310-3490 7800-7790 7800z"; CPPUNIT_ASSERT_MESSAGE( "Stroke is a 4-bezier circle", - basegfx::tools::exportToSvgD( aPath ).compareToAscii(sExportString) == 0 ); + basegfx::tools::exportToSvgD( aPath, true, true, false ).compareToAscii(sExportString) == 0 ); m_bRedCircleSeen = true; } Modified: openoffice/trunk/main/sdext/source/pdfimport/tree/drawtreevisiting.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sdext/source/pdfimport/tree/drawtreevisiting.cxx?rev=1536730&r1=1536729&r2=1536730&view=diff ============================================================================== --- openoffice/trunk/main/sdext/source/pdfimport/tree/drawtreevisiting.cxx (original) +++ openoffice/trunk/main/sdext/source/pdfimport/tree/drawtreevisiting.cxx Tue Oct 29 14:11:45 2013 @@ -358,7 +358,7 @@ void DrawXmlEmitter::visit( PolyPolyElem aBuf.append( sal_Unicode(' ') ); aBuf.append( convPx2mmPrec2(elem.h)*100.0 ); aProps[ USTR( "svg:viewBox" ) ] = aBuf.makeStringAndClear(); - aProps[ USTR( "svg:d" ) ] = basegfx::tools::exportToSvgD( elem.PolyPoly ); + aProps[ USTR( "svg:d" ) ] = basegfx::tools::exportToSvgD( elem.PolyPoly, true, true, false ); m_rEmitContext.rEmitter.beginTag( "draw:path", aProps ); m_rEmitContext.rEmitter.endTag( "draw:path" ); Modified: openoffice/trunk/main/sdext/source/pdfimport/tree/writertreevisiting.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sdext/source/pdfimport/tree/writertreevisiting.cxx?rev=1536730&r1=1536729&r2=1536730&view=diff ============================================================================== --- openoffice/trunk/main/sdext/source/pdfimport/tree/writertreevisiting.cxx (original) +++ openoffice/trunk/main/sdext/source/pdfimport/tree/writertreevisiting.cxx Tue Oct 29 14:11:45 2013 @@ -281,7 +281,7 @@ void WriterXmlEmitter::visit( PolyPolyEl aBuf.append( sal_Unicode(' ') ); aBuf.append( convPx2mmPrec2(elem.h)*100.0 ); aProps[ USTR( "svg:viewBox" ) ] = aBuf.makeStringAndClear(); - aProps[ USTR( "svg:d" ) ] = basegfx::tools::exportToSvgD( elem.PolyPoly ); + aProps[ USTR( "svg:d" ) ] = basegfx::tools::exportToSvgD( elem.PolyPoly, true, true, false ); m_rEmitContext.rEmitter.beginTag( "draw:path", aProps ); m_rEmitContext.rEmitter.endTag( "draw:path" ); Modified: openoffice/trunk/main/slideshow/source/engine/animationfactory.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/slideshow/source/engine/animationfactory.cxx?rev=1536730&r1=1536729&r2=1536730&view=diff ============================================================================== --- openoffice/trunk/main/slideshow/source/engine/animationfactory.cxx (original) +++ openoffice/trunk/main/slideshow/source/engine/animationfactory.cxx Tue Oct 29 14:11:45 2013 @@ -234,7 +234,7 @@ namespace slideshow ::basegfx::B2DPolyPolygon aPolyPoly; - ENSURE_OR_THROW( ::basegfx::tools::importFromSvgD( aPolyPoly, rSVGDPath ), + ENSURE_OR_THROW( ::basegfx::tools::importFromSvgD( aPolyPoly, rSVGDPath, false, 0 ), "PathAnimation::PathAnimation(): failed to parse SVG:d path" ); ENSURE_OR_THROW( aPolyPoly.count() == 1, "PathAnimation::PathAnimation(): motion path consists of multiple/zero polygon(s)" ); Modified: openoffice/trunk/main/svgio/inc/svgio/svgreader/svgpathnode.hxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/inc/svgio/svgreader/svgpathnode.hxx?rev=1536730&r1=1536729&r2=1536730&view=diff ============================================================================== --- openoffice/trunk/main/svgio/inc/svgio/svgreader/svgpathnode.hxx (original) +++ openoffice/trunk/main/svgio/inc/svgio/svgreader/svgpathnode.hxx Tue Oct 29 14:11:45 2013 @@ -25,6 +25,7 @@ #include <svgio/svgiodllapi.h> #include <svgio/svgreader/svgnode.hxx> #include <svgio/svgreader/svgstyleattributes.hxx> +#include <basegfx/polygon/b2dpolypolygontools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -36,12 +37,13 @@ namespace svgio { private: /// use styles - SvgStyleAttributes maSvgStyleAttributes; + SvgStyleAttributes maSvgStyleAttributes; /// variable scan values, dependent of given XAttributeList - basegfx::B2DPolyPolygon* mpPolyPolygon; - basegfx::B2DHomMatrix* mpaTransform; - SvgNumber maPathLength; + basegfx::B2DPolyPolygon* mpPolyPolygon; + basegfx::B2DHomMatrix* mpaTransform; + SvgNumber maPathLength; + basegfx::tools::PointIndexSet maHelpPointIndices; public: SvgPathNode( Modified: openoffice/trunk/main/svgio/inc/svgio/svgreader/svgstyleattributes.hxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/inc/svgio/svgreader/svgstyleattributes.hxx?rev=1536730&r1=1536729&r2=1536730&view=diff ============================================================================== --- openoffice/trunk/main/svgio/inc/svgio/svgreader/svgstyleattributes.hxx (original) +++ openoffice/trunk/main/svgio/inc/svgio/svgreader/svgstyleattributes.hxx Tue Oct 29 14:11:45 2013 @@ -26,6 +26,7 @@ #include <svgio/svgreader/svgpaint.hxx> #include <svgio/svgreader/svgnode.hxx> #include <vcl/vclenum.hxx> +#include <basegfx/polygon/b2dpolypolygontools.hxx> ////////////////////////////////////////////////////////////////////////////// // predefines @@ -253,7 +254,8 @@ namespace svgio const SvgMarkerNode& rMarker) const; void add_markers( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget) const; + drawinglayer::primitive2d::Primitive2DSequence& rTarget, + const basegfx::tools::PointIndexSet* pHelpPointIndices) const; public: /// local attribute scanner @@ -265,7 +267,8 @@ namespace svgio drawinglayer::primitive2d::Primitive2DSequence& rSource) const; void add_path( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget) const; + drawinglayer::primitive2d::Primitive2DSequence& rTarget, + const basegfx::tools::PointIndexSet* pHelpPointIndices) const; void add_postProcess( drawinglayer::primitive2d::Primitive2DSequence& rTarget, const drawinglayer::primitive2d::Primitive2DSequence& rSource, Modified: openoffice/trunk/main/svgio/source/svgreader/svgcirclenode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgcirclenode.cxx?rev=1536730&r1=1536729&r2=1536730&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgcirclenode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgcirclenode.cxx Tue Oct 29 14:11:45 2013 @@ -141,7 +141,7 @@ namespace svgio drawinglayer::primitive2d::Primitive2DSequence aNewTarget; - pStyle->add_path(basegfx::B2DPolyPolygon(aPath), aNewTarget); + pStyle->add_path(basegfx::B2DPolyPolygon(aPath), aNewTarget, 0); if(aNewTarget.hasElements()) { Modified: openoffice/trunk/main/svgio/source/svgreader/svgellipsenode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgellipsenode.cxx?rev=1536730&r1=1536729&r2=1536730&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgellipsenode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgellipsenode.cxx Tue Oct 29 14:11:45 2013 @@ -156,7 +156,7 @@ namespace svgio drawinglayer::primitive2d::Primitive2DSequence aNewTarget; - pStyle->add_path(basegfx::B2DPolyPolygon(aPath), aNewTarget); + pStyle->add_path(basegfx::B2DPolyPolygon(aPath), aNewTarget, 0); if(aNewTarget.hasElements()) { Modified: openoffice/trunk/main/svgio/source/svgreader/svglinenode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svglinenode.cxx?rev=1536730&r1=1536729&r2=1536730&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svglinenode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svglinenode.cxx Tue Oct 29 14:11:45 2013 @@ -152,7 +152,7 @@ namespace svgio drawinglayer::primitive2d::Primitive2DSequence aNewTarget; - pStyle->add_path(basegfx::B2DPolyPolygon(aPath), aNewTarget); + pStyle->add_path(basegfx::B2DPolyPolygon(aPath), aNewTarget, 0); if(aNewTarget.hasElements()) { Modified: openoffice/trunk/main/svgio/source/svgreader/svgpathnode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgpathnode.cxx?rev=1536730&r1=1536729&r2=1536730&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgpathnode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgpathnode.cxx Tue Oct 29 14:11:45 2013 @@ -75,7 +75,7 @@ namespace svgio { basegfx::B2DPolyPolygon aPath; - if(basegfx::tools::importFromSvgD(aPath, aContent)) + if(basegfx::tools::importFromSvgD(aPath, aContent, false, &maHelpPointIndices)) { if(aPath.count()) { @@ -120,7 +120,7 @@ namespace svgio { drawinglayer::primitive2d::Primitive2DSequence aNewTarget; - pStyle->add_path(*getPath(), aNewTarget); + pStyle->add_path(*getPath(), aNewTarget, &maHelpPointIndices); if(aNewTarget.hasElements()) { Modified: openoffice/trunk/main/svgio/source/svgreader/svgpolynode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgpolynode.cxx?rev=1536730&r1=1536729&r2=1536730&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgpolynode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgpolynode.cxx Tue Oct 29 14:11:45 2013 @@ -25,6 +25,7 @@ #include <svgio/svgreader/svgpolynode.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -77,7 +78,7 @@ namespace svgio case SVGTokenPoints: { basegfx::B2DPolygon aPath; - + if(basegfx::tools::importFromSvgPoints(aPath, aContent)) { if(aPath.count()) @@ -117,7 +118,7 @@ namespace svgio { drawinglayer::primitive2d::Primitive2DSequence aNewTarget; - pStyle->add_path(basegfx::B2DPolyPolygon(*getPolygon()), aNewTarget); + pStyle->add_path(basegfx::B2DPolyPolygon(*getPolygon()), aNewTarget, 0); if(aNewTarget.hasElements()) { Modified: openoffice/trunk/main/svgio/source/svgreader/svgrectnode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgrectnode.cxx?rev=1536730&r1=1536729&r2=1536730&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgrectnode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgrectnode.cxx Tue Oct 29 14:11:45 2013 @@ -213,7 +213,7 @@ namespace svgio drawinglayer::primitive2d::Primitive2DSequence aNewTarget; - pStyle->add_path(basegfx::B2DPolyPolygon(aPath), aNewTarget); + pStyle->add_path(basegfx::B2DPolyPolygon(aPath), aNewTarget, 0); if(aNewTarget.hasElements()) { Modified: openoffice/trunk/main/svgio/source/svgreader/svgstyleattributes.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgstyleattributes.cxx?rev=1536730&r1=1536729&r2=1536730&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgstyleattributes.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgstyleattributes.cxx Tue Oct 29 14:11:45 2013 @@ -838,7 +838,8 @@ namespace svgio void SvgStyleAttributes::add_markers( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget) const + drawinglayer::primitive2d::Primitive2DSequence& rTarget, + const basegfx::tools::PointIndexSet* pHelpPointIndices) const { // try to access linked markers const SvgMarkerNode* pStart = accessMarkerStartXLink(); @@ -897,6 +898,18 @@ namespace svgio pNeeded = pMid; } + if(pHelpPointIndices && !pHelpPointIndices->empty()) + { + const basegfx::tools::PointIndexSet::const_iterator aFound( + pHelpPointIndices->find(basegfx::tools::PointIndex(a, b))); + + if(aFound != pHelpPointIndices->end()) + { + // this point is a pure helper point; do not create a marker for it + continue; + } + } + if(!pNeeded) { // no marker needs to be created for this point @@ -1008,7 +1021,8 @@ namespace svgio void SvgStyleAttributes::add_path( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget) const + drawinglayer::primitive2d::Primitive2DSequence& rTarget, + const basegfx::tools::PointIndexSet* pHelpPointIndices) const { if(!rPath.count()) { @@ -1066,7 +1080,7 @@ namespace svgio SVGTokenLine == mrOwner.getType()) // line { // try to add markers - add_markers(rPath, rTarget); + add_markers(rPath, rTarget, pHelpPointIndices); } } Modified: openoffice/trunk/main/xmloff/inc/xexptran.hxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/inc/xexptran.hxx?rev=1536730&r1=1536729&r2=1536730&view=diff ============================================================================== --- openoffice/trunk/main/xmloff/inc/xexptran.hxx (original) +++ openoffice/trunk/main/xmloff/inc/xexptran.hxx Tue Oct 29 14:11:45 2013 @@ -115,83 +115,22 @@ public: class SdXMLImExViewBox { - rtl::OUString msString; - sal_Int32 mnX; - sal_Int32 mnY; - sal_Int32 mnW; - sal_Int32 mnH; + rtl::OUString msString; + double mfX; + double mfY; + double mfW; + double mfH; public: - SdXMLImExViewBox(sal_Int32 nX = 0L, sal_Int32 nY = 0L, sal_Int32 nW = 1000L, sal_Int32 nH = 1000L); - SdXMLImExViewBox(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv); + SdXMLImExViewBox(double fX = 0.0, double fY = 0.0, double fW = 1000.0, double fH = 1000.0); + SdXMLImExViewBox(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv); - sal_Int32 GetX() const { return mnX; } - sal_Int32 GetY() const { return mnY; } - sal_Int32 GetWidth() const { return mnW; } - sal_Int32 GetHeight() const { return mnH; } - const rtl::OUString& GetExportString(); + double GetX() const { return mfX; } + double GetY() const { return mfY; } + double GetWidth() const { return mfW; } + double GetHeight() const { return mfH; } + const rtl::OUString& GetExportString(); }; -////////////////////////////////////////////////////////////////////////////// - -class SdXMLImExPointsElement -{ - rtl::OUString msString; - com::sun::star::drawing::PointSequenceSequence maPoly; - -public: - SdXMLImExPointsElement(com::sun::star::drawing::PointSequence* pPoints, - const SdXMLImExViewBox& rViewBox, - const com::sun::star::awt::Point& rObjectPos, - const com::sun::star::awt::Size& rObjectSize, - // #96328# - const bool bClosed = true); - SdXMLImExPointsElement(const rtl::OUString& rNew, - const SdXMLImExViewBox& rViewBox, - const com::sun::star::awt::Point& rObjectPos, - const com::sun::star::awt::Size& rObjectSize, - const SvXMLUnitConverter& rConv); - - const rtl::OUString& GetExportString() const { return msString; } - const com::sun::star::drawing::PointSequenceSequence& GetPointSequenceSequence() const { return maPoly; } -}; - -////////////////////////////////////////////////////////////////////////////// - -class SdXMLImExSvgDElement -{ - rtl::OUString msString; - const SdXMLImExViewBox& mrViewBox; - bool mbIsClosed; - bool mbIsCurve; - - sal_Int32 mnLastX; - sal_Int32 mnLastY; - - com::sun::star::drawing::PointSequenceSequence maPoly; - com::sun::star::drawing::FlagSequenceSequence maFlag; - -public: - SdXMLImExSvgDElement(const SdXMLImExViewBox& rViewBox); - SdXMLImExSvgDElement(const rtl::OUString& rNew, - const SdXMLImExViewBox& rViewBox, - const com::sun::star::awt::Point& rObjectPos, - const com::sun::star::awt::Size& rObjectSize, - const SvXMLUnitConverter& rConv); - - void AddPolygon( - com::sun::star::drawing::PointSequence* pPoints, - com::sun::star::drawing::FlagSequence* pFlags, - const com::sun::star::awt::Point& rObjectPos, - const com::sun::star::awt::Size& rObjectSize, - bool bClosed = false, bool bRelative = true); - - const rtl::OUString& GetExportString() const { return msString; } - bool IsClosed() const { return mbIsClosed; } - bool IsCurve() const { return mbIsCurve; } - const com::sun::star::drawing::PointSequenceSequence& GetPointSequenceSequence() const { return maPoly; } - const com::sun::star::drawing::FlagSequenceSequence& GetFlagSequenceSequence() const { return maFlag; } -}; - - #endif // _XEXPTRANSFORM_HXX +// eof Modified: openoffice/trunk/main/xmloff/source/draw/XMLImageMapContext.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/source/draw/XMLImageMapContext.cxx?rev=1536730&r1=1536729&r2=1536730&view=diff ============================================================================== --- openoffice/trunk/main/xmloff/source/draw/XMLImageMapContext.cxx (original) +++ openoffice/trunk/main/xmloff/source/draw/XMLImageMapContext.cxx Tue Oct 29 14:11:45 2013 @@ -19,25 +19,18 @@ * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" #include "XMLImageMapContext.hxx" #include <rtl/ustrbuf.hxx> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/beans/XPropertySet.hpp> -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP #include <com/sun/star/beans/XPropertySetInfo.hpp> -#endif #include <com/sun/star/xml/sax/XAttributeList.hpp> #include <com/sun/star/container/XIndexContainer.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/drawing/PointSequenceSequence.hpp> - -#ifndef _COM_SUN_STAR_DOCUMENT_XEVENTSSUPPLIER_HPP #include <com/sun/star/document/XEventsSupplier.hpp> -#endif #include <com/sun/star/awt/Rectangle.hpp> #include <xmloff/xmltoken.hxx> #include <xmloff/xmlimp.hxx> @@ -50,7 +43,8 @@ #include <xmloff/XMLEventsImportContext.hxx> #include "XMLStringBufferImportContext.hxx" #include <tools/debug.hxx> - +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> using namespace ::com::sun::star; using namespace ::xmloff::token; @@ -506,33 +500,30 @@ void XMLImageMapPolygonContext::ProcessA bValid = bViewBoxOK && bPointsOK; } -void XMLImageMapPolygonContext::Prepare( - Reference<XPropertySet> & rPropertySet) +void XMLImageMapPolygonContext::Prepare(Reference<XPropertySet> & rPropertySet) { - // process view box - SdXMLImExViewBox aViewBox(sViewBoxString, - GetImport().GetMM100UnitConverter()); - - // get polygon sequence - awt::Point aPoint(aViewBox.GetX(), aViewBox.GetY()); - awt::Size aSize(aViewBox.GetWidth(), aViewBox.GetHeight()); - SdXMLImExPointsElement aPoints( sPointsString, aViewBox, aPoint, aSize, - GetImport().GetMM100UnitConverter() ); - PointSequenceSequence aPointSeqSeq = aPoints.GetPointSequenceSequence(); - - // only use first element of sequence-sequence - if (aPointSeqSeq.getLength() > 0) - { - Any aAny; - aAny <<= aPointSeqSeq[0]; - rPropertySet->setPropertyValue(sPolygon, aAny); - } + // process view box + SdXMLImExViewBox aViewBox(sViewBoxString, GetImport().GetMM100UnitConverter()); - // parent properties - XMLImageMapObjectContext::Prepare(rPropertySet); -} + // get polygon sequence + basegfx::B2DPolygon aPolygon; + if(basegfx::tools::importFromSvgPoints(aPolygon, sPointsString)) + { + if(aPolygon.count()) + { + com::sun::star::drawing::PointSequence aPointSequence; + uno::Any aAny; + + basegfx::tools::B2DPolygonToUnoPointSequence(aPolygon, aPointSequence); + aAny <<= aPointSequence; + rPropertySet->setPropertyValue(sPolygon, aAny); + } + } + // parent properties + XMLImageMapObjectContext::Prepare(rPropertySet); +} class XMLImageMapCircleContext : public XMLImageMapObjectContext { Modified: openoffice/trunk/main/xmloff/source/draw/XMLImageMapExport.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/source/draw/XMLImageMapExport.cxx?rev=1536730&r1=1536729&r2=1536730&view=diff ============================================================================== --- openoffice/trunk/main/xmloff/source/draw/XMLImageMapExport.cxx (original) +++ openoffice/trunk/main/xmloff/source/draw/XMLImageMapExport.cxx Tue Oct 29 14:11:45 2013 @@ -19,8 +19,6 @@ * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" #include "XMLImageMapExport.hxx" @@ -32,10 +30,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/container/XIndexContainer.hpp> - -#ifndef _COM_SUN_STAR_DOCUMENT_XEVENTSSUPPLIER_HPP #include <com/sun/star/document/XEventsSupplier.hpp> -#endif #include <com/sun/star/awt/Rectangle.hpp> #include <com/sun/star/awt/Point.hpp> #include <com/sun/star/awt/Size.hpp> @@ -46,8 +41,8 @@ #include <xmloff/XMLEventExport.hxx> #include <xmloff/xmluconv.hxx> #include "xexptran.hxx" - - +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> using namespace ::com::sun::star; using namespace ::xmloff::token; @@ -322,61 +317,43 @@ void XMLImageMapExport::ExportCircle( aBuffer.makeStringAndClear() ); } -void XMLImageMapExport::ExportPolygon( - const Reference<XPropertySet> & rPropertySet) +void XMLImageMapExport::ExportPolygon(const Reference<XPropertySet> & rPropertySet) { - // polygons get exported as bounding box, viewbox, and coordinate - // pair sequence. The bounding box is always the entire image. - - // get polygon point sequence - Any aAny = rPropertySet->getPropertyValue(msPolygon); - PointSequence aPoly; - aAny >>= aPoly; - - // get bounding box (assume top-left to be 0,0) - sal_Int32 nWidth = 0; - sal_Int32 nHeight = 0; - sal_Int32 nLength = aPoly.getLength(); - const struct awt::Point* pPointPtr = aPoly.getConstArray(); - for ( sal_Int32 i = 0; i < nLength; i++ ) - { - sal_Int32 nPolyX = pPointPtr->X; - sal_Int32 nPolyY = pPointPtr->Y; - - if ( nPolyX > nWidth ) - nWidth = nPolyX; - if ( nPolyY > nHeight ) - nHeight = nPolyY; - - pPointPtr++; - } - DBG_ASSERT(nWidth > 0, "impossible Polygon found"); - DBG_ASSERT(nHeight > 0, "impossible Polygon found"); + // polygons get exported as bounding box, viewbox, and coordinate + // pair sequence. The bounding box is always the entire image. - // parameters svg:x, svg:y, svg:width, svg:height - OUStringBuffer aBuffer; - mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, 0); - mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_X, - aBuffer.makeStringAndClear() ); - mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, 0); - mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_Y, - aBuffer.makeStringAndClear() ); - mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, nWidth); - mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH, - aBuffer.makeStringAndClear() ); - mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, nHeight); - mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT, - aBuffer.makeStringAndClear() ); + // get polygon point sequence + Any aAny = rPropertySet->getPropertyValue(msPolygon); + PointSequence aPoly; + aAny >>= aPoly; + + const basegfx::B2DPolygon aPolygon( + basegfx::tools::UnoPointSequenceToB2DPolygon( + aPoly)); + const basegfx::B2DRange aPolygonRange(aPolygon.getB2DRange()); + + // parameters svg:x, svg:y, svg:width, svg:height + OUStringBuffer aBuffer; + + mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, 0); + mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_X, aBuffer.makeStringAndClear() ); + mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, 0); + mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_Y, aBuffer.makeStringAndClear() ); + mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, basegfx::fround(aPolygonRange.getWidth())); + mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH, aBuffer.makeStringAndClear() ); + mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, basegfx::fround(aPolygonRange.getHeight())); + mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT, aBuffer.makeStringAndClear() ); + + // svg:viewbox + SdXMLImExViewBox aViewBox(0.0, 0.0, aPolygonRange.getWidth(), aPolygonRange.getHeight()); + mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString()); + + // export point sequence + const ::rtl::OUString aPointString( + basegfx::tools::exportToSvgPoints( + aPolygon)); - // svg:viewbox - SdXMLImExViewBox aViewBox(0, 0, nWidth, nHeight); - mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, - aViewBox.GetExportString()); - - // export point sequence - awt::Point aPoint(0, 0); - awt::Size aSize(nWidth, nHeight); - SdXMLImExPointsElement aPoints( &aPoly, aViewBox, aPoint, aSize ); - mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_POINTS, - aPoints.GetExportString()); + mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPointString); } + +// eof Modified: openoffice/trunk/main/xmloff/source/draw/shapeexport2.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/source/draw/shapeexport2.cxx?rev=1536730&r1=1536729&r2=1536730&view=diff ============================================================================== --- openoffice/trunk/main/xmloff/source/draw/shapeexport2.cxx (original) +++ openoffice/trunk/main/xmloff/source/draw/shapeexport2.cxx Tue Oct 29 14:11:45 2013 @@ -19,8 +19,6 @@ * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" #include "unointerfacetouniqueidentifiermapper.hxx" @@ -35,10 +33,7 @@ #include <com/sun/star/drawing/HomogenMatrix3.hpp> #include <com/sun/star/media/ZoomLevel.hpp> #include "anim.hxx" - -#ifndef _XMLOFF_SHAPEEXPORT_HXX #include <xmloff/shapeexport.hxx> -#endif #include "sdpropls.hxx" #include <tools/debug.hxx> #include <tools/urlobj.hxx> @@ -50,10 +45,14 @@ #include <tools/gen.hxx> // FRound #include <xmloff/xmltoken.hxx> #include <xmloff/nmspmap.hxx> - #include "xmloff/xmlnmspe.hxx" #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/tuple/b2dtuple.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <basegfx/point/b2dpoint.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/polygon/b2dpolypolygontools.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> using ::rtl::OUString; using ::rtl::OUStringBuffer; @@ -1014,116 +1013,87 @@ void XMLShapeExport::ImpExportPolygonSha sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# - if(bBezier) - { - // get PolygonBezier - uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) ); - drawing::PolyPolygonBezierCoords* pSourcePolyPolygon = - (drawing::PolyPolygonBezierCoords*)aAny.getValue(); - - if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength()) - { - sal_Int32 nOuterCnt(pSourcePolyPolygon->Coordinates.getLength()); - drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->Coordinates.getArray(); - drawing::FlagSequence* pOuterFlags = pSourcePolyPolygon->Flags.getArray(); - - if(pOuterSequence && pOuterFlags) - { - // prepare svx:d element export - SdXMLImExSvgDElement aSvgDElement(aViewBox); - - for(sal_Int32 a(0L); a < nOuterCnt; a++) - { - drawing::PointSequence* pSequence = pOuterSequence++; - drawing::FlagSequence* pFlags = pOuterFlags++; - - if(pSequence && pFlags) - { - aSvgDElement.AddPolygon(pSequence, pFlags, - aPoint, aSize, bClosed); - } - } - - // write point array - mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString()); - } - - // write object now - SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PATH, bCreateNewline, sal_True); - - ImpExportDescription( xShape ); // #i68101# - ImpExportEvents( xShape ); - ImpExportGluePoints( xShape ); - ImpExportText( xShape ); - } - } - else - { - // get non-bezier polygon - uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) ); - drawing::PointSequenceSequence* pSourcePolyPolygon = (drawing::PointSequenceSequence*)aAny.getValue(); - - if(pSourcePolyPolygon && pSourcePolyPolygon->getLength()) - { - sal_Int32 nOuterCnt(pSourcePolyPolygon->getLength()); - - if(1L == nOuterCnt && !bBezier) - { - // simple polygon shape, can be written as svg:points sequence - drawing::PointSequence* pSequence = pSourcePolyPolygon->getArray(); - if(pSequence) - { - SdXMLImExPointsElement aPoints(pSequence, aViewBox, aPoint, aSize, - // #96328# - bClosed); - - // write point array - mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPoints.GetExportString()); - } - - // write object now - SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, - bClosed ? XML_POLYGON : XML_POLYLINE , bCreateNewline, sal_True); - - ImpExportDescription( xShape ); // #i68101# - ImpExportEvents( xShape ); - ImpExportGluePoints( xShape ); - ImpExportText( xShape ); - } - else - { - // polypolygon or bezier, needs to be written as a svg:path sequence - drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->getArray(); - if(pOuterSequence) - { - // prepare svx:d element export - SdXMLImExSvgDElement aSvgDElement(aViewBox); - - for(sal_Int32 a(0L); a < nOuterCnt; a++) - { - drawing::PointSequence* pSequence = pOuterSequence++; - if(pSequence) - { - aSvgDElement.AddPolygon(pSequence, 0L, aPoint, - aSize, bClosed); - } - } + if(bBezier) + { + // get PolygonBezier + uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) ); + const basegfx::B2DPolyPolygon aPolyPolygon( + basegfx::tools::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(*(drawing::PolyPolygonBezierCoords*)aAny.getValue())); - // write point array - mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString()); - } + if(aPolyPolygon.count()) + { + // complex polygon shape, write as svg:d + const ::rtl::OUString aPolygonString( + basegfx::tools::exportToSvgD( + aPolyPolygon, + true, // bUseRelativeCoordinates + false, // bDetectQuadraticBeziers: not used in old, but maybe activated now + true)); // bHandleRelativeNextPointCompatible + + // write point array + mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString); + + // write object now + SvXMLElementExport aOBJ( + mrExport, + XML_NAMESPACE_DRAW, + XML_PATH, + bCreateNewline, + sal_True); + } + } + else + { + // get non-bezier polygon + uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) ); + const basegfx::B2DPolyPolygon aPolyPolygon( + basegfx::tools::UnoPointSequenceSequenceToB2DPolyPolygon(*(drawing::PointSequenceSequence*)aAny.getValue())); - // write object now - SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PATH, bCreateNewline, sal_True); + if(!aPolyPolygon.areControlPointsUsed() && 1 == aPolyPolygon.count()) + { + // simple polygon shape, can be written as svg:points sequence + const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(0)); + const ::rtl::OUString aPointString(basegfx::tools::exportToSvgPoints(aPolygon)); + + // write point array + mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPointString); + + // write object now + SvXMLElementExport aOBJ( + mrExport, + XML_NAMESPACE_DRAW, + aPolygon.isClosed() ? XML_POLYGON : XML_POLYLINE, + bCreateNewline, + sal_True); + } + else + { + // complex polygon shape, write as svg:d + const ::rtl::OUString aPolygonString( + basegfx::tools::exportToSvgD( + aPolyPolygon, + true, // bUseRelativeCoordinates + false, // bDetectQuadraticBeziers: not used in old, but maybe activated now + true)); // bHandleRelativeNextPointCompatible + + // write point array + mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString); + + // write object now + SvXMLElementExport aOBJ( + mrExport, + XML_NAMESPACE_DRAW, + XML_PATH, + bCreateNewline, + sal_True); + } + } - ImpExportDescription( xShape ); // #i68101# - ImpExportEvents( xShape ); - ImpExportGluePoints( xShape ); - ImpExportText( xShape ); - } - } - } - } + ImpExportDescription( xShape ); // #i68101# + ImpExportEvents( xShape ); + ImpExportGluePoints( xShape ); + ImpExportText( xShape ); + } } ////////////////////////////////////////////////////////////////////////////// @@ -1463,43 +1433,24 @@ void XMLShapeExport::ImpExportConnectorS } } - if( xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier") ) ) >>= aAny ) - { - // get PolygonBezier - drawing::PolyPolygonBezierCoords* pSourcePolyPolygon = - (drawing::PolyPolygonBezierCoords*)aAny.getValue(); - - if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength()) - { - sal_Int32 nOuterCnt(pSourcePolyPolygon->Coordinates.getLength()); - drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->Coordinates.getArray(); - drawing::FlagSequence* pOuterFlags = pSourcePolyPolygon->Flags.getArray(); - - if(pOuterSequence && pOuterFlags) - { - // prepare svx:d element export - awt::Point aPoint( 0, 0 ); - awt::Size aSize( 1, 1 ); - SdXMLImExViewBox aViewBox( 0, 0, 1, 1 ); - SdXMLImExSvgDElement aSvgDElement(aViewBox); - - for(sal_Int32 a(0L); a < nOuterCnt; a++) - { - drawing::PointSequence* pSequence = pOuterSequence++; - drawing::FlagSequence* pFlags = pOuterFlags++; - - if(pSequence && pFlags) - { - aSvgDElement.AddPolygon(pSequence, pFlags, - aPoint, aSize, sal_False ); - } - } + if( xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier") ) ) >>= aAny ) + { + // get PolygonBezier + drawing::PolyPolygonBezierCoords* pSourcePolyPolygon = (drawing::PolyPolygonBezierCoords*)aAny.getValue(); - // write point array - mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString()); - } - } - } + if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength()) + { + const basegfx::B2DPolyPolygon aPolyPolygon( + basegfx::tools::UnoPolyPolygonBezierCoordsToB2DPolyPolygon( + *pSourcePolyPolygon)); + const ::rtl::OUString aPolygonString( + basegfx::tools::exportToSvgD( + aPolyPolygon, + true, // bUseRelativeCoordinates + false, // bDetectQuadraticBeziers: not used in old, but maybe activated now + true)); // bHandleRelativeNextPointCompatible + } + } // write connector shape. Add Export later. sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# Modified: openoffice/trunk/main/xmloff/source/draw/shapeexport3.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/source/draw/shapeexport3.cxx?rev=1536730&r1=1536729&r2=1536730&view=diff ============================================================================== --- openoffice/trunk/main/xmloff/source/draw/shapeexport3.cxx (original) +++ openoffice/trunk/main/xmloff/source/draw/shapeexport3.cxx Tue Oct 29 14:11:45 2013 @@ -19,10 +19,9 @@ * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" + #include <com/sun/star/drawing/HomogenMatrix.hpp> #include <com/sun/star/drawing/PolyPolygonShape3D.hpp> #include <com/sun/star/drawing/ProjectionMode.hpp> @@ -32,10 +31,7 @@ #include <com/sun/star/drawing/CameraGeometry.hpp> #include <com/sun/star/drawing/DoubleSequence.hpp> #include <tools/gen.hxx> - -#ifndef _XMLOFF_SHAPEEXPORT_HXX #include <xmloff/shapeexport.hxx> -#endif #include "sdpropls.hxx" #include <tools/debug.hxx> #include <rtl/ustrbuf.hxx> @@ -44,8 +40,12 @@ #include "xexptran.hxx" #include <xmloff/xmltoken.hxx> #include <basegfx/vector/b3dvector.hxx> - -#include "xmloff/xmlnmspe.hxx" +#include <xmloff/xmlnmspe.hxx> +#include <basegfx/polygon/b3dpolypolygon.hxx> +#include <basegfx/polygon/b3dpolypolygontools.hxx> +#include <basegfx/matrix/b3dhommatrix.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/polygon/b2dpolypolygontools.hxx> using ::rtl::OUString; using ::rtl::OUStringBuffer; @@ -198,104 +198,45 @@ void XMLShapeExport::ImpExport3DShape( case XmlShapeTypeDraw3DLatheObject: case XmlShapeTypeDraw3DExtrudeObject: { - // write special 3DLathe/3DExtrude attributes - aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPolyPolygon3D"))); - drawing::PolyPolygonShape3D xPolyPolygon3D; - aAny >>= xPolyPolygon3D; - - // look for maximal values - double fXMin = 0; - double fXMax = 0; - double fYMin = 0; - double fYMax = 0; - sal_Bool bInit(sal_False); - sal_Int32 nOuterSequenceCount(xPolyPolygon3D.SequenceX.getLength()); - drawing::DoubleSequence* pInnerSequenceX = xPolyPolygon3D.SequenceX.getArray(); - drawing::DoubleSequence* pInnerSequenceY = xPolyPolygon3D.SequenceY.getArray(); - - sal_Int32 a; - for (a = 0; a < nOuterSequenceCount; a++) - { - sal_Int32 nInnerSequenceCount(pInnerSequenceX->getLength()); - double* pArrayX = pInnerSequenceX->getArray(); - double* pArrayY = pInnerSequenceY->getArray(); - - for(sal_Int32 b(0L); b < nInnerSequenceCount; b++) - { - double fX = *pArrayX++; - double fY = *pArrayY++; - - if(bInit) - { - if(fX > fXMax) - fXMax = fX; - - if(fX < fXMin) - fXMin = fX; - - if(fY > fYMax) - fYMax = fY; - - if(fY < fYMin) - fYMin = fY; - } - else - { - fXMin = fXMax = fX; - fYMin = fYMax = fY; - bInit = sal_True; - } - } - - pInnerSequenceX++; - pInnerSequenceY++; - } - - // export ViewBox - awt::Point aMinPoint(FRound(fXMin), FRound(fYMin)); - awt::Size aMaxSize(FRound(fXMax) - aMinPoint.X, FRound(fYMax) - aMinPoint.Y); - SdXMLImExViewBox aViewBox( - aMinPoint.X, aMinPoint.Y, aMaxSize.Width, aMaxSize.Height); - mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, - aViewBox.GetExportString()); - - // prepare svx:d element export - SdXMLImExSvgDElement aSvgDElement(aViewBox); - pInnerSequenceX = xPolyPolygon3D.SequenceX.getArray(); - pInnerSequenceY = xPolyPolygon3D.SequenceY.getArray(); - - for (a = 0; a < nOuterSequenceCount; a++) - { - sal_Int32 nInnerSequenceCount(pInnerSequenceX->getLength()); - double* pArrayX = pInnerSequenceX->getArray(); - double* pArrayY = pInnerSequenceY->getArray(); - drawing::PointSequence aPoly(nInnerSequenceCount); - awt::Point* pInnerSequence = aPoly.getArray(); - - for(sal_Int32 b(0L); b < nInnerSequenceCount; b++) - { - double fX = *pArrayX++; - double fY = *pArrayY++; - - *pInnerSequence = awt::Point(FRound(fX), FRound(fY)); - pInnerSequence++; - } - - // calculate closed flag - awt::Point* pFirst = aPoly.getArray(); - awt::Point* pLast = pFirst + (nInnerSequenceCount - 1); - sal_Bool bClosed = (pFirst->X == pLast->X && pFirst->Y == pLast->Y); - - aSvgDElement.AddPolygon(&aPoly, 0L, aMinPoint, - aMaxSize, bClosed); - - // #80594# corrected error in PolyPolygon3D export for 3D XML - pInnerSequenceX++; - pInnerSequenceY++; - } + // write special 3DLathe/3DExtrude attributes, get 3D PolyPolygon as drawing::PolyPolygonShape3D + aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPolyPolygon3D"))); + drawing::PolyPolygonShape3D xPolyPolygon3D; + aAny >>= xPolyPolygon3D; + + // convert to 3D PolyPolygon + const basegfx::B3DPolyPolygon aPolyPolygon3D( + basegfx::tools::UnoPolyPolygonShape3DToB3DPolyPolygon( + xPolyPolygon3D)); + + // convert to 2D PolyPolygon using identity 3D transformation (just grep X and Y) + const basegfx::B3DHomMatrix aB3DHomMatrixFor2DConversion; + const basegfx::B2DPolyPolygon aPolyPolygon( + basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon( + aPolyPolygon3D, + aB3DHomMatrixFor2DConversion)); + + // get 2D range of it + const basegfx::B2DRange aPolyPolygonRange(aPolyPolygon.getB2DRange()); + + // export ViewBox + SdXMLImExViewBox aViewBox( + aPolyPolygonRange.getMinX(), + aPolyPolygonRange.getMinY(), + aPolyPolygonRange.getWidth(), + aPolyPolygonRange.getHeight()); + + mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString()); + + // prepare svg:d string + const ::rtl::OUString aPolygonString( + basegfx::tools::exportToSvgD( + aPolyPolygon, + true, // bUseRelativeCoordinates + false, // bDetectQuadraticBeziers TTTT: not used in old, but maybe activated now + true)); // bHandleRelativeNextPointCompatible - // write point array - mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString()); + // write point array + mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString); if(eShapeType == XmlShapeTypeDraw3DLatheObject) {
