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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
|
/***************************************************************************
domtreeview.h
-------------------
copyright : (C) 2001 - The Kafka Team/Andreas Schlapbach
(C) 2005 - Leo Savernik
email : [email protected]
[email protected]
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
/* $Id$ */
#ifndef DOMTREEVIEW_H
#define DOMTREEVIEW_H
#include <tqptrdict.h>
#include <tqptrlist.h>
#include <dom/css_stylesheet.h>
#include <dom/css_rule.h>
#include <dom/dom_node.h>
#include "domtreeviewbase.h"
namespace DOM {
class Element;
class CharacterData;
}
class DOMListViewItem;
class DOMTreeWindow;
class TQListViewItem;
class KPushButton;
class KEdFind;
class TDEHTMLPart;
class DOMTreeView : public DOMTreeViewBase
{
TQ_OBJECT
public:
DOMTreeView(TQWidget *parent, const char* name, bool allowSaving = true);
~DOMTreeView();
TDEHTMLPart *htmlPart() const { return part; }
void setHtmlPart(TDEHTMLPart *);
/** returns the main window */
DOMTreeWindow *mainWindow() const;
protected:
/*
void saveTreeAsHTML(const DOM::Node &pNode);
*/
virtual bool eventFilter(TQObject *o, TQEvent *e);
signals:
/** emitted when the part has been changed. */
void htmlPartChanged(TDEHTMLPart *part);
public slots:
void refresh();
void increaseExpansionDepth();
void decreaseExpansionDepth();
void setMessage(const TQString &msg);
void hideMessageLine();
void moveToParent();
void activateNode(const DOM::Node &node);
void deleteNodes();
/**
* Takes measures to disconnect this instance from the current html
* part as long as it is active.
*/
void disconnectFromActivePart();
/**
* Takes measures to disconnect this instance from the current html
* part when it is being torn down.
*/
void disconnectFromTornDownPart();
/**
* Connects to the current html part.
*/
void connectToPart();
void slotFindClicked();
void slotAddElementDlg();
void slotAddTextDlg();
protected slots:
void slotShowNode(const DOM::Node &pNode);
void slotShowTree(const DOM::Node &pNode);
void slotItemClicked(TQListViewItem *);
void slotRefreshNode(const DOM::Node &pNode);
void slotMovedItems(TQPtrList<TQListViewItem> &items, TQPtrList<TQListViewItem> &afterFirst, TQPtrList<TQListViewItem> &afterNow);
void slotPrepareMove();
void slotSearch();
// void slotSaveClicked();
void slotPureToggled(bool);
void slotShowAttributesToggled(bool);
void slotHighlightHTMLToggled(bool);
void showDOMTreeContextMenu(TQListViewItem *, const TQPoint &, int);
void slotSetHtmlPartDelayed();
void slotRestoreScrollOffset();
private:
TQPtrDict<DOMListViewItem> m_itemdict;
DOM::Node m_document;
uint m_expansionDepth, m_maxDepth;
bool m_bPure, m_bShowAttributes, m_bHighlightHTML;
private:
void showRecursive(const DOM::Node &pNode, const DOM::Node &node,
uint depth);
// void saveRecursive(const DOM::Node &node, int ident);
void searchRecursive(DOMListViewItem *cur_item,
const TQString &searchText,
bool caseSensitive);
void adjustDepth();
void adjustDepthRecursively(TQListViewItem *cur_item, uint currDepth);
void highlightHTML(DOMListViewItem *cur_item,
const TQString &nodeName);
void addElement(const DOM::Node &node, DOMListViewItem *cur_item,
bool isLast);
void updateIncrDecreaseButton();
private:
KEdFind* m_findDialog;
TDEHTMLPart *part;
TQTextStream* m_textStream;
const TDEListView* m_rootListView;
KPushButton* m_saveButton;
TQObject *focused_child;
DOM::Node current_node;
DOM::CSSStyleSheet stylesheet;
DOM::CSSRule active_node_rule;
bool _refreshed;
int scroll_ofs_x, scroll_ofs_y;
// == DOM Node Info panel ======================================
public:
// Keep in sync with the widget stack children
enum InfoPanel { ElementPanel, CDataPanel, EmptyPanel };
public slots:
void initializeOptionsFromNode(const DOM::Node &);
void initializeOptionsFromListItem(TQListViewItem *);
void copyAttributes();
void cutAttributes();
void pasteAttributes();
void deleteAttributes();
private:
void initDOMNodeInfo();
void initializeOptionsFromElement(const DOM::Element &);
void initializeOptionsFromCData(const DOM::CharacterData &);
private slots:
void slotItemRenamed(TQListViewItem *, const TQString &str, int col);
void slotEditAttribute(TQListViewItem *, const TQPoint &, int col);
void slotApplyContent();
void showInfoPanelContextMenu(TQListViewItem *, const TQPoint &, int);
private:
DOM::Node infoNode; // node these infos apply to
// == End DOM Node Info panel ==================================
};
#endif
|