/// <summary>Creates an instance of this class from a single <see cref="Altaxo.Graph.Gdi.GraphDocument"/>.</summary>
		/// <param name="doc">The graph document.</param>
		/// <returns>An instance of this class. The graph document is analyzed and all underlying tables of the plot items of the graph document are collected.</returns>
		public static ExchangeTablesOfPlotItemsDocument CreateFromGraph(Altaxo.Graph.Gdi.GraphDocument doc)
		{
			var result = new ExchangeTablesOfPlotItemsDocument();
			doc.VisitDocumentReferences(result.CollectDataTableFromProxyVisit);
			result.CollectPlotItemsForGraph(doc);
			return result;
		}
        /// <summary>Creates an instance of this class from a single <see cref="Altaxo.Graph.Gdi.GraphDocument"/>.</summary>
        /// <param name="doc">The graph document.</param>
        /// <returns>An instance of this class. The graph document is analyzed and all underlying tables of the plot items of the graph document are collected.</returns>
        public static ExchangeTablesOfPlotItemsDocument CreateFromGraph(Altaxo.Graph.Gdi.GraphDocument doc)
        {
            var result = new ExchangeTablesOfPlotItemsDocument();

            doc.VisitDocumentReferences(result.CollectDataTableFromProxyVisit);
            result.CollectPlotItemsForGraph(doc);
            return(result);
        }
        /// <summary>Initialize the controller with the document. If successfull, the function has to return true.</summary>
        /// <param name="args">The arguments neccessary to create the controller. Normally, the first argument is the document, the second can be the parent of the document and so on.</param>
        /// <returns>Returns <see langword="true"/> if successfull; otherwise <see langword="false"/>.</returns>
        public bool InitializeDocument(params object[] args)
        {
            if (null == args || 0 == args.Length || !(args[0] is ExchangeTablesOfPlotItemsDocument))
            {
                return(false);
            }

            _doc = args[0] as ExchangeTablesOfPlotItemsDocument;
            Initialize(true);
            return(true);
        }
		/// <summary>Creates an instance of this class from multiple <see cref="Altaxo.Graph.Gdi.GraphDocument"/>s.</summary>
		/// <param name="docs">The graph documents.</param>
		/// <returns>An instance of this class. The graph documents are analyzed and all underlying tables of the plot items of all graph documents are collected.</returns>
		public static ExchangeTablesOfPlotItemsDocument CreateFromGraphs(IEnumerable<Altaxo.Graph.Gdi.GraphDocument> docs)
		{
			var result = new ExchangeTablesOfPlotItemsDocument();
			foreach (var doc in docs)
			{
				doc.VisitDocumentReferences(result.CollectDataTableFromProxyVisit);
				result.CollectPlotItemsForGraph(doc);
			}

			return result;
		}
        /// <summary>Creates an instance of this class from multiple <see cref="Altaxo.Graph.Gdi.GraphDocument"/>s.</summary>
        /// <param name="docs">The graph documents.</param>
        /// <returns>An instance of this class. The graph documents are analyzed and all underlying tables of the plot items of all graph documents are collected.</returns>
        public static ExchangeTablesOfPlotItemsDocument CreateFromGraphs(IEnumerable <Altaxo.Graph.Gdi.GraphDocument> docs)
        {
            var result = new ExchangeTablesOfPlotItemsDocument();

            foreach (var doc in docs)
            {
                doc.VisitDocumentReferences(result.CollectDataTableFromProxyVisit);
                result.CollectPlotItemsForGraph(doc);
            }

            return(result);
        }
		/// <summary>Initialize the controller with the document. If successfull, the function has to return true.</summary>
		/// <param name="args">The arguments neccessary to create the controller. Normally, the first argument is the document, the second can be the parent of the document and so on.</param>
		/// <returns>Returns <see langword="true"/> if successfull; otherwise <see langword="false"/>.</returns>
		public bool InitializeDocument(params object[] args)
		{
			if (null == args || 0 == args.Length || !(args[0] is ExchangeTablesOfPlotItemsDocument))
				return false;

			_doc = args[0] as ExchangeTablesOfPlotItemsDocument;
			Initialize(true);
			return true;
		}