OSDN Git Service

505a0a54073872f58c2ae5aa3698c2f75d8aca8e
[kita/kita.git] / kita / src / domtree.h
1 /***************************************************************************
2  *   Copyright (C) 2004, 2007 by Kita Developers                           *
3  *   ikemo@users.sourceforge.jp                                            *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  ***************************************************************************/
10 #ifndef KITADOMTREE_H
11 #define KITADOMTREE_H
12
13 #include <QtCore/QVector>
14
15 #include <dom/html_block.h>
16 #include <dom/html_document.h>
17
18 namespace Kita
19 {
20     class DatInfo;
21
22     class DomTree
23     {
24         DomTree(const DomTree&);
25         DomTree& operator=(const DomTree&);
26
27         DatInfo* m_datInfo;
28         int m_bufSize;
29
30         /* bottom number of shown.
31          * probably m_bottomNum == m_datInfo->getReadNum
32          */
33         int m_bottomNum;
34
35         /* return val of DatInfo::getHTML(). See datinfo.h */
36         QVector<int> m_resStatus;
37         QVector<bool> m_coloredNum; /* colored number */
38
39         /* DOM elements */
40         DOM::HTMLDocument m_hdoc; /* root node of document*/
41         /* the vector of the element of response */
42         QVector<DOM::HTMLDivElement> m_titleElm;
43         /* the vector of the element of response */
44         QVector<DOM::HTMLDivElement> m_bodyElm; 
45         DOM::Element m_header;
46         DOM::Element m_footer;
47         DOM::Element m_kokoyon;
48
49     public:
50         DomTree(const DOM::HTMLDocument& hdoc, const KUrl& datUrl);
51         ~DomTree();
52
53         /* rendering functions */
54
55         bool createResElement(int num);
56         bool appendRes(int num);
57         void redraw(bool force);
58         void changeColorOfAllResponsedNumber();
59
60         /* information */
61
62         int getBottomResNumber() const;
63
64         /* header Node, footer Node, kokomadeyonda Node, etc... */
65
66        void appendFooterAndHeader();
67        void appendKokoyon();
68
69     private:
70         void appendAnchorNode(const DOM::Element& root, const QString& linkstr,
71                 const QString& comment);
72         void updateHeader(DOM::Element& targetelm);
73         void updateFooter(DOM::Element& targetelm);
74         void createHeader();
75         void createFooter();
76         void createKokoyon();
77         void changeColorOfNumber(int num);
78     };
79 }
80
81 #endif