Ejemplo n.º 1
0
        private void EhXmlDeserializationFinished_UseLinkedScaleAndLayerIndex(Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object documentRoot, bool isFinallyCall)
        {
            if (null != _linkedScaleIndex && null != _linkedLayerIndex)
            {
                int linkedScaleIndex = _linkedScaleIndex.Value;
                int linkedLayerIndex = _linkedLayerIndex.Value;

                // Retrieve the document
                Scale scale = null;
                var   layer = AbsoluteDocumentPath.GetRootNodeImplementing <Altaxo.Graph.Gdi.HostLayer>(this);
                if (null != layer)
                {
                    var parentLayer = layer.ParentLayer;
                    if (null != parentLayer)
                    {
                        var sibling = parentLayer.Layers[linkedLayerIndex] as Altaxo.Graph.Gdi.XYPlotLayer;
                        if (null != sibling)
                        {
                            scale = sibling.Scales[linkedScaleIndex];
                        }
                    }
                }

                if (null != scale)
                {
                    ScaleLinkedTo = scale;
                }
            }

            if (ScaleLinkedTo != null || isFinallyCall)
            {
                info.DeserializationFinished -= EhXmlDeserializationFinished_UseLinkedScaleAndLayerIndex;
            }
        }
Ejemplo n.º 2
0
            private void EhXmlDeserializationFinished(Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object documentRoot, bool isFinallyCall)
            {
                // Retrieve the document
                Scale scale = null;
                var   layer = AbsoluteDocumentPath.GetRootNodeImplementing <Altaxo.Graph.Gdi.HostLayer>(_instance);

                if (null != layer)
                {
                    var parentLayer = layer.ParentLayer;
                    if (null != parentLayer)
                    {
                        var sibling = parentLayer.Layers[_linkedLayerIndex] as Altaxo.Graph.Gdi.XYPlotLayer;
                        if (null != sibling)
                        {
                            scale = sibling.Scales[_linkedScaleIndex];
                        }
                    }
                }

                if (null != scale || isFinallyCall)
                {
                    _instance.ScaleLinkedTo       = scale;
                    info.DeserializationFinished -= EhXmlDeserializationFinished;
                }
            }
Ejemplo n.º 3
0
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                var s = (GraphViewOptions)obj;

                info.AddValue("Graph", AbsoluteDocumentPath.GetAbsolutePath(s._graphDocument));
                info.AddNullableEnum("RootLayerMarkersVisibility", s._rootLayerMarkersVisibility);
            }
Ejemplo n.º 4
0
        protected override void Initialize(bool initData)
        {
            base.Initialize(initData);

            if (initData)
            {
                _outputQuantities = new SelectableListNodeList();
                _creationOptions  = new SelectableListNodeList();
            }

            if (_view != null)
            {
                var yColName = AbsoluteDocumentPath.GetPathString(_doc.ColumnToTransform, int.MaxValue);
                _view.SetColumnToTransform(yColName);

                string xInc = _doc.XIncrementValue.ToString();
                if (_doc.XIncrementMessage != null)
                {
                    xInc += string.Format(" ({0})", _doc.XIncrementMessage);
                }
                _view.SetXIncrement(xInc, _doc.XIncrementMessage != null);

                _outputQuantities.FillWithFlagEnumeration(_doc.Output);
                _view.SetOutputQuantities(_outputQuantities);

                _creationOptions.FillWithEnumeration(_doc.OutputPlacement);
                _view.SetCreationOptions(_creationOptions);
            }
        }
Ejemplo n.º 5
0
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                var s = (GraphViewLayout)obj;

                info.AddValue("AutoZoom", s._isAutoZoomActive);
                info.AddValue("Zoom", s._zoomFactor);
                info.AddValue("Graph", AbsoluteDocumentPath.GetAbsolutePath(s._graphDocument));
            }
Ejemplo n.º 6
0
            private void EhDeserializationFinished(Altaxo.Serialization.Xml.IXmlDeserializationInfo info, Main.IDocumentNode documentRoot, bool isFinallyCall)
            {
                object o = AbsoluteDocumentPath.GetObject(_pathToDocument, documentRoot);

                if (o is TextDocument textDoc)
                {
                    _deserializedInstance.Document = textDoc;
                    info.DeserializationFinished  -= new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(EhDeserializationFinished);
                }
            }
