internal void PushHookup(GroupHookup child, int insertAt) { m_insertAfter = null; // default insert at start m_insertRunAt = 0; if (CurrentHookup != null) { if (insertAt > 0) { var prevChild = CurrentHookup.Children[insertAt - 1] as IItemsHookup; if (prevChild != null) { if (prevChild.LastBox != null && prevChild.LastBox.Container == m_destination) { m_insertAfter = prevChild.LastBox; } var runHookup = prevChild.LastChild as LiteralStringParaHookup; if (runHookup != null && runHookup.ParaBox == m_destination) { m_insertRunAt = runHookup.ClientRunIndex + 1; } } } CurrentHookup.InsertChildHookup(child, insertAt); } CurrentHookup = child; }
public bool GetParagraphOps(out IParagraphOperations paragraphOps, out GroupHookup parentHookup, out int index) { paragraphOps = null; ItemHookup itemHookup = null; parentHookup = null; foreach (var hookup in Hookup.Parents) { var isoHookup = hookup as IHaveParagagraphOperations; if (isoHookup != null && isoHookup.GetParagraphOperations() != null) { parentHookup = hookup; paragraphOps = isoHookup.GetParagraphOperations(); break; } itemHookup = hookup as ItemHookup; } if (paragraphOps == null || itemHookup == null) { index = -1; return(false); } index = parentHookup.Children.IndexOf(itemHookup); return(true); }
public ViewBuilder(GroupBox destination) { m_destination = destination; m_rootBox = destination.Root; if (m_rootBox.RootHookup == null && m_destination == m_rootBox) { m_rootBox.RootHookup = new RootHookup(m_rootBox); } // Enhance JohnT: if we really use the capability to make a builder whose box is not the root, // we may need a more subtle way to get the appropriate current hookup. CurrentHookup = m_rootBox.RootHookup; }
void IHookupInternal.SetParentHookup(GroupHookup parent) { Debug.Assert(parent == m_hookup, "Can't make the parent of a LazyBox anything but the LazyHookup it already knows about"); }