} else { //total removed
removeLtRef(ref);
ref.getRbIndex().removeRbRef(ref);
}
} else { //initially scaned, create ranges
final Range org = new RangeSimple(ref.getSheet(), null, ref.getLeft(), ref.getTop(), ref.getRight(), ref.getBottom());
if (ref.getBottom() >= bottom) { //partially removed
final RowIndex dstri = _rowIndex.getMatrix().getRowIndex(bottom);
final CellIndex dstci = dstri.getCellIndex(_col);
dstci.addLtRef(ref); //ref's left, top, right, bottom is associated with dstci
final Range mod = new RangeSimple(ref.getSheet(), null, ref.getLeft(), ref.getTop(), ref.getRight(), ref.getBottom());
putScaned(ref, new Range[] {org, mod}, changed);
} else { //total removed
removeLtRef(ref);
ref.getRbIndex().removeRbRef(ref);
putScaned(ref, new Range[] {org, null}, changed);
}
}
}
}
} else {
for (int j = sz - 1; j >= 0; --j) {
final Ref2d ref = (Ref2d) _ltRefs.get(j);
if (right == -1 || (ref.getLeft() >= left && ref.getRight() <= right)) { //in range
if (ref.getBottom() >= bottom) { //partially removed
final RowIndex dstri = _rowIndex.getMatrix().getRowIndex(bottom);
final CellIndex dstci = dstri.getCellIndex(_col);
dstci.addLtRef(ref); //ref's left, top, right, bottom is associated with dstci
} else { //total removed
removeLtRef(ref);
ref.getRbIndex().removeRbRef(ref);
}
}
}
}
}
if (_rbRefs != null) {
top = top - 1;
final int sz = _rbRefs.size();
if (matrix.isUiRelated()) {
for (int j = sz - 1; j >= 0; --j) {
final Ref2d ref = (Ref2d) _rbRefs.get(j);
if (right == -1 || (ref.getLeft() >= left && ref.getRight() <= right)) { //in range
if (isScaned(ref, changed)) { //ever scaned, ranges might half baked
if (ref.getTop() <= top) { //partially removed
final RowIndex dstri = _rowIndex.getMatrix().getRowIndex(top);
if (dstri.isEmpty()) {
++indexdiff;
}
final CellIndex dstci = dstri.getCellIndex(_col);
dstci.addRbRef(ref); //ref's left, top, right, bottom is associated with dstci
final Range[] rngs = getScaned(ref, changed);
rngs[1] = new RangeSimple(ref.getSheet(), null, ref.getLeft(), ref.getTop(), ref.getRight(), ref.getBottom());
} else { //total removed
removeRbRef(ref);
ref.getLtIndex().removeLtRef(ref);
}
} else { //initially scaned, create ranges
final Range org = new RangeSimple(ref.getSheet(), null, ref.getLeft(), ref.getTop(), ref.getRight(), ref.getBottom());
if (ref.getTop() <= top) { //partially removed
final RowIndex dstri = _rowIndex.getMatrix().getRowIndex(top);
if (dstri.isEmpty()) {
++indexdiff;
}
final CellIndex dstci = dstri.getCellIndex(_col);
dstci.addRbRef(ref); //ref's left, top, right, bottom is associated with dstci
final Range mod = new RangeSimple(ref.getSheet(), null, ref.getLeft(), ref.getTop(), ref.getRight(), ref.getBottom());
putScaned(ref, new Range[] {org, mod}, changed);
} else { //total removed
removeRbRef(ref);
ref.getLtIndex().removeLtRef(ref);
putScaned(ref, new Range[] {org, null}, changed);