logo

Allows RTF text to be edited if it's normal text without formatting. More...

Public Member Functions

string AddBoldTagInRTF (string rtf, int textpos, int sellentext)
 Make text bold. More...
 
string AddItalicTagInRTF (string rtf, int textpos, int sellentext)
 Make text italic. More...
 
string AddUnderlineTagInRTF (string rtf, int textpos, int sellentext)
 Make text underline. More...
 
string AddStrikeTagInRTF (string rtf, int textpos, int sellentext)
 Make text striketought. More...
 
string RemoveBoldTagsInRTF (string rtf, int textpos, int sellentext)
 Remove text bold. More...
 
string RemoveItalicTagsInRTF (string rtf, int textpos, int sellentext)
 Remove italic text. More...
 
string RemoveStrikeTagsInRTF (string rtf, int textpos, int sellentext)
 Remove striketought text. More...
 
string RemoveUnderlineTagsInRTF (string rtf, int textpos, int sellentext)
 Remove underline text. More...
 
string SetColorAllRTF (string rtf, Color newclr, int textlength)
 Set all rtf text to a particulair color. More...
 
string SetSizeTagInRtf (string rtf, int textpos, int seltextlen, int fontsize)
 Set the font size in RTF. More...
 
string SetColorInRTF (string rtf, Color newclr, int textpos, int sellentext)
 The color of text in the RTF stream, More...
 

Private Member Functions

int NextTextChar (int nrtextchar)
  More...
 
string RemoveTagsInRTF (string rtf, int textpos, int sellentext, string starttag, string endtag)
 Remove all RTF tags in selected text. More...
 
bool CheckTagOpened (bool tagopen, string rtf, int i, string starttag, string endtag)
 Check if the RTF tag is open. More...
 
StringBuilder RemoveTag (StringBuilder newrtf, string rtf, int i, string starttag, string endtag)
 Remove RTF tags, between position i for length of sellentext. More...
 
string SetTagInRTF (string rtf, int textpos, int sellentext, string starttag, string endtag)
 Add a RTF start- and endtag to the RTF stream More...
 
bool InRTFFormat (string rtf, int pos, bool rtfformat)
 Figure out if the RTF stream is at position pos still in RTF format mode or is displaying the text from the RTF stream. More...
 
bool IsRTFTab (string rtf, int i)
 Is there a RTF tab code at a position in a RTF stream. More...
 
int FindStartPosDoc (string rtf)
 Find the start of the RTF document content. More...
 
StringBuilder CreateColortbl (StringBuilder newrtf, Color textcolor)
 Create a colortable in the rtf stream. More...
 
int CheckRTFLevel (string rtf, int i, int rtflevel)
 Check if rtf contains a new level or depth document level has been gone up. Escape \ characters are not a new rtf level. More...
 
bool IsRTFSpecialChar (string rtf, int i)
 Is the RTF part at a position a RTF special chracter escaping. More...
 
int IntParseFast (string value)
 Converts a string to integer, optimization. More...
 
int GetNrcoloritem (string rtf, Color clr)
 Get the position of a color in the current colortbl. More...
 
Color ParserColorItem (string colortblraw)
 Parser a string with a coloritem from the colortbl in the RTF stream as a color object. More...
 
void ParserColorTbl (string rtf, int posstartcolortbl)
 Parser the colortbl in the RTF stream at position posstartcolortbl. Put all coloritems in the list colortblitems. More...
 
StringBuilder AddColorItem (StringBuilder newrtf, int posstartcolortbl, Color newclr)
 Add a color to the RTF colortbl. More...
 
int FindPosStartColortbl (string rtf)
 Find the start position of the colortbl in the RTF stream. More...
 
int GetLenDigit (string text, int startpos)
 Get the length of the digits in a string at a position More...
 

Private Attributes

const string RTF1DOCTAG = @"{\rtf1"
 The RTF start tag More...
 
const string VIEWKINDTAG = @"\viewkind"
 The RTF document viewkind tag More...
 
const string COLORTBLTAG = @"{\colortbl "
 The RTF colortable tag More...
 
const string COLORITEMTAG = @"\cf"
 The RTF color format tag More...
 
const string RTFTABTAG = @"\tab"
 RTF tab character More...
 
const string RTFBOLDTAG = @"\b"
 RTF bold character More...
 
const string RTFBOLDENDTAG = @"\b0"
 RTF bold end character More...
 
const string RTFITALICTAG = @"\i"
 RTF italic tag More...
 
const string RTFITALICENDTAG = @"\i0"
 RTF italic endtag More...
 
const string RTFSTRIKETAG = @"\strike"
 RTF strike tag More...
 
const string RTFSTRIKEENDTAG = @"\strike0"
 RTF strike endtag More...
 
const string RTFUNDERLINETAG = @"\ul"
 RTF underline tag More...
 
const string RTFUNDERLINEENDTAG = @"\ulnone"
 RTF enderline endtag More...
 
const int MAXLENRTFTTAG = 10
 Maximum length of a RTF tag More...
 
