1996-05-06 18:06:24 +02:00
|
|
|
/*
|
|
|
|
* Help Viewer
|
|
|
|
*
|
2002-07-16 03:46:29 +02:00
|
|
|
* Copyright 1996 Ulrich Schmid
|
2008-04-18 21:33:57 +02:00
|
|
|
* 2002, 2008 Eric Pouech
|
2007-12-12 22:57:45 +01:00
|
|
|
* 2007 Kirill K. Smirnov
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
1996-05-06 18:06:24 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
struct tagHelpFile;
|
|
|
|
|
2002-11-18 20:48:11 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char type[10];
|
|
|
|
char name[9];
|
|
|
|
char caption[51];
|
|
|
|
POINT origin;
|
|
|
|
SIZE size;
|
|
|
|
int style;
|
|
|
|
DWORD win_style;
|
2002-12-16 23:11:11 +01:00
|
|
|
COLORREF sr_color; /* color for scrollable region */
|
2002-11-18 20:48:11 +01:00
|
|
|
COLORREF nsr_color; /* color for non scrollable region */
|
|
|
|
} HLPFILE_WINDOWINFO;
|
|
|
|
|
2008-04-23 21:38:14 +02:00
|
|
|
typedef struct tagHlpFileLink
|
1996-05-06 18:06:24 +02:00
|
|
|
{
|
2002-12-16 23:11:11 +01:00
|
|
|
enum {hlp_link_link, hlp_link_popup, hlp_link_macro} cookie;
|
2008-04-23 21:38:14 +02:00
|
|
|
LPCSTR string; /* name of the file to for the link (NULL if same file) */
|
|
|
|
LONG hash; /* topic index */
|
2008-05-01 21:17:04 +02:00
|
|
|
unsigned bClrChange : 1; /* true if the link is green & underlined */
|
2009-09-19 12:53:01 +02:00
|
|
|
unsigned bHotSpot : 1; /* true if the link is an hotspot (actually HLPFILE_HOTSPOTLINK) */
|
2002-12-16 23:11:11 +01:00
|
|
|
unsigned window; /* window number for displaying the link (-1 is current) */
|
2008-04-23 21:38:14 +02:00
|
|
|
DWORD cpMin;
|
|
|
|
DWORD cpMax;
|
|
|
|
struct tagHlpFileLink* next;
|
1996-05-06 18:06:24 +02:00
|
|
|
} HLPFILE_LINK;
|
|
|
|
|
2009-09-19 12:53:01 +02:00
|
|
|
typedef struct tagHlpFileHotSpotLink
|
|
|
|
{
|
|
|
|
HLPFILE_LINK link;
|
|
|
|
unsigned x;
|
|
|
|
unsigned y;
|
|
|
|
unsigned width;
|
|
|
|
unsigned height;
|
|
|
|
} HLPFILE_HOTSPOTLINK;
|
|
|
|
|
2002-11-20 20:46:18 +01:00
|
|
|
typedef struct tagHlpFileMacro
|
|
|
|
{
|
|
|
|
LPCSTR lpszMacro;
|
|
|
|
struct tagHlpFileMacro* next;
|
|
|
|
} HLPFILE_MACRO;
|
|
|
|
|
1996-05-06 18:06:24 +02:00
|
|
|
typedef struct tagHlpFilePage
|
|
|
|
{
|
2002-07-16 03:46:29 +02:00
|
|
|
LPSTR lpszTitle;
|
2002-11-20 20:46:18 +01:00
|
|
|
HLPFILE_MACRO* first_macro;
|
2002-07-16 03:46:29 +02:00
|
|
|
|
2008-04-23 21:38:14 +02:00
|
|
|
HLPFILE_LINK* first_link;
|
|
|
|
|
2002-07-16 03:46:29 +02:00
|
|
|
unsigned wNumber;
|
|
|
|
unsigned offset;
|
2008-04-18 21:34:36 +02:00
|
|
|
DWORD reference;
|
2002-07-16 03:46:29 +02:00
|
|
|
struct tagHlpFilePage* next;
|
|
|
|
struct tagHlpFilePage* prev;
|
2002-11-20 20:46:18 +01:00
|
|
|
|
|
|
|
DWORD browse_bwd;
|
|
|
|
DWORD browse_fwd;
|
|
|
|
|
2002-07-16 03:46:29 +02:00
|
|
|
struct tagHlpFileFile* file;
|
1996-05-06 18:06:24 +02:00
|
|
|
} HLPFILE_PAGE;
|
|
|
|
|
2006-10-26 11:21:44 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
LONG lMap;
|
|
|
|
unsigned long offset;
|
|
|
|
} HLPFILE_MAP;
|
|
|
|
|
2002-07-16 03:46:29 +02:00
|
|
|
typedef struct
|
1996-05-06 18:06:24 +02:00
|
|
|
{
|
2012-01-20 12:50:15 +01:00
|
|
|
LOGFONTA LogFont;
|
2002-07-16 03:46:29 +02:00
|
|
|
HFONT hFont;
|
|
|
|
COLORREF color;
|
|
|
|
} HLPFILE_FONT;
|
1996-05-06 18:06:24 +02:00
|
|
|
|
2002-07-16 03:46:29 +02:00
|
|
|
typedef struct tagHlpFileFile
|
|
|
|
{
|
2008-04-18 21:33:57 +02:00
|
|
|
BYTE* file_buffer;
|
|
|
|
UINT file_buffer_size;
|
2002-07-16 03:46:29 +02:00
|
|
|
LPSTR lpszPath;
|
|
|
|
LPSTR lpszTitle;
|
2002-11-13 05:09:34 +01:00
|
|
|
LPSTR lpszCopyright;
|
2002-07-16 03:46:29 +02:00
|
|
|
HLPFILE_PAGE* first_page;
|
2007-12-17 18:46:50 +01:00
|
|
|
HLPFILE_PAGE* last_page;
|
2002-07-16 03:46:29 +02:00
|
|
|
HLPFILE_MACRO* first_macro;
|
2007-12-01 17:01:25 +01:00
|
|
|
BYTE* Context;
|
2007-12-12 22:56:09 +01:00
|
|
|
BYTE* kwbtree;
|
|
|
|
BYTE* kwdata;
|
2006-10-26 11:21:44 +02:00
|
|
|
unsigned wMapLen;
|
|
|
|
HLPFILE_MAP* Map;
|
2008-08-06 17:47:11 +02:00
|
|
|
unsigned wTOMapLen;
|
|
|
|
unsigned* TOMap;
|
2002-11-13 05:09:34 +01:00
|
|
|
unsigned long contents_start;
|
|
|
|
|
2002-07-16 03:46:29 +02:00
|
|
|
struct tagHlpFileFile* prev;
|
|
|
|
struct tagHlpFileFile* next;
|
|
|
|
|
|
|
|
unsigned wRefCount;
|
|
|
|
|
|
|
|
unsigned short version;
|
|
|
|
unsigned short flags;
|
2008-04-23 21:37:58 +02:00
|
|
|
unsigned short charset;
|
2007-12-01 16:57:24 +01:00
|
|
|
unsigned short tbsize; /* topic block size */
|
|
|
|
unsigned short dsize; /* decompress size */
|
|
|
|
unsigned short compressed;
|
2007-12-04 01:22:05 +01:00
|
|
|
unsigned hasPhrases; /* file has |Phrases */
|
|
|
|
unsigned hasPhrases40; /* file has |PhrIndex/|PhrImage */
|
2008-04-18 21:33:57 +02:00
|
|
|
UINT num_phrases;
|
|
|
|
unsigned* phrases_offsets;
|
|
|
|
char* phrases_buffer;
|
|
|
|
|
|
|
|
BYTE** topic_map;
|
|
|
|
BYTE* topic_end;
|
|
|
|
UINT topic_maplen;
|
2002-07-16 03:46:29 +02:00
|
|
|
|
2002-11-13 05:09:34 +01:00
|
|
|
unsigned numBmps;
|
|
|
|
HBITMAP* bmps;
|
|
|
|
|
2002-07-16 03:46:29 +02:00
|
|
|
unsigned numFonts;
|
|
|
|
HLPFILE_FONT* fonts;
|
2002-11-18 20:48:11 +01:00
|
|
|
|
|
|
|
unsigned numWindows;
|
|
|
|
HLPFILE_WINDOWINFO* windows;
|
2008-04-22 22:00:50 +02:00
|
|
|
HICON hIcon;
|
2008-07-12 10:37:01 +02:00
|
|
|
|
2008-07-12 10:37:08 +02:00
|
|
|
BOOL has_popup_color;
|
|
|
|
COLORREF popup_color;
|
|
|
|
|
2008-07-12 10:37:01 +02:00
|
|
|
LPSTR help_on_file;
|
1996-05-06 18:06:24 +02:00
|
|
|
} HLPFILE;
|
|
|
|
|
2007-12-12 22:57:45 +01:00
|
|
|
/*
|
|
|
|
* Compare function type for HLPFILE_BPTreeSearch function.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* p [I] pointer to testing block (key + data)
|
|
|
|
* key [I] pointer to key value to look for
|
|
|
|
* leaf [I] whether this function called for index of leaf page
|
|
|
|
* next [O] pointer to pointer to next block
|
|
|
|
*/
|
|
|
|
typedef int (*HLPFILE_BPTreeCompare)(void *p, const void *key,
|
|
|
|
int leaf, void **next);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Callback function type for HLPFILE_BPTreeEnum function.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* p [I] pointer to data block
|
|
|
|
* next [O] pointer to pointer to next block
|
|
|
|
* cookie [IO] cookie data
|
|
|
|
*/
|
|
|
|
typedef void (*HLPFILE_BPTreeCallback)(void *p, void **next, void *cookie);
|
|
|
|
|
2002-11-20 20:46:18 +01:00
|
|
|
HLPFILE* HLPFILE_ReadHlpFile(LPCSTR lpszPath);
|
2008-04-22 22:00:56 +02:00
|
|
|
HLPFILE_PAGE* HLPFILE_PageByHash(HLPFILE* hlpfile, LONG lHash, ULONG* relative);
|
|
|
|
HLPFILE_PAGE* HLPFILE_PageByMap(HLPFILE* hlpfile, LONG lMap, ULONG* relative);
|
|
|
|
HLPFILE_PAGE* HLPFILE_PageByOffset(HLPFILE* hlpfile, LONG offset, ULONG* relative);
|
1996-05-06 18:06:24 +02:00
|
|
|
LONG HLPFILE_Hash(LPCSTR lpszContext);
|
2002-11-20 20:46:18 +01:00
|
|
|
void HLPFILE_FreeHlpFile(HLPFILE*);
|
2008-04-24 22:05:59 +02:00
|
|
|
|
2007-12-12 22:57:45 +01:00
|
|
|
void HLPFILE_BPTreeEnum(BYTE*, HLPFILE_BPTreeCallback cb, void *cookie);
|
2008-04-18 21:34:36 +02:00
|
|
|
|
2008-04-23 21:37:51 +02:00
|
|
|
struct RtfData {
|
|
|
|
BOOL in_text;
|
|
|
|
char* data; /* RTF stream start */
|
|
|
|
char* ptr; /* current position in stream */
|
|
|
|
unsigned allocated; /* overall allocated size */
|
|
|
|
unsigned char_pos; /* current char position (in richedit) */
|
|
|
|
char* where; /* pointer to feed back richedit */
|
2008-05-01 21:17:29 +02:00
|
|
|
unsigned font_scale; /* how to scale fonts */
|
2008-04-23 21:38:14 +02:00
|
|
|
HLPFILE_LINK*first_link;
|
|
|
|
HLPFILE_LINK*current_link;
|
2008-04-23 21:37:51 +02:00
|
|
|
BOOL force_color;
|
2008-05-01 21:17:41 +02:00
|
|
|
unsigned relative; /* offset within page to lookup for */
|
|
|
|
unsigned char_pos_rel; /* char_pos correspondinf to relative */
|
2008-04-23 21:37:51 +02:00
|
|
|
};
|
|
|
|
|
2008-05-01 21:17:41 +02:00
|
|
|
BOOL HLPFILE_BrowsePage(HLPFILE_PAGE*, struct RtfData* rd,
|
|
|
|
unsigned font_scale, unsigned relative);
|