///
<summary>
/// WordPos is a
description for a word and position.
///
</summary>
///
<remarks>
/// The WordPos object
maintains data about the linear position within the margins of a page,
///
the
physical width of a word, the font and its whitespace characteristics.
///
</remarks>
public class
WordPos : ICloneable
{
public
float PagePos;
public
string Word;
public
float WordWidth;
public
WhiteSpace WhiteSpace;
public
Font Font;
///
<summary>
///
Constructor
///
</summary>
public
WordPos()
{
}
///
<summary>
///
Constructor for a whitespace word position
///
</summary>
///
<param name="ws">The
WhiteSpace type to use</param>
public
WordPos(WhiteSpace ws)
{
WhiteSpace
= ws;
PagePos=0;
Word =
"";
WordWidth = 0;
}
///
<summary>
///
Constructor
///
</summary>
///
<param name="ws">The
WhiteSpace type</param>
///
<param name="pp">Page
position</param>
///
<param name="word">The
string definition of the word</param>
///
<param name="ww">Word
Width</param>
///
<param name="font">the
Font used to draw the word</param>
protected
WordPos(WhiteSpace ws, float pp,
string word, float
ww, Font font)
{
WhiteSpace = ws;
PagePos=pp;
Word =
word;
WordWidth = ww;
Font=font;
}
///
<summary>
///
Creates a string definition of this object for diagnostic purposes
///
</summary>
///
<returns>a
string describing the contents of the WordPos object</returns>
public
override string
ToString()
{
return
string.Format("WordPos:\r\n"+
"\tPagePos = {0}\r\n"+
"\tWord = {1}\r\n"+
"\tWordWidth = {2}\r\n"+
"\tWhiteSpace = {3}\r\n",
PagePos,
Word,
WordWidth,
WhiteSpace);
}
///
<summary>
///
Creates a copy of the object
///
</summary>
///
<returns>a copy
of the current object</returns>
object
ICloneable.Clone()
{
return
this.Clone();
}
///
<summary>
///
returns a copy of the object
///
</summary>
///
<returns>An
exact copy of the object</returns>
public
WordPos Clone()
{
return
new WordPos(WhiteSpace,
PagePos,
Word,
WordWidth,
Font);
}
}
'/ <summary>
'/ WordPos is a description for a word and poition.
'/ </summary>
'/ <remarks>
'/ The WordPos object maintains data about the linear
position within the margins of a page, the physical width of a word, the font
and its whitespace characteristics.
'/ </remarks>
Public Class
WordPos
Implements ICloneable
'ToDo: Add Implements Clauses for implementation methods of these interface(s)
Public PagePos As
Single
Public Word As
String
Public WordWidth As
Single
Public WhiteSpace As
WhiteSpace
Public Font As
Font
'/ <summary>
'/ Constructor
'/ </summary>
Public Sub
New()
End Sub
'New
'/ <summary>
'/ Constructor for a whitespace word position
'/ </summary>
'/ <param name="ws">The WhiteSpace type to use</param>
Public Sub
New(ByVal ws
As WhiteSpace)
WhiteSpace = ws
PagePos = 0
Word = ""
WordWidth = 0
End Sub
'New
'/ <summary>
'/ Constructor
'/ </summary>
'/ <param name="ws">The WhiteSpace type</param>
'/ <param name="pp">Page position</param>
'/ <param name="word">The string definition of the
word</param>
'/ <param name="ww">Word Width</param>
'/ <param name="font">the Font used to draw the word</param>
Protected Sub
New(ByVal ws
As WhiteSpace, ByVal
pp As Single,
ByVal wrd As
String, ByVal ww
As Single,
ByVal fnt As
Font)
Me.WhiteSpace = ws
Me.PagePos = pp
Me.Word = wrd
Me.WordWidth = ww
Me.Font = fnt
End Sub
'New
'/ <summary>
'/ Creates a string definition of this object for
diagnostic purposes
'/
</summary>
'/ <returns>a string describing the contents of the
WordPos object</returns>
Public Overrides
Function ToString() As
String
Return String.Format("WordPos:"
+ ControlChars.Cr + ControlChars.Lf + ControlChars.Tab + "PagePos = {0}" +
ControlChars.Cr + ControlChars.Lf + ControlChars.Tab + "Word = {1}" +
ControlChars.Cr + ControlChars.Lf + ControlChars.Tab + "WordWidth = {2}" +
ControlChars.Cr + ControlChars.Lf + ControlChars.Tab + "WhiteSpace = {3}" +
ControlChars.Cr + ControlChars.Lf, PagePos, Word, WordWidth, WhiteSpace)
End Function
'ToString
'/ <summary>
'/ Creates a copy of the object
'/ </summary>
'/ <returns>a copy of the current object</returns>
Function Clone() As
Object Implements
ICloneable.Clone
Return New
WordPos(WhiteSpace, PagePos, Word, WordWidth, Font)
End Function
'ICloneable.Clone
End Class
'WordPos