Ejemplo n.º 7
0
            private void EhDeserializationFinished(Altaxo.Serialization.Xml.IXmlDeserializationInfo info, Main.IDocumentNode documentRoot, bool isFinallyCall)
            {
                var o = AbsoluteDocumentPath.GetObject(_PathToGraph, documentRoot);

                if (o is GraphDocument)
                {
                    _GraphController._graphDocument = (GraphDocument)o;
                    info.DeserializationFinished   -= new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(EhDeserializationFinished);
                }
            }
 /// <summary>Collects a underlying data table from a proxy.</summary>
 /// <param name="proxy">The proxy.</param>
 /// <param name="owner">The owner of the proxy.</param>
 /// <param name="propertyName">Name of the property in the owner class that will return the proxy.</param>
 private void CollectDataTableFromProxyVisit(IProxy proxy, object owner, string propertyName)
 {
     if (proxy.IsEmpty)
     {
     }
     else if (proxy.DocumentObject is Altaxo.Data.DataColumn)
     {
         var table = Altaxo.Data.DataTable.GetParentDataTableOf((DataColumn)proxy.DocumentObject);
         if (table != null)
         {
             var tablePath = AbsoluteDocumentPath.GetAbsolutePath(table);
             if (!_tablesToChange.ContainsKey(tablePath))
             {
                 _tablesToChange.Add(tablePath, null);
             }
         }
     }
     else if (proxy.DocumentObject is Altaxo.Data.DataColumnCollection)
     {
         var table = Altaxo.Data.DataTable.GetParentDataTableOf((DataColumnCollection)proxy.DocumentObject);
         if (table != null)
         {
             var tablePath = AbsoluteDocumentPath.GetAbsolutePath(table);
             if (!_tablesToChange.ContainsKey(tablePath))
             {
                 _tablesToChange.Add(tablePath, null);
             }
         }
     }
     else if (proxy.DocumentObject is DataTable)
     {
         var table = proxy.DocumentObject as DataTable;
         if (table != null)
         {
             var tablePath = AbsoluteDocumentPath.GetAbsolutePath(table);
             if (!_tablesToChange.ContainsKey(tablePath))
             {
                 _tablesToChange.Add(tablePath, null);
             }
         }
     }
     else if ((proxy is Altaxo.Data.INumericColumnProxy) || (proxy is Altaxo.Data.IReadableColumnProxy))
     {
         var path = proxy.DocumentPath;
         if (path.Count >= 2 && path.StartsWith(AbsoluteDocumentPath.GetPath(Current.Project.DataTableCollection, int.MaxValue)))
         {
             var tablePath = path.SubPath(0, 2);
             if (!_tablesToChange.ContainsKey(tablePath))
             {
                 _tablesToChange.Add(tablePath, null);
             }
         }
     }
 }
Ejemplo n.º 9
0
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                var s = (GraphViewLayout)obj;

                info.AddValue("Graph", AbsoluteDocumentPath.GetAbsolutePath(s._graphDocument));
                info.AddValue("AutoZoom", s._isAutoZoomActive);
                if (false == s._isAutoZoomActive)
                {
                    info.AddValue("Zoom", s._zoomFactor);
                    info.AddValue("ViewportOffset", s._positionOfViewportsUpperLeftCornerInRootLayerCoordinates);
                }
            }
Ejemplo n.º 10
0
        public void InitializeDropLineChoices()
        {
            var layer = AbsoluteDocumentPath.GetRootNodeImplementing(_doc, typeof(XYZPlotLayer)) as XYZPlotLayer;

            _dropLineChoices = new SelectableListNodeList();
            foreach (CSPlaneID id in layer.CoordinateSystem.GetJoinedPlaneIdentifier(layer.AxisStyles.AxisStyleIDs, _doc.DropTargets))
            {
                bool sel = _doc.DropTargets.Contains(id);
                CSPlaneInformation info = layer.CoordinateSystem.GetPlaneInformation(id);
                _dropLineChoices.Add(new SelectableListNode(info.Name, id, sel));
            }
        }
Ejemplo n.º 11
0
        public void InitializeAttachmentDirectionChoices()
        {
            var layer = AbsoluteDocumentPath.GetRootNodeImplementing(_doc, typeof(IPlotArea)) as IPlotArea;

            _attachmentDirectionChoices = new SelectableListNodeList();

            if (layer != null)
            {
                foreach (CSPlaneInformation info in layer.CoordinateSystem.PlaneStyles)
                {
                    _attachmentDirectionChoices.Add(new SelectableListNode(info.Name, info.Identifier, info.Identifier == _doc.AttachedPlane));
                }
            }
        }
