Commit 07a6f566 authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

add Range.promoteFromTo

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@54715 954022d7-b5bf-4e40-9824-e11837661b57
parent 3deb33a5
...@@ -7045,18 +7045,18 @@ Range.prototype._isSameSizeMerged=function(bbox, aMerged){ ...@@ -7045,18 +7045,18 @@ Range.prototype._isSameSizeMerged=function(bbox, aMerged){
} }
return oRes; return oRes;
}; };
Range.prototype._canPromote=function(oPromoteRange, nWidth, nHeight, bVertical, nIndex){ Range.prototype._canPromote=function(from, to, bIsPromote, nWidth, nHeight, bVertical, nIndex){
var oRes = {oMergedFrom: null, oMergedTo: null}; var oRes = {oMergedFrom: null, oMergedTo: null};
//если надо только удалить внутреннее содержимое не смотрим на замерженость //если надо только удалить внутреннее содержимое не смотрим на замерженость
if(!((true == bVertical && nIndex >= 0 && nIndex < nHeight) || (false == bVertical && nIndex >= 0 && nIndex < nWidth))) if(!bIsPromote || !((true == bVertical && nIndex >= 0 && nIndex < nHeight) || (false == bVertical && nIndex >= 0 && nIndex < nWidth)))
{ {
if(null != oPromoteRange){ if(null != to){
var oMergedTo = this.worksheet.mergeManager.get(oPromoteRange.getBBox0()); var oMergedTo = this.worksheet.mergeManager.get(to);
if(oMergedTo.outer.length > 0) if(oMergedTo.outer.length > 0)
oRes = null; oRes = null;
else else
{ {
var oMergedFrom = this.worksheet.mergeManager.get(this.getBBox0()); var oMergedFrom = this.worksheet.mergeManager.get(from);
oRes.oMergedFrom = oMergedFrom; oRes.oMergedFrom = oMergedFrom;
if(oMergedTo.inner.length > 0) if(oMergedTo.inner.length > 0)
{ {
...@@ -7064,8 +7064,8 @@ Range.prototype._canPromote=function(oPromoteRange, nWidth, nHeight, bVertical, ...@@ -7064,8 +7064,8 @@ Range.prototype._canPromote=function(oPromoteRange, nWidth, nHeight, bVertical,
if(oMergedFrom.inner.length > 0) if(oMergedFrom.inner.length > 0)
{ {
//merge области должны иметь одинаковый размер //merge области должны иметь одинаковый размер
var oSizeFrom = this._isSameSizeMerged(this.getBBox0(), oMergedFrom.inner); var oSizeFrom = this._isSameSizeMerged(from, oMergedFrom.inner);
var oSizeTo = this._isSameSizeMerged(oPromoteRange.getBBox0(), oMergedTo.inner); var oSizeTo = this._isSameSizeMerged(to, oMergedTo.inner);
if(!(null != oSizeFrom && null != oSizeTo && oSizeTo.width == oSizeFrom.width && oSizeTo.height == oSizeFrom.height)) if(!(null != oSizeFrom && null != oSizeTo && oSizeTo.width == oSizeFrom.width && oSizeTo.height == oSizeFrom.height))
oRes = null; oRes = null;
} }
...@@ -7077,6 +7077,34 @@ Range.prototype._canPromote=function(oPromoteRange, nWidth, nHeight, bVertical, ...@@ -7077,6 +7077,34 @@ Range.prototype._canPromote=function(oPromoteRange, nWidth, nHeight, bVertical,
} }
return oRes; return oRes;
}; };
Range.prototype.promoteFromTo=function(from, to){
if(!from.isIntersect(to))
{
var bFromWholeCol = (0 == from.c1 && gc_nMaxCol0 == from.c2);
var bFromWholeRow = (0 == from.r1 && gc_nMaxRow0 == from.r2);
var bToWholeCol = (0 == to.c1 && gc_nMaxCol0 == to.c2);
var bToWholeRow = (0 == to.r1 && gc_nMaxRow0 == to.r2);
if(((bFromWholeCol && bToWholeCol) == (bFromWholeCol || bToWholeCol)) && ((bFromWholeRow && bToWholeRow) == (bFromWholeRow || bToWholeRow)))
{
if(to.isOneCell())
{
to = to.clone();
to.setOffsetLast({offsetCol: (from.c2 - from.c1) - (to.c2 - to.c1), offsetRow: (from.r2 - from.r1) - (to.r2 - to.r1)});
}
var bVertical = true;
var nIndex = 1;
//проверяем можно ли осуществить promote
var oCanPromote = this._canPromote(from, to, false, 1, 1, bVertical, nIndex);
if(null != oCanPromote)
{
History.Create_NewPoint();
History.SetSelection(to);
History.SetSelectionRedo(from);
this._promoteFromTo(from, to, false, oCanPromote, false, bVertical, nIndex);
}
}
}
}
Range.prototype.promote=function(bCtrl, bVertical, nIndex){ Range.prototype.promote=function(bCtrl, bVertical, nIndex){
//todo отдельный метод для promote в таблицах и merge в таблицах //todo отдельный метод для promote в таблицах и merge в таблицах
var oBBox = this.bbox; var oBBox = this.bbox;
...@@ -7090,7 +7118,6 @@ Range.prototype.promote=function(bCtrl, bVertical, nIndex){ ...@@ -7090,7 +7118,6 @@ Range.prototype.promote=function(bCtrl, bVertical, nIndex){
if((bWholeCol && bWholeRow) || (true == bVertical && bWholeCol) || (false == bVertical && bWholeRow)) if((bWholeCol && bWholeRow) || (true == bVertical && bWholeCol) || (false == bVertical && bWholeRow))
return; return;
var oPromoteAscRange = null; var oPromoteAscRange = null;
var oPromoteRange = null;
if(0 == nIndex) if(0 == nIndex)
oPromoteAscRange = Asc.Range(oBBox.c1, oBBox.r1, oBBox.c2, oBBox.r2); oPromoteAscRange = Asc.Range(oBBox.c1, oBBox.r1, oBBox.c2, oBBox.r2);
else else
...@@ -7121,13 +7148,10 @@ Range.prototype.promote=function(bCtrl, bVertical, nIndex){ ...@@ -7121,13 +7148,10 @@ Range.prototype.promote=function(bCtrl, bVertical, nIndex){
} }
} }
//проверяем можно ли осуществить promote //проверяем можно ли осуществить promote
oPromoteRange = this.worksheet.getRange3(oPromoteAscRange.r1, oPromoteAscRange.c1, oPromoteAscRange.r2, oPromoteAscRange.c2); var oCanPromote = this._canPromote(oBBox, oPromoteAscRange, true, nWidth, nHeight, bVertical, nIndex);
var oCanPromote = this._canPromote(oPromoteRange, nWidth, nHeight, bVertical, nIndex);
if(null == oCanPromote) if(null == oCanPromote)
return; return;
lockDraw(this.worksheet.workbook);
var recalcArr = [];
History.Create_NewPoint(); History.Create_NewPoint();
var oSelection = History.GetSelection(); var oSelection = History.GetSelection();
if(null != oSelection) if(null != oSelection)
...@@ -7171,95 +7195,172 @@ Range.prototype.promote=function(bCtrl, bVertical, nIndex){ ...@@ -7171,95 +7195,172 @@ Range.prototype.promote=function(bCtrl, bVertical, nIndex){
} }
History.SetSelectionRedo(oSelectionRedo); History.SetSelectionRedo(oSelectionRedo);
} }
//this._promoteFromTo(oBBox, oPromoteAscRange, true, oCanPromote, bCtrl, bVertical, nIndex);
this._promoteFromTo(oBBox, oPromoteAscRange, false, oCanPromote, bCtrl, bVertical, nIndex);
}
Range.prototype._promoteFromTo=function(from, to, bIsPromote, oCanPromote, bCtrl, bVertical, nIndex){
lockDraw(this.worksheet.workbook);
History.StartTransaction(); History.StartTransaction();
var nLastCol = oPromoteAscRange.c2;
if(bWholeRow) var toRange = this.worksheet.getRange3(to.r1, to.c1, to.r2, to.c2);
var fromRange = this.worksheet.getRange3(from.r1, from.c1, from.r2, from.c2);
var nLastCol = from.c2;
if(0 == from.c1 && gc_nMaxCol0 == from.c2)
{ {
var aRowProperties = [];
nLastCol = 0; nLastCol = 0;
this._foreachRowNoEmpty(function(){}, function(cell){ fromRange._foreachRowNoEmpty(function(row){
if(!row.isEmptyProp())
aRowProperties.push({index: from.r1 - this.index, prop: row.getHeightProp(), style: row.getStyle()});
}, function(cell){
var nCurCol0 = cell.oId.getCol0(); var nCurCol0 = cell.oId.getCol0();
if(nCurCol0 > nLastCol0) if(nCurCol0 > nLastCol)
nLastCol0 = nCurCol0; nLastCol = nCurCol0;
}); });
if(aRowProperties.length > 0)
{
var nCurCount = 0;
for(var i = 0, length = aRowProperties.length; i < length; ++i)
{
var propElem = aRowProperties[i];
var nCurIndex = to.r1 + nCurCount * propElem.index;
if(nCurIndex <= to.r2)
{
var row = this.worksheet._getRow(nCurIndex);
if(null != propElem.style)
row.setStyle(propElem.style);
if(null != propElem.prop)
{
var oNewProps = propElem.prop;
var oOldProps = row.getHeightProp();
if(false == Asc.isEqual(oOldProps, oNewProps))
{
row.setHeightProp(oNewProps);
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RowProp, this.worksheet.getId(), new Asc.Range(0, nCurIndex, gc_nMaxCol0, nCurIndex), new UndoRedoData_IndexSimpleProp(nCurIndex, true, oOldProps, oNewProps));
}
}
}
}
}
} }
var nLastRow = oPromoteAscRange.r2; var nLastRow = from.r2;
if(bWholeCol) if(0 == from.r1 && gc_nMaxRow0 == from.r2)
{ {
var aColProperties = [];
nLastRow = 0; nLastRow = 0;
this._foreachColNoEmpty(function(){}, function(cell){ fromRange._foreachColNoEmpty(function(col){
if(!col.isEmpty())
aRowProperties.push({index: from.c1 - this.index, prop: row.getWidthProp(), style: row.getStyle()});
}, function(cell){
var nCurRow0 = cell.oId.getRow0(); var nCurRow0 = cell.oId.getRow0();
if(nCurRow0 > nLastRow) if(nCurRow0 > nLastRow)
nLastRow = nCurRow0; nLastRow = nCurRow0;
}); });
if(aColProperties.length > 0)
{
var nCurCount = 0;
for(var i = 0, length = aColProperties.length; i < length; ++i)
{
var propElem = aColProperties[i];
var nCurIndex = to.c1 + nCurCount * propElem.index;
if(nCurIndex <= to.c2)
{
var col = this.worksheet._getCol(nCurIndex);
if(null != propElem.style)
col.setStyle(propElem.style);
if(null != propElem.prop)
{
var oNewProps = propElem.prop;
var oOldProps = col.getWidthProp();
if(false == oOldProps.isEqual(oNewProps))
{
col.setWidthProp(oNewProps);
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ColProp, this.worksheet.getId(), new Asc.Range(nCurIndex, 0, nCurIndex, gc_nMaxRow0), new UndoRedoData_IndexSimpleProp(nCurIndex, false, oOldProps, oNewProps));
}
}
}
}
}
} }
if(nLastCol != oPromoteAscRange.c2 || nLastRow != oPromoteAscRange.r2) if(nLastCol != from.c2 || nLastRow != from.r2)
{ {
oPromoteRange.setOffsetLast({offsetCol:nLastCol - oPromoteAscRange.c2, offsetRow:nLastRow - oPromoteAscRange.r2}); var offset = {offsetCol:nLastCol - from.c2, offsetRow:nLastRow - from.r2};
oPromoteAscRange = oPromoteRange.getBBox0(); toRange.setOffsetLast(offset);
to = toRange.getBBox0();
fromRange.setOffsetLast(offset);
from = fromRange.getBBox0();
} }
var nWidth = from.c2 - from.c1 + 1;
var nHeight = from.r2 - from.r1 + 1;
//удаляем текст или все в области для заполнения //удаляем текст или все в области для заполнения
if(nIndex >= 0 && ((true == bVertical && nHeight > nIndex) || (false == bVertical && nWidth > nIndex))) if(bIsPromote && nIndex >= 0 && ((true == bVertical && nHeight > nIndex) || (false == bVertical && nWidth > nIndex)))
{ {
//удаляем только текст в области для заполнения //удаляем только текст в области для заполнения
oPromoteRange.cleanText(); toRange.cleanText();
} }
else else
{ {
//удаляем все в области для заполнения //удаляем все в области для заполнения
oPromoteRange.cleanAll(); if(bIsPromote)
toRange.cleanAll();
else
toRange.cleanFormat();
//собираем все данные //собираем все данные
var bReverse = false; var bReverse = false;
if(nIndex < 0) if(nIndex < 0)
bReverse = true; bReverse = true;
var oPromoteHelper = new PromoteHelper(bVertical, bReverse, oBBox); var oPromoteHelper = new PromoteHelper(bVertical, bReverse, from);
this._foreachNoEmpty(function(oCell, nRow0, nCol0,nRowStart0, nColStart0){ fromRange._foreachNoEmpty(function(oCell, nRow0, nCol0, nRowStart0, nColStart0){
if(null != oCell) if(null != oCell)
{ {
var nVal = null; var nVal = null;
var bDelimiter = false; var bDelimiter = false;
var sPrefix = null; var sPrefix = null;
var bDate = false; var bDate = false;
if (!oCell.sFormula) if(bIsPromote)
{ {
var sValue = oCell.getValueWithoutFormat(); if (!oCell.sFormula)
if("" != sValue)
{ {
bDelimiter = true; var sValue = oCell.getValueWithoutFormat();
var nType = oCell.getType(); if("" != sValue)
if(CellValueType.Number == nType || CellValueType.String == nType)
{ {
if(CellValueType.Number == nType) bDelimiter = true;
nVal = sValue - 0; var nType = oCell.getType();
else if(CellValueType.Number == nType || CellValueType.String == nType)
{ {
//если текст заканчивается на цифру тоже используем ее if(CellValueType.Number == nType)
var nEndIndex = sValue.length; nVal = sValue - 0;
for(var k = sValue.length - 1; k >= 0; --k) else
{
var sCurChart = sValue[k];
if('0' <= sCurChart && sCurChart <= '9')
nEndIndex--;
else
break;
}
if(sValue.length != nEndIndex)
{ {
sPrefix = sValue.substring(0, nEndIndex); //если текст заканчивается на цифру тоже используем ее
nVal = sValue.substring(nEndIndex) - 0; var nEndIndex = sValue.length;
for(var k = sValue.length - 1; k >= 0; --k)
{
var sCurChart = sValue[k];
if('0' <= sCurChart && sCurChart <= '9')
nEndIndex--;
else
break;
}
if(sValue.length != nEndIndex)
{
sPrefix = sValue.substring(0, nEndIndex);
nVal = sValue.substring(nEndIndex) - 0;
}
} }
} }
if(null != oCell.xfs && null != oCell.xfs.num && null != oCell.xfs.num.f){
var numFormat = oNumFormatCache.get(oCell.xfs.num.f);
if(numFormat.isDateTimeFormat())
bDate = true;
}
if(null != nVal)
bDelimiter = false;
} }
if(null != oCell.xfs && null != oCell.xfs.num && null != oCell.xfs.num.f){
var numFormat = oNumFormatCache.get(oCell.xfs.num.f);
if(numFormat.isDateTimeFormat())
bDate = true;
}
if(null != nVal)
bDelimiter = false;
} }
else
bDelimiter = true;
} }
else
bDelimiter = true;
oPromoteHelper.add(nRow0 - nRowStart0, nCol0 - nColStart0, nVal, bDelimiter, sPrefix, bDate, oCell); oPromoteHelper.add(nRow0 - nRowStart0, nCol0 - nColStart0, nVal, bDelimiter, sPrefix, bDate, oCell);
} }
}); });
...@@ -7274,37 +7375,37 @@ Range.prototype.promote=function(bCtrl, bVertical, nIndex){ ...@@ -7274,37 +7375,37 @@ Range.prototype.promote=function(bCtrl, bVertical, nIndex){
var nStartRow, nEndRow, nStartCol, nEndCol, nColDx, bRowFirst; var nStartRow, nEndRow, nStartCol, nEndCol, nColDx, bRowFirst;
if(bVertical) if(bVertical)
{ {
nStartRow = oPromoteAscRange.c1; nStartRow = to.c1;
nEndRow = oPromoteAscRange.c2; nEndRow = to.c2;
bRowFirst = false; bRowFirst = false;
if(bReverse) if(bReverse)
{ {
nStartCol = oPromoteAscRange.r2; nStartCol = to.r2;
nEndCol = oPromoteAscRange.r1; nEndCol = to.r1;
nColDx = -1; nColDx = -1;
} }
else else
{ {
nStartCol = oPromoteAscRange.r1; nStartCol = to.r1;
nEndCol = oPromoteAscRange.r2; nEndCol = to.r2;
nColDx = 1; nColDx = 1;
} }
} }
else else
{ {
nStartRow = oPromoteAscRange.r1; nStartRow = to.r1;
nEndRow = oPromoteAscRange.r2; nEndRow = to.r2;
bRowFirst = true; bRowFirst = true;
if(bReverse) if(bReverse)
{ {
nStartCol = oPromoteAscRange.c2; nStartCol = to.c2;
nEndCol = oPromoteAscRange.c1; nEndCol = to.c1;
nColDx = -1; nColDx = -1;
} }
else else
{ {
nStartCol = oPromoteAscRange.c1; nStartCol = to.c1;
nEndCol = oPromoteAscRange.c2; nEndCol = to.c2;
nColDx = 1; nColDx = 1;
} }
} }
...@@ -7327,66 +7428,58 @@ Range.prototype.promote=function(bCtrl, bVertical, nIndex){ ...@@ -7327,66 +7428,58 @@ Range.prototype.promote=function(bCtrl, bVertical, nIndex){
oCopyCell.setStyle(oFromCell.getStyle()); oCopyCell.setStyle(oFromCell.getStyle());
oCopyCell.setType(oFromCell.getType()); oCopyCell.setType(oFromCell.getType());
} }
if(false == bCopy && null != data.nCurValue) if(bIsPromote)
{
var sVal = "";
if(null != data.sPrefix)
sVal += data.sPrefix;
sVal += data.nCurValue;
oCopyCell.setValue(sVal);
}
else if(null != oFromCell)
{ {
//копируем полностью if(false == bCopy && null != data.nCurValue)
if(!oFromCell.formulaParsed){ {
var DataOld = oCopyCell.getValueData(); var sVal = "";
oCopyCell.oValue = oFromCell.oValue.clone(oCopyCell); if(null != data.sPrefix)
var DataNew = oCopyCell.getValueData(); sVal += data.sPrefix;
if(false == DataOld.isEqual(DataNew)) sVal += data.nCurValue;
History.Add(g_oUndoRedoCell, historyitem_Cell_ChangeValue, this.worksheet.getId(), new Asc.Range(oCopyCell.oId.getCol0(), oCopyCell.oId.getRow0(), oCopyCell.oId.getCol0(), oCopyCell.oId.getRow0()), new UndoRedoData_CellSimpleData(oCopyCell.oId.getRow0(), oCopyCell.oId.getCol0(), DataOld, DataNew)); oCopyCell.setValue(sVal);
//todo
// if(oCopyCell.isEmptyTextString())
// this.worksheet._getHyperlink().remove({r1: oCopyCell.oId.getRow0(), c1: oCopyCell.oId.getCol0(), r2: oCopyCell.oId.getRow0(), c2: oCopyCell.oId.getCol0()});
} }
else{ else if(null != oFromCell)
var assemb; {
var _p_ = new parserFormula(oFromCell.sFormula,oCopyCell.getName(),this.worksheet); //копируем полностью
if( _p_.parse() ){ if(!oFromCell.formulaParsed){
assemb = _p_.changeOffset(oCopyCell.getOffset2(oFromCell.getName())).assemble(); var DataOld = oCopyCell.getValueData();
oCopyCell.setValue("="+assemb); oCopyCell.oValue = oFromCell.oValue.clone(oCopyCell);
var DataNew = oCopyCell.getValueData();
if(false == DataOld.isEqual(DataNew))
History.Add(g_oUndoRedoCell, historyitem_Cell_ChangeValue, this.worksheet.getId(), new Asc.Range(oCopyCell.oId.getCol0(), oCopyCell.oId.getRow0(), oCopyCell.oId.getCol0(), oCopyCell.oId.getRow0()), new UndoRedoData_CellSimpleData(oCopyCell.oId.getRow0(), oCopyCell.oId.getCol0(), DataOld, DataNew));
//todo
// if(oCopyCell.isEmptyTextString())
// this.worksheet._getHyperlink().remove({r1: oCopyCell.oId.getRow0(), c1: oCopyCell.oId.getCol0(), r2: oCopyCell.oId.getRow0(), c2: oCopyCell.oId.getCol0()});
}
else{
var assemb;
var _p_ = new parserFormula(oFromCell.sFormula,oCopyCell.getName(),this.worksheet);
if( _p_.parse() ){
assemb = _p_.changeOffset(oCopyCell.getOffset2(oFromCell.getName())).assemble();
oCopyCell.setValue("="+assemb);
}
}
} }
} }
} }
} }
}
} }
var aNodes = this.worksheet.workbook.dependencyFormulas.getInRange( this.worksheet.Id, oPromoteAscRange ); if(bIsPromote)
if(aNodes && aNodes.length > 0)
{ {
for(var i = 0, length = aNodes.length; i < length; ++i) var aNodes = this.worksheet.workbook.dependencyFormulas.getInRange( this.worksheet.Id, to );
if(aNodes && aNodes.length > 0)
{ {
var node = aNodes[i]; for(var i = 0, length = aNodes.length; i < length; ++i)
this.worksheet.workbook.needRecalc.nodes[ node.nodeId ] = [ node.sheetId, node.cellId ]; {
this.worksheet.workbook.needRecalc.length++; var node = aNodes[i];
this.worksheet.workbook.needRecalc.nodes[ node.nodeId ] = [ node.sheetId, node.cellId ];
this.worksheet.workbook.needRecalc.length++;
}
} }
} }
//добавляем замерженые области //добавляем замерженые области
var nShiftHorizontal = 0; var nShiftHorizontal = to.c1 - from.c1;
var nShiftVertical = 0; var nShiftVertical = to.r1 - from.r1;
if(bVertical)
{
if(nIndex < 0)
nShiftVertical = -nHeight;
else
nShiftVertical = nHeight;
}
else
{
if(nIndex < 0)
nShiftHorizontal = -nWidth;
else
nShiftHorizontal = nWidth;
}
var oMergedFrom = oCanPromote.oMergedFrom; var oMergedFrom = oCanPromote.oMergedFrom;
if(null != oMergedFrom && oMergedFrom.all.length > 0) if(null != oMergedFrom && oMergedFrom.all.length > 0)
{ {
...@@ -7400,7 +7493,7 @@ Range.prototype.promote=function(bCtrl, bVertical, nIndex){ ...@@ -7400,7 +7493,7 @@ Range.prototype.promote=function(bCtrl, bVertical, nIndex){
{ {
var oMergedBBox = oMergedFrom.all[i].bbox; var oMergedBBox = oMergedFrom.all[i].bbox;
var oNewMerged = Asc.Range(oMergedBBox.c1 + nCount * nShiftHorizontal, oMergedBBox.r1 + nCount * nShiftVertical, oMergedBBox.c2 + nCount * nShiftHorizontal, oMergedBBox.r2 + nCount * nShiftVertical); var oNewMerged = Asc.Range(oMergedBBox.c1 + nCount * nShiftHorizontal, oMergedBBox.r1 + nCount * nShiftVertical, oMergedBBox.c2 + nCount * nShiftHorizontal, oMergedBBox.r2 + nCount * nShiftVertical);
if(oPromoteAscRange.containsRange(oNewMerged)) if(to.containsRange(oNewMerged))
{ {
this.worksheet.mergeManager.add(oNewMerged, 1); this.worksheet.mergeManager.add(oNewMerged, 1);
bInserted = true; bInserted = true;
...@@ -7408,26 +7501,29 @@ Range.prototype.promote=function(bCtrl, bVertical, nIndex){ ...@@ -7408,26 +7501,29 @@ Range.prototype.promote=function(bCtrl, bVertical, nIndex){
} }
} }
} }
//добавляем ссылки if(bIsPromote)
//не как в Excel поддерживаются ссылки на диапазоны
var oHyperlinks = this.worksheet.hyperlinkManager.get(oBBox);
if(oHyperlinks.inner.length > 0)
{ {
var bInserted = true; //добавляем ссылки
var nCount = 0; //не как в Excel поддерживаются ссылки на диапазоны
while(bInserted) var oHyperlinks = this.worksheet.hyperlinkManager.get(from);
if(oHyperlinks.inner.length > 0)
{ {
bInserted = false; var bInserted = true;
nCount++; var nCount = 0;
for(var i = 0, length = oHyperlinks.inner.length; i < length; i++) while(bInserted)
{ {
var oHyperlink = oHyperlinks.inner[i]; bInserted = false;
var oHyperlinkBBox = oHyperlink.bbox; nCount++;
var oNewHyperlink = Asc.Range(oHyperlinkBBox.c1 + nCount * nShiftHorizontal, oHyperlinkBBox.r1 + nCount * nShiftVertical, oHyperlinkBBox.c2 + nCount * nShiftHorizontal, oHyperlinkBBox.r2 + nCount * nShiftVertical); for(var i = 0, length = oHyperlinks.inner.length; i < length; i++)
if(oPromoteAscRange.containsRange(oNewHyperlink))
{ {
this.worksheet.hyperlinkManager.add(oNewHyperlink, oHyperlink.data.clone()); var oHyperlink = oHyperlinks.inner[i];
bInserted = true; var oHyperlinkBBox = oHyperlink.bbox;
var oNewHyperlink = Asc.Range(oHyperlinkBBox.c1 + nCount * nShiftHorizontal, oHyperlinkBBox.r1 + nCount * nShiftVertical, oHyperlinkBBox.c2 + nCount * nShiftHorizontal, oHyperlinkBBox.r2 + nCount * nShiftVertical);
if(to.containsRange(oNewHyperlink))
{
this.worksheet.hyperlinkManager.add(oNewHyperlink, oHyperlink.data.clone());
bInserted = true;
}
} }
} }
} }
......
...@@ -2220,6 +2220,10 @@ Col.prototype = ...@@ -2220,6 +2220,10 @@ Col.prototype =
this.BestFit = null; this.BestFit = null;
} }
}, },
getStyle : function()
{
return this.xfs;
},
setStyle : function(xfs) setStyle : function(xfs)
{ {
var oldVal = this.xfs; var oldVal = this.xfs;
...@@ -2422,7 +2426,7 @@ Row.prototype = ...@@ -2422,7 +2426,7 @@ Row.prototype =
}, },
isEmpty : function() isEmpty : function()
{ {
if(null != this.xfs || null != this.h || null != this.hd || null != this.CustomHeight) if(!this.isEmptyProp())
return false; return false;
var bEmptyCells = true; var bEmptyCells = true;
for(var i in this.c) for(var i in this.c)
...@@ -2434,6 +2438,10 @@ Row.prototype = ...@@ -2434,6 +2438,10 @@ Row.prototype =
return false; return false;
return true; return true;
}, },
isEmptyProp : function()
{
return null == this.xfs && null == this.h && null == this.hd && null == this.CustomHeight;
},
Remove : function() Remove : function()
{ {
this.ws._removeRow(this.index); this.ws._removeRow(this.index);
...@@ -2495,6 +2503,10 @@ Row.prototype = ...@@ -2495,6 +2503,10 @@ Row.prototype =
this.CustomHeight = otherRow.CustomHeight; this.CustomHeight = otherRow.CustomHeight;
this.hd = otherRow.hd; this.hd = otherRow.hd;
}, },
getStyle : function()
{
return this.xfs;
},
setStyle : function(xfs) setStyle : function(xfs)
{ {
var oldVal = this.xfs; var oldVal = this.xfs;
......
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