Commit 0157aedd authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Добавил метод asc_getAnchorPosition - получить координаты для каких-либо действий (для общей схемы)

Переименовал метод для комментариев из asc_getWorksheetId в asc_getMasterCommentId

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55410 954022d7-b5bf-4e40-9824-e11837661b57
parent 29fba7db
...@@ -46,7 +46,7 @@ function getFullImageSrc(src) { ...@@ -46,7 +46,7 @@ function getFullImageSrc(src) {
} }
else else
return src; return src;
}; }
function getCurrentTime() { function getCurrentTime() {
var currDate = new Date(); var currDate = new Date();
......
...@@ -2703,6 +2703,11 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -2703,6 +2703,11 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
return this.wb.getWorksheet().getActiveCellCoord(); return this.wb.getWorksheet().getActiveCellCoord();
}, },
// Получить координаты для каких-либо действий (для общей схемы)
asc_getAnchorPosition: function () {
return this.asc_getActiveCellCoord();
},
// Получаем свойство: редактируем мы сейчас или нет // Получаем свойство: редактируем мы сейчас или нет
asc_getCellEditMode: function () { asc_getCellEditMode: function () {
return this.wb.getCellEditMode(); return this.wb.getCellEditMode();
...@@ -3701,6 +3706,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -3701,6 +3706,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
// Cell interface // Cell interface
prot["asc_getCellInfo"] = prot.asc_getCellInfo; prot["asc_getCellInfo"] = prot.asc_getCellInfo;
prot["asc_getActiveCellCoord"] = prot.asc_getActiveCellCoord; prot["asc_getActiveCellCoord"] = prot.asc_getActiveCellCoord;
prot["asc_getAnchorPosition"] = prot.asc_getAnchorPosition;
prot["asc_setCellFontName"] = prot.asc_setCellFontName; prot["asc_setCellFontName"] = prot.asc_setCellFontName;
prot["asc_setCellFontSize"] = prot.asc_setCellFontSize; prot["asc_setCellFontSize"] = prot.asc_setCellFontSize;
prot["asc_setCellBold"] = prot.asc_setCellBold; prot["asc_setCellBold"] = prot.asc_setCellBold;
......
This diff is collapsed.
...@@ -2300,15 +2300,16 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aF ...@@ -2300,15 +2300,16 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aF
if(ws.aComments.length > 0 && ws.aCommentsCoords.length > 0) if(ws.aComments.length > 0 && ws.aCommentsCoords.length > 0)
this.bs.WriteItem(c_oSerWorksheetsTypes.Comments, function(){oThis.WriteComments(ws.aComments, ws.aCommentsCoords);}); this.bs.WriteItem(c_oSerWorksheetsTypes.Comments, function(){oThis.WriteComments(ws.aComments, ws.aCommentsCoords);});
var oBinaryTableWriter;
if(null != ws.AutoFilter && !this.isCopyPaste) if(null != ws.AutoFilter && !this.isCopyPaste)
{ {
var oBinaryTableWriter = new BinaryTableWriter(this.memory, this.aDxfs); oBinaryTableWriter = new BinaryTableWriter(this.memory, this.aDxfs);
this.bs.WriteItem(c_oSerWorksheetsTypes.Autofilter, function(){oBinaryTableWriter.WriteAutoFilter(ws.AutoFilter);}); this.bs.WriteItem(c_oSerWorksheetsTypes.Autofilter, function(){oBinaryTableWriter.WriteAutoFilter(ws.AutoFilter);});
} }
if(null != ws.TableParts && ws.TableParts.length > 0) if(null != ws.TableParts && ws.TableParts.length > 0)
{ {
var oBinaryTableWriter = new BinaryTableWriter(this.memory, this.aDxfs, this.isCopyPaste); oBinaryTableWriter = new BinaryTableWriter(this.memory, this.aDxfs, this.isCopyPaste);
this.bs.WriteItem(c_oSerWorksheetsTypes.TableParts, function(){oBinaryTableWriter.Write(ws.TableParts);}); this.bs.WriteItem(c_oSerWorksheetsTypes.TableParts, function(){oBinaryTableWriter.Write(ws.TableParts);});
} }
}; };
...@@ -3194,27 +3195,27 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aF ...@@ -3194,27 +3195,27 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aF
this.WriteComments = function(aComments, aCommentsCoords) this.WriteComments = function(aComments, aCommentsCoords)
{ {
var oThis = this; var oThis = this;
var oNewComments = {}; var oNewComments = {}, i, length, elem, nRow, nCol, row, comment;
for(var i = 0, length = aComments.length; i < length; ++i) for(i = 0, length = aComments.length; i < length; ++i)
{ {
//write only active comments, if copy/paste //write only active comments, if copy/paste
if(this.isCopyPaste && !this.isCopyPaste.contains(aComments[i].nCol, aComments[i].nRow)) if(this.isCopyPaste && !this.isCopyPaste.contains(aComments[i].nCol, aComments[i].nRow))
continue; continue;
var elem = aComments[i]; elem = aComments[i];
var nRow = elem.asc_getRow(); nRow = elem.asc_getRow();
if(null == nRow) if(null == nRow)
nRow = 0; nRow = 0;
var nCol = elem.asc_getCol(); nCol = elem.asc_getCol();
if(null == nCol) if(null == nCol)
nCol = 0; nCol = 0;
var row = oNewComments[nRow]; row = oNewComments[nRow];
if(null == row) if(null == row)
{ {
row = {}; row = {};
oNewComments[nRow] = row; oNewComments[nRow] = row;
} }
var comment = row[nCol]; comment = row[nCol];
if(null == comment) if(null == comment)
{ {
comment = {data: [], coord: null}; comment = {data: [], coord: null};
...@@ -3222,25 +3223,25 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aF ...@@ -3222,25 +3223,25 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aF
} }
comment.data.push(elem); comment.data.push(elem);
} }
for(var i = 0, length = aCommentsCoords.length; i < length; ++i) for(i = 0, length = aCommentsCoords.length; i < length; ++i)
{ {
//write only active comments, if copy/paste //write only active comments, if copy/paste
if(this.isCopyPaste && !this.isCopyPaste.contains(aCommentsCoords[i].nCol, aCommentsCoords[i].nRow)) if(this.isCopyPaste && !this.isCopyPaste.contains(aCommentsCoords[i].nCol, aCommentsCoords[i].nRow))
continue; continue;
var elem = aCommentsCoords[i]; elem = aCommentsCoords[i];
var nRow = elem.asc_getRow(); nRow = elem.asc_getRow();
if(null == nRow) if(null == nRow)
nRow = 0; nRow = 0;
var nCol = elem.asc_getCol(); nCol = elem.asc_getCol();
if(null == nCol) if(null == nCol)
nCol = 0; nCol = 0;
var row = oNewComments[nRow]; row = oNewComments[nRow];
if(null == row) if(null == row)
{ {
row = {}; row = {};
oNewComments[nRow] = row; oNewComments[nRow] = row;
} }
var comment = row[nCol]; comment = row[nCol];
if(null == comment) if(null == comment)
{ {
comment = {data: [], coord: null}; comment = {data: [], coord: null};
...@@ -3248,12 +3249,12 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aF ...@@ -3248,12 +3249,12 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aF
} }
comment.coord = elem; comment.coord = elem;
} }
for(var i in oNewComments) for(i in oNewComments)
{ {
var row = oNewComments[i]; row = oNewComments[i];
for(var j in row) for(var j in row)
{ {
var comment = row[j]; comment = row[j];
if(null == comment.coord || 0 == comment.data.length) if(null == comment.coord || 0 == comment.data.length)
continue; continue;
var coord = comment.coord; var coord = comment.coord;
...@@ -5082,17 +5083,18 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs, ...@@ -5082,17 +5083,18 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs,
this.aHyperlinks = []; this.aHyperlinks = [];
var oNewWorksheet = new Woorksheet(this.wb, wb.aWorksheets.length, false); var oNewWorksheet = new Woorksheet(this.wb, wb.aWorksheets.length, false);
res = this.bcr.Read1(length, function(t,l){ res = this.bcr.Read1(length, function(t,l){
return oThis.ReadWorksheet(t,l, oNewWorksheet); return oThis.ReadWorksheet(t,l, oNewWorksheet);
}); });
//merged //merged
for(var i = 0, length = this.aMerged.length; i < length; ++i) var i;
for(i = 0, length = this.aMerged.length; i < length; ++i)
{ {
var range = oNewWorksheet.getRange2(this.aMerged[i]); var range = oNewWorksheet.getRange2(this.aMerged[i]);
if(null != range) if(null != range)
range.mergeOpen(); range.mergeOpen();
} }
//hyperlinks //hyperlinks
for(var i = 0, length = this.aHyperlinks.length; i < length; ++i) for(i = 0, length = this.aHyperlinks.length; i < length; ++i)
{ {
var hyperlink = this.aHyperlinks[i]; var hyperlink = this.aHyperlinks[i];
if (null !== hyperlink.Ref) if (null !== hyperlink.Ref)
...@@ -5150,7 +5152,7 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs, ...@@ -5150,7 +5152,7 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs,
oTo.CustomWidth = oFrom.CustomWidth; oTo.CustomWidth = oFrom.CustomWidth;
if(oTo.index + 1 > oWorksheet.nColsCount) if(oTo.index + 1 > oWorksheet.nColsCount)
oWorksheet.nColsCount = oTo.index + 1; oWorksheet.nColsCount = oTo.index + 1;
} };
//если есть стиль последней колонки, назначаем его стилем всей таблицы и убираем из колонок //если есть стиль последней колонки, назначаем его стилем всей таблицы и убираем из колонок
var oAllCol = null; var oAllCol = null;
if(aTempCols.length > 0) if(aTempCols.length > 0)
...@@ -5250,12 +5252,10 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs, ...@@ -5250,12 +5252,10 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs,
{ {
oBinary_TableReader = new Binary_TableReader(this.stream, oWorksheet, this.Dxfs); oBinary_TableReader = new Binary_TableReader(this.stream, oWorksheet, this.Dxfs);
oBinary_TableReader.Read(length, oWorksheet.TableParts); oBinary_TableReader.Read(length, oWorksheet.TableParts);
} } else if ( c_oSerWorksheetsTypes.Comments == type ) {
else if ( c_oSerWorksheetsTypes.Comments == type )
{
res = this.bcr.Read1(length, function(t,l){ res = this.bcr.Read1(length, function(t,l){
return oThis.ReadComments(t,l, oWorksheet); return oThis.ReadComments(t,l, oWorksheet);
}); });
} else if (c_oSerWorksheetsTypes.ConditionalFormatting === type) { } else if (c_oSerWorksheetsTypes.ConditionalFormatting === type) {
oConditionalFormatting = new Asc.CConditionalFormatting(); oConditionalFormatting = new Asc.CConditionalFormatting();
res = this.bcr.Read1(length, function (t, l) { res = this.bcr.Read1(length, function (t, l) {
...@@ -5806,10 +5806,11 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs, ...@@ -5806,10 +5806,11 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs,
var oCommentCoords = new Asc.asc_CCommentCoords(); var oCommentCoords = new Asc.asc_CCommentCoords();
var aCommentData = []; var aCommentData = [];
res = this.bcr.Read2Spreadsheet(length, function(t,l){ res = this.bcr.Read2Spreadsheet(length, function(t,l){
return oThis.ReadComment(t,l, oCommentCoords, aCommentData); return oThis.ReadComment(t,l, oCommentCoords, aCommentData);
}); });
//todo проверка //todo проверка
for(var i = 0, length = aCommentData.length; i < length; ++i) var i;
for(i = 0, length = aCommentData.length; i < length; ++i)
{ {
var elem = aCommentData[i]; var elem = aCommentData[i];
elem.asc_putRow(oCommentCoords.asc_getRow()); elem.asc_putRow(oCommentCoords.asc_getRow());
......
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