Package org.zkoss.zss.engine.impl

Examples of org.zkoss.zss.engine.impl.ChangeInfo


      break;
    }
    final Set<Ref> toEval = new HashSet<Ref>();
    final Set<Ref> affected = new HashSet<Ref>();
    final List<MergeChange> mergeChanges = new ArrayList<MergeChange>();
    final ChangeInfo changeInfo = new ChangeInfo(toEval, affected, mergeChanges);
    final int rowCount = srcRef.getRowCount();
    final int colCount = srcRef.getColumnCount();
    final int srctRow = srcRef.getTopRow();
    final int srcbRow = srcRef.getBottomRow();
    final int srclCol = srcRef.getLeftCol();
    final int srcrCol = srcRef.getRightCol();
   
    final int dstbRow = dstRef.getBottomRow();
    final StepChunk[] stepChunks = new StepChunk[colCount];
    //prepare StepChunks
    for(int c = srclCol, j = 0; c <= srcrCol; ++c) {
      final StepChunk stepChunk = getRowStepChunk(sheet, fillType, c, srctRow, srcbRow, true, colCount);
      stepChunks[j++] = stepChunk;
    }
    //handle special copy only case (two consecutive same type of row)
    handleSpecialCopyStep(stepChunks, rowCount, colCount);
    for(int c = srclCol, j = 0; c <= srcrCol; ++c) {
      final StepChunk stepChunk = stepChunks[j++];
      for(int srcIndex = 0, r = srcbRow + 1; r <= dstbRow; ++r, ++srcIndex) {
        final int index = srcIndex % rowCount;
        final int srcrow = srctRow + index;
        final Cell srcCell = BookHelper.getCell(sheet, srcrow, c);
        if (srcCell == null) {
          final Set<Ref>[] refs = BookHelper.removeCell(sheet, r, c);
          assignRefs(toEval, affected, refs);
        } else {
          final ChangeInfo changeInfo0 = BookHelper.copyCell(stepChunk.getStep(index).next(srcCell), srcCell, sheet, r, c, pasteType, BookHelper.PASTEOP_NONE, false);
          assignChangeInfo(toEval, affected, mergeChanges, changeInfo0);
        }
      }
    }
    final RefSheet refSheet = BookHelper.getRefSheet((Book)sheet.getWorkbook(), sheet);
View Full Code Here


      return null;
    }
    final Set<Ref> toEval = new HashSet<Ref>();
    final Set<Ref> affected = new HashSet<Ref>();
    final List<MergeChange> mergeChanges = new ArrayList<MergeChange>();
    final ChangeInfo changeInfo = new ChangeInfo(toEval, affected, mergeChanges);
    final int rowCount = srcRef.getRowCount();
    final int colCount = srcRef.getColumnCount();
    final int srctRow = srcRef.getTopRow();
    final int srcbRow = srcRef.getBottomRow();
    final int srclCol = srcRef.getLeftCol();
    final int srcrCol = srcRef.getRightCol();
   
    final int dsttRow = dstRef.getTopRow();
    final StepChunk[] stepChunks = new StepChunk[colCount];
    for(int c = srclCol, j = 0; c <= srcrCol; ++c) {
      final StepChunk stepChunk = getRowStepChunk(sheet, fillType, c, srcbRow, srctRow, false, colCount);
      stepChunks[j++] = stepChunk;
    }
    //handle special copy only case (two consecutive same type of row)
    handleSpecialCopyStep(stepChunks, rowCount, colCount);
    for(int c = srclCol, j = 0; c <= srcrCol; ++c) {
      final StepChunk stepChunk = stepChunks[j++];
      for(int srcIndex = 0, r = srctRow - 1; r >= dsttRow; --r, ++srcIndex) {
        final int index = srcIndex % rowCount;
        final int srcrow = srcbRow - index;
        final Cell srcCell = BookHelper.getCell(sheet, srcrow, c);
        if (srcCell == null) {
          final Set<Ref>[] refs = BookHelper.removeCell(sheet, r, c);
          assignRefs(toEval, affected, refs);
        } else {
          final ChangeInfo changeInfo0 = BookHelper.copyCell(stepChunk.getStep(index).next(srcCell), srcCell, sheet, r, c, pasteType, BookHelper.PASTEOP_NONE, false);
          assignChangeInfo(toEval, affected, mergeChanges, changeInfo0);
        }
      }
    }
    final RefSheet refSheet = BookHelper.getRefSheet((Book)sheet.getWorkbook(), sheet);
