Package org.zkoss.zss.engine

Examples of org.zkoss.zss.engine.Ref


 
  @Override
  public void merge(boolean across) {
    synchronized (_sheet) {
      if (_refs != null && !_refs.isEmpty()) {
        final Ref ref = _refs.iterator().next();
        final RefSheet refSheet = ref.getOwnerSheet();
        final RefBook refBook = refSheet.getOwnerBook();
        final int tRow = ref.getTopRow();
        final int lCol = ref.getLeftCol();
        final int bRow = ref.getBottomRow();
        final int rCol = ref.getRightCol();
        final Worksheet sheet = BookHelper.getSheet(_sheet, refSheet);
        final ChangeInfo info = BookHelper.merge(sheet, tRow, lCol, bRow, rCol, across);
        notifyMergeChange(refBook, info, ref, SSDataEvent.ON_CONTENTS_CHANGE, SSDataEvent.MOVE_NO);
      }
    }
View Full Code Here


 
  @Override
  public void unMerge() {
    synchronized (_sheet) {
      if (_refs != null && !_refs.isEmpty()) {
        final Ref ref = _refs.iterator().next();
        final RefSheet refSheet = ref.getOwnerSheet();
        final RefBook refBook = refSheet.getOwnerBook();
        final int tRow = ref.getTopRow();
        final int lCol = ref.getLeftCol();
        final int bRow = ref.getBottomRow();
        final int rCol = ref.getRightCol();
        final Worksheet sheet = BookHelper.getSheet(_sheet, refSheet);
        final ChangeInfo info = BookHelper.unMerge(sheet, tRow, lCol, bRow, rCol);
        notifyMergeChange(refBook, info, ref, SSDataEvent.ON_CONTENTS_CHANGE, SSDataEvent.MOVE_NO);
      }
    }
View Full Code Here

  }
 
  @Override
  public Range getCells(int row, int col) {
    synchronized (_sheet) {
      final Ref ref = getRefs().iterator().next();
      final int col1 = ref.getLeftCol() + col;
      final int row1 = ref.getTopRow() + row;
      return new RangeImpl(row1, col1, _sheet, _sheet);
    }
  }
View Full Code Here

    int dstbRow = bRow;
    for(int rr = rowRepeat; rr > 0; --rr) {
      int lCol0 = lCol;
      for (int cr = colRepeat; cr > 0; --cr) {
        for (Entry<Integer, Ref> srcEntry : srcRefs.entrySet()) {
          final Ref srcRef = srcEntry.getValue();
          int rCol0 = lCol0 + (transpose ? srcRef.getRowCount() : srcRef.getColumnCount()) - 1;
          final Ref dstRef0 = new AreaRefImpl(dsttRow, lCol0, dstbRow, rCol0, dstSheet);
          copyRef(srcRef, 1, 1, dstRef0, pasteType, pasteOp, skipBlanks, false, info);
          lCol0 = rCol0 + 1;
        }
      }
      dsttRow = dstbRow + 1;
View Full Code Here

    int dstrCol = rCol;
    for (int cr = colRepeat; cr > 0; --cr) {
      int tRow0 = tRow;
      for(int rr = rowRepeat; rr > 0; --rr) {
        for (Entry<Integer, Ref> srcEntry : srcRefs.entrySet()) {
          final Ref srcRef = srcEntry.getValue();
          int bRow0 = tRow0 + (transpose ? srcRef.getColumnCount() : srcRef.getRowCount()) - 1;
          final Ref dstRef0 = new AreaRefImpl(tRow0, dstlCol, bRow0, dstrCol, dstSheet);
          copyRef(srcRef, 1, 1, dstRef0, pasteType, pasteOp, skipBlanks, false, info);
          tRow0 = bRow0 + 1;
        }
      }
      dstlCol += dstrCol + 1;
View Full Code Here

 
  //Any cell is protecetd and locked
  @Override
  public boolean isAnyCellProtected() {
    synchronized (_sheet) {
      final Ref ref = _refs != null && !_refs.isEmpty() ? _refs.iterator().next() : null;
      if (ref != null) {
        final RefSheet refSheet = ref.getOwnerSheet();
        final int left = ref.getLeftCol();
        final int right = ref.getRightCol();
        final int top = ref.getTopRow();
        final int bottom = ref.getBottomRow();
       
        //ZSS-22: Shall not allow Copy and Paste operation in a protected spreadsheet
        final Worksheet sheet = BookHelper.getSheet(_sheet, refSheet);
        if (sheet.getProtect()) {
          for (int r = top; r <= bottom; ++r) {
View Full Code Here

    final int dstB = dstT + dstRowCount - 1;
    final int dstR = dstL + dstColCount - 1;
   
    //ZSS-22: Shall not allow Copy and Paste operation in a protected spreadsheet
    final Worksheet dstSheet = BookHelper.getSheet(_sheet, dstRefSheet);
    final Ref pasteRef = new AreaRefImpl(dstT, dstL, dstB, dstR, dstRefSheet);
    return new RangeImpl(pasteRef, dstSheet).isAnyCellProtected() ? null : pasteRef;
  }
View Full Code Here

    final Worksheet dstSheet = BookHelper.getSheet(_sheet, dstRefSheet);
    final Ref pasteRef = new AreaRefImpl(dstT, dstL, dstB, dstR, dstRefSheet);
    return new RangeImpl(pasteRef, dstSheet).isAnyCellProtected() ? null : pasteRef;
  }
  private Ref copyRefs(boolean sameRow, SortedMap<Integer, Ref> srcRefs, int srcColCount, int srcRowCount, int colRepeat, int rowRepeat, Ref dstRef, int pasteType, int pasteOp, boolean skipBlanks, boolean transpose, ChangeInfo info) {
    final Ref pasteRef = getPasteRef(srcRowCount, srcColCount, rowRepeat, colRepeat, dstRef, transpose);
    if (pasteRef == null) {
      return null;
    }
    if (pasteType == Range.PASTE_COLUMN_WIDTHS) {
      final Integer lastKey = srcRefs.lastKey();
      final Ref srcRef = srcRefs.get(lastKey);
      final int srclCol = srcRef.getLeftCol();
      final Worksheet srcSheet = BookHelper.getSheet(_sheet, srcRef.getOwnerSheet());
      final int widthRepeatCount = srcRef.getColumnCount();
      copyColumnWidths(srcSheet, widthRepeatCount, srclCol, pasteRef);
      return pasteRef;
    }
   
    final RefSheet dstSheet = dstRef.getOwnerSheet();
View Full Code Here

  }
 
  private Ref copyRef(Ref srcRef, int colRepeat, int rowRepeat, Ref dstRef, int pasteType, int pasteOp, boolean skipBlanks, boolean transpose, ChangeInfo info) {
    final int srcRowCount = srcRef.getRowCount();
    final int srcColCount = srcRef.getColumnCount();
    final Ref pasteRef = getPasteRef(srcRowCount, srcColCount, rowRepeat, colRepeat, dstRef, transpose);
    if (pasteRef == null) {
      return null;
    }
    if (pasteType == Range.PASTE_COLUMN_WIDTHS) {
      final int srclCol = srcRef.getLeftCol();
View Full Code Here

 
  @Override
  public void setBorders(short borderIndex, BorderStyle lineStyle, String color) {
    synchronized (_sheet) {
      if (_refs != null && !_refs.isEmpty()) {
        final Ref ref = _refs.iterator().next();
        final RefSheet refSheet = ref.getOwnerSheet();
        final int tRow = ref.getTopRow();
        final int lCol = ref.getLeftCol();
        final int bRow = ref.getBottomRow();
        final int rCol = ref.getRightCol();
        final Worksheet sheet = BookHelper.getSheet(_sheet, refSheet);
        final Set<Ref> all = BookHelper.setBorders(sheet, tRow, lCol, bRow, rCol, borderIndex, lineStyle, color);
        if (all != null) {
          final Book book = (Book) _sheet.getWorkbook();
          BookHelper.notifyCellChanges(book, all);
View Full Code Here

TOP

Related Classes of org.zkoss.zss.engine.Ref

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.