예제 #1
0
        DataOrientation?ValidateXValuesRange(SheetCellRange[] ranges)
        {
            if ((ranges == null) || (ranges.Length == 0))
            {
                return(0);
            }
            SheetCellRange  range    = ranges[0];
            Worksheet       sheet    = range.Sheet;
            DataOrientation?nullable = new DataOrientation?((range.ColumnCount > range.RowCount) ? DataOrientation.Horizontal : DataOrientation.Vertical);

            for (int i = 1; i < ranges.Length; i++)
            {
                SheetCellRange range2 = ranges[i];
                if (range2.Sheet != sheet)
                {
                    throw new ArgumentException(ResourceStrings.NeedSingleCellRowColumn);
                }
                if (nullable.HasValue)
                {
                    DataOrientation orientation2 = (range2.ColumnCount > range2.RowCount) ? DataOrientation.Horizontal : DataOrientation.Vertical;
                    DataOrientation?nullable2    = nullable;
                    if ((orientation2 != ((DataOrientation)nullable2.GetValueOrDefault())) || !nullable2.HasValue)
                    {
                        nullable = null;
                    }
                }
            }
            return(nullable);
        }
예제 #2
0
 public ExcelFileReader(IDictionary <int, ExcelFilePropertySetter> propertySetters, ExcelAddressBase columnHeaderRange, ExcelAddressBase dataRange, DataOrientation datasetOrientation)
 {
     PropertySetters    = propertySetters;
     ColumnHeaderRange  = columnHeaderRange;
     DataRange          = dataRange;
     DatasetOrientation = datasetOrientation;
 }
예제 #3
0
        public async Task <M> Build(
            [InputPin(PropertyMode = PropertyMode.Allow)] ISequence <V> vectors,
            [InputPin(PropertyMode = PropertyMode.Default)] DataOrientation orientation = DataOrientation.Row)
        {
            var vectorlist = await vectors.ToListAsync();

            int  max  = 0;
            Type type = vectorlist.First().UnderlyingArray.ElementType;

            foreach (var vector in vectorlist)
            {
                if (vector.UnderlyingArray.Count > max)
                {
                    max = vector.UnderlyingArray.Count;
                }
                if (type != vector.UnderlyingArray.ElementType)
                {
                    throw new Exception("Vector in sequence are of different types");
                }
            }

            A a = null;

            if (orientation == DataOrientation.Column)
            {
                a = A.Create(type, max, vectorlist.Count);

                if (vectorlist.Count == 1)
                {
                    Buffer.BlockCopy(vectorlist[0].UnderlyingArray.Buffer, 0, a.Buffer, 0, vectorlist[0].UnderlyingArray.SizeInBytes);
                }
                else
                {
                    for (var c = 0; c < a.Dimension[0]; ++c)
                    {
                        for (var r = 0; r < a.Dimension[1]; ++r)
                        {
                            if (c < vectorlist[r].UnderlyingArray.Count)
                            {
                                a.SetValue(vectorlist[r].UnderlyingArray.GetValue(c), c, r);
                            }
                        }
                    }
                }
            }
            else if (orientation == DataOrientation.Row)
            {
                a = A.Create(type, vectorlist.Count, max);
                int i = 0;

                foreach (var v in vectorlist)
                {
                    Buffer.BlockCopy(v.UnderlyingArray.Buffer, 0, a.Buffer, i * Marshal.SizeOf(type) * a.Stride[0], v.UnderlyingArray.SizeInBytes);
                    ++i;
                }
            }

            return(M.FromArray(a));
        }
예제 #4
0
 /// <summary>
 /// 在IO监视器上显示byte[]数据
 /// </summary>
 /// <param name="dataOrientation"></param>
 /// <param name="data"></param>
 public void ChannelMonitorData(DataOrientation dataOrientation, byte[] data)
 {
     if (IsChannelMonitor)
     {
         if (ChannelMonitor != null)
         {
             ChannelMonitor.DataMonitor(dataOrientation, data);
         }
     }
 }
