C# Class IfacesEnumsStructsClasses.HTMLEditHelper

Helper class to perform HTML editing functions For example of usage, please refer to frmHTMLEditor.cs
Afficher le fichier Open project: mcorrientes/Web-Security-Toolset

Méthodes publiques

Свойство Type Description
HtmlAmp string
HtmlSpace string
HtmlTagClose string
HtmlTagOpen string

Méthodes publiques

Méthode Description
AddToSelection ( string s_BeginHtml, string s_EndHtml ) : bool

1) If nothing is selected returns false 2) If the user has selected text or multiple elements inserts s_BeginHtml before and s_EndHtml behind the current selection 3)If the user has selected a control returns false

AppendAnchor ( string href, string target ) : bool
AppendChild ( IHTMLElement parent, string TagName ) : IHTMLDOMNode

Creates and appends an HTMLElement to a parent element

AppendChild ( string TagName ) : IHTMLDOMNode

Creates and appends an HTMLElement to the end of the document DOM

AppendHr ( string align, string hrcolor, string width, bool noshade ) : bool
AppendImage ( string src, string width, string height, string border, string alignment, string alt, string hspace, string vspace, string lowsrc ) : bool
AppendTable ( int colnum, int rownum, int bordersize, string alignment, int cellpadding, int cellspacing, string widthpercentage, int widthpixel, string backcolor, string bordercolor, string lightbordercolor, string darkbordercolor ) : bool
DeleteCol ( IHTMLTable table, int colindex ) : void
DeleteRow ( IHTMLTable table, int rowindex ) : void

Deletes a given rowindex in a given table zero based If the table has no rows after deletion anymore we delete it compeletely

EmbedBr ( ) : bool

Embeds a BR tag at the selection

FindParent ( IHTMLElement elem, string ParentTagName ) : IHTMLElement

Searches for a parent (or grandparent) element with the given tag ParentTagName must be in the form "TD" "TR" "TABLE" (uppercase)

GetCaretPosition ( ) : tagPOINT

Attempts to retreive Caret position

GetCharIndexFromPos ( int clientX, int clientY ) : int

Attempts to retreive char index from given X and Y coordinates relative to the body content. The point must be in client coordinates

GetColCount ( IHTMLTable table, int rowindex ) : int

Gets the column count of row(rowindex) Accounts for colSpan property

GetColIndex ( IHTMLTableCell cell ) : int

Get the column of the current cell zero based

GetDocumentColor ( DocumentColors whichcolor ) : System.Drawing.Color
GetParentRow ( IHTMLElement cellelem ) : IHTMLTableRow

Returns parent row of passed cell element

GetParentTable ( IHTMLElement cellelem ) : IHTMLTable

Returns parent table of passed cell element

GetPosFromCharIndex ( int charindex ) : tagPOINT

Attempts to retreive a character position relative to the body content based on the character index.

GetRow ( IHTMLTable table, int rowindex ) : IHTMLTableRow

Zero based

GetRowCount ( IHTMLTable table ) : int
GetRowIndex ( IHTMLElement cellelem ) : int
GetWordUnderMouse ( int clientX, int clientY ) : string

Attempts to retrive a word located under mouse pointer relative to body content

HTMLEditHelper ( ) : System
InsertCol ( IHTMLTable table, int index ) : void
InsertHTML ( IHTMLElement elem, string s_Html, bool b_AtBegin, bool b_Inside ) : void

Inserts the given HTML code inside or outside of this Html element There are 4 possible insert positions: Outside-BeforeInside-Before InnerHTML Inside-AfterOuside-After

InsertRow ( IHTMLTable table, int index, int numberofcells ) : void
IsElementEmpty ( IHTMLElement elem ) : bool

Return TRUE if the element is empty inside (e.g. )

NextSibiling ( IHTMLDOMNode node ) : IHTMLElement

Returns the right neighbour which is a IHTMLElement in the HTML hierarchy

PasteIntoSelection ( string s_Html ) : bool

