Package org.zkoss.zss.model

Examples of org.zkoss.zss.model.Book


    return r;
  }
 
  protected void syncClipboard() {
    if (_clipboard != null) {
      final Book srcBook = _clipboard.book;
      if (!srcBook.equals(_spreadsheet.getBook())) {
        _clipboard = null;
      } else {
        final Worksheet srcSheet = _clipboard.sourceSheet;
        boolean validSheet = srcBook.getSheetIndex(srcSheet) >= 0;
        if (!validSheet) {
          clearClipboard();
        } else if (!srcSheet.equals(_spreadsheet.getSelectedSheet())) {
          _spreadsheet.setHighlight(null);
        } else {
View Full Code Here


      return deleteXSSFColumns(sheet, startCol, num);
    }
  }
 
  public static ChangeInfo deleteHSSFColumns(Worksheet sheet, int startCol, int num) {
    final Book book = (Book) sheet.getWorkbook();
    final RefSheet refSheet = getRefSheet(book, sheet);
    final Set<Ref>[] refs = refSheet.deleteColumns(startCol, num);
    final int startCol0 = startCol + num;
    final List<CellRangeAddress[]> shiftedRanges = ((HSSFSheetImpl)sheet).shiftColumnsOnly(startCol0, -1, -num, true, false, true, true, Range.FORMAT_NONE);
    final List<MergeChange> changeMerges = prepareChangeMerges(refSheet, shiftedRanges);
    final Set<Ref> last = refs[0];
    final Set<Ref> all = refs[1];
    final int maxrow = book.getSpreadsheetVersion().getLastRowIndex();
    final int maxcol = book.getSpreadsheetVersion().getLastColumnIndex();
    shiftFormulas(all, sheet, 0, maxrow, 0, startCol0, maxcol, -num);
   
    return new ChangeInfo(last, all, changeMerges);
  }
View Full Code Here

   * @param pasteOperation
   * @param skipBlank
   * @param transpose
   */
  protected void doPasteImpl(Rect selection, int pasteType, int pasteOperation, boolean skipBlank, boolean transpose) {
    Book srcBook = _clipboard.book;
    Book targetBook = _spreadsheet.getBook();
    if (targetBook != null && targetBook.equals(srcBook)) {
      final Worksheet srcSheet = _clipboard.sourceSheet;
      boolean validSheet = srcBook.getSheetIndex(srcSheet) >= 0;
      if (!validSheet) {
        clearClipboard();
        return;
View Full Code Here

   
    return new ChangeInfo(last, all, changeMerges);
  }
 
  public static ChangeInfo deleteXSSFColumns(Worksheet sheet, int startCol, int num) {
    final Book book = (Book) sheet.getWorkbook();
    final RefSheet refSheet = getRefSheet(book, sheet);
    final Set<Ref>[] refs = refSheet.deleteColumns(startCol, num);
    final int startCol0 = startCol + num;
    final List<CellRangeAddress[]> shiftedRanges = ((XSSFSheetImpl)sheet).shiftColumnsOnly(startCol0, -1, -num, true, false, true, true, Range.FORMAT_NONE);
    final List<MergeChange> changeMerges = prepareChangeMerges(refSheet, shiftedRanges);
    final Set<Ref> last = refs[0];
    final Set<Ref> all = refs[1];
    final int maxrow = book.getSpreadsheetVersion().getLastRowIndex();
    final int maxcol = book.getSpreadsheetVersion().getLastColumnIndex();
    shiftFormulas(all, sheet, 0, maxrow, 0, startCol0, maxcol, -num);
   
    return new ChangeInfo(last, all, changeMerges);
  }
View Full Code Here

      return insertXSSFRange(sheet, tRow, lCol, bRow, rCol, horizontal, copyRightBelow);
    }
  }
 
  private static ChangeInfo insertHSSFRange(Worksheet sheet, int tRow, int lCol, int bRow, int rCol, boolean horizontal, int copyRightBelow) {
    final Book book = (Book) sheet.getWorkbook();
    final RefSheet refSheet = getRefSheet(book, sheet);
    final Set<Ref>[] refs = refSheet.insertRange(tRow, lCol, bRow, rCol, horizontal);
    final int num = horizontal ? rCol - lCol + 1 : bRow - tRow + 1;
    final List<CellRangeAddress[]> shiftedRanges = horizontal ?
      ((HSSFSheetImpl)sheet).shiftColumnsRange(lCol, -1, num, tRow, bRow, true, false, true, false, copyRightBelow):
      ((HSSFSheetImpl)sheet).shiftRowsRange(tRow, -1, num, lCol, rCol, true, false, true, false, copyRightBelow);
    final List<MergeChange> changeMerges = prepareChangeMerges(refSheet, shiftedRanges);
    final Set<Ref> last = refs[0];
    final Set<Ref> all = refs[1];
    if (horizontal) {
      final int maxcol = book.getSpreadsheetVersion().getLastColumnIndex();
      all.add(new AreaRefImpl(tRow, lCol, bRow, maxcol, refSheet));
      shiftFormulas(all, sheet, tRow, bRow, 0, lCol, maxcol, num);
    } else {
      final int maxrow = book.getSpreadsheetVersion().getLastRowIndex();
      all.add(new AreaRefImpl(tRow, lCol, maxrow, rCol, refSheet));
      shiftFormulas(all, sheet, tRow, maxrow, num, lCol, rCol, 0);
    }
   
    return new ChangeInfo(last, all, changeMerges);
View Full Code Here

   
    return new ChangeInfo(last, all, changeMerges);
  }
 
  private static ChangeInfo insertXSSFRange(Worksheet sheet, int tRow, int lCol, int bRow, int rCol, boolean horizontal, int copyRightBelow) {
    final Book book = (Book) sheet.getWorkbook();
    final RefSheet refSheet = getRefSheet(book, sheet);
    final Set<Ref>[] refs = refSheet.insertRange(tRow, lCol, bRow, rCol, horizontal);
    final int num = horizontal ? rCol - lCol + 1 : bRow - tRow + 1;
    final List<CellRangeAddress[]> shiftedRanges = horizontal ?
      ((XSSFSheetImpl)sheet).shiftColumnsRange(lCol, -1, num, tRow, bRow, true, false, true, false, copyRightBelow):
      ((XSSFSheetImpl)sheet).shiftRowsRange(tRow, -1, num, lCol, rCol, true, false, true, false, copyRightBelow);
    final List<MergeChange> changeMerges = prepareChangeMerges(refSheet, shiftedRanges);
    final Set<Ref> last = refs[0];
    final Set<Ref> all = refs[1];
    if (horizontal) {
      final int maxcol = book.getSpreadsheetVersion().getLastColumnIndex();
      all.add(new AreaRefImpl(tRow, lCol, bRow, maxcol, refSheet));
      shiftFormulas(all, sheet, tRow, bRow, 0, lCol, maxcol, num);
    } else {
      final int maxrow = book.getSpreadsheetVersion().getLastRowIndex();
      all.add(new AreaRefImpl(tRow, lCol, maxrow, rCol, refSheet));
      shiftFormulas(all, sheet, tRow, maxrow, num, lCol, rCol, 0);
    }
   
    return new ChangeInfo(last, all, changeMerges);
View Full Code Here

      return deleteXSSFRange(sheet, tRow, lCol, bRow, rCol, horizontal);
    }
  }
 
  private static ChangeInfo deleteHSSFRange(Worksheet sheet, int tRow, int lCol, int bRow, int rCol, boolean horizontal) {
    final Book book = (Book) sheet.getWorkbook();
    final RefSheet refSheet = getRefSheet(book, sheet);
    final Set<Ref>[] refs = refSheet.deleteRange(tRow, lCol, bRow, rCol, horizontal);
    final int num = horizontal ? rCol - lCol + 1 : bRow - tRow + 1;
    final List<CellRangeAddress[]> shiftedRanges = horizontal ?
      ((HSSFSheetImpl)sheet).shiftColumnsRange(rCol + 1, -1, -num, tRow, bRow, true, false, true, true, Range.FORMAT_NONE):
      ((HSSFSheetImpl)sheet).shiftRowsRange(bRow + 1, -1, -num, lCol, rCol, true, false, true, true, Range.FORMAT_NONE);
    final List<MergeChange> changeMerges = prepareChangeMerges(refSheet, shiftedRanges);
    final Set<Ref> last = refs[0];
    final Set<Ref> all = refs[1];
   
    if (horizontal) {
      final int maxcol = book.getSpreadsheetVersion().getLastColumnIndex();
      all.add(new AreaRefImpl(tRow, lCol, bRow, maxcol, refSheet));
      shiftFormulas(all, sheet, tRow, bRow, 0, rCol + 1, maxcol, -num);
    } else {
      final int maxrow = book.getSpreadsheetVersion().getLastRowIndex();
      all.add(new AreaRefImpl(tRow, lCol, maxrow, rCol, refSheet));
      shiftFormulas(all, sheet, bRow + 1, maxrow, -num, lCol, rCol, 0);
    }
   
    return new ChangeInfo(last, all, changeMerges);
View Full Code Here

   
    return new ChangeInfo(last, all, changeMerges);
  }

  private static ChangeInfo deleteXSSFRange(Worksheet sheet, int tRow, int lCol, int bRow, int rCol, boolean horizontal) {
    final Book book = (Book) sheet.getWorkbook();
    final RefSheet refSheet = getRefSheet(book, sheet);
    final Set<Ref>[] refs = refSheet.deleteRange(tRow, lCol, bRow, rCol, horizontal);
    final int num = horizontal ? rCol - lCol + 1 : bRow - tRow + 1;
    final List<CellRangeAddress[]> shiftedRanges = horizontal ?
      ((XSSFSheetImpl)sheet).shiftColumnsRange(rCol + 1, -1, -num, tRow, bRow, true, false, true, true, Range.FORMAT_NONE):
      ((XSSFSheetImpl)sheet).shiftRowsRange(bRow + 1, -1, -num, lCol, rCol, true, false, true, true, Range.FORMAT_NONE);
    final List<MergeChange> changeMerges = prepareChangeMerges(refSheet, shiftedRanges);
    final Set<Ref> last = refs[0];
    final Set<Ref> all = refs[1];
   
    if (horizontal) {
      final int maxcol = book.getSpreadsheetVersion().getLastColumnIndex();
      all.add(new AreaRefImpl(tRow, lCol, bRow, maxcol, refSheet));
      shiftFormulas(all, sheet, tRow, bRow, 0, rCol + 1, maxcol, -num);
    } else {
      final int maxrow = book.getSpreadsheetVersion().getLastRowIndex();
      all.add(new AreaRefImpl(tRow, lCol, maxrow, rCol, refSheet));
      shiftFormulas(all, sheet, bRow + 1, maxrow, -num, lCol, rCol, 0);
    }
   
    return new ChangeInfo(last, all, changeMerges);
View Full Code Here

   
  private static ChangeInfo moveHSSFRange(Worksheet sheet, int tRow, int lCol, int bRow, int rCol, int nRow, int nCol) {
    if (nRow == 0 && nCol == 0) { //nothing to do!
      return null;
    }
    final Book book = (Book) sheet.getWorkbook();
    final RefSheet refSheet = getRefSheet(book, sheet);
    final Set<Ref>[] refs = refSheet.moveRange(tRow, lCol, bRow, rCol, nRow, nCol);
    final List<CellRangeAddress[]> shiftedRanges = nCol != 0 && nRow == 0 ?
      ((HSSFSheetImpl)sheet).shiftColumnsRange(lCol, rCol, nCol, tRow, bRow, true, false, true, false, Range.FORMAT_NONE):
      nCol == 0 && nRow != 0 ?
      ((HSSFSheetImpl)sheet).shiftRowsRange(tRow, bRow, nRow, lCol, rCol, true, false, true, false, Range.FORMAT_NONE):
      ((HSSFSheetImpl)sheet).shiftBothRange(tRow, bRow, nRow, lCol, rCol, nCol, true); //nCol != 0 && nRow != 0
    final List<MergeChange> changeMerges = prepareChangeMerges(refSheet, shiftedRanges);
    final Set<Ref> last = refs[0];
    final Set<Ref> all = refs[1];
    shiftFormulas(all, sheet, tRow, bRow, nRow, lCol, rCol, nCol);
    all.add(new AreaRefImpl(tRow, lCol, bRow, rCol, refSheet)); //original selection
    final int maxrow = book.getSpreadsheetVersion().getLastRowIndex();
    final int maxcol = book.getSpreadsheetVersion().getLastColumnIndex();
    int ntRow = Math.max(0, tRow + nRow);
    int nlCol = Math.max(0, lCol + nCol);
    int nbRow = Math.min(maxrow, bRow + nRow);
    int nrCol = Math.min(maxcol, rCol + nCol);
    if (ntRow <= nbRow && nlCol <= nrCol)
View Full Code Here

 
  private static ChangeInfo moveXSSFRange(Worksheet sheet, int tRow, int lCol, int bRow, int rCol, int nRow, int nCol) {
    if (nRow == 0 && nCol == 0) { //nothing to do!
      return null;
    }
    final Book book = (Book) sheet.getWorkbook();
    final RefSheet refSheet = getRefSheet(book, sheet);
    final Set<Ref>[] refs = refSheet.moveRange(tRow, lCol, bRow, rCol, nRow, nCol);
    final List<CellRangeAddress[]> shiftedRanges = nCol != 0 && nRow == 0 ?
      ((XSSFSheetImpl)sheet).shiftColumnsRange(lCol, rCol, nCol, tRow, bRow, true, false, true, false, Range.FORMAT_NONE):
      nCol == 0 && nRow != 0 ?
      ((XSSFSheetImpl)sheet).shiftRowsRange(tRow, bRow, nRow, lCol, rCol, true, false, true, false, Range.FORMAT_NONE):
      ((XSSFSheetImpl)sheet).shiftBothRange(tRow, bRow, nRow, lCol, rCol, nCol, true); //nCol != 0 && nRow != 0
    final List<MergeChange> changeMerges = prepareChangeMerges(refSheet, shiftedRanges);
    final Set<Ref> last = refs[0];
    final Set<Ref> all = refs[1];
    shiftFormulas(all, sheet, tRow, bRow, nRow, lCol, rCol, nCol);
    all.add(new AreaRefImpl(tRow, lCol, bRow, rCol, refSheet)); //original selection
    final int maxrow = book.getSpreadsheetVersion().getLastRowIndex();
    final int maxcol = book.getSpreadsheetVersion().getLastColumnIndex();
    int ntRow = Math.max(0, tRow + nRow);
    int nlCol = Math.max(0, lCol + nCol);
    int nbRow = Math.min(maxrow, bRow + nRow);
    int nrCol = Math.min(maxcol, rCol + nCol);
    if (ntRow <= nbRow && nlCol <= nrCol)
View Full Code Here

TOP

Related Classes of org.zkoss.zss.model.Book

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.