|
1 |
| -Partial Public Class SelectionHelper0 |
2 |
| - |
3 |
| - Public Enum SelectionPointType |
4 |
| - StartPoint |
5 |
| - EndPoint |
6 |
| - Selection |
7 |
| - End Enum |
8 |
| - |
9 |
| - Public ReadOnly Property IsEmpty As Boolean |
10 |
| - Get |
11 |
| - If SelectionStart Is Nothing Then |
12 |
| - If SelectionEnd Is Nothing Then |
13 |
| - ' TODO: Implement HasChildren.... in ChildrenHelper |
14 |
| - Return CommonAncestror.Children.First Is Nothing |
15 |
| - Else |
16 |
| - Return False |
17 |
| - End If |
18 |
| - Else |
19 |
| - Return SelectionStart.NextSibling Is SelectionEnd |
20 |
| - End If |
21 |
| - End Get |
22 |
| - End Property |
23 |
| - |
24 |
| - Public Sub CollapseToEnd() |
25 |
| - Dim NewPoint = New Selection(EndPoint.CommonAncestror, EndPoint.CommonAncestror.Children.Before(EndPoint.SelectionStart), EndPoint.SelectionStart) |
26 |
| - SetSelection(NewPoint, PointToChange:=SelectionHelper.SelectionPointType.StartPoint) |
27 |
| - End Sub |
28 |
| - |
29 |
| - Public Sub CollapseToStart() |
30 |
| - ' TODO: Implement CollapseToStart |
31 |
| - Throw New NotImplementedException() |
32 |
| - End Sub |
33 |
| - |
34 |
| - Public Sub MoveNext(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) |
35 |
| - Dim Sel As Selection = GetSelection(MovedPoint) |
36 |
| - Dim E = Sel.CommonAncestror.ParentLayoutEngineChild |
37 |
| - Sel.CommonAncestror = E.ParentElement |
38 |
| - Sel.SelectionStart = E |
39 |
| - Sel.SelectionEnd = E.NextSibling |
40 |
| - SetSelection(Sel, MovedPoint) |
41 |
| - End Sub |
42 |
| - |
43 |
| - Public Sub MovePrevious(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) |
44 |
| - Dim Sel As Selection = GetSelection(MovedPoint) |
45 |
| - Dim E = Sel.CommonAncestror.ParentLayoutEngineChild |
46 |
| - Sel.CommonAncestror = E.ParentElement |
47 |
| - Sel.SelectionStart = E.PreviousSibling |
48 |
| - Sel.SelectionEnd = E |
49 |
| - SetSelection(Sel, MovedPoint) |
50 |
| - End Sub |
51 |
| - |
52 |
| - Public Sub MoveLeft(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) |
53 |
| - |
54 |
| - Dim Sel As Selection = GetSelection(MovedPoint) |
55 |
| - Dim E = Sel.SelectionStart |
56 |
| - |
57 |
| - If E Is Nothing Then |
58 |
| - MovePrevious(MovedPoint) |
59 |
| - Else |
60 |
| - Sel.CommonAncestror = E.ParentElement |
61 |
| - Sel.SelectionStart = E.PreviousSibling |
62 |
| - Sel.SelectionEnd = E |
63 |
| - SetSelection(Sel, MovedPoint) |
64 |
| - End If |
65 |
| - |
66 |
| - End Sub |
67 |
| - |
68 |
| - Public Sub MoveRight(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) |
69 |
| - |
70 |
| - Dim Sel As Selection = GetSelection(MovedPoint) |
71 |
| - Dim E = Sel.SelectionEnd |
72 |
| - |
73 |
| - If E Is Nothing Then |
74 |
| - MoveNext(MovedPoint) |
75 |
| - Else |
76 |
| - Sel.CommonAncestror = E.ParentElement |
77 |
| - Sel.SelectionStart = E |
78 |
| - Sel.SelectionEnd = E.NextSibling |
79 |
| - SetSelection(Sel, MovedPoint) |
80 |
| - End If |
81 |
| - |
82 |
| - End Sub |
83 |
| - |
84 |
| - Public Sub MoveStart(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) |
85 |
| - |
86 |
| - Dim Sel As Selection = GetSelection(MovedPoint) |
87 |
| - Sel.SelectionStart = Nothing |
88 |
| - Sel.SelectionEnd = Sel.CommonAncestror.FirstChild |
89 |
| - SetSelection(Sel, MovedPoint) |
90 |
| - |
91 |
| - End Sub |
92 |
| - |
93 |
| - Public Sub MoveEnd(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) |
94 |
| - |
95 |
| - Dim Sel As Selection = GetSelection(MovedPoint) |
96 |
| - Sel.SelectionEnd = Nothing |
97 |
| - Sel.SelectionStart = Sel.CommonAncestror.LastChild |
98 |
| - SetSelection(Sel, MovedPoint) |
99 |
| - |
100 |
| - End Sub |
101 |
| - |
102 |
| - Public Sub MoveDocumentStart(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) |
103 |
| - |
104 |
| - SetSelection(New Selection(CommonAncestror.Root, Nothing, CommonAncestror.Root.FirstChild), MovedPoint) |
105 |
| - |
106 |
| - End Sub |
107 |
| - |
108 |
| - Public Sub MoveDocumentEnd(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) |
109 |
| - |
110 |
| - SetSelection(New Selection(CommonAncestror.Root, CommonAncestror.Root.LastChild, Nothing), MovedPoint) |
111 |
| - |
112 |
| - End Sub |
| 1 | +'Partial Public Class SelectionHelper0 |
| 2 | + |
| 3 | +' Public Enum SelectionPointType |
| 4 | +' StartPoint |
| 5 | +' EndPoint |
| 6 | +' Selection |
| 7 | +' End Enum |
| 8 | + |
| 9 | +' Public ReadOnly Property IsEmpty As Boolean |
| 10 | +' Get |
| 11 | +' If SelectionStart Is Nothing Then |
| 12 | +' If SelectionEnd Is Nothing Then |
| 13 | +' ' TODO: Implement HasChildren.... in ChildrenHelper |
| 14 | +' Return CommonAncestror.Children.First Is Nothing |
| 15 | +' Else |
| 16 | +' Return False |
| 17 | +' End If |
| 18 | +' Else |
| 19 | +' Return SelectionStart.NextSibling Is SelectionEnd |
| 20 | +' End If |
| 21 | +' End Get |
| 22 | +' End Property |
| 23 | + |
| 24 | +' Public Sub CollapseToEnd() |
| 25 | +' Dim NewPoint = New Selection(EndPoint.CommonAncestror, EndPoint.CommonAncestror.Children.Before(EndPoint.SelectionStart), EndPoint.SelectionStart) |
| 26 | +' SetSelection(NewPoint, PointToChange:=SelectionHelper.SelectionPointType.StartPoint) |
| 27 | +' End Sub |
| 28 | + |
| 29 | +' Public Sub CollapseToStart() |
| 30 | +' ' TODO: Implement CollapseToStart |
| 31 | +' Throw New NotImplementedException() |
| 32 | +' End Sub |
| 33 | + |
| 34 | +' Public Sub MoveNext(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) |
| 35 | +' Dim Sel As Selection = GetSelection(MovedPoint) |
| 36 | +' Dim E = Sel.CommonAncestror.ParentLayoutEngineChild |
| 37 | +' Sel.CommonAncestror = E.ParentElement |
| 38 | +' Sel.SelectionStart = E |
| 39 | +' Sel.SelectionEnd = E.NextSibling |
| 40 | +' SetSelection(Sel, MovedPoint) |
| 41 | +' End Sub |
| 42 | + |
| 43 | +' Public Sub MovePrevious(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) |
| 44 | +' Dim Sel As Selection = GetSelection(MovedPoint) |
| 45 | +' Dim E = Sel.CommonAncestror.ParentLayoutEngineChild |
| 46 | +' Sel.CommonAncestror = E.ParentElement |
| 47 | +' Sel.SelectionStart = E.PreviousSibling |
| 48 | +' Sel.SelectionEnd = E |
| 49 | +' SetSelection(Sel, MovedPoint) |
| 50 | +' End Sub |
| 51 | + |
| 52 | +' Public Sub MoveLeft(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) |
| 53 | + |
| 54 | +' Dim Sel As Selection = GetSelection(MovedPoint) |
| 55 | +' Dim E = Sel.SelectionStart |
| 56 | + |
| 57 | +' If E Is Nothing Then |
| 58 | +' MovePrevious(MovedPoint) |
| 59 | +' Else |
| 60 | +' Sel.CommonAncestror = E.ParentElement |
| 61 | +' Sel.SelectionStart = E.PreviousSibling |
| 62 | +' Sel.SelectionEnd = E |
| 63 | +' SetSelection(Sel, MovedPoint) |
| 64 | +' End If |
| 65 | + |
| 66 | +' End Sub |
| 67 | + |
| 68 | +' Public Sub MoveRight(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) |
| 69 | + |
| 70 | +' Dim Sel As Selection = GetSelection(MovedPoint) |
| 71 | +' Dim E = Sel.SelectionEnd |
| 72 | + |
| 73 | +' If E Is Nothing Then |
| 74 | +' MoveNext(MovedPoint) |
| 75 | +' Else |
| 76 | +' Sel.CommonAncestror = E.ParentElement |
| 77 | +' Sel.SelectionStart = E |
| 78 | +' Sel.SelectionEnd = E.NextSibling |
| 79 | +' SetSelection(Sel, MovedPoint) |
| 80 | +' End If |
| 81 | + |
| 82 | +' End Sub |
| 83 | + |
| 84 | +' Public Sub MoveStart(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) |
| 85 | + |
| 86 | +' Dim Sel As Selection = GetSelection(MovedPoint) |
| 87 | +' Sel.SelectionStart = Nothing |
| 88 | +' Sel.SelectionEnd = Sel.CommonAncestror.FirstChild |
| 89 | +' SetSelection(Sel, MovedPoint) |
| 90 | + |
| 91 | +' End Sub |
| 92 | + |
| 93 | +' Public Sub MoveEnd(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) |
| 94 | + |
| 95 | +' Dim Sel As Selection = GetSelection(MovedPoint) |
| 96 | +' Sel.SelectionEnd = Nothing |
| 97 | +' Sel.SelectionStart = Sel.CommonAncestror.LastChild |
| 98 | +' SetSelection(Sel, MovedPoint) |
| 99 | + |
| 100 | +' End Sub |
| 101 | + |
| 102 | +' Public Sub MoveDocumentStart(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) |
| 103 | + |
| 104 | +' SetSelection(New Selection(CommonAncestror.Root, Nothing, CommonAncestror.Root.FirstChild), MovedPoint) |
| 105 | + |
| 106 | +' End Sub |
| 107 | + |
| 108 | +' Public Sub MoveDocumentEnd(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) |
| 109 | + |
| 110 | +' SetSelection(New Selection(CommonAncestror.Root, CommonAncestror.Root.LastChild, Nothing), MovedPoint) |
| 111 | + |
| 112 | +' End Sub |
113 | 113 |
|
114 |
| -End Class |
| 114 | +'End Class |
0 commit comments