The currently selected text/controls will be replaced by the given HTML code. If nothing is selected, the HTML code is inserted at the cursor position

PreviousSibling ( IHTMLDOMNode node ) : IHTMLElement

Returns the left neighbour which is a IHTMLElement in the HTML hierarchy

RemoveNode ( IHTMLElement elem, bool RemoveAllChildren ) : IHTMLDOMNode

Removes node element If RemoveAllChildren == true, Removes this element and all it's children from the document else it just strips this element but does not remove its children E.g. "Hello World" ---> strip BIG tag --> "Hello World"

RemoveUnderline ( IHTMLElement elem, IHighlightSegment ihs ) : void
Row_DeleteCol ( IHTMLTableRow row, int index ) : void
Row_GetCell ( IHTMLTableRow row, int index ) : IHTMLTableCell
Row_GetCellCount ( IHTMLTableRow row ) : int
Row_InsertCell ( IHTMLTableRow row, int index ) : IHTMLElement
Row_InsertCell ( IHTMLTableRow row, int index, string cellwidth ) : IHTMLElement
Row_InsertCol ( IHTMLTableRow row, int index ) : IHTMLElement
SetCursorAtElementStart ( IHTMLElement elem ) : bool

Attempts to set the cursor at the start of the given html element The element must be a textual element such as P

SetSelectionTextFromClipboard ( ) : bool

Attempts to set the selection text from clipboard

UnderLineWord ( int wordindex, int wordlen ) : void

Attempts to find and highlight a word based on it's index and wordlen within body element

UnderLineWord2 ( IHTMLTxtRange range ) : IHighlightSegment
Underline ( IHTMLElement elem ) : void

Attempts to underline a given element To change the highlighting style, please refer to HTMLRenderStyle_xxxxxxx properties

Underline2 ( IHTMLElement elem ) : IHighlightSegment

Underline variation which returns IHighlightSegmentinstance

Private Methods

Méthode Description
CalculateCellWidths ( int numberofcols ) : void

Method Details

AddToSelection() public méthode

1) If nothing is selected returns false 2) If the user has selected text or multiple elements inserts s_BeginHtml before and s_EndHtml behind the current selection 3)If the user has selected a control returns false
public AddToSelection ( string s_BeginHtml, string s_EndHtml ) : bool
s_BeginHtml string
s_EndHtml string
Résultat bool

AppendAnchor() public méthode

public AppendAnchor ( string href, string target ) : bool
href string
target string
Résultat bool

AppendChild() public méthode

Creates and appends an HTMLElement to a parent element
public AppendChild ( IHTMLElement parent, string TagName ) : IHTMLDOMNode
parent IHTMLElement
TagName string a, img, table,...
Résultat IHTMLDOMNode

AppendChild() public méthode

Creates and appends an HTMLElement to the end of the document DOM
public AppendChild ( string TagName ) : IHTMLDOMNode
TagName string a, img, table,...
Résultat IHTMLDOMNode

AppendHr() public méthode

public AppendHr ( string align, string hrcolor, string width, bool noshade ) : bool
align string
hrcolor string
width string
noshade bool
Résultat bool

AppendImage() public méthode

public AppendImage ( string src, string width, string height, string border, string alignment, string alt, string hspace, string vspace, string lowsrc ) : bool
src string
width string
height string
border string
alignment string
alt string
hspace string
vspace string
lowsrc string
Résultat bool

AppendTable() public méthode

public AppendTable ( int colnum, int rownum, int bordersize, string alignment, int cellpadding, int cellspacing, string widthpercentage, int widthpixel, string backcolor, string bordercolor, string lightbordercolor, string darkbordercolor ) : bool
colnum int
rownum int
bordersize int
alignment string
cellpadding int
cellspacing int
widthpercentage string
widthpixel int
backcolor string
bordercolor string
lightbordercolor string
darkbordercolor string
Résultat bool

DeleteCol() public méthode

public DeleteCol ( IHTMLTable table, int colindex ) : void
table IHTMLTable
colindex int
Résultat void

DeleteRow() public méthode

