Commit 5e7f5ded authored by Sergey Luzyanin's avatar Sergey Luzyanin

fix Bug 33863

parent 3a09861e
...@@ -1124,7 +1124,10 @@ ...@@ -1124,7 +1124,10 @@
_convertBeforeInsertIntoShapeContent: function(worksheet, content, isConvertToPPTX, target_doc_content) _convertBeforeInsertIntoShapeContent: function(worksheet, content, isConvertToPPTX, target_doc_content)
{ {
var elements = [], selectedElement, element; var elements = [], selectedElement, element;
var bRemoveHyperlink = false;
if(target_doc_content && target_doc_content.Is_ChartTitleContent && target_doc_content.Is_ChartTitleContent()){
bRemoveHyperlink = true;
}
for(var i = 0; i < content.length; i++) for(var i = 0; i < content.length; i++)
{ {
selectedElement = new CSelectedElement(); selectedElement = new CSelectedElement();
...@@ -1132,7 +1135,7 @@ ...@@ -1132,7 +1135,7 @@
if(type_Paragraph === element.GetType())//paragraph if(type_Paragraph === element.GetType())//paragraph
{ {
selectedElement.Element = AscFormat.ConvertParagraphToPPTX(element, worksheet.model.DrawingDocument, target_doc_content, true); selectedElement.Element = AscFormat.ConvertParagraphToPPTX(element, worksheet.model.DrawingDocument, target_doc_content, true, bRemoveHyperlink);
elements.push(selectedElement); elements.push(selectedElement);
} }
else if(type_Table === element.GetType())//table else if(type_Table === element.GetType())//table
...@@ -1143,7 +1146,7 @@ ...@@ -1143,7 +1146,7 @@
for(var j = 0; j < paragraphs.length; j++) for(var j = 0; j < paragraphs.length; j++)
{ {
selectedElement = new CSelectedElement(); selectedElement = new CSelectedElement();
selectedElement.Element = AscFormat.ConvertParagraphToPPTX(paragraphs[j], worksheet.model.DrawingDocument, target_doc_content); selectedElement.Element = AscFormat.ConvertParagraphToPPTX(paragraphs[j], worksheet.model.DrawingDocument, target_doc_content, true, bRemoveHyperlink);
elements.push(selectedElement); elements.push(selectedElement);
} }
} }
......
...@@ -425,6 +425,14 @@ ...@@ -425,6 +425,14 @@
return false; return false;
}; };
CDrawingDocContent.prototype.Is_ChartTitleContent = function(){
if(this.Parent instanceof AscFormat.CTextBody &&
this.Parent.parent instanceof AscFormat.CTitle){
return true;
}
return false;
};
CDrawingDocContent.prototype.Selection_Draw_Page = function(PageIndex){ CDrawingDocContent.prototype.Selection_Draw_Page = function(PageIndex){
var CurPage = PageIndex; var CurPage = PageIndex;
if (CurPage < 0 || CurPage >= this.Pages.length) if (CurPage < 0 || CurPage >= this.Pages.length)
......
...@@ -261,7 +261,7 @@ function CopyRunToPPTX(Run, Paragraph, bHyper) ...@@ -261,7 +261,7 @@ function CopyRunToPPTX(Run, Paragraph, bHyper)
return NewRun; return NewRun;
} }
function ConvertParagraphToPPTX(paragraph, drawingDocument, newParent, bIsAddMath) function ConvertParagraphToPPTX(paragraph, drawingDocument, newParent, bIsAddMath, bRemoveHyperlink)
{ {
var _drawing_document = isRealObject(drawingDocument) ? drawingDocument : paragraph.DrawingDocument; var _drawing_document = isRealObject(drawingDocument) ? drawingDocument : paragraph.DrawingDocument;
var _new_parent = isRealObject(newParent) ? newParent : paragraph.Parent; var _new_parent = isRealObject(newParent) ? newParent : paragraph.Parent;
...@@ -308,9 +308,23 @@ function ConvertParagraphToPPTX(paragraph, drawingDocument, newParent, bIsAddMat ...@@ -308,9 +308,23 @@ function ConvertParagraphToPPTX(paragraph, drawingDocument, newParent, bIsAddMat
new_paragraph.Internal_Content_Add(new_paragraph.Content.length, CopyRunToPPTX(Item, new_paragraph), false); new_paragraph.Internal_Content_Add(new_paragraph.Content.length, CopyRunToPPTX(Item, new_paragraph), false);
} }
else if(Item.Type === para_Hyperlink) else if(Item.Type === para_Hyperlink)
{
if(bRemoveHyperlink === true)
{
for(var j = 0; j < Item.Content.length; ++j)
{
if(Item.Content[j].Type === para_Run)
{
new_paragraph.Internal_Content_Add(new_paragraph.Content.length, CopyRunToPPTX(Item.Content[j], new_paragraph), false);
}
}
}
else
{ {
new_paragraph.Internal_Content_Add(new_paragraph.Content.length, ConvertHyperlinkToPPTX(Item, new_paragraph), false); new_paragraph.Internal_Content_Add(new_paragraph.Content.length, ConvertHyperlinkToPPTX(Item, new_paragraph), false);
} }
}
else if(true === bIsAddMath && Item.Type === para_Math) else if(true === bIsAddMath && Item.Type === para_Math)
{ {
new_paragraph.Internal_Content_Add(new_paragraph.Content.length, Item.Copy(), false); new_paragraph.Internal_Content_Add(new_paragraph.Content.length, Item.Copy(), false);
......
...@@ -2501,7 +2501,7 @@ PasteProcessor.prototype = ...@@ -2501,7 +2501,7 @@ PasteProcessor.prototype =
{ {
if(type_Paragraph === aContent.content[i].Get_Type()) if(type_Paragraph === aContent.content[i].Get_Type())
{ {
newContent.push(AscFormat.ConvertParagraphToPPTX(aContent.content[i], this.oDocument.DrawingDocument, this.oDocument)); newContent.push(AscFormat.ConvertParagraphToPPTX(aContent.content[i], this.oDocument.DrawingDocument, this.oDocument, false, true));
} }
} }
...@@ -2587,7 +2587,7 @@ PasteProcessor.prototype = ...@@ -2587,7 +2587,7 @@ PasteProcessor.prototype =
element.Get_AllDrawingObjects(drawings); element.Get_AllDrawingObjects(drawings);
if(type_Paragraph == element.GetType())//paragraph if(type_Paragraph == element.GetType())//paragraph
{ {
selectedElement.Element = AscFormat.ConvertParagraphToPPTX(element, null, null, true); selectedElement.Element = AscFormat.ConvertParagraphToPPTX(element, null, null, true, false);
elements.push(selectedElement); elements.push(selectedElement);
} }
else if(type_Table == element.GetType())//table else if(type_Table == element.GetType())//table
...@@ -3879,7 +3879,7 @@ PasteProcessor.prototype = ...@@ -3879,7 +3879,7 @@ PasteProcessor.prototype =
{ {
if(cDocumentContent.Content[n] instanceof Paragraph) if(cDocumentContent.Content[n] instanceof Paragraph)
{ {
cDocumentContent.Content[nIndex] = AscFormat.ConvertParagraphToPPTX(cDocumentContent.Content[nIndex]); cDocumentContent.Content[nIndex] = AscFormat.ConvertParagraphToPPTX(cDocumentContent.Content[nIndex], null, null, true, false);
++nIndex; ++nIndex;
} }
......
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