Hello everybody. Here is a patch from the "I have no idea what I'm doing" department.
So I am not pushing it directly, as I want to avoid breaking something in LO. :D Kudos to David Tardon for helping me with the boost stuff. Essentially, there is a truckload of code duplication in the WMF loading, and this is an humble contribution to make things saner. P.S. I am not sure how to really test this... I just ran make -sr :) -- Marc-André Laverdière Software Security Scientist Innovation Labs, Tata Consultancy Services Hyderabad, India
>From 6dc35a5fefa9a1f812cbdbe502127ba84bc3a40a Mon Sep 17 00:00:00 2001 From: Marc-Andre Laverdiere <marc-an...@atc.tcs.com> Date: Mon, 19 Sep 2011 17:27:50 +0530 Subject: [PATCH 1/3] Minor refactoring on WMF loading --- svtools/source/filter/wmf/enhwmf.cxx | 136 +++++++++++++--------------------- svtools/source/filter/wmf/winmtf.hxx | 3 + 2 files changed, 55 insertions(+), 84 deletions(-) diff --git a/svtools/source/filter/wmf/enhwmf.cxx b/svtools/source/filter/wmf/enhwmf.cxx index 10fa8f3..618f13d 100644 --- a/svtools/source/filter/wmf/enhwmf.cxx +++ b/svtools/source/filter/wmf/enhwmf.cxx @@ -351,14 +351,14 @@ void EnhWMFReader::ReadGDIComment() * pWMF: the stream containings the polygons * */ template <class T> -Polygon WMFReadPolygon(sal_uInt16 nStartIndex, sal_uInt16 nPoints, SvStream& rWMF) +Polygon EnhWMFReader::ReadPolygon(sal_uInt16 nStartIndex, sal_uInt16 nPoints) { Polygon aPolygon(nPoints); - for (sal_uInt16 i = nStartIndex ; i < nPoints && rWMF.good(); i++ ) + for (sal_uInt16 i = nStartIndex ; i < nPoints && pWMF->good(); i++ ) { T nX, nY; - rWMF >> nX >> nY; - if (!rWMF.good()) + *pWMF >> nX >> nY; + if (pWMF->good()) break; aPolygon[ i ] = Point( nX, nY ); } @@ -366,6 +366,44 @@ Polygon WMFReadPolygon(sal_uInt16 nStartIndex, sal_uInt16 nPoints, SvStream& rWM return aPolygon; } +template <class T> +void EnhWMFReader::ReadAndDrawPolyPolygon() +{ + sal_uInt32 i, nPoly, nGesPoints, nPoints; + pWMF->SeekRel( 0x10 ); + // Number of polygons + *pWMF >> nPoly >> nGesPoints; + if ( pWMF->good() && + ( nGesPoints < SAL_MAX_UINT32 / sizeof(Point) ) && //check against numeric overflowing + ( nPoly < SAL_MAX_UINT32 / sizeof(sal_uInt16) ) && + ( ( nPoly * sizeof( sal_uInt16 ) ) <= ( nEndPos - pWMF->Tell() ) )) + { + //Get number of points in each polygon + sal_uInt16 * pnPoints = new sal_uInt16[ nPoly ]; + for ( i = 0; i < nPoly && pWMF->good(); i++ ) + { + *pWMF >> nPoints; + pnPoints[ i ] = (sal_uInt16)nPoints; + } //end for + if ( pWMF->good() && ( nGesPoints * (sizeof(T)+sizeof(T)) ) <= ( nEndPos - pWMF->Tell() ) ) + { + // Get polygon points + Point * pPtAry = new Point[ nGesPoints ]; + for ( i = 0; i < nGesPoints && pWMF->good(); i++ ) + { + T nX, nY; + *pWMF >> nX >> nY; + pPtAry[ i ] = Point( nX, nY ); + } //end for + // Create PolyPolygon Actions + PolyPolygon aPolyPoly( (sal_uInt16)nPoly, pnPoints, pPtAry ); + pOut->DrawPolyPolygon( aPolyPoly, bRecordPath ); + delete[] pPtAry; + } //end if + delete[] pnPoints; + } //end if +} + sal_Bool EnhWMFReader::ReadEnhWMF() { sal_uInt32 nStretchBltMode = 0; @@ -452,7 +490,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF() i++; nPoints++; } - Polygon aPoly = WMFReadPolygon<sal_Int32>(i, nPoints, *pWMF); + Polygon aPoly = ReadPolygon<sal_Int32>(i, nPoints); pOut->DrawPolyBezier( aPoly, bFlag, bRecordPath ); } break; @@ -461,7 +499,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF() { pWMF->SeekRel( 16 ); *pWMF >> nPoints; - Polygon aPoly = WMFReadPolygon<sal_Int32>(0, nPoints, *pWMF); + Polygon aPoly = ReadPolygon<sal_Int32>(0, nPoints); pOut->DrawPolygon( aPoly, bRecordPath ); } break; @@ -478,7 +516,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF() i++; nPoints++; } - Polygon aPolygon = WMFReadPolygon<sal_Int32>(i, nPoints, *pWMF); + Polygon aPolygon = ReadPolygon<sal_Int32>(i, nPoints); pOut->DrawPolyLine( aPolygon, bFlag, bRecordPath ); } break; @@ -523,42 +561,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF() case EMR_POLYPOLYGON : { - sal_uInt32 i, nPoly, nGesPoints; - pWMF->SeekRel( 0x10 ); - - // Number of polygons: - *pWMF >> nPoly >> nGesPoints; - - if ( ( nGesPoints < SAL_MAX_UINT32 / sizeof(Point) ) && ( nPoly < SAL_MAX_UINT32 / sizeof(sal_uInt16) ) ) - { - if ( ( nPoly * sizeof(sal_uInt16) ) <= ( nEndPos - pWMF->Tell() ) ) - { - sal_uInt16* pnPoints = new sal_uInt16[ nPoly ]; - - for ( i = 0; i < nPoly; i++ ) - { - *pWMF >> nPoints; - pnPoints[ i ] = (sal_uInt16)nPoints; - } - - if ( ( nGesPoints * (sizeof(sal_uInt32)+sizeof(sal_uInt32)) ) <= ( nEndPos - pWMF->Tell() ) ) - { - // Get polygon points - Point* pPtAry = new Point[ nGesPoints ]; - - for ( i = 0; i < nGesPoints; i++ ) - { - *pWMF >> nX32 >> nY32; - pPtAry[ i ] = Point( nX32, nY32 ); - } - // Produce PolyPolygon Actions - PolyPolygon aPolyPoly( (sal_uInt16)nPoly, pnPoints, pPtAry ); - pOut->DrawPolyPolygon( aPolyPoly, bRecordPath ); - delete[] pPtAry; - } - delete[] pnPoints; - } - } + ReadAndDrawPolyPolygon<sal_uInt32>(); } break; @@ -1235,7 +1238,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF() i++; nPoints++; } - Polygon aPoly = WMFReadPolygon<sal_Int16>(i, nPoints, *pWMF); + Polygon aPoly = ReadPolygon<sal_Int16>(i, nPoints); pOut->DrawPolyBezier( aPoly, bFlag, bRecordPath ); // Line( aPoly, bFlag ); } break; @@ -1244,7 +1247,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF() { pWMF->SeekRel( 16 ); *pWMF >> nPoints; - Polygon aPoly = WMFReadPolygon<sal_Int16>(0, nPoints, *pWMF); + Polygon aPoly = ReadPolygon<sal_Int16>(0, nPoints); pOut->DrawPolygon( aPoly, bRecordPath ); } break; @@ -1261,7 +1264,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF() i++; nPoints++; } - Polygon aPoly = WMFReadPolygon<sal_Int16>(i, nPoints, *pWMF); + Polygon aPoly = ReadPolygon<sal_Int16>(i, nPoints); pOut->DrawPolyLine( aPoly, bFlag, bRecordPath ); } break; @@ -1287,7 +1290,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF() // Get polygon points: for ( i = 0; ( i < nPoly ) && pWMF->good(); i++ ) { - Polygon aPolygon = WMFReadPolygon<sal_Int16>(0, pnPoints[i], *pWMF); + Polygon aPolygon = ReadPolygon<sal_Int16>(0, pnPoints[i]); pOut->DrawPolyLine( aPolygon, sal_False, bRecordPath ); } delete[] pnPoints; @@ -1298,42 +1301,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF() case EMR_POLYPOLYGON16 : { - sal_uInt16* pnPoints; - Point* pPtAry; - - sal_uInt32 i, nPoly, nGesPoints; - pWMF->SeekRel( 0x10 ); - // Number of polygons - *pWMF >> nPoly >> nGesPoints; - if ( ( nGesPoints < SAL_MAX_UINT32 / sizeof(Point) ) && ( nPoly < SAL_MAX_UINT32 / sizeof(sal_uInt16) ) ) - { - if ( ( static_cast< sal_uInt32 >( nPoly ) * sizeof( sal_uInt16 ) ) <= ( nEndPos - pWMF->Tell() ) ) - { - pnPoints = new sal_uInt16[ nPoly ]; - for ( i = 0; i < nPoly; i++ ) - { - *pWMF >> nPoints; - pnPoints[ i ] = (sal_uInt16)nPoints; - } - if ( ( nGesPoints * (sizeof(sal_uInt16)+sizeof(sal_uInt16)) ) <= ( nEndPos - pWMF->Tell() ) ) - { - // Get polygon points - pPtAry = new Point[ nGesPoints ]; - for ( i = 0; i < nGesPoints; i++ ) - { - sal_Int16 nX16(0), nY16(0); - *pWMF >> nX16 >> nY16; - pPtAry[ i ] = Point( nX16, nY16 ); - } - - // Create PolyPolygon Actions - PolyPolygon aPolyPoly( (sal_uInt16)nPoly, pnPoints, pPtAry ); - pOut->DrawPolyPolygon( aPolyPoly, bRecordPath ); - delete[] pPtAry; - } - delete[] pnPoints; - } - } + ReadAndDrawPolyPolygon<sal_uInt16>(); } break; @@ -1537,7 +1505,7 @@ sal_Bool EnhWMFReader::ReadHeader() //----------------------------------------------------------------------------------- -Rectangle EnhWMFReader::ReadRectangle( sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) +Rectangle EnhWMFReader::ReadRectangle( sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) { Point aTL ( Point( x1, y1 ) ); Point aBR( Point( --x2, --y2 ) ); diff --git a/svtools/source/filter/wmf/winmtf.hxx b/svtools/source/filter/wmf/winmtf.hxx index cd9e82b..c6561f6 100644 --- a/svtools/source/filter/wmf/winmtf.hxx +++ b/svtools/source/filter/wmf/winmtf.hxx @@ -836,6 +836,9 @@ public: sal_Bool ReadEnhWMF(); void ReadEMFPlusComment(sal_uInt32 length, sal_Bool& bHaveDC); void ReadGDIComment(); +private: + template <class T> void ReadAndDrawPolyPolygon(); + template <class T> Polygon ReadPolygon(sal_uInt16 nStartIndex, sal_uInt16 nPoints); }; //============================ WMFReader ================================== -- 1.7.6
>From 9f47f3f10a3f6df93bec80e58b021864b773df3d Mon Sep 17 00:00:00 2001 From: Marc-Andre Laverdiere <marc-an...@atc.tcs.com> Date: Tue, 20 Sep 2011 12:54:43 +0530 Subject: [PATCH 3/3] Futher refactoring in enhwmf.cxx --- svtools/source/filter/wmf/enhwmf.cxx | 100 +++++++++++----------------------- svtools/source/filter/wmf/winmtf.hxx | 2 +- 2 files changed, 34 insertions(+), 68 deletions(-) diff --git a/svtools/source/filter/wmf/enhwmf.cxx b/svtools/source/filter/wmf/enhwmf.cxx index 9d80efb..b95fd8f 100644 --- a/svtools/source/filter/wmf/enhwmf.cxx +++ b/svtools/source/filter/wmf/enhwmf.cxx @@ -397,6 +397,36 @@ Polygon EnhWMFReader::ReadPolygon(sal_uInt16 nStartIndex, sal_uInt16 nPoints) return aPolygon; } +template <class T> +void EnhWMFReader::ReadAndDrawPolyLine() +{ + sal_uInt32 nPoints; + sal_Int32 i, nPoly(0), nGesPoints(0); + pWMF->SeekRel( 0x10 ); + // Number of Polygons: + *pWMF >> nPoly >> nGesPoints; + + // taking the amount of points of each polygon, retrieving the total number of points + if ( pWMF->good() && + ( static_cast< sal_uInt32 >(nPoly) < SAL_MAX_UINT32 / sizeof(sal_uInt16) ) && + ( static_cast< sal_uInt32 >( nPoly ) * sizeof(sal_uInt16) ) <= ( nEndPos - pWMF->Tell() ) + ) + { + sal_uInt16* pnPoints = new sal_uInt16[ nPoly ]; + for ( i = 0; i < nPoly && pWMF->good(); i++ ) + { + *pWMF >> nPoints; + pnPoints[ i ] = (sal_uInt16)nPoints; + } + // Get polygon points: + for ( i = 0; ( i < nPoly ) && pWMF->good(); i++ ) + { + Polygon aPolygon = ReadPolygon<T>(0, pnPoints[i]); + pOut->DrawPolyLine( aPolygon, sal_False, bRecordPath ); + } + delete[] pnPoints; + } +} template <class T> void EnhWMFReader::ReadAndDrawPolyPolygon() @@ -529,47 +559,11 @@ sal_Bool EnhWMFReader::ReadEnhWMF() break; case EMR_POLYPOLYLINE : - { - sal_Int32 i, nPoly(0); - pWMF->SeekRel( 0x10 ); - - // Number of Polygons: - *pWMF >> nPoly >> i; - - // taking the amount of points of each polygon, retrieving the total number of points - if ( static_cast< sal_uInt32 >(nPoly) < SAL_MAX_UINT32 / sizeof(sal_uInt16) ) - { - if ( ( static_cast< sal_uInt32 >( nPoly ) * sizeof(sal_uInt16) ) <= ( nEndPos - pWMF->Tell() ) ) - { - sal_uInt16* pnPoints = new sal_uInt16[ nPoly ]; - - for ( i = 0; i < nPoly; i++ ) - { - *pWMF >> nPoints; - pnPoints[ i ] = (sal_uInt16)nPoints; - } - - // Get polygon points: - for ( i = 0; ( i < nPoly ) && !pWMF->IsEof(); i++ ) - { - Polygon aPoly( pnPoints[ i ] ); - for( sal_uInt16 k = 0; k < pnPoints[ i ]; k++ ) - { - *pWMF >> nX32 >> nY32; - aPoly[ k ] = Point( nX32, nY32 ); - } - pOut->DrawPolyLine( aPoly, sal_False, bRecordPath ); - } - delete[] pnPoints; - } - } - } + ReadAndDrawPolyLine<sal_uInt32>(); break; case EMR_POLYPOLYGON : - { ReadAndDrawPolyPolygon<sal_uInt32>(); - } break; case EMR_SETWINDOWEXTEX : @@ -1252,39 +1246,11 @@ sal_Bool EnhWMFReader::ReadEnhWMF() break; case EMR_POLYPOLYLINE16 : - { - sal_Int32 i, nPoly(0), nGesPoints(0); - pWMF->SeekRel( 0x10 ); - // Number of Polygons: - *pWMF >> nPoly >> nGesPoints; - - // taking the amount of points of each polygon, retrieving the total number of points - if ( static_cast< sal_uInt32 >(nPoly) < SAL_MAX_UINT32 / sizeof(sal_uInt16) ) - { - if ( ( static_cast< sal_uInt32 >( nPoly ) * sizeof(sal_uInt16) ) <= ( nEndPos - pWMF->Tell() ) ) - { - sal_uInt16* pnPoints = new sal_uInt16[ nPoly ]; - for ( i = 0; i < nPoly; i++ ) - { - *pWMF >> nPoints; - pnPoints[ i ] = (sal_uInt16)nPoints; - } - // Get polygon points: - for ( i = 0; ( i < nPoly ) && pWMF->good(); i++ ) - { - Polygon aPolygon = ReadPolygon<sal_Int16>(0, pnPoints[i]); - pOut->DrawPolyLine( aPolygon, sal_False, bRecordPath ); - } - delete[] pnPoints; - } - } - } - break; + ReadAndDrawPolyLine<sal_uInt16>(); + break; case EMR_POLYPOLYGON16 : - { ReadAndDrawPolyPolygon<sal_uInt16>(); - } break; case EMR_FILLRGN : diff --git a/svtools/source/filter/wmf/winmtf.hxx b/svtools/source/filter/wmf/winmtf.hxx index 07ddb7e..0fa899d 100644 --- a/svtools/source/filter/wmf/winmtf.hxx +++ b/svtools/source/filter/wmf/winmtf.hxx @@ -843,8 +843,8 @@ public: void ReadGDIComment(); private: template <class T> void ReadAndDrawPolyPolygon(); + template <class T> void ReadAndDrawPolyLine(); template <class T> Polygon ReadPolygon(sal_uInt16 nStartIndex, sal_uInt16 nPoints); -// template <class T, void * O> void ReadAndDrawPolygon(const sal_uInt16 nPoints, const sal_Bool skipFirst); template <class T, class Drawer> void ReadAndDrawPolygon(Drawer drawer, const sal_Bool skipFirst); }; -- 1.7.6
>From 114fdd980057ed7b03466d07137899df890c64f5 Mon Sep 17 00:00:00 2001 From: Marc-Andre Laverdiere <marc-an...@atc.tcs.com> Date: Tue, 20 Sep 2011 12:25:01 +0530 Subject: [PATCH 2/3] Refactoring drawing of simple polygons in enhwmf.cxx --- svtools/source/filter/wmf/enhwmf.cxx | 112 ++++++++++++++-------------------- svtools/source/filter/wmf/winmtf.hxx | 7 ++ 2 files changed, 54 insertions(+), 65 deletions(-) diff --git a/svtools/source/filter/wmf/enhwmf.cxx b/svtools/source/filter/wmf/enhwmf.cxx index 618f13d..9d80efb 100644 --- a/svtools/source/filter/wmf/enhwmf.cxx +++ b/svtools/source/filter/wmf/enhwmf.cxx @@ -31,7 +31,7 @@ #include "winmtf.hxx" #include <osl/endian.h> -#include <vector> +#include <boost/bind.hpp> using namespace std; //=========================== GDI-Array =================================== @@ -350,6 +350,38 @@ void EnhWMFReader::ReadGDIComment() * nPoints: number of points * pWMF: the stream containings the polygons * */ +template <class T, class Drawer> +void EnhWMFReader::ReadAndDrawPolygon(Drawer drawer, const sal_Bool skipFirst) +{ + sal_uInt16 nPoints(0), nStartIndex(0); + pWMF->SeekRel( 16 ); + *pWMF >> nPoints; + if (skipFirst) + { + nPoints ++; + nStartIndex ++; + } + + Polygon aPolygon(nPoints); + for (sal_uInt16 i = nStartIndex ; i < nPoints && pWMF->good(); i++ ) + { + T nX, nY; + *pWMF >> nX >> nY; + if (pWMF->good()) + break; + aPolygon[ i ] = Point( nX, nY ); + } + drawer(pOut, aPolygon, skipFirst, bRecordPath); +} + + +/** + * Reads polygons from the stream. + * The <class T> parameter is for the type of the points + * nStartIndex: which is the starting index in the polygon of the first point read + * nPoints: number of points + * pWMF: the stream containings the polygons + * */ template <class T> Polygon EnhWMFReader::ReadPolygon(sal_uInt16 nStartIndex, sal_uInt16 nPoints) { @@ -479,46 +511,21 @@ sal_Bool EnhWMFReader::ReadEnhWMF() switch( nRecType ) { case EMR_POLYBEZIERTO : - bFlag = sal_True; + ReadAndDrawPolygon<sal_Int32>(boost::bind(&WinMtfOutput::DrawPolyBezier, _1, _2, _3, _4), sal_True); + break; case EMR_POLYBEZIER : - { - pWMF->SeekRel( 16 ); - *pWMF >> nPoints; - sal_uInt16 i = 0; - if ( bFlag ) - { - i++; - nPoints++; - } - Polygon aPoly = ReadPolygon<sal_Int32>(i, nPoints); - pOut->DrawPolyBezier( aPoly, bFlag, bRecordPath ); - } + ReadAndDrawPolygon<sal_Int32>(boost::bind(&WinMtfOutput::DrawPolyBezier, _1, _2, _3, _4), sal_False); break; case EMR_POLYGON : - { - pWMF->SeekRel( 16 ); - *pWMF >> nPoints; - Polygon aPoly = ReadPolygon<sal_Int32>(0, nPoints); - pOut->DrawPolygon( aPoly, bRecordPath ); - } + ReadAndDrawPolygon<sal_Int32>(boost::bind(&WinMtfOutput::DrawPolygon, _1, _2, _3, _4), sal_False); break; case EMR_POLYLINETO : - bFlag = sal_True; + ReadAndDrawPolygon<sal_Int32>(boost::bind(&WinMtfOutput::DrawPolyLine, _1, _2, _3, _4), sal_True); + break; case EMR_POLYLINE : - { - pWMF->SeekRel( 0x10 ); - *pWMF >> nPoints; - sal_uInt16 i = 0; - if ( bFlag ) - { - i++; - nPoints++; - } - Polygon aPolygon = ReadPolygon<sal_Int32>(i, nPoints); - pOut->DrawPolyLine( aPolygon, bFlag, bRecordPath ); - } + ReadAndDrawPolygon<sal_Int32>(boost::bind(&WinMtfOutput::DrawPolyLine, _1, _2, _3, _4), sal_False); break; case EMR_POLYPOLYLINE : @@ -1227,46 +1234,21 @@ sal_Bool EnhWMFReader::ReadEnhWMF() break; case EMR_POLYBEZIERTO16 : - bFlag = sal_True; + ReadAndDrawPolygon<sal_Int16>(boost::bind(&WinMtfOutput::DrawPolyBezier, _1, _2, _3, _4), sal_True); + break; case EMR_POLYBEZIER16 : - { - pWMF->SeekRel( 16 ); - *pWMF >> nPoints; - sal_uInt16 i = 0; - if ( bFlag ) - { - i++; - nPoints++; - } - Polygon aPoly = ReadPolygon<sal_Int16>(i, nPoints); - pOut->DrawPolyBezier( aPoly, bFlag, bRecordPath ); // Line( aPoly, bFlag ); - } + ReadAndDrawPolygon<sal_Int16>(boost::bind(&WinMtfOutput::DrawPolyBezier, _1, _2, _3, _4), sal_False); break; case EMR_POLYGON16 : - { - pWMF->SeekRel( 16 ); - *pWMF >> nPoints; - Polygon aPoly = ReadPolygon<sal_Int16>(0, nPoints); - pOut->DrawPolygon( aPoly, bRecordPath ); - } + ReadAndDrawPolygon<sal_Int16>(boost::bind(&WinMtfOutput::DrawPolygon, _1, _2, _3, _4), sal_False); break; case EMR_POLYLINETO16 : - bFlag = sal_True; + ReadAndDrawPolygon<sal_Int16>(boost::bind(&WinMtfOutput::DrawPolyLine, _1, _2, _3, _4), sal_True); + break; case EMR_POLYLINE16 : - { - pWMF->SeekRel( 16 ); - *pWMF >> nPoints; - sal_uInt16 i = 0; - if ( bFlag ) - { - i++; - nPoints++; - } - Polygon aPoly = ReadPolygon<sal_Int16>(i, nPoints); - pOut->DrawPolyLine( aPoly, bFlag, bRecordPath ); - } + ReadAndDrawPolygon<sal_Int16>(boost::bind(&WinMtfOutput::DrawPolyLine, _1, _2, _3, _4), sal_False); break; case EMR_POLYPOLYLINE16 : diff --git a/svtools/source/filter/wmf/winmtf.hxx b/svtools/source/filter/wmf/winmtf.hxx index c6561f6..07ddb7e 100644 --- a/svtools/source/filter/wmf/winmtf.hxx +++ b/svtools/source/filter/wmf/winmtf.hxx @@ -738,6 +738,11 @@ public: const Point& rEndAngle ); void DrawPolygon( Polygon& rPolygon, sal_Bool bRecordPath = sal_False ); + void DrawPolygon( Polygon& rPolygon, sal_Bool bDrawTo, sal_Bool bRecordPath) + { //only for the template compatibility + bDrawTo = bDrawTo; //to avoid complaints about unused parameter + DrawPolygon(rPolygon, bRecordPath); + } void DrawPolyPolygon( PolyPolygon& rPolyPolygon, sal_Bool bRecordPath = sal_False ); void DrawPolyLine( Polygon& rPolygon, @@ -839,6 +844,8 @@ public: private: template <class T> void ReadAndDrawPolyPolygon(); template <class T> Polygon ReadPolygon(sal_uInt16 nStartIndex, sal_uInt16 nPoints); +// template <class T, void * O> void ReadAndDrawPolygon(const sal_uInt16 nPoints, const sal_Bool skipFirst); + template <class T, class Drawer> void ReadAndDrawPolygon(Drawer drawer, const sal_Bool skipFirst); }; //============================ WMFReader ================================== -- 1.7.6
_______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice