public ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped) { List<ICompletionData> completionData = new List<ICompletionData>(); int column = Math.Max(0, textArea.Caret.Column - 1); LineSegment line = textArea.Document.GetLineSegment(textArea.Caret.Line); TextWord word = line.GetWord(column); string itemText = (word != null ? word.Word : "") + char.ToLower(charTyped); if (mScriptContent.CommandsFlat.ContainsKey(itemText) != false) { foreach (string key in mScriptContent.CommandsFlat[itemText]) { completionData.Add(new ScriptCompletionData(mScriptContent.Commands[key].Name, mScriptContent.Commands[key].Description, 0)); } } if (mScriptContent.ConstantsFlat.ContainsKey(itemText) != false) { foreach (string key in mScriptContent.ConstantsFlat[itemText]) { completionData.Add(new ScriptCompletionData(mScriptContent.Constants[key].Name, mScriptContent.Constants[key].Description, 0)); } } if (mScriptContent.Maps.ContainsKey(itemText) != false) { foreach (string key in mScriptContent.Maps[itemText]) { completionData.Add(new ScriptCompletionData(key, key, 0)); } } return completionData.ToArray(); }
private TextWord SetTextWord(TextWord textWord, bool bold, string text, string right) { textWord.Bold = bold; textWord.WordText = text; textWord.Width = Int32.Parse(right) - textWord.Left; return(textWord); }
public WordPos(int Line, ref TextWord Word, string Caption = "") { this.Line = Line; this.Col = Word.Offset; this.Length = Word.Length; this.Caption = Caption; }
private bool IsKeyWord(string typeName, TextWord word) { return (_words[typeName] .Select(d => d.Text) .Contains(word.Word)); }
private void OnToolTipRequest(object sender, ToolTipRequestEventArgs e) { if (e.InDocument == false || e.ToolTipShown == true) { return; } int offset = mEditor.Document.PositionToOffset(e.LogicalPosition); LineSegment line = mEditor.Document.GetLineSegmentForOffset(offset); TextWord word = line.GetWord(e.LogicalPosition.Column); if (word == null) { return; } string lineText = word.Word; if (lineText.Length > 0) { if (TextArea.ToolTipWnd == null) { } e.ShowToolTip(lineText); } }
public ScanWordCursor( TextWord Word, TextLocation WordBx, TextLocation DelimBx, ScanPattern DelimPattern) : this() { this.Word = Word; this.WordBx = WordBx; this.DelimBx = DelimBx; this.DelimPattern = DelimPattern; }
public void SetupDataProvider(string fileName, ICSharpCode.TextEditor.TextArea textArea) { _textArea = textArea; _document = textArea.Document; _keywords = KeywordFactory.GetKeywords(); //TODO: just put these keywords in the factory and add a flag for "IsRequired" or something. // it may just require a KeywordType (Header, Action, etc). This needs cleaned up // in the code completion data provider as well. // the keyword factory just has the non-required words Keyword sightDist = new Keyword("bot_SightDist", "", "", false); sightDist.Inputs.Add(new KeywordInput(KeywordInputType.Action, "Sight Distance", "How far the highest skill bot can see on this map. 1500 is good for non-foggy maps, 700 is good for foggy maps.")); _keywords.Add(sightDist); _keywords.Add(new Keyword("spawnflag_is_priority", "", "Whether or no bots focus on spawnflags.", false)); _keywords.Add(new Keyword("cmdpost_is_priority", "", "Whether or not command posts critical on this map.", false)); _keywords.Add(new Keyword("construct_is_priority", "", "Whether or not engineers focus more on constructibles.", false)); _keywords.Add(new Keyword("map_has_vehicle", "", "Type of vehicle 0 = none, 1 = tank, 2 = train", false)); _keywords.Add(new Keyword("vehicle_entity_number", "", "The entity number of the vehicle.", false)); _keywords.Add(new Keyword("vehicle_team_owner", "", "The owner of the vehicle.", false)); LineSegment line = textArea.Document.GetLineSegmentForOffset(textArea.Caret.Offset); if (line != null) { TextWord first = GetWord(line, 1); if (first != null) { Keyword keyword = _keywords.GetWord(first.Word); if (keyword != null) { if (keyword.Inputs.Count > 0) { for (int x = 0; x < keyword.Inputs.Count; x++) { TextWord param = GetWord(line, x + 2); if (param == null) { KeywordInput inputParam = (KeywordInput)keyword.Inputs[x]; if (inputParam.InputType != KeywordInputType.PredefinedList) { _insightKeywords.Add(new Keyword(inputParam.Label, inputParam.Label, inputParam.HelpText, false)); break; } } } } } } } }
/// <summary> /// Highlights any XML validation errors that are found. /// </summary> /// <param name="p_strMessage">The message to display as a tool tip over the highlighted text.</param> /// <param name="p_tlcStart">The start of the text to highlight.</param> private void HighlightValidationErrors(string p_strMessage, TextLocation p_tlcStart) { IDocument docDocument = ActiveTextAreaControl.TextArea.Document; TextWord twdWord = docDocument.GetLineSegment(p_tlcStart.Line).GetWord(p_tlcStart.Column); Int32 intWordOffest = docDocument.PositionToOffset(p_tlcStart); TextMarker tmkError = new TextMarker(intWordOffest, (twdWord == null) ? 1 : twdWord.Length, TextMarkerType.WaveLine); tmkError.ToolTip = p_strMessage; docDocument.MarkerStrategy.AddMarker(tmkError); }
public void ConvertTokensTo(TokenConversionType conversionType) { try { ActiveTextArea.BeginUpdate(); StringBuilder sb = null; HighlightRuleSet rules = ActiveDocument.HighlightingStrategy.GetRuleSet(null); IList <LineSegment> lines = ActiveDocument.LineSegmentCollection; for (int k = 0; k < lines.Count; k++) { LineSegment segment = lines[k]; for (int i = 0; i < segment.Words.Count; i++) { TextWord word = segment.Words[i]; if (word.Type != TextWordType.Word) { continue; } if (rules.KeyWords[ActiveDocument, segment, word.Offset, word.Length] != null) { string newVal = word.Word; switch (conversionType) { case TokenConversionType.Lower: newVal = word.Word.ToLowerInvariant(); break; case TokenConversionType.Upper: newVal = word.Word.ToUpperInvariant(); break; case TokenConversionType.Capitalize: newVal = word.Word; char[] chars = newVal.ToCharArray(); chars[0] = Char.ToUpperInvariant(newVal[0]); sb = new StringBuilder(); sb.Append(chars); newVal = sb.ToString(); break; default: break; } ActiveDocument.Replace(segment.Offset + word.Offset, word.Length, newVal); } } } } finally { ActiveTextArea.EndUpdate(); } }
private TextWord CreateWordFromWordNode(XmlNode nodeInsideLn) { TextWord word = new TextWord(); word.WordText = nodeInsideLn.InnerText; word.Left = Int32.Parse(nodeInsideLn.Attributes["l"].Value); word.Top = Int32.Parse(nodeInsideLn.Attributes["t"].Value); word.Width = Int32.Parse(nodeInsideLn.Attributes["r"].Value) - word.Left; word.Height = Int32.Parse(nodeInsideLn.Attributes["b"].Value) - word.Top; return(word); }
private int GetWordInt(TextWord word) { try { return(Convert.ToInt32(word.Word)); } catch { return(Int32.MinValue); } }
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------- /// <summary> /// Generates the fold markers. /// </summary> /// <param name="document">The document.</param> /// <param name="strFileName">Name of the file.</param> /// <param name="oParseInformation">The parse information.</param> /// <returns></returns> public List <FoldMarker> GenerateFoldMarkers(IDocument document, string strFileName, object oParseInformation) { List <FoldMarker> lFolderMarker = new List <FoldMarker>(); int iStartLine = -1; string strFoldingDescription = ""; // Create foldmarkers for the whole document, enumerate through every line. for (int iCounter = 0; iCounter < document.TotalNumberOfLines; iCounter++) { LineSegment ls = document.GetLineSegment(iCounter); if (ls.Words != null && ls.Words.Count > 0) { TextWord tw = ls.Words[0]; if (tw != null) { if (tw.Word.EqualsIgnoreCase(REGION_START)) { iStartLine = iCounter; //Alle Wörter dahiner autmatisch als FoldingDescription this.sb.Clear(); for (int iWordCounter = 1; iWordCounter < ls.Words.Count; iWordCounter++) { string strWord = ls.Words[iWordCounter].Word; if (strWord != "--" && strWord.IsEmpty() == false) { this.sb.AppendFormat("{0} ", strWord); } } strFoldingDescription = this.sb.ToString(); continue; } if (tw.Word.EqualsIgnoreCase(REGION_END) && iStartLine > -1) { lFolderMarker.Add(new FoldMarker(document, iStartLine, 0, iCounter, ls.TotalLength, FoldType.Region, strFoldingDescription)); iStartLine = -1; continue; } } } } return(lFolderMarker); }
private TextWord GetTextWordAtLocation(TextLocation location) { if (location.Line >= _editor.Document.TotalNumberOfLines) { return(null); } LineSegment segment = _editor.Document.GetLineSegment(location.Line); TextWord textWord = segment.GetWord(location.Column); return(textWord); }
private void UnderlineErrors(IEnumerable <BuildError> parsedErrors) { if (_editor.IsDisposed || _editor.Disposing || !Enabled) { return; } if (_editor.InvokeRequired) { _editor.Invoke(() => UnderlineErrors(parsedErrors)); return; } _document.MarkerStrategy.RemoveAll(m => m is ErrorMarker); var options = Settings.Default.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase; foreach (BuildError error in parsedErrors.Where( error => error.File == _editor.FileName)) { var segment = _document.GetLineSegment(error.LineNumber - 1); Match match = Regex.Match(error.Description, "'(?<error>.*?)'"); TextWord word; int offset = segment.Offset; int length; if (match.Success) { word = segment.Words.FirstOrDefault( s => s.Word.Equals(match.Groups["error"].Value, options)) ?? segment.Words.FirstOrDefault(w => !w.IsWhiteSpace); length = match.Groups["error"].Length; } else { word = segment.Words.FirstOrDefault(w => !w.IsWhiteSpace); TextWord lastWord = segment.Words.Last(w => !w.IsWhiteSpace); length = lastWord.Offset + lastWord.Length; } if (word != null) { offset += word.Offset; } ErrorMarker marker = new ErrorMarker(offset, length, error.Description, error.IsWarning); _document.MarkerStrategy.AddMarker(marker); } }
private bool IsNullWord(TextWord word) { if (word == null) { return(true); } string s = Regex.Replace(word.Word, "\\s", ""); if (string.IsNullOrEmpty(s)) { return(true); } return(false); }
private Recipe GetRecipeFromNuanceXML(string xmlPath) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(xmlPath); Recipe recipe = SetupRecipe(); TextOverlay textOverlay = recipe.ParsedResults[0].TextOverlay; XmlNode pageInfoNode = xmlDoc.SelectSingleNode("/document/page[1]/description/theoreticalPage"); textOverlay.Width = Int32.Parse(pageInfoNode.Attributes["width"].Value); textOverlay.Height = Int32.Parse(pageInfoNode.Attributes["height"].Value); XmlNodeList nodeList = xmlDoc.SelectNodes("/document/page[1]/body//para/ln"); foreach (XmlNode lnNode in nodeList) { TextLine line = new TextLine(); line.Words = new List <TextWord>(); line.MinTop = Int32.Parse(lnNode.Attributes["t"].Value); line.MaxHeight = Int32.Parse(lnNode.Attributes["b"].Value) - line.MinTop; foreach (XmlNode nodeInsideLn in lnNode.ChildNodes) { if (nodeInsideLn.Name == "wd") { line.Words.Add(CreateWordFromWordNode(nodeInsideLn)); } else if (nodeInsideLn.Name == "run") { foreach (XmlNode nodeInsideRun in nodeInsideLn.ChildNodes) { if (nodeInsideLn.Name == "wd") { TextWord word = CreateWordFromWordNode(nodeInsideRun); // May be checking actual bold attribute is better than cheching // deviance from the normal text, depends on the recipe // use the code below in case you just want to find Bold text // word.Bold = Boolean.Parse(nodeInsideLn.Attributes["bold"].Value); word.Bold = true; line.Words.Add(word); } } } } textOverlay.Lines.Add(line); } return(recipe); }
private void AddVariate(TextWord word, string type) { string name = word.Word; foreach (var data in _vars.Union(_args)) { if (data.Text == name) { return; } } if (!IsDataType(word) && IsVariate(name)) { _vars.Add(new TFunc.VariateData(name, type)); } }
private void CodeValidated(object sender, EventArgs e) { IDocument docDocument = ActiveTextAreaControl.TextArea.Document; docDocument.MarkerStrategy.RemoveAll(x => { return(x.TextMarkerType == TextMarkerType.WaveLine); }); foreach (LanguageError errError in ViewModel.Errors) { LineSegment lsgLine = docDocument.GetLineSegment(errError.Line); TextWord twdWord = lsgLine.GetWord(errError.Column); Int32 intWordOffest = docDocument.PositionToOffset(new TextLocation(errError.Column, errError.Line)); TextMarker tmkError = new TextMarker(intWordOffest, (twdWord == null) ? 1 : twdWord.Length, TextMarkerType.WaveLine); tmkError.ToolTip = errError.Message; docDocument.MarkerStrategy.AddMarker(tmkError); } ActiveTextAreaControl.TextArea.Invalidate(); }
public ArrayList GenerateFoldMarkers(IDocument document, string fileName, object parseInformation) { ArrayList foldMarkers = new ArrayList(); int startLine = Int32.MinValue; string foldWord = ""; for (int x = 0; x < document.LineSegmentCollection.Count; x++) { LineSegment segment = (LineSegment)document.LineSegmentCollection[x]; if (segment.Words.Count > 0) { TextWord word = (TextWord)segment.Words[0]; if (startLine == Int32.MinValue) { if (word.Word.ToLower() == "action" && segment.Words.Count > 2) { startLine = x; for (int y = 2; y < segment.Words.Count; y++) { TextWord comments = (TextWord)segment.Words[y]; if (comments.Word != "//") { foldWord += " " + comments.Word; } } } } else { if (word.Word == "}") { FoldMarker actionMarker = new FoldMarker(document, startLine, 1, x, 1, FoldType.Region, foldWord, false); foldMarkers.Add(actionMarker); startLine = Int32.MinValue; foldWord = ""; } } } } return(foldMarkers); }
void TextEditorControl_ToolTipRequest(object sender, ToolTipRequestEventArgs e) { if (!e.InDocument || e.ToolTipShown) { return; } // Get word under cursor TextLocation position = e.LogicalPosition; LineSegment line = this.TextEditorControl.Document.GetLineSegment(position.Y); if (line != null) { TextWord word = line.GetWord(position.X); if (word != null && !String.IsNullOrEmpty(word.Word)) { e.ShowToolTip("Current word: \"" + word.Word + "\"\n" + "\nRow: " + (position.Y + 1) + " Column: " + (position.X + 1)); } } }
private static TextWord GetPrevWord(Caret caret, LineSegment lineSegment, TextWord curWord) { TextWord prevWord = null; var idx = caret.Column; while (prevWord == null && idx-- > 0) { var thisWord = lineSegment.GetWord(idx); if (thisWord.Offset == curWord.Offset || thisWord.IsWhiteSpace) { continue; } prevWord = thisWord; } return(prevWord); }
/// <summary> /// Colourises the given token and adds it to the document. /// </summary> /// <param name="document">The document being highlighted.</param> /// <param name="j">The token to highlight.</param> protected void HandleToken(IDocument document, IToken j) { LineSegment lsgLine = document.GetLineSegment(j.Line - 1); HighlightColor hclColour = GetColorFor(GetTokenClass(j.Type)); TextWord twdWord = new TextWord(document, lsgLine, j.CharPositionInLine, j.Text.Length, hclColour, false); Int32 i = 0; for (; i < lsgLine.Words.Count; i++) { if (lsgLine.Words[i].Offset > j.CharPositionInLine) { lsgLine.Words.Insert(i, twdWord); break; } } if (lsgLine.Words.Count == i) { lsgLine.Words.Add(twdWord); } }
public void ChangeScriptCase(TokenConversionType conversionType) { try { ActiveTextArea.BeginUpdate(); HighlightRuleSet rules = ActiveDocument.HighlightingStrategy.GetRuleSet(null); IList <LineSegment> lines = ActiveDocument.LineSegmentCollection; for (int k = 0; k < lines.Count; k++) { LineSegment segment = lines[k]; for (int i = 0; i < segment.Words.Count; i++) { TextWord word = segment.Words[i]; if (word.Type != TextWordType.Word) { continue; } string newVal = word.Word; switch (conversionType) { case TokenConversionType.Lower: newVal = word.Word.ToLowerInvariant(); break; case TokenConversionType.Upper: newVal = word.Word.ToUpperInvariant(); break; default: break; } ActiveDocument.Replace(segment.Offset + word.Offset, word.Length, newVal); } } } finally { ActiveTextArea.EndUpdate(); } }
public List <TextWord> Decode(XElement line) { List <TextWord> textWords = new List <TextWord>(); IEnumerable <XElement> words = line.Descendants(_spanName); foreach (XElement word in words) { TextWord textWord = new TextWord(); XAttribute coords = word.Attribute("title"); if (coords != null) { var coordlist = coords.Value.Split(' '); textWord.X = Convert.ToInt32(HelperOcr.GetNumbers(coordlist[1])); textWord.Y = Convert.ToInt32(HelperOcr.GetNumbers(coordlist[2])); textWord.Width = Convert.ToInt32(HelperOcr.GetNumbers(coordlist[3])) - Convert.ToInt32(HelperOcr.GetNumbers(coordlist[1])); textWord.Height = Convert.ToInt32(HelperOcr.GetNumbers(coordlist[4])) - Convert.ToInt32(HelperOcr.GetNumbers(coordlist[2])); } XAttribute id = word.Attribute("id"); if (word.Elements(XName.Get("strong")).FirstOrDefault(d => !d.IsEmpty) != null) { textWord.Bold = true; } ; if (id != null) { textWord.id = id.Value; } textWord.Word = word.Value; textWords.Add(textWord); } return(textWords); }
/// <summary> /// Called when entry should be inserted. Forward to the insertion action of the completion data. /// </summary> public bool InsertAction(ICompletionData data, TextArea textArea, int insertionOffset, char key) { int endOffset = insertionOffset; LineSegment line = textArea.Document.GetLineSegment(textArea.Caret.Line); // Try to find the last word and replace it if (insertionOffset != 0) { // insertionOffset represent the current Caret, so this isnt needed // But just in case.. if (textArea.Caret.Column > 0) { TextWord word = line.GetWord(textArea.Caret.Column - 1); if (word != null) { // Nothing todo? if (word.Word == data.Text) { data.Text = ""; } else { // cap insert data data.Text = data.Text.Substring(word.Length); } } } } return data.InsertAction(textArea, key); }
string GetStyle(TextWord word) { if (word.SyntaxColor == null || word.SyntaxColor.ToString() == currentDefaultTextColor.ToString()) { return(null); } string style = "color: " + ColorToString(word.Color) + ";"; if (word.Bold) { style += " font-weight: bold;"; } if (word.Italic) { style += " font-style: italic;"; } if (word.SyntaxColor.HasBackground) { style += " background-color: " + ColorToString(word.SyntaxColor.BackgroundColor) + ";"; } return(style); }
private static Tuple <TextLocation, TextWord> IsolateWordText( ScanStream ScanStream, TextTraits Traits, LiteralType?LiteralType, string LitText, int Bx, int?NonWordBx) { TextLocation wordBx = null; TextWord wordPart = null; // not a literal. A word that runs from Bx to immed before NonWordBx. if (LiteralType == null) { wordBx = new StreamLocation(Bx).ToTextLocation(ScanStream); int lx; if (NonWordBx == null) { lx = ScanStream.Stream.Length - Bx; } else { lx = NonWordBx.Value - Bx; } wordPart = new TextWord( ScanStream.Substring(Bx, lx), WordClassification.Identifier, Traits); } // a quoted or numeric literal else { wordBx = new StreamLocation(Bx).ToTextLocation(ScanStream); wordPart = new TextWord(LitText, LiteralType.Value, Traits); } return(new Tuple <TextLocation, TextWord>(wordBx, wordPart)); }
/// <summary> /// Description /// </summary> private string GetIndentationSmart(TextArea textArea, int lineNumber) { if (lineNumber < 0 || lineNumber > textArea.Document.TotalNumberOfLines) { throw new ArgumentOutOfRangeException("lineNumber"); } //! TODO: // - search backward the last symbol // - on { or ), indend by \t // - think about more indentation style // - remember last ) and set next indentation -1 LineSegment lastLine = textArea.Document.GetLineSegment(lineNumber); if (lastLine == null || lastLine.Words.Count == 0) { // No text in the last line return(""); } // Fetch leading space of last line string lastLeading = GetIndentation(textArea, lineNumber); TextWord lastWord = lastLine.Words[lastLine.Words.Count - 1]; if (lastWord.Type != TextWordType.Word) { return(lastLeading); } if (mIndentationChars.Contains(lastWord.Word.Trim()) == false) { return(lastLeading); } return(lastLeading + "\t"); }
public ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped) { _keywords = KeywordFactory.GetKeywords(); // the keyword factory just has the non-required words _keywords.Add(new Keyword("bot_SightDist", "", "How far the highest skill bot can see on this map", false)); ArrayList allowable = new ArrayList(); allowable.Add("0"); allowable.Add("1"); Keyword flag = new Keyword("spawnflag_is_priority", "", "Whether or no bots focus on spawnflags.", false); KeywordInput flagInput = new KeywordInput(KeywordInputType.PredefinedList, "spawnflag_is_priority", "Whether or no bots focus on spawnflags."); flagInput.AllowableValues = allowable; flag.Inputs.Add(flagInput); _keywords.Add(flag); Keyword cmdpost = new Keyword("cmdpost_is_priority", "", "Whether or not command posts critical on this map.", false); KeywordInput cmdpostInput = new KeywordInput(KeywordInputType.PredefinedList, "cmdpost_is_priority", "Whether or not command posts critical on this map."); cmdpostInput.AllowableValues = allowable; cmdpost.Inputs.Add(cmdpostInput); _keywords.Add(cmdpost); Keyword construct = new Keyword("construct_is_priority", "", "Whether or not engineers focus more on constructibles.", false); KeywordInput constructInput = new KeywordInput(KeywordInputType.PredefinedList, "construct_is_priority", "Whether or not engineers focus more on constructibles."); constructInput.AllowableValues = allowable; construct.Inputs.Add(constructInput); _keywords.Add(construct); Keyword vehicle = new Keyword("map_has_vehicle", "", "Whether or not this map has a tank or a train.", false); KeywordInput vehicleInput = new KeywordInput(KeywordInputType.PredefinedList, "map_has_vehicle", "Type of vehicle 0 = none, 1 = tank, 2 = train"); ArrayList allowableVehicle = new ArrayList(); allowable.Add("0"); allowable.Add("1"); allowable.Add("2"); vehicleInput.AllowableValues = allowableVehicle; vehicle.Inputs.Add(vehicleInput); _keywords.Add(vehicle); //vehicle_entity_number 429 //the entity number of the tank Keyword vehicleEntity = new Keyword("vehicle_entity_number", "", "The entity number of the vehicle.", false); vehicleEntity.Inputs.Add(new KeywordInput(KeywordInputType.Action, "Vehicle Entity Number", "The entity number of the vehicle.")); _keywords.Add(vehicleEntity); //vehicle_team_owner 2 //ALLIES own this tank! 1 = AXIS, 2 = ALLIES Keyword vehicleOwner = new Keyword("vehicle_team_owner", "", "The owner of the vehicle.", false); KeywordInput vehicleOwnerInput = new KeywordInput(KeywordInputType.PredefinedList, "vehicle_team_owner", "1 = AXIS, 2 = ALLIES."); vehicleOwnerInput.AllowableValues.Add("1");; vehicleOwnerInput.AllowableValues.Add("2");; vehicleOwner.Inputs.Add(vehicleOwnerInput); _keywords.Add(vehicleOwner); _keywords.Sort(KeywordComparer.SortBy.Command); _textArea = textArea; _typedChar = charTyped; // see if a word on the line the input was in is a keyword that we have, // then figure out what input they are at LineSegment line = textArea.Document.GetLineSegmentForOffset(textArea.Caret.Offset); bool keywordFound = false; if (line != null) { TextWord first = GetWord(line, 1); if (first != null) { Keyword keyword = _keywords.GetWord(first.Word); if (keyword != null) { keywordFound = true; if (keyword.Inputs.Count > 0) { for (int x = 0; x < keyword.Inputs.Count; x++) { TextWord param = GetWord(line, x + 2); if (param == null) { KeywordInput inputParam = (KeywordInput)keyword.Inputs[x]; if (inputParam.InputType == KeywordInputType.PredefinedList) { ICompletionData[] data = new ICompletionData[inputParam.AllowableValues.Count]; for (int y = 0; y < inputParam.AllowableValues.Count; y++) { Keyword dummyKeyword = new Keyword((string)inputParam.AllowableValues[y], (string)inputParam.AllowableValues[y], inputParam.HelpText, false); data[y] = new KeywordCompletionData(dummyKeyword); } return(data); } } } } } } } if (keywordFound) { return(null); } // fall through, return all keywords ICompletionData[] all = new ICompletionData[_keywords.Count]; for (int x = 0; x < _keywords.Count; x++) { all[x] = new KeywordCompletionData(_keywords[x]); } return(all); }
internal FormWord(TextWord textWord, int pageNumber) : base(new FieldBoundingBox(textWord.BoundingBox), pageNumber, textWord.Text) { Confidence = textWord.Confidence ?? Constants.DefaultConfidenceValue; }