Deletes a given rowindex in a given table zero based If the table has no rows after deletion anymore we delete it compeletely
public DeleteRow ( IHTMLTable table, int rowindex ) : void
table IHTMLTable
rowindex int
Résultat void

EmbedBr() public méthode

Embeds a BR tag at the selection
public EmbedBr ( ) : bool
Résultat bool

FindParent() public méthode

Searches for a parent (or grandparent) element with the given tag ParentTagName must be in the form "TD" "TR" "TABLE" (uppercase)
public FindParent ( IHTMLElement elem, string ParentTagName ) : IHTMLElement
elem IHTMLElement
ParentTagName string
Résultat IHTMLElement

GetCaretPosition() public méthode

Attempts to retreive Caret position
public GetCaretPosition ( ) : tagPOINT
Résultat tagPOINT

GetCharIndexFromPos() public méthode

Attempts to retreive char index from given X and Y coordinates relative to the body content. The point must be in client coordinates
public GetCharIndexFromPos ( int clientX, int clientY ) : int
clientX int
clientY int
Résultat int

GetColCount() public méthode

Gets the column count of row(rowindex) Accounts for colSpan property
public GetColCount ( IHTMLTable table, int rowindex ) : int
table IHTMLTable
rowindex int
Résultat int

GetColIndex() public méthode

Get the column of the current cell zero based
public GetColIndex ( IHTMLTableCell cell ) : int
cell IHTMLTableCell
Résultat int

GetDocumentColor() public méthode

public GetDocumentColor ( DocumentColors whichcolor ) : System.Drawing.Color
whichcolor DocumentColors
Résultat System.Drawing.Color

GetParentRow() public méthode

Returns parent row of passed cell element
public GetParentRow ( IHTMLElement cellelem ) : IHTMLTableRow
cellelem IHTMLElement
Résultat IHTMLTableRow

GetParentTable() public méthode

Returns parent table of passed cell element
public GetParentTable ( IHTMLElement cellelem ) : IHTMLTable
cellelem IHTMLElement
Résultat IHTMLTable

GetPosFromCharIndex() public méthode

Attempts to retreive a character position relative to the body content based on the character index.
public GetPosFromCharIndex ( int charindex ) : tagPOINT
charindex int
Résultat tagPOINT

GetRow() public méthode

Zero based
public GetRow ( IHTMLTable table, int rowindex ) : IHTMLTableRow
table IHTMLTable
rowindex int
Résultat IHTMLTableRow

GetRowCount() public méthode

public GetRowCount ( IHTMLTable table ) : int
table IHTMLTable
Résultat int

GetRowIndex() public méthode

public GetRowIndex ( IHTMLElement cellelem ) : int
cellelem IHTMLElement
Résultat int

GetWordUnderMouse() public méthode

Attempts to retrive a word located under mouse pointer relative to body content
public GetWordUnderMouse ( int clientX, int clientY ) : string
clientX int Left cocordinates based relative to client
clientY int Top cocordinates based relative to client
Résultat string

HTMLEditHelper() public méthode

public HTMLEditHelper ( ) : System
Résultat System

InsertCol() public méthode

public InsertCol ( IHTMLTable table, int index ) : void
table IHTMLTable
index int
Résultat void

InsertHTML() public méthode

Inserts the given HTML code inside or outside of this Html element There are 4 possible insert positions: Outside-BeforeInside-Before InnerHTML Inside-AfterOuside-After
public InsertHTML ( IHTMLElement elem, string s_Html, bool b_AtBegin, bool b_Inside ) : void
elem IHTMLElement
s_Html string
b_AtBegin bool
b_Inside bool
Résultat void

InsertRow() public méthode

public InsertRow ( IHTMLTable table, int index, int numberofcells ) : void
table IHTMLTable
index int
numberofcells int
Résultat void

IsElementEmpty() public méthode

Return TRUE if the element is empty inside (e.g. )
public IsElementEmpty ( IHTMLElement elem ) : bool
elem IHTMLElement
Résultat bool

