Commit c1182d46 authored by Sergey.Luzyanin's avatar Sergey.Luzyanin

Undo при быстром совместном редактировании; перенес проверку залоченности в...

Undo при быстром совместном редактировании; перенес проверку залоченности в callback добавления картинки.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@66466 954022d7-b5bf-4e40-9824-e11837661b57
parent 1a831037
...@@ -333,8 +333,20 @@ CShowPr.prototype.Copy = function(){ ...@@ -333,8 +333,20 @@ CShowPr.prototype.Copy = function(){
function CPresentation(DrawingDocument) function CPresentation(DrawingDocument)
{ {
this.History = History; this.History = History;
History.Document = this; this.IdCounter = g_oIdCounter;
this.TableId = g_oTableId;
this.CollaborativeEditing = (("undefined" !== typeof(CCollaborativeEditing) && CollaborativeEditing instanceof CCollaborativeEditing) ? CollaborativeEditing : null);
this.Api = editor;
//------------------------------------------------------------------------
if (DrawingDocument)
{
if (this.History)
this.History.Set_LogicDocument(this);
if (this.CollaborativeEditing)
this.CollaborativeEditing.m_oLogicDocument = this;
}
//------------------------------------------------------------------------ //------------------------------------------------------------------------
...@@ -493,6 +505,14 @@ CPresentation.prototype = ...@@ -493,6 +505,14 @@ CPresentation.prototype =
}, },
Get_Api: function(){
return this.Api;
},
Get_CollaborativeEditing: function(){
return this.CollaborativeEditing;
},
addSlideMaster: function(pos, master) addSlideMaster: function(pos, master)
{ {
History.Add(this, {Type: historyitem_Presentation_AddSlideMaster, pos: pos, master: master}); History.Add(this, {Type: historyitem_Presentation_AddSlideMaster, pos: pos, master: master});
......
...@@ -4308,55 +4308,52 @@ asc_docs_api.prototype._addImageUrl = function(url) { ...@@ -4308,55 +4308,52 @@ asc_docs_api.prototype._addImageUrl = function(url) {
}; };
asc_docs_api.prototype.AddImageUrl = function(url, imgProp) asc_docs_api.prototype.AddImageUrl = function(url, imgProp)
{ {
if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content) ) if(g_oDocumentUrls.getLocal(url))
{ {
if(g_oDocumentUrls.getLocal(url)) this.AddImageUrlAction(url, imgProp);
{ }
this.AddImageUrlAction(url, imgProp); else
} {
else var rData = {
{ "id": this.documentId,
var rData = { "userid": this.documentUserId,
"id": this.documentId, "vkey": this.documentVKey,
"userid": this.documentUserId, "c": "imgurl",
"vkey": this.documentVKey, "saveindex": g_oDocumentUrls.getMaxIndex(),
"c": "imgurl", "data": url};
"saveindex": g_oDocumentUrls.getMaxIndex(),
"data": url}; var t = this;
this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
var t = this; this.fCurCallback = function(input) {
this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage); if(null != input && "imgurl" == input["type"]){
this.fCurCallback = function(input) { if("ok" ==input["status"]) {
if(null != input && "imgurl" == input["type"]){ var data = input["data"];
if("ok" ==input["status"]) { var urls = {};
var data = input["data"]; var firstUrl;
var urls = {}; for(var i = 0; i < data.length; ++i){
var firstUrl; var elem = data[i];
for(var i = 0; i < data.length; ++i){ if(elem.url){
var elem = data[i]; if(!firstUrl){
if(elem.url){ firstUrl = elem.url;
if(!firstUrl){ }
firstUrl = elem.url; urls[elem.path] = elem.url;
} }
urls[elem.path] = elem.url; }
} g_oDocumentUrls.addUrls(urls);
} if(firstUrl) {
g_oDocumentUrls.addUrls(urls); t.AddImageUrlAction(firstUrl, imgProp);
if(firstUrl) { } else {
t.AddImageUrlAction(firstUrl, imgProp); t.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.NoCritical);
} else { }
t.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.NoCritical); } else {
} t.asc_fireCallback("asc_onError", g_fMapAscServerErrorToAscError(parseInt(input["data"])), c_oAscError.Level.NoCritical);
} else { }
t.asc_fireCallback("asc_onError", g_fMapAscServerErrorToAscError(parseInt(input["data"])), c_oAscError.Level.NoCritical); } else {
} t.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.NoCritical);
} else { }
t.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.NoCritical); t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
} };
t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage); sendCommand2(this, null, rData );
};
sendCommand2(this, null, rData );
}
} }
}; };
asc_docs_api.prototype.AddImageUrlAction = function(url, imgProp) asc_docs_api.prototype.AddImageUrlAction = function(url, imgProp)
...@@ -4364,52 +4361,7 @@ asc_docs_api.prototype.AddImageUrlAction = function(url, imgProp) ...@@ -4364,52 +4361,7 @@ asc_docs_api.prototype.AddImageUrlAction = function(url, imgProp)
var _image = this.ImageLoader.LoadImage(url, 1); var _image = this.ImageLoader.LoadImage(url, 1);
if (null != _image) if (null != _image)
{ {
var _w = Math.max(1, Page_Width - (X_Left_Margin + X_Right_Margin)); if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content) )
var _h = Math.max(1, Page_Height - (Y_Top_Margin + Y_Bottom_Margin));
if (_image.Image != null)
{
var __w = Math.max(parseInt(_image.Image.width * g_dKoef_pix_to_mm), 1);
var __h = Math.max(parseInt(_image.Image.height * g_dKoef_pix_to_mm), 1);
_w = Math.max(5, Math.min(_w, __w));
_h = Math.max(5, Math.min(parseInt(_w * __h / __w)));
}
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(historydescription_Document_AddImageUrl);
var src = _image.src;
if (this.isShapeImageChangeUrl)
{
var AscShapeProp = new asc_CShapeProperty();
AscShapeProp.fill = new asc_CShapeFill();
AscShapeProp.fill.type = c_oAscFill.FILL_TYPE_BLIP;
AscShapeProp.fill.fill = new asc_CFillBlip();
AscShapeProp.fill.fill.asc_putUrl(src);
this.ImgApply(new asc_CImgProperty({ShapeProperties:AscShapeProp}));
this.isShapeImageChangeUrl = false;
}
else if (this.isImageChangeUrl)
{
var AscImageProp = new asc_CImgProperty();
AscImageProp.ImageUrl = src;
this.ImgApply(AscImageProp);
this.isImageChangeUrl = false;
}
else
{
var imageLocal = g_oDocumentUrls.getImageLocal(src);
if(imageLocal){
src = imageLocal;
}
if (undefined === imgProp || undefined === imgProp.WrappingStyle || 0 == imgProp.WrappingStyle)
this.WordControl.m_oLogicDocument.Add_InlineImage(_w, _h, src);
else
this.WordControl.m_oLogicDocument.Add_InlineImage(_w, _h, src, null, true);
}
}
else
{
this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
this.asyncImageEndLoaded2 = function(_image)
{ {
var _w = Math.max(1, Page_Width - (X_Left_Margin + X_Right_Margin)); var _w = Math.max(1, Page_Width - (X_Left_Margin + X_Right_Margin));
var _h = Math.max(1, Page_Height - (Y_Top_Margin + Y_Bottom_Margin)); var _h = Math.max(1, Page_Height - (Y_Top_Margin + Y_Bottom_Margin));
...@@ -4420,9 +4372,9 @@ asc_docs_api.prototype.AddImageUrlAction = function(url, imgProp) ...@@ -4420,9 +4372,9 @@ asc_docs_api.prototype.AddImageUrlAction = function(url, imgProp)
_w = Math.max(5, Math.min(_w, __w)); _w = Math.max(5, Math.min(_w, __w));
_h = Math.max(5, Math.min(parseInt(_w * __h / __w))); _h = Math.max(5, Math.min(parseInt(_w * __h / __w)));
} }
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(historydescription_Document_AddImageUrlLong); this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(historydescription_Document_AddImageUrl);
var src = _image.src;
var src = _image.src;
if (this.isShapeImageChangeUrl) if (this.isShapeImageChangeUrl)
{ {
var AscShapeProp = new asc_CShapeProperty(); var AscShapeProp = new asc_CShapeProperty();
...@@ -4442,17 +4394,67 @@ asc_docs_api.prototype.AddImageUrlAction = function(url, imgProp) ...@@ -4442,17 +4394,67 @@ asc_docs_api.prototype.AddImageUrlAction = function(url, imgProp)
} }
else else
{ {
var imageLocal = g_oDocumentUrls.getImageLocal(src); var imageLocal = g_oDocumentUrls.getImageLocal(src);
if(imageLocal){ if(imageLocal){
src = imageLocal; src = imageLocal;
} }
if (undefined === imgProp || undefined === imgProp.WrappingStyle || 0 == imgProp.WrappingStyle) if (undefined === imgProp || undefined === imgProp.WrappingStyle || 0 == imgProp.WrappingStyle)
this.WordControl.m_oLogicDocument.Add_InlineImage(_w, _h, src); this.WordControl.m_oLogicDocument.Add_InlineImage(_w, _h, src);
else else
this.WordControl.m_oLogicDocument.Add_InlineImage(_w, _h, src, null, true); this.WordControl.m_oLogicDocument.Add_InlineImage(_w, _h, src, null, true);
} }
}
}
else
{
this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
this.asyncImageEndLoaded2 = function(_image)
{
if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content) )
{
var _w = Math.max(1, Page_Width - (X_Left_Margin + X_Right_Margin));
var _h = Math.max(1, Page_Height - (Y_Top_Margin + Y_Bottom_Margin));
if (_image.Image != null)
{
var __w = Math.max(parseInt(_image.Image.width * g_dKoef_pix_to_mm), 1);
var __h = Math.max(parseInt(_image.Image.height * g_dKoef_pix_to_mm), 1);
_w = Math.max(5, Math.min(_w, __w));
_h = Math.max(5, Math.min(parseInt(_w * __h / __w)));
}
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(historydescription_Document_AddImageUrlLong);
var src = _image.src;
if (this.isShapeImageChangeUrl)
{
var AscShapeProp = new asc_CShapeProperty();
AscShapeProp.fill = new asc_CShapeFill();
AscShapeProp.fill.type = c_oAscFill.FILL_TYPE_BLIP;
AscShapeProp.fill.fill = new asc_CFillBlip();
AscShapeProp.fill.fill.asc_putUrl(src);
this.ImgApply(new asc_CImgProperty({ShapeProperties:AscShapeProp}));
this.isShapeImageChangeUrl = false;
}
else if (this.isImageChangeUrl)
{
var AscImageProp = new asc_CImgProperty();
AscImageProp.ImageUrl = src;
this.ImgApply(AscImageProp);
this.isImageChangeUrl = false;
}
else
{
var imageLocal = g_oDocumentUrls.getImageLocal(src);
if(imageLocal){
src = imageLocal;
}
if (undefined === imgProp || undefined === imgProp.WrappingStyle || 0 == imgProp.WrappingStyle)
this.WordControl.m_oLogicDocument.Add_InlineImage(_w, _h, src);
else
this.WordControl.m_oLogicDocument.Add_InlineImage(_w, _h, src, null, true);
}
}
this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage); this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
this.asyncImageEndLoaded2 = null; this.asyncImageEndLoaded2 = null;
......
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