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