diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-06-10 15:34:44 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-06-10 17:53:02 +0100 |
commit | b04e1e79e64cb7bb3106fd08a019c27b09bdd5c6 (patch) | |
tree | 4e692bdb31e889df82c967a7a1731401816a6678 /filter | |
parent | 6cca91f7ada91701443225061a5dd0ae81a98b8e (diff) |
Prop_pSegmentInfo is totally misunderstood apparently
digging into the crash on export of kde216114-1.odt
reveals various horrors
Change-Id: I0d24fe303d561a00a08098b306d10fd8273af928
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/msfilter/escherex.cxx | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 93b2d958ba4b..1e298dcb62b3 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -3253,85 +3253,92 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT .WriteUInt16( nElementSize ); for ( j = 0; j < nElements; j++ ) { + // The segment type is stored in the upper 3 bits + // and segment count is stored in the lower 13 + // bits. + // + // If the segment type is msopathEscape, the lower 13 bits + // are divided in a 5 bit escape code and 8 bit + // vertex count (not segment count!) sal_uInt16 nVal = (sal_uInt16)aSegments[ j ].Count; switch( aSegments[ j ].Command ) { - case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::UNKNOWN : - case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LINETO : break; - case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::MOVETO : - { - nVal = 0x4000; - } - break; + case css::drawing::EnhancedCustomShapeSegmentCommand::UNKNOWN : + case css::drawing::EnhancedCustomShapeSegmentCommand::LINETO : + break; + case css::drawing::EnhancedCustomShapeSegmentCommand::MOVETO : + nVal = (msopathMoveTo << 13); + break; case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CURVETO : { - nVal |= 0x2000; + nVal |= (msopathCurveTo << 13); } break; case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH : { - nVal = 0x6001; + nVal = 1; + nVal |= (msopathClose << 13); } break; case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH : { - nVal = 0x8000; + nVal = (msopathEnd << 13); } break; case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::NOFILL : { - nVal = 0xaa00; + nVal = (msopathEscape << 13) | (5 << 8); } break; case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::NOSTROKE : { - nVal = 0xab00; + nVal = (msopathEscape << 13) | (11 << 8); } break; case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSETO : { nVal *= 3; - nVal |= 0xa100; + nVal |= (msopathEscape << 13) | (1 << 8); } break; case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSE : { nVal *= 3; - nVal |= 0xa200; + nVal |= (msopathEscape << 13) | (2 << 8); } break; case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ARCTO : { nVal <<= 2; - nVal |= 0xa300; + nVal |= (msopathEscape << 13) | (3 << 8); } break; case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ARC : { nVal <<= 2; - nVal |= 0xa400; + nVal |= (msopathEscape << 13) | (4 << 8); } break; case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO : { nVal <<= 2; - nVal |= 0xa500; + nVal |= (msopathEscape << 13) | (5 << 8); } break; case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARC : { nVal <<= 2; - nVal |= 0xa600; + nVal |= (msopathEscape << 13) | (6 << 8); } break; case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTX : { - nVal |= 0xa700; + nVal |= (msopathEscape << 13) | (7 << 8); } break; case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTY : { - nVal |= 0xa800; + nVal |= (msopathEscape << 13) | (8 << 8); } break; } |