Ejemplo n.º 1
0
        internal void AddToSupport(Sheet supported, int col, int row, int cols, int rows)
        {
            Sheet                referredSheet = this.sheet ?? supported;
            Interval             referredRows, referredCols;
            Func <int, Interval> supportedRows, supportedCols;
            int ra = ul.rowRef, rb = lr.rowRef, r1 = row, r2 = row + rows - 1;

            RefAndSupp(ul.rowAbs, lr.rowAbs, ra, rb, r1, r2, out referredRows, out supportedRows);
            int ca = ul.colRef, cb = lr.colRef, c1 = col, c2 = col + cols - 1;

            RefAndSupp(ul.colAbs, lr.colAbs, ca, cb, c1, c2, out referredCols, out supportedCols);
            // Outer iteration should be over the shorter interval for efficiency
            if (referredCols.Length < referredRows.Length)
            {
                referredCols.ForEach(c => {
                    Interval suppCols = supportedCols(c);
                    referredRows.ForEach(r =>
                                         referredSheet.AddSupport(c, r, supported, suppCols, supportedRows(r)));
                });
            }
            else
            {
                referredRows.ForEach(r => {
                    Interval suppRows = supportedRows(r);
                    referredCols.ForEach(c =>
                                         referredSheet.AddSupport(c, r, supported, supportedCols(c), suppRows));
                });
            }
        }