/// <summary> /// Changes the Selection's style /// </summary> public override void ApplyStyle(string style) { IStyle styleToBeApplied = RootBox.Style.Stylesheet.Style(style); if (styleToBeApplied == null) { return; } if (styleToBeApplied.IsParagraphStyle) { ISelectionRestoreData restoreData = RestoreData(RootBox.Selection); IParagraphOperations paragraphOps; GroupHookup parentHookup; int index; if (!GetParagraphOps(out paragraphOps, out parentHookup, out index)) { return; } paragraphOps.ApplyParagraphStyle(index, 1, style); restoreData.RestoreSelection().Install(); } else { StyleToBeApplied = styleToBeApplied; } }
private void ApplyParagraphStyle(InsertionPoint start, int numBoxes, string style) { ISelectionRestoreData restoreData = RestoreData(RootBox.Selection); IParagraphOperations paragraphOps; GroupHookup parentHookup; int index; if (!start.GetParagraphOps(out paragraphOps, out parentHookup, out index)) { return; } paragraphOps.ApplyParagraphStyle(index, numBoxes, style); restoreData.RestoreSelection(); }