Add 0007-Improved-image-file-handling.patch patch
Improved code for creation of image files when RTF files containing
images processed.
Salvatore Bonaccorso authored 8 years ago
Willi Mann committed 8 years ago
0 | Description: Improved image file handling | |
1 | Improved code for creation of image files when RTF files containing | |
2 | images processed | |
3 | Origin: backport, http://hg.savannah.gnu.org/hgweb/unrtf/raw-rev/ba40e844a32a, | |
4 | http://hg.savannah.gnu.org/hgweb/unrtf/raw-rev/0f3b6a2cc680 | |
5 | Forwarded: not-needed | |
6 | Author: Salvatore Bonaccorso <carnil@debian.org> | |
7 | Last-Update: 2015-01-26 | |
8 | Applied-Upstream: 0.21.7 | |
9 | ||
10 | --- a/src/convert.c | |
11 | +++ b/src/convert.c | |
12 | @@ -1876,6 +1876,17 @@ static int cmd_rtf (Word *w, int align, | |
13 | return FALSE; | |
14 | } | |
15 | ||
16 | +/*======================================================================== | |
17 | + * Name: cmd_shppict | |
18 | + * Purpose: Executes the \shppict command. | |
19 | + * Args: Word, paragraph align info, and numeric param if any. | |
20 | + * Returns: Flag, true only if rest of Words on line should be ignored. | |
21 | + *=======================================================================*/ | |
22 | + | |
23 | +static int cmd_shppict (Word *w, int align, char has_param, int param) | |
24 | +{ | |
25 | + return FALSE; | |
26 | +} | |
27 | ||
28 | /*======================================================================== | |
29 | * Name: cmd_up | |
30 | @@ -2311,7 +2322,28 @@ static int cmd_footerf (Word *w, int ali | |
31 | * Returns: Flag, true only if rest of Words on line should be ignored. | |
32 | *=======================================================================*/ | |
33 | ||
34 | -static int cmd_ignore (Word *w, int align, char has_param, int param) { | |
35 | +static int cmd_ignore (Word *w, int align, char has_param, int param) | |
36 | +{ | |
37 | + return TRUE; | |
38 | +} | |
39 | + | |
40 | +/*======================================================================== | |
41 | + * Name: cmd_maybe_ignore | |
42 | + * Purpose: Dummy function to get rid of subgroups in most cases | |
43 | + * Args: Word, paragraph align info, and numeric param if any. | |
44 | + * Returns: Flag, true only if rest of Words on line should be ignored. | |
45 | + *=======================================================================*/ | |
46 | + | |
47 | +static int cmd_maybe_ignore (Word *w, int align, char has_param, int param) | |
48 | +{ | |
49 | + char *s = NULL; | |
50 | + if(w->next) | |
51 | + { | |
52 | + s = word_string(w->next); | |
53 | + if(s && strcmp(s, "\\shppict") == 0) | |
54 | + return(FALSE); | |
55 | + } | |
56 | + | |
57 | return TRUE; | |
58 | } | |
59 | ||
60 | @@ -2334,7 +2366,8 @@ static int cmd_info (Word *w, int align, | |
61 | * Returns: Flag, true only if rest of Words on line should be ignored. | |
62 | *=======================================================================*/ | |
63 | ||
64 | -static int cmd_pict (Word *w, int align, char has_param, int param) { | |
65 | +static int cmd_pict (Word *w, int align, char has_param, int param) | |
66 | +{ | |
67 | within_picture=TRUE; | |
68 | picture_width = picture_height = 0; | |
69 | picture_type = PICT_WB; | |
70 | @@ -2513,7 +2546,18 @@ typedef struct { | |
71 | ||
72 | /* All of the possible commands that RTF might recognize. */ | |
73 | static HashItem hashArray_other [] = { | |
74 | +/* 0.21.7 | |
75 | + * the "*" command was ignored in earlier versions, but included pictures | |
76 | + * seem to often start with \*\shppict{\pict so if "*" is ignored, so is | |
77 | + * the picture, so I have defined a new function "cmd_maybe_ignore" which | |
78 | + * tests whether the next word is shppict and if so does not ignore what | |
79 | + * follows. On simple tests this seems to work. - daved | |
80 | + */ | |
81 | +#if 0 | |
82 | { "*", cmd_ignore, NULL }, | |
83 | +#else | |
84 | + { "*", cmd_maybe_ignore, NULL }, | |
85 | +#endif | |
86 | { "-", cmd_optional_hyphen, "optional hyphen" }, | |
87 | { "_", cmd_nonbreaking_hyphen, "nonbreaking hyphen" }, | |
88 | { "~", cmd_nonbreaking_space, NULL }, | |
89 | @@ -2704,6 +2748,7 @@ static HashItem hashArray_s [] = { | |
90 | { "strikedl", &cmd_strikedl, NULL }, | |
91 | { "stylesheet", &cmd_ignore, "style sheet" }, | |
92 | { "shp", cmd_shp, "drawn shape" }, | |
93 | + { "shppict", &cmd_shppict, "shppict wrapper" }, | |
94 | #if 0 | |
95 | { "shading", NULL, NULL }, | |
96 | #endif |