summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-06-10 15:34:44 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-06-25 20:22:48 +0100
commiteca8386ce0f7693bfe3520f6cd86bc7c1cbb4dc0 (patch)
tree062a94315a1248df245bb8b5df497f31481f81ce /filter
parentc0d691b9d3266823e2ca64164b1738965699b8c9 (diff)
Prop_pSegmentInfo is totally misunderstood apparently
digging into the crash on export of kde216114-1.odt reveals various horrors Change-Id: I0d24fe303d561a00a08098b306d10fd8273af928 (cherry picked from commit b04e1e79e64cb7bb3106fd08a019c27b09bdd5c6)
Diffstat (limited to 'filter')
-rw-r--r--filter/source/msfilter/escherex.cxx47
1 files changed, 27 insertions, 20 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index 3bc125f8c1cc..eded8e8e949f 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -3258,85 +3258,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;
}