summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/CHM.h
blob: 291818de85ffe519aa04e820f473c7e639481c43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef __CHM_h
#define __CHM_h
#include <stdio.h>
#include <sys/stat.h>
#include "CExpander.h"
#include "chm_lib.h"
#include "my_list.h"
#include "CExpander.h"

struct Ref {
    QString RefName;
    QString RefLoc;
    int beginpos;
    int endpos;
};

struct Pic {
    QString RefName;
    QString RefLoc;
    int beginpos;
    int endpos;
};

class CHM : public CExpander
{
  void start2endSection();
  struct chmUnitInfo m_ui;
  struct chmFile *chmFile;
  chmUnitInfo chmui;
  //alloc a meg to buffer
  QString chmHomeBuffer;
  QString chmBuffer;
  QString chmPath;
  QString chmHHCPath;
  unsigned int bufpos;
  unsigned long fsize;
  unsigned long m_homestart, m_homeend;
public:
    void suspend();
    void unsuspend();
    bool hasnavigation() { return true; }

    CHM();
    virtual ~CHM();
    int OpenFile(const char *src);
    int getch();
    unsigned int locate();
    void locate(unsigned int n);
    bool hasrandomaccess() { return true; }
    void sizes(unsigned long& _file, unsigned long& _text);
    void addContent(QString content);
    void getch(tchar& ch, CStyle& sty);
    void setPath(QString PathName) {chmPath = PathName;};
    void setHomePath(QString PathName) {chmHHCPath = PathName;};

    MarkupType PreferredMarkup() {
        return cCHM;
    }
    bool getFile(const QString& href, const QString& nm);
    QImage *getPicture(const QString& href);
    QString about() { return QString("CHM codec (c) Bob Griffin\nchm_lib (c) Jed Wing\nLZX code (c) Stuart Cale"); }
private :
    bool FillBuffer();
    bool FillContent();
    void FillHomeContent();
};
#endif