urlmon: Don't create stgmed_obj for binding to object.
[wine] / programs / winhelp / hlpfile.h
1 /*
2  * Help Viewer
3  *
4  * Copyright    1996 Ulrich Schmid
5  *              2002 Eric Pouech
6  *              2007 Kirill K. Smirnov
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21  */
22
23 struct tagHelpFile;
24
25 typedef struct 
26 {
27     char        type[10];
28     char        name[9];
29     char        caption[51];
30     POINT       origin;
31     SIZE        size;
32     int         style;
33     DWORD       win_style;
34     COLORREF    sr_color;       /* color for scrollable region */
35     COLORREF    nsr_color;      /* color for non scrollable region */
36 } HLPFILE_WINDOWINFO;
37
38 typedef struct
39 {
40     enum {hlp_link_link, hlp_link_popup, hlp_link_macro} cookie;
41     LPCSTR      lpszString;     /* name of the file to for the link (NULL if same file) */
42     LONG        lHash;          /* topic index */
43     unsigned    bClrChange : 1, /* true if the link is green & underlined */
44                 wRefCount;      /* number of internal references to this object */
45     unsigned    window;         /* window number for displaying the link (-1 is current) */
46 } HLPFILE_LINK;
47
48 enum para_type {para_normal_text, para_debug_text, para_bitmap, para_metafile};
49
50 typedef struct tagHlpFileParagraph
51 {
52     enum para_type              cookie;
53
54     union
55     {
56         struct
57         {
58             LPSTR                       lpszText;
59             unsigned                    wFont;
60             unsigned                    wIndent;
61             unsigned                    wHSpace;
62             unsigned                    wVSpace;
63         } text;
64         struct
65         {
66             unsigned                    pos;    /* 0: center, 1: left, 2: right */
67             union 
68             {
69                 struct 
70                 {
71                     HBITMAP             hBitmap;
72                 } bmp;
73                 METAFILEPICT            mfp;
74             } u;
75         } gfx; /* for bitmaps and metafiles */
76     } u;
77
78     HLPFILE_LINK*               link;
79
80     struct tagHlpFileParagraph* next;
81 } HLPFILE_PARAGRAPH;
82
83 typedef struct tagHlpFileMacro
84 {
85     LPCSTR                      lpszMacro;
86     struct tagHlpFileMacro*     next;
87 } HLPFILE_MACRO;
88
89 typedef struct tagHlpFilePage
90 {
91     LPSTR                       lpszTitle;
92     HLPFILE_PARAGRAPH*          first_paragraph;
93     HLPFILE_MACRO*              first_macro;
94
95     unsigned                    wNumber;
96     unsigned                    offset;
97     struct tagHlpFilePage*      next;
98     struct tagHlpFilePage*      prev;
99
100     DWORD                       browse_bwd;
101     DWORD                       browse_fwd;
102
103     struct tagHlpFileFile*      file;
104 } HLPFILE_PAGE;
105
106 typedef struct
107 {
108     LONG                        lMap;
109     unsigned long               offset;
110 } HLPFILE_MAP;
111
112 typedef struct
113 {
114     LOGFONT                     LogFont;
115     HFONT                       hFont;
116     COLORREF                    color;
117 } HLPFILE_FONT;
118
119 typedef struct tagHlpFileFile
120 {
121     LPSTR                       lpszPath;
122     LPSTR                       lpszTitle;
123     LPSTR                       lpszCopyright;
124     HLPFILE_PAGE*               first_page;
125     HLPFILE_PAGE*               last_page;
126     HLPFILE_MACRO*              first_macro;
127     BYTE*                       Context;
128     BYTE*                       kwbtree;
129     BYTE*                       kwdata;
130     unsigned                    wMapLen;
131     HLPFILE_MAP*                Map;
132     unsigned long               contents_start;
133
134     struct tagHlpFileFile*      prev;
135     struct tagHlpFileFile*      next;
136
137     unsigned                    wRefCount;
138
139     unsigned short              version;
140     unsigned short              flags;
141     unsigned short              tbsize;     /* topic block size */
142     unsigned short              dsize;      /* decompress size */
143     unsigned short              compressed;
144     unsigned                    hasPhrases;   /* file has |Phrases */
145     unsigned                    hasPhrases40; /* file has |PhrIndex/|PhrImage */
146
147     unsigned                    numBmps;
148     HBITMAP*                    bmps;
149
150     unsigned                    numFonts;
151     HLPFILE_FONT*               fonts;
152
153     unsigned                    numWindows;
154     HLPFILE_WINDOWINFO*         windows;
155 } HLPFILE;
156
157 /*
158  * Compare function type for HLPFILE_BPTreeSearch function.
159  *
160  * PARAMS
161  *     p       [I] pointer to testing block (key + data)
162  *     key     [I] pointer to key value to look for
163  *     leaf    [I] whether this function called for index of leaf page
164  *     next    [O] pointer to pointer to next block
165  */
166 typedef int (*HLPFILE_BPTreeCompare)(void *p, const void *key,
167                                      int leaf, void **next);
168
169 /*
170  * Callback function type for HLPFILE_BPTreeEnum function.
171  *
172  * PARAMS
173  *     p       [I]  pointer to data block
174  *     next    [O]  pointer to pointer to next block
175  *     cookie  [IO] cookie data
176  */
177 typedef void (*HLPFILE_BPTreeCallback)(void *p, void **next, void *cookie);
178
179 HLPFILE*      HLPFILE_ReadHlpFile(LPCSTR lpszPath);
180 HLPFILE_PAGE* HLPFILE_Contents(HLPFILE* hlpfile);
181 HLPFILE_PAGE* HLPFILE_PageByHash(HLPFILE* hlpfile, LONG lHash);
182 HLPFILE_PAGE* HLPFILE_PageByMap(HLPFILE* hlpfile, LONG lMap);
183 HLPFILE_PAGE* HLPFILE_PageByOffset(HLPFILE* hlpfile, LONG offset);
184 LONG          HLPFILE_Hash(LPCSTR lpszContext);
185 void          HLPFILE_FreeLink(HLPFILE_LINK* link);
186 void          HLPFILE_FreeHlpFile(HLPFILE*);
187
188 void* HLPFILE_BPTreeSearch(BYTE*, const void*, HLPFILE_BPTreeCompare);
189 void  HLPFILE_BPTreeEnum(BYTE*, HLPFILE_BPTreeCallback cb, void *cookie);