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/list.h"
46 #define WB_GOFORWARD 1
58 typedef struct ContentItem
{
59 struct ContentItem
*parent
;
60 struct ContentItem
*child
;
61 struct ContentItem
*next
;
70 typedef struct IndexSubItem
{
75 typedef struct IndexItem
{
76 struct IndexItem
*next
;
88 typedef struct SearchItem
{
89 struct SearchItem
*next
;
96 typedef struct CHMInfo
98 IITStorage
*pITStorage
;
102 IStream
*strings_stream
;
115 #define TAB_CONTENTS 0
118 #define TAB_FAVORITES 3
119 #define TAB_NUMTABS TAB_FAVORITES
140 HIMAGELIST hImageList
;
143 struct wintype_stringsW
{
154 WCHAR
*pszCustomTabs
;
157 struct wintype_stringsA
{
172 IOleClientSite IOleClientSite_iface
;
173 IOleInPlaceSite IOleInPlaceSite_iface
;
174 IOleInPlaceFrame IOleInPlaceFrame_iface
;
175 IDocHostUIHandler IDocHostUIHandler_iface
;
180 IWebBrowser2
*web_browser
;
182 } WebBrowserContainer
;
185 WebBrowserContainer
*web_browser
;
189 struct wintype_stringsA stringsA
;
190 struct wintype_stringsW stringsW
;
194 ContentItem
*content
;
198 ContentsTab contents
;
203 HHTab tabs
[TAB_FAVORITES
+1];
204 int viewer_initialized
;
208 BOOL
InitWebBrowser(HHInfo
*,HWND
);
209 void ReleaseWebBrowser(HHInfo
*);
210 void ResizeWebBrowser(HHInfo
*,DWORD
,DWORD
);
211 void DoPageAction(WebBrowserContainer
*,DWORD
);
213 void InitContent(HHInfo
*);
214 void ReleaseContent(HHInfo
*);
215 void ActivateContentTopic(HWND
,LPCWSTR
,ContentItem
*);
217 void InitIndex(HHInfo
*);
218 void ReleaseIndex(HHInfo
*);
220 CHMInfo
*OpenCHM(LPCWSTR szFile
);
221 BOOL
LoadWinTypeFromCHM(HHInfo
*info
);
222 CHMInfo
*CloseCHM(CHMInfo
*pCHMInfo
);
223 void SetChmPath(ChmPath
*,LPCWSTR
,LPCWSTR
);
224 IStream
*GetChmStream(CHMInfo
*,LPCWSTR
,ChmPath
*);
225 LPWSTR
FindContextAlias(CHMInfo
*,DWORD
);
226 WCHAR
*GetDocumentTitle(CHMInfo
*,LPCWSTR
);
228 extern struct list window_list
;
229 HHInfo
*CreateHelpViewer(HHInfo
*,LPCWSTR
,HWND
);
230 void ReleaseHelpViewer(HHInfo
*);
231 BOOL
NavigateToUrl(HHInfo
*,LPCWSTR
);
232 BOOL
NavigateToChm(HHInfo
*,LPCWSTR
,LPCWSTR
);
233 void MergeChmProperties(HH_WINTYPEW
*,HHInfo
*,BOOL
);
234 void UpdateHelpWindow(HHInfo
*info
);
236 void InitSearch(HHInfo
*info
, const char *needle
);
237 void ReleaseSearch(HHInfo
*info
);
239 LPCWSTR
skip_schema(LPCWSTR url
);
240 void wintype_stringsA_free(struct wintype_stringsA
*stringsA
);
241 void wintype_stringsW_free(struct wintype_stringsW
*stringsW
);
242 WCHAR
*decode_html(const char *html_fragment
, int html_fragment_len
, UINT code_page
);
243 HHInfo
*find_window(const WCHAR
*window
);
245 /* memory allocation functions */
247 static inline LPWSTR
strdupnAtoW(LPCSTR str
, LONG lenA
)
257 /* find length of string */
258 LPCSTR eos
= memchr(str
, 0, lenA
);
259 if (eos
) lenA
= eos
- str
;
262 len
= MultiByteToWideChar(CP_ACP
, 0, str
, lenA
, NULL
, 0)+1; /* +1 for null pad */
263 ret
= malloc(len
* sizeof(WCHAR
));
264 MultiByteToWideChar(CP_ACP
, 0, str
, lenA
, ret
, len
);
270 static inline LPWSTR
strdupAtoW(LPCSTR str
)
272 return strdupnAtoW(str
, -1);
275 static inline LPSTR
strdupWtoA(LPCWSTR str
)
283 len
= WideCharToMultiByte(CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
285 WideCharToMultiByte(CP_ACP
, 0, str
, -1, ret
, len
, NULL
, NULL
);
290 extern HINSTANCE hhctrl_hinstance
;
291 extern BOOL hh_process
;