public static bool RemoveChild(this AnchoredBlock parent, TextElement child) { var block = child as Block; if (block == null) { return(false); } return(parent.Blocks.Remove(block)); }
public static void AddChild(this AnchoredBlock parent, TextElement child) { var block = child as Block; if (block == null) { return; } parent.Blocks.Add(block); }
public static void InsertAfter(this AnchoredBlock parent, TextElement previousSibling, TextElement child) { var block = child as Block; if (block == null) { return; } var previousBlock = previousSibling as Block; if (previousBlock == null || !parent.Blocks.Contains(previousBlock)) { parent.Blocks.Add(block); } parent.Blocks.InsertAfter(previousBlock, block); }
public static void InsertBefore(this AnchoredBlock parent, TextElement nextSibling, TextElement child) { var block = child as Block; if (block == null) { return; } var nextBlock = nextSibling as Block; if (nextBlock == null || !parent.Blocks.Contains(nextBlock)) { parent.Blocks.Add(block); } parent.Blocks.InsertBefore(nextBlock, block); }
private static int GetCharOffsetToPosition(Inline currentInline, TextPointer position, out TextPointer result) { Run run = currentInline as Run; if (run != null) { return(GetCharOffsetToPosition(run, position, out result)); } LineBreak lineBreak = currentInline as LineBreak; if (lineBreak != null) { return(GetCharOffsetToPosition(lineBreak, position, out result)); } Span span = currentInline as Span; if (span != null) { return(GetCharOffsetToPosition(span, position, out result)); } InlineUIContainer inlineUIContainer = currentInline as InlineUIContainer; if (inlineUIContainer != null) { return(GetCharOffsetToPosition(inlineUIContainer, position, out result)); } AnchoredBlock anchoredBlock = currentInline as AnchoredBlock; if (anchoredBlock != null) { return(GetCharOffsetToPosition(anchoredBlock, position, out result)); } throw new ArgumentException(); }
private static TextPointer GetPointerFromCharOffset(Inline currentInline, ref int charOffset) { Run run = currentInline as Run; if (run != null) { return(GetPointerFromCharOffset(run, ref charOffset)); } LineBreak lineBreak = currentInline as LineBreak; if (lineBreak != null) { return(GetPointerFromCharOffset(lineBreak, ref charOffset)); } Span span = currentInline as Span; if (span != null) { return(GetPointerFromCharOffset(span, ref charOffset)); } InlineUIContainer inlineUIContainer = currentInline as InlineUIContainer; if (inlineUIContainer != null) { return(GetPointerFromCharOffset(inlineUIContainer, ref charOffset)); } AnchoredBlock anchoredBlock = currentInline as AnchoredBlock; if (anchoredBlock != null) { return(GetPointerFromCharOffset(anchoredBlock, ref charOffset)); } throw new ArgumentException(); }
// Token: 0x06006B36 RID: 27446 RVA: 0x001EF6F4 File Offset: 0x001ED8F4 internal override bool InvalidateStructure(int startPosition) { Invariant.Assert(base.ParagraphEndCharacterPosition >= startPosition); bool result = false; if (base.ParagraphStartCharacterPosition == startPosition) { result = true; AnchoredBlock anchoredBlock = null; if (this._attachedObjects != null && this._attachedObjects.Count > 0) { anchoredBlock = (AnchoredBlock)this._attachedObjects[0].Element; } if (anchoredBlock != null && startPosition == anchoredBlock.ElementStartOffset) { StaticTextPointer staticTextPointerFromCP = TextContainerHelper.GetStaticTextPointerFromCP(base.StructuralCache.TextContainer, startPosition); if (staticTextPointerFromCP.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart) { result = (anchoredBlock != staticTextPointerFromCP.GetAdjacentElement(LogicalDirection.Forward)); } } } this.InvalidateTextFormatCache(); if (this._attachedObjects != null) { for (int i = 0; i < this._attachedObjects.Count; i++) { BaseParagraph para = this._attachedObjects[i].Para; if (para.ParagraphEndCharacterPosition >= startPosition) { para.InvalidateStructure(startPosition); } } } return(result); }
public static IEnumerable <TextElement> GetChildren(this AnchoredBlock parent) { return(parent.Blocks); }
private static int GetCharOffsetToPosition(AnchoredBlock anchoredBlock, TextPointer position, out TextPointer result) { return(GetCharOffsetToPosition(anchoredBlock.Blocks, position, out result)); }
private static TextPointer GetPointerFromCharOffset(AnchoredBlock anchoredBlock, ref int charOffset) { return(GetPointerFromCharOffset(anchoredBlock.ElementEnd, anchoredBlock.Blocks, ref charOffset)); }