Exemple #1
0
            public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                ColumnHeaderStyle s = null != o ? (ColumnHeaderStyle)o : new ColumnHeaderStyle();

                info.GetBaseValueEmbedded(s, typeof(ColumnHeaderStyle).BaseType, parent);
                return(s);
            }
Exemple #2
0
        // 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;
        }
Exemple #3
0
        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"));
            }
        }
        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;
        }
    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;
    }
Exemple #6
0
		public ColumnHeaderStyle(ColumnHeaderStyle chs)
			: base(chs)
		{
			_leftUpperTextFormat = (StringFormat)chs._leftUpperTextFormat.Clone();
			_rightUpperTextFormat = (StringFormat)chs._rightUpperTextFormat.Clone();
		}
Exemple #7
0
 public ColumnHeaderStyle(ColumnHeaderStyle chs)
     : base(chs)
 {
     _leftUpperTextFormat  = (StringFormat)chs._leftUpperTextFormat.Clone();
     _rightUpperTextFormat = (StringFormat)chs._rightUpperTextFormat.Clone();
 }
 public ColumnHeaderStyle(ColumnHeaderStyle chs)
   : base(chs)
 {
   m_LeftUpperFormat = (StringFormat)chs.m_LeftUpperFormat.Clone();
   m_RightUpperFormat = (StringFormat)chs.m_RightUpperFormat.Clone();
 }
Exemple #9
0
		// 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;
		}
Exemple #10
0
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                ColumnHeaderStyle s = (ColumnHeaderStyle)obj;

                info.AddBaseValueEmbedded(s, typeof(ColumnHeaderStyle).BaseType);
            }
Exemple #11
0
 public ColumnHeaderStyle(ColumnHeaderStyle chs)
     : base(chs)
 {
     m_LeftUpperFormat  = (StringFormat)chs.m_LeftUpperFormat.Clone();
     m_RightUpperFormat = (StringFormat)chs.m_RightUpperFormat.Clone();
 }