OSDN Git Service

Move the directories
[kita/kita.git] / src / domtree.h
diff --git a/src/domtree.h b/src/domtree.h
new file mode 100644 (file)
index 0000000..505a0a5
--- /dev/null
@@ -0,0 +1,81 @@
+/***************************************************************************
+ *   Copyright (C) 2004, 2007 by Kita Developers                           *
+ *   ikemo@users.sourceforge.jp                                            *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ ***************************************************************************/
+#ifndef KITADOMTREE_H
+#define KITADOMTREE_H
+
+#include <QtCore/QVector>
+
+#include <dom/html_block.h>
+#include <dom/html_document.h>
+
+namespace Kita
+{
+    class DatInfo;
+
+    class DomTree
+    {
+        DomTree(const DomTree&);
+        DomTree& operator=(const DomTree&);
+
+        DatInfo* m_datInfo;
+        int m_bufSize;
+
+        /* bottom number of shown.
+         * probably m_bottomNum == m_datInfo->getReadNum
+         */
+        int m_bottomNum;
+
+        /* return val of DatInfo::getHTML(). See datinfo.h */
+        QVector<int> m_resStatus;
+        QVector<bool> m_coloredNum; /* colored number */
+
+        /* DOM elements */
+        DOM::HTMLDocument m_hdoc; /* root node of document*/
+        /* the vector of the element of response */
+        QVector<DOM::HTMLDivElement> m_titleElm;
+        /* the vector of the element of response */
+        QVector<DOM::HTMLDivElement> m_bodyElm; 
+        DOM::Element m_header;
+        DOM::Element m_footer;
+        DOM::Element m_kokoyon;
+
+    public:
+        DomTree(const DOM::HTMLDocument& hdoc, const KUrl& datUrl);
+        ~DomTree();
+
+        /* rendering functions */
+
+        bool createResElement(int num);
+        bool appendRes(int num);
+        void redraw(bool force);
+        void changeColorOfAllResponsedNumber();
+
+        /* information */
+
+        int getBottomResNumber() const;
+
+        /* header Node, footer Node, kokomadeyonda Node, etc... */
+
+       void appendFooterAndHeader();
+       void appendKokoyon();
+
+    private:
+        void appendAnchorNode(const DOM::Element& root, const QString& linkstr,
+                const QString& comment);
+        void updateHeader(DOM::Element& targetelm);
+        void updateFooter(DOM::Element& targetelm);
+        void createHeader();
+        void createFooter();
+        void createKokoyon();
+        void changeColorOfNumber(int num);
+    };
+}
+
+#endif