// Token: 0x060067A2 RID: 26530 RVA: 0x001D08B8 File Offset: 0x001CEAB8 internal override void InvalidateFormatCache() { for (BaseParagraph baseParagraph = this._firstChild; baseParagraph != null; baseParagraph = baseParagraph.Next) { baseParagraph.InvalidateFormatCache(); } }
// ------------------------------------------------------------------ // Table has been structurally altered // ------------------------------------------------------------------ private void TableStructureChanged(object sender, EventArgs e) { // Disconnect obsolete paragraphs. BaseParagraph paraInvalid = _firstChild; while (paraInvalid != null) { paraInvalid.Dispose(); paraInvalid = paraInvalid.Next; } _firstChild = null; // // Since whole table content is disposed, we need // - to create dirty text range corresponding to the Table content // - notify formatter that Table's content is changed. // int charCount = Table.SymbolCount - 2;// This is equivalent to (ContentEndOffset – ContentStartOffset) but is more performant. if (charCount > 0) { DirtyTextRange dtr = new DirtyTextRange(Table.ContentStartOffset, charCount, charCount); StructuralCache.AddDirtyTextRange(dtr); } if (StructuralCache.FormattingOwner.Formatter != null) { StructuralCache.FormattingOwner.Formatter.OnContentInvalidated(true, Table.ContentStart, Table.ContentEnd); } }
// Token: 0x060067A1 RID: 26529 RVA: 0x001D07BC File Offset: 0x001CE9BC internal override bool InvalidateStructure(int startPosition) { int paragraphStartCharacterPosition = base.ParagraphStartCharacterPosition; if (startPosition <= paragraphStartCharacterPosition + TextContainerHelper.ElementEdgeCharacterLength) { BaseParagraph baseParagraph = this._firstChild; while (baseParagraph != null) { BaseParagraph baseParagraph2 = baseParagraph; baseParagraph = baseParagraph.Next; baseParagraph2.Dispose(); baseParagraph2.Next = null; baseParagraph2.Previous = null; } this._firstChild = (this._lastFetchedChild = null); } else { BaseParagraph baseParagraph = this._firstChild; while (baseParagraph != null) { if (baseParagraph.ParagraphStartCharacterPosition + baseParagraph.LastFormatCch >= startPosition) { if (!baseParagraph.InvalidateStructure(startPosition)) { baseParagraph = baseParagraph.Next; } if (baseParagraph != null) { if (baseParagraph.Previous != null) { baseParagraph.Previous.Next = null; this._lastFetchedChild = baseParagraph.Previous; } else { this._firstChild = (this._lastFetchedChild = null); } while (baseParagraph != null) { BaseParagraph baseParagraph3 = baseParagraph; baseParagraph = baseParagraph.Next; baseParagraph3.Dispose(); baseParagraph3.Next = null; baseParagraph3.Previous = null; } break; } break; } else { baseParagraph = baseParagraph.Next; } } } return(startPosition < paragraphStartCharacterPosition + TextContainerHelper.ElementEdgeCharacterLength); }
// Token: 0x06006797 RID: 26519 RVA: 0x001CF7E8 File Offset: 0x001CD9E8 void ISegment.GetFirstPara(out int fSuccessful, out IntPtr firstParaName) { if (this._ur != null) { int cpfromElement = TextContainerHelper.GetCPFromElement(base.StructuralCache.TextContainer, base.Element, ElementEdge.AfterStart); if (this._ur.SyncPara != null && cpfromElement == this._ur.SyncPara.ParagraphStartCharacterPosition) { this._ur.SyncPara.Previous = null; if (this._ur.Next != null && this._ur.Next.FirstPara == this._ur.SyncPara) { this._ur.SyncPara.SetUpdateInfo(this._ur.Next.ChangeType, false); } else { this._ur.SyncPara.SetUpdateInfo(PTS.FSKCHANGE.fskchNone, this._ur.Next == null); } Invariant.Assert(this._firstChild == null); this._firstChild = this._ur.SyncPara; this._ur = this._ur.Next; } } if (this._firstChild != null) { if (base.StructuralCache.CurrentFormatContext.IncrementalUpdate && this._ur == null && this.NeedsUpdate() && !this._firstParaValidInUpdateMode) { if (!base.StructuralCache.CurrentFormatContext.FinitePage) { for (BaseParagraph baseParagraph = this._firstChild; baseParagraph != null; baseParagraph = baseParagraph.Next) { baseParagraph.Dispose(); } this._firstChild = null; } this._firstParaValidInUpdateMode = true; } else if (this._ur != null && this._ur.InProcessing && this._ur.FirstPara == this._firstChild) { this._firstChild.SetUpdateInfo(PTS.FSKCHANGE.fskchInside, false); } } if (this._firstChild == null) { ITextPointer contentStart = TextContainerHelper.GetContentStart(base.StructuralCache.TextContainer, base.Element); this._firstChild = this.GetParagraph(contentStart, false); if (this._ur != null && this._firstChild != null) { this._firstChild.SetUpdateInfo(PTS.FSKCHANGE.fskchNew, false); } } if (base.StructuralCache.CurrentFormatContext.IncrementalUpdate) { this._firstParaValidInUpdateMode = true; } this._lastFetchedChild = this._firstChild; fSuccessful = PTS.FromBoolean(this._firstChild != null); firstParaName = ((this._firstChild != null) ? this._firstChild.Handle : IntPtr.Zero); }
// Token: 0x060067A0 RID: 26528 RVA: 0x001D0780 File Offset: 0x001CE980 internal override void ClearUpdateInfo() { for (BaseParagraph baseParagraph = this._firstChild; baseParagraph != null; baseParagraph = baseParagraph.Next) { baseParagraph.ClearUpdateInfo(); } base.ClearUpdateInfo(); this._ur = null; this._firstParaValidInUpdateMode = false; }
// Token: 0x060068B0 RID: 26800 RVA: 0x001D8BE4 File Offset: 0x001D6DE4 protected override BaseParagraph GetParagraph(ITextPointer textPointer, bool fEmptyOk) { Invariant.Assert(textPointer is TextPointer); BaseParagraph baseParagraph = null; while (baseParagraph == null) { TextPointerContext pointerContext = textPointer.GetPointerContext(LogicalDirection.Forward); if (pointerContext == TextPointerContext.ElementStart) { TextElement adjacentElementFromOuterPosition = ((TextPointer)textPointer).GetAdjacentElementFromOuterPosition(LogicalDirection.Forward); if (adjacentElementFromOuterPosition is ListItem) { baseParagraph = new ListItemParagraph(adjacentElementFromOuterPosition, base.StructuralCache); break; } if (adjacentElementFromOuterPosition is List) { baseParagraph = new ListParagraph(adjacentElementFromOuterPosition, base.StructuralCache); break; } if (((TextPointer)textPointer).IsFrozen) { textPointer = textPointer.CreatePointer(); } textPointer.MoveToPosition(adjacentElementFromOuterPosition.ElementEnd); } else if (pointerContext == TextPointerContext.ElementEnd) { if (base.Element == ((TextPointer)textPointer).Parent) { break; } if (((TextPointer)textPointer).IsFrozen) { textPointer = textPointer.CreatePointer(); } textPointer.MoveToNextContextPosition(LogicalDirection.Forward); } else { if (((TextPointer)textPointer).IsFrozen) { textPointer = textPointer.CreatePointer(); } textPointer.MoveToNextContextPosition(LogicalDirection.Forward); } } if (baseParagraph != null) { base.StructuralCache.CurrentFormatContext.DependentMax = (TextPointer)textPointer; } return(baseParagraph); }
// Token: 0x06006AC7 RID: 27335 RVA: 0x001E901C File Offset: 0x001E721C public override void Dispose() { this.Table.TableStructureChanged -= this.TableStructureChanged; BaseParagraph baseParagraph = this._firstChild; while (baseParagraph != null) { BaseParagraph baseParagraph2 = baseParagraph; baseParagraph = baseParagraph.Next; baseParagraph2.Dispose(); baseParagraph2.Next = null; baseParagraph2.Previous = null; } this._firstChild = null; base.Dispose(); }
// Token: 0x06006796 RID: 26518 RVA: 0x001CF794 File Offset: 0x001CD994 public override void Dispose() { BaseParagraph baseParagraph = this._firstChild; while (baseParagraph != null) { BaseParagraph baseParagraph2 = baseParagraph; baseParagraph = baseParagraph.Next; baseParagraph2.Dispose(); baseParagraph2.Next = null; baseParagraph2.Previous = null; } this._firstChild = (this._lastFetchedChild = null); base.Dispose(); GC.SuppressFinalize(this); }
// ------------------------------------------------------------------ // IDisposable.Dispose // ------------------------------------------------------------------ public override void Dispose() { Table.TableStructureChanged -= new System.EventHandler(TableStructureChanged); BaseParagraph paraChild = _firstChild; while (paraChild != null) { BaseParagraph para = paraChild; paraChild = paraChild.Next; para.Dispose(); para.Next = null; para.Previous = null; } _firstChild = null; base.Dispose(); }
// Token: 0x06006ADC RID: 27356 RVA: 0x001E94F0 File Offset: 0x001E76F0 private void TableStructureChanged(object sender, EventArgs e) { for (BaseParagraph baseParagraph = this._firstChild; baseParagraph != null; baseParagraph = baseParagraph.Next) { baseParagraph.Dispose(); } this._firstChild = null; int num = this.Table.SymbolCount - 2; if (num > 0) { DirtyTextRange dtr = new DirtyTextRange(this.Table.ContentStartOffset, num, num, false); base.StructuralCache.AddDirtyTextRange(dtr); } if (base.StructuralCache.FormattingOwner.Formatter != null) { base.StructuralCache.FormattingOwner.Formatter.OnContentInvalidated(true, this.Table.ContentStart, this.Table.ContentEnd); } }
// Token: 0x06006AD2 RID: 27346 RVA: 0x001E92E0 File Offset: 0x001E74E0 internal void GetNextRow(IntPtr nmRow, out int fFound, out IntPtr pnmNextRow) { BaseParagraph baseParagraph = (RowParagraph)base.PtsContext.HandleToObject(nmRow); BaseParagraph baseParagraph2 = baseParagraph.Next; if (baseParagraph2 == null) { TableRow row = ((RowParagraph)baseParagraph).Row; TableRowGroup rowGroup = row.RowGroup; TableRow tableRow = null; int num = row.Index + 1; int num2 = rowGroup.Index + 1; if (num < rowGroup.Rows.Count) { tableRow = rowGroup.Rows[num]; } while (tableRow == null && num2 != this.Table.RowGroups.Count) { TableRowCollection rows = this.Table.RowGroups[num2].Rows; if (rows.Count > 0) { tableRow = rows[0]; } num2++; } if (tableRow != null) { baseParagraph2 = new RowParagraph(tableRow, base.StructuralCache); baseParagraph.Next = baseParagraph2; baseParagraph2.Previous = baseParagraph; ((RowParagraph)baseParagraph2).CalculateRowSpans(); } } if (baseParagraph2 != null) { fFound = 1; pnmNextRow = baseParagraph2.Handle; return; } fFound = 0; pnmNextRow = IntPtr.Zero; }
// Token: 0x060067A6 RID: 26534 RVA: 0x001D0CB8 File Offset: 0x001CEEB8 private UpdateRecord UpdateRecordFromDtr(DtrList dtrs, DirtyTextRange dtr, int dcpContent) { UpdateRecord updateRecord = new UpdateRecord(); updateRecord.Dtr = dtr; BaseParagraph baseParagraph = this._firstChild; int num = dcpContent; if (num < updateRecord.Dtr.StartIndex) { while (baseParagraph != null && num + baseParagraph.LastFormatCch <= updateRecord.Dtr.StartIndex && (num + baseParagraph.LastFormatCch != updateRecord.Dtr.StartIndex || !(baseParagraph is TextParagraph))) { num += baseParagraph.LastFormatCch; baseParagraph = baseParagraph.Next; } } updateRecord.FirstPara = baseParagraph; if (baseParagraph == null) { updateRecord.ChangeType = PTS.FSKCHANGE.fskchNew; } else if (num < updateRecord.Dtr.StartIndex) { updateRecord.ChangeType = PTS.FSKCHANGE.fskchInside; } else { updateRecord.ChangeType = PTS.FSKCHANGE.fskchNew; } updateRecord.SyncPara = null; while (baseParagraph != null) { if (num + baseParagraph.LastFormatCch > updateRecord.Dtr.StartIndex + updateRecord.Dtr.PositionsRemoved || (num + baseParagraph.LastFormatCch == updateRecord.Dtr.StartIndex + updateRecord.Dtr.PositionsRemoved && updateRecord.ChangeType != PTS.FSKCHANGE.fskchNew)) { updateRecord.SyncPara = baseParagraph.Next; break; } num += baseParagraph.LastFormatCch; baseParagraph = baseParagraph.Next; } return(updateRecord); }
// Token: 0x0600679A RID: 26522 RVA: 0x001CFD2C File Offset: 0x001CDF2C internal void UpdGetSegmentChange(out PTS.FSKCHANGE fskch) { if (base.StructuralCache.CurrentFormatContext.FinitePage) { DtrList dtrList = base.StructuralCache.DtrsFromRange(TextContainerHelper.GetCPFromElement(base.StructuralCache.TextContainer, base.Element, ElementEdge.BeforeStart), base.LastFormatCch); if (dtrList != null) { int cpfromElement = TextContainerHelper.GetCPFromElement(base.StructuralCache.TextContainer, base.Element, ElementEdge.AfterStart); DirtyTextRange dirtyTextRange = dtrList[0]; int num = cpfromElement; BaseParagraph baseParagraph = this._firstChild; if (num < dirtyTextRange.StartIndex) { while (baseParagraph != null && num + baseParagraph.LastFormatCch <= dirtyTextRange.StartIndex && (num + baseParagraph.LastFormatCch != dirtyTextRange.StartIndex || !(baseParagraph is TextParagraph))) { num += baseParagraph.Cch; baseParagraph = baseParagraph.Next; } if (baseParagraph != null) { baseParagraph.SetUpdateInfo(PTS.FSKCHANGE.fskchInside, false); } } else { baseParagraph.SetUpdateInfo(PTS.FSKCHANGE.fskchNew, false); } if (baseParagraph != null) { for (baseParagraph = baseParagraph.Next; baseParagraph != null; baseParagraph = baseParagraph.Next) { baseParagraph.SetUpdateInfo(PTS.FSKCHANGE.fskchNew, false); } } this._changeType = PTS.FSKCHANGE.fskchInside; } } fskch = this._changeType; }
// Token: 0x06006799 RID: 26521 RVA: 0x001CFC28 File Offset: 0x001CDE28 void ISegment.UpdGetFirstChangeInSegment(out int fFound, out int fChangeFirst, out IntPtr nmpBeforeChange) { this.BuildUpdateRecord(); fFound = PTS.FromBoolean(this._ur != null); fChangeFirst = PTS.FromBoolean(this._ur != null && (this._firstChild == null || this._firstChild == this._ur.FirstPara)); if (PTS.ToBoolean(fFound) && !PTS.ToBoolean(fChangeFirst)) { if (this._ur.FirstPara == null) { BaseParagraph baseParagraph = this._lastFetchedChild; while (baseParagraph.Next != null) { baseParagraph = baseParagraph.Next; } nmpBeforeChange = baseParagraph.Handle; } else { if (this._ur.ChangeType == PTS.FSKCHANGE.fskchNew) { this._ur.FirstPara.Previous.Next = null; } nmpBeforeChange = this._ur.FirstPara.Previous.Handle; } } else { nmpBeforeChange = IntPtr.Zero; } if (PTS.ToBoolean(fFound)) { this._ur.InProcessing = PTS.ToBoolean(fChangeFirst); this._changeType = PTS.FSKCHANGE.fskchInside; this._stopAsking = false; } }
// 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); }
// Token: 0x060067A3 RID: 26531 RVA: 0x001D08E0 File Offset: 0x001CEAE0 protected virtual BaseParagraph GetParagraph(ITextPointer textPointer, bool fEmptyOk) { BaseParagraph baseParagraph = null; switch (textPointer.GetPointerContext(LogicalDirection.Forward)) { case TextPointerContext.None: Invariant.Assert(textPointer.CompareTo(textPointer.TextContainer.End) == 0); if (!fEmptyOk) { baseParagraph = new TextParagraph(base.Element, base.StructuralCache); } break; case TextPointerContext.Text: if (textPointer.TextContainer.Start.CompareTo(textPointer) > 0 && (!(base.Element is TextElement) || ((TextElement)base.Element).ContentStart != textPointer)) { throw new InvalidOperationException(SR.Get("TextSchema_TextIsNotAllowedInThisContext", new object[] { base.Element.GetType().Name })); } baseParagraph = new TextParagraph(base.Element, base.StructuralCache); break; case TextPointerContext.EmbeddedElement: baseParagraph = new TextParagraph(base.Element, base.StructuralCache); break; case TextPointerContext.ElementStart: { TextElement adjacentElementFromOuterPosition = ((TextPointer)textPointer).GetAdjacentElementFromOuterPosition(LogicalDirection.Forward); if (adjacentElementFromOuterPosition is List) { baseParagraph = new ListParagraph(adjacentElementFromOuterPosition, base.StructuralCache); } else if (adjacentElementFromOuterPosition is Table) { baseParagraph = new TableParagraph(adjacentElementFromOuterPosition, base.StructuralCache); } else if (adjacentElementFromOuterPosition is BlockUIContainer) { baseParagraph = new UIElementParagraph(adjacentElementFromOuterPosition, base.StructuralCache); } else if (adjacentElementFromOuterPosition is Block || adjacentElementFromOuterPosition is ListItem) { baseParagraph = new ContainerParagraph(adjacentElementFromOuterPosition, base.StructuralCache); } else if (adjacentElementFromOuterPosition is Inline) { baseParagraph = new TextParagraph(base.Element, base.StructuralCache); } else { Invariant.Assert(false); } break; } case TextPointerContext.ElementEnd: Invariant.Assert(textPointer is TextPointer); Invariant.Assert(base.Element == ((TextPointer)textPointer).Parent); if (!fEmptyOk) { baseParagraph = new TextParagraph(base.Element, base.StructuralCache); } break; } if (baseParagraph != null) { base.StructuralCache.CurrentFormatContext.DependentMax = (TextPointer)textPointer; } return(baseParagraph); }
/// <summary> /// Determine paragraph type at the current TextPointer and /// create it. Only ListItem elements are considered. Any other /// content is skipped. /// </summary> /// <param name="textPointer"> /// TextPointer at which paragraph is to be created /// </param> /// <param name="fEmptyOk"> /// True if empty paragraph is acceptable /// </param> /// <returns> /// BaseParagraph that was created /// </returns> protected override BaseParagraph GetParagraph(ITextPointer textPointer, bool fEmptyOk) { Invariant.Assert(textPointer is TextPointer); BaseParagraph paragraph = null; while (paragraph == null) { TextPointerContext runType = textPointer.GetPointerContext(LogicalDirection.Forward); if (runType == TextPointerContext.ElementStart) { TextElement element = ((TextPointer)textPointer).GetAdjacentElementFromOuterPosition(LogicalDirection.Forward); if (element is ListItem) { // Need to handle visibility collapsed. //Visibility visibility = Retriever.Visibility(treePtr.CPPtr.Element); //if (visibility != Visibility.Collapsed) //{ // para = new //} //else skip the element paragraph = new ListItemParagraph(element, StructuralCache); break; } else if (element is List) { // Need to handle visibility collapsed. //Visibility visibility = Retriever.Visibility(treePtr.CPPtr.Element); //if (visibility != Visibility.Collapsed) //{ // para = new //} //else skip the element paragraph = new ListParagraph(element, StructuralCache); break; } // Skip all elements, which are not valid list item children if (((TextPointer)textPointer).IsFrozen) { // Need to clone TextPointer before moving it. textPointer = textPointer.CreatePointer(); } textPointer.MoveToPosition(element.ElementEnd); } else if (runType == TextPointerContext.ElementEnd) { // End of list, if the same as Owner of associated element // Skip content otherwise if (Element == ((TextPointer)textPointer).Parent) { break; } if (((TextPointer)textPointer).IsFrozen) { // Need to clone TextPointer before moving it. textPointer = textPointer.CreatePointer(); } textPointer.MoveToNextContextPosition(LogicalDirection.Forward); } else { // Skip content if (((TextPointer)textPointer).IsFrozen) { // Need to clone TextPointer before moving it. textPointer = textPointer.CreatePointer(); } textPointer.MoveToNextContextPosition(LogicalDirection.Forward); } } if (paragraph != null) { StructuralCache.CurrentFormatContext.DependentMax = (TextPointer)textPointer; } return(paragraph); }
// Token: 0x060067BE RID: 26558 RVA: 0x001D150D File Offset: 0x001CF70D internal AttachedObject(int dcp, BaseParagraph para) : base(dcp) { this.Para = para; }
/// <summary> /// GetNextRow /// </summary> /// <param name="nmRow">Previous body row name</param> /// <param name="fFound">Indication that body row is found</param> /// <param name="pnmNextRow">Body row name</param> internal void GetNextRow( IntPtr nmRow, out int fFound, out IntPtr pnmNextRow) { Debug.Assert(Table.RowGroups.Count > 0); BaseParagraph prevParagraph = ((RowParagraph)PtsContext.HandleToObject(nmRow)); BaseParagraph nextParagraph = prevParagraph.Next; if (nextParagraph == null) { TableRow currentRow = ((RowParagraph)prevParagraph).Row; TableRowGroup currentRowGroup = currentRow.RowGroup; TableRow tableRow = null; int nextRowIndex = currentRow.Index + 1; int nextRowGroupIndex = currentRowGroup.Index + 1; if (nextRowIndex < currentRowGroup.Rows.Count) { Debug.Assert(currentRowGroup.Rows[nextRowIndex].Index != -1, "Row is not in a table"); tableRow = currentRowGroup.Rows[nextRowIndex]; } while (tableRow == null) { if (nextRowGroupIndex == Table.RowGroups.Count) { break; } TableRowCollection Rows = Table.RowGroups[nextRowGroupIndex].Rows; if (Rows.Count > 0) { Debug.Assert(Rows[0].Index != -1, "Row is not in a table"); tableRow = Rows[0]; } nextRowGroupIndex++; } if (tableRow != null) { nextParagraph = new RowParagraph(tableRow, StructuralCache); prevParagraph.Next = nextParagraph; nextParagraph.Previous = prevParagraph; ((RowParagraph)nextParagraph).CalculateRowSpans(); } } if (nextParagraph != null) { fFound = PTS.True; pnmNextRow = nextParagraph.Handle; } else { fFound = PTS.False; pnmNextRow = IntPtr.Zero; } }
protected BaseParaClient(BaseParagraph paragraph) : base(paragraph.PtsContext) { _paraHandle = new SecurityCriticalDataForSet<IntPtr>(IntPtr.Zero); _paragraph = paragraph; }
// Token: 0x06006798 RID: 26520 RVA: 0x001CFA2C File Offset: 0x001CDC2C void ISegment.GetNextPara(BaseParagraph prevParagraph, out int fFound, out IntPtr nextParaName) { if (this._ur != null) { int paragraphEndCharacterPosition = prevParagraph.ParagraphEndCharacterPosition; if (this._ur.SyncPara != null && paragraphEndCharacterPosition == this._ur.SyncPara.ParagraphStartCharacterPosition) { this._ur.SyncPara.Previous = prevParagraph; prevParagraph.Next = this._ur.SyncPara; if (this._ur.Next != null && this._ur.Next.FirstPara == this._ur.SyncPara) { this._ur.SyncPara.SetUpdateInfo(this._ur.Next.ChangeType, false); } else { this._ur.SyncPara.SetUpdateInfo(PTS.FSKCHANGE.fskchNone, this._ur.Next == null); } this._ur = this._ur.Next; } else { Invariant.Assert(this._ur.SyncPara == null || paragraphEndCharacterPosition < this._ur.SyncPara.ParagraphStartCharacterPosition); if (!this._ur.InProcessing && this._ur.FirstPara != prevParagraph.Next && prevParagraph.Next != null) { prevParagraph.Next.SetUpdateInfo(PTS.FSKCHANGE.fskchNone, false); } else if (this._ur.FirstPara != null && this._ur.FirstPara == prevParagraph.Next) { this._ur.InProcessing = true; prevParagraph.Next.SetUpdateInfo(PTS.FSKCHANGE.fskchInside, false); } } } BaseParagraph baseParagraph = prevParagraph.Next; if (baseParagraph == null) { ITextPointer textPointerFromCP = TextContainerHelper.GetTextPointerFromCP(base.StructuralCache.TextContainer, prevParagraph.ParagraphEndCharacterPosition, LogicalDirection.Forward); baseParagraph = this.GetParagraph(textPointerFromCP, true); if (baseParagraph != null) { baseParagraph.Previous = prevParagraph; prevParagraph.Next = baseParagraph; if (this._changeType == PTS.FSKCHANGE.fskchInside) { baseParagraph.SetUpdateInfo(PTS.FSKCHANGE.fskchNew, false); } } } if (baseParagraph != null) { fFound = 1; nextParaName = baseParagraph.Handle; this._lastFetchedChild = baseParagraph; return; } fFound = 0; nextParaName = IntPtr.Zero; this._lastFetchedChild = prevParagraph; this._ur = null; }
//------------------------------------------------------------------- // ISegment.GetNextPara //------------------------------------------------------------------- void ISegment.GetNextPara( BaseParagraph prevParagraph, // IN: current para out int fFound, // OUT: is there next paragraph? out IntPtr nextParaName) // OUT: name of the next paragraph in section { if (_ur != null) { // Determine if synchronization point has been reached. int cpCurrent = prevParagraph.ParagraphEndCharacterPosition; if (_ur.SyncPara != null && cpCurrent == _ur.SyncPara.ParagraphStartCharacterPosition) { _ur.SyncPara.Previous = prevParagraph; prevParagraph.Next = _ur.SyncPara; if (_ur.Next != null && _ur.Next.FirstPara == _ur.SyncPara) { _ur.SyncPara.SetUpdateInfo(_ur.Next.ChangeType, false); } else { _ur.SyncPara.SetUpdateInfo(PTS.FSKCHANGE.fskchNone, _ur.Next == null); } _ur = _ur.Next; } else { Invariant.Assert(_ur.SyncPara == null || cpCurrent < _ur.SyncPara.ParagraphStartCharacterPosition); // Skip all paragraphs before the beginning of the next UpdateRecord. // This situation may happen when we go to the next UpdateRecord after finding // synchronization point. It means that we have to run into _ur.FirstPara and all // paragraphs up to this point dont need to be updated. if (!_ur.InProcessing && _ur.FirstPara != prevParagraph.Next && prevParagraph.Next != null) { prevParagraph.Next.SetUpdateInfo(PTS.FSKCHANGE.fskchNone, false); } // If updated paragraph return it else if (_ur.FirstPara != null && _ur.FirstPara == prevParagraph.Next) { Debug.Assert(_ur.ChangeType == PTS.FSKCHANGE.fskchInside); // Inconsistent UpdateRecord data _ur.InProcessing = true; prevParagraph.Next.SetUpdateInfo(PTS.FSKCHANGE.fskchInside, false); } } } BaseParagraph nextParagraph = prevParagraph.Next; #if TEXTPANELLAYOUTDEBUG bool cached = nextParagraph != null; #endif if (nextParagraph == null) { // Determine paragraph type and create it ITextPointer textPointer = TextContainerHelper.GetTextPointerFromCP(StructuralCache.TextContainer, prevParagraph.ParagraphEndCharacterPosition, LogicalDirection.Forward); nextParagraph = GetParagraph(textPointer, true); // Add new paragraph to a linked list of paragraphs in the segment if (nextParagraph != null) { nextParagraph.Previous = prevParagraph; prevParagraph.Next = nextParagraph; if (_changeType == PTS.FSKCHANGE.fskchInside) { nextParagraph.SetUpdateInfo(PTS.FSKCHANGE.fskchNew, false); } } } // Initialize output parameters if (nextParagraph != null) { fFound = PTS.True; nextParaName = nextParagraph.Handle; _lastFetchedChild = nextParagraph; } else { fFound = PTS.False; nextParaName = IntPtr.Zero; // Pages might be created in random order (assuming that structure is not // dirty). Because of that always update last fetched paragraph cache. _lastFetchedChild = prevParagraph; _ur = null; // Clear out any additional update record info for this segment. } #if TEXTPANELLAYOUTDEBUG if (StructuralCache.CurrentFormatContext.IncrementalUpdate) { System.Text.StringBuilder msg = new System.Text.StringBuilder(); msg.Append("ContPara.GetNextPara, Found=" + fFound); if (nextParagraph != null) { msg.Append(" Cached=" + cached + " Para=" + nextParagraph.GetType().Name); } TextPanelDebug.Log(msg.ToString(), TextPanelDebug.Category.ContentChange); } #endif }
protected BaseParaClient(BaseParagraph paragraph) : base(paragraph.PtsContext) { this._paraHandle = new SecurityCriticalDataForSet <IntPtr>(IntPtr.Zero); this._paragraph = paragraph; }
/// <summary> /// Constructor. /// </summary> /// <param name="dcp"> /// Attached object's character position. /// </param> /// <param name="para"> /// Paragraph associated with attached object. /// </param> internal AttachedObject(int dcp, BaseParagraph para) : base(dcp) { Para = para; }