//Find the first valid insertion position after or before the boundary node private bool _GetFirstFixedPosition(FixedTextPointer ftp, out FixedPosition fixedP) { LogicalDirection dir = LogicalDirection.Forward; if (ftp.FlowPosition.FlowNode.Fp != 0) { //End boundary dir = LogicalDirection.Backward; } FlowPosition flowP = (FlowPosition)ftp.FlowPosition.Clone(); //Get the first node that comes before or after the boundary node(probably a start or end node) flowP.Move(dir); FixedTextPointer nav = new FixedTextPointer(true, dir, flowP); if (flowP.IsStart || flowP.IsEnd) { ((ITextPointer)nav).MoveToNextInsertionPosition(dir); } if (this.Container.GetPageNumber(nav) == this.PageIndex) { return(Container.FixedTextBuilder.GetFixedPosition(nav.FlowPosition, dir, out fixedP)); } else { //This position is on another page. fixedP = new FixedPosition(this.Container.FixedTextBuilder.FixedFlowMap.FixedStartEdge, 0); return(false); } }
// Immediate scoping element. If no element scops the position, // returns the container element. internal FixedElement GetScopingElement() { FlowPosition flowScan = (FlowPosition)this.Clone(); int nestedElement = 0; TextPointerContext tst; while (flowScan.FlowNode.Fp > 0 && !IsVirtual(_FixedFlowMap[flowScan.FlowNode.Fp - 1]) && // do not de-virtualize nodes (tst = flowScan.GetPointerContext(LogicalDirection.Backward)) != TextPointerContext.None) { if (tst == TextPointerContext.ElementStart) { if (nestedElement == 0) { FlowPosition flowEnd = flowScan.GetClingPosition(LogicalDirection.Backward); return((FixedElement)flowEnd._flowNode.Cookie); } nestedElement--; } else if (tst == TextPointerContext.ElementEnd) { nestedElement++; } flowScan.Move(LogicalDirection.Backward); } return(_container.ContainerElement); }
// Token: 0x06002F97 RID: 12183 RVA: 0x000D65F8 File Offset: 0x000D47F8 internal FixedElement GetScopingElement() { FlowPosition flowPosition = (FlowPosition)this.Clone(); int num = 0; TextPointerContext pointerContext; while (flowPosition.FlowNode.Fp > 0 && !this.IsVirtual(this._FixedFlowMap[flowPosition.FlowNode.Fp - 1]) && (pointerContext = flowPosition.GetPointerContext(LogicalDirection.Backward)) != TextPointerContext.None) { if (pointerContext == TextPointerContext.ElementStart) { if (num == 0) { FlowPosition clingPosition = flowPosition.GetClingPosition(LogicalDirection.Backward); return((FixedElement)clingPosition._flowNode.Cookie); } num--; } else if (pointerContext == TextPointerContext.ElementEnd) { num++; } flowPosition.Move(LogicalDirection.Backward); } return(this._container.ContainerElement); }
// Token: 0x06002EBD RID: 11965 RVA: 0x000D31A4 File Offset: 0x000D13A4 ITextPointer ITextPointer.CreatePointer(int distance, LogicalDirection gravity) { ValidationHelper.VerifyDirection(gravity, "gravity"); FlowPosition flowPosition = (FlowPosition)this._flowPosition.Clone(); if (!flowPosition.Move(distance)) { throw new ArgumentException(SR.Get("BadDistance"), "distance"); } return(new FixedTextPointer(true, gravity, flowPosition)); }
// Token: 0x06002EF7 RID: 12023 RVA: 0x000D46A8 File Offset: 0x000D28A8 private bool _GetFirstFixedPosition(FixedTextPointer ftp, out FixedPosition fixedP) { LogicalDirection logicalDirection = LogicalDirection.Forward; if (ftp.FlowPosition.FlowNode.Fp != 0) { logicalDirection = LogicalDirection.Backward; } FlowPosition flowPosition = (FlowPosition)ftp.FlowPosition.Clone(); flowPosition.Move(logicalDirection); FixedTextPointer fixedTextPointer = new FixedTextPointer(true, logicalDirection, flowPosition); if (flowPosition.IsStart || flowPosition.IsEnd) { ((ITextPointer)fixedTextPointer).MoveToNextInsertionPosition(logicalDirection); } if (this.Container.GetPageNumber(fixedTextPointer) == this.PageIndex) { return(this.Container.FixedTextBuilder.GetFixedPosition(fixedTextPointer.FlowPosition, logicalDirection, out fixedP)); } fixedP = new FixedPosition(this.Container.FixedTextBuilder.FixedFlowMap.FixedStartEdge, 0); return(false); }