1 diff --git cppcanvas/source/inc/implrenderer.hxx cppcanvas/source/inc/implrenderer.hxx
2 index 59d793f..bb6ce2a 100644
3 --- cppcanvas/source/inc/implrenderer.hxx
4 +++ cppcanvas/source/inc/implrenderer.hxx
5 @@ -282,6 +282,7 @@ static float GetSwapFloat( SvStream& rSt )
6 ActionVector::const_iterator& o_rRangeBegin,
7 ActionVector::const_iterator& o_rRangeEnd ) const;
9 + void processObjectRecord(SvMemoryStream& rObjectStream, UINT16 flags);
10 void processEMFPlus( MetaCommentAction* pAct, const ActionFactoryParameters& rFactoryParms, OutDevState& rState, const CanvasSharedPtr& rCanvas );
11 void EMFPPlusFillPolygon (::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms, OutDevState& rState, const CanvasSharedPtr& rCanvas, bool isColor, sal_uInt32 brushIndexOrColor);
13 @@ -306,6 +307,10 @@ static float GetSwapFloat( SvStream& rSt )
17 + /* multipart object data */
20 + SvMemoryStream mMStream;
24 diff --git cppcanvas/source/mtfrenderer/emfplus.cxx cppcanvas/source/mtfrenderer/emfplus.cxx
25 index 657e867..9088e93 100644
26 --- cppcanvas/source/mtfrenderer/emfplus.cxx
27 +++ cppcanvas/source/mtfrenderer/emfplus.cxx
28 @@ -636,6 +636,8 @@ namespace cppcanvas
30 sal_uInt32 header, unknown;
32 + EMFP_DEBUG (dumpWords(s, 16));
36 EMFP_DEBUG (printf ("EMF+\timage\nEMF+\theader: 0x%08x type: 0x%08x\n", header, type));
37 @@ -947,6 +949,72 @@ namespace cppcanvas
41 + void ImplRenderer::processObjectRecord(SvMemoryStream& rObjectStream, UINT16 flags)
46 + EMFP_DEBUG (printf ("EMF+ Object slot: %hd flags: %hx\n", flags & 0xff, flags & 0xff00));
48 + index = flags & 0xff;
49 + if (aObjects [index] != NULL) {
50 + delete aObjects [index];
51 + aObjects [index] = NULL;
54 + switch (flags & 0x7f00) {
55 + case EmfPlusObjectTypeBrush:
58 + aObjects [index] = brush = new EMFPBrush ();
59 + brush->Read (rObjectStream, *this);
63 + case EmfPlusObjectTypePen:
66 + aObjects [index] = pen = new EMFPPen ();
67 + pen->Read (rObjectStream, *this, nHDPI, nVDPI);
71 + case EmfPlusObjectTypePath:
72 + sal_uInt32 header, pathFlags;
75 + rObjectStream >> header >> points >> pathFlags;
77 + EMFP_DEBUG (printf ("EMF+\tpath\n"));
78 + EMFP_DEBUG (printf ("EMF+\theader: 0x%08x points: %d additional flags: 0x%08x\n", header, points, pathFlags));
81 + aObjects [index] = path = new EMFPPath (points);
82 + path->Read (rObjectStream, pathFlags, *this);
85 + case EmfPlusObjectTypeRegion: {
88 + aObjects [index] = region = new EMFPRegion ();
89 + region->Read (rObjectStream);
93 + case EmfPlusObjectTypeImage:
96 + aObjects [index] = image = new EMFPImage ();
97 + image->Read (rObjectStream);
102 + EMFP_DEBUG (printf ("EMF+\tObject unhandled flags: 0x%04x\n", flags & 0xff00));
107 void ImplRenderer::processEMFPlus( MetaCommentAction* pAct, const ActionFactoryParameters& rFactoryParms,
108 OutDevState& rState, const CanvasSharedPtr& rCanvas )
110 @@ -966,6 +1034,26 @@ namespace cppcanvas
112 EMFP_DEBUG (printf ("EMF+ record size: %d type: %04hx flags: %04hx data size: %d\n", size, type, flags, dataSize));
114 + if (type == EmfPlusRecordTypeObject && (mbMultipart && flags & 0x7fff == mMFlags & 0x7fff || flags & 0x8000)) {
115 + if (!mbMultipart) {
116 + mbMultipart = true;
120 + EMFP_DEBUG (dumpWords(rMF, 16));
121 + // 1st 4 bytes are unknown
122 + mMStream.Write (((const char *)rMF.GetData()) + rMF.Tell() + 4, dataSize - 4);
123 + EMFP_DEBUG (printf ("EMF+ read next object part size: %d type: %04hx flags: %04hx data size: %d\n", size, type, flags, dataSize));
126 + EMFP_DEBUG (printf ("EMF+ multipart record flags: %04hx\n", mMFlags));
128 + processObjectRecord (mMStream, mMFlags);
130 + mbMultipart = false;
133 + if (type != EmfPlusRecordTypeObject || !(flags & 0x8000))
135 case EmfPlusRecordTypeHeader:
136 UINT32 header, version;
137 @@ -984,73 +1072,8 @@ namespace cppcanvas
138 EMFP_DEBUG (printf ("EMF+\talready used in svtools wmf/emf filter parser\n"));
140 case EmfPlusRecordTypeObject:
145 - EMFP_DEBUG (printf ("EMF+ Object slot: %hd flags: %hx\n", flags & 0xff, flags & 0xff00));
147 - index = flags & 0xff;
148 - if (aObjects [index] != NULL) {
149 - delete aObjects [index];
150 - aObjects [index] = NULL;
153 - // not sure yet, what 0x8000 means
154 - switch (flags & 0x7f00) {
155 - case EmfPlusObjectTypeBrush:
158 - aObjects [index] = brush = new EMFPBrush ();
159 - brush->Read (rMF, *this);
163 - case EmfPlusObjectTypePen:
166 - aObjects [index] = pen = new EMFPPen ();
167 - pen->Read (rMF, *this, nHDPI, nVDPI);
171 - case EmfPlusObjectTypePath:
172 - sal_uInt32 header, pathFlags;
175 - rMF >> header >> points >> pathFlags;
177 - EMFP_DEBUG (printf ("EMF+\tpath\n"));
178 - EMFP_DEBUG (printf ("EMF+\theader: 0x%08x points: %d additional flags: 0x%08x\n", header, points, pathFlags));
181 - aObjects [index] = path = new EMFPPath (points);
182 - path->Read (rMF, pathFlags, *this);
185 - case EmfPlusObjectTypeRegion: {
186 - EMFPRegion *region;
188 - aObjects [index] = region = new EMFPRegion ();
189 - region->Read (rMF);
193 - case EmfPlusObjectTypeImage:
196 - aObjects [index] = image = new EMFPImage ();
202 - EMFP_DEBUG (printf ("EMF+\tObject unhandled flags: 0x%04x\n", flags & 0xff00));
208 + processObjectRecord (rMF, flags);
210 case EmfPlusRecordTypeFillPath:
212 sal_uInt32 index = flags & 0xff;
213 diff --git cppcanvas/source/mtfrenderer/implrenderer.cxx cppcanvas/source/mtfrenderer/implrenderer.cxx
214 index 7189004..2d03b8a 100644
215 --- cppcanvas/source/mtfrenderer/implrenderer.cxx
216 +++ cppcanvas/source/mtfrenderer/implrenderer.cxx
217 @@ -3034,6 +3034,7 @@ namespace cppcanvas
220 memset (aObjects, 0, sizeof (aObjects));
221 + mbMultipart = false;
223 createActions( const_cast<GDIMetaFile&>(rMtf), // HACK(Q2):