public void Move(int fromRow, int fromColumn, int toRow, int toColumn, int rowCount, int columnCount)
        {
            this.MoveDataRange(fromRow, fromColumn, toRow, toColumn, rowCount, columnCount);
            DataMatrix <Sparkline> matrix = new DataMatrix <Sparkline>(rowCount, columnCount);

            for (int i = 0; i < rowCount; i++)
            {
                for (int k = 0; k < columnCount; k++)
                {
                    Sparkline sparkline = this.Sheet.GetSparkline(fromRow + i, fromColumn + k);
                    if (sparkline != null)
                    {
                        sparkline.Row    = toRow + i;
                        sparkline.Column = toColumn + k;
                        matrix.SetValue(i, k, sparkline);
                    }
                    this.Sheet.SetSparkline(fromRow + i, fromColumn + k, null);
                }
            }
            for (int j = 0; j < rowCount; j++)
            {
                for (int m = 0; m < columnCount; m++)
                {
                    this.Sheet.SetSparkline(toRow + j, toColumn + m, matrix.GetValue(j, m));
                }
            }
        }
Exemple #2
0
        internal DataMatrix <object> GetAllBoundData()
        {
            if (!this.isBound)
            {
                return(null);
            }
            DataMatrix <object> data = new DataMatrix <object> {
                RowCount    = this.rowIndexes.Count,
                ColumnCount = this.fields.Length
            };

            for (int k = 0; k < this.rowIndexes.Count; k++)
            {
                if (this.rowIndexes[k] != -1)
                {
                    for (int i = 0; i < this.fields.Length; i++)
                    {
                        string field = this.fields[i];
                        if (field != null)
                        {
                            object obj2 = this.Connection.GetValue(this.rowIndexes[k], field);
                            data.SetValue(k, i, obj2);
                        }
                    }
                }
            }
            return(data);
        }
Exemple #3
0
        internal DataMatrix <object> GetAllCachedData()
        {
            List <int>          nonEmpty;
            DataMatrix <object> data = new DataMatrix <object>();

            if (this.isBound)
            {
                data.RowCount    = this.rowIndexes.Count;
                data.ColumnCount = this.fields.Length;
                nonEmpty         = this.Connection.GetDirtyRecordIndex();
                for (int k = 0; k < nonEmpty.Count; k++)
                {
                    int recordIndex = nonEmpty[k];
                    int row         = this.rowIndexes.IndexOf(recordIndex);
                    if ((row >= 0) && (this.fields != null))
                    {
                        List <int> nonEmptyIndexes = this.fields.GetNonEmptyIndexes();
                        for (int i = 0; i < nonEmptyIndexes.Count; i++)
                        {
                            int    column = nonEmptyIndexes[i];
                            string str    = this.fields[column];
                            if (!string.IsNullOrEmpty(str))
                            {
                                object obj2 = this.Connection.GetValue(recordIndex, str);
                                data.SetValue(row, column, obj2);
                            }
                        }
                    }
                }
            }
            return(data);
        }
        public void Copy(int fromRow, int fromColumn, int toRow, int toColumn, int rowCount, int columnCount)
        {
            DataMatrix <Sparkline> matrix = new DataMatrix <Sparkline>(rowCount, columnCount);
            int offsetRow    = toRow - fromRow;
            int offsetColumn = toColumn - fromColumn;

            for (int i = 0; i < rowCount; i++)
            {
                for (int k = 0; k < columnCount; k++)
                {
                    Sparkline sparkline = this.Sheet.GetSparkline(fromRow + i, fromColumn + k);
                    if (sparkline != null)
                    {
                        Sparkline sparkline2 = sparkline.Clone();
                        sparkline2.Row    = toRow + i;
                        sparkline2.Column = toColumn + k;
                        CalcExpression dateAxisReference = sparkline2.DateAxisReference;
                        if (dateAxisReference != null)
                        {
                            if (CanOffset(dateAxisReference, offsetRow, offsetColumn, ((Worksheet)this.Sheet).RowCount, ((Worksheet)this.Sheet).ColumnCount))
                            {
                                sparkline2.DateAxisReference = dateAxisReference.Offset(offsetRow, offsetColumn, false, true);
                            }
                            else
                            {
                                sparkline2.DateAxisReference = new CalcErrorExpression(CalcErrors.Reference);
                            }
                        }
                        CalcExpression dataReference = sparkline2.DataReference;
                        if (dataReference != null)
                        {
                            if (CanOffset(dataReference, offsetRow, offsetColumn, ((Worksheet)this.Sheet).RowCount, ((Worksheet)this.Sheet).ColumnCount))
                            {
                                sparkline2.DataReference = dataReference.Offset(offsetRow, offsetColumn, false, true);
                            }
                            else
                            {
                                sparkline2.DataReference = new CalcErrorExpression(CalcErrors.Reference);
                            }
                        }
                        this.Add(sparkline2.Group);
                        matrix.SetValue(i, k, sparkline2);
                    }
                }
            }
            for (int j = 0; j < rowCount; j++)
            {
                for (int m = 0; m < columnCount; m++)
                {
                    this.Sheet.SetSparkline(toRow + j, toColumn + m, matrix.GetValue(j, m));
                }
            }
        }
Exemple #5
0
 void IRangeSupport.Move(int fromRow, int fromColumn, int toRow, int toColumn, int rowCount, int columnCount)
 {
     if (!this.isLoadingData && this.IsBound)
     {
         if (fromRow < 0)
         {
             fromRow  = 0;
             rowCount = this.rowIndexes.Count;
         }
         if (fromRow > this.rowIndexes.Count)
         {
             fromRow  = this.rowIndexes.Count;
             rowCount = 0;
         }
         if (fromColumn < 0)
         {
             fromColumn  = 0;
             columnCount = this.fields.Length;
         }
         if (fromColumn > this.fields.Length)
         {
             fromColumn  = this.fields.Length;
             columnCount = 0;
         }
         if (toRow < 0)
         {
             toRow = 0;
         }
         if (toRow > this.rowIndexes.Count)
         {
             toRow = this.rowIndexes.Count;
         }
         if (toColumn < 0)
         {
             toColumn = 0;
         }
         if (toColumn > this.fields.Length)
         {
             toColumn = this.fields.Length;
         }
         DataMatrix <object> matrix = new DataMatrix <object>(rowCount, columnCount);
         for (int i = 0; i < rowCount; i++)
         {
             for (int k = 0; k < columnCount; k++)
             {
                 object obj2 = this.GetValue(fromRow + i, fromColumn + k);
                 if (obj2 != null)
                 {
                     matrix.SetValue(i, k, obj2);
                 }
             }
         }
         ((IRangeSupport)this).Clear(fromRow, fromColumn, rowCount, columnCount);
         for (int j = 0; j < rowCount; j++)
         {
             for (int m = 0; m < columnCount; m++)
             {
                 this.SetValue(toRow + j, toColumn + m, matrix.GetValue(j, m));
             }
         }
     }
 }