private IPlaceholderTag CreatePhTag(string tagContent, XmlNode item, bool source) { IPlaceholderTagProperties phTagProperties = PropertiesFactory.CreatePlaceholderTagProperties(tagContent); IPlaceholderTag phTag = ItemFactory.CreatePlaceholderTag(phTagProperties); string cont; if (item.NextSibling == null) { cont = ""; } else { cont = item.NextSibling.Value; } phTagProperties.SegmentationHint = SegmentationHint.IncludeWithText; phTagProperties.TagContent = item.OuterXml; phTagProperties.DisplayText = item.Name; phTagProperties.CanHide = false; //determine tag id if (source) { /*Sdl.FileTypeSupport.Framework.NativeApi.TagId thisId = * new Sdl.FileTypeSupport.Framework.NativeApi.TagId(totalTagCount.ToString()); * * phTagProperties.TagId = thisId;*/ totalTagCount += 1; tmpTotalTagCount += 1; srcSegmentTagCount += 1; } else { /*foreach (object tag in thisSrcSegment.AllSubItems) * { * if (tag.ToString().StartsWith("<") && tag.ToString().EndsWith(">")) * { * IPlaceholderTag srcPh = (IPlaceholderTag)tag; * * if (srcPh.TagProperties.TagId.ToString() == totalTagCount.ToString()) * { * if (phTagProperties.TagContent == srcPh.TagProperties.TagContent) * { * Sdl.FileTypeSupport.Framework.NativeApi.TagId thisId = * new Sdl.FileTypeSupport.Framework.NativeApi.TagId(totalTagCount.ToString()); * * phTagProperties.TagId = thisId; * totalTagCount += 1; * } * } * } * }*/ } return(phTag); }
public void InlinePlaceholderTag(IPlaceholderTagProperties tagInfo) { if (!_tqaDeletion) { _buffer.InlinePlaceholderTag(tagInfo); } }
private IPlaceholderTag CreatePhTag(string tagContent, XmlNode item, int tagNo, bool source) { IPlaceholderTagProperties phTagProperties = PropertiesFactory.CreatePlaceholderTagProperties(tagContent); IPlaceholderTag phTag = ItemFactory.CreatePlaceholderTag(phTagProperties); phTagProperties.TagContent = item.OuterXml; phTagProperties.DisplayText = string.Format("{{{0}}}", tagNo); phTagProperties.CanHide = false; //determine tag id if (source) { var thisId = new TagId(_totalTagCount.ToString(CultureInfo.InvariantCulture)); phTagProperties.TagId = thisId; _totalTagCount += 1; _tmpTotalTagCount += 1; _srcSegmentTagCount += 1; } else { var thisId = new TagId(_totalTagCount.ToString(CultureInfo.InvariantCulture)); phTagProperties.TagId = thisId; _totalTagCount += 1; } return(phTag); }
//Helper method to check if source or tag have same Id and same content private bool CheckForIdAndPropertiesEqual(TagId placeholderId, IPlaceholderTagProperties phTagProperties) { if (_dictionaryTags.ContainsKey(int.Parse(placeholderId.Id)) && _dictionaryTags.ContainsValue(phTagProperties)) { return(true); } return(false); }
//Helper function for source or tag with the same Id but different content private int CreatePlaceholderTagHelper(TagId placeholderId, IPlaceholderTagProperties phTagProperties) { var max = _dictionaryTags.Keys.Max(); var id = max + 1; placeholderId.Id = id.ToString(); phTagProperties.TagId = placeholderId; _dictionaryTags.Add(id, phTagProperties); return(id); }
private IPlaceholderTag CreatePhTag(string tagContent, int tagNo, bool source) { IPlaceholderTagProperties phTagProperties = PropertiesFactory.CreatePlaceholderTagProperties(tagContent); IPlaceholderTag phTag = ItemFactory.CreatePlaceholderTag(phTagProperties); phTagProperties.TagContent = tagContent; phTagProperties.DisplayText = string.Format("{{{0}}}", tagNo); phTagProperties.CanHide = false; if (source) { var thisId = new TagId(totalTagCount.ToString(CultureInfo.InvariantCulture)); phTagProperties.TagId = thisId; if (tags.ContainsKey(int.Parse(thisId.Id)) && !tags.ContainsValue(phTagProperties)) { totalTagCount = CreatePlaceholderTagHelper(thisId, phTagProperties); } if (!(tags.ContainsKey(int.Parse(thisId.Id)) && tags.ContainsValue(phTagProperties))) { tags.Add(totalTagCount, phTagProperties); } tagIds.Enqueue(totalTagCount); totalTagCount++; } else { int id; if (tagIds.Count != 0) { id = tagIds.Dequeue(); } else { id = totalTagCount++; } var thisId = new TagId(id.ToString(CultureInfo.InvariantCulture)); phTagProperties.TagId = thisId; if (tags.ContainsKey(int.Parse(thisId.Id)) && !tags.ContainsValue(phTagProperties)) { totalTagCount = CreatePlaceholderTagHelper(thisId, phTagProperties); } } return(phTag); }
public override void InlinePlaceholderTag(IPlaceholderTagProperties tagInfo) { var originalText = tagInfo.GetMetaData(EmbeddedContentConstants.EmbeddedContentMetaKey); if (originalText != null) { var textInfo = PropertiesFactory.CreateTextProperties(originalText); Text(textInfo); } else { base.InlinePlaceholderTag(tagInfo); } }
public override void InlinePlaceholderTag(IPlaceholderTagProperties tagInfo) { string originalText = tagInfo.GetMetaData(EmbeddedContentMetaKey); if (originalText != null) { ITextProperties textInfo = PropertiesFactory.CreateTextProperties(originalText); base.Text(textInfo); } else { base.InlinePlaceholderTag(tagInfo); } }
private IPlaceholderTag CreatePhTag(string tagContent, XmlNode item, int tagNo, bool source) { IPlaceholderTagProperties phTagProperties = PropertiesFactory.CreatePlaceholderTagProperties(tagContent); IPlaceholderTag phTag = ItemFactory.CreatePlaceholderTag(phTagProperties); phTagProperties.TagContent = item.OuterXml; phTagProperties.DisplayText = string.Format("{{{0}}}", tagNo); phTagProperties.CanHide = false; //determine tag id if (source) { var thisId = new TagId(_totalTagCount.ToString(CultureInfo.InvariantCulture)); phTagProperties.TagId = thisId; _totalTagCount += 1; _tmpTotalTagCount += 1; _srcSegmentTagCount += 1; //check for source with the same Id and different properties if (CheckForIdAndPropertiesNotEqual(thisId, phTagProperties)) { _totalTagCount = CreatePlaceholderTagHelper(thisId, phTagProperties); } //check for source with the same Id and same properties if (!CheckForIdAndPropertiesEqual(thisId, phTagProperties)) { _dictionaryTags.Add(int.Parse(thisId.Id), phTagProperties); } } else { var thisId = new TagId(_totalTagCount.ToString(CultureInfo.InvariantCulture)); phTagProperties.TagId = thisId; if (CheckForIdAndPropertiesNotEqual(thisId, phTagProperties)) { _totalTagCount = CreatePlaceholderTagHelper(thisId, phTagProperties); } } return(phTag); }
private IPlaceholderTag CreatePhTag(string tagContent, XmlNode item, int tagNo) { IPlaceholderTagProperties phTagProperties = PropertiesFactory.CreatePlaceholderTagProperties(tagContent); IPlaceholderTag phTag = ItemFactory.CreatePlaceholderTag(phTagProperties); string cont; if (item.NextSibling == null) { cont = ""; } else { cont = item.NextSibling.Value; } phTagProperties.TagContent = item.OuterXml; phTagProperties.DisplayText = item.Name; phTagProperties.CanHide = false; return(phTag); }
private IPlaceholderTag CreatePhTag(string tagContent, XmlNode item, bool source) { IPlaceholderTagProperties phTagProperties = PropertiesFactory.CreatePlaceholderTagProperties(tagContent); IPlaceholderTag phTag = ItemFactory.CreatePlaceholderTag(phTagProperties); string cont; if (item.NextSibling == null) { cont = ""; } else { cont = item.NextSibling.Value; } phTagProperties.SegmentationHint = SegmentationHint.IncludeWithText; phTagProperties.TagContent = item.OuterXml; phTagProperties.DisplayText = item.Name; phTagProperties.CanHide = false; //determine tag id if (source) { /*Sdl.FileTypeSupport.Framework.NativeApi.TagId thisId = * new Sdl.FileTypeSupport.Framework.NativeApi.TagId(totalTagCount.ToString()); * * phTagProperties.TagId = thisId;*/ totalTagCount += 1; tmpTotalTagCount += 1; srcSegmentTagCount += 1; } return(phTag); }
//Helper function for source or tag with the same Id but different content private int CreatePlaceholderTagHelper(TagId placeholderId, IPlaceholderTagProperties phTagProperties) { var max = _dictionaryTags.Keys.Max(); var id = max + 1; placeholderId.Id = id.ToString(); phTagProperties.TagId = placeholderId; _dictionaryTags.Add(id, phTagProperties); return id; }
//Helper method to check if source or tag have same Id and same content private bool CheckForIdAndPropertiesEqual(TagId placeholderId, IPlaceholderTagProperties phTagProperties) { if (_dictionaryTags.ContainsKey(int.Parse(placeholderId.Id)) && _dictionaryTags.ContainsValue(phTagProperties)) { return true; } return false; }
private IPlaceholderTag CreatePlaceHolderTagInternal(string text, IPlaceholderTagProperties placeHolderTagProps) { return(ItemFactory.CreatePlaceholderTag(placeHolderTagProps)); }
public override void InlinePlaceholderTag(IPlaceholderTagProperties tag) { base.InlinePlaceholderTag(tag); }