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); }
private ParaBox MakePara(MockSequenceHookup hookup, AssembledStyles styles, MockData1 itemNew, string contents, RootBox root) { var newItemHookup = new ItemHookup(itemNew, null); hookup.InsertChildHookup(newItemHookup, 1); // Give that hookup a stringhookup child, connected to a paragraph and root box. var clientRuns = new List <IClientRun>(); itemNew.SimpleThree = contents; var run = new StringClientRun(contents, styles); clientRuns.Add(run); var source = new TextSource(clientRuns, null); var para = new ParaBox(styles, source); run.Hookup = new LiteralStringParaHookup(itemNew, para); newItemHookup.InsertChildHookup(run.Hookup, 0); root.AddBox(para); return(para); }