Commit 2874c966 authored by GoshaZotov's avatar GoshaZotov

for copy/paste into chart title

parent 97cacc45
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
var c_oAscMaxCellOrCommentLength = AscCommon.c_oAscMaxCellOrCommentLength; var c_oAscMaxCellOrCommentLength = AscCommon.c_oAscMaxCellOrCommentLength;
var doc = window.document; var doc = window.document;
var copyPasteUseBinary = true; var copyPasteUseBinary = true;
var CopyPasteCorrectString = AscCommon.CopyPasteCorrectString; var CopyPasteCorrectString = AscCommon.CopyPasteCorrectString;
function number2color(n) { function number2color(n) {
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
/** @constructor */ /** @constructor */
function Clipboard() function Clipboard()
{ {
this.copyProcessor = new CopyProcessorExcel(); this.copyProcessor = new CopyProcessorExcel();
this.pasteProcessor = new PasteProcessorExcel(); this.pasteProcessor = new PasteProcessorExcel();
...@@ -837,19 +837,15 @@ ...@@ -837,19 +837,15 @@
_pasteFromBinaryWord: function(worksheet, base64, isIntoShape) _pasteFromBinaryWord: function(worksheet, base64, isIntoShape)
{ {
var pasteData = this.ReadFromBinaryWord(base64, worksheet); var pasteData = this.ReadFromBinaryWord(base64, worksheet);
var oPasteFromBinaryWord = new pasteFromBinaryWord(this, worksheet);
//insert binary from word into SHAPE //insert binary from word into SHAPE
if(isIntoShape) if(isIntoShape)
{ {
var insertContent = new CSelectedContent(); this._insertBinaryIntoShapeContent(worksheet, pasteData.content, true);
var target_doc_content = isIntoShape;
insertContent.Elements = this._convertBeforeInsertIntoShapeContent(pasteData.content, true);
this._insertSelectedContentIntoShapeContent(worksheet, insertContent, target_doc_content);
} }
else else
{ {
var oPasteFromBinaryWord = new pasteFromBinaryWord(this, worksheet);
oPasteFromBinaryWord._paste(worksheet, pasteData); oPasteFromBinaryWord._paste(worksheet, pasteData);
} }
...@@ -874,20 +870,16 @@ ...@@ -874,20 +870,16 @@
{ {
case "Content": case "Content":
{ {
var docContent = this.ReadPresentationText(stream, worksheet, isIntoShape);
if(isIntoShape) if(isIntoShape)
{ {
var pasteData = this.ReadPresentationText(stream, worksheet); this._insertBinaryIntoShapeContent(worksheet, docContent)
var insertContent = new CSelectedContent();
var target_doc_content = isIntoShape;
insertContent.Elements = this._convertBeforeInsertIntoShapeContent(pasteData);
this._insertSelectedContentIntoShapeContent(worksheet, insertContent, target_doc_content);
return true; return true;
} }
else else
{ {
var docContent = this.ReadPresentationText(stream, worksheet);
var oPasteFromBinaryWord = new pasteFromBinaryWord(this, worksheet); var oPasteFromBinaryWord = new pasteFromBinaryWord(this, worksheet);
var oTempDrawingDocument = worksheet.model.DrawingDocument; var oTempDrawingDocument = worksheet.model.DrawingDocument;
...@@ -956,7 +948,24 @@ ...@@ -956,7 +948,24 @@
return false; return false;
}, },
_convertBeforeInsertIntoShapeContent: function(content, isConvertToPPTX) _insertBinaryIntoShapeContent: function(worksheet, content, isConvertToPPTX)
{
History.Create_NewPoint();
History.StartTransaction();
//ещё раз вызваем getTargetDocContent с флагом true после создания точки в истории(getTargetDocContent добавляет данные в историю)
var isIntoShape = worksheet.objectRender.controller.getTargetDocContent(true);
var insertContent = new CSelectedContent();
var target_doc_content = isIntoShape;
insertContent.Elements = this._convertBeforeInsertIntoShapeContent(worksheet, content, isConvertToPPTX, target_doc_content);
this._insertSelectedContentIntoShapeContent(worksheet, insertContent, target_doc_content);
History.EndTransaction();
},
_convertBeforeInsertIntoShapeContent: function(worksheet, content, isConvertToPPTX, target_doc_content)
{ {
var elements = [], selectedElement, element; var elements = [], selectedElement, element;
...@@ -969,7 +978,8 @@ ...@@ -969,7 +978,8 @@
{ {
if(isConvertToPPTX) if(isConvertToPPTX)
{ {
selectedElement.Element = AscFormat.ConvertParagraphToPPTX(element);
selectedElement.Element = AscFormat.ConvertParagraphToPPTX(element, worksheet.model.DrawingDocument, target_doc_content);
} }
else else
{ {
...@@ -996,6 +1006,8 @@ ...@@ -996,6 +1006,8 @@
paragraph.Check_NearestPos(NearPos); paragraph.Check_NearestPos(NearPos);
target_doc_content.Insert_Content(selectedContent, NearPos); target_doc_content.Insert_Content(selectedContent, NearPos);
worksheet.objectRender.controller.cursorMoveRight(false, false)
var oTargetTextObject = AscFormat.getTargetTextObject(worksheet.objectRender.controller); var oTargetTextObject = AscFormat.getTargetTextObject(worksheet.objectRender.controller);
oTargetTextObject && oTargetTextObject.checkExtentsByDocContent && oTargetTextObject.checkExtentsByDocContent(); oTargetTextObject && oTargetTextObject.checkExtentsByDocContent && oTargetTextObject.checkExtentsByDocContent();
worksheet.objectRender.controller.startRecalculate(); worksheet.objectRender.controller.startRecalculate();
...@@ -1695,7 +1707,7 @@ ...@@ -1695,7 +1707,7 @@
return {arrShapes: arr_shapes, arrImages: loader.End_UseFullUrl(), arrTransforms: arr_transforms}; return {arrShapes: arr_shapes, arrImages: loader.End_UseFullUrl(), arrTransforms: arr_transforms};
}, },
ReadPresentationText: function(stream, worksheet) ReadPresentationText: function(stream, worksheet, cDocumentContent)
{ {
History.TurnOff(); History.TurnOff();
...@@ -1712,7 +1724,7 @@ ...@@ -1712,7 +1724,7 @@
for(var i = 0; i < count; ++i) for(var i = 0; i < count; ++i)
{ {
loader.stream.Skip2(1); // must be 0 loader.stream.Skip2(1); // must be 0
paragraph = loader.ReadParagraph(worksheet.model); paragraph = loader.ReadParagraph(cDocumentContent);
elements.push(paragraph); elements.push(paragraph);
} }
......
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