OSDN Git Service

reformat
[kita/kita.git] / kita / src / part / kitadomtree.h
1 /***************************************************************************
2 *   Copyright (C) 2004 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
11 #ifndef KITADOMTREE_H
12 #define KITADOMTREE_H
13
14 #include <qvaluevector.h>
15 #include <khtml_part.h>
16 #include <dom/html_block.h>
17
18 namespace Kita
19 {
20     class DatInfo;
21 }
22
23 class KitaDomTree
24 {
25     Kita::DatInfo* m_datInfo;
26     int m_bufLng;
27
28     /*
29
30       When readNum = m_datInfo->getReadNum(), the responses are
31
32       No.1 <-- shown --> m_templateNum <-- not shown -->
33       m_topNum <-- shown ---> m_bottomNum <-- not shown --> readNum.
34
35       If m_topNum <= i <= m_bottomNum, then m_resshown[i] = TRUE.
36       
37       If m_bottomNum < i <= readNum, where m_bottomNum < readNum,
38       then m_resshown[i] = FALSE.
39     */
40     int m_templateNum;
41     int m_topNum;
42     int m_bottomNum;
43     int m_headerMaxNum;
44     QValueVector < bool > m_resshown; /* the res is shown */
45     QValueVector < int > m_resStatus; /* return val of DatInfo::getHTML(). See datinfo.h */
46     QValueVector < bool > m_coloredNum; /* colored number */
47
48     /* DOM elements */
49     DOM::HTMLDocument m_hdoc; /* root node of document*/
50     QValueVector < DOM::HTMLDivElement > m_titleElm; /* the vector of the element of response */
51     QValueVector < DOM::HTMLDivElement > m_bodyElm; /* the vector of the element of response */
52     DOM::Element m_header;
53     DOM::Element m_footer;
54     DOM::Element m_kokoyon;
55     DOM::Element m_tugi100;
56     DOM::Element m_mae100;
57
58     /*-------------------------------------------------------------*/
59
60 public:
61
62     KitaDomTree( const DOM::HTMLDocument& hdoc, const KURL& datURL );
63     ~KitaDomTree();
64
65     /* rendering functions */
66
67     bool createResElement( int num );
68     bool appendRes( int num );
69     void redraw( bool force );
70     void changeColorOfAllResponsedNumber();
71
72     /* information */
73
74     const bool isResShown( int num ) const;
75     const int getTopResNumber() const;
76     const int getBottomResNumber() const;
77     const int getTemplateNumber() const;
78     const bool isMae100Shown() const;
79
80     /* header Node, footer Node, kokomadeyonda Node, etc... */
81
82     void appendTemplate( int tmnNum );
83     void appendFooterAndHeader();
84
85     void appendKokoyon();
86
87     void appendTugi100();
88     void removeTugi100();
89
90     void appendMae100();
91     void removeMae100();
92
93     void createCommentNode( const QString& comment, const QString& idstr, int beforeBR, int afterBR, bool binsert );
94     void createBeltNode( const QString& idstr );
95
96
97 private:
98
99     void appendANode( DOM::Element rootnode, const QString& linkstr, const QString& comment );
100     void updateFooterOrHeader( DOM::Element& targetelm, QString strType );
101     void createFooterOrHeader( QString strType );
102     void createKokoyon();
103     void createTugi100();
104     void createMae100();
105     void changeColorOfNumber( int num );
106 };
107
108
109
110 #endif