Ejemplo n.º 12
0
            private void EhDeserializationFinished(Altaxo.Serialization.Xml.IXmlDeserializationInfo info, IDocumentNode documentRoot, bool isFinallyCall)
            {
                var o = AbsoluteDocumentPath.GetObject(_pathToGraphDocument, documentRoot);

                if (o is GraphDocument)
                {
                    _deserializedObject._graphDocument = (GraphDocument)o;
                }

                if (null != _deserializedObject._graphDocument || isFinallyCall)
                {
                    info.DeserializationFinished -= new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(EhDeserializationFinished);
                }
            }
Ejemplo n.º 13
0
        public void InitializeFillDirectionChoices()
        {
            _areaFillDirectionChoices = new SelectableListNodeList();
            var layer = AbsoluteDocumentPath.GetRootNodeImplementing(_doc, typeof(IPlotArea)) as IPlotArea;

            if (layer != null)
            {
                foreach (CSPlaneID id in layer.CoordinateSystem.GetJoinedPlaneIdentifier(layer.AxisStyleIDs, new CSPlaneID[] { _doc.FillDirection }))
                {
                    CSPlaneInformation info = layer.CoordinateSystem.GetPlaneInformation(id);
                    _areaFillDirectionChoices.Add(new SelectableListNode(info.Name, id, id == _doc.FillDirection));
                }
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// This distributes changes made to one of the sub plot styles to all other plot styles. Additionally, the controller
        /// for this styles are also updated.
        /// </summary>
        /// <param name="pivotelement"></param>
        private void DistributeStyleChange(int pivotelement)
        {
            IPlotArea layer = AbsoluteDocumentPath.GetRootNodeImplementing <IPlotArea>(_doc);

            _doc.Style.DistributeSubStyleChange(pivotelement, layer, _doc.GetRangesAndPoints(layer));

            // now all style controllers must be updated
            for (int i = 0; i < _styleControllerList.Count; i++)
            {
                if (null != _styleControllerList[i])
                {
                    _styleControllerList[i].InitializeDocument(_doc.Style[i], (_doc.DataObject as Altaxo.Graph.Plot.Data.XYZColumnPlotData)?.DataTable, (_doc.DataObject as Altaxo.Graph.Plot.Data.XYZColumnPlotData)?.GroupNumber ?? 0);
                }
            }
        }
Ejemplo n.º 15
0
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                var s = (TextDocumentViewOptions)obj;

                info.AddValue("Document", AbsoluteDocumentPath.GetAbsolutePath(s.Document));
                info.AddEnum("WindowConfiguration", s.WindowConfiguration);
                info.AddValue("IsViewerSelected", s.IsViewerSelected);
                info.AddValue("FractionSourceEditor", s._fractionOfSourceEditorWindowVisible);
                info.AddValue("IsWordWrappingEnabled", s.IsWordWrappingEnabled);
                info.AddValue("IsLineNumberingEnabled", s.IsLineNumberingEnabled);
                info.AddValue("IsSpellCheckingEnabled", s.IsSpellCheckingEnabled);
                info.AddValue("IsFoldingEnabled", s.IsFoldingEnabled);
                info.AddValue("HighlightingStyle", s.HighlightingStyle);
                info.AddValue("IsOutlineWindowVisible", s.IsOutlineWindowVisible);
                info.AddValue("OutlineWindowRelativeWidth", s.OutlineWindowRelativeWidth);
            }
Ejemplo n.º 16
0
            private void EhDeserializationFinished(Altaxo.Serialization.Xml.IXmlDeserializationInfo info, Main.IDocumentNode documentRoot, bool isFinallyCall)
            {
                if (null != _PathToLayout)
                {
                    var o = AbsoluteDocumentPath.GetObject(_PathToLayout, documentRoot);
                    if (o is Altaxo.Worksheet.WorksheetLayout)
                    {
                        _TableController._worksheetLayout = (Altaxo.Worksheet.WorksheetLayout)o;
                        _PathToLayout = null;
                    }
                }

                if (null == _PathToLayout)
                {
                    info.DeserializationFinished -= new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(EhDeserializationFinished);
                }
            }
Ejemplo n.º 17
0
        private static void ColumnHeaderStyle_Paint(Altaxo.Worksheet.ColumnHeaderStyle thiss, object drawingContext, RectangleD2D cellRect, int nRow, Altaxo.Data.DataColumn data, bool bSelected)
        {
            var  dc            = (DrawingContext)drawingContext;
            Rect cellRectangle = cellRect.ToWpf();

            thiss.PaintBackground(dc, cellRect, bSelected);

            var    dataColCol    = (Altaxo.Data.DataColumnCollection)AbsoluteDocumentPath.GetRootNodeImplementing(data, typeof(Altaxo.Data.DataColumnCollection));
            string columnnumber  = dataColCol.GetColumnNumber(data).ToString();
            string kindandgroup  = string.Format("({0}{1})", dataColCol.GetColumnKind(data).ToString(), dataColCol.GetColumnGroup(data));
            var    font          = WpfFontManager.ToWpf(thiss.TextFont);
            var    fontSize      = (thiss.TextFont.Size * 96) / 72;
            var    fontheight    = font.FontFamily.LineSpacing * fontSize;
            var    nameRectangle = cellRectangle;

            nameRectangle.Height = Math.Max(fontheight, cellRectangle.Height - fontheight);
            var numRectangle = cellRectangle;

            numRectangle.Height = fontheight;
            numRectangle.Y      = Math.Max(cellRectangle.Y + cellRectangle.Height - fontheight, cellRectangle.Y);

            var txtBrush = bSelected ? thiss.DefaultSelectedTextBrush.ToWpf() : thiss.TextBrush.ToWpf();

            FormattedText t;

            t = new FormattedText(columnnumber, System.Globalization.CultureInfo.InvariantCulture, FlowDirection.LeftToRight, font, fontSize, txtBrush)
            {
                MaxTextWidth  = numRectangle.Width,
                TextAlignment = TextAlignment.Left
            };
            dc.DrawText(t, numRectangle.Location);

            t = new FormattedText(kindandgroup, System.Globalization.CultureInfo.InvariantCulture, FlowDirection.LeftToRight, font, fontSize, txtBrush)
            {
                MaxTextWidth  = numRectangle.Width,
                TextAlignment = TextAlignment.Right
            };
            dc.DrawText(t, numRectangle.Location);

            t = new FormattedText(data.Name, System.Globalization.CultureInfo.InvariantCulture, FlowDirection.LeftToRight, font, fontSize, txtBrush)
            {
                MaxTextWidth  = nameRectangle.Width,
                TextAlignment = TextAlignment.Center
            };
            dc.DrawText(t, nameRectangle.Location);
        }
Ejemplo n.º 18
0
 /// <summary>Collects a underlying data table from a proxy.</summary>
 /// <param name="proxy">The proxy.</param>
 /// <param name="owner">The owner of the proxy.</param>
 /// <param name="propertyName">Name of the property in the owner class that will return the proxy.</param>
 private void CollectDataColumnsFromProxyVisit(IProxy proxy, object owner, string propertyName)
 {
     if (null == proxy || proxy.IsEmpty)
     {
     }
     else if (proxy.DocumentObject is Altaxo.Data.DataColumn)
     {
         var dataColumn = (DataColumn)proxy.DocumentObject;
         if (!_columnsToChange.ContainsKey(dataColumn))
         {
             var table = Altaxo.Data.DataTable.GetParentDataTableOf(dataColumn);
             _columnsToChange.Add(dataColumn, table);
         }
     }
     else if (proxy.DocumentObject is Altaxo.Data.DataColumnCollection)
     {
         var table = Altaxo.Data.DataTable.GetParentDataTableOf((DataColumnCollection)proxy.DocumentObject);
         if (table != null)
         {
             var tablePath = AbsoluteDocumentPath.GetAbsolutePath(table);
             if (!_tablesToChange.ContainsKey(tablePath))
             {
                 _tablesToChange.Add(tablePath, null);
             }
         }
     }
     else if (proxy.DocumentObject is DataTable)
     {
         var table = proxy.DocumentObject as DataTable;
         if (table != null)
         {
             var tablePath = AbsoluteDocumentPath.GetAbsolutePath(table);
             if (!_tablesToChange.ContainsKey(tablePath))
             {
                 _tablesToChange.Add(tablePath, null);
             }
         }
     }
     else if ((proxy is Altaxo.Data.INumericColumnProxy) || (proxy is Altaxo.Data.IReadableColumnProxy))
     {
         // seems to be an indexer column or something alike. No need to do something
     }
 }
Ejemplo n.º 19
0
        public static string GetName(int level, IReadableColumn Document, AbsoluteDocumentPath InternalDocumentPath)
        {
            IReadableColumn col = Document; // this may have the side effect that the object is tried to resolve, is this o.k.?

            if (col is Data.DataColumn)
            {
                var    table          = Altaxo.Data.DataTable.GetParentDataTableOf((DataColumn)col);
                string tablename      = table == null ? string.Empty : table.Name + "\\";
                string collectionname = table == null ? string.Empty : (table.PropertyColumns.ContainsColumn((DataColumn)col) ? "PropCols\\" : "DataCols\\");
                if (level <= 0)
                {
                    return(((DataColumn)col).Name);
                }
                else if (level == 1)
                {
                    return(tablename + ((DataColumn)col).Name);
                }
                else
                {
                    return(tablename + collectionname + ((DataColumn)col).Name);
                }
            }
            else
            {
                string path = InternalDocumentPath.ToString();
                int    idx  = 0;
                if (level <= 0)
                {
                    idx = path.LastIndexOf('/');
                    if (idx < 0)
                    {
                        idx = 0;
                    }
                    else
                    {
                        idx++;
                    }
                }

                return(path.Substring(idx));
            }
        }
        /// <summary>Exchanges the tables during a proxy visit.</summary>
        /// <param name="proxy">The proxy which contain a reference to another project item.</param>
        /// <param name="owner">The owner instance of the proxy.</param>
        /// <param name="propertyName">Name of the property in the owner instance that returns the proxy.</param>
        private void ExchangeTablesProxyVisit(IProxy proxy, object owner, string propertyName)
        {
            Altaxo.Data.DataTable substituteTable;

            if (proxy.IsEmpty)
            {
            }
            else if (proxy.DocumentObject is Altaxo.Data.DataColumn)
            {
                var table = Altaxo.Data.DataTable.GetParentDataTableOf((DataColumn)proxy.DocumentObject);
                if (table != null)
                {
                    var tablePath = AbsoluteDocumentPath.GetAbsolutePath(table);
                    if (_tablesToChange.TryGetValue(tablePath, out substituteTable) && null != substituteTable)
                    {
                        proxy.ReplacePathParts(tablePath, AbsoluteDocumentPath.GetAbsolutePath(substituteTable), (IDocumentLeafNode)owner);
                    }
                }
            }
            else if (proxy.DocumentObject is Altaxo.Data.DataColumnCollection)
            {
                throw new NotImplementedException();
            }
            else if (proxy.DocumentObject is DataTable)
            {
                throw new NotImplementedException();
            }
            else if ((proxy is Altaxo.Data.INumericColumnProxy) || (proxy is Altaxo.Data.IReadableColumnProxy))
            {
                var path = proxy.DocumentPath;
                var tableCollectionPath = AbsoluteDocumentPath.GetAbsolutePath(Current.Project.DataTableCollection);
                if (path.Count >= 2 && path[0] == tableCollectionPath[0])
                {
                    var tablePath = path.SubPath(0, 2);
                    if (_tablesToChange.TryGetValue(tablePath, out substituteTable) && null != substituteTable)
                    {
                        proxy.ReplacePathParts(tablePath, AbsoluteDocumentPath.GetAbsolutePath(substituteTable), (IDocumentLeafNode)owner);
                    }
                }
            }
        }
        private void Initialize(bool initData)
        {
            if (initData)
            {
                _viewList = new List <SelectableListNodeList>();

                foreach (var srcGroup in _doc)
                {
                    var destGroup = new SelectableListNodeList();
                    _viewList.Add(destGroup);
                    foreach (var srcEle in srcGroup)
                    {
                        var destEle = new SelectableListNode(AbsoluteDocumentPath.GetAbsolutePath(srcEle).ToString(), srcEle, false);
                        destGroup.Add(destEle);
                    }
                }
            }
            if (null != _view)
            {
                _view.InitializeListData(_viewList);
            }
        }
Ejemplo n.º 22
0
        protected override void Initialize(bool initData)
        {
            base.Initialize(initData);

            if (initData)
            {
                _parentLayerOfOriginalDoc = AbsoluteDocumentPath.GetRootNodeImplementing <XYPlotLayer>(_doc);

                _locationController = (IMVCANController)Current.Gui.GetController(new object[] { _doc.Location }, typeof(IMVCANController), UseDocument.Directly);
                Current.Gui.FindAndAttachControlTo(_locationController);
            }

            if (_view != null)
            {
                _view.BeginUpdate();

                _view.SelectedBackground = _doc.Background;

                _view.EditText = _doc.Text;

                // fill the font name combobox with all fonts
                _view.SelectedFont = _doc.Font;

                _view.SelectedLineSpacing = _doc.LineSpacing;

                // fill the font size combobox with reasonable values
                //this.m_cbFontSize.Items.AddRange(new string[] { "8", "9", "10", "11", "12", "14", "16", "18", "20", "22", "24", "26", "28", "36", "48", "72" });
                //this.m_cbFontSize.Text = m_TextObject.Font.Size.ToString();

                // fill the color dialog box
                _view.SelectedFontBrush = _doc.TextFillBrush;

                _view.LocationView = _locationController.ViewObject;

                _view.EndUpdate();
            }
        }
Ejemplo n.º 23
0
        public virtual void EhView_AddStyle()
        {
            var sel = _singleStylesAvailable.FirstSelectedNode;

            if (null == sel)
            {
                return;
            }

            var           propertyContext = Altaxo.PropertyExtensions.GetPropertyContext(_doc);
            IG3DPlotStyle style           = null;

            try
            {
                style = (IG3DPlotStyle)Activator.CreateInstance((Type)sel.Tag, propertyContext); // first try with a constructor which uses a property context
            }
            catch (System.MissingMethodException)
            {
            }

            if (null == style)                                                  // if style was not constructed
            {
                style = (IG3DPlotStyle)Activator.CreateInstance((Type)sel.Tag); // try with parameterless constructor
            }
            var layer    = AbsoluteDocumentPath.GetRootNodeImplementing <IPlotArea>(_doc);
            var plotitem = AbsoluteDocumentPath.GetRootNodeImplementing <G3DPlotItem>(_doc);

            if (layer != null && plotitem != null)
            {
                _doc.PrepareNewSubStyle(style, layer, plotitem.GetRangesAndPoints(layer));
            }

            _currentItems.Add <IG3DPlotStyle>(new SelectableListNode(Current.Gui.GetUserFriendlyClassName(style.GetType()), style, true), (docNodeToAdd) => _doc.Add(docNodeToAdd));

            OnCollectionChangeCommit();
        }
Ejemplo n.º 24
0
 /// <summary>
 /// Gets the root path for a given project item type.
 /// </summary>
 /// <param name="type">The type of project item.</param>
 /// <returns>The root path of this type of item.</returns>
 public AbsoluteDocumentPath GetRootPathForProjectItemType(System.Type type)
 {
     return(AbsoluteDocumentPath.GetAbsolutePath(GetCollectionForProjectItemType(type)));
 }
Ejemplo n.º 25
0
			private void EhDeserializationFinished(Altaxo.Serialization.Xml.IXmlDeserializationInfo info, Main.IDocumentNode documentRoot, bool isFinallyCall)
			{
				if (null != _PathToLayout)
				{
					var o = AbsoluteDocumentPath.GetObject(_PathToLayout, documentRoot);
					if (o is Altaxo.Worksheet.WorksheetLayout)
					{
						_TableController._worksheetLayout = (Altaxo.Worksheet.WorksheetLayout)o;
						_PathToLayout = null;
					}
				}

				if (null == _PathToLayout)
				{
					info.DeserializationFinished -= new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(this.EhDeserializationFinished);
				}
			}
Ejemplo n.º 26
0
		public static string GetName(int level, IReadableColumn Document, AbsoluteDocumentPath InternalDocumentPath)
		{
			IReadableColumn col = Document; // this may have the side effect that the object is tried to resolve, is this o.k.?
			if (col is Data.DataColumn)
			{
				Altaxo.Data.DataTable table = Altaxo.Data.DataTable.GetParentDataTableOf((DataColumn)col);
				string tablename = table == null ? string.Empty : table.Name + "\\";
				string collectionname = table == null ? string.Empty : (table.PropertyColumns.ContainsColumn((DataColumn)col) ? "PropCols\\" : "DataCols\\");
				if (level <= 0)
					return ((DataColumn)col).Name;
				else if (level == 1)
					return tablename + ((DataColumn)col).Name;
				else
					return tablename + collectionname + ((DataColumn)col).Name;
			}
			else
			{
				string path = InternalDocumentPath.ToString();
				int idx = 0;
				if (level <= 0)
				{
					idx = path.LastIndexOf('/');
					if (idx < 0)
						idx = 0;
					else
						idx++;
				}

				return path.Substring(idx);
			}
		}
		public bool ReplacePathParts(AbsoluteDocumentPath partToReplace, AbsoluteDocumentPath newPart, IDocumentLeafNode rootNode)
		{
			return false;
		}
Ejemplo n.º 28
0
		public static RelativeDocumentPath FromOldDeprecated(AbsoluteDocumentPath absPath)
		{
			if (null == absPath)
				throw new ArgumentNullException(nameof(absPath));

			int numberOfLevelsDown = 0;
			var pathList = new List<string>();

			for (int i = 0; i < absPath.Count; ++i)
			{
				if (absPath[i] == "..")
				{
					numberOfLevelsDown++;
				}
				else
				{
					pathList.Add(absPath[i]);
				}
			}
			return new RelativeDocumentPath(numberOfLevelsDown, pathList);
		}
Ejemplo n.º 29
0
 public bool ReplacePathParts(AbsoluteDocumentPath partToReplace, AbsoluteDocumentPath newPart, IDocumentLeafNode rootNode)
 {
     return(false);
 }
Ejemplo n.º 30
0
		/// <summary>
		/// Replaces parts of the part of the document node by another part. If the replacement was successful, the original document node is cleared.
		/// See <see cref="M:DocumentPath.ReplacePathParts"/> for details of the part replacement.
		/// </summary>
		/// <param name="partToReplace">Part of the path that should be replaced. This part has to match the beginning of this part. The last item of the part
		/// is allowed to be given only partially.</param>
		/// <param name="newPart">The new part to replace that piece of the path, that match the <c>partToReplace</c>.</param>
		/// <param name="rootNode">Any document node in the hierarchy that is used to find the root node of the hierarchy.</param>
		/// <returns>True if the path could be replaced. Returns false if the path does not fulfill the presumptions given above.</returns>
		/// <remarks>
		/// As stated above, the last item of the partToReplace can be given only partially. As an example, the path (here separated by space)
		/// <para>Tables Preexperiment1/WDaten Time</para>
		/// <para>should be replaced by </para>
		/// <para>Tables Preexperiment2\WDaten Time</para>
		/// <para>To make this replacement, the partToReplace should be given by</para>
		/// <para>Tables Preexperiment1/</para>
		/// <para>and the newPart should be given by</para>
		/// <para>Tables Preexperiment2\</para>
		/// <para>Note that Preexperiment1\ and Preexperiment2\ are only partially defined items of the path.</para>
		/// </remarks>
		public bool ReplacePathParts(AbsoluteDocumentPath partToReplace, AbsoluteDocumentPath newPart, IDocumentLeafNode rootNode)
		{
			if (!(_docNodePath != null || IsDisposeInProgress)) throw new InvalidProgramException();
			if (null == rootNode)
				throw new ArgumentNullException(nameof(rootNode));

			AbsoluteDocumentPath newPath;
			var success = _docNodePath.ReplacePathParts(partToReplace, newPart, out newPath);
			if (success)
			{
				_docNodePath = newPath;
				ClearDocNode();
				ResolveDocumentObject(rootNode);
			}

			return success;
		}
Ejemplo n.º 31
0
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                var s = (WorksheetViewLayout)obj;

                info.AddValue("Layout", AbsoluteDocumentPath.GetAbsolutePath(s.WorksheetLayout));
            }
Ejemplo n.º 32
0
		/// <summary>
		/// Adds a replacement entry for a project item. The paths given should be complete paths of the project item (original path and new path).
		/// </summary>
		/// <param name="originalPath">The original path of the project item (DataTable, Graph, ProjectFolderPropertyBag).</param>
		/// <param name="newPath">The new path of the project item.</param>
		public void AddProjectItemReplacement(AbsoluteDocumentPath originalPath, AbsoluteDocumentPath newPath)
		{
			_itemRelocationDictionary.Add(originalPath, newPath);
		}