List< Color > colortblitems = new List<Color>()
 List with colortable coloritems More...
 
bool rtfformat = true
 Are we at current position in the RTF document buzy with RTF code format or text content. More...
 
int drtflen = 0
 Different length between orginal RTF and new rtf. More...
 
char[] hexchars = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }
 Array with hexcharacters (lowercase alpha). More...
 

Detailed Description

Member Function Documentation

string NoteFly.RTFDirectEdit.AddBoldTagInRTF ( string  rtf,
int  textpos,
int  sellentext 
)
Parameters
rtfThe rtf stream.
textposThe text position.
sellentextThe selected length to make bold.
Returns
The rtf stream with new bold formatting.
StringBuilder NoteFly.RTFDirectEdit.AddColorItem ( StringBuilder  newrtf,
int  posstartcolortbl,
Color  newclr 
)
private
Parameters
newrtfThe rtf stream.
posstartcolortblThe position of start of colortbl in RTF.
newclrThe new color to add to the colortbl.
Returns
The new RTF with the color add to the colortbl.
string NoteFly.RTFDirectEdit.AddItalicTagInRTF ( string  rtf,
int  textpos,
int  sellentext 
)
Parameters
rtfThe rtf stream.
textposThe text position.
sellentextThe selected length to make italic.
Returns
The rtf stream with new italic formatting.
string NoteFly.RTFDirectEdit.AddStrikeTagInRTF ( string  rtf,
int  textpos,
int  sellentext 
)
Parameters
rtfThe rtf stream.
textposThe text position.
sellentextThe selected length to make striketought.
Returns
The rtf stream with new striketought formatting.
string NoteFly.RTFDirectEdit.AddUnderlineTagInRTF ( string  rtf,
int  textpos,
int  sellentext 
)
Parameters
rtfThe rtf stream.
textposThe text position.
sellentextThe selected length to make underline.
Returns
The rtf stream with new underline formatting.
int NoteFly.RTFDirectEdit.CheckRTFLevel ( string  rtf,
int  i,
int  rtflevel 
)
private
Parameters
rtfThe rtf stream.
iThe position in RTF
rtflevelCurrent RTF depth level.
Returns
New RTF depth level.
bool NoteFly.RTFDirectEdit.CheckTagOpened ( bool  tagopen,
string  rtf,
int  i,
string  starttag,
string  endtag 
)
private
Parameters
tagopenTrue if tag open.
rtfThe rtf stream.
iPosition in the rtf stream.
starttagRTF start tag.
endtagRTF end tag.
Returns
True if tag still in open state.
StringBuilder NoteFly.RTFDirectEdit.CreateColortbl ( StringBuilder  newrtf,
Color  textcolor 
)
private
Parameters
newrtfThe rtf stream.
textcolorThe textcolor to add to the color table rtf stream.
Returns
StringBuilder of colortbl.
int NoteFly.RTFDirectEdit.FindPosStartColortbl ( string  rtf)
private
Parameters
rtfThe rtf stream.
Returns
The position in the RTF.
int NoteFly.RTFDirectEdit.FindStartPosDoc ( string  rtf)
private
Parameters
rtfThe rtf stream.
Returns
The position after viewkind rtftag in the rtf stream.
int NoteFly.RTFDirectEdit.GetLenDigit ( string  text,
int  startpos 
)
private
Parameters
textText with digits at startpos
startposThe position where the digit are
Returns
The length of the digits
int NoteFly.RTFDirectEdit.GetNrcoloritem ( string  rtf,
Color  clr 
)
private
Parameters
rtfThe rtf stream.
clrColor object
Returns
Returns -1 if coloritem in colortbl is not found.
bool NoteFly.RTFDirectEdit.InRTFFormat ( string  rtf,
int  pos,
bool  rtfformat 
)
private
Parameters
rtfThe rtf stream.
posThe position to check.
rtfformatThe current rtf status, in rtf formating if true
Returns
True if document at pos is in rtf formating mode.
int NoteFly.RTFDirectEdit.IntParseFast ( string  value)
private
Parameters
valueAn nummeric string.
Returns
An integer.
bool NoteFly.RTFDirectEdit.IsRTFSpecialChar ( string  rtf,
int  i 
)
private
Parameters
rtfThe rtf stream.
iThe RTF position in where the special character starts
Returns
True if there is a special character RTF code at position i.
bool NoteFly.RTFDirectEdit.IsRTFTab ( string  rtf,
int  i 
)
private
Parameters
rtfThe rtf stream.
iPosition with the rtf stream to look for a tab rtf character.
Returns
True if rtf at position i is RTF tab code.
int NoteFly.RTFDirectEdit.NextTextChar ( int  nrtextchar)
private
Parameters
nrtextchar
Returns
Color NoteFly.RTFDirectEdit.ParserColorItem ( string  colortblraw)
private
Parameters
colortblrawAn string with a coloritem for the RTF colortbl.
Returns
An color object.
void NoteFly.RTFDirectEdit.ParserColorTbl ( string  rtf,
int  posstartcolortbl 
)
private
Parameters
rtfThe rtf stream.
posstartcolortblPosition of where the colortbl starts.
string NoteFly.RTFDirectEdit.RemoveBoldTagsInRTF ( string  rtf,
int  textpos,
int  sellentext 
)
Parameters
rtfThe rtf stream.
textposThe text position.
sellentextThe selected length to remove bold formatting from.
Returns
The rtf stream without bold formatting.
string NoteFly.RTFDirectEdit.RemoveItalicTagsInRTF ( string  rtf,
int  textpos,
int  sellentext 
)
Parameters
rtfThe rtf stream.
textposThe text position.
sellentextThe selected length to remove italic formatting from.
Returns
The new rtf stream without italic formatting.
string NoteFly.RTFDirectEdit.RemoveStrikeTagsInRTF ( string  rtf,
int  textpos,
int  sellentext 
)
Parameters
rtfThe rtf stream.
textposThe text position.
sellentextThe select text length.
Returns
The new rtf stream without striketought formatting.
StringBuilder NoteFly.RTFDirectEdit.RemoveTag ( StringBuilder  newrtf,
string  rtf,
int  i,
string  starttag,
string  endtag 
)
private
Parameters
newrtfThe new rtf stream.
rtfThe rtf stream.
iPosition the rtf stream.
starttagRTF start tag.
endtagRTF end tag.
Returns
The new rtf stream as stringbuilder.
string NoteFly.RTFDirectEdit.RemoveTagsInRTF ( string  rtf,
int  textpos,
int  sellentext,
string  starttag,
string  endtag 
)
private
Parameters
rtfThe rtf stream.
textposThe text position.
sellentextThe selected text length.
starttagThe RTF starttag to remove.
endtagThe RTF endtag to remove. Should be of the same kind as RTF starttag.
Returns
The new rtf stream.
string NoteFly.RTFDirectEdit.RemoveUnderlineTagsInRTF ( string  rtf,
int  textpos,
int  sellentext 
)
Parameters
rtfThe rtf stream.
textposThe text position.
sellentextThe selected text length.
Returns
The new rtf stream.
string NoteFly.RTFDirectEdit.SetColorAllRTF ( string  rtf,
Color  newclr,
int  textlength 
)
Parameters
rtfThe rtf stream.
newclrThe color to use for all text in the rtf stream.
textlengthThe length of the real text in the rtf stream.
Returns
The new rtf stream.
string NoteFly.RTFDirectEdit.SetColorInRTF ( string  rtf,
Color  newclr,
int  textpos,
int  sellentext 
)
Parameters
rtfThe rtf stream.
newclrThe color to give the text.
textposThe text position.
sellentextThe text length to color.
Returns
The new RTF stream.
string NoteFly.RTFDirectEdit.SetSizeTagInRtf ( string  rtf,
int  textpos,
int  seltextlen,
int  fontsize 
)
Parameters
rtfThe RTF stream.
textposThe text position.
seltextlenThe selected text length.
fontsizeThe new font size.
Returns
string NoteFly.RTFDirectEdit.SetTagInRTF ( string  rtf,
int  textpos,
int  sellentext,
string  starttag,
string  endtag 
)
private
Parameters
rtfThe rtf stream.
textposThe text position where to add the starttag
sellentextThe length of the text after the starttag to add the RTF end tag.
starttagThe RTF start tag to add.
endtagThe RTF end tag to add.
Returns
The new rtf stream.

