129
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2000, 2005 IBM Corporation and others.
|
|
3 * All rights reserved. This program and the accompanying materials
|
|
4 * are made available under the terms of the Eclipse Public License v1.0
|
|
5 * which accompanies this distribution, and is available at
|
|
6 * http://www.eclipse.org/legal/epl-v10.html
|
|
7 *
|
|
8 * Contributors:
|
|
9 * IBM Corporation - initial API and implementation
|
|
10 * Port to the D programming language:
|
|
11 * Frank Benoit <benoit@tionex.de>
|
|
12 *******************************************************************************/
|
|
13 module dwtx.jface.text.ITextViewerExtension5;
|
|
14
|
|
15 import dwt.dwthelper.utils;
|
|
16
|
|
17 /**
|
|
18 * Extension interface for {@link dwtx.jface.text.ITextViewer}. Defines
|
|
19 * a conceptual replacement of the original visible region concept. This interface
|
|
20 * replaces {@link dwtx.jface.text.ITextViewerExtension3}.
|
|
21 * <p>
|
|
22 * Introduces the explicit concept of model and widget coordinates. For example,
|
|
23 * a selection returned by the text viewer's control is a widget selection. A
|
|
24 * widget selection always maps to a certain range of the viewer's document.
|
|
25 * This range is considered the model selection.
|
|
26 * <p>
|
|
27 * All model ranges that have a corresponding widget ranges are considered
|
|
28 * "exposed model ranges". The viewer can be requested to expose a given model
|
|
29 * range. Thus, a visible region is a particular degeneration of exposed model
|
|
30 * ranges.
|
|
31 * <p>
|
|
32 * This interface allows implementers to follow a sophisticated presentation
|
|
33 * model in which the visible presentation is a complex projection of the
|
|
34 * viewer's input document.
|
|
35 *
|
|
36 * @since 3.0
|
|
37 */
|
|
38 public interface ITextViewerExtension5 : ITextViewerExtension3 {
|
|
39
|
|
40 /**
|
|
41 * Returns the minimal region of the viewer's input document that completely
|
|
42 * comprises everything that is visible in the viewer's widget or
|
|
43 * <code>null</code> if there is no such region.
|
|
44 *
|
|
45 * @return the minimal region of the viewer's document comprising the
|
|
46 * contents of the viewer's widget or <code>null</code>
|
|
47 */
|
|
48 IRegion getModelCoverage();
|
|
49
|
|
50 /**
|
|
51 * Returns the widget line that corresponds to the given line of the
|
|
52 * viewer's input document or <code>-1</code> if there is no such line.
|
|
53 *
|
|
54 * @param modelLine the line of the viewer's document
|
|
55 * @return the corresponding widget line or <code>-1</code>
|
|
56 */
|
|
57 int modelLine2WidgetLine(int modelLine);
|
|
58
|
|
59 /**
|
|
60 * Returns the widget offset that corresponds to the given offset in the
|
|
61 * viewer's input document or <code>-1</code> if there is no such offset
|
|
62 *
|
|
63 * @param modelOffset the offset in the viewer's document
|
|
64 * @return the corresponding widget offset or <code>-1</code>
|
|
65 */
|
|
66 int modelOffset2WidgetOffset(int modelOffset);
|
|
67
|
|
68 /**
|
|
69 * Returns the minimal region of the viewer's widget that completely
|
|
70 * comprises the given region of the viewer's input document or
|
|
71 * <code>null</code> if there is no such region.
|
|
72 *
|
|
73 * @param modelRange the region of the viewer's document
|
|
74 * @return the minimal region of the widget comprising
|
|
75 * <code>modelRange</code> or <code>null</code>
|
|
76 */
|
|
77 IRegion modelRange2WidgetRange(IRegion modelRange);
|
|
78
|
|
79 /**
|
|
80 * Returns the offset of the viewer's input document that corresponds to the
|
|
81 * given widget offset or <code>-1</code> if there is no such offset
|
|
82 *
|
|
83 * @param widgetOffset the widget offset
|
|
84 * @return the corresponding offset in the viewer's document or
|
|
85 * <code>-1</code>
|
|
86 */
|
|
87 int widgetOffset2ModelOffset(int widgetOffset);
|
|
88
|
|
89 /**
|
|
90 * Returns the minimal region of the viewer's input document that completely
|
|
91 * comprises the given widget region or <code>null</code> if there is no
|
|
92 * such region.
|
|
93 *
|
|
94 * @param widgetRange the widget region
|
|
95 * @return the minimal region of the viewer's document comprising
|
|
96 * <code>widgetlRange</code> or <code>null</code>
|
|
97 */
|
|
98 IRegion widgetRange2ModelRange(IRegion widgetRange);
|
|
99
|
|
100 /**
|
|
101 * Returns the line of the viewer's input document that corresponds to the
|
|
102 * given widget line or <code>-1</code> if there is no such line.
|
|
103 *
|
|
104 * @param widgetLine the widget line
|
|
105 * @return the corresponding line of the viewer's document or
|
|
106 * <code>-1</code>
|
|
107 */
|
|
108 int widgetLine2ModelLine(int widgetLine);
|
|
109
|
|
110 /**
|
|
111 * Returns the widget line of the given widget offset.
|
|
112 *
|
|
113 * @param widgetOffset the widget offset
|
|
114 * @return the widget line of the widget offset
|
|
115 */
|
|
116 int widgetLineOfWidgetOffset(int widgetOffset);
|
|
117
|
|
118
|
|
119 /**
|
|
120 * Returns the maximal subranges of the given model range thus that there is
|
|
121 * no offset inside a subrange for which there is no image offset.
|
|
122 *
|
|
123 * @param modelRange the model range
|
|
124 * @return the list of subranges
|
|
125 */
|
|
126 IRegion[] getCoveredModelRanges(IRegion modelRange);
|
|
127
|
|
128 /**
|
|
129 * Exposes the given model range. Returns whether this call caused a change
|
|
130 * of the set of exposed model ranges.
|
|
131 *
|
|
132 * @param modelRange the model range to be exposed
|
|
133 * @return <code>true</code> if the set of exposed model ranges changed,
|
|
134 * <code>false</code> otherwise
|
|
135 */
|
|
136 bool exposeModelRange(IRegion modelRange);
|
|
137 }
|