c8d0ddc7219113f90cebd98e29e1ef9875518e75
1 /*
2 * Copyright (c) 2004 World Wide Web Consortium,
3 *
4 * (Massachusetts Institute of Technology, European Research Consortium for
5 * Informatics and Mathematics, Keio University). All Rights Reserved. This
6 * work is distributed under the W3C(r) Software License [1] in the hope that
7 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
8 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 *
10 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
11 */
13 package org.w3c.dom.views;
15 import org.w3c.dom.Node;
17 /**
18 * Visual segments contain match criteria attributes and result attributes
19 * common to visual views of a document. When this structure is created, all
20 * booleans are set to false, all integral values are set to 0, and all
21 * strings and object references are set to null. Match criteria are then
22 * set. After setting match criteria, <code>matchSegment</code> is called
23 * passing this segment or another segment that references this segment,
24 * which finds a matching segment and sets result attributes.
25 * <p>See also the <a href='http://www.w3.org/TR/2004/NOTE-DOM-Level-3-Views-20040226'>Document Object Model (DOM) Level 3 Views and Formatting
26 Specification</a>.
27 */
28 public interface VisualSegment extends VisualResource {
29 /**
30 * May be set to cause the corresponding segment to be matched only if it
31 * contains the specified <code>matchX</code> and <code>matchY</code>
32 * positions.
33 */
34 public boolean getMatchPosition();
35 /**
36 * May be set to cause the corresponding segment to be matched only if it
37 * contains the specified <code>matchX</code> and <code>matchY</code>
38 * positions.
39 */
40 public void setMatchPosition(boolean matchPosition);
42 /**
43 * May be set to cause the corresponding segment to be matched only if it
44 * is inside the specified rectangular region bounded by
45 * <code>matchX</code>, <code>matchY</code>, <code>matchXR</code>, and
46 * <code>matchYR</code>.
47 */
48 public boolean getMatchInside();
49 /**
50 * May be set to cause the corresponding segment to be matched only if it
51 * is inside the specified rectangular region bounded by
52 * <code>matchX</code>, <code>matchY</code>, <code>matchXR</code>, and
53 * <code>matchYR</code>.
54 */
55 public void setMatchInside(boolean matchInside);
57 /**
58 * May be set to cause the corresponding segment to be matched only if it
59 * contains the specified rectangular region bounded by
60 * <code>matchX</code>, <code>matchY</code>, <code>matchXR</code>, and
61 * <code>matchYR</code>.
62 */
63 public boolean getMatchContaining();
64 /**
65 * May be set to cause the corresponding segment to be matched only if it
66 * contains the specified rectangular region bounded by
67 * <code>matchX</code>, <code>matchY</code>, <code>matchXR</code>, and
68 * <code>matchYR</code>.
69 */
70 public void setMatchContaining(boolean matchContaining);
72 /**
73 * An integral X coordinate, specified in horizontal view units, that may
74 * be used to match a point or region.
75 */
76 public int getMatchX();
77 /**
78 * An integral X coordinate, specified in horizontal view units, that may
79 * be used to match a point or region.
80 */
81 public void setMatchX(int matchX);
83 /**
84 * An integral Y coordinate, specified in vertical view units, that may be
85 * used to match a point or region.
86 */
87 public int getMatchY();
88 /**
89 * An integral Y coordinate, specified in vertical view units, that may be
90 * used to match a point or region.
91 */
92 public void setMatchY(int matchY);
94 /**
95 * An integral X coordinate, specified in horizontal view units, that may
96 * be used to match a region.
97 */
98 public int getMatchXR();
99 /**
100 * An integral X coordinate, specified in horizontal view units, that may
101 * be used to match a region.
102 */
103 public void setMatchXR(int matchXR);
105 /**
106 * An integral Y coordinate, specified in vertical view units, that may be
107 * used to match a region.
108 */
109 public int getMatchYR();
110 /**
111 * An integral Y coordinate, specified in vertical view units, that may be
112 * used to match a region.
113 */
114 public void setMatchYR(int matchYR);
116 /**
117 * May be set to cause the corresponding segment to only be matched if it
118 * presents the <code>matchNode</code> content, offset by
119 * <code>matchOffset</code>.
120 */
121 public boolean getMatchContent();
122 /**
123 * May be set to cause the corresponding segment to only be matched if it
124 * presents the <code>matchNode</code> content, offset by
125 * <code>matchOffset</code>.
126 */
127 public void setMatchContent(boolean matchContent);
129 /**
130 * May be set to cause the corresponding segment to only be matched if the
131 * content it presents is within the range of content between Node
132 * <code>matchNode</code> offset <code>matchOffset</code> and Node
133 * <code>matchNodeR</code> offset <code>matchOffsetR</code>.
134 */
135 public boolean getMatchRange();
136 /**
137 * May be set to cause the corresponding segment to only be matched if the
138 * content it presents is within the range of content between Node
139 * <code>matchNode</code> offset <code>matchOffset</code> and Node
140 * <code>matchNodeR</code> offset <code>matchOffsetR</code>.
141 */
142 public void setMatchRange(boolean matchRange);
144 /**
145 * The node, or first node in a range to use to match segments which
146 * present specified content.
147 * <br>If matching content is enabled, but this is set to null, then only
148 * segments that are not associated with content will be matched.
149 */
150 public Node getMatchNode();
151 /**
152 * The node, or first node in a range to use to match segments which
153 * present specified content.
154 * <br>If matching content is enabled, but this is set to null, then only
155 * segments that are not associated with content will be matched.
156 */
157 public void setMatchNode(Node matchNode);
159 /**
160 * The offset, or first offset in a range to use to match segments which
161 * present specified content.
162 */
163 public int getMatchOffset();
164 /**
165 * The offset, or first offset in a range to use to match segments which
166 * present specified content.
167 */
168 public void setMatchOffset(int matchOffset);
170 /**
171 * The second node in a range to use to match segments which present
172 * specified content.
173 * <br>If matching a content range is enabled, but this is set to null,
174 * then only segments that are not associated with content will be
175 * matched.
176 */
177 public Node getMatchNodeR();
178 /**
179 * The second node in a range to use to match segments which present
180 * specified content.
181 * <br>If matching a content range is enabled, but this is set to null,
182 * then only segments that are not associated with content will be
183 * matched.
184 */
185 public void setMatchNodeR(Node matchNodeR);
187 /**
188 * The offset, or first offset in a range to use to match segments which
189 * present specified content.
190 */
191 public int getMatchOffsetR();
192 /**
193 * The offset, or first offset in a range to use to match segments which
194 * present specified content.
195 */
196 public void setMatchOffsetR(int matchOffsetR);
198 /**
199 * May be set to cause the corresponding segment to only be matched if the
200 * content being presented contains a cursor or part of a selected
201 * region.
202 */
203 public boolean getMatchContainsSelected();
204 /**
205 * May be set to cause the corresponding segment to only be matched if the
206 * content being presented contains a cursor or part of a selected
207 * region.
208 */
209 public void setMatchContainsSelected(boolean matchContainsSelected);
211 /**
212 * May be set to cause the corresponding segment to only be matched if the
213 * segment being presented contains some part that is visible.
214 */
215 public boolean getMatchContainsVisible();
216 /**
217 * May be set to cause the corresponding segment to only be matched if the
218 * segment being presented contains some part that is visible.
219 */
220 public void setMatchContainsVisible(boolean matchContainsVisible);
222 /**
223 * Returns true result if the desired segment was located, or false if it
224 * was not. If this value is set to false, no other results are set. If
225 * this value is set to true, all other results are set.
226 */
227 public boolean getExists();
229 /**
230 * Whenever a segment is matched, this is set to the first node presented
231 * by the matched segment or null if the segment does not present any
232 * specific document content.
233 */
234 public Node getStartNode();
236 /**
237 * Whenever a segment is matched, this is set to the first offset
238 * presented within the first node presented by the matched segment or 0
239 * if the segment does not present any specific document content.
240 */
241 public int getStartOffset();
243 /**
244 * Whenever a segment is matched, this is set to the last node presented
245 * by the matched segment or null if the segment does not present any
246 * specific document content.
247 */
248 public Node getEndNode();
250 /**
251 * Whenever a segment is matched, this is set to first offset not
252 * presented within the last node presented by the matched segment or 0
253 * if the segment does not present any specific document content.
254 */
255 public int getEndOffset();
257 /**
258 * Whenever a segment is matched, this is set to the top offset of the
259 * segment within the view, specified in vertical view units.
260 */
261 public int getTopOffset();
263 /**
264 * Whenever a segment is matched, this is set to the bottom offset of the
265 * segment within the view, specified in vertical view units.
266 */
267 public int getBottomOffset();
269 /**
270 * Whenever a segment is matched, this is set to the left offset of the
271 * segment within the view, specified in horizontal view units.
272 */
273 public int getLeftOffset();
275 /**
276 * Whenever a segment is matched, this is set to the right offset of the
277 * segment within the view, specified in horizontal view units.
278 */
279 public int getRightOffset();
281 /**
282 * Whenever a segment is matched, this is set to the width of the segment
283 * within the view, specified in horizontal view units.
284 */
285 public int getWidth();
287 /**
288 * Whenever a segment is matched, this is set to the width of the segment
289 * within the view, specified in vertical view units.
290 */
291 public int getHeight();
293 /**
294 * Whenever a segment is matched, this is set to true if the segment
295 * presents the content with the cursor or selected content, otherwise,
296 * this is set to false.
297 */
298 public boolean getSelected();
300 /**
301 * Whenever a segment is matched, this is set to true if the segment
302 * contains some part that is visible, otherwise, this is set to false.
303 */
304 public boolean getVisible();
306 /**
307 * Whenever a segment is matched, this is set to the integral value of the
308 * foreground color of that segment, or transparent if there is no
309 * foreground color. The 32 bits of this value are divided into the
310 * following 8-bit sub-fields, from most significant to least
311 * significant: alpha, red, green, blue. The color fields range from 0
312 * for no intensity to 255 to indicate the contribution of each color.
313 * The alpha field ranges from 0 for transparent to 255 for completely
314 * opaque. For complete transparency, the color fields will be
315 * normalized to 0 as well.
316 */
317 public int getForegroundColor();
319 /**
320 * Whenever a segment is matched, this is set to the integral value of the
321 * background color of that segment, or transparent if there is no
322 * background color. The 32 bits of this value are divided into the
323 * following 8-bit sub-fields, from most significant to least
324 * significant: alpha, red, green, blue. The color fields range from 0
325 * for no intensity to 255 to indicate the contribution of each color.
326 * The alpha field ranges from 0 for transparent to 255 for completely
327 * opaque. For a transparent alpha value of 0, the color fields are be
328 * normalized to 0 as well.
329 */
330 public int getBackgroundColor();
332 /**
333 * The font name is a view-specific designation of the font name.
334 */
335 public String getFontName();
337 /**
338 */
339 public String getFontHeight();
341 /**
342 * Fetches the results of the next matching <code>VisualResource</code>,
343 * if any.
344 * @return
345 */
346 public boolean getNext();
348 }