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 @@ ...@@ -231,8 +231,9 @@
}; };
/** @constructor */ /** @constructor */
function AutoFilters() { function AutoFilters(currentSheet) {
if ( !(this instanceof AutoFilters) ) {return new AutoFilters();} if ( !(this instanceof AutoFilters) ) {return new AutoFilters();}
this.worksheet = currentSheet;
return this; return this;
} }
...@@ -279,7 +280,7 @@ ...@@ -279,7 +280,7 @@
var splitRange; var splitRange;
if(!addFormatTableOptionsObj) if(!addFormatTableOptionsObj)
addNameColumn = true; addNameColumn = true;
else else if(typeof addFormatTableOptionsObj == 'object')
{ {
ref = addFormatTableOptionsObj.asc_getRange(); ref = addFormatTableOptionsObj.asc_getRange();
addNameColumn = !addFormatTableOptionsObj.asc_getIsTitle(); addNameColumn = !addFormatTableOptionsObj.asc_getIsTitle();
...@@ -287,6 +288,9 @@ ...@@ -287,6 +288,9 @@
if(newRange) if(newRange)
activeCells = newRange; activeCells = newRange;
} }
else if(addFormatTableOptionsObj)
addNameColumn = false;
//callback //callback
var onAddAutoFiltersCallback = function(success) var onAddAutoFiltersCallback = function(success)
{ {
......
...@@ -262,10 +262,10 @@ ...@@ -262,10 +262,10 @@
} }
}, },
copyRange: function (range, worksheet) { copyRange: function (range, worksheet, isCut) {
var t = this; var t = this;
t._cleanElement(); t._cleanElement();
var text = t._makeTableNode(range, worksheet); var text = t._makeTableNode(range, worksheet, isCut);
if(text == false) if(text == false)
return; return;
//исключения для opera в случае копирования пустой html //исключения для opera в случае копирования пустой html
...@@ -292,7 +292,7 @@ ...@@ -292,7 +292,7 @@
}, },
copyRangeButton: function (range, worksheet) { copyRangeButton: function (range, worksheet, isCut) {
if(/MSIE/g.test(navigator.userAgent)) if(/MSIE/g.test(navigator.userAgent))
{ {
this._cleanElement(); this._cleanElement();
...@@ -338,7 +338,7 @@ ...@@ -338,7 +338,7 @@
else if(activateLocalStorage) else if(activateLocalStorage)
{ {
var t = this; var t = this;
var table = t._makeTableNode(range,worksheet); var table = t._makeTableNode(range, worksheet, isCut);
t.copyText = t._getTextFromTable(table); t.copyText = t._getTextFromTable(table);
return true; return true;
} }
...@@ -859,7 +859,6 @@ ...@@ -859,7 +859,6 @@
pastebin.setAttribute("contentEditable", true); pastebin.setAttribute("contentEditable", true);
pastebin.onpaste = function(e){ pastebin.onpaste = function(e){
console.log(window.GlobalPasteFlag);
if (!window.GlobalPasteFlag) if (!window.GlobalPasteFlag)
return; return;
...@@ -876,7 +875,6 @@ ...@@ -876,7 +875,6 @@
pastebin.removeChild(aChildNodes[i]); pastebin.removeChild(aChildNodes[i]);
} }
pastebin.onpaste = function(e){ pastebin.onpaste = function(e){
console.log(window.GlobalPasteFlag);
if (!window.GlobalPasteFlag) if (!window.GlobalPasteFlag)
return; return;
...@@ -2071,7 +2069,7 @@ ...@@ -2071,7 +2069,7 @@
} }
}, },
_makeTableNode: function (range, worksheet) { _makeTableNode: function (range, worksheet, isCut) {
var fn = range.worksheet.workbook.getDefaultFont(); var fn = range.worksheet.workbook.getDefaultFont();
var fs = range.worksheet.workbook.getDefaultSize(); var fs = range.worksheet.workbook.getDefaultSize();
var bbox = range.getBBox0(); var bbox = range.getBBox0();
...@@ -2158,7 +2156,7 @@ ...@@ -2158,7 +2156,7 @@
nLoc++; nLoc++;
isImage = true; 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 @@ ...@@ -2182,7 +2180,7 @@
else else
localStText += textRange; 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; t.lStorageText = localStText;
...@@ -2268,14 +2266,15 @@ ...@@ -2268,14 +2266,15 @@
return table; 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 t = this;
var numRow = activeRange.r1;
var numCol = activeRange.c1;
if(isChart) if(isChart)
{ {
t.lStorage = []; t.lStorage = [];
t.lStorage[0] = {}; t.lStorage[0] = {};
t.lStorage[0].isChart = isChart; t.lStorage[0].isChart = isChart;
//t.lStorage[trueRow][trueCol] = isChart;
} }
else if(!isImage) else if(!isImage)
{ {
...@@ -2305,7 +2304,37 @@ ...@@ -2305,7 +2304,37 @@
} }
if(cell.getQuotePrefix() && t.lStorage[row][col] && t.lStorage[row][col].value2 && t.lStorage[row][col].value2[0]) 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; 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 @@ ...@@ -1325,7 +1325,7 @@
var t = this, ws, v; var t = this, ws, v;
if (!t.controller.isCellEditMode && !window.USER_AGENT_SAFARI_MACOS) { if (!t.controller.isCellEditMode && !window.USER_AGENT_SAFARI_MACOS) {
ws = t.getWorksheet(); ws = t.getWorksheet();
t.clipboard.copyRange(ws.getSelectedRange(), ws); t.clipboard.copyRange(ws.getSelectedRange(), ws, true);
ws.setSelectionInfo("empty", c_oAscCleanOptions.All); ws.setSelectionInfo("empty", c_oAscCleanOptions.All);
} else if(!window.USER_AGENT_SAFARI_MACOS){ } else if(!window.USER_AGENT_SAFARI_MACOS){
v = t.cellEditor.cutSelection(); v = t.cellEditor.cutSelection();
...@@ -1337,7 +1337,7 @@ ...@@ -1337,7 +1337,7 @@
var t = this, ws, v; var t = this, ws, v;
if (!t.controller.isCellEditMode) { if (!t.controller.isCellEditMode) {
ws = t.getWorksheet(); ws = t.getWorksheet();
var result = t.clipboard.copyRangeButton(ws.getSelectedRange(), ws); var result = t.clipboard.copyRangeButton(ws.getSelectedRange(), ws, true);
if(result) if(result)
ws.setSelectionInfo("empty", c_oAscCleanOptions.All); ws.setSelectionInfo("empty", c_oAscCleanOptions.All);
return result; return result;
......
...@@ -458,7 +458,7 @@ ...@@ -458,7 +458,7 @@
this.collaborativeEditing = collaborativeEditing; this.collaborativeEditing = collaborativeEditing;
// Auto filters // Auto filters
this.autoFilters = new asc_AF(); this.autoFilters = new asc_AF(this);
this.cellCommentator = new asc_CCellCommentator(this); this.cellCommentator = new asc_CCellCommentator(this);
this._init(); this._init();
...@@ -7078,7 +7078,21 @@ ...@@ -7078,7 +7078,21 @@
unLockDraw(t.model.workbook); unLockDraw(t.model.workbook);
arn = selectData[0]; arn = selectData[0];
selectionRange = arn.clone(true); 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, т.к. мы продолжаем строки в ячейках... // Должны обновить больший range, т.к. мы продолжаем строки в ячейках...
arn.c1 = 0; arn.c1 = 0;
arn.c2 = gc_nMaxCol0; 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