Ejemplo n.º 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);
            }
Ejemplo n.º 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;
        }
Ejemplo n.º 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"));
            }
        }
Ejemplo n.º 4
0
        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;
        }
Ejemplo n.º 5
0
    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;
    }
Ejemplo n.º 6
0
		public ColumnHeaderStyle(ColumnHeaderStyle chs)
			: base(chs)
		{
			_leftUpperTextFormat = (StringFormat)chs._leftUpperTextFormat.Clone();
			_rightUpperTextFormat = (StringFormat)chs._rightUpperTextFormat.Clone();
		}
Ejemplo n.º 7
0
 public ColumnHeaderStyle(ColumnHeaderStyle chs)
     : base(chs)
 {
     _leftUpperTextFormat  = (StringFormat)chs._leftUpperTextFormat.Clone();
     _rightUpperTextFormat = (StringFormat)chs._rightUpperTextFormat.Clone();
 }
Ejemplo n.º 8
0
 public ColumnHeaderStyle(ColumnHeaderStyle chs)
   : base(chs)
 {
   m_LeftUpperFormat = (StringFormat)chs.m_LeftUpperFormat.Clone();
   m_RightUpperFormat = (StringFormat)chs.m_RightUpperFormat.Clone();
 }
Ejemplo n.º 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;
		}
Ejemplo n.º 10
0
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                ColumnHeaderStyle s = (ColumnHeaderStyle)obj;

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