예제 #5
0
 internal void Init()
 {
     this.setting               = null;
     this.innerList             = null;
     this.sparklineType         = Dt.Cells.Data.SparklineType.Line;
     this.dateAxisData          = null;
     this.dateAxisReference     = null;
     this.axisOrientation       = DataOrientation.Vertical;
     this.SparklineGroupManager = null;
     this.cachedFormula         = null;
 }
예제 #6
0
 void UpdateDataProviders()
 {
     if (this._dataProviders != null)
     {
         foreach (ISeriesDataProvider provider in this._dataProviders)
         {
             if (provider != null)
             {
                 if (provider is WorksheetSeriesDataProvider)
                 {
                     (provider as WorksheetSeriesDataProvider).Worksheet = null;
                 }
                 provider.DataChanged -= new EventHandler(this.DataProvider_DataChanged);
             }
         }
     }
     this._dataProviders = null;
     if ((this.DataSeries != null) && (this.DataSeries.DataReference != null))
     {
         CalcReferenceExpression[] expressions = null;
         FormulaUtility.ExtractAllReferenceExpression(this._dataSeries.Evaluator, this._dataSeries.DataReference, out expressions);
         if ((expressions != null) && (expressions.Length > 0))
         {
             this._dataProviders = new List <ISeriesDataProvider>();
             foreach (CalcReferenceExpression expression in expressions)
             {
                 DataOrientation vertical = DataOrientation.Vertical;
                 if (this._dataSeries.DataOrientation.HasValue)
                 {
                     vertical = this._dataSeries.DataOrientation.Value;
                 }
                 else if (expression is CalcRangeExpression)
                 {
                     CalcRangeExpression expression2 = expression as CalcRangeExpression;
                     int num  = (expression2.EndColumn - expression2.StartColumn) + 1;
                     int num2 = (expression2.EndRow - expression2.StartRow) + 1;
                     vertical = (num > num2) ? DataOrientation.Horizontal : DataOrientation.Vertical;
                 }
                 WorksheetSeriesDataProvider provider2 = this.CreateSeriesDataProvider(new DefaultDataSeries(expression, vertical, this._dataSeries.DisplayHiddenData, this._dataSeries.EmptyValueStyle, null));
                 this._dataProviders.Add(provider2);
                 if (expression is CalcExternalExpression)
                 {
                     provider2.Worksheet = (expression as CalcExternalExpression).Source as Worksheet;
                 }
                 provider2.DataChanged += new EventHandler(this.DataProvider_DataChanged);
             }
         }
     }
 }
예제 #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dataOrientation"></param>
        /// <param name="data"></param>
        public void SaveOriginalBytes(DataOrientation dataOrientation, byte[] data)
        {
            if (this.DeviceParameter.IsSaveOriginBytes)
            {
                if (!System.IO.Directory.Exists(_SaveBytesPath))
                {
                    System.IO.Directory.CreateDirectory(_SaveBytesPath);
                }

                string path = String.Format("{0}/{1}_{2}.txt", _SaveBytesPath, DateTime.Now.ToString("yyyyMMdd"), this.DeviceParameter.DeviceID.ToString());

                string hexString = String.Format("[{0}]{1}", dataOrientation.ToString(), BinaryUtil.ByteToHex(data));
                FileUtil.WriteAppend(path, hexString);
            }
        }
