// Token: 0x0600349D RID: 13469 RVA: 0x000EA0C0 File Offset: 0x000E82C0 internal MarkerList GetOpenMarkerStyles() { MarkerList markerList = new MarkerList(); if (this._dnaOpen != null) { this._dnaOpen.CullOpen(); int num = 0; for (int i = 0; i < this._dnaOpen.Count; i++) { DocumentNode documentNode = this._dnaOpen.EntryAt(i); if (documentNode.IsPending && documentNode.Type == DocumentNodeType.dnShape) { num = i + 1; } } for (int j = num; j < this._dnaOpen.Count; j++) { DocumentNode documentNode2 = this._dnaOpen.EntryAt(j); if (documentNode2.IsPending && documentNode2.Type == DocumentNodeType.dnList) { markerList.AddEntry(documentNode2.FormatState.Marker, documentNode2.FormatState.ILS, documentNode2.FormatState.StartIndex, documentNode2.FormatState.StartIndexDefault, documentNode2.VirtualListLevel); } } } return(markerList); }
// Token: 0x0600349E RID: 13470 RVA: 0x000EA1A0 File Offset: 0x000E83A0 internal MarkerList GetLastMarkerStyles(MarkerList mlHave, MarkerList mlWant) { MarkerList markerList = new MarkerList(); if (mlHave.Count > 0 || mlWant.Count == 0) { return(markerList); } bool flag = true; for (int i = this.Count - 1; i >= 0; i--) { DocumentNode documentNode = this.EntryAt(i); if (documentNode.Type == DocumentNodeType.dnCell || documentNode.Type == DocumentNodeType.dnTable) { break; } if (documentNode.Type == DocumentNodeType.dnListItem) { DocumentNode parentOfType = documentNode.GetParentOfType(DocumentNodeType.dnCell); if (parentOfType != null && !parentOfType.IsPending) { break; } DocumentNode parentOfType2 = documentNode.GetParentOfType(DocumentNodeType.dnShape); if (parentOfType2 == null || parentOfType2.IsPending) { for (DocumentNode parent = documentNode.Parent; parent != null; parent = parent.Parent) { if (parent.Type == DocumentNodeType.dnList) { MarkerListEntry markerListEntry = new MarkerListEntry(); markerListEntry.Marker = parent.FormatState.Marker; markerListEntry.StartIndexOverride = parent.FormatState.StartIndex; markerListEntry.StartIndexDefault = parent.FormatState.StartIndexDefault; markerListEntry.VirtualListLevel = parent.VirtualListLevel; markerListEntry.ILS = parent.FormatState.ILS; markerList.Insert(0, markerListEntry); if (markerListEntry.Marker != MarkerStyle.MarkerBullet) { flag = false; } } } break; } } } if (markerList.Count == 1 && flag) { markerList.RemoveRange(0, 1); } return(markerList); }
internal MarkerList GetLastMarkerStyles(MarkerList mlHave, MarkerList mlWant) { MarkerList ml = new MarkerList(); if (mlHave.Count > 0 || mlWant.Count == 0) { return ml; } bool bAllBullet = true; for (int i = Count - 1; i >= 0; i--) { DocumentNode dn = EntryAt(i); // Don't reopen a list across a table. if (dn.Type == DocumentNodeType.dnCell || dn.Type == DocumentNodeType.dnTable) { break; } if (dn.Type == DocumentNodeType.dnListItem) { // Don't open a list item in a closed table. DocumentNode dnCell = dn.GetParentOfType(DocumentNodeType.dnCell); if (dnCell != null && !dnCell.IsPending) { break; } // Ignore list items in shapes - note the continue since these didn't effect list continuation. DocumentNode dnShape = dn.GetParentOfType(DocumentNodeType.dnShape); if (dnShape != null && !dnShape.IsPending) { continue; } // OK, gather up the list structure that I'm potentially reopening. for (DocumentNode dnList = dn.Parent; dnList != null; dnList = dnList.Parent) { // Note that I'm building this list up in the reverse order of GetOpenMarkerStyles if (dnList.Type == DocumentNodeType.dnList) { MarkerListEntry mle = new MarkerListEntry(); mle.Marker = dnList.FormatState.Marker; mle.StartIndexOverride = dnList.FormatState.StartIndex; mle.StartIndexDefault = dnList.FormatState.StartIndexDefault; mle.VirtualListLevel = dnList.VirtualListLevel; mle.ILS = dnList.FormatState.ILS; ml.Insert(0, mle); if (mle.Marker != MarkerStyle.MarkerBullet) { bAllBullet = false; } } } break; } } // If all bullets at one level, don't do the continuation thing for simpler content generation. if (ml.Count == 1 && bAllBullet) { ml.RemoveRange(0, 1); } return ml; }
internal MarkerList GetOpenMarkerStyles() { MarkerList ml = new MarkerList(); if (_dnaOpen != null) { _dnaOpen.CullOpen(); int nShape = 0; for (int i = 0; i < _dnaOpen.Count; i++) { DocumentNode dn = _dnaOpen.EntryAt(i); if (dn.IsPending && dn.Type == DocumentNodeType.dnShape) { nShape = i + 1; } } for (int i = nShape; i < _dnaOpen.Count; i++) { DocumentNode dn = _dnaOpen.EntryAt(i); if (dn.IsPending && dn.Type == DocumentNodeType.dnList) { ml.AddEntry(dn.FormatState.Marker, dn.FormatState.ILS, dn.FormatState.StartIndex, dn.FormatState.StartIndexDefault, dn.VirtualListLevel); } } } return ml; }
private void EnsureListAndListItem(FormatState formatState, DocumentNodeArray dna, MarkerList mlHave, MarkerList mlWant, int nMatch) { int nInsertAt; bool added = false; int nLists = mlHave.Count; int nLevel = mlWant.Count; // Close any open lists that don't match the ones we want. bool bInField = dna.FindUnmatched(DocumentNodeType.dnFieldBegin) >= 0; if (nLists > nMatch) { DocumentNode documentNodePara = dna.Pop(); while (nLists > nMatch) { int nOpen = dna.FindPending(DocumentNodeType.dnList); if (nOpen >= 0) { dna.CloseAt(nOpen); // Only coalesce if this is a top-level list. Otherwise I want to get // the full structure to use for margin fixups so I delay coalescing. // No, don't coalesce since a later list may need to get merged with this one. // if (!bInField && dna.FindPending(DocumentNodeType.dnList) < 0) // dna.CoalesceChildren(_converterState, nOpen); } nLists--; mlHave.RemoveRange(mlHave.Count - 1, 1); } dna.Push(documentNodePara); } if (nLists < nLevel) { // Multiple immediately nested lists are handled poorly in Avalon and are usually an indication // of bad input from Word (or some other word processor). Clip the number of lists we'll create here. if (nLevel != nLists + 1) { // I'm going to truncate, but make the list I create here of the specific type at this level. if (nLevel <= mlWant.Count) { mlWant[nLists] = mlWant[mlWant.Count - 1]; } nLevel = nLists + 1; } // Ensure sufficient lists are open - this may be our first indication // Insert the list nodes right before the current paragraph nInsertAt = dna.Count - 1; while (nLists < nLevel) { added = true; DocumentNode dnList = new DocumentNode(DocumentNodeType.dnList); DocumentNode dnLI = new DocumentNode(DocumentNodeType.dnListItem); dna.InsertNode(nInsertAt, dnLI); dna.InsertNode(nInsertAt, dnList); // Set the list properties MarkerListEntry mle = mlWant.EntryAt(nLists); dnList.FormatState.Marker = mle.Marker; dnList.FormatState.StartIndex = mle.StartIndexToUse; dnList.FormatState.StartIndexDefault = mle.StartIndexDefault; dnList.VirtualListLevel = mle.VirtualListLevel; dnList.FormatState.ILS = mle.ILS; nLists++; } } // Ensure listitem is open nInsertAt = dna.Count - 1; int nList = dna.FindPending(DocumentNodeType.dnList); if (nList >= 0) { int nLI = dna.FindPending(DocumentNodeType.dnListItem, nList); if (nLI >= 0 && !added && !formatState.IsContinue) { DocumentNode documentNodePara = dna.Pop(); dna.CloseAt(nLI); // Don't coalesce - I may need to do margin fixup. // dna.CoalesceChildren(_converterState, nLI); dna.Push(documentNodePara); nLI = -1; nInsertAt = dna.Count - 1; } if (nLI == -1) { DocumentNode dnLI = new DocumentNode(DocumentNodeType.dnListItem); dna.InsertNode(nInsertAt, dnLI); } } }
private int GetMatchedMarkList(FormatState formatState, MarkerList mlHave, MarkerList mlWant) { // The ones we have are only "good" if the styles match what we want. int nMatch = 0; for (; nMatch < mlHave.Count && nMatch < mlWant.Count; nMatch++) { if (!formatState.IsContinue) { MarkerListEntry eHave = mlHave.EntryAt(nMatch); MarkerListEntry eWant = mlWant.EntryAt(nMatch); if (eHave.Marker != eWant.Marker || eHave.ILS != eWant.ILS || eHave.StartIndexDefault != eWant.StartIndexDefault || eWant.StartIndexOverride >= 0) { break; } } } return nMatch; }
internal MarkerList GetMarkerStylesOfParagraph(MarkerList mlHave, FormatState fs, bool bMarkerPresent) { MarkerList mlWant = new MarkerList(); long nVirtualListLevel = fs.ListLevel; long nStartIndexOverride = -1; // No list? if (nVirtualListLevel < 1) { return mlWant; } // Use currently open list styles for all levels below requested one for (int i = 0; i < mlHave.Count; i++) if (mlHave.EntryAt(i).VirtualListLevel < nVirtualListLevel || fs.IsContinue) { MarkerListEntry mle = mlHave.EntryAt(i); mlWant.AddEntry(mle.Marker, mle.ILS, -1, mle.StartIndexDefault, mle.VirtualListLevel); } else { break; } // If I'm a continuation paragraph, I'm done. if (fs.IsContinue) { return mlWant; } // Now determine the list style for the list level I'm going to add. ListOverrideTable lot = _converterState.ListOverrideTable; ListOverride lo = lot.FindEntry((int)fs.ILS); if (lo != null) { ListLevelTable levels = lo.Levels; if (levels == null || levels.Count == 0) { ListTableEntry lte = _converterState.ListTable.FindEntry(lo.ID); if (lte != null) { levels = lte.Levels; } // Did the list override specify a start index? if (lo.StartIndex > 0) { nStartIndexOverride = lo.StartIndex; } } if (levels != null) { ListLevel listLevel = levels.EntryAt((int)nVirtualListLevel - 1); if (listLevel != null) { // If there was a marker present, we ignore the "Hidden" style in the list table. MarkerStyle ms = listLevel.Marker; if (ms == MarkerStyle.MarkerHidden && bMarkerPresent) { ms = MarkerStyle.MarkerBullet; } mlWant.AddEntry(ms, fs.ILS, nStartIndexOverride, listLevel.StartIndex, nVirtualListLevel); return mlWant; } } } // If there wasn't a list definition, use the marker type in the formatstate. mlWant.AddEntry(fs.Marker, fs.ILS, nStartIndexOverride, fs.StartIndex, nVirtualListLevel); return mlWant; }