protected override IEnumerable <Main.DocumentNodeAndName> GetDocumentNodeChildrenWithName() { if (null != _columnHeaderStyle) { yield return(new Main.DocumentNodeAndName(_columnHeaderStyle, () => _columnHeaderStyle = null, "ColumnHeaderStyle")); } if (null != _rowHeaderStyle) { yield return(new Main.DocumentNodeAndName(_rowHeaderStyle, () => _rowHeaderStyle = null, "RowHeaderStyle")); } if (null != _propertyColumnHeaderStyle) { yield return(new Main.DocumentNodeAndName(_propertyColumnHeaderStyle, () => _propertyColumnHeaderStyle = null, "PropertyColumnHeaderStyle")); } if (null != _dataColumnStyles) { yield return(new Main.DocumentNodeAndName(_dataColumnStyles, () => _dataColumnStyles = null, "DataColumnStyles")); } if (null != _propertyColumnStyles) { yield return(new Main.DocumentNodeAndName(_propertyColumnStyles, () => _propertyColumnStyles = null, "PropertyColumnStyles")); } }
public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info) { RowHeaderStyle s = (RowHeaderStyle)obj; info.AddBaseValueEmbedded(s, typeof(RowHeaderStyle).BaseType); info.AddValue("Height", s.m_RowHeight); }
// TODO (Wpf) Uncomment the next serialization if this is also implemented in Altaxo3 /* * * // New in version 2 (2010-08): the key of the default styles is now the type of the column (before it was the type of default style) * // both data columns and property columns have their own default styles * // ColumnDictionary now has its own serialization code * [Altaxo.Serialization.Xml.XmlSerializationSurrogateFor(typeof(WorksheetLayout), 2)] * class XmlSerializationSurrogate2 : Altaxo.Serialization.Xml.IXmlSerializationSurrogate * { * protected WorksheetLayout _deserializedInstance; * protected Main.DocumentPath _unresolvedPathToTable; * * public virtual void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info) * { * WorksheetLayout s = (WorksheetLayout)obj; * * info.AddValue("Guid", System.Xml.XmlConvert.ToString(s._guid)); * info.AddValue("Table", Main.DocumentPath.GetAbsolutePath(s._dataTable)); * info.AddValue("RowHeaderStyle", s._rowHeaderStyle); * info.AddValue("ColumnHeaderStyle", s._columnHeaderStyle); * info.AddValue("PropertyColumnHeaderStyle", s._propertyColumnHeaderStyle); * * info.AddValue("DataColumnStyles", s._dataColumnStyles); * info.AddValue("PropertyColumnStyles", s._propertyColumnStyles); * } * * public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) * { * WorksheetLayout s = null != o ? (WorksheetLayout)o : new WorksheetLayout(); * Deserialize(s, info, parent); * return s; * } * * protected virtual void Deserialize(WorksheetLayout s, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) * { * XmlSerializationSurrogate2 surr = new XmlSerializationSurrogate2(); * surr._deserializedInstance = s; * info.DeserializationFinished += new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(surr.EhDeserializationFinished); * * s._guid = System.Xml.XmlConvert.ToGuid(info.GetString("Guid")); * surr._unresolvedPathToTable = (Main.DocumentPath)info.GetValue("Table", s); * s._rowHeaderStyle = (RowHeaderStyle)info.GetValue("RowHeaderStyle", s); * s._columnHeaderStyle = (ColumnHeaderStyle)info.GetValue("ColumnHeaderStyle", s); * s._propertyColumnHeaderStyle = (ColumnHeaderStyle)info.GetValue("PropertyColumnHeaderStyle", s); * * s._dataColumnStyles = (ColumnStyleDictionary)info.GetValue("DataColumnStypes", s); * s._propertyColumnStyles = (ColumnStyleDictionary)info.GetValue("PropertyColumnStyles", s); * } * * public void EhDeserializationFinished(Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object documentRoot) * { * if (this._unresolvedPathToTable != null) * { * object table = Main.DocumentPath.GetObject(this._unresolvedPathToTable, this._deserializedInstance, documentRoot); * if (table is Altaxo.Data.DataTable) * { * this._deserializedInstance._dataTable = (Altaxo.Data.DataTable)table; * this._unresolvedPathToTable = null; * } * } * * // if the table path has been resolved, we can finish deserialization * if (this._unresolvedPathToTable == null) * info.DeserializationFinished -= new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(this.EhDeserializationFinished); * } * } */ #endregion Serialization #region Constructors protected WorksheetLayout() { _guid = System.Guid.NewGuid(); // m_ColumnStyles stores the column styles for each data column individually, _dataColumnStyles = new ColumnStyleDictionary() { ParentObject = this }; _propertyColumnStyles = new ColumnStyleDictionary() { ParentObject = this }; // The style of the row header. This is the leftmost column that shows usually the row number. _rowHeaderStyle = new RowHeaderStyle() { ParentObject = this }; // holds the style of the row header (leftmost column of data grid) // The style of the column header. This is the upmost row that shows the name of the columns. _columnHeaderStyle = new ColumnHeaderStyle() { ParentObject = this }; // the style of the column header (uppermost row of datagrid) // The style of the property column header. This is the leftmost column in the left of the property columns, _propertyColumnHeaderStyle = new ColumnHeaderStyle() { ParentObject = this }; _doShowPropertyColumns = true; }
protected WorksheetLayout() { m_Guid = System.Guid.NewGuid(); // defaultColumnsStyles stores the default column Styles in a Hashtable m_DefaultColumnStyles = new System.Collections.Hashtable(); // defaultPropertyColumnsStyles stores the default property column Styles in a Hashtable m_DefaultPropertyColumnStyles = new System.Collections.Hashtable(); // m_ColumnStyles stores the column styles for each data column individually, m_ColumnStyles = new ColumnDictionary(); // The style of the row header. This is the leftmost column that shows usually the row number. m_RowHeaderStyle = new RowHeaderStyle(); // holds the style of the row header (leftmost column of data grid) // The style of the column header. This is the upmost row that shows the name of the columns. m_ColumnHeaderStyle = new ColumnHeaderStyle(); // the style of the column header (uppermost row of datagrid) // The style of the property column header. This is the leftmost column in the left of the property columns, m_PropertyColumnHeaderStyle = new ColumnHeaderStyle(); this.m_ShowPropertyColumns = true; }
public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { RowHeaderStyle s = null != o ? (RowHeaderStyle)o : new RowHeaderStyle(); info.GetBaseValueEmbedded(s, typeof(RowHeaderStyle).BaseType, parent); s._rowHeight = info.GetInt32("Height"); return(s); }
public void GetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { System.Runtime.Serialization.ISurrogateSelector ss = AltaxoStreamingContext.GetSurrogateSelector(context); if (null != ss) { System.Runtime.Serialization.ISerializationSurrogate surr = ss.GetSurrogate(obj.GetType().BaseType, context, out ss); surr.GetObjectData(obj, info, context); // stream the data of the base object } else { throw new NotImplementedException(string.Format("Serializing a {0} without surrogate not implemented yet!", obj.GetType())); } RowHeaderStyle s = (RowHeaderStyle)obj; info.AddValue("Height", (float)s.m_RowHeight); }
public object SetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.ISurrogateSelector selector) { // first the base class System.Runtime.Serialization.ISurrogateSelector ss = AltaxoStreamingContext.GetSurrogateSelector(context); if (null != ss) { System.Runtime.Serialization.ISerializationSurrogate surr = ss.GetSurrogate(obj.GetType().BaseType, context, out ss); surr.SetObjectData(obj, info, context, selector); } else { throw new NotImplementedException(string.Format("Serializing a {0} without surrogate not implemented yet!", obj.GetType())); } // now the class itself RowHeaderStyle s = (RowHeaderStyle)obj; s.m_RowHeight = (int)info.GetSingle("Height"); return(obj); }
public RowHeaderStyle(RowHeaderStyle rhs) : base(rhs) { _rowHeight = rhs._rowHeight; }
public RowHeaderStyle(RowHeaderStyle rhs) : base(rhs) { m_RowHeight = rhs.m_RowHeight; }
// TODO (Wpf) Uncomment the next serialization if this is also implemented in Altaxo3 /* // New in version 2 (2010-08): the key of the default styles is now the type of the column (before it was the type of default style) // both data columns and property columns have their own default styles // ColumnDictionary now has its own serialization code [Altaxo.Serialization.Xml.XmlSerializationSurrogateFor(typeof(WorksheetLayout), 2)] class XmlSerializationSurrogate2 : Altaxo.Serialization.Xml.IXmlSerializationSurrogate { protected WorksheetLayout _deserializedInstance; protected Main.DocumentPath _unresolvedPathToTable; public virtual void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info) { WorksheetLayout s = (WorksheetLayout)obj; info.AddValue("Guid", System.Xml.XmlConvert.ToString(s._guid)); info.AddValue("Table", Main.DocumentPath.GetAbsolutePath(s._dataTable)); info.AddValue("RowHeaderStyle", s._rowHeaderStyle); info.AddValue("ColumnHeaderStyle", s._columnHeaderStyle); info.AddValue("PropertyColumnHeaderStyle", s._propertyColumnHeaderStyle); info.AddValue("DataColumnStyles", s._dataColumnStyles); info.AddValue("PropertyColumnStyles", s._propertyColumnStyles); } public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { WorksheetLayout s = null != o ? (WorksheetLayout)o : new WorksheetLayout(); Deserialize(s, info, parent); return s; } protected virtual void Deserialize(WorksheetLayout s, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { XmlSerializationSurrogate2 surr = new XmlSerializationSurrogate2(); surr._deserializedInstance = s; info.DeserializationFinished += new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(surr.EhDeserializationFinished); s._guid = System.Xml.XmlConvert.ToGuid(info.GetString("Guid")); surr._unresolvedPathToTable = (Main.DocumentPath)info.GetValue("Table", s); s._rowHeaderStyle = (RowHeaderStyle)info.GetValue("RowHeaderStyle", s); s._columnHeaderStyle = (ColumnHeaderStyle)info.GetValue("ColumnHeaderStyle", s); s._propertyColumnHeaderStyle = (ColumnHeaderStyle)info.GetValue("PropertyColumnHeaderStyle", s); s._dataColumnStyles = (ColumnStyleDictionary)info.GetValue("DataColumnStypes", s); s._propertyColumnStyles = (ColumnStyleDictionary)info.GetValue("PropertyColumnStyles", s); } public void EhDeserializationFinished(Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object documentRoot) { if (this._unresolvedPathToTable != null) { object table = Main.DocumentPath.GetObject(this._unresolvedPathToTable, this._deserializedInstance, documentRoot); if (table is Altaxo.Data.DataTable) { this._deserializedInstance._dataTable = (Altaxo.Data.DataTable)table; this._unresolvedPathToTable = null; } } // if the table path has been resolved, we can finish deserialization if (this._unresolvedPathToTable == null) info.DeserializationFinished -= new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(this.EhDeserializationFinished); } } */ #endregion Serialization #region Constructors protected WorksheetLayout() { _guid = System.Guid.NewGuid(); // m_ColumnStyles stores the column styles for each data column individually, _dataColumnStyles = new ColumnStyleDictionary() { ParentObject = this }; _propertyColumnStyles = new ColumnStyleDictionary() { ParentObject = this }; // The style of the row header. This is the leftmost column that shows usually the row number. _rowHeaderStyle = new RowHeaderStyle() { ParentObject = this }; // holds the style of the row header (leftmost column of data grid) // The style of the column header. This is the upmost row that shows the name of the columns. _columnHeaderStyle = new ColumnHeaderStyle() { ParentObject = this }; // the style of the column header (uppermost row of datagrid) // The style of the property column header. This is the leftmost column in the left of the property columns, _propertyColumnHeaderStyle = new ColumnHeaderStyle() { ParentObject = this }; this._doShowPropertyColumns = true; }