internal void UpdateStyle(BaseStyle activeStyle, StylePropertyType stylePropertyType, object value) { LevelStyle levelStyle = activeStyle as LevelStyle; InlineNoteStyle inlineStyle = activeStyle as InlineNoteStyle; WalkRecursively(__FakeRootNote, delegate(OutlinerNote note, out bool shouldWalkSubnotes, out bool shouldContinue) { shouldContinue = true; shouldWalkSubnotes = true; if (activeStyle.StyleType == StyleType.Inline) { if (!note.HasInlineNote) { return; } TextRange range = new TextRange(note.InlineNoteDocument.ContentStart, note.InlineNoteDocument.ContentEnd); UndoManager.PushUndoAction(new Undo.UndoFlowDocumentFormatting(note, 0, true, false)); LevelStyle.ApplyPropertyToRange(range, stylePropertyType, value); LevelStyle.ApplyPropertyToFlowDocument(note.InlineNoteDocument, stylePropertyType, value); } else // if (activeStyle.StyleType == StyleType.Level) { if (note.Level == levelStyle.Level || levelStyle.Level == -1) { ApplyStylePropertyForAllColumns(stylePropertyType, value, levelStyle, note); } } }); }
public OutlinerStyles() { __LevelStyles = new List <LevelStyle>(); __WholeDocumentStyle = new LevelStyle(-1); __WholeDocumentStyle.StyleChanged += new EventHandler(OnStyleChanged); Add(__WholeDocumentStyle); __InlineNoteStyle = new InlineNoteStyle(); __InlineNoteStyle.AddProperty(StylePropertyType.FontSize, Math.Floor(Settings.DefaultFontSize / 1.2)); __InlineNoteStyle.AddProperty(StylePropertyType.FontColor, new SolidColorBrush(Color.FromRgb(0x77, 0x77, 0x77))); __InlineNoteStyle.StyleChanged += new EventHandler(OnStyleChanged); Add(__InlineNoteStyle); GetStyleForLevel(5); // Create styles for the first 5 levels }