// public static readonly PropertyKey<GraphClipboardExportOptions> PropertyKeyCopyPageSettings = new PropertyKey<GraphClipboardExportOptions>("DE1819F6-7E8C-4C43-9984-B5C405236289", "Graph\\CopyPageOptions", PropertyLevel.All, typeof(GraphDocument), () => new GraphClipboardExportOptions()); static GraphDocumentClipboardActions() { DefaultGraphDocumentPasteOptions = GraphCopyOptions.All & ~GraphCopyOptions.CopyLayerPlotItems; DefaultGraphLayerPasteOptions = GraphCopyOptions.CopyLayerAll & ~GraphCopyOptions.CopyLayerPlotItems; _lastChoosenGraphDocumentPasteOptions = DefaultGraphDocumentPasteOptions; _lastChoosenGraphLayerPasteOptions = DefaultGraphLayerPasteOptions; }
/// <summary> /// Try to paste the entire GraphDocument from the clipboard using the specified paste options. /// </summary> /// <param name="doc">The graph document to paste into.</param> /// <param name="options">The options used for paste into that graph.</param> public static void PasteFromClipboard(this GraphDocument doc, GraphCopyOptions options) { object from = ClipboardSerialization.GetObjectFromClipboard("Altaxo.Graph.Graph3D.GraphDocumentAsXml"); if (from is GraphDocument) { doc.CopyFrom((GraphDocument)from, options); } }
public void CopyFrom(GraphDocument from, GraphCopyOptions options) { if (object.ReferenceEquals(this, from)) { return; } using (var suspendToken = SuspendGetToken()) { if (0 != (options & GraphCopyOptions.CloneNotes)) { ChildCopyToMember(ref _notes, from._notes); } if (0 != (options & GraphCopyOptions.CloneProperties)) { // Clone also the graph properties if (from._graphProperties != null && from._graphProperties.Count > 0) { PropertyBagNotNull.CopyFrom(from._graphProperties); } else { _graphProperties = null; } } // the order is important here: clone the layers only before setting the printable graph bounds and other // properties, otherwise some errors will happen var newRootLayer = RootLayer; if (GraphCopyOptions.CopyLayerAll == (options & GraphCopyOptions.CopyLayerAll)) { newRootLayer = (HostLayer)from._rootLayer.Clone(); } else if (0 != (options & GraphCopyOptions.CopyLayerAll)) { // don't clone the layers, but copy the style of each each of the souce layers to the destination layers - this has to be done recursively newRootLayer.CopyFrom(from._rootLayer, options); } RootLayer = newRootLayer; suspendToken.Resume(); } }
public static void PasteFromClipboardAsTemplateForLayer(this GraphDocument doc, IEnumerable <int> layerNumber) { /* * object options = new PasteLayerOptions() { PastePlotStyles = true, PastePlotItems = true }; * if (false == Current.Gui.ShowDialog(ref options, "Choose what to paste")) * return; * PasteFromClipboardAsTemplateForLayer(doc, layerNumber, (options as PasteLayerOptions).GetCopyOptions()); * */ GraphCopyOptions options = _lastChoosenGraphLayerPasteOptions; System.Enum options1 = options; if (Current.Gui.ShowDialogForEnumFlag(ref options1, "Choose paste options")) { options = (GraphCopyOptions)options1; _lastChoosenGraphLayerPasteOptions = options; PasteFromClipboardAsTemplateForLayer(doc, layerNumber, options); } }
/// <summary> /// Try to paste the entire GraphDocument from the clipboard. /// </summary> /// <param name="doc">The graph document to paste into.</param> /// <param name="showOptionsDialog">If <c>true</c>, shows the user an option dialog for choise of specific items to paste.</param> public static void PasteFromClipboardAsGraphStyle(this GraphDocument doc, bool showOptionsDialog) { object from = ClipboardSerialization.GetObjectFromClipboard("Altaxo.Graph.Graph3D.GraphDocumentAsXml"); if (from is GraphDocument) { GraphCopyOptions options = DefaultGraphDocumentPasteOptions; if (showOptionsDialog) { System.Enum o = _lastChoosenGraphDocumentPasteOptions; if (!Current.Gui.ShowDialogForEnumFlag(ref o, "Choose options for pasting")) { return; } _lastChoosenGraphDocumentPasteOptions = (GraphCopyOptions)o; options = _lastChoosenGraphDocumentPasteOptions; } PasteFromClipboard(doc, options); } }
public static void PasteFromClipboardAsTemplateForLayer(GraphDocument doc, IEnumerable <int> layerNumber, GraphCopyOptions options) { object o = ClipboardSerialization.GetObjectFromClipboard("Altaxo.Graph.Graph3D.GraphLayerAsXml"); if (null == o) { return; } var layer = o as XYZPlotLayer; if (null != layer) { doc.RootLayer.ElementAt(layerNumber).CopyFrom(layer, options); } }
public static void PasteFromClipboardAsTemplateForLayer(this GraphDocument doc, IEnumerable<int> layerNumber) { /* object options = new PasteLayerOptions() { PastePlotStyles = true, PastePlotItems = true }; if (false == Current.Gui.ShowDialog(ref options, "Choose what to paste")) return; PasteFromClipboardAsTemplateForLayer(doc, layerNumber, (options as PasteLayerOptions).GetCopyOptions()); * */ GraphCopyOptions options = _lastChoosenGraphLayerPasteOptions; System.Enum options1 = options; if (Current.Gui.ShowDialogForEnumFlag(ref options1, "Choose paste options")) { options = (GraphCopyOptions)options1; _lastChoosenGraphLayerPasteOptions = options; PasteFromClipboardAsTemplateForLayer(doc, layerNumber, options); } }
public static void PasteFromClipboardAsTemplateForLayer(GraphDocument doc, IEnumerable<int> layerNumber, GraphCopyOptions options) { object o = ClipboardSerialization.GetObjectFromClipboard("Altaxo.Graph.Graph3D.GraphLayerAsXml"); if (null == o) return; XYZPlotLayer layer = o as XYZPlotLayer; if (null != layer) { doc.RootLayer.ElementAt(layerNumber).CopyFrom(layer, options); } }
/// <summary> /// Try to paste the entire GraphDocument from the clipboard. /// </summary> /// <param name="doc">The graph document to paste into.</param> /// <param name="showOptionsDialog">If <c>true</c>, shows the user an option dialog for choise of specific items to paste.</param> public static void PasteFromClipboardAsGraphStyle(this GraphDocument doc, bool showOptionsDialog) { object from = ClipboardSerialization.GetObjectFromClipboard("Altaxo.Graph.Graph3D.GraphDocumentAsXml"); if (from is GraphDocument) { GraphCopyOptions options = DefaultGraphDocumentPasteOptions; if (showOptionsDialog) { System.Enum o = _lastChoosenGraphDocumentPasteOptions; if (!Current.Gui.ShowDialogForEnumFlag(ref o, "Choose options for pasting")) return; _lastChoosenGraphDocumentPasteOptions = (GraphCopyOptions)o; options = _lastChoosenGraphDocumentPasteOptions; } PasteFromClipboard(doc, options); } }