public GraphDocumentDataObject(GraphDocumentBase graphDocument, ProjectFileComObject fileComObject, ComManager comManager) : base(comManager) { ComDebug.ReportInfo("{0} constructor.", GetType().Name); _dataAdviseHolder = new ManagedDataAdviseHolder(); _graphDocumentName = graphDocument.Name; _graphDocumentSize = graphDocument.Size; _graphExportOptions = graphDocument.GetPropertyValue(ClipboardRenderingOptions.PropertyKeyClipboardRenderingOptions, () => new ClipboardRenderingOptions()).Clone(); var embeddedRenderingOptions = graphDocument.GetPropertyValue(EmbeddedObjectRenderingOptions.PropertyKeyEmbeddedObjectRenderingOptions, () => null); if (null != embeddedRenderingOptions) { _graphExportOptions.CopyFrom(embeddedRenderingOptions); // merge embedded rendering options } if ((_graphExportOptions.RenderEnhancedMetafile && _graphExportOptions.RenderEnhancedMetafileAsVectorFormat) || (_graphExportOptions.RenderDropFile && _graphExportOptions.DropFileImageFormat == System.Drawing.Imaging.ImageFormat.Emf) ) { if (graphDocument is Altaxo.Graph.Gdi.GraphDocument) { _graphDocumentMetafileImage = GraphDocumentExportActions.RenderAsEnhancedMetafileVectorFormat((Altaxo.Graph.Gdi.GraphDocument)graphDocument, _graphExportOptions); } } if (null == _graphDocumentMetafileImage || _graphExportOptions.RenderBitmap || _graphExportOptions.RenderWindowsMetafile || (_graphExportOptions.RenderEnhancedMetafile && !_graphExportOptions.RenderEnhancedMetafileAsVectorFormat) || _graphExportOptions.RenderDropFile) { if (graphDocument is Altaxo.Graph.Gdi.GraphDocument) { _graphDocumentBitmapImage = GraphDocumentExportActions.RenderAsBitmap((Altaxo.Graph.Gdi.GraphDocument)graphDocument, _graphExportOptions.BackgroundBrush, System.Drawing.Imaging.PixelFormat.Format32bppArgb, _graphExportOptions.SourceDpiResolution, _graphExportOptions.SourceDpiResolution / _graphExportOptions.OutputScalingFactor); } else if (graphDocument is Altaxo.Graph.Graph3D.GraphDocument) { _graphDocumentBitmapImage = Altaxo.Graph.Graph3D.GraphDocumentExportActions.RenderAsBitmap((Altaxo.Graph.Graph3D.GraphDocument)graphDocument, _graphExportOptions.BackgroundBrush, System.Drawing.Imaging.PixelFormat.Format32bppArgb, _graphExportOptions.SourceDpiResolution, _graphExportOptions.SourceDpiResolution / _graphExportOptions.OutputScalingFactor); } else { throw new NotImplementedException(); } } if (_graphExportOptions.RenderEmbeddedObject) { var miniProjectBuilder = new Altaxo.Graph.Procedures.MiniProjectBuilder(); _altaxoMiniProject = miniProjectBuilder.GetMiniProject(graphDocument, true); } else { _altaxoMiniProject = null; } }
public GraphDocumentLinkedComObject(GraphDocument graphDocument, ProjectFileComObject fileComObject, ComManager comManager) : base(comManager) { ComDebug.ReportInfo("{0} constructor.", GetType().Name); _dataAdviseHolder = new ManagedDataAdviseHolder(); _oleAdviseHolder = new ManagedOleAdviseHolderFM(); Document = graphDocument; if (null != fileComObject) { fileComObject.FileMonikerChanged += EhFileMonikerChanged; EhFileMonikerChanged(fileComObject.FileMoniker); } }
public GraphDocumentLinkedComObject(GraphDocument graphDocument, ProjectFileComObject fileComObject, ComManager comManager) : base(comManager) { ComDebug.ReportInfo("{0} constructor.", this.GetType().Name); _dataAdviseHolder = new ManagedDataAdviseHolder(); _oleAdviseHolder = new ManagedOleAdviseHolderFM(); Document = graphDocument; if (null != fileComObject) { fileComObject.FileMonikerChanged += EhFileMonikerChanged; EhFileMonikerChanged(fileComObject.FileMoniker); } }
private void InternalStopLocalServer() { ComDebug.ReportInfo("Stop local server"); if (null != _embeddedComObject) { _embeddedComObject.Dispose(); _embeddedComObject = null; } foreach (var co in _linkedDocumentsComObjects.Values) { co.Dispose(); } _linkedDocumentsComObjects.Clear(); if (null != _fileComObject) { _fileComObject.Dispose(); _fileComObject = null; } if (null != _classFactoryOfDocumentComObject) { _classFactoryOfDocumentComObject.RevokeClassObject(); ComDebug.ReportInfo("{0}.StopLocalServer:{1} Revoked.", GetType().Name, _classFactoryOfDocumentComObject.GetType().Name); _classFactoryOfDocumentComObject = null; } if (null != _classFactoryOfFileComObject) { _classFactoryOfFileComObject.RevokeClassObject(); ComDebug.ReportInfo("{0}.StopLocalServer:{1} Revoked.", GetType().Name, _classFactoryOfFileComObject.GetType().Name); _classFactoryOfFileComObject = null; } if (null != _garbageCollector) { // Now stop the Garbage Collector thread. _garbageCollector.StopThread(); _garbageCollector.WaitForThreadToStop(); _garbageCollector = null; ComDebug.ReportInfo("StopLocalServer: GarbageCollector thread stopped."); } IsActive = false; }
public GraphDocumentDataObject(GraphDocumentBase graphDocument, ProjectFileComObject fileComObject, ComManager comManager) : base(comManager) { ComDebug.ReportInfo("{0} constructor.", this.GetType().Name); _dataAdviseHolder = new ManagedDataAdviseHolder(); _graphDocumentName = graphDocument.Name; _graphDocumentSize = graphDocument.Size; _graphExportOptions = graphDocument.GetPropertyValue(ClipboardRenderingOptions.PropertyKeyClipboardRenderingOptions, () => new ClipboardRenderingOptions()).Clone(); var embeddedRenderingOptions = graphDocument.GetPropertyValue(EmbeddedObjectRenderingOptions.PropertyKeyEmbeddedObjectRenderingOptions, () => null); if (null != embeddedRenderingOptions) _graphExportOptions.CopyFrom(embeddedRenderingOptions); // merge embedded rendering options if ((_graphExportOptions.RenderEnhancedMetafile && _graphExportOptions.RenderEnhancedMetafileAsVectorFormat) || (_graphExportOptions.RenderDropFile && _graphExportOptions.DropFileImageFormat == System.Drawing.Imaging.ImageFormat.Emf) ) { if (graphDocument is Altaxo.Graph.Gdi.GraphDocument) _graphDocumentMetafileImage = GraphDocumentExportActions.RenderAsEnhancedMetafileVectorFormat((Altaxo.Graph.Gdi.GraphDocument)graphDocument, _graphExportOptions); } if (null == _graphDocumentMetafileImage || _graphExportOptions.RenderBitmap || _graphExportOptions.RenderWindowsMetafile || (_graphExportOptions.RenderEnhancedMetafile && !_graphExportOptions.RenderEnhancedMetafileAsVectorFormat) || _graphExportOptions.RenderDropFile) { if (graphDocument is Altaxo.Graph.Gdi.GraphDocument) _graphDocumentBitmapImage = GraphDocumentExportActions.RenderAsBitmap((Altaxo.Graph.Gdi.GraphDocument)graphDocument, _graphExportOptions.BackgroundBrush, System.Drawing.Imaging.PixelFormat.Format32bppArgb, _graphExportOptions.SourceDpiResolution, _graphExportOptions.SourceDpiResolution / _graphExportOptions.OutputScalingFactor); else if (graphDocument is Altaxo.Graph.Graph3D.GraphDocument) _graphDocumentBitmapImage = Altaxo.Graph.Graph3D.GraphDocumentExportActions.RenderAsBitmap((Altaxo.Graph.Graph3D.GraphDocument)graphDocument, _graphExportOptions.BackgroundBrush, System.Drawing.Imaging.PixelFormat.Format32bppArgb, _graphExportOptions.SourceDpiResolution, _graphExportOptions.SourceDpiResolution / _graphExportOptions.OutputScalingFactor); else throw new NotImplementedException(); } if (_graphExportOptions.RenderEmbeddedObject) { var miniProjectBuilder = new Altaxo.Graph.Procedures.MiniProjectBuilder(); _altaxoMiniProject = miniProjectBuilder.GetMiniProject(graphDocument, true); } else { _altaxoMiniProject = null; } }
public ComManager(AltaxoComApplicationAdapter appAdapter) { ApplicationAdapter = appAdapter; _guiThreadStack = new GuiThreadStack(appAdapter.IsInvokeRequiredForGuiThread, appAdapter.InvokeGuiThread); _fileComObject = new ProjectFileComObject(this); }
private void InternalStopLocalServer() { ComDebug.ReportInfo("Stop local server"); if (null != _embeddedComObject) { _embeddedComObject.Dispose(); _embeddedComObject = null; } foreach (var co in _linkedDocumentsComObjects.Values) { co.Dispose(); } _linkedDocumentsComObjects.Clear(); if (null != _fileComObject) { _fileComObject.Dispose(); _fileComObject = null; } if (null != _classFactoryOfDocumentComObject) { _classFactoryOfDocumentComObject.RevokeClassObject(); ComDebug.ReportInfo("{0}.StopLocalServer:{1} Revoked.", this.GetType().Name, _classFactoryOfDocumentComObject.GetType().Name); _classFactoryOfDocumentComObject = null; } if (null != _classFactoryOfFileComObject) { _classFactoryOfFileComObject.RevokeClassObject(); ComDebug.ReportInfo("{0}.StopLocalServer:{1} Revoked.", this.GetType().Name, _classFactoryOfFileComObject.GetType().Name); _classFactoryOfFileComObject = null; } if (null != _garbageCollector) { // Now stop the Garbage Collector thread. _garbageCollector.StopThread(); _garbageCollector.WaitForThreadToStop(); _garbageCollector = null; ComDebug.ReportInfo("StopLocalServer: GarbageCollector thread stopped."); } IsActive = false; }