Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members

chmfile.h

00001 /*
00002 
00003   Copyright (C) 2003  Razvan Cojocaru <razvanco@gmx.net>
00004  
00005   This program is free software; you can redistribute it and/or modify
00006   it under the terms of the GNU General Public License as published by
00007   the Free Software Foundation; either version 2 of the License, or
00008   (at your option) any later version.
00009   
00010   This program is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013   GNU General Public License for more details.
00014   
00015   You should have received a copy of the GNU General Public License
00016   along with this program; if not, write to the Free Software
00017   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 
00019 */
00020 
00021 
00022 #ifndef __CHMFILE_H_
00023 #define __CHMFILE_H_
00024 
00025 #include <chm_lib.h>
00026 #include <wx/string.h>
00027 #include <wx/treectrl.h>
00028 #include <wx/listbox.h>
00029 #include <wx/hashmap.h>
00030 
00031 
00033 WX_DECLARE_STRING_HASH_MAP(wxString, CHMSearchResults);
00034 
00035 
00037 class CHMFile {
00038 public:
00040         CHMFile();
00041         
00047         CHMFile(const wxString& archiveName);
00048 
00050         ~CHMFile();
00051 
00052         
00059         wxString HomePage() const { return _home; }
00060 
00068         wxString TopicsFile() const { return _topicsFile; }
00069 
00076         wxString ArchiveName() const { return _filename; }
00077 
00085         wxString IndexFile() const { return _indexFile; }
00086 
00092         wxString Title() const { return _title; }
00093 
00099         wxString DefaultFont() const { return _font; }
00100 
00107         bool IsOk() const { return _chmFile != NULL; }
00108 
00109 
00115         bool LoadCHM(const wxString& archiveName);
00116 
00118         void CloseCHM();
00119 
00129         bool GetTopicsTree(wxTreeCtrl *toBuild);
00130 
00131 
00142         bool IndexSearch(const wxString& text, bool wholeWords, 
00143                          bool titlesOnly, CHMSearchResults *results);
00144 
00155         bool ResolveObject(const wxString& fileName, chmUnitInfo *ui);
00156 
00166         size_t RetrieveObject(chmUnitInfo *ui, unsigned char *buffer,
00167                               off_t fileOffset, size_t bufferSize);
00168 
00169 private:
00171         bool GetArchiveInfo();
00172 
00174         u_int32_t GetLeafNodeOffset(const wxString& text,
00175                                     u_int32_t initalOffset,
00176                                     u_int32_t buffSize,
00177                                     u_int16_t treeDepth,
00178                                     chmUnitInfo *ui);
00179 
00181         bool ProcessWLC(u_int64_t wlc_count, u_int64_t wlc_size,
00182                         u_int32_t wlc_offset, unsigned char ds,
00183                         unsigned char dr, unsigned char cs,
00184                         unsigned char cr, unsigned char ls,
00185                         unsigned char lr, chmUnitInfo *uifmain,
00186                         chmUnitInfo* uitbl, chmUnitInfo *uistrings,
00187                         chmUnitInfo* topics, chmUnitInfo *urlstr,
00188                         CHMSearchResults *results);
00189 
00190 private:
00191         chmFile* _chmFile;
00192         wxString _filename;
00193         wxString _home;
00194         wxString _topicsFile;
00195         wxString _indexFile;
00196         wxString _title;
00197         wxString _font;
00198 
00199 private:
00201         CHMFile(const CHMFile&);
00202 
00204         CHMFile& operator=(const CHMFile&);
00205 };
00206 
00207 
00208 #endif // __CHMFILE_H_

Generated on Thu Oct 2 11:14:59 2003 for xCHM by doxygen 1.3.3