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
42 #include "wine/itss.h"
43 #include "wine/heap.h"
44 #include "wine/list.h"
47 #define WB_GOFORWARD 1
59 typedef struct ContentItem
{
60 struct ContentItem
*parent
;
61 struct ContentItem
*child
;
62 struct ContentItem
*next
;
71 typedef struct IndexSubItem
{
76 typedef struct IndexItem
{
77 struct IndexItem
*next
;
89 typedef struct SearchItem
{
90 struct SearchItem
*next
;
97 typedef struct CHMInfo
99 IITStorage
*pITStorage
;
103 IStream
*strings_stream
;
116 #define TAB_CONTENTS 0
119 #define TAB_FAVORITES 3
120 #define TAB_NUMTABS TAB_FAVORITES
141 HIMAGELIST hImageList
;
144 struct wintype_stringsW
{
155 WCHAR
*pszCustomTabs
;
158 struct wintype_stringsA
{
173 IOleClientSite IOleClientSite_iface
;
174 IOleInPlaceSite IOleInPlaceSite_iface
;
175 IOleInPlaceFrame IOleInPlaceFrame_iface
;
176 IDocHostUIHandler IDocHostUIHandler_iface
;
181 IWebBrowser2
*web_browser
;
183 } WebBrowserContainer
;
186 WebBrowserContainer
*web_browser
;
190 struct wintype_stringsA stringsA
;
191 struct wintype_stringsW stringsW
;
195 ContentItem
*content
;
199 ContentsTab contents
;
204 HHTab tabs
[TAB_FAVORITES
+1];
205 int viewer_initialized
;
209 BOOL
InitWebBrowser(HHInfo
*,HWND
) DECLSPEC_HIDDEN
;
210 void ReleaseWebBrowser(HHInfo
*) DECLSPEC_HIDDEN
;
211 void ResizeWebBrowser(HHInfo
*,DWORD
,DWORD
) DECLSPEC_HIDDEN
;
212 void DoPageAction(WebBrowserContainer
*,DWORD
) DECLSPEC_HIDDEN
;
214 void InitContent(HHInfo
*) DECLSPEC_HIDDEN
;
215 void ReleaseContent(HHInfo
*) DECLSPEC_HIDDEN
;
216 void ActivateContentTopic(HWND
,LPCWSTR
,ContentItem
*) DECLSPEC_HIDDEN
;
218 void InitIndex(HHInfo
*) DECLSPEC_HIDDEN
;
219 void ReleaseIndex(HHInfo
*) DECLSPEC_HIDDEN
;
221 CHMInfo
*OpenCHM(LPCWSTR szFile
) DECLSPEC_HIDDEN
;
222 BOOL
LoadWinTypeFromCHM(HHInfo
*info
) DECLSPEC_HIDDEN
;
223 CHMInfo
*CloseCHM(CHMInfo
*pCHMInfo
) DECLSPEC_HIDDEN
;
224 void SetChmPath(ChmPath
*,LPCWSTR
,LPCWSTR
) DECLSPEC_HIDDEN
;
225 IStream
*GetChmStream(CHMInfo
*,LPCWSTR
,ChmPath
*) DECLSPEC_HIDDEN
;
226 LPWSTR
FindContextAlias(CHMInfo
*,DWORD
) DECLSPEC_HIDDEN
;
227 WCHAR
*GetDocumentTitle(CHMInfo
*,LPCWSTR
) DECLSPEC_HIDDEN
;
229 extern struct list window_list DECLSPEC_HIDDEN
;
230 HHInfo
*CreateHelpViewer(HHInfo
*,LPCWSTR
,HWND
) DECLSPEC_HIDDEN
;
231 void ReleaseHelpViewer(HHInfo
*) DECLSPEC_HIDDEN
;
232 BOOL
NavigateToUrl(HHInfo
*,LPCWSTR
) DECLSPEC_HIDDEN
;
233 BOOL
NavigateToChm(HHInfo
*,LPCWSTR
,LPCWSTR
) DECLSPEC_HIDDEN
;
234 void MergeChmProperties(HH_WINTYPEW
*,HHInfo
*,BOOL
) DECLSPEC_HIDDEN
;
235 void UpdateHelpWindow(HHInfo
*info
) DECLSPEC_HIDDEN
;
237 void InitSearch(HHInfo
*info
, const char *needle
) DECLSPEC_HIDDEN
;
238 void ReleaseSearch(HHInfo
*info
) DECLSPEC_HIDDEN
;
240 LPCWSTR
skip_schema(LPCWSTR url
) DECLSPEC_HIDDEN
;
241 void wintype_stringsA_free(struct wintype_stringsA
*stringsA
) DECLSPEC_HIDDEN
;
242 void wintype_stringsW_free(struct wintype_stringsW
*stringsW
) DECLSPEC_HIDDEN
;
243 WCHAR
*decode_html(const char *html_fragment
, int html_fragment_len
, UINT code_page
) DECLSPEC_HIDDEN
;
244 HHInfo
*find_window(const WCHAR
*window
) DECLSPEC_HIDDEN
;
246 /* memory allocation functions */
248 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem
, size_t len
)
250 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, mem
, len
);
253 static inline LPWSTR
strdupW(LPCWSTR str
)
261 size
= (lstrlenW(str
)+1)*sizeof(WCHAR
);
262 ret
= heap_alloc(size
);
263 memcpy(ret
, str
, size
);
268 static inline LPWSTR
strdupnAtoW(LPCSTR str
, LONG lenA
)
278 /* find length of string */
279 LPCSTR eos
= memchr(str
, 0, lenA
);
280 if (eos
) lenA
= eos
- str
;
283 len
= MultiByteToWideChar(CP_ACP
, 0, str
, lenA
, NULL
, 0)+1; /* +1 for null pad */
284 ret
= heap_alloc(len
*sizeof(WCHAR
));
285 MultiByteToWideChar(CP_ACP
, 0, str
, lenA
, ret
, len
);
291 static inline LPWSTR
strdupAtoW(LPCSTR str
)
293 return strdupnAtoW(str
, -1);
296 static inline LPSTR
strdupWtoA(LPCWSTR str
)
304 len
= WideCharToMultiByte(CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
305 ret
= heap_alloc(len
);
306 WideCharToMultiByte(CP_ACP
, 0, str
, -1, ret
, len
, NULL
, NULL
);
311 extern HINSTANCE hhctrl_hinstance DECLSPEC_HIDDEN
;
312 extern BOOL hh_process DECLSPEC_HIDDEN
;