00001 #ifndef __CHM_h 00002 #define __CHM_h 00003 #include <stdio.h> 00004 #include <sys/stat.h> 00005 #include "CExpander.h" 00006 #include "chm_lib.h" 00007 #include "my_list.h" 00008 #include "CExpander.h" 00009 00010 struct Ref { 00011 QString RefName; 00012 QString RefLoc; 00013 int beginpos; 00014 int endpos; 00015 }; 00016 00017 struct Pic { 00018 QString RefName; 00019 QString RefLoc; 00020 int beginpos; 00021 int endpos; 00022 }; 00023 00024 class CHM : public CExpander 00025 { 00026 void start2endSection(); 00027 struct chmUnitInfo m_ui; 00028 struct chmFile *chmFile; 00029 chmUnitInfo chmui; 00030 //alloc a meg to buffer 00031 QString chmHomeBuffer; 00032 QString chmBuffer; 00033 QString chmPath; 00034 QString chmHHCPath; 00035 unsigned int bufpos; 00036 unsigned long fsize; 00037 unsigned long m_homestart, m_homeend; 00038 public: 00039 void suspend(); 00040 void unsuspend(); 00041 bool hasnavigation() { return true; } 00042 00043 CHM(); 00044 virtual ~CHM(); 00045 int OpenFile(const char *src); 00046 int getch(); 00047 unsigned int locate(); 00048 void locate(unsigned int n); 00049 bool hasrandomaccess() { return true; } 00050 void sizes(unsigned long& _file, unsigned long& _text); 00051 void addContent(QString content); 00052 void getch(tchar& ch, CStyle& sty); 00053 void setPath(QString PathName) {chmPath = PathName;}; 00054 void setHomePath(QString PathName) {chmHHCPath = PathName;}; 00055 00056 MarkupType PreferredMarkup() { 00057 return cCHM; 00058 } 00059 bool getFile(const QString& href, const QString& nm); 00060 QImage *getPicture(const QString& href); 00061 QString about() { return QString("CHM codec (c) Bob Griffin\nchm_lib (c) Jed Wing\nLZX code (c) Stuart Cale"); } 00062 private : 00063 bool FillBuffer(); 00064 bool FillContent(); 00065 void FillHomeContent(); 00066 }; 00067 #endif
1.4.2