Commit 2ec1cbe1 authored by Igor.Zotov's avatar Igor.Zotov Committed by Alexander.Trofimov

copy/paste графических объектов(pp - excel, pp - word, word - pp, excel - pp)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@59823 954022d7-b5bf-4e40-9824-e11837661b57
parent 832dd52a
......@@ -152,7 +152,15 @@
"../../PowerPoint/Editor/Format/GraphicFrame.js",
"../../PowerPoint/api-all.js",
"../../PowerPoint/Build/Log/apiExport.js"
"../../PowerPoint/Build/Log/apiExport.js",
"../../Excel/utils/utils.js",
"../../Excel/model/CellComment.js",
"../../Excel/model/Serialize.js",
"../../Excel/model/WorkbookElems.js",
"../../Excel/model/Workbook.js",
"../../Excel/model/CellInfo.js",
"../../Excel/model/AdvancedOptions.js"
],
"dst": "../../PowerPoint/sdk-all.js",
"externs": [
......
This diff is collapsed.
......@@ -1655,7 +1655,7 @@
_pasteFromBinary: function(worksheet, node, onlyFromLocalStorage, isIntoShape)
{
var base64 = null, base64FromWord = null, t = this;
var base64 = null, base64FromWord = null, base64FromPresentation = null, t = this;
if(onlyFromLocalStorage)
{
......@@ -1680,11 +1680,11 @@
else//find class xslData or docData
{
var classNode;
if(node.children[0] && node.children[0].getAttribute("class") != null && (node.children[0].getAttribute("class").indexOf("xslData;") > -1 || node.children[0].getAttribute("class").indexOf("docData;") > -1))
if(node.children[0] && node.children[0].getAttribute("class") != null && (node.children[0].getAttribute("class").indexOf("xslData;") > -1 || node.children[0].getAttribute("class").indexOf("docData;") > -1 || node.children[0].getAttribute("class").indexOf("pptData;") > -1))
classNode = node.children[0].getAttribute("class");
else if(node.children[0] && node.children[0].children[0] && node.children[0].children[0].getAttribute("class") != null && (node.children[0].children[0].getAttribute("class").indexOf("xslData;") > -1 || node.children[0].children[0].getAttribute("class").indexOf("docData;") > -1))
else if(node.children[0] && node.children[0].children[0] && node.children[0].children[0].getAttribute("class") != null && (node.children[0].children[0].getAttribute("class").indexOf("xslData;") > -1 || node.children[0].children[0].getAttribute("class").indexOf("docData;") > -1 || node.children[0].children[0].getAttribute("class").indexOf("pptData;") > -1))
classNode = node.children[0].children[0].getAttribute("class");
else if(node.children[0] && node.children[0].children[0] && node.children[0].children[0].children[0] && node.children[0].children[0].children[0].getAttribute("class") != null && (node.children[0].children[0].children[0].getAttribute("class").indexOf("xslData;") > -1 || node.children[0].children[0].children[0].getAttribute("class").indexOf("docData;") > -1))
else if(node.children[0] && node.children[0].children[0] && node.children[0].children[0].children[0] && node.children[0].children[0].children[0].getAttribute("class") != null && (node.children[0].children[0].children[0].getAttribute("class").indexOf("xslData;") > -1 || node.children[0].children[0].children[0].getAttribute("class").indexOf("docData;") > -1 || node.children[0].children[0].children[0].getAttribute("class").indexOf("pptData;") > -1))
classNode = node.children[0].children[0].children[0].getAttribute("class");
if( classNode != null ){
......@@ -1698,6 +1698,10 @@
{
base64FromWord = cL[i].split('docData;')[1];
}
else if(cL[i].indexOf("pptData;") > -1)
{
base64FromPresentation = cL[i].split('pptData;')[1];
}
}
}
};
......@@ -1742,11 +1746,130 @@
window.GlobalPasteFlagCounter = 0;
return true;
};
}
else if(base64FromPresentation)
{
window.global_pptx_content_loader.Clear();
var _stream = CreateBinaryReader(base64FromPresentation, 0, base64FromPresentation.length);
var stream = new FileStream(_stream.data, _stream.size);
var p_url = stream.GetString2();
var p_width = stream.GetULong()/100000;
var p_height = stream.GetULong()/100000;
var fonts = [];
var first_string = stream.GetString2();
switch(first_string)
{
case "Content":
{
//пока вставляем через html
return false;
//TODO вставка через бинарник требует переконвертировать контент в вордовский, либо сделать парсинг из презентационных параграфов
var docContent = this.ReadPresentationText(stream, worksheet);
var pasteFromBinaryWord = new Asc.pasteFromBinaryWord(this, worksheet);
pasteFromBinaryWord._paste(worksheet, {DocumentContent: docContent});
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
return true;
}
case "Drawings":
{
var objects = this.ReadPresentationShapes(stream, worksheet);
var arr_shapes = objects.arrShapes;
if(arr_shapes && arr_shapes.length)
{
if(!(window["Asc"]["editor"] && window["Asc"]["editor"].isChartEditor))
t._insertImagesFromBinary(worksheet, {Drawings: arr_shapes}, isIntoShape);
}
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
return true;
}
case "SlideObjects":
{
break;
}
}
}
return false;
},
ReadPresentationShapes: function(stream, worksheet)
{
var loader = new BinaryPPTYLoader();
loader.presentation = worksheet.model;
loader.Start_UseFullUrl();
loader.stream = stream;
//loader.presentation = editor.WordControl.m_oLogicDocument;
//var presentation = editor.WordControl.m_oLogicDocument;
var count = stream.GetULong();
var arr_shapes = [];
var arr_transforms = [];
for(var i = 0; i < count; ++i)
{
//loader.TempMainObject = presentation.Slides[presentation.CurPage];
var style_index = null;
if(!loader.stream.GetBool())
{
if(loader.stream.GetBool())
{
style_index = stream.GetULong();
}
}
var drawing = loader.ReadGraphicObject();
var x = stream.GetULong()/100000;
var y = stream.GetULong()/100000;
var extX = stream.GetULong()/100000;
var extY = stream.GetULong()/100000;
arr_shapes[i] = worksheet.objectRender.createDrawingObject();
arr_shapes[i].graphicObject = drawing;
/*arr_shapes[i].Drawing = drawing;
arr_shapes[i].X = x;
arr_shapes[i].Y = y;
arr_shapes[i].ExtX = extX;
arr_shapes[i].ExtY = extY;*/
}
return {arrShapes: arr_shapes, arrImages: loader.End_UseFullUrl(), arrTransforms: arr_transforms};
},
ReadPresentationText: function(stream, worksheet)
{
var loader = new BinaryPPTYLoader();
loader.Start_UseFullUrl();
loader.stream = stream;
loader.presentation = worksheet.model;
var count = stream.GetULong() / 100000;
//читаем контент, здесь только параграфы
//var newDocContent = new CDocumentContent(shape.txBody, editor.WordControl.m_oDrawingDocument, 0 , 0, 0, 0, false, false);
var elements = [], paragraph, selectedElement;
for(var i = 0; i < count; ++i)
{
loader.stream.Skip2(1); // must be 0
paragraph = loader.ReadParagraph(worksheet.model);
elements.push(paragraph);
}
return elements;
},
_pasteInShape: function(worksheet, node, onlyFromLocalStorage, targetDocContent)
{
targetDocContent.DrawingDocument.m_oLogicDocument = null;
......
......@@ -209,6 +209,17 @@
<script type="text/javascript" src="../../../../OfficeWeb/Word/Math/accent.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Word/Math/borderBox.js"></script>
<!--for copy/paste from excel-->
<script type="text/javascript" src="../../../../OfficeWeb/Excel/utils/utils.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Excel/model/CellComment.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Excel/model/Serialize.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Excel/model/WorkbookElems.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Excel/model/Workbook.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Excel/model/CellInfo.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Excel/model/AdvancedOptions.js"></script>
<script src="../../../../OfficeWeb/Word/Editor/FlowObjects.js"></script>
<script src="../../../../OfficeWeb/Word/Editor/Paragraph.js"></script>
<script src="../../../../OfficeWeb/Word/Editor/Paragraph_Recalculate.js"></script>
......
......@@ -5288,14 +5288,27 @@ function BinaryFileReader(doc, openParams)
bInBlock = true;
//создаем список используемых шрифтов
var AllFonts = {};
this.Document.Numbering.Document_Get_AllFontNames(AllFonts);
if(this.Document.Numbering)
this.Document.Numbering.Document_Get_AllFontNames(AllFonts);
if(this.Document.Styles)
this.Document.Styles.Document_Get_AllFontNames(AllFonts);
for (var Index = 0, Count = aContent.length; Index < Count; Index++)
aContent[Index].Document_Get_AllFontNames(AllFonts);
var aPrepeareFonts = [];
var oDocument = this.Document && this.Document.LogicDocument ? this.Document.LogicDocument : this.Document;
checkThemeFonts(AllFonts, oDocument.theme.themeElements.fontScheme)
var fontScheme;
var m_oLogicDocument = editor.WordControl.m_oLogicDocument;
//для презентаций находим fontScheme
if(m_oLogicDocument && m_oLogicDocument.slideMasters && m_oLogicDocument.slideMasters[0] && m_oLogicDocument.slideMasters[0].Theme && m_oLogicDocument.slideMasters[0].Theme.themeElements)
fontScheme = m_oLogicDocument.slideMasters[0].Theme.themeElements.fontScheme;
else
fontScheme = oDocument.theme.themeElements.fontScheme;
checkThemeFonts(AllFonts, fontScheme);
for (var i in AllFonts)
aPrepeareFonts.push(new CFont(i, 0, "", 0));
......
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