internal BaseHighLightCell(Interop.IHTMLTableCell Cell, IHtmlEditor htmlEditor) { if (Cell != null) { GenericCell = (Interop.IHTMLElement)Cell; m_Col = Cell.cellIndex; m_Row = ((Interop.IHTMLTableRow)((Interop.IHTMLElement)Cell).GetParentElement()).rowIndex; } }
/// <summary> /// Adds a cell to the specified row /// </summary> /// <param name="rowIndex"></param> /// <param name="cell"></param> public void AddCell(int rowIndex, Interop.IHTMLTableCell cell) { ArrayList currentRow; int row; int colSpan; int colIndex; int rowSpanCount; ArrayList cellList; currentRow = (ArrayList)this._rows[rowIndex]; row = 0; while (row < currentRow.Count && currentRow[row] != null) { row++; } colSpan = 0; while (colSpan < cell.colSpan) { colIndex = row + colSpan; this.EnsureIndex(currentRow, colIndex); currentRow[colIndex] = cell; if (!(this._cells.Contains(cell))) { this._cells[cell] = new Pair(rowIndex, colIndex); } rowSpanCount = 1; while (rowSpanCount < cell.rowSpan) { if (rowIndex + 1 >= this._rows.Count) { this._rows.Add(new ArrayList()); } cellList = (ArrayList)this._rows[rowIndex + rowSpanCount]; this.EnsureIndex(cellList, colIndex); cellList[colIndex] = cell; if (!(this._cells.Contains(cell))) { this._cells[cell] = new Pair(rowIndex + rowSpanCount, colIndex); } rowSpanCount++; } colSpan++; } CellCoordinate cc = new CellCoordinate(); cc.row = (int)((Pair)this._cells[cell]).First; cc.col = (int)((Pair)this._cells[cell]).Second; cc.x = ((Interop.IHTMLElement)cell).GetOffsetLeft(); cc.y = ((Interop.IHTMLElement)cell).GetOffsetTop(); cc.w = ((Interop.IHTMLElement)cell).GetOffsetWidth(); cc.h = ((Interop.IHTMLElement)cell).GetOffsetHeight(); cc.r = cc.x + cc.w; cc.b = cc.y + cc.h; this.CellCoordinates.Add(cc); }
/// <summary> /// Add a cell to the collection of highlighted cells. /// </summary> /// <param name="Cell">The base cell</param> /// <returns>The highlighted cell</returns> private BaseHighLightCell AddHighLightCell(Interop.IHTMLTableCell Cell) { BaseHighLightCell hCell = m_HighLightCellFactory.CreateHighLightCell(Cell); if (!m_Cells.Contains(hCell)) { System.Diagnostics.Debug.WriteLine("AddHighLightCell", Cell.GetHashCode().ToString()); hCell.MakeHighLight(); m_Cells.Add(hCell); } return(hCell); }
/// <summary> /// Returns the coordinates of a given cell element /// </summary> /// <param name="cell">Cell element to check</param> /// <param name="row">row index</param> /// <param name="col">column index</param> public void GetCellPoint(Interop.IHTMLTableCell cell, ref int row, ref int col) { Pair pair = (Pair)this._cells [cell]; if (pair != null) { row = (int)pair.First; col = (int)pair.Second; return; } row = -1; col = -1; return; }
/// <summary> /// Remove highlight cells and protect the first cell. This method removes the behavior and clears the stack completely. /// </summary> /// <param name="PreserveFirst"></param> internal void RemoveHighLight(bool PreserveFirst) { Interop.IHTMLTableCell preservedCell = null; if (m_Cells.Count > 0) { preservedCell = m_Cells[0] as Interop.IHTMLTableCell; } foreach (BaseHighLightCell cell in m_Cells) { cell.ReleaseHighLight(); } m_Cells.Clear(); if (PreserveFirst && preservedCell != null) { this.AddHighLightCell(preservedCell); } }
internal BaseHighLightCell CreateHighLightCell(Interop.IHTMLTableCell Cell) { return(new HighLightCellColor(_HighLightColor, _HighLightBorderColor, Cell, htmlEditor)); }
/// <summary> /// Method to add a new cell to the collection. /// </summary> /// <param name="Cell">The cell to add.</param> internal void AddCell(Interop.IHTMLTableCell Cell) { this.AddHighLightCell(Cell); }
/// <summary> /// Constructor, sets the base values for highlighting. /// </summary> /// <param name="HighLightColor">Background color</param> /// <param name="HighLightBorderColor">Border color</param> /// <param name="Cell">Cell to which the highlight should added</param> /// <param name="htmlEditor"></param> internal HighLightCellColor(Color HighLightColor, Color HighLightBorderColor, Interop.IHTMLTableCell Cell, IHtmlEditor htmlEditor) : base(Cell, htmlEditor) { _HighLightColor = HighLightColor; _HighLightBorderColor = HighLightBorderColor; _cookie = -1; if (_behavior == null) { _behavior = new HighLightCellBehavior(htmlEditor); } }