[PATCH 2/2] riched20: Add support for the \shppict destination.
Huw Davies
huw at codeweavers.com
Wed Oct 28 07:49:56 CDT 2015
Signed-off-by: Huw Davies <huw at codeweavers.com>
---
dlls/riched20/editor.c | 30 ++++++++++++++++++++++++++++++
dlls/riched20/reader.c | 2 ++
dlls/riched20/rtf.h | 4 +++-
3 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 31d134f..98c7414 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -1236,6 +1236,35 @@ static BOOL ME_RTFInsertOleObject(RTF_Info *info, HENHMETAFILE hemf, HBITMAP hbm
return ret;
}
+static void ME_RTFReadShpPictGroup( RTF_Info *info )
+{
+ int level = 1;
+
+ for (;;)
+ {
+ RTFGetToken (info);
+
+ if (info->rtfClass == rtfEOF) return;
+ if (RTFCheckCM( info, rtfGroup, rtfEndGroup ))
+ {
+ if (--level == 0) break;
+ }
+ else if (RTFCheckCM( info, rtfGroup, rtfBeginGroup ))
+ {
+ level++;
+ }
+ else
+ {
+ RTFRouteToken( info );
+ if (RTFCheckCM( info, rtfGroup, rtfEndGroup ))
+ level--;
+ }
+ }
+
+ RTFRouteToken( info ); /* feed "}" back to router */
+ return;
+}
+
static DWORD read_hex_data( RTF_Info *info, BYTE **out )
{
DWORD read = 0, size = 1024;
@@ -1579,6 +1608,7 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
WriterInit(&parser);
RTFInit(&parser);
RTFSetReadHook(&parser, ME_RTFReadHook);
+ RTFSetDestinationCallback(&parser, rtfShpPict, ME_RTFReadShpPictGroup);
RTFSetDestinationCallback(&parser, rtfPict, ME_RTFReadPictGroup);
RTFSetDestinationCallback(&parser, rtfObject, ME_RTFReadObjectGroup);
if (!parser.editor->bEmulateVersion10) /* v4.1 */
diff --git a/dlls/riched20/reader.c b/dlls/riched20/reader.c
index e5202aa..0972911 100644
--- a/dlls/riched20/reader.c
+++ b/dlls/riched20/reader.c
@@ -1808,6 +1808,8 @@ static RTFKey rtfKey[] =
{ rtfDestination, rtfNeXTGraphic, "NeXTGraphic", 0 },
{ rtfDestination, rtfNestTableProps, "nesttableprops", 0 },
{ rtfDestination, rtfNoNestTables, "nonesttables", 0 },
+ { rtfDestination, rtfShpPict, "shppict", 0 },
+ { rtfDestination, rtfNonShpPict, "nonshppict", 0 },
/*
* Font families
diff --git a/dlls/riched20/rtf.h b/dlls/riched20/rtf.h
index 064ba60..335d098 100644
--- a/dlls/riched20/rtf.h
+++ b/dlls/riched20/rtf.h
@@ -184,7 +184,9 @@
# define rtfGenerator 74
# define rtfNestTableProps 75
# define rtfNoNestTables 76
-# define rtfMaxDestination 77 /* highest dest + 1 */
+# define rtfShpPict 77
+# define rtfNonShpPict 78
+# define rtfMaxDestination 79 /* highest dest + 1 */
# define rtfFontFamily 4
# define rtfFFNil 0
--
1.8.0
More information about the wine-patches
mailing list