The WordPosCollection class.
///
<summary>
/// A specialized
collection class that manages WordPos objects
///
</summary>
public class
WordPosCollection : CollectionBase
{
bool
_containsNewline=false;
bool
_newParagraph=false;
///
<summary>
///
///
</summary>
public
bool NewParagraph
{
get{return
_newParagraph;}
set{_newParagraph=value;}
}
///
<summary>
///
Readonly property. when true, the formatted text contains a newline whitespace
character
///
</summary>
public
bool ContainsNewline
{
get{return
_containsNewline;}
}
///
<summary>
///
Strongly typed method to add WordPos objects to the cllection.
///
</summary>
///
<param name="wp">The
WordPos object to add</param>
public
void Add(WordPos wp)
{
if(wp.WhiteSpace==WhiteSpace.NewLine)
_containsNewline=true;
List.Add(wp);
}
///
<summary>
///
Indexer that gets and sets WordPos objecs at a specified index within the
collection
///
</summary>
public
WordPos this[int
index]
{
get{return
(WordPos)List[index];}
set
{
if(value.WhiteSpace==WhiteSpace.NewLine)
this._containsNewline=true;
List[index]=value;
}
}
///
<summary>
///
Removes the last WordPos object from the collection.
///
</summary>
public
void RemoveLast()
{
List.RemoveAt(List.Count-1);
}
///
<summary>
///
Returns the last WordPos object in the collection.
///
</summary>
///
<returns>The
last WordPos object in the collection</returns>
public
WordPos Last()
{
if(List.Count==0)
return
null;
return
(WordPos)List[List.Count-1];
}
}
'/ <summary>
'/ A specialized collection class that manages WordPos
objects
'/ </summary>
Public Class
WordPosCollection
Inherits
CollectionBase
Private
_containsNewline As
Boolean = False
Private
_newParagraph As
Boolean = False
'/
<summary>
'/
'/
</summary>
Public
Property NewParagraph()
As Boolean
Get
Return
_newParagraph
End
Get
Set(ByVal
Value As Boolean)
_newParagraph = value
End
Set
End
Property
'/
<summary>
'/
Readonly property. when true, the formatted text contains a newline whitespace
character
'/
</summary>
Public
ReadOnly Property
ContainsNewline() As
Boolean
Get
Return
_containsNewline
End
Get
End
Property
'/
<summary>
'/
Strongly typed method to add WordPos objects to the cllection.
'/
</summary>
'/
<param name="wp">The WordPos object to add</param>
Public
Sub Add(ByVal wp
As WordPos)
If
wp.WhiteSpace = WhiteSpace.NewLine Then
_containsNewline = True
End
If
List.Add(wp)
End
Sub 'Add
'/
<summary>
'/
Indexer that gets and sets WordPos objecs at a specified index within the
collection
'/
</summary>
Default
Public Property
Item(ByVal index As
Integer) As
WordPos
Get
Return
CType(List(index), WordPos)
End
Get
Set(ByVal
Value As WordPos)
If
value.WhiteSpace = WhiteSpace.NewLine Then
Me._containsNewline
= True
End
If
List(index)
= value
End
Set
End
Property
'/
<summary>
'/
Removes the last WordPos object from the collection.
'/
</summary>
Public
Sub RemoveLast()
List.RemoveAt((List.Count
- 1))
End
Sub 'RemoveLast
'/
<summary>
'/
Returns the last WordPos object in the collection.
'/
</summary>
'/
<returns>The last WordPos object in the collection</returns>
Public
Function Last() As
WordPos
If
List.Count = 0 Then
Return
Nothing
End
If
Return
CType(List((List.Count - 1)), WordPos)
End
Function 'Last
End Class
'WordPosCollection