View Full Code Here

      return null;
    }
    final Set<Ref> toEval = new HashSet<Ref>();
    final Set<Ref> affected = new HashSet<Ref>();
    final List<MergeChange> mergeChanges = new ArrayList<MergeChange>();
    final ChangeInfo changeInfo = new ChangeInfo(toEval, affected, mergeChanges);
    final int rowCount = srcRef.getRowCount();
    final int colCount = srcRef.getColumnCount();
    final int srclCol = srcRef.getLeftCol();
    final int srcrCol = srcRef.getRightCol();
    final int srctRow = srcRef.getTopRow();
    final int srcbRow = srcRef.getBottomRow();
   
    final int dstrCol = dstRef.getRightCol();
    final StepChunk[] stepChunks = new StepChunk[rowCount];
    for(int r = srctRow, j = 0; r <= srcbRow; ++r) {
      final StepChunk stepChunk = getColStepChunk(sheet, fillType, r, srclCol, srcrCol, true, rowCount);
      stepChunks[j++] = stepChunk;
    }
    //handle special copy only case (two consecutive same type of row)
    handleSpecialCopyStep(stepChunks, colCount, rowCount);
    for(int r = srctRow, j = 0; r <= srcbRow; ++r) {
      final StepChunk stepChunk = stepChunks[j++];
      for(int srcIndex = 0, c = srcrCol + 1; c <= dstrCol; ++c, ++srcIndex) {
        final int index = srcIndex % colCount;
        final int srccol = srclCol + index;
        final Cell srcCell = BookHelper.getCell(sheet, r, srccol);
        if (srcCell == null) {
          final Set<Ref>[] refs = BookHelper.removeCell(sheet, r, c);
          assignRefs(toEval, affected, refs);
        } else {
          final ChangeInfo changeInfo0 = BookHelper.copyCell(stepChunk.getStep(index).next(srcCell), srcCell, sheet, r, c, pasteType, BookHelper.PASTEOP_NONE, false);
          assignChangeInfo(toEval, affected, mergeChanges, changeInfo0);
        }
      }
    }
    final RefSheet refSheet = BookHelper.getRefSheet((Book)sheet.getWorkbook(), sheet);
View Full Code Here

      return null;
    }
    final Set<Ref> toEval = new HashSet<Ref>();
    final Set<Ref> affected = new HashSet<Ref>();
    final List<MergeChange> mergeChanges = new ArrayList<MergeChange>();
    final ChangeInfo changeInfo = new ChangeInfo(toEval, affected, mergeChanges);
    final int rowCount = srcRef.getRowCount();
    final int colCount = srcRef.getColumnCount();
    final int srclCol = srcRef.getLeftCol();
    final int srcrCol = srcRef.getRightCol();
    final int srctRow = srcRef.getTopRow();
    final int srcbRow = srcRef.getBottomRow();
   
    final int dstlCol = dstRef.getLeftCol();
    final StepChunk[] stepChunks = new StepChunk[rowCount];
    for(int r = srctRow, j = 0; r <= srcbRow; ++r) {
      final StepChunk stepChunk = getColStepChunk(sheet, fillType, r, srcrCol, srclCol, false, rowCount);
      stepChunks[j++] = stepChunk;
    }
    //handle special copy only case (two consecutive same type of row)
    handleSpecialCopyStep(stepChunks, colCount, rowCount);
    for(int r = srctRow, j = 0; r <= srcbRow; ++r) {
      final StepChunk stepChunk = stepChunks[j++];
      for(int srcIndex = 0, c = srclCol - 1; c >= dstlCol; --c, ++srcIndex) {
        final int index = srcIndex % colCount;
        final int srccol = srcrCol - index;
        final Cell srcCell = BookHelper.getCell(sheet, r, srccol);
        if (srcCell == null) {
          final Set<Ref>[] refs = BookHelper.removeCell(sheet, r, c);
          assignRefs(toEval, affected, refs);
        } else {
          final ChangeInfo changeInfo0 = BookHelper.copyCell(stepChunk.getStep(index).next(srcCell), srcCell, sheet, r, c, pasteType, BookHelper.PASTEOP_NONE, false);
          assignChangeInfo(toEval, affected, mergeChanges, changeInfo0);
        }
      }
    }
    final RefSheet refSheet = BookHelper.getRefSheet((Book)sheet.getWorkbook(), sheet);
