Пример #1
0
 public void copyIntervalToBuffer(Intervalo i, boolean delete) {
   int l = -1, c = -1;
   Cell aux;
   _cutBuffer.clear();
   for (Cell cel : i.getList()) {
     if (l == -1 || c == -1) {
       l = cel.getLinha() - 1;
       c = cel.getColuna() - 1;
     }
     aux = new Cell(cel.getLinha() - l, cel.getColuna() - c);
     aux.setConteudo(cel.getConteudo());
     _cutBuffer.add(aux);
     if (delete) removeCell(cel.getLinha(), cel.getColuna());
   }
 }
Пример #2
0
 public void pasteInterval(int[] cord) throws InvalidOperation {
   int colunamax, linhamax, i = 0;
   if (cord.length == 2) {
     cord[0]--;
     cord[1]--;
     for (Cell c : getCutBuffer()) {
       linhamax = cord[0] + c.getLinha();
       colunamax = cord[1] + c.getColuna();
       if (linhamax <= _linhas && colunamax <= _colunas) {
         pasteCell(getCell(cord[0] + c.getLinha(), cord[1] + c.getColuna()), i);
         i++;
       }
     }
   } else {
     if (_cutBuffer.size() == intervalLen(cord)) {
       Intervalo inter = new Intervalo(cord, this);
       for (Cell c : inter.getList()) {
         pasteCell(getCell(c.getLinha(), c.getColuna()), i);
         i++;
       }
     }
   }
 }
Пример #3
0
 public void copyCellToBuffer(Cell c) {
   Cell celula = new Cell(1, 1);
   celula.setConteudo(c.getConteudo());
   _cutBuffer.clear();
   _cutBuffer.add(celula);
 }
Пример #4
0
 public void pasteCell(Cell c, int index) {
   c.setConteudo(_cutBuffer.get(index).getConteudo());
 }
Пример #5
0
 public void cutCellToBuffer(Cell c) {
   copyCellToBuffer(c);
   removeCell(c.getLinha(), c.getColuna());
 }