richedit: Allow reading an enhanced metafile from an RTF stream.

This commit is contained in:
Eric Pouech 2008-03-16 21:48:29 +01:00 committed by Alexandre Julliard
parent 984e4167af
commit 4a01ddca25
3 changed files with 31 additions and 21 deletions

View File

@ -786,7 +786,7 @@ static void ME_RTFReadPictGroup(RTF_Info *info)
METAFILEPICT mfp;
HENHMETAFILE hemf;
HBITMAP hbmp;
enum gfxkind {gfx_unknown = 0, gfx_enhmetafile, gfx_dib} gfx = gfx_unknown;
enum gfxkind {gfx_unknown = 0, gfx_enhmetafile, gfx_metafile, gfx_dib} gfx = gfx_unknown;
RTFGetToken (info);
if (info->rtfClass == rtfEOF)
@ -796,13 +796,17 @@ static void ME_RTFReadPictGroup(RTF_Info *info)
if (RTFCheckMM (info, rtfPictAttr, rtfWinMetafile))
{
mfp.mm = info->rtfParam;
gfx = gfx_enhmetafile;
gfx = gfx_metafile;
}
else if (RTFCheckMM (info, rtfPictAttr, rtfDevIndBitmap))
{
if (info->rtfParam != 0) FIXME("dibitmap should be 0 (%d)\n", info->rtfParam);
gfx = gfx_dib;
}
else if (RTFCheckMM (info, rtfPictAttr, rtfEmfBlip))
{
gfx = gfx_enhmetafile;
}
else
{
FIXME("%d %d\n", info->rtfMajor, info->rtfMinor);
@ -825,11 +829,11 @@ static void ME_RTFReadPictGroup(RTF_Info *info)
}
else if (RTFCheckMM (info, rtfPictAttr, rtfPicWid))
{
if (gfx == gfx_enhmetafile) mfp.xExt = info->rtfParam;
if (gfx == gfx_metafile) mfp.xExt = info->rtfParam;
}
else if (RTFCheckMM (info, rtfPictAttr, rtfPicHt))
{
if (gfx == gfx_enhmetafile) mfp.yExt = info->rtfParam;
if (gfx == gfx_metafile) mfp.yExt = info->rtfParam;
}
else if (RTFCheckMM (info, rtfPictAttr, rtfPicGoalWid))
sz.cx = info->rtfParam;
@ -869,6 +873,10 @@ static void ME_RTFReadPictGroup(RTF_Info *info)
switch (gfx)
{
case gfx_enhmetafile:
if ((hemf = SetEnhMetaFileBits(bufidx, buffer)))
ME_RTFInsertOleObject(info, hemf, NULL, &sz);
break;
case gfx_metafile:
if ((hemf = SetWinMetaFileBits(bufidx, buffer, NULL, &mfp)))
ME_RTFInsertOleObject(info, hemf, NULL, &sz);
break;

View File

@ -1788,6 +1788,7 @@ static RTFKey rtfKey[] =
{ rtfPictAttr, rtfWinMetafile, "wmetafile", 0 },
{ rtfPictAttr, rtfDevIndBitmap, "dibitmap", 0 },
{ rtfPictAttr, rtfWinBitmap, "wbitmap", 0 },
{ rtfPictAttr, rtfEmfBlip, "emfblip", 0 },
{ rtfPictAttr, rtfPixelBits, "wbmbitspixel", 0 },
{ rtfPictAttr, rtfBitmapPlanes, "wbmplanes", 0 },
{ rtfPictAttr, rtfBitmapWid, "wbmwidthbytes", 0 },

View File

@ -597,23 +597,24 @@
# define rtfWinMetafile 2
# define rtfDevIndBitmap 3
# define rtfWinBitmap 4
# define rtfPixelBits 5
# define rtfBitmapPlanes 6
# define rtfBitmapWid 7
# define rtfPicWid 8
# define rtfPicHt 9
# define rtfPicGoalWid 10
# define rtfPicGoalHt 11
# define rtfPicScaleX 12
# define rtfPicScaleY 13
# define rtfPicScaled 14
# define rtfPicCropTop 15
# define rtfPicCropBottom 16
# define rtfPicCropLeft 17
# define rtfPicCropRight 18
# define rtfPicMFHasBitmap 19 /* new in 1.10 */
# define rtfPicMFBitsPerPixel 20 /* new in 1.10 */
# define rtfPicBinary 21
# define rtfEmfBlip 5
# define rtfPixelBits 6
# define rtfBitmapPlanes 7
# define rtfBitmapWid 8
# define rtfPicWid 9
# define rtfPicHt 10
# define rtfPicGoalWid 11
# define rtfPicGoalHt 12
# define rtfPicScaleX 13
# define rtfPicScaleY 14
# define rtfPicScaled 15
# define rtfPicCropTop 16
# define rtfPicCropBottom 17
# define rtfPicCropLeft 18
# define rtfPicCropRight 19
# define rtfPicMFHasBitmap 20 /* new in 1.10 */
# define rtfPicMFBitsPerPixel 21 /* new in 1.10 */
# define rtfPicBinary 22
# define rtfBookmarkAttr 14
# define rtfBookmarkFirstCol 0