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 IndexSubItem
{
73 typedef struct IndexItem
{
74 struct IndexItem
*next
;
86 typedef struct SearchItem
{
87 struct SearchItem
*next
;
94 typedef struct CHMInfo
96 IITStorage
*pITStorage
;
100 IStream
*strings_stream
;
109 #define TAB_CONTENTS 0
112 #define TAB_FAVORITES 3
133 IOleClientSite
*client_site
;
134 IWebBrowser2
*web_browser
;
135 IOleObject
*wb_object
;
149 LPWSTR pszCustomTabs
;
152 ContentItem
*content
;
160 HHTab tabs
[TAB_FAVORITES
+1];
164 BOOL
InitWebBrowser(HHInfo
*,HWND
);
165 void ReleaseWebBrowser(HHInfo
*);
166 void ResizeWebBrowser(HHInfo
*,DWORD
,DWORD
);
167 void DoPageAction(HHInfo
*,DWORD
);
169 void InitContent(HHInfo
*);
170 void ReleaseContent(HHInfo
*);
172 void InitIndex(HHInfo
*);
173 void ReleaseIndex(HHInfo
*);
175 CHMInfo
*OpenCHM(LPCWSTR szFile
);
176 BOOL
LoadWinTypeFromCHM(HHInfo
*info
);
177 CHMInfo
*CloseCHM(CHMInfo
*pCHMInfo
);
178 void SetChmPath(ChmPath
*,LPCWSTR
,LPCWSTR
);
179 IStream
*GetChmStream(CHMInfo
*,LPCWSTR
,ChmPath
*);
180 LPWSTR
FindContextAlias(CHMInfo
*,DWORD
);
182 HHInfo
*CreateHelpViewer(LPCWSTR
);
183 void ReleaseHelpViewer(HHInfo
*);
184 BOOL
NavigateToUrl(HHInfo
*,LPCWSTR
);
185 BOOL
NavigateToChm(HHInfo
*,LPCWSTR
,LPCWSTR
);
187 void InitSearch(HHInfo
*info
, const char *needle
);
188 void ReleaseSearch(HHInfo
*info
);
190 /* memory allocation functions */
192 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len
)
194 return HeapAlloc(GetProcessHeap(), 0, len
);
197 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len
)
199 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
202 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem
, size_t len
)
204 return HeapReAlloc(GetProcessHeap(), 0, mem
, len
);
207 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem
, size_t len
)
209 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, mem
, len
);
212 static inline BOOL
heap_free(void *mem
)
214 return HeapFree(GetProcessHeap(), 0, mem
);
217 static inline LPWSTR
strdupW(LPCWSTR str
)
225 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
226 ret
= heap_alloc(size
);
227 memcpy(ret
, str
, size
);
232 static inline LPWSTR
strdupnAtoW(LPCSTR str
, LONG lenA
)
242 /* find length of string */
243 LPCSTR eos
= memchr(str
, 0, lenA
);
244 if (eos
) lenA
= eos
- str
;
247 len
= MultiByteToWideChar(CP_ACP
, 0, str
, lenA
, NULL
, 0)+1; /* +1 for null pad */
248 ret
= heap_alloc(len
*sizeof(WCHAR
));
249 MultiByteToWideChar(CP_ACP
, 0, str
, lenA
, ret
, len
);
255 static inline LPWSTR
strdupAtoW(LPCSTR str
)
257 return strdupnAtoW(str
, -1);
262 extern HINSTANCE hhctrl_hinstance
;
263 extern BOOL hh_process
;