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 override void Delete() { if (Anchor.Hookup != DragEnd.Hookup) // Enhance JohnT: eventually we may handle some more cases. { IParagraphOperations paragraphOps = Anchor.Hookup.Parents.OfType <IHaveParagagraphOperations>().Select(isoHookup => isoHookup.GetParagraphOperations()). FirstOrDefault(); if (paragraphOps != null) { Action makeSelection; paragraphOps.InsertString(this, "", out makeSelection); RootBox.Site.PerformAfterNotifications(makeSelection); } Start.Install(); return; } if (!CanDelete()) { return; } Invalidate(); // while all old state still applies figure out old thing to invalidate. Anchor.Hookup.Delete(Start, End); Start.Install(); }
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; }