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
41 #include "wine/itss.h"
42 #include "wine/unicode.h"
45 #define WB_GOFORWARD 1
56 typedef struct ContentItem {
57 struct ContentItem *parent;
58 struct ContentItem *child;
59 struct ContentItem *next;
68 typedef struct CHMInfo
70 IITStorage *pITStorage;
74 IStream *strings_stream;
79 #define TAB_CONTENTS 0
82 #define TAB_FAVORITES 3
90 IOleClientSite *client_site;
91 IWebBrowser2 *web_browser;
92 IOleObject *wb_object;
106 LPWSTR pszCustomTabs;
109 ContentItem *content;
114 HHTab tabs[TAB_FAVORITES+1];
118 BOOL InitWebBrowser(HHInfo*,HWND);
119 void ReleaseWebBrowser(HHInfo*);
120 void ResizeWebBrowser(HHInfo*,DWORD,DWORD);
121 void DoPageAction(HHInfo*,DWORD);
123 void InitContent(HHInfo*);
124 void ReleaseContent(HHInfo*);
126 CHMInfo *OpenCHM(LPCWSTR szFile);
127 BOOL LoadWinTypeFromCHM(HHInfo *info);
128 CHMInfo *CloseCHM(CHMInfo *pCHMInfo);
129 void SetChmPath(ChmPath*,LPCWSTR,LPCWSTR);
130 IStream *GetChmStream(CHMInfo*,LPCWSTR,ChmPath*);
131 LPWSTR FindContextAlias(CHMInfo*,DWORD);
133 HHInfo *CreateHelpViewer(LPCWSTR);
134 void ReleaseHelpViewer(HHInfo*);
135 BOOL NavigateToUrl(HHInfo*,LPCWSTR);
136 BOOL NavigateToChm(HHInfo*,LPCWSTR,LPCWSTR);
138 /* memory allocation functions */
140 static inline void *heap_alloc(size_t len)
142 return HeapAlloc(GetProcessHeap(), 0, len);
145 static inline void *heap_alloc_zero(size_t len)
147 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
150 static inline void *heap_realloc(void *mem, size_t len)
152 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
155 static inline void *heap_realloc_zero(void *mem, size_t len)
157 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
160 static inline BOOL heap_free(void *mem)
162 return HeapFree(GetProcessHeap(), 0, mem);
165 static inline LPWSTR strdupW(LPCWSTR str)
173 size = (strlenW(str)+1)*sizeof(WCHAR);
174 ret = heap_alloc(size);
175 memcpy(ret, str, size);
180 static inline LPWSTR strdupAtoW(LPCSTR str)
188 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
189 ret = heap_alloc(len*sizeof(WCHAR));
190 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
195 extern HINSTANCE hhctrl_hinstance;
196 extern BOOL hh_process;