本文整理汇总了C#中Nodes.Node.HasChildren方法的典型用法代码示例。如果您正苦于以下问题:C# Node.HasChildren方法的具体用法?C# Node.HasChildren怎么用?C# Node.HasChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nodes.Node
的用法示例。
在下文中一共展示了Node.HasChildren方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: create
private Node create(Node node, Node selectedNode, Node lastSelectedNode)
{
Node n = new Node();
n.tagDeleted = node.tagDeleted;
n.tokenType = node.tokenType;
n.xmlTagName = node.xmlTagName;
n.namespaceURI = node.namespaceURI;
n.isVisible = node.isVisible;
n.isGlyph = node.isGlyph;
n.skip = node.skip;
n.literalText = node.literalText;
n.literalCaret = node.literalCaret;
n.literalStart = node.literalStart;
n.yOffset = node.yOffset;
n.displayStyle = node.displayStyle;
n.glyph = node.glyph;
n.scriptLevel_ = node.scriptLevel_;
n.type_ = node.type_;
if (node.attrs != null)
{
n.attrs = new AttributeList();
node.attrs.CopyTo(n.attrs);
}
n.FontStyle = node.FontStyle;
if (node.style_ != null)
{
n.style_ = new StyleAttributes();
node.style_.CopyTo(n.style_);
}
if (node == selectedNode)
{
this.selected_ = n;
}
if (node == lastSelectedNode)
{
this.lastSel_ = n;
}
if (node.HasChildren())
{
NodesList list = node.GetChildrenNodes();
int count = list.Count;
for (int i = 0; i < count; i++)
{
Node c = list.Get(i);
Node child = this.create(c, selectedNode, lastSelectedNode);
if (child != null)
{
n.AdoptChild(child);
}
}
}
return n;
}
示例2: FillBackground
public void FillBackground(Node node)
{
if (node.HasChildren())
{
NodesList nodesList = node.GetChildrenNodes();
Node n = nodesList.Next();
int x = 0;
int y = 0;
int w = 0;
int h = 0;
while (n != null)
{
if (n.NotOnWhite())
{
x = n.box.X;
y = n.box.Y;
w = n.box.Width;
h = n.box.Height;
int count = 0;
while (((n.nextSibling != null) && n.nextSibling.NotOnWhite()) && (n.nextSibling.Background == n.Background))
{
n = n.nextSibling;
if (n.box.Y < y)
{
h += y - n.box.Y;
y = n.box.Y;
}
if ((n.box.X + n.box.Width) > (x + w))
{
w = (n.box.X + n.box.Width) - x;
}
if ((n.box.Y + n.box.Height) > (y + h))
{
h = (n.box.Y + n.box.Height) - y;
}
count++;
}
if (count > 0)
{
this.FillRectangle(x, y, w, h, n.Background);
}
}
if (n != null)
{
n = nodesList.Next();
}
}
}
}
示例3: IsEmptyCell
//
private bool IsEmptyCell (Node node)
{
bool r = false;
try
{
if (node.type_.type != ElementType.Mtd)
{
return r;
}
if (node.HasChildren ())
{
if (((node.numChildren == 1) && (node.firstChild.type_.type == ElementType.Mrow)) &&
(node.firstChild.numChildren == 0))
{
r = true;
}
return r;
}
return true;
}
catch
{
return r;
}
}
示例4: TagAsDeleted
//
private void TagAsDeleted (Node node)
{
if (node.HasChildren ())
{
NodesList list = node.GetChildrenNodes ();
for (int i = 0; i < list.Count; i++)
{
Node n = list.Get (i);
if (n != null)
{
this.TagAsDeleted (n);
}
}
}
node.tagDeleted = true;
node = null;
}
示例5: EnterPressed_NeedSplit
//
private bool EnterPressed_NeedSplit (bool splitCell)
{
bool isTop = false;
try
{
Node cur = this.GetCurrentlySelectedNode ();
if (((cur == null)) || (cur.type_.type == ElementType.Math))
{
return isTop;
}
try
{
bool isLast = false;
bool isfirst = false;
Node td = null;
Node c = cur;
bool isMath = false;
while (((c.parent_ != null) && !isMath) && (c.type_.type != ElementType.Mtd))
{
if (c.type_.type == ElementType.Math)
{
isMath = true;
continue;
}
td = c;
c = c.parent_;
}
if ((c != null) && (c.type_.type == ElementType.Mtd))
{
Node cell = c;
if (cell.nextSibling == null)
{
isLast = true;
}
if (((cell.nextSibling != null) && (cell.prevSibling == null)) &&
((cell.firstChild == cur) && (cur.InternalMark == 0)))
{
isfirst = true;
}
if ((cell.parent_ != null) && (cell.parent_.type_.type == ElementType.Mtr))
{
Node row = cell.parent_;
int numCols = row.numChildren;
string xml = "<math xmlns=\"http://www.w3.org/1998/Math/MathML\">";
xml = xml + "<mtable columnalign=\"left\">";
xml = xml + "<mtr>";
for (int i = 0; i < numCols; i++)
{
if (i == 0)
{
xml = xml + "<mtd nugenCursor=''/>";
}
else
{
xml = xml + "<mtd><mrow/></mtd>";
}
}
xml = xml + "</mtr>";
xml = xml + "</mtable>";
xml = xml + "</math>";
XmlDocument doc = new XmlDocument ();
doc.LoadXml (xml);
XmlNode topnode = doc.DocumentElement.FirstChild;
Node newNode = new Node ();
Node newSelected = newNode.Parse (topnode, this.types_, this.entityManager, true, null);
Node toSel = null;
if (newNode.HasChildren ())
{
newNode = newNode.firstChild;
}
if (newNode.type_.type != ElementType.Mtr)
{
return isTop;
}
if (isfirst)
{
row.PrependNode (newNode);
this.PropogateAttributes (row, newNode);
if ((newSelected.type_.type == ElementType.Mtd) && (newSelected.numChildren == 0))
{
newSelected.AdoptChild (this.CreateRow ());
}
this.SelectNode (cur, false);
return isTop;
}
row.AppendNode (newNode);
this.PropogateAttributes (row, newNode);
if (newSelected == null)
{
return isTop;
}
if (splitCell && isLast)
{
if (td != null)
{
Node cel = td;
toSel = newSelected;
int num = 0;
if ((cel.InternalMark == 0) && (cel.prevSibling == null))
//.........这里部分代码省略.........
示例6: ApplyActionAttrs
//
public bool ApplyActionAttrs (Node node, ActionAttributes ActionAttributes, string statusLine)
{
try
{
this.OnInsert (false);
if ((ActionAttributes.actionType == ActionType.StatusLine) ||
(ActionAttributes.actionType == ActionType.ToolTip))
{
try
{
if (node.HasChildren ())
{
Node first = node.firstChild;
if ((first != null) && (first.nextSibling != null))
{
first = first.nextSibling;
if (first.type_.type == ElementType.Mtext)
{
first.literalText = statusLine;
}
}
}
}
catch
{
}
}
if ((node != null) && (ActionAttributes != null))
{
AttributeBuilder.ApplyAttrs (node, ActionAttributes);
}
}
catch
{
}
return true;
}
示例7: MActionDialog
public MActionDialog(Node node)
{
this.container = null;
this.success = false;
this.node = null;
if (node != null)
{
this.node = node;
this.attributes = AttributeBuilder.ActionAttributes(node);
if (this.attributes == null)
{
this.attributes = new ActionAttributes();
}
}
this.InitializeComponent();
if (this.attributes.actionType == ActionType.StatusLine)
{
this.statusline.Checked = true;
this.spinner.Enabled = false;
this.spinner.Maximum = new decimal(1);
this.statline.Enabled = true;
}
else if (this.attributes.actionType == ActionType.ToolTip)
{
this.tooltip.Checked = true;
this.spinner.Enabled = false;
this.spinner.Maximum = new decimal(1);
this.statline.Enabled = true;
}
else if (this.attributes.actionType == ActionType.Highlight)
{
this.highlight.Checked = true;
this.spinner.Enabled = false;
this.spinner.Maximum = new decimal(1);
this.statusline.Enabled = false;
this.tooltip.Enabled = false;
this.statline.Enabled = false;
this.statline.Text = "";
}
else if (this.attributes.actionType == ActionType.Toggle)
{
this.toggle.Checked = true;
this.statusline.Enabled = false;
this.tooltip.Enabled = false;
this.spinner.Enabled = true;
this.spinner.Maximum = (decimal) node.numChildren;
this.spinner.Value = (decimal) this.attributes.selection;
this.statline.Enabled = false;
this.statline.Text = "";
}
else
{
this.statusline.Checked = false;
this.tooltip.Checked = false;
this.toggle.Checked = false;
this.highlight.Checked = false;
this.spinner.Enabled = false;
this.spinner.Maximum = new decimal(1);
this.statline.Enabled = false;
this.statline.Text = "";
}
if ((this.attributes.actionType == ActionType.StatusLine) || (this.attributes.actionType == ActionType.ToolTip))
{
string s = "";
try
{
if (node.HasChildren())
{
Node n = node.firstChild;
if ((n != null) && (n.nextSibling != null))
{
n = n.nextSibling;
if (n.type_.type == ElementType.Mtext)
{
s = n.literalText;
}
}
}
}
catch
{
}
this.statline.Text = s;
}
}
示例8: MTable
public MTable(Node node)
{
this.colColSpan = 0;
this.totalHorzFrameSpacing = 0;
this.totalWidth = 0;
this.minWidth = 30;
this.totalVertFrameSpacing = 0;
this.tableAlign = 0;
this.rowFrameSpacing = 0;
this.colFrameSpacing = 0;
this.maxWidth = 0;
this.curRow = 0;
this.curCol = 0;
this.selKind_ = TableCellKind.SelAll;
this.displayStyle = false;
this.equalRows = false;
this.equalColumns = false;
this.align = TableAlign.AXIS;
this.frame = TableLineStyle.NONE;
this.framespacing = "0.4em 0.5ex";
this.side = Side.RIGHT;
this.minlabelSpacing = "0.8em";
this.colLines = new TableLineStyle[] { TableLineStyle.NONE };
this.colSpacing = new string[] { "0.8em" };
this.colAligns = new HAlign[] { HAlign.CENTER };
this.rowAligns = new RowAlign[] { RowAlign.BASELINE };
this.node_ = node;
this.attrs = AttributeBuilder.mtableAttributes(node);
if (this.attrs != null)
{
this.rowAligns = this.attrs.rowAligns;
this.colAligns = this.attrs.colAligns;
this.colLines = this.attrs.colLines;
this.colSpacing = this.attrs.colSpacing;
this.displayStyle = this.attrs.displaystyle;
this.equalRows = this.attrs.equalRows;
this.equalColumns = this.attrs.equalColumns;
this.align = this.attrs.align;
this.frame = this.attrs.frame;
this.framespacing = this.attrs.framespacing;
this.side = this.attrs.side;
this.minlabelSpacing = this.attrs.minlabelspacing;
}
this.rows = new ArrayList();
if (node.HasChildren())
{
NodesList nodesList = node.GetChildrenNodes();
Node n = nodesList.Next();
for (int i = 0; n != null; i++)
{
MRow row = this.AddRow(n, i);
if (this.attrs != null)
{
if (i < this.attrs.rowSpacing.Length)
{
row.spacing = this.attrs.rowSpacing[i];
}
else if (this.attrs.rowSpacing.Length > 0)
{
row.spacing = this.attrs.rowSpacing[this.attrs.rowSpacing.Length - 1];
}
if (i < this.attrs.rowLines.Length)
{
row.lines = this.attrs.rowLines[i];
}
else if (this.attrs.rowLines.Length > 0)
{
row.lines = this.attrs.rowLines[this.attrs.rowLines.Length - 1];
}
}
if (row.attrs != null)
{
row.colAligns = row.attrs.colAligns;
row.align = row.attrs.align;
}
if (n.HasChildren())
{
NodesList list = n.GetChildrenNodes();
Node child = list.Next();
int colSpan = 0;
if (n.type_.type == ElementType.Mlabeledtr)
{
row.isLabeled = true;
MCell cell = row.AddLabel(child, n.numChildren - 1);
if (cell.tableAttrs != null)
{
cell.rowAlign = cell.tableAttrs.rowAlign;
cell.columnAlign = cell.tableAttrs.columnAlign;
cell.columnSpan = cell.tableAttrs.columnSpan;
cell.rowSpan = cell.tableAttrs.rowSpan;
}
child = list.Next();
}
while (child != null)
{
MCell cell = row.AddCell(child, colSpan);
if (cell.tableAttrs != null)
{
cell.rowAlign = cell.tableAttrs.rowAlign;
cell.columnAlign = cell.tableAttrs.columnAlign;
//.........这里部分代码省略.........
示例9: tryAddMathXML
//.........这里部分代码省略.........
if (xmlRoot == null)
{
return;
}
if (!this.IsMultiline)
{
Node wasSelected = selectedNode;
if (this.CreateTopLevelTable ())
{
nodeClass = this.GetNodeClass (selectedNode);
selectedNode = this.GetCurrentlySelectedNode ();
}
else
{
return;
}
}
if ((nodeClass == NodeClass.unknown) )
{
return;
}
bool wasSelect = false;
Node lastRow = null;
if (!((xmlRoot == null) || !xmlRoot.HasChildNodes))
{
Node selRow = selectedNode;
int count = 0;
count = xmlRoot.ChildNodes.Count;
int rCount = 0;
if (((selRow.type_ != null) && (selRow.type_.type == ElementType.Mrow)) && !selRow.HasChildren())
{
emptyRow = true;
rCount = 1;
}
if ((((selRow.parent_ != null)) &&
((selRow.parent_.type_.maxChilds != -1) &&
(((selRow.parent_.numChildren - rCount) + count) >= selRow.parent_.type_.maxChilds))) ||
((selRow.parent_.type_.type == ElementType.Mmultiscripts) ||
(selRow.parent_.type_.type == ElementType.Maction)))
{
selRow = this.WrapInRowInplace(selRow);
}
if (selRow.IsAppend)
{
Node row = selRow;
Node lastCell = null;
if (isPaste && (xmlRoot.Name == "math"))
{
Node newNode = new Node();
newNode.Parse(xmlRoot, this.types_, this.entityManager, true, null);
if ((newNode.type_ != null) && newNode.HasChildren())
{
NodesList list = newNode.GetChildrenNodes();
Node n = list.Next();
lastRow = row;
for (int i = 0; (row != null) && (n != null); i++)
{
row.AppendNode(n);
lastCell = n;
n = list.Next();
row = row.nextSibling;