summaryrefslogtreecommitdiffstats
path: root/quanta/parts/kafka/nodeproperties.h
blob: b41fccfd342c56528f8a72c932562e4a7c743ae7 (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
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
/***************************************************************************
                               nodeproperties.h
                             -------------------

    copyright            : (C) 2003, 2004 - Nicolas Deschildre
    email                : ndeschildre@tdewebdev.org
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 NODEPROPERTIES_H
#define NODEPROPERTIES_H

#include <dom/dom_node.h>

class Node;

/**
 * This class basically acts as a link containing attributes between Nodes and DOM::Nodes.
 * Node->rootNode(), Node->leafNode() are Node->DOM::Node links (cf node.h)
 * domNodeProps[domNode.handle()] is DOM::Node->kNodeAttr link (cf wkafkapart.h)
 */
class kNodeAttrs
{
public:
	kNodeAttrs();
	~kNodeAttrs();

	/**
	 * Get/set the Node this kNodeAttrs is linked to.
	 */
	Node *getNode() {return m_node;}
	void setNode(Node *node) {m_node = node;}

	/**
	 * Get/set the DOM::Node this kNodeAttrs is linked to.
	 */
	DOM::Node getDomNode() {return m_domNode;}
	void setDomNode(DOM::Node domNode) {m_domNode = domNode;}

	/**
	 * Get/set if the DOM::Node linked by this kNodeAttrs has a corresponding Node.
	 * If not, this may reveal that it is a special DOM::Node which could be handled separatly.
	 */
	bool isLinkedToNode() {return m_isLinkedToNode;}
	void setIsLinkedToNode(bool isLinkedToNode) {m_isLinkedToNode = isLinkedToNode;}

	/**
	 * The different possible reasons why this kNodeAttr isn't linked to a Node.
	 */
	enum specialBehavior
	{
		/**
		 * No special behavior.
		 */
		none = 0,

		/**
		 * The DOM::Node linked by this kNodeAttrs is an empty Text DOM::Node
		 * which has been set at the left of a block so that the user can
		 * access this area with the cursor.
		 */
		emptyTextSurroundingBlockElementAtTheLeft,

		/**
		 * Same as above but at the right of a block.
		 */
		emptyTextSurroundingBlockElementAtTheRight,

		/**
		 * The DOM::Node linked by this kNodeAttrs is an empty Text DOM::Node
		 * which has been set as the only child of a childless element so that the user
		 * can access this area with the cursor.
		 */
		emptyTextAsChildOfAChildlessElement
	};

	/**
	 * Get/set the reason why this kNodeAttrs isn't linked to a Node.
	 */
	int specialBehavior() {return m_specialBehavior;}
	void setSpecialBehavior(int specialBehavior) {m_specialBehavior = specialBehavior;}

	/**
	 * SOME PARTS will be brought back later (for non-HTML DTD edition)
	 */

	//DEPRECATED.
	int getType() {return m_type;}
	void setType(int type) {m_type = type;}

	/**
	 * Get/set the "type" of Node. (Can Have CUrsor FOCus) cf cursorType. Useful
	 * when manipulating Nodes with the caret.
	 */
	int chCurFoc() {return m_chCursorFocus;}
	void setCHCursorFocus(int chCursorFocus) {m_chCursorFocus = chCursorFocus;}

	//Not real clear, comes from old deprecated code.
	enum cursorType
	{
		//Can't have the cursor focus, or we don't care to know that.
		no = 0,
		//Inline Node
		inlineNode,
		//A Block Node in which the cursor can enter/leave e.g. H1, DIV
		blockNode,
		//A BLOCK Node in which the cursor can't enter/leave e.g. TABLE
		singleNodeAndItself,
		//A text Node.
		textNode
	};

	/**
	 * Specifies if the cursor can enter/leave this Node. (Cursor CAN ENTER)
	 */
	bool ccanEnter() {return m_ccEnter;}
	void setCCEnter(bool ccEnter) {m_ccEnter = ccEnter;}

	/**
	 * NOT USED. It will be used with the non HTML DTD support.
	 * Specifies if this Node can be modified e.g. resizing.
	 */
	bool cbMod() {return m_cbModified;}
	void setCBModified(bool cbModified) {m_cbModified = cbModified;}

	/**
	 * NOT USED. It will be used with the non HTML DTD support.
	 * Specifies if this Node can be deleted.
	 */
	bool cbDel() {return m_cbDeleted;}
	void setCBDeleted(bool cbDeleted) {m_cbDeleted = cbDeleted;}

private:
	Node* m_node;
	DOM::Node m_domNode;
	bool m_isLinkedToNode;
	int m_specialBehavior;
	int m_type;
	bool m_cbDeleted;
	bool m_cbModified;
	int m_chCursorFocus;
	bool m_ccEnter;

};

#endif