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
57 typedef struct ContentItem
{
58 struct ContentItem
*parent
;
59 struct ContentItem
*child
;
60 struct ContentItem
*next
;
69 typedef struct IndexSubItem
{
74 typedef struct IndexItem
{
75 struct IndexItem
*next
;
87 typedef struct SearchItem
{
88 struct SearchItem
*next
;
95 typedef struct CHMInfo
97 IITStorage
*pITStorage
;
101 IStream
*strings_stream
;
111 #define TAB_CONTENTS 0
114 #define TAB_FAVORITES 3
115 #define TAB_NUMTABS TAB_FAVORITES
136 IOleClientSite
*client_site
;
137 IWebBrowser2
*web_browser
;
138 IOleObject
*wb_object
;
152 LPWSTR pszCustomTabs
;
155 ContentItem
*content
;
163 HHTab tabs
[TAB_FAVORITES
+1];
167 BOOL
InitWebBrowser(HHInfo
*,HWND
) DECLSPEC_HIDDEN
;
168 void ReleaseWebBrowser(HHInfo
*) DECLSPEC_HIDDEN
;
169 void ResizeWebBrowser(HHInfo
*,DWORD
,DWORD
) DECLSPEC_HIDDEN
;
170 void DoPageAction(HHInfo
*,DWORD
) DECLSPEC_HIDDEN
;
172 void InitContent(HHInfo
*) DECLSPEC_HIDDEN
;
173 void ReleaseContent(HHInfo
*) DECLSPEC_HIDDEN
;
174 void ActivateContentTopic(HWND
,LPCWSTR
,ContentItem
*) DECLSPEC_HIDDEN
;
176 void InitIndex(HHInfo
*) DECLSPEC_HIDDEN
;
177 void ReleaseIndex(HHInfo
*) DECLSPEC_HIDDEN
;
179 CHMInfo
*OpenCHM(LPCWSTR szFile
) DECLSPEC_HIDDEN
;
180 BOOL
LoadWinTypeFromCHM(HHInfo
*info
) DECLSPEC_HIDDEN
;
181 CHMInfo
*CloseCHM(CHMInfo
*pCHMInfo
) DECLSPEC_HIDDEN
;
182 void SetChmPath(ChmPath
*,LPCWSTR
,LPCWSTR
) DECLSPEC_HIDDEN
;
183 IStream
*GetChmStream(CHMInfo
*,LPCWSTR
,ChmPath
*) DECLSPEC_HIDDEN
;
184 LPWSTR
FindContextAlias(CHMInfo
*,DWORD
) DECLSPEC_HIDDEN
;
186 HHInfo
*CreateHelpViewer(LPCWSTR
) DECLSPEC_HIDDEN
;
187 void ReleaseHelpViewer(HHInfo
*) DECLSPEC_HIDDEN
;
188 BOOL
NavigateToUrl(HHInfo
*,LPCWSTR
) DECLSPEC_HIDDEN
;
189 BOOL
NavigateToChm(HHInfo
*,LPCWSTR
,LPCWSTR
) DECLSPEC_HIDDEN
;
191 void InitSearch(HHInfo
*info
, const char *needle
) DECLSPEC_HIDDEN
;
192 void ReleaseSearch(HHInfo
*info
) DECLSPEC_HIDDEN
;
194 LPCWSTR
skip_schema(LPCWSTR url
) DECLSPEC_HIDDEN
;
196 /* memory allocation functions */
198 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len
)
200 return HeapAlloc(GetProcessHeap(), 0, len
);
203 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len
)
205 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
208 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem
, size_t len
)
210 return HeapReAlloc(GetProcessHeap(), 0, mem
, len
);
213 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem
, size_t len
)
215 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, mem
, len
);
218 static inline BOOL
heap_free(void *mem
)
220 return HeapFree(GetProcessHeap(), 0, mem
);
223 static inline LPWSTR
strdupW(LPCWSTR str
)
231 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
232 ret
= heap_alloc(size
);
233 memcpy(ret
, str
, size
);
238 static inline LPWSTR
strdupnAtoW(LPCSTR str
, LONG lenA
)
248 /* find length of string */
249 LPCSTR eos
= memchr(str
, 0, lenA
);
250 if (eos
) lenA
= eos
- str
;
253 len
= MultiByteToWideChar(CP_ACP
, 0, str
, lenA
, NULL
, 0)+1; /* +1 for null pad */
254 ret
= heap_alloc(len
*sizeof(WCHAR
));
255 MultiByteToWideChar(CP_ACP
, 0, str
, lenA
, ret
, len
);
261 static inline LPWSTR
strdupAtoW(LPCSTR str
)
263 return strdupnAtoW(str
, -1);
268 extern HINSTANCE hhctrl_hinstance DECLSPEC_HIDDEN
;
269 extern BOOL hh_process DECLSPEC_HIDDEN
;