Commit 00e903fe authored by Igor.Zotov's avatar Igor.Zotov Committed by Alexander.Trofimov

вставка html в автофигуру, добавлен wordcopypaste.js в excel, переименованы функции

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56322 954022d7-b5bf-4e40-9824-e11837661b57
parent 37b07bc7
......@@ -2566,7 +2566,7 @@ function Editor_Paste_Exec(api, pastebin, nodeDisplay)
function trimString( str ){
return str.replace(/^\s+|\s+$/g, '') ;
};
function PasteProcessor(api, bUploadImage, bUploadFonts, bNested)
function PasteProcessor(api, bUploadImage, bUploadFonts, bNested, pasteInExcel)
{
this.oRootNode = null;
this.api = api;
......@@ -2582,6 +2582,8 @@ function PasteProcessor(api, bUploadImage, bUploadFonts, bNested)
this.oImages = {};
this.aContent = [];
this.pasteInExcel = pasteInExcel;
//��� ������� ������ � ������, ��� ����������� �� word � chrome ���������� ������ ������� ��� <p>
this.bIgnoreNoBlockText = false;
......@@ -4464,7 +4466,7 @@ PasteProcessor.prototype =
}
var oDocument = this.oDocument;
//Heading
if(null != pNoHtmlPr.hLevel)
if(null != pNoHtmlPr.hLevel && oDocument.Styles)
Para.Style_Add(oDocument.Styles.Get_Default_Heading(pNoHtmlPr.hLevel));
var pPr = Para.Pr;
......@@ -4684,7 +4686,7 @@ PasteProcessor.prototype =
NumId = PrevNumPr.NumId;
}
}
if(null == NumId)
if(null == NumId && this.pasteInExcel !== true)
{
//������� ����� ������
NumId = this.oLogicDocument.Numbering.Create_AbstractNum();
......@@ -4744,7 +4746,8 @@ PasteProcessor.prototype =
}
}
}
Para.Numbering_Add( NumId, 0 );
if(this.pasteInExcel !== true)
Para.Numbering_Add( NumId, 0 );
}
else
{
......@@ -5701,7 +5704,7 @@ PasteProcessor.prototype =
return bAddParagraph;
}
var sNodeName = node.nodeName.toLowerCase();
if("table" == sNodeName)
if("table" == sNodeName && this.pasteInExcel !== true)
{
if(g_bIsDocumentCopyPaste)
{
......@@ -5749,7 +5752,7 @@ PasteProcessor.prototype =
}
}
if("img" == sNodeName)
if("img" == sNodeName && this.pasteInExcel !== true)
{
if(g_bIsDocumentCopyPaste)
{
......
......@@ -1346,12 +1346,12 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
// Какая-то непонятная заглушка, чтобы не падало в ipad
if (this.isMobileVersion) {
window.USER_AGENT_SAFARI_MACOS = false;
PASTE_ELEMENT_ID = "wrd_pastebin";
ELEMENT_DISPAY_STYLE = "none";
PASTE_ELEMENT_ID2 = "wrd_pastebin";
ELEMENT_DISPAY_STYLE2 = "none";
}
if (window.USER_AGENT_SAFARI_MACOS)
setInterval(SafariIntervalFocus, 10);
setInterval(SafariIntervalFocus2, 10);
},
_onGetEditorPermissions: function(response) {
......
......@@ -96,6 +96,8 @@
<script type="text/javascript" src="../../../../OfficeWeb/Common/FontsFreeType/font_engine.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Common/FontsFreeType/FontFile.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Common/FontsFreeType/FontManager.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Common/wordcopypaste.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Word/Drawing/HatchPattern.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Word/Drawing/WorkEvents.js"></script>
......
......@@ -187,11 +187,11 @@
var found = true;
if (!t.element) {
t.element = doc.getElementById(COPY_ELEMENT_ID);
t.element = doc.getElementById(COPY_ELEMENT_ID2);
if (!t.element) {found = false; t.element = doc.createElement("DIV");}
}
t.element.id = COPY_ELEMENT_ID;
t.element.id = COPY_ELEMENT_ID2;
t.element.setAttribute("class", COPYPASTE_ELEMENT_CLASS);
t.element.style.position = "absolute";
// Если сделать width маленьким, то параграф будет постоянно переноситься по span
......@@ -202,7 +202,7 @@
t.element.style.height = '100px';
t.element.style.overflow = 'hidden';
t.element.style.zIndex = -1000;
t.element.style.display = ELEMENT_DISPAY_STYLE;
t.element.style.display = ELEMENT_DISPAY_STYLE2;
t.element.setAttribute("contentEditable", true);
if (!found) {doc.body.appendChild(t.element);}
......@@ -228,7 +228,7 @@
t.elementText.style.overflow = 'hidden';
t.elementText.style.zIndex = -1000;
//if(AscBrowser.isIE)
t.elementText.style.display = ELEMENT_DISPAY_STYLE;
t.elementText.style.display = ELEMENT_DISPAY_STYLE2;
t.elementText.setAttribute("contentEditable", true);
if (!foundText) {doc.body.appendChild(t.elementText);}
......@@ -290,8 +290,8 @@
this.lStorage.htmlInShape = text;
else
{
var fullUrl = this._getUseFullUrl();
window.global_pptx_content_writer.Start_UseFullUrl(fullUrl);
var fullUrl = this._getUseFullUrl();
window.global_pptx_content_writer.Start_UseFullUrl(fullUrl);
var oBinaryFileWriter = new Asc.BinaryFileWriter(worksheet.model.workbook, worksheet.activeRange);
var sBase64 = oBinaryFileWriter.Write();
......@@ -304,7 +304,7 @@
$(this.element.children[0]).addClass("xslData;" + sBase64);
//for buttons copy/paste
this.lStorage = sBase64;
this.lStorage = sBase64;
window.global_pptx_content_writer.End_UseFullUrl()
}
......@@ -621,7 +621,7 @@
window.setTimeout(
function() {
// отменяем возможность выделения
t.element.style.display = ELEMENT_DISPAY_STYLE;
t.element.style.display = ELEMENT_DISPAY_STYLE2;
doc.body.style.MozUserSelect = "none";
doc.body.style["-khtml-user-select"] = "none";
doc.body.style["-o-user-select"] = "none";
......@@ -636,7 +636,7 @@
}
}
t.elementText.style.display = ELEMENT_DISPAY_STYLE;
t.elementText.style.display = ELEMENT_DISPAY_STYLE2;
var textInsert = t.elementText.value;
if(isOnlyLocalBufferSafari && navigator.userAgent.toLowerCase().indexOf('safari') > -1 && navigator.userAgent.toLowerCase().indexOf('mac') && t.lStorageText)
textInsert = t.lStorageText;
......@@ -848,10 +848,10 @@
if(!isTruePaste)
t._editorPasteExec(worksheet, pastebin);
pastebin.style.display = ELEMENT_DISPAY_STYLE;
pastebin.style.display = ELEMENT_DISPAY_STYLE2;
if(AscBrowser.isIE)
pastebin.style.display = ELEMENT_DISPAY_STYLE;
pastebin.style.display = ELEMENT_DISPAY_STYLE2;
if (callback && callback.call) {callback();}
};
......@@ -866,10 +866,10 @@
{
//var oWordControl = api.WordControl;
var t = this;
var pastebin = document.getElementById(PASTE_ELEMENT_ID);
var pastebin = document.getElementById(PASTE_ELEMENT_ID2);
if(!pastebin){
pastebin = document.createElement("div");
pastebin.setAttribute( 'id', PASTE_ELEMENT_ID );
pastebin.setAttribute( 'id', PASTE_ELEMENT_ID2 );
pastebin.setAttribute( 'class', COPYPASTE_ELEMENT_CLASS );
pastebin.style.position = 'absolute';
pastebin.style.top = '100px';
......@@ -1118,7 +1118,7 @@
bExist = true;
}
ifr.style.display = ELEMENT_DISPAY_STYLE;
ifr.style.display = ELEMENT_DISPAY_STYLE2;
}
if(bExist)
{
......@@ -1433,7 +1433,7 @@
_IsBlockElem : function(name)
{
if( "p" == name || "div" == name || "ul" == name || "ol" == name || "li" == name || "table" == name ||
if( "p" == name || "div" == name || "ul" == name || "ol" == name || "li" == name || "table" == name || "tbody" == name || "tr" == name || "td" == name || "th" == name ||
"h1" == name || "h2" == name || "h3" == name || "h4" == name || "h5" == name || "h6" == name || "center" == name)
return true;
return false;
......@@ -1679,15 +1679,22 @@
return false;
},
_pasteInShape: function(worksheet, node, onlyFromLocalStorage)
_pasteInShape: function(worksheet, node, onlyFromLocalStorage, targetDocContent)
{
if(onlyFromLocalStorage)
var oPasteProcessor = new PasteProcessor({WordControl:{m_oLogicDocument: targetDocContent}, FontLoader: {}}, false, false, true, true);
oPasteProcessor._Execute(node, {}, true, true, false);
oPasteProcessor.InsertInPlace(targetDocContent , oPasteProcessor.aContent);
//targetDocContent.Parent.parent.recalculate();
/*if(onlyFromLocalStorage)
{
if(t.lStorage && t.lStorage.htmlInShape)
worksheet.objectRender.controller.curState.textObject.txBody.insertHtml(t.lStorage.htmlInShape);
}
else
worksheet.objectRender.controller.curState.textObject.txBody.insertHtml(node);
worksheet.objectRender.controller.curState.textObject.txBody.insertHtml(node);*/
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
},
......@@ -1706,7 +1713,7 @@
var isIntoShape = worksheet.objectRender.controller.getTargetDocContent();
if(isIntoShape)
{
this._pasteInShape(worksheet, node, onlyFromLocalStorage);
this._pasteInShape(worksheet, node, onlyFromLocalStorage, isIntoShape);
return;
};
......@@ -2342,7 +2349,7 @@
window.setTimeout(
function() {
// отменяем возможность выделения
t.element.style.display = ELEMENT_DISPAY_STYLE;
t.element.style.display = ELEMENT_DISPAY_STYLE2;
doc.body.style.MozUserSelect = "none";
doc.body.style["-khtml-user-select"] = "none";
doc.body.style["-o-user-select"] = "none";
......@@ -5104,9 +5111,9 @@ window.USER_AGENT_WEBKIT = AscBrowser.isWebkit;
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
var COPY_ELEMENT_ID = "clipboard-helper";
var PASTE_ELEMENT_ID = "wrd_pastebin";
var ELEMENT_DISPAY_STYLE = "none";
var COPY_ELEMENT_ID2 = "clipboard-helper";
var PASTE_ELEMENT_ID2 = "wrd_pastebin";
var ELEMENT_DISPAY_STYLE2 = "none";
var COPYPASTE_ELEMENT_CLASS = "sdk-element";
var kElementTextId = "clipboard-helper-text";
var isNeedEmptyAfterCut = false;
......@@ -5129,17 +5136,17 @@ function CopyPasteCorrectString(str)
if (window.USER_AGENT_SAFARI_MACOS)
{
var PASTE_ELEMENT_ID = "clipboard-helper";
var ELEMENT_DISPAY_STYLE = "block";
var PASTE_ELEMENT_ID2 = "clipboard-helper";
var ELEMENT_DISPAY_STYLE2 = "block";
}
function SafariIntervalFocus()
function SafariIntervalFocus2()
{
var api = window["Asc"]["editor"];
if (api)
{
if((api.wb && api.wb.cellEditor && api.wb.cellEditor != null && api.wb.cellEditor.isTopLineActive) || (api.wb && api.wb.getWorksheet() && api.wb.getWorksheet().isSelectionDialogMode))
return;
var pastebin = document.getElementById(COPY_ELEMENT_ID);
var pastebin = document.getElementById(COPY_ELEMENT_ID2);
var pastebinText = document.getElementById(kElementTextId);
if(pastebinText && (api.wb && api.wb.getWorksheet() && api.wb.getWorksheet().isCellEditMode) && api.IsFocus)
{
......@@ -5150,15 +5157,15 @@ function SafariIntervalFocus()
else if(!pastebin || !pastebinText)
{
// create
Editor_CopyPaste_Create(api);
Editor_CopyPaste_Create2(api);
}
}
}
function Editor_CopyPaste_Create(api)
function Editor_CopyPaste_Create2(api)
{
var ElemToSelect = document.createElement("div");
ElemToSelect.id = COPY_ELEMENT_ID;
ElemToSelect.id = COPY_ELEMENT_ID2;
ElemToSelect.setAttribute("class", COPYPASTE_ELEMENT_CLASS);
ElemToSelect.style.left = '0px';
......@@ -5224,7 +5231,7 @@ function Editor_CopyPaste_Create(api)
elementText.style.top = '-100px';
elementText.style.overflow = 'hidden';
elementText.style.zIndex = -1000;
elementText.style.display = ELEMENT_DISPAY_STYLE;
elementText.style.display = ELEMENT_DISPAY_STYLE2;
elementText.setAttribute("contentEditable", true);
elementText.setAttribute("class", COPYPASTE_ELEMENT_CLASS);
......@@ -5347,3 +5354,38 @@ function CreateBinaryReader(szSrc, offset, srcLen)
return stream;
}
function Common_CmpObj2(Obj1, Obj2)
{
if(!Obj1 || !Obj2 || typeof(Obj1) != typeof(Obj2))
return false;
var p, v1, v2;
//проверяем чтобы Obj1 имел теже свойства что и Obj2
for(p in Obj2)
{
if(!Obj1.hasOwnProperty(p))
return false;
}
//проверяем чтобы Obj2 имел теже свойства что и Obj1 и сравниваем их
for(p in Obj1)
{
if(Obj2.hasOwnProperty(p))
{
v1 = Obj1[p];
v2 = Obj2[p];
if(v1 && v2 && 'object' === typeof(v1) && 'object' === typeof(v2) )
{
if( false == Common_CmpObj2(v1, v2))
return false;
}
else
{
if(v1 != v2)
return false;
}
}
else
return false;
}
return true;
};
......@@ -918,7 +918,7 @@
{
if (0 === window.GlobalPasteFlagCounter)
{
SafariIntervalFocus();
SafariIntervalFocus2();
window.GlobalPasteFlag = true;
t.handlers.trigger("paste");
}
......
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