예제 #8
0
        public static bool AreSegmentsAligned(List <List <SheetCellRange> > ranges, DataOrientation dataOrientation)
        {
            if (ranges.Count == 0)
            {
                return(false);
            }
            int num = -1;

            int[]  numArray  = null;
            int[]  numArray2 = null;
            bool[] flagArray = null;
            foreach (List <SheetCellRange> list in ranges)
            {
                if ((num != -1) && (list.Count != num))
                {
                    return(false);
                }
                num = list.Count;
                if (dataOrientation == DataOrientation.Vertical)
                {
                    if ((numArray != null) && (numArray2 != null))
                    {
                        for (int i = 0; i < num; i++)
                        {
                            int row  = list[i].Row;
                            int num4 = (list[i].Row + list[i].RowCount) - 1;
                            if ((row != numArray[i]) || (num4 != numArray2[i]))
                            {
                                flagArray[i] = false;
                                return(false);
                            }
                            flagArray[i] = true;
                            numArray[i]  = row;
                            numArray2[i] = num4;
                        }
                    }
                    if ((numArray == null) && (numArray2 == null))
                    {
                        numArray  = new int[num];
                        numArray2 = new int[num];
                        flagArray = new bool[num];
                        for (int j = 0; j < list.Count; j++)
                        {
                            numArray[j]  = list[j].Row;
                            numArray2[j] = (list[j].Row + list[j].RowCount) - 1;
                            flagArray[j] = true;
                        }
                    }
                }
                else
                {
                    if ((numArray != null) && (numArray2 != null))
                    {
                        for (int k = 0; k < num; k++)
                        {
                            int column = list[k].Column;
                            int num8   = (list[k].Column + list[k].ColumnCount) - 1;
                            if ((column != numArray[k]) || (num8 != numArray2[k]))
                            {
                                flagArray[k] = false;
                                return(false);
                            }
                            flagArray[k] = true;
                            numArray[k]  = column;
                            numArray2[k] = num8;
                        }
                    }
                    if ((numArray == null) && (numArray2 == null))
                    {
                        numArray  = new int[num];
                        numArray2 = new int[num];
                        flagArray = new bool[num];
                        for (int m = 0; m < list.Count; m++)
                        {
                            numArray[m]  = list[m].Column;
                            numArray2[m] = (list[m].Column + list[m].ColumnCount) - 1;
                            flagArray[m] = true;
                        }
                    }
                }
            }
            return(true);
        }
예제 #9
0
        public static Dictionary <int, List <SheetCellRange> > ArrangeRangesByOrientation(IEnumerable <SheetCellRange> ranges, DataOrientation dataOrientation)
        {
            Dictionary <int, List <SheetCellRange> > dictionary = new Dictionary <int, List <SheetCellRange> >();

            if (dataOrientation == DataOrientation.Vertical)
            {
                foreach (SheetCellRange range in ranges)
                {
                    if (!dictionary.ContainsKey(range.Column))
                    {
                        dictionary.Add(range.Column, new List <SheetCellRange>());
                    }
                    if (!dictionary[range.Column].Contains(range))
                    {
                        dictionary[range.Column].Add(range);
                    }
                }
                return(dictionary);
            }
            foreach (SheetCellRange range2 in ranges)
            {
                if (!dictionary.ContainsKey(range2.Row))
                {
                    dictionary.Add(range2.Row, new List <SheetCellRange>());
                }
                if (!dictionary[range2.Row].Contains(range2))
                {
                    dictionary[range2.Row].Add(range2);
                }
            }
            return(dictionary);
        }