View Full Code Here

 
  private static ChangeInfo copyCell(Object cellValue, Cell srcCell, Cell dstCell, int pasteType, int pasteOp, boolean transpose) {
    final Set<Ref> toEval = new HashSet<Ref>();
    final Set<Ref> affected = new HashSet<Ref>();
    final List<MergeChange> mergeChanges = new ArrayList<MergeChange>();
    final ChangeInfo changeInfo = new ChangeInfo(toEval, affected, mergeChanges);
    //paste cell formats
    if ((pasteType & BookHelper.INNERPASTE_FORMATS) != 0) {
      dstCell.setCellStyle(prepareCellStyle(srcCell.getCellStyle(), dstCell, pasteType));
      //handle merge/unmerge cases
      final int dstrow = dstCell.getRowIndex();
      final int dstcol = dstCell.getColumnIndex();
      final Worksheet dstSheet = (Worksheet)dstCell.getSheet();
      final CellRangeAddress dstaddr = ((SheetCtrl)dstSheet).getMerged(dstrow, dstcol);
      if (dstaddr != null) { //shall un-merge the destination merge range
        final int dstrow2 = dstaddr.getLastRow();
        final int dstcol2 = dstaddr.getLastColumn();
        final ChangeInfo changeInfo0 = unMerge(dstSheet, dstrow, dstcol, dstrow2, dstcol2);
        assignChangeInfo(toEval, affected, mergeChanges, changeInfo0);
      }
      final int srcrow = srcCell.getRowIndex();
      final int srccol = srcCell.getColumnIndex();
      final CellRangeAddress srcaddr = ((SheetCtrl)srcCell.getSheet()).getMerged(srcrow, srccol);
      if (srcaddr != null) { //src is a merge range, shall merge dest cell
        final int srcrow2 = srcaddr.getLastRow();
        final int srccol2 = srcaddr.getLastColumn();
        final int tRow = dstrow;
        final int lCol = dstcol;
        final int bRow = tRow + srcrow2 - srcrow;
        final int rCol = lCol + srccol2 - srccol;
        final ChangeInfo changeInfo0 = merge(dstSheet, tRow, lCol, bRow, rCol, false);
        assignChangeInfo(toEval, affected, mergeChanges, changeInfo0);
      }
    }
   
    //paste comment
View Full Code Here

    final Set<Ref> all = refs[1];
    final int maxrow = book.getSpreadsheetVersion().getLastRowIndex();
    final int maxcol = book.getSpreadsheetVersion().getLastColumnIndex();
    shiftFormulas(all, sheet, startRow, maxrow, num, 0, maxcol, 0);
   
    return new ChangeInfo(last, all, changeMerges);
  }
View Full Code Here

    final Set<Ref> all = refs[1];
    final int maxrow = book.getSpreadsheetVersion().getLastRowIndex();
    final int maxcol = book.getSpreadsheetVersion().getLastColumnIndex();
    shiftFormulas(all, sheet, startRow, maxrow, num, 0, maxcol, 0);
   
    return new ChangeInfo(last, all, changeMerges);
  }
View Full Code Here

    final Set<Ref> all = refs[1];
    final int maxrow = book.getSpreadsheetVersion().getLastRowIndex();
    final int maxcol = book.getSpreadsheetVersion().getLastColumnIndex();
    shiftFormulas(all, sheet, startRow0, maxrow, -num, 0, maxcol, 0);
   
    return new ChangeInfo(last, all, changeMerges);
  }
View Full Code Here

    final Set<Ref> all = refs[1];
    final int maxrow = book.getSpreadsheetVersion().getLastRowIndex();
    final int maxcol = book.getSpreadsheetVersion().getLastColumnIndex();
    shiftFormulas(all, sheet, startRow0, maxrow, -num, 0, maxcol, 0);
   
    return new ChangeInfo(last, all, changeMerges);
  }
View Full Code Here

    final Set<Ref> all = refs[1];
    final int maxrow = book.getSpreadsheetVersion().getLastRowIndex();
    final int maxcol = book.getSpreadsheetVersion().getLastColumnIndex();
    shiftFormulas(all, sheet, 0, maxrow, 0, startCol, maxcol, num);
   
    return new ChangeInfo(last, all, changeMerges);
  }
View Full Code Here

TOP

Related Classes of org.zkoss.zss.engine.impl.ChangeInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.