/// <summary> /// Append a text block with the specified type. /// </summary> public void WriteTextBlock(string text, TextBlockType textType) { Debug.Assert((int)XPathNodeType.Text < (int)XPathNodeType.SignificantWhitespace); Debug.Assert((int)XPathNodeType.SignificantWhitespace < (int)XPathNodeType.Whitespace); if (text.Length != 0) { if (_textType == TextBlockType.None) { _text = text; _textType = textType; if (_lineInfo != null) { _lineNum = _lineInfo.LineNumber; _linePos = _lineInfo.LinePosition; } } else { _text = string.Concat(_text, text); // Determine whether text is Text, Whitespace, or SignificantWhitespace if ((int)textType < (int)_textType) { _textType = textType; } } } }
protected void OnOutput(string text, TextBlockType type) { if (text != null) { OnOutput(new TextBlock[] { new TextBlock(text, type) }); } }
private void CachedTextNode() { TextBlockType textType = this.textBldr.TextType; string str = this.textBldr.ReadText(); this.AddSibling((XPathNodeType)textType, string.Empty, string.Empty, string.Empty, string.Empty); this.pageSibling[this.idxSibling].SetValue(str); }
public string ReadText() { if (this.textType == TextBlockType.None) { return(string.Empty); } this.textType = TextBlockType.None; return(this.text); }
public void TextBlock02() { TextBlockType textBlock = TextBlockContentManager.Select(327); Console.Write(textBlock.DecryptTextblock()); Assert.AreEqual(327, textBlock.Number); Assert.AreEqual(0, textBlock.PartNum); Assert.AreEqual(0, textBlock.LinkTo); }
public void TextBlock01() { TextBlockType textBlock = TextBlockContentManager.Select(5); string actualText = textBlock.DecryptTextblock(); Assert.AreEqual("boat:7\npassage:7\nskiff:7\ncharge:7\n", actualText); Assert.AreEqual(5, textBlock.Number); Assert.AreEqual(0, textBlock.PartNum); Assert.AreEqual(6, textBlock.LinkTo); }
/// <summary> /// SetLabelText sets the input string on the TextBlock. /// </summary> /// <param name="type">The TextBlock on which to set the text</param> /// <param name="text">The text to set</param> private void SetLabelText(TextBlockType type, String text) { //Switch on the TextBlock to update switch (type) { case TextBlockType.Mirror: this.MirrorName = text; break; case TextBlockType.Potentiostat: this.PotentiostatName = text; break; case TextBlockType.Laser: this.LaserName = text; break; } }
public void WriteTextBlock(string text, TextBlockType textType) { if (text.Length != 0) { if (this.textType == TextBlockType.None) { this.text = text; this.textType = textType; if (this.lineInfo != null) { this.lineNum = this.lineInfo.LineNumber; this.linePos = this.lineInfo.LinePosition; } } else { this.text = this.text + text; if (textType < this.textType) { this.textType = textType; } } } }
List <TextBlock> FindRegexBlocks (Regex rxStart, Regex rxEnd, CheckBlockEnd checkEnd, IList blocks, TextBlockType typeForMatches, bool discardBlocks) { var ret = new List <TextBlock> (); foreach (TextBlock block in blocks) { if (block.Type != TextBlockType.Verbatim) { ret.Add (block); continue; } int lastIndex = 0, index; MatchCollection matches = rxStart.Matches (block.Content); bool foundMatches = matches.Count > 0; foreach (Match match in matches) { foundMatches = true; index = match.Index; if (lastIndex < index) ret.Add (new TextBlock (TextBlockType.Verbatim, block.Content.Substring (lastIndex, index - lastIndex))); string value = match.Value; if (rxEnd != null && checkEnd (value)) { int startFrom = index + value.Length; Match m = rxEnd.Match (block.Content, startFrom); if (m.Success) value += block.Content.Substring (startFrom, m.Index - startFrom) + m.Value; } if (!discardBlocks) ret.Add (new TextBlock (typeForMatches, value)); lastIndex = index + value.Length; } if (lastIndex > 0 && lastIndex < block.Content.Length) ret.Add (new TextBlock (TextBlockType.Verbatim, block.Content.Substring (lastIndex))); if (!foundMatches) ret.Add (block); } return ret; }
/// <summary> /// Constructor. /// </summary> public void Initialize(IXmlLineInfo lineInfo) { _lineInfo = lineInfo; _textType = TextBlockType.None; }
public TextBlockAdapter(int order, TextBlockType type, string text) { Order = order; Type = type; Text = text; }
/// <summary> /// Returns true if current text is bold or italic /// </summary> /// <param name="textBlockType">Type of text blocks</param> /// <param name="unitCount">Count of text blocks</param> /// <returns>bool</returns> public bool IsTextMarked(TextBlockType textBlockType, int unitCount) { Object count = unitCount; Object extend = WdMovementType.wdExtend; Object unit; bool flag = false; try { switch (textBlockType) { case TextBlockType.paragraph: unit = WdUnits.wdParagraph; _application.Selection.MoveDown(ref unit, ref count, ref extend); if (_application.Selection.Font.Italic >= 1 || _application.Selection.Font.Bold != 1) { flag = true; } _application.Selection.MoveLeft(); break; case TextBlockType.word: unit = WdUnits.wdWord; _application.Selection.MoveRight(ref unit, ref count, ref extend); if (_application.Selection.Font.Italic != 0 || _application.Selection.Font.Bold != 0) { flag = true; } _application.Selection.MoveLeft(); break; case TextBlockType.line: unit = WdUnits.wdLine; _application.Selection.MoveDown(ref unit, ref count, ref extend); if (_application.Selection.Font.Italic != 0 || _application.Selection.Font.Bold != 0) { flag = true; } _application.Selection.MoveLeft(); break; } } catch(Exception ex) { MessageBox.Show("Could not perform! \n" + ex.Message); } return flag; }
/// <summary> /// Write an element text block with the specified text type (whitespace, significant whitespace, or text). /// </summary> public void WriteString(string text, TextBlockType textType) { _textBldr.WriteTextBlock(text, textType); }
public TextBlock(string text, TextBlockType type) { Text = text; Type = type; }
/// <summary> /// Returns text from current cursor position /// </summary> /// <param name="textBlockType">Type of text blocks</param> /// <param name="unitCount">Count of text blocks</param> /// <returns>string of text</returns> public string GetTextFromPosition(TextBlockType textBlockType, int unitCount) { Object count = unitCount; Object extend = WdMovementType.wdExtend; Object move = WdMovementType.wdMove; Object unit; string SelectedText = String.Empty; try { switch (textBlockType) { case TextBlockType.paragraph: unit = WdUnits.wdParagraph; _application.Selection.MoveDown(ref unit, ref count, ref extend); SelectedText = _application.Selection.Text; _application.Selection.MoveLeft(); break; case TextBlockType.word: unit = WdUnits.wdWord; _application.Selection.MoveRight(ref unit, ref count, ref extend); SelectedText = _application.Selection.Text; _application.Selection.MoveLeft(); break; case TextBlockType.line: unit = WdUnits.wdLine; _application.Selection.MoveDown(ref unit, ref count, ref extend); SelectedText = _application.Selection.Text; _application.Selection.MoveLeft(); break; } return SelectedText; } catch (Exception ex) { MessageBox.Show("Could not get text! \n" + ex.Message); } return string.Empty; }
/// <summary> /// Constructor. /// </summary> public void Initialize(IXmlLineInfo lineInfo) { _lineInfo = lineInfo; _textType = TextBlockType.None; }
/// <summary> /// Append a text block with the specified type. /// </summary> public void WriteTextBlock(string text, TextBlockType textType) { Debug.Assert((int)XPathNodeType.Text < (int)XPathNodeType.SignificantWhitespace); Debug.Assert((int)XPathNodeType.SignificantWhitespace < (int)XPathNodeType.Whitespace); if (text.Length != 0) { if (_textType == TextBlockType.None) { _text = text; _textType = textType; if (_lineInfo != null) { _lineNum = _lineInfo.LineNumber; _linePos = _lineInfo.LinePosition; } } else { _text = string.Concat(_text, text); // Determine whether text is Text, Whitespace, or SignificantWhitespace if ((int)textType < (int)_textType) _textType = textType; } } }
public string GetTextFromPosition(TextBlockType textBlockType, int unitCount) { throw new NotImplementedException(); }
public void WriteTextBlock(string text, TextBlockType textType) { if (text.Length != 0) { if (this.textType == TextBlockType.None) { this.text = text; this.textType = textType; if (this.lineInfo != null) { this.lineNum = this.lineInfo.LineNumber; this.linePos = this.lineInfo.LinePosition; } } else { this.text = this.text + text; if (textType < this.textType) { this.textType = textType; } } } }
/// <summary> /// Read all cached text, or string.Empty if no text has been cached, and clear the text block type. /// </summary> public string ReadText() { if (this.textType == TextBlockType.None) return string.Empty; this.textType = TextBlockType.None; return this.text; }
/// <summary> /// Constructor. /// </summary> public void Initialize(IXmlLineInfo lineInfo) { this.lineInfo = lineInfo; this.textType = TextBlockType.None; }
public TextBlock( RichTextArea _textArea, string _strText, Color _color, TextBlockType _lineType=TextBlockType.Paragraph, int _iIndentLevel=0 ) { mTextArea = _textArea; Text = _strText; BlockType = _lineType; IndentLevel = _iIndentLevel; Color = _color; }
public TextBlock (TextBlockType type, string content) { Content = content; Type = type; Length = content.Length; }
/// <summary> /// Read all cached text, or string.Empty if no text has been cached, and clear the text block type. /// </summary> public string ReadText() { if (_textType == TextBlockType.None) return string.Empty; _textType = TextBlockType.None; return _text; }
/// <summary> /// Constructor. /// </summary> public void Initialize(IXmlLineInfo lineInfo) { this.lineInfo = lineInfo; this.textType = TextBlockType.None; }
public TextBlock( RichTextArea _textArea, string _strText, TextBlockType _lineType=TextBlockType.Paragraph, int _iIndentLevel=0 ) : this( _textArea, _strText, _textArea.Screen.Style.DefaultTextColor, _lineType, _iIndentLevel ) { }
public bool IsTextMarked(TextBlockType textBlockType, int unitCount) { throw new NotImplementedException(); }
/// <summary> /// Write an element text block with the specified text type (whitespace, significant whitespace, or text). /// </summary> public void WriteString(string text, TextBlockType textType) { _textBldr.WriteTextBlock(text, textType); }