Member Data Documentation

const string NoteFly.RTFDirectEdit.COLORITEMTAG = @"\cf"
private
List<Color> NoteFly.RTFDirectEdit.colortblitems = new List<Color>()
private
const string NoteFly.RTFDirectEdit.COLORTBLTAG = @"{\colortbl "
private
int NoteFly.RTFDirectEdit.drtflen = 0
private
char [] NoteFly.RTFDirectEdit.hexchars = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }
private
const int NoteFly.RTFDirectEdit.MAXLENRTFTTAG = 10
private
const string NoteFly.RTFDirectEdit.RTF1DOCTAG = @"{\rtf1"
private
const string NoteFly.RTFDirectEdit.RTFBOLDENDTAG = @"\b0"
private
const string NoteFly.RTFDirectEdit.RTFBOLDTAG = @"\b"
private
bool NoteFly.RTFDirectEdit.rtfformat = true
private
const string NoteFly.RTFDirectEdit.RTFITALICENDTAG = @"\i0"
private
const string NoteFly.RTFDirectEdit.RTFITALICTAG = @"\i"
private
const string NoteFly.RTFDirectEdit.RTFSTRIKEENDTAG = @"\strike0"
private
const string NoteFly.RTFDirectEdit.RTFSTRIKETAG = @"\strike"
private
const string NoteFly.RTFDirectEdit.RTFTABTAG = @"\tab"
private
const string NoteFly.RTFDirectEdit.RTFUNDERLINEENDTAG = @"\ulnone"
private
const string NoteFly.RTFDirectEdit.RTFUNDERLINETAG = @"\ul"
private
const string NoteFly.RTFDirectEdit.VIEWKINDTAG = @"\viewkind"
private