NextSibiling() public méthode

Returns the right neighbour which is a IHTMLElement in the HTML hierarchy
public NextSibiling ( IHTMLDOMNode node ) : IHTMLElement
node IHTMLDOMNode
Résultat IHTMLElement

PasteIntoSelection() public méthode

The currently selected text/controls will be replaced by the given HTML code. If nothing is selected, the HTML code is inserted at the cursor position
public PasteIntoSelection ( string s_Html ) : bool
s_Html string
Résultat bool

PreviousSibling() public méthode

Returns the left neighbour which is a IHTMLElement in the HTML hierarchy
public PreviousSibling ( IHTMLDOMNode node ) : IHTMLElement
node IHTMLDOMNode
Résultat IHTMLElement

RemoveNode() public méthode

Removes node element If RemoveAllChildren == true, Removes this element and all it's children from the document else it just strips this element but does not remove its children E.g. "Hello World" ---> strip BIG tag --> "Hello World"
public RemoveNode ( IHTMLElement elem, bool RemoveAllChildren ) : IHTMLDOMNode
elem IHTMLElement
RemoveAllChildren bool
Résultat IHTMLDOMNode

RemoveUnderline() public méthode

public RemoveUnderline ( IHTMLElement elem, IHighlightSegment ihs ) : void
elem IHTMLElement
ihs IHighlightSegment
Résultat void

Row_DeleteCol() public méthode

public Row_DeleteCol ( IHTMLTableRow row, int index ) : void
row IHTMLTableRow
index int
Résultat void

Row_GetCell() public méthode

public Row_GetCell ( IHTMLTableRow row, int index ) : IHTMLTableCell
row IHTMLTableRow
index int
Résultat IHTMLTableCell

Row_GetCellCount() public méthode

public Row_GetCellCount ( IHTMLTableRow row ) : int
row IHTMLTableRow
Résultat int

Row_InsertCell() public méthode

public Row_InsertCell ( IHTMLTableRow row, int index ) : IHTMLElement
row IHTMLTableRow
index int
Résultat IHTMLElement

Row_InsertCell() public méthode

public Row_InsertCell ( IHTMLTableRow row, int index, string cellwidth ) : IHTMLElement
row IHTMLTableRow
index int
cellwidth string
Résultat IHTMLElement

Row_InsertCol() public méthode

public Row_InsertCol ( IHTMLTableRow row, int index ) : IHTMLElement
row IHTMLTableRow
index int
Résultat IHTMLElement

SetCursorAtElementStart() public méthode

Attempts to set the cursor at the start of the given html element The element must be a textual element such as P
public SetCursorAtElementStart ( IHTMLElement elem ) : bool
elem IHTMLElement
Résultat bool

SetSelectionTextFromClipboard() public méthode

Attempts to set the selection text from clipboard
public SetSelectionTextFromClipboard ( ) : bool
Résultat bool

UnderLineWord() public méthode

Attempts to find and highlight a word based on it's index and wordlen within body element
public UnderLineWord ( int wordindex, int wordlen ) : void
wordindex int
wordlen int
Résultat void

UnderLineWord2() public méthode

public UnderLineWord2 ( IHTMLTxtRange range ) : IHighlightSegment
range IHTMLTxtRange
Résultat IHighlightSegment

Underline() public méthode

Attempts to underline a given element To change the highlighting style, please refer to HTMLRenderStyle_xxxxxxx properties
public Underline ( IHTMLElement elem ) : void
elem IHTMLElement
Résultat void

Underline2() public méthode

Underline variation which returns IHighlightSegmentinstance
public Underline2 ( IHTMLElement elem ) : IHighlightSegment
elem IHTMLElement
Résultat IHighlightSegment

Property Details

HtmlAmp public_oe property

public string HtmlAmp
Résultat string

HtmlSpace public_oe property

public string HtmlSpace
Résultat string

HtmlTagClose public_oe property

public string HtmlTagClose
Résultat string

HtmlTagOpen public_oe property

public string HtmlTagOpen
Résultat string