예제 #10
0
        public static List <List <SheetCellRange> > TryCombineSeriesRange(List <List <SheetCellRange> > seriesRanges, DataOrientation dataOrientation)
        {
            List <List <SheetCellRange> > list = new List <List <SheetCellRange> >();

            for (int i = 0; i < seriesRanges.Count; i++)
            {
                List <SheetCellRange> list2 = seriesRanges[i];
                if ((list2 != null) && (list2.Count != 0))
                {
                    if (list.Count == 0)
                    {
                        List <SheetCellRange> list3 = new List <SheetCellRange>();
                        for (int k = 0; k < list2.Count; k++)
                        {
                            list3.Add(list2[k].Clone() as SheetCellRange);
                        }
                        list.Add(list3);
                        continue;
                    }
                    List <SheetCellRange> list4 = list[list.Count - 1];
                    if (list2.Count != list4.Count)
                    {
                        List <SheetCellRange> list5 = new List <SheetCellRange>();
                        for (int m = 0; m < list2.Count; m++)
                        {
                            list5.Add(list2[m].Clone() as SheetCellRange);
                        }
                        list.Add(list5);
                        continue;
                    }
                    bool flag = true;
                    for (int j = 0; j < list2.Count; j++)
                    {
                        SheetCellRange range  = list2[j];
                        SheetCellRange range2 = list4[j];
                        if (dataOrientation == DataOrientation.Vertical)
                        {
                            if (((range.Row == range2.Row) && (range.RowCount == range2.RowCount)) && (range.Column == (range2.Column + range2.ColumnCount)))
                            {
                                continue;
                            }
                            flag = false;
                            break;
                        }
                        if (((range.Column != range2.Column) || (range.ColumnCount != range2.ColumnCount)) || (range.Row != (range2.Row + range2.RowCount)))
                        {
                            flag = false;
                            break;
                        }
                    }
                    if (flag)
                    {
                        list.Remove(list4);
                        List <SheetCellRange> list6 = new List <SheetCellRange>();
                        for (int n = 0; n < list2.Count; n++)
                        {
                            SheetCellRange range3 = list2[n];
                            SheetCellRange range4 = list4[n];
                            if (dataOrientation == DataOrientation.Vertical)
                            {
                                SheetCellRange range5 = new SheetCellRange(range4.Sheet, range4.Row, range4.Column, range4.RowCount, range4.ColumnCount + range3.ColumnCount);
                                list6.Add(range5);
                            }
                            else
                            {
                                SheetCellRange range6 = new SheetCellRange(range4.Sheet, range4.Row, range4.Column, range4.RowCount + range3.RowCount, range4.ColumnCount);
                                list6.Add(range6);
                            }
                        }
                        list.Add(list6);
                    }
                    else
                    {
                        List <SheetCellRange> list7 = new List <SheetCellRange>();
                        for (int num6 = 0; num6 < list2.Count; num6++)
                        {
                            list7.Add(list2[num6].Clone() as SheetCellRange);
                        }
                        list.Add(list7);
                    }
                }
            }
            List <List <SheetCellRange> > list8 = new List <List <SheetCellRange> >();

            foreach (List <SheetCellRange> list9 in list)
            {
                if (list9.Count != 0)
                {
                    List <SheetCellRange> list10 = new List <SheetCellRange> {
                        list9[0]
                    };
                    if (dataOrientation == DataOrientation.Vertical)
                    {
                        for (int num7 = 1; num7 < list9.Count; num7++)
                        {
                            SheetCellRange range7 = list10[list10.Count - 1];
                            SheetCellRange range8 = list9[num7];
                            if ((range7.Row + range7.RowCount) == range8.Row)
                            {
                                list10.Remove(range7);
                                SheetCellRange range9 = new SheetCellRange(range7.Sheet, range7.Row, range7.Column, range7.RowCount + range8.RowCount, range7.ColumnCount);
                                list10.Add(range9);
                            }
                            else
                            {
                                list10.Add(range8);
                            }
                        }
                    }
                    else
                    {
                        for (int num8 = 1; num8 < list9.Count; num8++)
                        {
                            SheetCellRange range10 = list10[list10.Count - 1];
                            SheetCellRange range11 = list9[num8];
                            if ((range10.Column + range10.ColumnCount) == range11.Column)
                            {
                                list10.Remove(range10);
                                SheetCellRange range12 = new SheetCellRange(range10.Sheet, range10.Row, range10.Column, range10.RowCount, range10.ColumnCount + range11.ColumnCount);
                                list10.Add(range12);
                            }
                            else
                            {
                                list10.Add(range11);
                            }
                        }
                    }
                    list8.Add(list10);
                }
            }
            return(list8);
        }
예제 #11
0
 public ExcelFileDefinition <T> WithVerticalDataset()
 {
     _datasetOrientation = DataOrientation.Vertical;
     return(this);
 }
