Commit 8056d408 authored by GoshaZotov's avatar GoshaZotov

apply special paste property by cell(cell editor)

parent 9e07e76b
...@@ -71,6 +71,8 @@ ...@@ -71,6 +71,8 @@
this.wrap = true; this.wrap = true;
this.fill = true; this.fill = true;
this.angle = true; this.angle = true;
this.images = true;
} }
SpecialPasteProps.prototype = { SpecialPasteProps.prototype = {
...@@ -92,6 +94,8 @@ ...@@ -92,6 +94,8 @@
this.wrap = true; this.wrap = true;
this.fill = true; this.fill = true;
this.angle = true; this.angle = true;
this.images = true;
}, },
revert: function() revert: function()
{ {
...@@ -108,6 +112,8 @@ ...@@ -108,6 +112,8 @@
this.wrap = null; this.wrap = null;
this.fill = null; this.fill = null;
this.angle = null; this.angle = null;
this.images = null;
}, },
setProps: function(props) setProps: function(props)
{ {
...@@ -115,62 +121,81 @@ ...@@ -115,62 +121,81 @@
{ {
case "formulas": case "formulas":
{ {
//только формулы(или значения)
this.revert();
this.formula = true;
this.val = true;
break;
} }
case "formulasNumberFormating": case "formulasNumberFormating":
{ {
//только формулы(или значения) и числовой формат
this.revert();
this.formula = true;
this.numFormat = true;
this.val = true;
break;
} }
case "keepSourceFormating": case "keepSourceFormating":
{ {
//формулы и формат
break;
} }
case "noBorders": case "noBorders":
{ {
//всё кроме бордеров
this.borders = null; this.borders = null;
} break;
case "keepSourceColumnWidth":
{
} }
case "keepSourceColumnWidths": case "keepSourceColumnWidths":
{ {
break;
} }
case "transpose": case "transpose":
{ {
break;
} }
case "values": case "values":
{ {
//только значения(вместо формул также вставляются значения)
this.revert(); this.revert();
this.val = true; this.val = true;
} }
case "valuesSourceFormating": case "valuesNumberFormating":
{ {
this.revert();
this.val = true;
this.numFormat = true;
break;
} }
case "valuesNumberFormating": case "valuesSourceFormating":
{ {
//все кроме формул
this.formula = null;
break;
} }
case "formating": case "formating":
{ {
this.formula = null;
break;
} }
case "pasteLink": case "pasteLink":
{ {
this.revert();
break;
} }
case "picture": case "picture":
{ {
break;
} }
case "linkedPicture": case "linkedPicture":
{ {
break;
} }
} }
......
...@@ -8889,7 +8889,8 @@ ...@@ -8889,7 +8889,8 @@
var api = asc["editor"]; var api = asc["editor"];
var isEndTransaction = false; var isEndTransaction = false;
if ( pasteContent.props.addImagesFromWord && pasteContent.props.addImagesFromWord.length != 0 && !(window["Asc"]["editor"] && window["Asc"]["editor"].isChartEditor) ) var imagesFromWord = pasteContent.props.addImagesFromWord;
if ( imagesFromWord && imagesFromWord.length != 0 && !(window["Asc"]["editor"] && window["Asc"]["editor"].isChartEditor) && specialPasteProps.images)
{ {
var oObjectsForDownload = AscCommon.GetObjectsForImageDownload( pasteContent.props._aPastedImages ); var oObjectsForDownload = AscCommon.GetObjectsForImageDownload( pasteContent.props._aPastedImages );
...@@ -9132,7 +9133,7 @@ ...@@ -9132,7 +9133,7 @@
} }
//apply props by cell //apply props by cell
t._setPastedDataByCurrentRange(range, pastedRangeProps); t._setPastedDataByCurrentRange(range, pastedRangeProps, null, specialPasteProps);
}; };
for (var autoR = 0; autoR < maxARow; ++autoR) { for (var autoR = 0; autoR < maxARow; ++autoR) {
...@@ -9162,6 +9163,9 @@ ...@@ -9162,6 +9163,9 @@
lastSelection.r2 = arn.r2; lastSelection.r2 = arn.r2;
var arnFor = [arn, arrFormula]; var arnFor = [arn, arrFormula];
var _clipboard = window["Asc"]["editor"].wb.clipboard;
_clipboard.specialPasteProps = null;
return arnFor; return arnFor;
}; };
...@@ -9305,7 +9309,7 @@ ...@@ -9305,7 +9309,7 @@
} }
}; };
var checkMerge = function(range, curMerge, nRow, nCol, rowDiff, colDiff) var checkMerge = function(range, curMerge, nRow, nCol, rowDiff, colDiff, pastedRangeProps)
{ {
var isMerged = false; var isMerged = false;
...@@ -9328,8 +9332,7 @@ ...@@ -9328,8 +9332,7 @@
offsetRow = gc_nMaxRow0 - nRow; offsetRow = gc_nMaxRow0 - nRow;
} }
range.setOffsetLast({offsetCol: offsetCol, offsetRow: offsetRow}); pastedRangeProps.offsetLast = {offsetCol: offsetCol, offsetRow: offsetRow};
range.merge(c_oAscMergeOptions.Merge);
mergeArr[n] = { mergeArr[n] = {
r1: curMerge.r1 + arn.r1 - activeCellsPasteFragment.r1 + rowDiff, r1: curMerge.r1 + arn.r1 - activeCellsPasteFragment.r1 + rowDiff,
...@@ -9343,11 +9346,7 @@ ...@@ -9343,11 +9346,7 @@
else else
{ {
if (!isMerged) { if (!isMerged) {
range.setOffsetLast({ pastedRangeProps.offsetLast = {offsetCol: isMergedFirstCell.c2 - isMergedFirstCell.c1, offsetRow: isMergedFirstCell.r2 - isMergedFirstCell.r1};
offsetCol: (isMergedFirstCell.c2 - isMergedFirstCell.c1),
offsetRow: (isMergedFirstCell.r2 - isMergedFirstCell.r1)
});
range.merge(c_oAscMergeOptions.Merge);
mergeArr[n] = { mergeArr[n] = {
r1: isMergedFirstCell.r1, r1: isMergedFirstCell.r1,
...@@ -9372,7 +9371,7 @@ ...@@ -9372,7 +9371,7 @@
} }
//merge //merge
checkMerge(range, curMerge, nRow, nCol, rowDiff, colDiff); checkMerge(range, curMerge, nRow, nCol, rowDiff, colDiff, pastedRangeProps);
//set style //set style
if (!isOneMerge) { if (!isOneMerge) {
...@@ -9399,7 +9398,7 @@ ...@@ -9399,7 +9398,7 @@
pastedRangeProps.alignHorizontal = newVal.getAlignHorizontal(); pastedRangeProps.alignHorizontal = newVal.getAlignHorizontal();
//borders //borders
var fullBorders = newVal.getBorderFull(); var fullBorders = newVal.getBorderFull();
if (range.bbox.c2 !== range.bbox.c1 && curMerge && fullBorders) { if (pastedRangeProps.offsetLast && pastedRangeProps.offsetLast.offsetCol > 0 && curMerge && fullBorders) {
//для мерженных ячеек, правая границу //для мерженных ячеек, правая границу
var endMergeCell = val.getCell3(pasteRow, curMerge.c2); var endMergeCell = val.getCell3(pasteRow, curMerge.c2);
var fullBordersEndMergeCell = endMergeCell.getBorderFull(); var fullBordersEndMergeCell = endMergeCell.getBorderFull();
...@@ -9421,7 +9420,7 @@ ...@@ -9421,7 +9420,7 @@
//apply props by cell //apply props by cell
var formulaProps = {firstRange: firstRange, arrFormula: arrFormula, tablesMap: tablesMap, newVal: newVal, isOneMerge: isOneMerge}; var formulaProps = {firstRange: firstRange, arrFormula: arrFormula, tablesMap: tablesMap, newVal: newVal, isOneMerge: isOneMerge};
t._setPastedDataByCurrentRange(range, pastedRangeProps, formulaProps); t._setPastedDataByCurrentRange(range, pastedRangeProps, formulaProps, specialPasteProps);
}; };
for (var autoR = 0; autoR < maxARow; ++autoR) { for (var autoR = 0; autoR < maxARow; ++autoR) {
...@@ -9462,10 +9461,13 @@ ...@@ -9462,10 +9461,13 @@
t.isChanged = true; t.isChanged = true;
var arnFor = [arn, arrFormula]; var arnFor = [arn, arrFormula];
var _clipboard = window["Asc"]["editor"].wb.clipboard;
_clipboard.specialPasteProps = null;
return arnFor; return arnFor;
}; };
WorksheetView.prototype._setPastedDataByCurrentRange = function(range, rangeStyle, formulaProps) WorksheetView.prototype._setPastedDataByCurrentRange = function(range, rangeStyle, formulaProps, specialPasteProps)
{ {
var t = this; var t = this;
...@@ -9551,15 +9553,15 @@ ...@@ -9551,15 +9553,15 @@
} }
}; };
if(rangeStyle.cellStyle) if(rangeStyle.cellStyle && specialPasteProps.cellStyle)
{ {
range.setCellStyle(rangeStyle.cellStyle); range.setCellStyle(rangeStyle.cellStyle);
} }
if(rangeStyle.val) if(rangeStyle.val && specialPasteProps.val)
{ {
range.setValue(rangeStyle.val); range.setValue(rangeStyle.val);
} }
if(rangeStyle.numFormat) if(rangeStyle.numFormat && specialPasteProps.cellStyle)
{ {
range.setNumFormat(rangeStyle.numFormat); range.setNumFormat(rangeStyle.numFormat);
} }
...@@ -9570,7 +9572,7 @@ ...@@ -9570,7 +9572,7 @@
setFormula(newVal, firstRange, range); setFormula(newVal, firstRange, range);
} }
if(rangeStyle.font) if(rangeStyle.font && specialPasteProps.font)
{ {
range.setFont(rangeStyle.font); range.setFont(rangeStyle.font);
} }
...@@ -9578,47 +9580,44 @@ ...@@ -9578,47 +9580,44 @@
{ {
range.setValue2(rangeStyle.value2); range.setValue2(rangeStyle.value2);
} }
if(rangeStyle.alignVertical) if(rangeStyle.alignVertical && specialPasteProps.alignVertical)
{ {
range.setAlignVertical(rangeStyle.alignVertical); range.setAlignVertical(rangeStyle.alignVertical);
} }
if(rangeStyle.alignHorizontal) if(rangeStyle.alignHorizontal && specialPasteProps.alignHorizontal)
{ {
range.setAlignHorizontal(rangeStyle.alignHorizontal); range.setAlignHorizontal(rangeStyle.alignHorizontal);
} }
if(rangeStyle.fontSize) if(rangeStyle.fontSize && specialPasteProps.fontSize)
{ {
range.setFontsize(rangeStyle.fontSize); range.setFontsize(rangeStyle.fontSize);
} }
if(rangeStyle.offsetLast) if(rangeStyle.offsetLast && specialPasteProps.merge)
{ {
range.setOffsetLast(rangeStyle.offsetLast); range.setOffsetLast(rangeStyle.offsetLast);
}
if(rangeStyle.merge)
{
range.merge(rangeStyle.merge); range.merge(rangeStyle.merge);
} }
if(rangeStyle.borders) if(rangeStyle.borders && specialPasteProps.borders)
{ {
range.setBorderSrc(rangeStyle.borders); range.setBorderSrc(rangeStyle.borders);
} }
if(rangeStyle.bordersFull) if(rangeStyle.bordersFull && specialPasteProps.borders)
{ {
range.setBorder(rangeStyle.bordersFull); range.setBorder(rangeStyle.bordersFull);
} }
if(rangeStyle.wrap) if(rangeStyle.wrap && specialPasteProps.wrap)
{ {
range.setWrap(rangeStyle.wrap); range.setWrap(rangeStyle.wrap);
} }
if(rangeStyle.fill) if(rangeStyle.fill && specialPasteProps.fill)
{ {
range.setFill(rangeStyle.fill); range.setFill(rangeStyle.fill);
} }
if(rangeStyle.angle) if(rangeStyle.angle && specialPasteProps.angle)
{ {
range.setAngle(rangeStyle.angle); range.setAngle(rangeStyle.angle);
} }
if (rangeStyle.hyperLink) if (rangeStyle.hyperLink && specialPasteProps.hyperlink)
{ {
var _link = rangeStyle.hyperLink.hyperLink; var _link = rangeStyle.hyperLink.hyperLink;
var newHyperlink = new AscCommonExcel.Hyperlink(); var newHyperlink = new AscCommonExcel.Hyperlink();
...@@ -9634,7 +9633,7 @@ ...@@ -9634,7 +9633,7 @@
newHyperlink.Tooltip = rangeStyle.hyperLink.toolTip; newHyperlink.Tooltip = rangeStyle.hyperLink.toolTip;
range.setHyperlink(newHyperlink); range.setHyperlink(newHyperlink);
} }
if (rangeStyle.hyperlinkObj) if (rangeStyle.hyperlinkObj && specialPasteProps.hyperlink)
{ {
rangeStyle.hyperlinkObj.Ref = range; rangeStyle.hyperlinkObj.Ref = range;
range.setHyperlink(rangeStyle.hyperlinkObj, true); range.setHyperlink(rangeStyle.hyperlinkObj, true);
......
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