示例#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++;
       }
     }
   }
 }