예제 #12
0
 public ExcelFileDefinition <T> WithHorizontalDataset()
 {
     _datasetOrientation = DataOrientation.Horizontal;
     return(this);
 }
        public StatVarProperties ParseStatVarProperties(int pRow, int pCol, DataOrientation pDataOrientation)
        {

            int mStatVarIndex;

            if (pDataOrientation == DataOrientation.InColumns)
            {
                mStatVarIndex = pRow;
            }
            else
            {
                mStatVarIndex = pCol;
            }

            var mStatVarProperties = new StatVarProperties();

            for (int i = 0, j = dgvStatVarProperties.RowCount; i < j; i++)
            {
                int mIndex = (int)dgvStatVarProperties["Index", i].Value;

                if (mIndex == mStatVarIndex)
                {
                    for (int f = 0; f < dgvStatVarProperties.ColumnCount; f++)
                    {
                        DataGridViewColumn mDGVC = dgvStatVarProperties.Columns[f];

                        switch (mDGVC.Index)
                        {
                            case 3:
                                mStatVarProperties.StatVar1 = getStatVarLevelValue(dgvStatVarProperties[f, i]);
                                if (mStatVarProperties.StatVar1 != null)
                                {
                                    mStatVarProperties.fk_variable = mStatVarProperties.StatVar1.id.ToString();
                                }
                                break;
                            case 4:
                                mStatVarProperties.StatVar2 = getStatVarLevelValue(dgvStatVarProperties[f, i]);
                                if (mStatVarProperties.StatVar2 != null)
                                {
                                mStatVarProperties.fk_variable = mStatVarProperties.StatVar2.id.ToString(); 
                                }                                break;
                            case 5:
                                mStatVarProperties.StatVar3 = getStatVarLevelValue(dgvStatVarProperties[f, i]);
                                if (mStatVarProperties.StatVar3 != null)
                                {
                                mStatVarProperties.fk_variable = mStatVarProperties.StatVar3.id.ToString(); 
                                }                                break;
                            case 6:
                                mStatVarProperties.StatVar4 = getStatVarLevelValue(dgvStatVarProperties[f, i]);
                                if (mStatVarProperties.StatVar4 != null)
                                {
                                    mStatVarProperties.fk_variable = mStatVarProperties.StatVar4.id.ToString();
                                }
                                break;
                            case 7:
                                mStatVarProperties.StatVar5 = getStatVarLevelValue(dgvStatVarProperties[f, i]);
                                if (mStatVarProperties.StatVar5 != null)
                                {
                                    mStatVarProperties.fk_variable = mStatVarProperties.StatVar5.id.ToString();
                                }
                                break;
                            case 8:
                                mStatVarProperties.MeasurementUnit = Util.CheckNullOrEmpty(dgvStatVarProperties[f, i].Value);
                                break;
                            case 9:
                                mStatVarProperties.Year = Table.GetNullOrDoubleString(dgvStatVarProperties[f, i].Value);
                                break;
                            case 10:
                                mStatVarProperties.Quarter = Table.GetNullOrDoubleString(dgvStatVarProperties[f, i].Value);
                                break;
                            case 11:
                                mStatVarProperties.Month = Table.GetNullOrDoubleString(dgvStatVarProperties[f, i].Value);
                                break;
                            case 12:
                                mStatVarProperties.Day = Table.GetNullOrDoubleString(dgvStatVarProperties[f, i].Value);
                                break;
                        }

                    }

                    break;
                }
            }
            return mStatVarProperties;
        }
 /// <summary>
 /// Get a row or a column from the selection
 /// </summary>
 /// <param name="mSelection">An Excel range object</param>
 /// <param name="pIndexNum">The 1-based index of the row or column to retrieve</param>
 /// <param name="pDataOrientation">Whether to get a row or a column</param>
 /// <returns></returns>
 public static StatProps GetIndex(Object[,] mSelection, int pIndexNum, DataOrientation pDataOrientation)
 {
     if (pDataOrientation == DataOrientation.InColumns)
     {
         return GetColNum(mSelection, pIndexNum, pDataOrientation);
     }
     else
     {
         return GetRowNum(mSelection, pIndexNum, pDataOrientation);
     }
 }
        public static StatProps GetColNum(Object[,] mSelection, int pColNum = 1, DataOrientation pDataOrientation = DataOrientation.InColumns)
        {
            if (pColNum <= mSelection.GetLength(1))
            {
                var mStatProps = new StatProps(pDataOrientation);
                for (int mRowNum = 1, mNumRows = mSelection.GetLength(0); mRowNum <= mNumRows; mRowNum++)
                {
                    mStatProps.AddValue(mRowNum, Table.GetNullOrString(mSelection[mRowNum, pColNum]));
                }
                return mStatProps;
            }
            else
            {
                return null;
            }

        }
        public void SetStatVarProperties(string pCellContentType, int pIndex, DataOrientation pDataOrientation)
        {
            switch (pCellContentType)
            {
                // Load stat variables
                case CellContentType.StatVars:
                    this.StatVarProperties = Table.GetIndex(this.SelectedRange.Cells.Value, pIndex, pDataOrientation);
                    break;
                // Load stat dates
                case CellContentType.StatVars2:
                    this.StatVarProperties2 = Table.GetIndex(this.SelectedRange.Cells.Value, pIndex, pDataOrientation);
                    break;
                // Load stat dates
                case CellContentType.StatDatum:
                    this.StatDatumProperties = Table.GetIndex(this.SelectedRange.Cells.Value, pIndex, pDataOrientation);
                    break;
                // Load stat area IDs and names concatenated - note that this takes presedent over other stat area attributes
                case CellContentType.StatAreaIDsAndNames:
                    // Create three statvar props,
                    // One for ids and names concatenated
                    StatProps mIDsAndNames = Table.GetIndex(this.SelectedRange.Cells.Value, pIndex, pDataOrientation);
                    // One for ids alone
                    this.StatAreaIDsProperties = Table.GetIndex(this.SelectedRange.Cells.Value, pIndex, pDataOrientation);
                    // And one areas alone
                    this.StatAreaNameProperties = Table.GetIndex(this.SelectedRange.Cells.Value, pIndex, pDataOrientation);

                    // Loop through the values
                    foreach (int t in mIDsAndNames.Keys)
                    {
                        // Read the concatenated string
                        List<string> mStatAreaIDAndName = mIDsAndNames[t].ToString().Split(' ').ToList<string>();
                        if (mStatAreaIDAndName.Count() >= 1)
                        {
                            string mStatAreaID = mStatAreaIDAndName[0];
                            this.StatAreaIDsProperties[t] = mStatAreaID;

                            if (mStatAreaIDAndName.Count() >= 2)
                            {
                                mStatAreaIDAndName.RemoveAt(0);
                                string mStatAreaName = string.Join(" ", mStatAreaIDAndName);
                                this.StatAreaNameProperties[t] = mStatAreaName;
                            }
                        }
                    }
                    break;
                // Load stat area IDs
                case CellContentType.StatAreaIDs:
                    this.StatAreaIDsProperties = Table.GetIndex(this.SelectedRange.Cells.Value, pIndex, pDataOrientation);
                    break;
                // Load stat area names
                case CellContentType.StatAreaNames:
                    this.StatAreaNameProperties = Table.GetIndex(this.SelectedRange.Cells.Value, pIndex, pDataOrientation);
                    break;
                // Load stat area groups
                case CellContentType.StatAreaGroups:
                    this.StatAreaGroupProperties = Table.GetIndex(this.SelectedRange.Cells.Value, pIndex, pDataOrientation);
                    break;
            }
            return;
        }
        public void OnCellContenTypeComboBoxChangeCommit(ComboBox pChangedComboBox, DataOrientation pDataOrientation, int pIndex)
        {

            // Get the new value of the changed CB
            var mNewCellContentType = Util.GetComboBoxSelectedValueString(pChangedComboBox);

            // Create a list to store all currently selected CB values
            var mAssignedCellContentTypes = new List<string>();

            // For each of the comboboxes with data layout info
            foreach (ComboBox mComboBox in this.CellContentTypeComboBoxes)
            {
                // Get the current contents of col/row
                var mCellContentType = Util.GetComboBoxSelectedValueString(mComboBox);

                // For all but the current control
                if (mComboBox != pChangedComboBox &&
                    (mCellContentType != CellContentType.Values && mCellContentType != CellContentType.Ignore))
                {
                    if (mCellContentType == mNewCellContentType ||
                        mAssignedCellContentTypes.Contains(mCellContentType))
                    {
                        mComboBox.SelectedValue = CellContentType.Values;
                    }
                    mAssignedCellContentTypes.Add(mCellContentType);
                }
            }

            // Add the new type to the list of used types
            if (!mAssignedCellContentTypes.Contains(mNewCellContentType) &&
                (mNewCellContentType != CellContentType.Values && mNewCellContentType != CellContentType.Ignore))
            {
                mAssignedCellContentTypes.Add(mNewCellContentType);
            }

            // Based on the new value of the changed CB, do something
            SetStatVarProperties(mNewCellContentType, pIndex, pDataOrientation);

            // Set conditional visibility of manual statdatum settings
            if (mAssignedCellContentTypes.Contains(CellContentType.StatDatum) && mAssignedCellContentTypes.Contains(CellContentType.StatVars))
            {
                this.grpStatDatumSettings.Enabled = false;
                this.grpAutoDateSettings.Enabled = true;
                this.dgvStatVarProperties.Columns["ar"].Visible = false;
                this.dgvStatVarProperties.Columns["kvartal"].Visible = false;
                this.dgvStatVarProperties.Columns["mnd"].Visible = false;
                this.dgvStatVarProperties.Columns["Day"].Visible = false;
            }
            else if (!mAssignedCellContentTypes.Contains(CellContentType.StatDatum) && mAssignedCellContentTypes.Contains(CellContentType.StatVars))
            {
                this.grpStatDatumSettings.Enabled = true;
                this.grpAutoDateSettings.Enabled = false;
                this.dgvStatVarProperties.Columns["ar"].Visible = true;
                this.dgvStatVarProperties.Columns["kvartal"].Visible = true;
                this.dgvStatVarProperties.Columns["mnd"].Visible = true;
                this.dgvStatVarProperties.Columns["Day"].Visible = true;
            }
            else
            {
                this.grpStatDatumSettings.Enabled = false;
                this.grpAutoDateSettings.Enabled = false;
            }

            // Set conditional visibility of manual stat area settings
            if (!mAssignedCellContentTypes.Contains(CellContentType.StatAreaIDs) && !mAssignedCellContentTypes.Contains(CellContentType.StatAreaIDsAndNames))
            {
                this.grpStatAreaSettings.Enabled = true;
            }
            else if (mAssignedCellContentTypes.Contains(CellContentType.StatAreaIDs) || mAssignedCellContentTypes.Contains(CellContentType.StatAreaIDsAndNames))
            {
                this.grpStatAreaSettings.Enabled = false;
            }
            else
            {
                this.grpStatAreaSettings.Enabled = false;
            }

            // Reset parsed values if no longer present in layout combos
            // Reset statvars
            if (!mAssignedCellContentTypes.Contains(CellContentType.StatVars))
            {
                this.StatVarProperties = null;
                this.dgvStatVarProperties.DataSource = null;
                this.dgvStatVarProperties.Refresh();
            }

            // Reset statareaids
            if (!mAssignedCellContentTypes.Contains(CellContentType.StatAreaIDs) &&
                !mAssignedCellContentTypes.Contains(CellContentType.StatAreaIDsAndNames))
            {
                this.StatAreaIDsProperties = null;
            }

            // Reset statdatum
            if (!mAssignedCellContentTypes.Contains(CellContentType.StatDatum))
            {
                this.StatDatumProperties = null;
            }

            // Rebind statvarprops to grid
            if (this.StatVarProperties != null)
            {
                // Load statvars to manual settings for statvars if not already done
                // or if change in content of perpendicular rows/columns
                if (dgvStatVarProperties.DataSource == null ||
                    mNewCellContentType == CellContentType.StatVars ||
                    mNewCellContentType == CellContentType.StatVars2 ||
                    pDataOrientation != this.StatVarProperties.DataOrientation)
                {
                    this.LoadStatVarPropertiesGrid();
                    //tabControl.SelectedTab = tpStatisticsVariables;
                }

                // Parse with current settings
                // TODO: Verify if this causes multiple reloads
                this.ParseSelectionWithCurrentSettings();

            }

            // Determine whether layout comboboxes are supposed to be enabled or not
            this.SetCellContentTypeComboBoxEnabledState();
            return;

        }
 public static StatProps GetRowNum(Object[,] mSelection, int pRowNum = 1, DataOrientation pDataOrientation = DataOrientation.InRows)
 {
     if (pRowNum <= mSelection.GetLength(0))
     {
         var mStatProps = new StatProps(pDataOrientation);
         for (int mColNum = 1, mNumCols = mSelection.GetLength(1); mColNum <= mNumCols; mColNum++)
         {
             mStatProps.Add(mColNum, Table.GetNullOrString(mSelection[pRowNum, mColNum]));
         }
         return mStatProps;
     }
     else
     {
         return null;
     }
 }