Exemple #1
0
        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 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;
			}
		}