Commit 5b9f3d0d authored by Igor.Zotov's avatar Igor.Zotov Committed by Alexander.Trofimov

copy/paste для форматированных таблиц(через внутренний буфер). bug #20841

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@50302 954022d7-b5bf-4e40-9824-e11837661b57
parent d9927f52
......@@ -231,8 +231,9 @@
};
/** @constructor */
function AutoFilters() {
function AutoFilters(currentSheet) {
if ( !(this instanceof AutoFilters) ) {return new AutoFilters();}
this.worksheet = currentSheet;
return this;
}
......@@ -279,7 +280,7 @@
var splitRange;
if(!addFormatTableOptionsObj)
addNameColumn = true;
else
else if(typeof addFormatTableOptionsObj == 'object')
{
ref = addFormatTableOptionsObj.asc_getRange();
addNameColumn = !addFormatTableOptionsObj.asc_getIsTitle();
......@@ -287,6 +288,9 @@
if(newRange)
activeCells = newRange;
}
else if(addFormatTableOptionsObj)
addNameColumn = false;
//callback
var onAddAutoFiltersCallback = function(success)
{
......
......@@ -262,10 +262,10 @@
}
},
copyRange: function (range, worksheet) {
copyRange: function (range, worksheet, isCut) {
var t = this;
t._cleanElement();
var text = t._makeTableNode(range, worksheet);
var text = t._makeTableNode(range, worksheet, isCut);
if(text == false)
return;
//исключения для opera в случае копирования пустой html
......@@ -292,7 +292,7 @@
},
copyRangeButton: function (range, worksheet) {
copyRangeButton: function (range, worksheet, isCut) {
if(/MSIE/g.test(navigator.userAgent))
{
this._cleanElement();
......@@ -338,7 +338,7 @@
else if(activateLocalStorage)
{
var t = this;
var table = t._makeTableNode(range,worksheet);
var table = t._makeTableNode(range, worksheet, isCut);
t.copyText = t._getTextFromTable(table);
return true;
}
......@@ -859,7 +859,6 @@
pastebin.setAttribute("contentEditable", true);
pastebin.onpaste = function(e){
console.log(window.GlobalPasteFlag);
if (!window.GlobalPasteFlag)
return;
......@@ -876,7 +875,6 @@
pastebin.removeChild(aChildNodes[i]);
}
pastebin.onpaste = function(e){
console.log(window.GlobalPasteFlag);
if (!window.GlobalPasteFlag)
return;
......@@ -2071,7 +2069,7 @@
}
},
_makeTableNode: function (range, worksheet) {
_makeTableNode: function (range, worksheet, isCut) {
var fn = range.worksheet.workbook.getDefaultFont();
var fs = range.worksheet.workbook.getDefaultSize();
var bbox = range.getBBox0();
......@@ -2158,7 +2156,7 @@
nLoc++;
isImage = true;
t._addLocalStorage(isImage,isChart,range.worksheet.getCell( new CellAddress(row, col, 0) ),bbox.r1,bbox.c1, image.from.row, image.from.col);
t._addLocalStorage(isImage,isChart,range.worksheet.getCell( new CellAddress(row, col, 0) ),bbox, image.from.row, image.from.col, worksheet, isCut);
}
}
......@@ -2182,7 +2180,7 @@
else
localStText += textRange;
//добавляем ноды
t._addLocalStorage(false,false,currentRange,bbox.r1,bbox.c1,row,col);
t._addLocalStorage(false,false,currentRange,bbox,row,col, worksheet, isCut);
}
}
t.lStorageText = localStText;
......@@ -2268,14 +2266,15 @@
return table;
},
_addLocalStorage : function (isImage,isChart,cell,numRow,numCol,trueRow,trueCol) {
_addLocalStorage : function (isImage,isChart,cell,activeRange,trueRow,trueCol, worksheet, isCut) {
var t = this;
var numRow = activeRange.r1;
var numCol = activeRange.c1;
if(isChart)
{
t.lStorage = [];
t.lStorage[0] = {};
t.lStorage[0].isChart = isChart;
//t.lStorage[trueRow][trueCol] = isChart;
}
else if(!isImage)
{
......@@ -2305,7 +2304,37 @@
}
if(cell.getQuotePrefix() && t.lStorage[row][col] && t.lStorage[row][col].value2 && t.lStorage[row][col].value2[0])
t.lStorage[row][col].value2[0].text = "'" + t.lStorage[row][col].value2[0].text;
//проверка на наличие автофильтров
if(!t.lStorage.autoFilters)
{
var autoFiltersObj = worksheet.autoFilters;
var findFilter = autoFiltersObj._searchFiltersInRange(activeRange, worksheet.model);
if(findFilter && !findFilter[0].TableStyleInfo)
{
findFilter.splice(0, 1);
}
if(findFilter)
{
var ref;
var style;
var range;
var tempRange;
t.lStorage.autoFilters = [];
for(var i = 0; i < findFilter.length; i++)
{
ref = findFilter[i].Ref;
tempRange = autoFiltersObj._refToRange(ref);
range = {r1: tempRange.r1 - activeRange.r1, c1: tempRange.c1 - activeRange.c1, r2: tempRange.r2 - activeRange.r1, c2: tempRange.c2 - activeRange.c1};
style = findFilter[i].TableStyleInfo ? findFilter[i].TableStyleInfo.Name : null;
t.lStorage.autoFilters[i] =
{
style: style,
range: range,
autoFilter: findFilter[i].AutoFilter ? true : false
}
}
}
}
}
},
......
......@@ -1325,7 +1325,7 @@
var t = this, ws, v;
if (!t.controller.isCellEditMode && !window.USER_AGENT_SAFARI_MACOS) {
ws = t.getWorksheet();
t.clipboard.copyRange(ws.getSelectedRange(), ws);
t.clipboard.copyRange(ws.getSelectedRange(), ws, true);
ws.setSelectionInfo("empty", c_oAscCleanOptions.All);
} else if(!window.USER_AGENT_SAFARI_MACOS){
v = t.cellEditor.cutSelection();
......@@ -1337,7 +1337,7 @@
var t = this, ws, v;
if (!t.controller.isCellEditMode) {
ws = t.getWorksheet();
var result = t.clipboard.copyRangeButton(ws.getSelectedRange(), ws);
var result = t.clipboard.copyRangeButton(ws.getSelectedRange(), ws, true);
if(result)
ws.setSelectionInfo("empty", c_oAscCleanOptions.All);
return result;
......
......@@ -458,7 +458,7 @@
this.collaborativeEditing = collaborativeEditing;
// Auto filters
this.autoFilters = new asc_AF();
this.autoFilters = new asc_AF(this);
this.cellCommentator = new asc_CCellCommentator(this);
this._init();
......@@ -7078,7 +7078,21 @@
unLockDraw(t.model.workbook);
arn = selectData[0];
selectionRange = arn.clone(true);
//добавляем автофильтры и форматированные таблицы
if(isLocal && val.lStorage && val.lStorage.autoFilters && val.lStorage.autoFilters.length)
{
var aFilters = val.lStorage.autoFilters;
var range;
for(var aF = 0; aF < aFilters.length; aF++)
{
range = {r1: aFilters[aF].range.r1 + selectionRange.r1, c1: aFilters[aF].range.c1 + selectionRange.c1, r2: aFilters[aF].range.r2 + selectionRange.r1, c2: aFilters[aF].range.c2 + selectionRange.c1}
t.autoFilters.addAutoFilter(t, aFilters[aF].style, range, null, null, true);
if(!aFilters[aF].autoFilter)
t.autoFilters.addAutoFilter(t, null, range, null, null, true);
}
};
// Должны обновить больший range, т.к. мы продолжаем строки в ячейках...
arn.c1 = 0;
arn.c2 = gc_nMaxCol0;
......
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