public void VisitLockedContent(ILockedContent lockedContent) { var lockedText = RemoveTags(lockedContent.ToString()); _tokens.Add(new Token(lockedText, Token.TokenType.LockedContent)); PlainText.Append(lockedText); }
public void VisitLockedContent(ILockedContent lockedContent) { if (ElementTypeToSearch == Token.TokenType.LockedContent && _currentLockedContentId.ToString() == ElementIdToSearch) { FoundElement = lockedContent; } _currentLockedContentId++; }
public void VisitLockedContent(ILockedContent lockedContent) { LockedContentTags.Add((ILockedContent)lockedContent); SegmentSections.Add(new SegmentSection(SegmentSection.ContentType.LockedContent, "", lockedContent.Content.ToString())); PlainText.Append(lockedContent.Content); }
public void VisitLockedContent(ILockedContent lockedContent) { LockedContent.Add(new IndexData(PlainText.Length, 0)); VisitChildren((IAbstractMarkupDataContainer)lockedContent.Content); LockedContent[LockedContent.Count - 1].Length = PlainText.Length - LockedContent[LockedContent.Count - 1].IndexStart; }
public void VisitLockedContent(ILockedContent lockedContent) { if (_ignoreTags) { return; } Text += lockedContent.Content.ToString(); }
public void VisitLockedContent(ILockedContent lockedContent) { if (_element is ElementLocked && _currentLockedContentId.ToString() == _elementIdToSearch) { FoundElement = lockedContent; } _currentLockedContentId++; }
public static void UnlockContent(ISegment targetSegment, IDocumentItemFactory itemFactory, IPropertiesFactory propFactory) { Location textLocation = new Location(targetSegment, true); bool isLContentFound = false; do { ILockedContent content = textLocation.ItemAtLocation as ILockedContent; if (content != null) { isLContentFound = true; int indexInParent = content.IndexInParent; ILockedContent origLContent = (ILockedContent)content.Clone(); Location lockedLocation = new Location(origLContent.Content, true); Location origLocation = new Location(CloneContainer(content.Parent), true); // create new parent subitems IAbstractMarkupDataContainer newParent = content.Parent; newParent.Clear(); int index = 0; do // loop by parent location { // take from locked selection if (index == indexInParent) { do // loop by locked content { if (lockedLocation.ItemAtLocation != null) { newParent.Add((IAbstractMarkupData)lockedLocation.ItemAtLocation.Clone()); } }while (lockedLocation.MoveNextSibling()); index++; } // take original items else { if (origLocation.ItemAtLocation != null) { newParent.Add((IAbstractMarkupData)origLocation.ItemAtLocation.Clone()); } index++; } }while (origLocation.MoveNextSibling()); } }while (textLocation.MoveNext()); if (isLContentFound) { // merge IText objects MergeMarkupData(targetSegment, itemFactory, propFactory); } }
public void VisitLockedContent(ILockedContent lockedContent) { if (_ignoreTags) { return; } _anchor++; var tag = new Tag( TagType.LockedContent, _anchor.ToString(), _anchor) { TextEquivalent = lockedContent.Content.ToString() }; Segment?.Add(tag); }
public void VisitLockedContent(ILockedContent lockedContent) { if (IgnoreTags) { return; } TagId++; var tag = new Tag( TagType.LockedContent, TagId.ToString(), TagId) { TextEquivalent = lockedContent.Content.ToString() }; Segment?.Add(tag); }
private void AddOpenTagContainer(ContentMatch match) { if (match.MatchRule.IsContentTranslatable) { ITagPair tagPair = CreateTagPair(match); _currentContainer.Add(tagPair); _currentContainer = tagPair; } else { //treat non-translatable content as locked ILockedContent lockedContent = CreateLockedContent(); _currentContainer.Add(lockedContent); _currentContainer = lockedContent.Content; } }
public void VisitLockedContent(ILockedContent lockedContent) { LockedContentTags.Add((ILockedContent)lockedContent.Clone()); var objTag = new Tag { AlignmentAnchor = "", Anchor = "", TagId = lockedContent.UniqueId.ToString(), TextEquivalent = lockedContent.Content.ToString(), SectionType = Tag.Type.LockedContent }; SegmentSections.Add(objTag); PlainText.Append(lockedContent.Content); }
public void VisitLockedContent(ILockedContent lockedContent) { // all locked content must be counted, as it is treated // as a single unit. if (_inLockedContent) { // we are already iterating recursively through all locked content // must not do it again here, as that would cause nested locked // content to be counted multiple times. return; } _inLockedContent = true; foreach (var item in lockedContent.Content.AllSubItems) { item.AcceptVisitor(this); } _inLockedContent = false; }
public void VisitLockedContent(ILockedContent lockedContent) { var lockedTag = new Sdl.LanguagePlatform.Core.Tag { Type = Sdl.LanguagePlatform.Core.TagType.LockedContent, TextEquivalent = lockedContent.Content.ToString(), Anchor = TagCounter }; Segment.Add(lockedTag); TagCounter++; SegmentSections.Add(IsRevisionMarker ? new SegmentSection(SegmentSection.ContentType.LockedContent, string.Empty, lockedContent.Content.ToString(), RevisionMarker) : new SegmentSection(SegmentSection.ContentType.LockedContent, string.Empty, lockedContent.Content.ToString())); PlainText.Append(lockedContent.Content); }
public void VisitLockedContent(ILockedContent lockedContent) { if (_ignoreTags) { return; } var element = new ElementLocked { Type = Element.TagType.OpeningTag }; Elements.Add(element); VisitChilderen(lockedContent.Content); element = new ElementLocked { Type = Element.TagType.ClosingTag }; Elements.Add(element); }
public void VisitLockedContent(ILockedContent lockedContent) { // all locked counted must be counted, as it is treated // as a single unit. if (_inLockedContent) { // we are already iterating recursively through all locked content, // must not do it again here, as that would cause nested locked // content to be counted multiple times. return; } // track the fact that we are in locked content, so that we avoid // counting nested locked content multiple times while vising all the sub-items. _inLockedContent = true; foreach (IAbstractMarkupData item in lockedContent.Content.AllSubItems) { item.AcceptVisitor(this); } // done _inLockedContent = false; }
public void VisitLockedContent(ILockedContent lockedContent) { // Not required for this implementation }
public void VisitLockedContent(ILockedContent lockedContent) { VisitChildren(lockedContent.Content); }
public void VisitLockedContent(ILockedContent lockedContent) { //Nothing to add }
public void VisitLockedContent(ILockedContent lockedContent) { // ignore; not used for this implementation }
public void VisitLockedContent(ILockedContent lockedContent) { _currentContainer.Add((ILockedContent)lockedContent.Clone()); }
public override void VisitLockedContent(ILockedContent lockedContent) { isCheckTags = true; VisitChildren((IAbstractMarkupDataContainer)lockedContent.Content); isCheckTags = false; }
public void VisitLockedContent(ILockedContent lockedContent) { }
public void VisitLockedContent(ILockedContent lockedContent) { SegmentSections.Add(new SegmentSection(false, lockedContent.Content.ToString())); PlainText.Append(lockedContent.Content); }
public void VisitLockedContent(ILockedContent lockedContent) { //Nothing to do }
public void VisitLockedContent(ILockedContent lockedContent) { PlainText.Append(lockedContent.Content); }
private int PerformReplaceIterator(Location textLocation, int textIndexStart, int textLength, ref int textIndex) { bool isWarning = false; _lockedCharactersCount = 0; TextCharacterCountingIterator iterator = new TextCharacterCountingIterator(textLocation); do { // if (iterator.CharacterCount + iterator.CharactersToNextLocation > textIndexStart) if (iterator.CharacterCount + iterator.CharactersToNextLocation + _charactersShift > textIndexStart) { // text with tags - do not replace, report warning //if (iterator.CharacterCount + iterator.CharactersToNextLocation < textIndexStart + textLength) if (iterator.CharacterCount + iterator.CharactersToNextLocation + _charactersShift < textIndexStart + textLength) { //textIndex = (iterator.CharacterCount + iterator.CharactersToNextLocation) - (textIndexStart + textLength); textIndex = (iterator.CharacterCount + iterator.CharactersToNextLocation + _charactersShift) - (textIndexStart + textLength); isWarning = true; } #region IText IText text = iterator.CurrentLocation.ItemAtLocation as IText; if (text != null && !isWarning) { // real index in IText textIndex = textIndexStart - (iterator.CharacterCount + _charactersShift); // replace the text of IText string replacedText = TextReplace(text.Properties.Text, textIndex, textLength); iterator.CurrentLocation.ItemAtLocation.Parent[iterator.CurrentLocation.ItemAtLocation.IndexInParent] = ItemFactory.CreateText(PropertiesFactory.CreateTextProperties(replacedText)); return(0); } #endregion #region Tags if (isWarning) { IPlaceholderTag phTag = iterator.CurrentLocation.ItemAtLocation as IPlaceholderTag; ITagPair tagPair = iterator.CurrentLocation.ItemAtLocation as ITagPair; if (phTag != null || tagPair != null) { return(-1); } tagPair = iterator.CurrentLocation.BottomLevel.Parent as ITagPair; if (iterator.CurrentLocation.BottomLevel.IsAtEndOfParent && tagPair != null) { return(-1); } } #endregion #region Comment if (isWarning) { ICommentMarker comment = iterator.CurrentLocation.ItemAtLocation as ICommentMarker; if (comment != null) { return(-3); } comment = iterator.CurrentLocation.BottomLevel.Parent as ICommentMarker; if (iterator.CurrentLocation.BottomLevel.IsAtEndOfParent && comment != null) { return(-3); } } #endregion } #region LockedContent ILockedContent content = iterator.CurrentLocation.ItemAtLocation as ILockedContent; if (content != null) { if (isWarning) { return(-2); } // real index in ILockedContent textIndex = textIndexStart - (iterator.CharacterCount + _charactersShift); // call the iterator for Locked Content Location lockedLocation = new Location((IAbstractMarkupDataContainer)content.Content, true); int sts = PerformReplaceIterator(lockedLocation, textIndex, textLength, ref textIndex); // CODE TO FIX TextCharacterCountingIterator BUG !!! >> // if TextCharacterCountingIterator failed to get CharactersToNextLocation, // we calculate it manually and save as _charactersShift if (iterator.CharactersToNextLocation == 0) { _charactersShift += _lockedCharactersCount; } if (sts != -4) { return(sts); } } content = iterator.CurrentLocation.BottomLevel.Parent as ILockedContent; if (iterator.CurrentLocation.BottomLevel.IsAtEndOfParent && content != null) { if (isWarning) { return(-1); } } #endregion } while (iterator.MoveNext()); _lockedCharactersCount = iterator.CharacterCount; return(-4); }