diff options
author | Kurt Zenker <kz@openoffice.org> | 2009-11-13 18:48:59 +0100 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2009-11-13 18:48:59 +0100 |
commit | 787924900754f8a3d3bc126649e518b2adb9beb5 (patch) | |
tree | 1efa84ffba8ab3a2b909d8d9bb395349f052826b /vcl/source | |
parent | e66f4ee8e5923ccb16ef6869b3b9e9cb816a5966 (diff) | |
parent | 475a5ec764e1963f179df43cfa91e1c73b5a97c5 (diff) |
CWS-TOOLING: integrate CWS impress178_DEV300
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/gdi/cvtsvm.cxx | 40 | ||||
-rw-r--r-- | vcl/source/gdi/metaact.cxx | 37 | ||||
-rw-r--r-- | vcl/source/gdi/outdev3.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/region.cxx | 8 |
4 files changed, 71 insertions, 16 deletions
diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx index c1c02b673658..4ecb89ec5a8e 100644 --- a/vcl/source/gdi/cvtsvm.cxx +++ b/vcl/source/gdi/cvtsvm.cxx @@ -90,12 +90,17 @@ void ImplReadPoly( SvStream& rIStm, Polygon& rPoly ) void ImplWritePoly( SvStream& rOStm, const Polygon& rPoly ) { - INT32 nSize = rPoly.GetSize(); + // #i102224# Here the evtl. curved nature of Polygon was + // ignored (for all those Years). Adapted to at least write + // a polygon representing the curve as good as possible + Polygon aSimplePoly; + rPoly.AdaptiveSubdivide(aSimplePoly); + INT32 nSize = aSimplePoly.GetSize(); rOStm << nSize; for( INT32 i = 0; i < nSize; i++ ) - rOStm << rPoly[ (USHORT) i ]; + rOStm << aSimplePoly[ (USHORT) i ]; } // ------------------------------------------------------------------------ @@ -131,13 +136,18 @@ void ImplWritePolyPolyAction( SvStream& rOStm, const PolyPolygon& rPolyPoly ) for( n = 0; n < nPoly; n++ ) { + // #i102224# Here the evtl. curved nature of Polygon was + // ignored (for all those Years). Adapted to at least write + // a polygon representing the curve as good as possible const Polygon& rPoly = rPolyPoly[ n ]; - const USHORT nSize = rPoly.GetSize(); + Polygon aSimplePoly; + rPoly.AdaptiveSubdivide(aSimplePoly); + const USHORT nSize = aSimplePoly.GetSize(); rOStm << (INT32) nSize; for( USHORT j = 0; j < nSize; j++ ) - rOStm << rPoly[ j ]; + rOStm << aSimplePoly[ j ]; } } @@ -1354,8 +1364,15 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { MetaPolyLineAction* pAct = (MetaPolyLineAction*) pAction; const Polygon& rPoly = pAct->GetPolygon(); + + // #i102224# Here the evtl. curved nature of Polygon was + // ignored (for all those Years). Adapted to at least write + // a polygon representing the curve as good as possible + Polygon aSimplePoly; + rPoly.AdaptiveSubdivide(aSimplePoly); + const LineInfo& rInfo = pAct->GetLineInfo(); - const USHORT nPoints = rPoly.GetSize(); + const USHORT nPoints = aSimplePoly.GetSize(); const BOOL bFatLine = ( !rInfo.IsDefault() && ( LINE_NONE != rInfo.GetStyle() ) ); if( bFatLine ) @@ -1369,7 +1386,7 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, rOStm << (INT32) nPoints; for( USHORT n = 0; n < nPoints; n++ ) - rOStm << rPoly[ n ]; + rOStm << aSimplePoly[ n ]; nCount++; @@ -1385,14 +1402,21 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { MetaPolygonAction* pAct = (MetaPolygonAction*) pAction; const Polygon& rPoly = pAct->GetPolygon(); - const USHORT nPoints = rPoly.GetSize(); + + // #i102224# Here the evtl. curved nature of Polygon was + // ignored (for all those Years). Adapted to at least write + // a polygon representing the curve as good as possible + Polygon aSimplePoly; + rPoly.AdaptiveSubdivide(aSimplePoly); + + const USHORT nPoints = aSimplePoly.GetSize(); rOStm << (INT16) GDI_POLYGON_ACTION; rOStm << (INT32) ( 8 + ( nPoints << 3 ) ); rOStm << (INT32) nPoints; for( USHORT n = 0; n < nPoints; n++ ) - rOStm << rPoly[ n ]; + rOStm << aSimplePoly[ n ]; nCount++; } diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index 4fe9a41be797..82566b2b4362 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -989,7 +989,7 @@ void MetaPolyLineAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) WRITE_BASE_COMPAT( rOStm, 3, pData ); Polygon aSimplePoly; - maPoly.GetSimple( aSimplePoly ); + maPoly.AdaptiveSubdivide( aSimplePoly ); rOStm << aSimplePoly; // Version 1 rOStm << maLineInfo; // Version 2 @@ -1077,7 +1077,7 @@ void MetaPolygonAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) WRITE_BASE_COMPAT( rOStm, 2, pData ); Polygon aSimplePoly; // Version 1 - maPoly.GetSimple( aSimplePoly ); + maPoly.AdaptiveSubdivide( aSimplePoly ); rOStm << aSimplePoly; sal_uInt8 bHasPolyFlags = maPoly.HasFlags(); // Version 2 @@ -1169,7 +1169,7 @@ void MetaPolyPolygonAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) const Polygon& rPoly = maPolyPoly.GetObject( i ); if ( rPoly.HasFlags() ) nNumberOfComplexPolygons++; - rPoly.GetSimple( aSimplePoly ); + rPoly.AdaptiveSubdivide( aSimplePoly ); rOStm << aSimplePoly; } @@ -2581,7 +2581,13 @@ sal_Bool MetaGradientExAction::Compare( const MetaAction& rMetaAction ) const void MetaGradientExAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { WRITE_BASE_COMPAT( rOStm, 1, pData ); - rOStm << maPolyPoly << maGradient; + + // #i105373# see comment at MetaTransparentAction::Write + PolyPolygon aNoCurvePolyPolygon; + maPolyPoly.AdaptiveSubdivide(aNoCurvePolyPolygon); + + rOStm << aNoCurvePolyPolygon; + rOStm << maGradient; } // ------------------------------------------------------------------------ @@ -2649,7 +2655,13 @@ sal_Bool MetaHatchAction::Compare( const MetaAction& rMetaAction ) const void MetaHatchAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { WRITE_BASE_COMPAT( rOStm, 1, pData ); - rOStm << maPolyPoly << maHatch; + + // #i105373# see comment at MetaTransparentAction::Write + PolyPolygon aNoCurvePolyPolygon; + maPolyPoly.AdaptiveSubdivide(aNoCurvePolyPolygon); + + rOStm << aNoCurvePolyPolygon; + rOStm << maHatch; } // ------------------------------------------------------------------------ @@ -3716,7 +3728,20 @@ sal_Bool MetaTransparentAction::Compare( const MetaAction& rMetaAction ) const void MetaTransparentAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { WRITE_BASE_COMPAT( rOStm, 1, pData ); - rOStm << maPolyPoly; + + // #i105373# The PolyPolygon in this action may be a curve; this + // was ignored until now what is an error. To make older office + // versions work with MetaFiles, i opt for applying AdaptiveSubdivide + // to the PolyPoylgon. + // The alternative would be to really write the curve information + // like in MetaPolyPolygonAction::Write (where someone extended it + // correctly, but not here :-( ). + // The golden solution would be to combine both, but i think it's + // not necessary; a good subdivision will be sufficient. + PolyPolygon aNoCurvePolyPolygon; + maPolyPoly.AdaptiveSubdivide(aNoCurvePolyPolygon); + + rOStm << aNoCurvePolyPolygon; rOStm << mnTransPercent; } diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 0a7a8b765b6b..8a057b3f3c7b 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -4835,7 +4835,7 @@ void OutputDevice::ImplGetEmphasisMark( PolyPolygon& rPolyPoly, BOOL& rPolyLine, double dScale = ((double)nDotSize)/1000.0; aPoly.Scale( dScale, dScale ); Polygon aTemp; - aPoly.GetSimple( aTemp ); + aPoly.AdaptiveSubdivide( aTemp ); Rectangle aBoundRect = aTemp.GetBoundRect(); rWidth = aBoundRect.GetWidth(); nDotSize = aBoundRect.GetHeight(); diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx index 43bb224aaa94..5314837143de 100644 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -2537,7 +2537,13 @@ SvStream& operator<<( SvStream& rOStrm, const Region& rRegion ) rOStrm << bHasPolyPolygon; if( bHasPolyPolygon ) - rOStrm << rRegion.GetPolyPolygon(); + { + // #i105373# + PolyPolygon aNoCurvePolyPolygon; + rRegion.GetPolyPolygon().AdaptiveSubdivide(aNoCurvePolyPolygon); + + rOStrm << aNoCurvePolyPolygon; + } } return rOStrm; |