using System; using System.ComponentModel; using FastReport.Utils; using FastReport.CrossView; using System.Drawing.Design; namespace FastReport.Data { /// /// Base class for all CubeSources such as . /// [TypeConverter(typeof(FastReport.TypeConverters.CubeSourceConverter))] [Editor("FastReport.TypeEditors.CubeSourceEditor, FastReport", typeof(UITypeEditor))] public abstract class CubeSourceBase : DataComponentBase { #region Fields #endregion #region Properties /// /// /// public int XAxisFieldsCount { get { return CubeLink != null ? CubeLink.XAxisFieldsCount : 0; } } /// /// /// public int YAxisFieldsCount { get { return CubeLink != null ? CubeLink.YAxisFieldsCount : 0; } } /// /// /// public int MeasuresCount { get { return CubeLink != null ? CubeLink.MeasuresCount : 0; } } /// /// /// public int MeasuresLevel { get { return CubeLink != null ? CubeLink.MeasuresLevel : 0; } } /// /// /// public bool MeasuresInXAxis { get { return CubeLink != null ? CubeLink.MeasuresInXAxis : false; } } /// /// /// public bool MeasuresInYAxis { get { return CubeLink != null ? CubeLink.MeasuresInYAxis : false; } } /// /// /// public int DataColumnCount { get { return CubeLink != null ? CubeLink.DataColumnCount : 0; } } /// /// /// public int DataRowCount { get { return CubeLink != null ? CubeLink.DataRowCount : 0; } } /// /// /// public bool SourceAssigned { get { return CubeLink != null; } } /// /// /// public event EventHandler OnChanged; /// /// /// public IBaseCubeLink CubeLink { get { return Reference as IBaseCubeLink; } } #endregion #region Private Methods #endregion #region Protected Methods #endregion #region Public Methods /// /// /// public CrossViewMeasureCell GetMeasureCell(int colIndex, int rowIndex) { if (CubeLink != null) return CubeLink.GetMeasureCell(colIndex, rowIndex); else return new CrossViewMeasureCell(); } /// /// /// public void TraverseXAxis(CrossViewAxisDrawCellHandler crossViewAxisDrawCellHandler) { if (CubeLink != null) { CubeLink.TraverseXAxis(crossViewAxisDrawCellHandler); } } /// /// /// public void TraverseYAxis(CrossViewAxisDrawCellHandler crossViewAxisDrawCellHandler) { if (CubeLink != null) { CubeLink.TraverseYAxis(crossViewAxisDrawCellHandler); } } /// /// /// public string GetXAxisFieldName(int fieldIndex) { if (CubeLink != null) { return CubeLink.GetXAxisFieldName(fieldIndex); } else return ""; } /// /// /// public string GetYAxisFieldName(int fieldIndex) { if (CubeLink != null) { return CubeLink.GetYAxisFieldName(fieldIndex); } else return ""; } /// /// /// public string GetMeasureName(int measureIndex) { if (CubeLink != null) { return CubeLink.GetMeasureName(measureIndex); } else return ""; } /// public override void Serialize(FRWriter writer) { base.Serialize(writer); } /// public override void Deserialize(FRReader reader) { base.Deserialize(reader); } /// /// /// public void Changed() { if (OnChanged != null) OnChanged(this, new EventArgs()); } #endregion /// /// Initializes a new instance of the class with default settings. /// public CubeSourceBase() { SetFlags(Flags.HasGlobalName, true); } } }