[PATCH 18/18] [RichEdit]: allow reading an enhanced metafile from an RTF stream

Eric Pouech eric.pouech at orange.fr
Sun Mar 16 15:48:29 CDT 2008




A+
---

 dlls/riched20/editor.c |   16 ++++++++++++----
 dlls/riched20/reader.c |    1 +
 dlls/riched20/rtf.h    |   35 ++++++++++++++++++-----------------
 3 files changed, 31 insertions(+), 21 deletions(-)


diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index e014605..4026976 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -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;
diff --git a/dlls/riched20/reader.c b/dlls/riched20/reader.c
index 4ed7258..1ecca08 100644
--- a/dlls/riched20/reader.c
+++ b/dlls/riched20/reader.c
@@ -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 },
diff --git a/dlls/riched20/rtf.h b/dlls/riched20/rtf.h
index 3a9c235..8b39f60 100644
--- a/dlls/riched20/rtf.h
+++ b/dlls/riched20/rtf.h
@@ -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





More information about the wine-patches mailing list