Commit 52e952c3 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Поправил использование функции intersection (можно вызывать isIntersect).

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57684 954022d7-b5bf-4e40-9824-e11837661b57
parent 301a5628
...@@ -388,27 +388,18 @@ function FrozenPlace(ws, type) { ...@@ -388,27 +388,18 @@ function FrozenPlace(ws, type) {
_this.isCellInside = function(cell) { _this.isCellInside = function(cell) {
var result = false; var result = false;
if ( cell && _this.range ) { if (cell && _this.range) {
var cellRange = new asc_Range(cell.col, cell.row, cell.col, cell.row); var cellRange = new asc_Range(cell.col, cell.row, cell.col, cell.row);
var _r = _this.range.intersection(cellRange); result = _this.range.isIntersect(cellRange);
if ( _r ) {
if ( log )
console.log( cell.col + "," + cell.row + " in " + _this.type);
result = true;
}
} }
return result; return result;
}; };
_this.isObjectInside = function(object) { _this.isObjectInside = function(object) {
// TODO Нужно учитывать collOff, rowOff // TODO Нужно учитывать collOff, rowOff
var result = false;
var objectRange = new asc_Range(object.from.col, object.from.row, object.to.col, object.to.row); var objectRange = new asc_Range(object.from.col, object.from.row, object.to.col, object.to.row);
var _r = _this.range.intersection(objectRange); return _this.range.isIntersect(objectRange);
if ( _r )
result = true;
return result;
}; };
_this.getVerticalScroll = function() { _this.getVerticalScroll = function() {
......
...@@ -2056,40 +2056,40 @@ var gUndoInsDelCellsFlag = true; ...@@ -2056,40 +2056,40 @@ var gUndoInsDelCellsFlag = true;
} }
return null; return null;
}, },
checkApplyFilterOrSort: function(tablePartId) checkApplyFilterOrSort: function(tablePartId)
{ {
var aWs = this._getCurrentWS(); var aWs = this._getCurrentWS();
var result = false; var result = false;
if(tablePartId !== undefined) if(tablePartId !== undefined)
{ {
var tablePart = aWs.TableParts[tablePartId]; var tablePart = aWs.TableParts[tablePartId];
if(tablePart.Ref && ((tablePart.AutoFilter && tablePart.AutoFilter.FilterColumns && tablePart.AutoFilter.FilterColumns.length) || (tablePart && tablePart.SortState && tablePart.SortState.SortConditions && tablePart.SortState.SortConditions[0]))) if(tablePart.Ref && ((tablePart.AutoFilter && tablePart.AutoFilter.FilterColumns && tablePart.AutoFilter.FilterColumns.length) || (tablePart && tablePart.SortState && tablePart.SortState.SortConditions && tablePart.SortState.SortConditions[0])))
result = {isFilterColumns: true, isAutoFilter: true}; result = {isFilterColumns: true, isAutoFilter: true};
else if(tablePart.Ref && tablePart.AutoFilter && tablePart.AutoFilter !== null) else if(tablePart.Ref && tablePart.AutoFilter && tablePart.AutoFilter !== null)
result = {isFilterColumns: null, isAutoFilter: true}; result = {isFilterColumns: null, isAutoFilter: true};
else else
result = {isFilterColumns: null, isAutoFilter: false}; result = {isFilterColumns: null, isAutoFilter: false};
} }
else else
{ {
if(aWs.AutoFilter && ((aWs.AutoFilter.FilterColumns && aWs.AutoFilter.FilterColumns.length) || (aWs.AutoFilter.SortState && aWs.AutoFilter.SortState.SortConditions && aWs.AutoFilter.SortState.SortConditions[0]))) if(aWs.AutoFilter && ((aWs.AutoFilter.FilterColumns && aWs.AutoFilter.FilterColumns.length) || (aWs.AutoFilter.SortState && aWs.AutoFilter.SortState.SortConditions && aWs.AutoFilter.SortState.SortConditions[0])))
{ {
result = {isFilterColumns: true, isAutoFilter: true}; result = {isFilterColumns: true, isAutoFilter: true};
} }
else if(aWs.AutoFilter) else if(aWs.AutoFilter)
{ {
result = {isFilterColumns: null, isAutoFilter: true}; result = {isFilterColumns: null, isAutoFilter: true};
} }
else else
{ {
result = {isFilterColumns: null, isAutoFilter: false}; result = {isFilterColumns: null, isAutoFilter: false};
}; };
}; };
return result; return result;
}, },
getAddFormatTableOptions: function(activeCells) getAddFormatTableOptions: function(activeCells)
{ {
...@@ -2137,19 +2137,12 @@ var gUndoInsDelCellsFlag = true; ...@@ -2137,19 +2137,12 @@ var gUndoInsDelCellsFlag = true;
checkRemoveTableParts: function(delRange, tableRange) checkRemoveTableParts: function(delRange, tableRange)
{ {
var result = true, firstRowRange; var result = true, firstRowRange;
var aWs = this._getCurrentWS();
if(tableRange) if(tableRange && delRange.containsRange(tableRange) == false)
{ {
if(delRange.containsRange(tableRange) == false) firstRowRange = new Asc.Range(tableRange.c1, tableRange.r1, tableRange.c2, tableRange.r1);
{ result = !firstRowRange.isIntersect(delRange);
firstRowRange = new Asc.Range(tableRange.c1, tableRange.r1, tableRange.c2, tableRange.r1); }
if(firstRowRange.intersection(delRange))
{
result = false;
};
};
};
return result; return result;
}, },
...@@ -6514,7 +6507,7 @@ var gUndoInsDelCellsFlag = true; ...@@ -6514,7 +6507,7 @@ var gUndoInsDelCellsFlag = true;
//проходимся по всем заголовкам //проходимся по всем заголовкам
for(var j = tableRange.c1; j <= tableRange.c2; j++) for(var j = tableRange.c1; j <= tableRange.c2; j++)
{ {
cell = ws.model.getCell(new CellAddress(ref.r1, j, 0)) cell = ws.model.getCell(new CellAddress(ref.r1, j, 0));
val = cell.getValue(); val = cell.getValue();
//если не пустая изменяем TableColumns //если не пустая изменяем TableColumns
if(val != "" && intersection.c1 <= j && intersection.c2 >= j ) if(val != "" && intersection.c1 <= j && intersection.c2 >= j )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment