public UndoInsertRow(OutlinerNote note, int columnIndex) { __NoteId = note.Id; __ParentNoteId = note.Parent.Id; __Index = note.Parent.SubNotes.IndexOf(note); __ColumnIndexAfterInsert = columnIndex; }
public UndoLevelStyle(OutlinerNote note) { __NoteId = note.Id; __Before = new MemoryStream[note.Columns.Count]; __After = new MemoryStream[note.Columns.Count]; __IsEmpty = true; for (int i = 0; i < note.Columns.Count; i++) { FlowDocument document = note.Columns[i].ColumnData as FlowDocument; if (document == null) continue; __Before[i] = new MemoryStream(); __After[i] = new MemoryStream(); TextRange range = new TextRange(document.ContentStart, document.ContentEnd); range.Save(__Before[i], DataFormats.Xaml); if (!range.IsEmpty) __IsEmpty = false; } }
public UndoLevelStyle(OutlinerNote note) { __NoteId = note.Id; __Before = new MemoryStream[note.Columns.Count]; __After = new MemoryStream[note.Columns.Count]; __IsEmpty = true; for (int i = 0; i < note.Columns.Count; i++) { FlowDocument document = note.Columns[i].ColumnData as FlowDocument; if (document == null) { continue; } __Before[i] = new MemoryStream(); __After[i] = new MemoryStream(); TextRange range = new TextRange(document.ContentStart, document.ContentEnd); range.Save(__Before[i], DataFormats.Xaml); if (!range.IsEmpty) { __IsEmpty = false; } } }
private static void DumpHTMLRecursive(StreamWriter writer, OutlinerNote outlinerNote) { if (!outlinerNote.IsRoot) { string style; string html = HtmlFromReport((FlowDocument)outlinerNote.Columns[0].ColumnData, out style); string inlineNote = ""; if (outlinerNote.HasInlineNote) { string inlineStyle; inlineNote = HtmlFromReport((FlowDocument)outlinerNote.InlineNoteDocument, out inlineStyle); inlineNote = string.Format("<div id=note style='{0}'>{1}</div>", inlineStyle, inlineNote); } writer.WriteLine("<li style='{0}'>{1}{2}</li>", style, html, inlineNote); } if (outlinerNote.SubNotes.Count > 0) { writer.WriteLine("<ul>"); for (int i = 0; i < outlinerNote.SubNotes.Count; i++) { DumpHTMLRecursive(writer, outlinerNote.SubNotes[i]); } writer.WriteLine("</ul>"); } }
private void SaveNote(OutlinerNote note) { __NoteId = note.Id; __SavedNote = note; __ParentNodeId = note.Parent.Id; __NodeIndex = note.Parent.SubNotes.IndexOf(note); }
private static void SaveRecursive(XmlWriter wr, OutlinerNote outlinerNote) { wr.WriteStartElement("Outline"); wr.WriteAttributeString("IsExpanded", outlinerNote.IsExpanded.ToString()); wr.WriteAttributeString("IsChecked", outlinerNote.IsChecked.ToString()); wr.WriteStartElement("Columns"); // Save all columns for (int i = 0; i < outlinerNote.Columns.Count; i++) { outlinerNote.Columns[i].Save(wr); } wr.WriteEndElement(); if (outlinerNote.HasInlineNote) { SaveInlineNote(wr, outlinerNote); } for (int i = 0; i < outlinerNote.SubNotes.Count; i++) { SaveRecursive(wr, outlinerNote.SubNotes[i]); } wr.WriteEndElement(); }
public override void Undo(OutlinerDocument document, TreeListView treeListView) { OutlinerNote row = document.FindOutlinerNoteById(__NodeId); MainWindow window = DragDropHelper.GetMainWindow(treeListView); window.DoHoist(row); }
public static void InsertItemInItemsControl(ItemsControl itemsControl, OutlinerNote itemToInsert, int insertionIndex) { OutlinerNote parent = itemsControl.DataContext as OutlinerNote; if (parent == null) { parent = (itemToInsert as OutlinerNote).GetRoot(); } OutlinerNote newNote = new OutlinerNote(parent); newNote.Clone(itemToInsert); Window ownerWindow = TreeListView.FindParentWindow(itemsControl); if (ownerWindow == null) { throw new Exception("Window cannot be null"); } DocumentHelpers.CopyNodesRecursively(newNote, itemToInsert); parent.SubNotes.Insert(insertionIndex, newNote); if (itemsControl is TreeListView) { ((TreeListView)itemsControl).MakeActive(newNote, -1, false); } }
public override void Redo(OutlinerDocument document, TreeListView treeListView) { OutlinerNote note = document.FindOutlinerNoteById(__NoteId); SaveNote(note); DocumentHelpers.DeleteRow(note, treeListView); }
/// <summary> /// /// </summary> /// <param name="note"></param> /// <param name="wasChecked">Была ли заметка выбрана до переключения</param> public UndoCheck(OutlinerNote currentNote, bool wasChecked, bool selectNote) { __WasChecked = wasChecked; __NodeId = currentNote.Id; __SelectNote = selectNote; __SavedCheckboxes = new List <SavedCheckState>(); SavedCheckState state = new SavedCheckState(); state.NodeId = currentNote.Id; state.IsChecked = currentNote.IsChecked == true; __SavedCheckboxes.Add(state); OutlinerDocument.WalkRecursively(currentNote, (RecursiveWalkDelegate) delegate(OutlinerNote note, out bool shouldWalkSubItems, out bool shouldContinue) { shouldContinue = true; shouldWalkSubItems = true; state = new SavedCheckState(); state.NodeId = note.Id; state.IsChecked = note.IsChecked == true; __SavedCheckboxes.Add(state); }); }
private static void DumpRtfRecursively_List(List list, OutlinerNote outlinerNote) { foreach (var note in outlinerNote.SubNotes) { MemoryStream sectionStream = ExportToXaml_Printing.TransformFlowDocumentToSection(note.DefaultRichTextDocument); ListItem newItem = new ListItem(); Section section = XamlReader.Load(sectionStream) as Section; if (section == null) { section = new Section(); } newItem.Blocks.Add(section); list.ListItems.Add(newItem); if (outlinerNote.SubNotes.Count > 0) { List newList = new List(); list.FontFamily = UVOutliner.Settings.DefaultFontFamily; list.FontSize = UVOutliner.Settings.DefaultFontSize; newItem.Blocks.Add(newList); DumpRtfRecursively_List(newList, note); } } }
private static void DumpTextRecursively(StreamWriter writer, OutlinerNote outlinerNote, int padding) { int newPadding = padding; if (!outlinerNote.IsRoot) { string paddingStr = ""; for (int i = 0; i < padding; i++) { paddingStr += " "; } writer.Write(paddingStr); TextRange selection = new TextRange(outlinerNote.DefaultRichTextDocument.ContentStart, outlinerNote.DefaultRichTextDocument.ContentEnd); using (MemoryStream stream = new MemoryStream()) { selection.Save(stream, System.Windows.DataFormats.Text); stream.Seek(0, SeekOrigin.Begin); StreamReader sr = new StreamReader(stream); string text = sr.ReadToEnd(); text = text.Replace("\r\n", "\r\n " + paddingStr); text = text.Trim(); writer.WriteLine("* {0}", text); } newPadding += 4; } for (int i = 0; i < outlinerNote.SubNotes.Count; i++) { DumpTextRecursively(writer, outlinerNote.SubNotes[i], newPadding); } }
public static void AddInlineNote(TableRowCollection tableRowCollection, OutlinerNote note, bool fromWordFriendly = false) { TableRow tableRow = new TableRow(); Section section = XamlReader.Load(TransformFlowDocumentToSection(note.InlineNoteDocument)) as Section; if (section == null) { return; } TableCell cell = new TableCell(); if (fromWordFriendly) { section.Margin = new Thickness(note.Level * 20 + (note.Document.CheckboxesVisble ? 10 : 0), 0, 0, 2); } else { section.Margin = new Thickness(note.Level * 20 + 20 + (note.Document.CheckboxesVisble ? 20 : 0), 0, 0, 2); } cell.Blocks.Add(section); tableRow.Cells.Add(cell); for (int c = 0; c < note.Columns.Count - 1; c++) { tableRow.Cells.Add(new TableCell()); } tableRowCollection.Add(tableRow); }
public override void Undo(OutlinerDocument document, TreeListView treeListView) { OutlinerNote rootNote = null; for (int i = 0; i < __SavedCheckboxes.Count; i++) { OutlinerNote note = document.FindOutlinerNoteById(__SavedCheckboxes[i].NodeId); note.SetCheckedForCurrentNote(__SavedCheckboxes[i].IsChecked); if (rootNote == null) { rootNote = note; } } for (int i = 0; i < __SavedCheckboxes.Count; i++) { OutlinerNote note = document.FindOutlinerNoteById(__SavedCheckboxes[i].NodeId); note.UpdateParentCheckboxes(); } if (__SelectNote && rootNote != null) { treeListView.MakeActive(rootNote, -1, false); } rootNote.UpdateParentCheckboxes(); rootNote.OnPropertyChanged("IsChecked"); rootNote.OnPropertyChanged("IsCheckedDirect"); }
private void DropTarget_PreviewDrop(object sender, DragEventArgs e) { object draggedItem = e.Data.GetData(this.format.Name); int indexRemoved = -1; if (draggedItem != null) { OutlinerNote note = draggedItem as OutlinerNote; if (note == null) { RemoveInsertionAdorner(); RemoveDragOverMargin(); return; } UndoDragDrop undo = new UndoDragDrop(note); indexRemoved = note.Parent.SubNotes.IndexOf(note); note.Parent.SubNotes.Remove(note); // This happens when we drag an item to a later position within the same ItemsControl. if (indexRemoved != -1 && this.sourceItemContainer.ParentItemsControl == this.targetItemContainer && indexRemoved < this.insertionIndex) { this.insertionIndex--; } DranDropUtilities.InsertItemInItemsControl(this.targetItemContainer, draggedItem as OutlinerNote, this.insertionIndex); note.Document.UndoManager.PushUndoAction(undo); RemoveInsertionAdorner(); RemoveDragOverMargin(); } e.Handled = true; }
private static void ReadColumns(XmlReader reader, OutlinerNote note) { for (int i = 0; i < note.Columns.Count; i++) { note.Columns[i].Load(reader); } }
private void RemoveDragOverMargin() { if (__DragOverNote != null) { __DragOverNote.DragOverNote = false; __DragOverNote = null; } }
public override void Undo(OutlinerDocument document, TreeListView treeListView) { OutlinerNote note = document.FindOutlinerNoteById(__NoteId); __SavedNote = note; __ColumnIndexBeforeUndo = DocumentHelpers.GetFocusedColumnIdx(treeListView, note); DocumentHelpers.DeleteRow(note, treeListView, __ColumnIndexAfterInsert); }
private static void ReadInlineNote(XmlReader reader, OutlinerNote note) { reader.ReadToFollowing("FlowDocument"); XmlReader xmlReader = reader.ReadSubtree(); FlowDocument inlineDoc = (FlowDocument)XamlReader.Load(xmlReader); note.CreateInlineNote(inlineDoc); xmlReader.Close(); }
public override void Redo(OutlinerDocument document, TreeListView treeListView) { OutlinerNote row = document.FindOutlinerNoteById(__NodeId); MainWindow window = DragDropHelper.GetMainWindow(treeListView); if (document.HostNode == row && row != null) { window.DoUnhoist(row); } }
public static OutlinerNote PasteFromClipboard(OutlinerNote insertAfterThisNote) { OutlinerNote note = null; OutlinerNote parentNode = insertAfterThisNote.Parent; int insertionIndex = insertAfterThisNote.Parent.SubNotes.IndexOf(insertAfterThisNote) + 1; if (Clipboard.ContainsData("uvoutlinerdata")) { try { string data = (string)Clipboard.GetData("uvoutlinerdata"); if (data == null || data == "") { return(null); } byte[] clipboard = Encoding.UTF8.GetBytes(data); MemoryStream stream = new MemoryStream(); stream.Write(clipboard, 0, clipboard.Length); stream.Seek(0, SeekOrigin.Begin); XmlReaderSettings settings = new XmlReaderSettings(); settings.CheckCharacters = false; XmlReader reader = XmlReader.Create(stream, settings); reader.ReadStartElement("UVOutlinerClipboard"); //reader.Read(); XmlReader subtree = reader.ReadSubtree(); note = ReadRecustive(subtree, parentNode); subtree.Close(); if (note != null) { parentNode.SubNotes.Insert(insertionIndex, note); } reader.Close(); } catch { // do nothing } } else if (Clipboard.ContainsData(DataFormats.Text)) { note = new OutlinerNote(parentNode); FlowDocument firstColumnDocument = (FlowDocument)(note.Columns[0].ColumnData); TextRange range = new TextRange(firstColumnDocument.ContentStart, firstColumnDocument.ContentEnd); range.Text = Clipboard.GetText(); parentNode.SubNotes.Insert(insertionIndex, note); } return(note); }
private static void AddImages(OutlinerDocument Document, OutlinerNote note, Paragraph para) { Image expImage = new Image(); expImage.Margin = new Thickness(0, 2, 0, 0); expImage.Width = 14; expImage.Height = 14; expImage.SetValue(RenderOptions.BitmapScalingModeProperty, BitmapScalingMode.NearestNeighbor); BitmapImage bImage = new BitmapImage(); if (note.SubNotes.Count == 0) { bImage.UriSource = new Uri("pack://application:,,,/uv;component/res/bullet.png"); } else { if (note.IsExpanded) { bImage.UriSource = new Uri("pack://application:,,,/uv;component/res/node_expanded.png"); } else { bImage.UriSource = new Uri("pack://application:,,,/uv;component/res/node_collapsed.png"); } } expImage.Source = bImage; expImage.Stretch = Stretch.None; para.Inlines.Add(expImage); if (Document.CheckboxesVisble) { Image checkBox = new Image(); checkBox.Margin = new Thickness(0, 2, 0, 0); checkBox.Width = 14; checkBox.Height = 14; checkBox.SetValue(RenderOptions.BitmapScalingModeProperty, BitmapScalingMode.NearestNeighbor); var checkSource = new BitmapImage(); if (note.IsChecked == true) { checkSource.UriSource = new Uri("pack://application:,,,/uv;component/res/checkbox_checked.png"); } else { checkSource.UriSource = new Uri("pack://application:,,,/uv;component/res/checkbox_unchecked.png"); } checkBox.Source = checkSource; checkBox.Stretch = Stretch.None; para.Inlines.Add(checkBox); } }
public static OutlinerColumn CreateColumnClass(OutlinerNote note, OutlinerColumnDefinition definition) { switch (definition.DataType) { case ColumnDataType.RichText: return new RichTextColumn(note); default: return null; } }
public static OutlinerColumn CreateColumnClass(OutlinerNote note, OutlinerColumnDefinition definition) { switch (definition.DataType) { case ColumnDataType.RichText: return(new RichTextColumn(note)); default: return(null); } }
private static void ReadOutlinerRow(OutlinerDocument rnl, XmlReader reader) { XmlReader subtree = reader.ReadSubtree(); OutlinerNote note = ReadRecustive(subtree, rnl.RootNode); subtree.Close(); if (note != null) { rnl.Add(note); } }
public override void Redo(OutlinerDocument document, TreeListView treeListView) { OutlinerNote newParent = document.FindOutlinerNoteById(__ParentNoteId); OutlinerNote newNote = new OutlinerNote(newParent); newNote.Clone(__SavedNote); DocumentHelpers.CopyNodesRecursively(newNote, __SavedNote); newParent.SubNotes.Insert(__Index, newNote); treeListView.MakeActive(newNote, __ColumnIndexBeforeUndo, false); }
public static void CopyToClipboard(OutlinerNote note) { MemoryStream clipboardStream = new MemoryStream(); XmlWriter wr = XmlWriter.Create(clipboardStream); // TODO: Write header wr.WriteStartElement("UVOutlinerClipboard"); SaveRecursive(wr, note); wr.WriteEndElement(); wr.Close(); Clipboard.SetData("uvoutlinerdata", Encoding.UTF8.GetString((clipboardStream as MemoryStream).ToArray())); }
public UndoIndent(OutlinerNote note, bool isInlineNoteFocused, IndentDirection direction) { __Direction = direction; __NoteId = note.Id; __IsInlineEditFocused = isInlineNoteFocused; if (direction == IndentDirection.DecreaseIndent) { if (note.SubNotes.Count > 0) __LimitNoteId = note.SubNotes[note.SubNotes.Count - 1].Id; else __LimitNoteId = note.Id; } }
public void StyleApplied(OutlinerNote note) { for (int i = 0; i < note.Columns.Count; i++) { FlowDocument document = note.Columns[i].ColumnData as FlowDocument; if (document == null) { continue; } TextRange range = new TextRange(document.ContentStart, document.ContentEnd); range.Save(__After[i], DataFormats.Xaml); } }
public static int RemoveItemFromItemsControl(ItemsControl itemsControl, object itemToRemove) { OutlinerNote note = (OutlinerNote)itemToRemove; if (note == null) { return(-1); } int noteIndex = note.Parent.SubNotes.IndexOf(note); note.Parent.SubNotes.Remove(note); return(noteIndex); }
public override void Redo(OutlinerDocument document, TreeListView treeListView) { OutlinerNote note = document.FindOutlinerNoteById(__NoteId); OutlinerNote newParent = document.FindOutlinerNoteById(__ParentNoteIdAfter); Debug.Assert(newParent != null); note.Parent.SubNotes.Remove(note); OutlinerNote newNote = new OutlinerNote(newParent); newNote.Clone(note); DocumentHelpers.CopyNodesRecursively(newNote, note); newParent.SubNotes.Insert(__IndexAfter, newNote); treeListView.MakeActive(newNote, -1, false); }
public override void Redo(OutlinerDocument document, TreeListView treeListView) { OutlinerNote note = document.FindOutlinerNoteById(__NodeId); note.IsChecked = __WasChecked; if (__SelectNote) { treeListView.MakeActive(note, -1, false); } note.UpdateParentCheckboxes(); note.OnPropertyChanged("IsChecked"); note.OnPropertyChanged("IsCheckedDirect"); }
internal void ApplyToNote(OutlinerNote note) { for (int i = 0; i < note.Columns.Count; i++) { FlowDocument document = note.Columns[i].ColumnData as FlowDocument; if (document == null) { continue; } TextRange range = new TextRange(document.ContentStart, document.ContentEnd); ApplyToRange(range); ApplyToDocument(document); } }
internal void UnapplyStyle(OutlinerNote note) { for (int i = 0; i < note.Columns.Count; i++) { if (note.Columns[i].DataType != UVOutliner.Columns.ColumnDataType.RichText) { continue; } FlowDocument document = (FlowDocument)note.Columns[i].ColumnData; TextRange range = new TextRange(document.ContentStart, document.ContentEnd); UnapplyToRange(range); UnapplyToDocument(document); } }
public UndoFlowDocumentFormatting(OutlinerNote note, int columnId, bool isInlineNote, bool wasSelected) { __NoteId = note.Id; __ColumnId = columnId; __IsInlineNote = isInlineNote; __Before = new MemoryStream(); FlowDocument flowDocument = (FlowDocument)note.Columns[columnId].ColumnData; __FontPropertiesBefore = new FontProperties(flowDocument); TextRange range = new TextRange(flowDocument.ContentStart, flowDocument.ContentEnd); range.Save(__Before, DataFormats.Xaml); __WasSelected = wasSelected; }
public static void AddInlineNote(TableRowCollection tableRowCollection, OutlinerNote note, bool fromWordFriendly = false) { TableRow tableRow = new TableRow(); Section section = XamlReader.Load(TransformFlowDocumentToSection(note.InlineNoteDocument)) as Section; if (section == null) return; TableCell cell = new TableCell(); if (fromWordFriendly) section.Margin = new Thickness(note.Level * 20 + (note.Document.CheckboxesVisble ? 10 : 0), 0, 0, 2); else section.Margin = new Thickness(note.Level * 20 + 20 + (note.Document.CheckboxesVisble ? 20 : 0), 0, 0, 2); cell.Blocks.Add(section); tableRow.Cells.Add(cell); for (int c = 0; c < note.Columns.Count - 1; c++) tableRow.Cells.Add(new TableCell()); tableRowCollection.Add(tableRow); }
/// <summary> /// /// </summary> /// <param name="note"></param> /// <param name="wasChecked">Была ли заметка выбрана до переключения</param> public UndoCheck(OutlinerNote currentNote, bool wasChecked, bool selectNote) { __WasChecked = wasChecked; __NodeId = currentNote.Id; __SelectNote = selectNote; __SavedCheckboxes = new List<SavedCheckState>(); SavedCheckState state = new SavedCheckState(); state.NodeId = currentNote.Id; state.IsChecked = currentNote.IsChecked == true; __SavedCheckboxes.Add(state); OutlinerDocument.WalkRecursively(currentNote, (RecursiveWalkDelegate)delegate(OutlinerNote note, out bool shouldWalkSubItems, out bool shouldContinue) { shouldContinue = true; shouldWalkSubItems = true; state = new SavedCheckState(); state.NodeId = note.Id; state.IsChecked = note.IsChecked == true; __SavedCheckboxes.Add(state); }); }
public RichTextColumn(OutlinerNote note) { __Document = null; __Note = note; }
public override void RemoveColumnData() { __Document = null; __LazyDocument = null; __Note = null; }
public UndoDeleteRow(OutlinerNote note) { __NoteId = note.Id; SaveNote(note); }
private static void DumpTextRecursively(StreamWriter writer, OutlinerNote outlinerNote, int padding) { int newPadding = padding; if (!outlinerNote.IsRoot) { string paddingStr = ""; for (int i = 0; i < padding; i++) paddingStr += " "; writer.Write(paddingStr); TextRange selection = new TextRange(outlinerNote.DefaultRichTextDocument.ContentStart, outlinerNote.DefaultRichTextDocument.ContentEnd); using (MemoryStream stream = new MemoryStream()) { selection.Save(stream, System.Windows.DataFormats.Text); stream.Seek(0, SeekOrigin.Begin); StreamReader sr = new StreamReader(stream); string text = sr.ReadToEnd(); text = text.Replace("\r\n", "\r\n " + paddingStr); text = text.Trim(); writer.WriteLine("* {0}", text); } newPadding += 4; } for (int i = 0; i < outlinerNote.SubNotes.Count; i++) DumpTextRecursively(writer, outlinerNote.SubNotes[i], newPadding); }
private static void ReadColumns(XmlReader reader, OutlinerNote note) { for (int i = 0; i < note.Columns.Count; i++) note.Columns[i].Load(reader); }
private static OutlinerNote ReadRecustive(XmlReader reader, OutlinerNote parent) { OutlinerNote note = new OutlinerNote(parent); note.LastStyleApplied = note.Document.Styles.GetStyleForLevel(note.Level); reader.Read(); string res = reader.GetAttribute("IsExpanded"); note.IsExpanded = bool.Parse(res); string isChecked = reader.GetAttribute("IsChecked"); if (isChecked != null && isChecked != "") note.IsChecked = bool.Parse(isChecked); reader.MoveToElement(); if (reader.ReadToFollowing("Columns") == false) throw new OpenFileException("No column tag found"); XmlReader subtree = reader.ReadSubtree(); ReadColumns(subtree, note); subtree.Close(); while (reader.Read()) { if (reader.Name == "InlineNote" && reader.IsStartElement()) ReadInlineNote(reader, note); if (reader.Name == "Outline" && reader.IsStartElement()) { subtree = reader.ReadSubtree(); OutlinerNote subNote = ReadRecustive(subtree, note); subtree.Close(); note.SubNotes.Add(subNote); } } return note; }
private static void SaveInlineNote(XmlWriter wr, OutlinerNote outlinerNote) { wr.WriteStartElement("InlineNote"); wr.WriteRaw(XamlWriter.Save(outlinerNote.InlineNoteDocument)); wr.WriteEndElement(); }
private static void SaveRecursive(XmlWriter wr, OutlinerNote outlinerNote) { wr.WriteStartElement("Outline"); wr.WriteAttributeString("IsExpanded", outlinerNote.IsExpanded.ToString()); wr.WriteAttributeString("IsChecked", outlinerNote.IsChecked.ToString()); wr.WriteStartElement("Columns"); // Save all columns for (int i = 0; i < outlinerNote.Columns.Count; i++) outlinerNote.Columns[i].Save(wr); wr.WriteEndElement(); if (outlinerNote.HasInlineNote) SaveInlineNote(wr, outlinerNote); for (int i = 0; i < outlinerNote.SubNotes.Count; i++) SaveRecursive(wr, outlinerNote.SubNotes[i]); wr.WriteEndElement(); }
public UndoHoist(OutlinerNote note) { __NodeId = note.Id; }
public void StyleApplied(OutlinerNote note) { for (int i = 0; i < note.Columns.Count; i++) { FlowDocument document = note.Columns[i].ColumnData as FlowDocument; if (document == null) continue; TextRange range = new TextRange(document.ContentStart, document.ContentEnd); range.Save(__After[i], DataFormats.Xaml); } }
public UndoDeleteInline(OutlinerNote note) { __NoteId = note.Id; __Document = DocumentHelpers.SaveDocumentToStream(note.InlineNoteDocument); __DocumentTag = note.InlineNoteDocument.Tag; }
public UndoDragDrop(OutlinerNote note) { __NoteId = note.Id; __ParentNoteIdBefore = note.Parent.Id; __IndexBefore = note.Parent.SubNotes.IndexOf(note); }
public UndoInsertInline(OutlinerNote note) { __NoteId = note.Id; }
private static void AddImages(OutlinerDocument Document, OutlinerNote note, Paragraph para) { Image expImage = new Image(); expImage.Margin = new Thickness(0, 2, 0, 0); expImage.Width = 14; expImage.Height = 14; expImage.SetValue(RenderOptions.BitmapScalingModeProperty, BitmapScalingMode.NearestNeighbor); BitmapImage bImage = new BitmapImage(); if (note.SubNotes.Count == 0) bImage.UriSource = new Uri("pack://application:,,,/uv;component/res/bullet.png"); else { if (note.IsExpanded) bImage.UriSource = new Uri("pack://application:,,,/uv;component/res/node_expanded.png"); else bImage.UriSource = new Uri("pack://application:,,,/uv;component/res/node_collapsed.png"); } expImage.Source = bImage; expImage.Stretch = Stretch.None; para.Inlines.Add(expImage); if (Document.CheckboxesVisble) { Image checkBox = new Image(); checkBox.Margin = new Thickness(0, 2, 0, 0); checkBox.Width = 14; checkBox.Height = 14; checkBox.SetValue(RenderOptions.BitmapScalingModeProperty, BitmapScalingMode.NearestNeighbor); var checkSource = new BitmapImage(); if (note.IsChecked == true) checkSource.UriSource = new Uri("pack://application:,,,/uv;component/res/checkbox_checked.png"); else checkSource.UriSource = new Uri("pack://application:,,,/uv;component/res/checkbox_unchecked.png"); checkBox.Source = checkSource; checkBox.Stretch = Stretch.None; para.Inlines.Add(checkBox); } }
internal void UnapplyStyle(OutlinerNote note) { for (int i = 0; i < note.Columns.Count; i++) { if (note.Columns[i].DataType != UVOutliner.Columns.ColumnDataType.RichText) continue; FlowDocument document = (FlowDocument)note.Columns[i].ColumnData; TextRange range = new TextRange(document.ContentStart, document.ContentEnd); UnapplyToRange(range); UnapplyToDocument(document); } }
public UndoMoveUp(OutlinerNote note, int activeColumn, bool isInlineNoteFocused) { __NodeId = note.Id; __ActiveColumn = activeColumn; __IsInlineNoteFocused = isInlineNoteFocused; }
internal void ApplyToNote(OutlinerNote note) { for (int i = 0; i < note.Columns.Count; i++) { FlowDocument document = note.Columns[i].ColumnData as FlowDocument; if (document == null) continue; TextRange range = new TextRange(document.ContentStart, document.ContentEnd); ApplyToRange(range); ApplyToDocument(document); } }