1 | // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team |
---|
2 | // |
---|
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this |
---|
4 | // software and associated documentation files (the "Software"), to deal in the Software |
---|
5 | // without restriction, including without limitation the rights to use, copy, modify, merge, |
---|
6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons |
---|
7 | // to whom the Software is furnished to do so, subject to the following conditions: |
---|
8 | // |
---|
9 | // The above copyright notice and this permission notice shall be included in all copies or |
---|
10 | // substantial portions of the Software. |
---|
11 | // |
---|
12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, |
---|
13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
---|
14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE |
---|
15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
---|
16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
---|
17 | // DEALINGS IN THE SOFTWARE. |
---|
18 | |
---|
19 | using System; |
---|
20 | using System.Windows.Media.TextFormatting; |
---|
21 | using ICSharpCode.AvalonEdit.Document; |
---|
22 | using ICSharpCode.AvalonEdit.Utils; |
---|
23 | |
---|
24 | namespace ICSharpCode.AvalonEdit.Rendering |
---|
25 | { |
---|
26 | /// <summary> |
---|
27 | /// Contains information relevant for text run creation. |
---|
28 | /// </summary> |
---|
29 | public interface ITextRunConstructionContext |
---|
30 | { |
---|
31 | /// <summary> |
---|
32 | /// Gets the text document. |
---|
33 | /// </summary> |
---|
34 | TextDocument Document { get; } |
---|
35 | |
---|
36 | /// <summary> |
---|
37 | /// Gets the text view for which the construction runs. |
---|
38 | /// </summary> |
---|
39 | TextView TextView { get; } |
---|
40 | |
---|
41 | /// <summary> |
---|
42 | /// Gets the visual line that is currently being constructed. |
---|
43 | /// </summary> |
---|
44 | VisualLine VisualLine { get; } |
---|
45 | |
---|
46 | /// <summary> |
---|
47 | /// Gets the global text run properties. |
---|
48 | /// </summary> |
---|
49 | TextRunProperties GlobalTextRunProperties { get; } |
---|
50 | |
---|
51 | /// <summary> |
---|
52 | /// Gets a piece of text from the document. |
---|
53 | /// </summary> |
---|
54 | /// <remarks> |
---|
55 | /// This method is allowed to return a larger string than requested. |
---|
56 | /// It does this by returning a <see cref="StringSegment"/> that describes the requested segment within the returned string. |
---|
57 | /// This method should be the preferred text access method in the text transformation pipeline, as it can avoid repeatedly allocating string instances |
---|
58 | /// for text within the same line. |
---|
59 | /// </remarks> |
---|
60 | StringSegment GetText(int offset, int length); |
---|
61 | } |
---|
62 | } |
---|