msi: Stub Migrate10CachedPackagesW.
[wine/multimedia.git] / dlls / hhctrl.ocx / hhctrl.h
blobbfc6618c7d006d7732dd2c3fe4ebaf36e2f29df8
1 /*
2 * Copyright 2005 James Hawkins
3 * Copyright 2007 Jacek Caban for CodeWeavers
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #ifndef HHCTRL_H
21 #define HHCTRL_H
23 #include <stdarg.h>
25 #define COBJMACROS
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winuser.h"
30 #include "winnls.h"
31 #include "htmlhelp.h"
32 #include "ole2.h"
33 #include "exdisp.h"
34 #include "mshtmhst.h"
35 #include "commctrl.h"
37 #ifdef INIT_GUID
38 #include "initguid.h"
39 #endif
41 #include "wine/itss.h"
42 #include "wine/unicode.h"
43 #include "wine/list.h"
45 #define WB_GOBACK 0
46 #define WB_GOFORWARD 1
47 #define WB_GOHOME 2
48 #define WB_SEARCH 3
49 #define WB_REFRESH 4
50 #define WB_STOP 5
51 #define WB_PRINT 6
53 typedef struct {
54 LPWSTR chm_file;
55 LPWSTR chm_index;
56 } ChmPath;
58 typedef struct ContentItem {
59 struct ContentItem *parent;
60 struct ContentItem *child;
61 struct ContentItem *next;
63 HTREEITEM id;
65 LPWSTR name;
66 LPWSTR local;
67 ChmPath merge;
68 } ContentItem;
70 typedef struct IndexSubItem {
71 LPWSTR name;
72 LPWSTR local;
73 } IndexSubItem;
75 typedef struct IndexItem {
76 struct IndexItem *next;
78 HTREEITEM id;
79 LPWSTR keyword;
80 ChmPath merge;
82 int nItems;
83 int itemFlags;
84 int indentLevel;
85 IndexSubItem *items;
86 } IndexItem;
88 typedef struct SearchItem {
89 struct SearchItem *next;
91 HTREEITEM id;
92 LPWSTR title;
93 LPWSTR filename;
94 } SearchItem;
96 typedef struct CHMInfo
98 IITStorage *pITStorage;
99 IStorage *pStorage;
100 WCHAR *szFile;
102 IStream *strings_stream;
103 char **strings;
104 DWORD strings_size;
106 WCHAR *compiledFile;
107 WCHAR *defWindow;
108 WCHAR *defTopic;
109 WCHAR *defTitle;
110 WCHAR *defToc;
112 UINT codePage;
113 } CHMInfo;
115 #define TAB_CONTENTS 0
116 #define TAB_INDEX 1
117 #define TAB_SEARCH 2
118 #define TAB_FAVORITES 3
119 #define TAB_NUMTABS TAB_FAVORITES
121 typedef struct {
122 HWND hwnd;
123 DWORD id;
124 } HHTab;
126 typedef struct {
127 HWND hwndList;
128 HWND hwndPopup;
129 HWND hwndCallback;
130 } IndexPopup;
132 typedef struct {
133 SearchItem *root;
134 HWND hwndEdit;
135 HWND hwndList;
136 HWND hwndContainer;
137 } SearchTab;
139 typedef struct {
140 HIMAGELIST hImageList;
141 } ContentsTab;
143 typedef struct {
144 IOleClientSite *client_site;
145 IWebBrowser2 *web_browser;
146 IOleObject *wb_object;
148 HH_WINTYPEW WinType;
150 LPWSTR pszType;
151 LPWSTR pszCaption;
152 LPWSTR pszToc;
153 LPWSTR pszIndex;
154 LPWSTR pszFile;
155 LPWSTR pszHome;
156 LPWSTR pszJump1;
157 LPWSTR pszJump2;
158 LPWSTR pszUrlJump1;
159 LPWSTR pszUrlJump2;
160 LPWSTR pszCustomTabs;
162 struct list entry;
163 CHMInfo *pCHMInfo;
164 ContentItem *content;
165 IndexItem *index;
166 IndexPopup popup;
167 SearchTab search;
168 ContentsTab contents;
169 HWND hwndTabCtrl;
170 HWND hwndSizeBar;
171 HFONT hFont;
173 HHTab tabs[TAB_FAVORITES+1];
174 DWORD current_tab;
175 } HHInfo;
177 BOOL InitWebBrowser(HHInfo*,HWND) DECLSPEC_HIDDEN;
178 void ReleaseWebBrowser(HHInfo*) DECLSPEC_HIDDEN;
179 void ResizeWebBrowser(HHInfo*,DWORD,DWORD) DECLSPEC_HIDDEN;
180 void DoPageAction(HHInfo*,DWORD) DECLSPEC_HIDDEN;
182 void InitContent(HHInfo*) DECLSPEC_HIDDEN;
183 void ReleaseContent(HHInfo*) DECLSPEC_HIDDEN;
184 void ActivateContentTopic(HWND,LPCWSTR,ContentItem *) DECLSPEC_HIDDEN;
186 void InitIndex(HHInfo*) DECLSPEC_HIDDEN;
187 void ReleaseIndex(HHInfo*) DECLSPEC_HIDDEN;
189 CHMInfo *OpenCHM(LPCWSTR szFile) DECLSPEC_HIDDEN;
190 BOOL LoadWinTypeFromCHM(HHInfo *info) DECLSPEC_HIDDEN;
191 CHMInfo *CloseCHM(CHMInfo *pCHMInfo) DECLSPEC_HIDDEN;
192 void SetChmPath(ChmPath*,LPCWSTR,LPCWSTR) DECLSPEC_HIDDEN;
193 IStream *GetChmStream(CHMInfo*,LPCWSTR,ChmPath*) DECLSPEC_HIDDEN;
194 LPWSTR FindContextAlias(CHMInfo*,DWORD) DECLSPEC_HIDDEN;
195 WCHAR *GetDocumentTitle(CHMInfo*,LPCWSTR) DECLSPEC_HIDDEN;
197 HHInfo *CreateHelpViewer(LPCWSTR,HWND) DECLSPEC_HIDDEN;
198 void ReleaseHelpViewer(HHInfo*) DECLSPEC_HIDDEN;
199 BOOL NavigateToUrl(HHInfo*,LPCWSTR) DECLSPEC_HIDDEN;
200 BOOL NavigateToChm(HHInfo*,LPCWSTR,LPCWSTR) DECLSPEC_HIDDEN;
202 void InitSearch(HHInfo *info, const char *needle) DECLSPEC_HIDDEN;
203 void ReleaseSearch(HHInfo *info) DECLSPEC_HIDDEN;
205 LPCWSTR skip_schema(LPCWSTR url) DECLSPEC_HIDDEN;
207 WCHAR *decode_html(const char *html_fragment, int html_fragment_len, UINT code_page);
209 /* memory allocation functions */
211 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
213 return HeapAlloc(GetProcessHeap(), 0, len);
216 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
218 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
221 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
223 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
226 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
228 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
231 static inline BOOL heap_free(void *mem)
233 return HeapFree(GetProcessHeap(), 0, mem);
236 static inline LPWSTR strdupW(LPCWSTR str)
238 LPWSTR ret;
239 int size;
241 if(!str)
242 return NULL;
244 size = (strlenW(str)+1)*sizeof(WCHAR);
245 ret = heap_alloc(size);
246 memcpy(ret, str, size);
248 return ret;
251 static inline LPWSTR strdupnAtoW(LPCSTR str, LONG lenA)
253 LPWSTR ret;
254 DWORD len;
256 if(!str)
257 return NULL;
259 if (lenA > 0)
261 /* find length of string */
262 LPCSTR eos = memchr(str, 0, lenA);
263 if (eos) lenA = eos - str;
266 len = MultiByteToWideChar(CP_ACP, 0, str, lenA, NULL, 0)+1; /* +1 for null pad */
267 ret = heap_alloc(len*sizeof(WCHAR));
268 MultiByteToWideChar(CP_ACP, 0, str, lenA, ret, len);
269 ret[len-1] = 0;
271 return ret;
274 static inline LPWSTR strdupAtoW(LPCSTR str)
276 return strdupnAtoW(str, -1);
281 extern HINSTANCE hhctrl_hinstance DECLSPEC_HIDDEN;
282 extern BOOL hh_process DECLSPEC_HIDDEN;
284 #endif