Commit c860bf8c authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@50107 954022d7-b5bf-4e40-9824-e11837661b57
parent 98b7ee1c
......@@ -3501,13 +3501,13 @@ function CTheme()
this.setFontScheme = function(fontScheme)
{
History.Add(this, {Type: historyitem_ChangeFontScheme, oldPr: this.themeElements.clrScheme, newPr: clrScheme});
History.Add(this, {Type: historyitem_ChangeFontScheme, oldPr: this.themeElements.fontScheme, newPr: fontScheme});
this.themeElements.fontScheme = fontScheme;
};
this.setFormatScheme = function(fmtScheme)
{
History.Add(this, {Type: historyitem_ChangeFmtScheme, oldPr: this.themeElements.clrScheme, newPr: clrScheme});
History.Add(this, {Type: historyitem_ChangeFmtScheme, oldPr: this.themeElements.fmtScheme, newPr: fmtScheme});
this.themeElements.fmtScheme = fmtScheme;
};
......@@ -3833,6 +3833,64 @@ function CTextStyles()
this.titleStyle = null;
this.bodyStyle = null;
this.otherStyle = null;
this.Write_ToBinary2 = function(w)
{
w.WriteBool(isRealObject(this.titleStyle));
if(isRealObject(this.titleStyle))
{
this.titleStyle.Write_ToBinary2(w);
}
w.WriteBool(isRealObject(this.bodyStyle));
if(isRealObject(this.bodyStyle))
{
this.bodyStyle.Write_ToBinary2(w);
}
w.WriteBool(isRealObject(this.otherStyle));
if(isRealObject(this.otherStyle))
{
this.otherStyle.Write_ToBinary2(w);
}
w.WriteString2("test");
};
this.Read_FromBinary2 = function(r)
{
if(r.GetBool())
{
this.titleStyle = new TextListStyle();
this.titleStyle.Read_FromBinary2(r);
}
else
{
this.titleStyle = null;
}
if(r.GetBool())
{
this.bodyStyle = new TextListStyle();
this.bodyStyle.Read_FromBinary2(r);
}
else
{
this.bodyStyle = null;
}
if(r.GetBool())
{
this.otherStyle = new TextListStyle();
this.otherStyle.Read_FromBinary2(r);
}
else
{
this.otherStyle = null;
}
var s = r.GetString2();
};
}
//---------------------------
......@@ -5297,6 +5355,13 @@ function CTextParagraphPr()
{
this.pPr.Write_ToBinary(w);
}
w.WriteBool(isRealObject(this.rPr));
if(isRealObject(this.rPr))
{
this.rPr.Write_ToBinary(w);
}
};
this.Read_FromBinary2 = function(r)
......@@ -5305,7 +5370,6 @@ function CTextParagraphPr()
{
this.bullet = new CBullet();
this.bullet.Read_FromBinary2(r);
}
else
{
......@@ -5325,6 +5389,12 @@ function CTextParagraphPr()
{
this.pPr.Read_FromBinary(r);
}
this.rPr = new CTextPr();
if(r.GetBool())
{
this.rPr.Read_FromBinary(r);
}
};
}
......@@ -5380,12 +5450,16 @@ function CBullet()
this.bulletSize.Write_ToBinary2(w);
}
w.WriteString2("dssdf");
w.WriteBool(isRealObject(this.bulletTypeface));
if(isRealObject(this.bulletTypeface))
{
this.bulletTypeface.Write_ToBinary2(w);
}
w.WriteBool(isRealObject(this.bulletType));
if(isRealObject(this.bulletType))
{
......@@ -5396,6 +5470,7 @@ function CBullet()
this.Read_FromBinary2 = function(r)
{
if(r.GetBool())
{
this.bulletColor = new CBulletColor();
......@@ -5408,6 +5483,7 @@ function CBullet()
this.bulletSize.Read_FromBinary2(r);
}
var s = r.GetString2();
if(r.GetBool())
{
this.bulletTypeface = new CBulletTypeface();
......@@ -5545,7 +5621,7 @@ function CBulletTypeface()
w.WriteBool(typeof this.typeface === "string");
if(typeof this.typeface === "string")
{
w.WriteString(this.typeface);
w.WriteString2(this.typeface);
}
};
......@@ -5596,7 +5672,7 @@ function CBulletType()
w.WriteBool(typeof this.Char === "string");
if(typeof this.Char === "string")
{
w.WriteString(this.Char);
w.WriteString2(this.Char);
}
w.WriteBool(isRealNumber(this.AutoNumType));
......@@ -5660,6 +5736,8 @@ function TextListStyle()
this.Write_ToBinary2 = function(w)
{
w.WriteBool(MASTER_STYLES);
for(var i = 0; i < 10; ++i)
{
w.WriteBool(isRealObject(this.levels[i]));
......@@ -5672,6 +5750,8 @@ function TextListStyle()
this.Read_FromBinary2 = function(r)
{
var b = r.GetBool();
for(var i = 0; i < 10; ++i)
{
if(r.GetBool())
......
......@@ -155,9 +155,8 @@ function CTableId()
case historyitem_type_Layout : Element = new SlideLayout(); break;
case historyitem_type_TextBody : Element = new CTextBody(); break;
case historyitem_type_GraphicFrame : Element = new CGraphicFrame(); break;
case historyitem_type_SlideMaster : Element = new MasterSlide(); break;
case historyitem_type_Theme : Element = new CTheme(); break;
}
Element.Read_FromBinary2(Reader);
......
......@@ -495,8 +495,20 @@ SlideLayout.prototype =
setMaster: function(master)
{
History.Add(this, {Type: historyitem_SetLayoutMaster, oldPr: this.Master, newPr:master});
this.Master = master;
},
setMatchingName: function(name)
{
History.Add(this, {Type: historyitem_SetLayoutMatchingName, oldPr: this.matchingName, newPr:name});
this.matchingName = name;
},
setType: function(type)
{
History.Add(this, {Type:historyitem_SetLayoutType, oldPr: this.type, newPr:type});
this.type = type;
},
changeSize: function(kw, kh)
{
......@@ -526,6 +538,282 @@ SlideLayout.prototype =
{
return this.Id;
},
changeBackground: function(bg)
{
History.Add(this, {Type: historyitem_ChangeBg, oldBg: this.cSld.Bg ? this.cSld.Bg.createFullCopy() : null, newBg: bg});
this.cSld.Bg = bg.createFullCopy();
},
setCSldName: function(name)
{
History.Add(this, {Type: historyitem_SetCSldName,oldName: this.cSld.name, newName: name});
this.cSld.name = name;
},
setShow: function(bShow)
{
History.Add(this, {Type:historyitem_SetShow, oldPr: this.show, newPr: bShow});
this.show = bShow;
},
setShowPhAnim: function(bShow)
{
History.Add(this, {Type: historyitem_SetShowPhAnim, oldPr: this.showMasterPhAnim, newPr: bShow});
this.showMasterPhAnim = bShow;
},
setShowMasterSp: function(bShow)
{
History.Add(this, {Type: historyitem_SetShowMasterSp, oldPr: this.showMasterSp, newPr: bShow});
this.showMasterSp = bShow;
},
setClMapOverride: function(clrMap)
{
History.Add(this, {Type: historyitem_SetClrMapOverride, oldClrMap: this.clrMap, newClrMap: clrMap});
this.clrMap = clrMap;
},
shapeAdd: function(pos, item)
{
History.Add(this, {Type: historyitem_ShapeAdd, pos: pos, item: item});
this.cSld.spTree.splice(pos, 0, item);
},
Undo: function(data)
{
switch(data.Type)
{
case historyitem_SetLayoutMaster:
{
this.Master = data.oldPr;
break;
}
case historyitem_SetLayoutType:
{
this.type = data.oldPr;
break;
}
case historyitem_SetLayoutMatchingName:
{
this.matchingName = data.oldPr;
break;
}
case historyitem_AddComment:
{
this.comments.splice(data.pos, 1);
editor.sync_RemoveComment( data.objectId );
break;
}
case historyitem_RemoveComment:
{
this.comments.splice(data.index, 0, g_oTableId.Get_ById(data.id));
editor.sync_AddComment( this.comments[data.index].Get_Id(), this.comments[data.index].Data);
break;
}
case historyitem_RemoveFromSpTree:
{
this.cSld.spTree.splice(data.index, 0, g_oTableId.Get_ById(data.id));
break;
}
case historyitem_AddToSlideSpTree:
{
this.cSld.spTree.splice(data.pos, 1);
break;
}
case historyitem_AddSlideLocks:
{
this.deleteLock = null;
this.backgroundLock = null;
this.timingLock = null;
this.transitionLock = null;
this.layoutLock = null;
break;
}
case historyitem_ChangeBg:
{
this.cSld.Bg = data.oldBg;
this.recalcInfo.recalculateBackground = true;
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
break;
}
case historyitem_ChangeTiming:
{
this.timing = data.oldTiming.createDuplicate();
break;
}
case historyitem_SetLayout:
{
this.Layout = data.oldLayout;
if(this.Layout != null)
this.recalcAll();
break;
}
case historyitem_SetSlideNum:
{
this.num = data.oldNum;
break;
}
case historyitem_ShapeAdd:
{
this.cSld.spTree.splice(data.pos, 1);
break;
}
case historyitem_SetCSldName:
{
this.cSld.name = data.oldName;
break;
}
case historyitem_SetClrMapOverride:
{
this.clrMap = data.oldClrMap;
break;
}
case historyitem_SetShow:
{
this.show = data.oldPr;
break;
}
case historyitem_SetShowPhAnim:
{
this.showMasterPhAnim = data.oldPr;
break;
}
case historyitem_SetShowMasterSp:
{
this.showMasterSp = data.oldPr;
break;
}
}
},
Redo: function(data)
{
switch(data.Type)
{
case historyitem_SetLayoutMaster:
{
this.Master = data.newPr;
break;
}
case historyitem_SetLayoutType:
{
this.type = data.newPr;
break;
}
case historyitem_SetLayoutMatchingName:
{
this.matchingName = data.newPr;
break;
}
case historyitem_AddComment:
{
this.comments.splice(data.pos, 0, g_oTableId.Get_ById(data.objectId));
editor.sync_AddComment( data.objectId, this.comments[data.pos].Data);
break;
}
case historyitem_RemoveComment:
{
this.comments.splice(data.index, 1);
editor.sync_RemoveComment(data.id);
break;
}
case historyitem_RemoveFromSpTree:
{
this.cSld.spTree.splice(data.index, 1);
break;
}
case historyitem_AddToSlideSpTree:
{
this.cSld.spTree.splice(data.pos, 0, g_oTableId.Get_ById(data.objectId));
break;
}
case historyitem_AddSlideLocks:
{
this.deleteLock = g_oTableId.Get_ById(data.deleteLock);
this.backgroundLock = g_oTableId.Get_ById(data.backgroundLock);
this.timingLock = g_oTableId.Get_ById(data.timingLock);
this.transitionLock = g_oTableId.Get_ById(data.transitionLock);
this.layoutLock = g_oTableId.Get_ById(data.layoutLock);
break;
}
case historyitem_ChangeBg:
{
this.cSld.Bg = data.newBg;
this.recalcInfo.recalculateBackground = true;
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
break;
}
case historyitem_ChangeTiming:
{
this.timing = data.newTiming.createDuplicate();
break;
}
case historyitem_SetLayout:
{
this.Layout = data.newLayout;
this.recalcAll();
break;
}
case historyitem_SetSlideNum:
{
this.num = data.newNum;
break;
}
case historyitem_ShapeAdd:
{
this.cSld.spTree.splice(data.pos, 0, data.item);
break;
}
case historyitem_SetCSldName:
{
this.cSld.name = data.newName;
break;
}
case historyitem_SetClrMapOverride:
{
this.clrMap = data.newClrMap;
break;
}
case historyitem_SetShow:
{
this.show = data.newPr;
break;
}
case historyitem_SetShowPhAnim:
{
this.showMasterPhAnim = data.newPr;
break;
}
case historyitem_SetShowMasterSp:
{
this.showMasterSp = data.newPr;
break;
}
}
},
Write_ToBinary2: function(w)
{
w.WriteLong(historyitem_type_Layout);
......@@ -537,14 +825,372 @@ SlideLayout.prototype =
this.Id = r.GetString2();
},
Refresh_RecalcData: function()
{},
Save_Changes: function(data, w)
{
w.WriteLong(data.Type);
switch(data.Type)
{
case historyitem_SetLayoutMaster:
{
w.WriteString2(data.newPr.Get_Id());
break;
}
case historyitem_SetLayoutType:
{
w.WriteLong(data.newPr);
break;
}
case historyitem_SetLayoutMatchingName:
{
w.WriteString2(data.newPr);
break;
}
case historyitem_AddComment:
{
w.WriteLong(data.pos);
w.WriteString2(data.objectId);
break;
}
case historyitem_RemoveComment:
{
w.WriteLong(data.index);
break;
}
case historyitem_RemoveFromSpTree:
{
w.WriteLong(data.index);
break;
}
case historyitem_AddToSlideSpTree:
{
w.WriteLong(data.pos);
w.WriteString2(data.objectId);
break;
}
case historyitem_AddSlideLocks:
{
w.WriteString2(data.deleteLock);
w.WriteString2(data.backgroundLock);
w.WriteString2(data.timingLock);
w.WriteString2(data.transitionLock);
w.WriteString2(data.layoutLock);
break;
}
case historyitem_ChangeBg:
{
data.newBg.Write_ToBinary2(w);
break;
}
case historyitem_ChangeTiming:
{
data.newTiming.Write_ToBinary2(w);
break;
}
case historyitem_SetLayout:
{
w.WriteBool(isRealObject(data.newLayout));
if(isRealObject(data.newLayout))
{
w.WriteString2(data.newLayout.Get_Id());
}
break;
}
case historyitem_SetSlideNum:
{
w.WriteBool(isRealNumber(data.newNum));
if(isRealNumber(data.newNum))
{
w.WriteLong(data.newNum);
}
break;
}
case historyitem_ShapeAdd:
{
w.WriteLong(data.pos);
w.WriteString2(data.item.Get_Id());
break;
}
case historyitem_SetCSldName:
{
w.WriteBool(typeof data.newName === "string");
if(typeof data.newName === "string")
{
w.WriteString2(data.newName);
}
break;
}
case historyitem_SetClrMapOverride:
{
w.WriteBool(isRealObject(data.newClrMap));
if(isRealObject(data.newClrMap))
{
data.newClrMap.Write_ToBinary2(w);
}
break;
}
case historyitem_SetShow:
{
w.WriteBool(data.newPr);
break;
}
case historyitem_SetShowPhAnim:
{
w.WriteBool( data.newPr);
break;
}
case historyitem_SetShowMasterSp:
{
w.WriteBool( data.newPr);
break;
}
}
},
Load_Changes: function(r)
{
var type = r.GetLong();
switch(type)
{
case historyitem_SetLayoutMaster:
{
this.Master = g_oTableId.Get_ById(r.GetString2());
break;
}
case historyitem_SetLayoutType:
{
this.type = r.GetLong();
break;
}
case historyitem_SetLayoutMatchingName:
{
this.matchingName = r.GetString2();
break;
}
case historyitem_AddComment:
{
var pos = r.GetLong();
var id = r.GetString2();
this.comments.splice(pos, 0, g_oTableId.Get_ById(id));
editor.sync_AddComment( id, this.comments[pos].Data);
break;
}
case historyitem_RemoveComment:
{
var comment = this.comments.splice(r.GetLong(), 1)[0];
editor.sync_RemoveComment(comment.Id);
break;
}
case historyitem_RemoveFromSpTree:
{
this.cSld.spTree.splice(r.GetLong(), 1);
break;
}
case historyitem_AddToSlideSpTree:
{
var pos = r.GetLong();
var id = r.GetString2();
this.cSld.spTree.splice(pos, 0, g_oTableId.Get_ById(id));
break;
}
case historyitem_AddSlideLocks:
{
this.deleteLock = g_oTableId.Get_ById(r.GetString2());
this.backgroundLock = g_oTableId.Get_ById(r.GetString2());
this.timingLock = g_oTableId.Get_ById(r.GetString2());
this.transitionLock = g_oTableId.Get_ById(r.GetString2());
this.layoutLock = g_oTableId.Get_ById(r.GetString2());
break;
}
case historyitem_ChangeBg:
{
this.cSld.Bg = new CBg();
this.cSld.Bg.Read_FromBinary2(r);
this.recalcInfo.recalculateBackground = true;
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
break;
}
case historyitem_ChangeTiming:
{
this.timing = new CAscSlideTiming();
this.timing.Read_FromBinary2(r);
break;
}
case historyitem_SetLayout:
{
if(r.GetBool())
{
this.Layout = g_oTableId.Get_ById(r.GetString2());
}
else
{
this.Layout = null;
}
this.recalcAll();
break;
}
case historyitem_SetSlideNum:
{
if(r.GetBool())
{
this.num = r.GetLong();
}
else
{
this.num = null;
}
break;
}
case historyitem_ShapeAdd:
{
var pos = r.GetLong();
var item = g_oTableId.Get_ById(r.GetString2());
this.cSld.spTree.splice(pos, 0, item);
break;
}
case historyitem_SetCSldName:
{
if(r.GetBool())
{
this.cSld.name = r.GetString2();
}
else
{
this.cSld.name = null;
}
break;
}
case historyitem_SetClrMapOverride:
{
if(r.GetBool())
{
this.clrMap = new ClrMap();
this.clrMap.Read_FromBinary2(r);
}
break;
}
case historyitem_SetShow:
{
this.show = r.GetBool();
break;
}
case historyitem_SetShowPhAnim:
{
this.showMasterPhAnim = r.GetBool();
break;
}
case historyitem_SetShowMasterSp:
{
this.showMasterSp = r.GetBool();
break;
}
}
},
Load_Comments : function(authors)
{
var _comments_count = this.writecomments.length;
var _comments_id = [];
var _comments_data = [];
var _comments = [];
for (var i = 0; i < _comments_count; i++)
{
var _wc = this.writecomments[i];
if (0 == _wc.WriteParentAuthorId || 0 == _wc.WriteParentCommentId)
{
var commentData = new CCommentData();
commentData.m_sText = _wc.WriteText;
commentData.m_sUserId = ("" + _wc.WriteAuthorId);
commentData.m_sUserName = "";
commentData.m_sTime = _wc.WriteTime;
for (var k in authors)
{
if (_wc.WriteAuthorId == authors[k].Id)
{
commentData.m_sUserName = authors[k].Name;
break;
}
}
if ("" != commentData.m_sUserName)
{
_comments_id.push(_wc.WriteCommentId);
_comments_data.push(commentData);
var comment = new CComment(undefined, null);
comment.setPosition(_wc.x / 25.4, _wc.y / 25.4);
_comments.push(comment);
}
}
else
{
var commentData = new CCommentData();
commentData.m_sText = _wc.WriteText;
commentData.m_sUserId = ("" + _wc.WriteAuthorId);
commentData.m_sUserName = "";
commentData.m_sTime = _wc.WriteTime;
for (var k in authors)
{
if (_wc.WriteAuthorId == authors[k].Id)
{
commentData.m_sUserName = authors[k].Name;
break;
}
}
var _parent = null;
for (var j = 0; j < _comments_data.length; j++)
{
if ((("" + _wc.WriteParentAuthorId) == _comments_data[j].m_sUserId) && (_wc.WriteParentCommentId == _comments_id[j]))
{
_parent = _comments_data[j];
break;
}
}
if (null != _parent)
{
_parent.m_aReplies.push(commentData);
}
}
}
for (var i = 0; i < _comments.length; i++)
{
_comments[i].Set_Data(_comments_data[i]);
this.addComment(_comments[i]);
}
this.writecomments = [];
}
};
......
......@@ -228,6 +228,8 @@ CStatistics.prototype =
}
};
var MASTER_STYLES = false;
function CPresentation(DrawingDocument)
{
this.History = new CHistory(this);
......@@ -399,6 +401,8 @@ function CSelectedElementsInfo()
return ( this.m_nDrawing === selected_DrawingObject ? true : false );
};
this.Set_MixedSelection = function()
{
this.m_bMixedSelection = true;
......@@ -423,6 +427,12 @@ CPresentation.prototype =
},
addSlideMaster: function(pos, master)
{
History.Add(this, {Type:historyitem_Presenattion_AddSlideMaster, pos: pos, master: master});
this.slideMasters.splice(pos, 0, master);
},
Get_Id : function()
{
return this.Id;
......@@ -5397,6 +5407,11 @@ CPresentation.prototype =
}
break;
}
case historyitem_Presenattion_AddSlideMaster:
{
this.slideMasters.splice(Data.pos, 1);
break;
}
}
},
......@@ -5454,6 +5469,11 @@ CPresentation.prototype =
}
break;
}
case historyitem_Presenattion_AddSlideMaster:
{
this.slideMasters.splice(Data.pos, 0, Data.master);
break;
}
}
},
......@@ -5876,9 +5896,6 @@ CPresentation.prototype =
this.DrawingDocument.OnRecalculatePage(_array[i], this.Slides[_array[i]]);
}
this.DrawingDocument.OnEndRecalculate();
}
},
......@@ -5891,8 +5908,8 @@ CPresentation.prototype =
return;
}
if(!(this.Document_Is_SelectionLocked(changestype_Theme) === false))
return;
//if(!(this.Document_Is_SelectionLocked(changestype_Theme) === false))
// return;
if(this.startChangeThemeTimeOutId != null)
{
clearTimeout(this.startChangeThemeTimeOutId);
......@@ -5905,9 +5922,9 @@ CPresentation.prototype =
{
clearTimeout(this.forwardChangeThemeTimeOutId);
}
this.themes.push(themeInfo.Theme);
this.slideMasters.push(themeInfo.Master);
this.slideLayouts = this.slideLayouts.concat(themeInfo.Layouts);
//this.themes.push(themeInfo.Theme);
this.addSlideMaster(this.slideMasters.length, themeInfo.Master);
//this.slideLayouts = this.slideLayouts.concat(themeInfo.Layouts);
var _new_master = themeInfo.Master;
_new_master.presentation = this;
......@@ -5938,12 +5955,10 @@ CPresentation.prototype =
_arr_old_layouts[_slide_index] = _arr_slides[_slide_index].Layout;
}
History.Create_NewPoint();
// History.Create_NewPoint();
var _arr_new_layouts = [];
var _new_layout;
var _history_data;
var _shape;
for(_slide_index = 0; _slide_index < this.Slides.length; ++_slide_index)
{
if(_arr_slides[_slide_index].Layout.calculatedType == null)
......@@ -6504,6 +6519,12 @@ CPresentation.prototype =
Writer.WriteDouble(Data.newH);
break;
}
case historyitem_Presenattion_AddSlideMaster:
{
Writer.WriteLong(Data.pos);
Writer.WriteString2(Data.master.Get_Id());
break;
}
}
return Writer;
......@@ -6615,6 +6636,14 @@ CPresentation.prototype =
{
History.TurnOn();
}
break;
}
case historyitem_Presenattion_AddSlideMaster:
{
var pos = Reader.GetLong();
var id = Reader.GetString2();
this.slideMasters.splice(pos, 0, g_oTableId.Get_ById(id));
break;
}
}
return true;
......
......@@ -15,7 +15,7 @@ function MasterSlide(presentation, theme)
this.sldLayoutLst = [];
this.txStyles = new CTextStyles();
this.txStyles = null;
this.preserve = false;
this.ImageBase64 = "";
......@@ -28,8 +28,8 @@ function MasterSlide(presentation, theme)
this.Width = 254;
this.Height = 190.5;
this.DrawingDocument = presentation.DrawingDocument;
this.recalcInfo = {};
this.DrawingDocument = editor.WordControl.m_oDrawingDocument;
this.changeProportions = function(kW, kH)
{
......@@ -209,7 +209,7 @@ function MasterSlide(presentation, theme)
};
//----------------------------------------------
this.presentation = presentation;
this.presentation = editor.WordControl.m_oLogicDocument;
this.theme = theme;
this.kind = MASTER_KIND;
......@@ -370,6 +370,12 @@ MasterSlide.prototype =
this.sldLayoutLst.push(layout);
},
setTheme: function(theme)
{
History.Add(this, {Type:historyitem_SetMasterTheme, oldPr: this.Theme, newPr: theme});
this.Theme = theme;
},
changeSize: function(kw, kh)
{
this.Width *= kw;
......@@ -395,6 +401,12 @@ MasterSlide.prototype =
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
},
setTxStyles: function(txStyles)
{
History.Add(this, {Type: historyitem_SetTxStyles, oldPr: this.txStyles, newPr: txStyles});
this.txStyles = txStyles;
},
setCSldName: function(name)
{
History.Add(this, {Type: historyitem_SetCSldName,oldName: this.cSld.name, newName: name});
......@@ -409,20 +421,555 @@ MasterSlide.prototype =
}
},
setClMapOverride: function(clrMap)
{
History.Add(this, {Type: historyitem_SetClrMapOverride, oldClrMap: this.clrMap, newClrMap: clrMap});
this.clrMap = clrMap;
},
addToSldLayoutLstToPos: function(pos, obj)
{
History.Add(this, {Type: historyitem_AddLayout, objectId: obj.Get_Id(), pos:pos});
this.sldLayoutLst.splice(pos, 0, obj);
},
Get_Id: function()
{
return this.Id;
},
Write_ToBinary2: function(w)
Refresh_RecalcData: function()
{},
Undo: function(data)
{
switch(data.Type)
{
case historyitem_SetMasterTheme:
{
this.Theme = data.oldPr;
break;
}
case historyitem_SetTxStyles:
{
this.txStyles = data.oldPr;
break;
}
case historyitem_AddComment:
{
this.comments.splice(data.pos, 1);
editor.sync_RemoveComment( data.objectId );
break;
}
case historyitem_RemoveComment:
{
this.comments.splice(data.index, 0, g_oTableId.Get_ById(data.id));
editor.sync_AddComment( this.comments[data.index].Get_Id(), this.comments[data.index].Data);
break;
}
case historyitem_RemoveFromSpTree:
{
this.cSld.spTree.splice(data.index, 0, g_oTableId.Get_ById(data.id));
break;
}
case historyitem_AddToSlideSpTree:
{
this.cSld.spTree.splice(data.pos, 1);
break;
}
case historyitem_AddLayout:
{
this.sldLayoutLst.splice(data.pos, 1);
break;
}
case historyitem_AddSlideLocks:
{
this.deleteLock = null;
this.backgroundLock = null;
this.timingLock = null;
this.transitionLock = null;
this.layoutLock = null;
break;
}
case historyitem_ChangeBg:
{
this.cSld.Bg = data.oldBg;
this.recalcInfo.recalculateBackground = true;
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
break;
}
case historyitem_ChangeTiming:
{
this.timing = data.oldTiming.createDuplicate();
break;
}
case historyitem_SetLayout:
{
this.Layout = data.oldLayout;
if(this.Layout != null)
this.recalcAll();
break;
}
case historyitem_SetSlideNum:
{
this.num = data.oldNum;
break;
}
case historyitem_ShapeAdd:
{
this.cSld.spTree.splice(data.pos, 1);
break;
}
case historyitem_SetCSldName:
{
this.cSld.name = data.oldName;
break;
}
case historyitem_SetClrMapOverride:
{
this.clrMap = data.oldClrMap;
break;
}
case historyitem_SetShow:
{
this.show = data.oldPr;
break;
}
case historyitem_SetShowPhAnim:
{
this.showMasterPhAnim = data.oldPr;
break;
}
case historyitem_SetShowMasterSp:
{
this.showMasterSp = data.oldPr;
break;
}
}
},
Redo: function(data)
{
switch(data.Type)
{
case historyitem_SetMasterTheme:
{
this.Theme = data.newPr;
break;
}
case historyitem_SetTxStyles:
{
this.txStyles = data.newPr;
break;
}
case historyitem_AddComment:
{
this.comments.splice(data.pos, 0, g_oTableId.Get_ById(data.objectId));
editor.sync_AddComment( data.objectId, this.comments[data.pos].Data);
break;
}
case historyitem_RemoveComment:
{
this.comments.splice(data.index, 1);
editor.sync_RemoveComment(data.id);
break;
}
case historyitem_RemoveFromSpTree:
{
this.cSld.spTree.splice(data.index, 1);
break;
}
case historyitem_AddToSlideSpTree:
{
this.cSld.spTree.splice(data.pos, 0, g_oTableId.Get_ById(data.objectId));
break;
}
case historyitem_AddLayout:
{
this.sldLayoutLst.splice(data.pos, 0, g_oTableId.Get_ById(data.objectId));
break;
}
case historyitem_AddSlideLocks:
{
this.deleteLock = g_oTableId.Get_ById(data.deleteLock);
this.backgroundLock = g_oTableId.Get_ById(data.backgroundLock);
this.timingLock = g_oTableId.Get_ById(data.timingLock);
this.transitionLock = g_oTableId.Get_ById(data.transitionLock);
this.layoutLock = g_oTableId.Get_ById(data.layoutLock);
break;
}
case historyitem_ChangeBg:
{
this.cSld.Bg = data.newBg;
this.recalcInfo.recalculateBackground = true;
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
break;
}
case historyitem_ChangeTiming:
{
this.timing = data.newTiming.createDuplicate();
break;
}
case historyitem_SetLayout:
{
this.Layout = data.newLayout;
this.recalcAll();
break;
}
case historyitem_SetSlideNum:
{
this.num = data.newNum;
break;
}
case historyitem_ShapeAdd:
{
this.cSld.spTree.splice(data.pos, 0, data.item);
break;
}
case historyitem_SetCSldName:
{
this.cSld.name = data.newName;
break;
}
case historyitem_SetClrMapOverride:
{
this.clrMap = data.newClrMap;
break;
}
case historyitem_SetShow:
{
this.show = data.newPr;
break;
}
case historyitem_SetShowPhAnim:
{
this.showMasterPhAnim = data.newPr;
break;
}
case historyitem_SetShowMasterSp:
{
this.showMasterSp = data.newPr;
break;
}
}
},
Write_ToBinary2: function(w)
{
w.WriteLong(historyitem_type_SlideMaster);
w.WriteString2(this.Id);
},
Read_FromBinary2: function(r)
{},
{
this.Id = r.GetString2();
},
Save_Changes: function(data, w)
{
w.WriteLong(data.Type);
switch(data.Type)
{
case historyitem_SetMasterTheme:
{
w.WriteString2(data.newPr.Get_Id());
break;
}
case historyitem_SetTxStyles:
{
MASTER_STYLES = true;
data.newPr.Write_ToBinary2(w);
MASTER_STYLES = false;
break;
}
case historyitem_AddComment:
{
w.WriteLong(data.pos);
w.WriteString2(data.objectId);
break;
}
case historyitem_RemoveComment:
{
w.WriteLong(data.index);
break;
}
case historyitem_RemoveFromSpTree:
{
w.WriteLong(data.index);
break;
}
case historyitem_AddToSlideSpTree:
{
w.WriteLong(data.pos);
w.WriteString2(data.objectId);
break;
}
case historyitem_AddLayout:
{
w.WriteLong(data.pos);
w.WriteString2(data.objectId);
break;
}
case historyitem_AddSlideLocks:
{
w.WriteString2(data.deleteLock);
w.WriteString2(data.backgroundLock);
w.WriteString2(data.timingLock);
w.WriteString2(data.transitionLock);
w.WriteString2(data.layoutLock);
break;
}
case historyitem_ChangeBg:
{
data.newBg.Write_ToBinary2(w);
break;
}
case historyitem_ChangeTiming:
{
data.newTiming.Write_ToBinary2(w);
break;
}
case historyitem_SetLayout:
{
w.WriteBool(isRealObject(data.newLayout));
if(isRealObject(data.newLayout))
{
w.WriteString2(data.newLayout.Get_Id());
}
break;
}
case historyitem_SetSlideNum:
{
w.WriteBool(isRealNumber(data.newNum));
if(isRealNumber(data.newNum))
{
w.WriteLong(data.newNum);
}
break;
}
case historyitem_ShapeAdd:
{
w.WriteLong(data.pos);
w.WriteString2(data.item.Get_Id());
break;
}
case historyitem_SetCSldName:
{
w.WriteBool(typeof data.newName === "string");
if(typeof data.newName === "string")
{
w.WriteString2(data.newName);
}
break;
}
case historyitem_SetClrMapOverride:
{
w.WriteBool(isRealObject(data.newClrMap));
if(isRealObject(data.newClrMap))
{
data.newClrMap.Write_ToBinary2(w);
}
break;
}
case historyitem_SetShow:
{
w.WriteBool(data.newPr);
break;
}
Save_Changes: function()
{},
Load_Changes: function()
{}
case historyitem_SetShowPhAnim:
{
w.WriteBool( data.newPr);
break;
}
case historyitem_SetShowMasterSp:
{
w.WriteBool( data.newPr);
break;
}
}
},
Load_Changes: function(r)
{
var type = r.GetLong();
switch(type)
{
case historyitem_SetMasterTheme:
{
this.Theme = g_oTableId.Get_ById(r.GetString2());
break;
}
case historyitem_SetTxStyles:
{
this.txStyles = new CTextStyles();
this.txStyles.Read_FromBinary2(r);
break;
}
case historyitem_AddComment:
{
var pos = r.GetLong();
var id = r.GetString2();
this.comments.splice(pos, 0, g_oTableId.Get_ById(id));
editor.sync_AddComment( id, this.comments[pos].Data);
break;
}
case historyitem_RemoveComment:
{
var comment = this.comments.splice(r.GetLong(), 1)[0];
editor.sync_RemoveComment(comment.Id);
break;
}
case historyitem_RemoveFromSpTree:
{
this.cSld.spTree.splice(r.GetLong(), 1);
break;
}
case historyitem_AddToSlideSpTree:
{
var pos = r.GetLong();
var id = r.GetString2();
this.cSld.spTree.splice(pos, 0, g_oTableId.Get_ById(id));
break;
}
case historyitem_AddLayout:
{
var pos = r.GetLong();
var id = r.GetString2();
this.sldLayoutLst.splice(pos, 0, g_oTableId.Get_ById(id));
break;
}
case historyitem_AddSlideLocks:
{
this.deleteLock = g_oTableId.Get_ById(r.GetString2());
this.backgroundLock = g_oTableId.Get_ById(r.GetString2());
this.timingLock = g_oTableId.Get_ById(r.GetString2());
this.transitionLock = g_oTableId.Get_ById(r.GetString2());
this.layoutLock = g_oTableId.Get_ById(r.GetString2());
break;
}
case historyitem_ChangeBg:
{
this.cSld.Bg = new CBg();
this.cSld.Bg.Read_FromBinary2(r);
this.recalcInfo.recalculateBackground = true;
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
break;
}
case historyitem_ChangeTiming:
{
this.timing = new CAscSlideTiming();
this.timing.Read_FromBinary2(r);
break;
}
case historyitem_SetLayout:
{
if(r.GetBool())
{
this.Layout = g_oTableId.Get_ById(r.GetString2());
}
else
{
this.Layout = null;
}
this.recalcAll();
break;
}
case historyitem_SetSlideNum:
{
if(r.GetBool())
{
this.num = r.GetLong();
}
else
{
this.num = null;
}
break;
}
case historyitem_ShapeAdd:
{
var pos = r.GetLong();
var item = g_oTableId.Get_ById(r.GetString2());
this.cSld.spTree.splice(pos, 0, item);
break;
}
case historyitem_SetCSldName:
{
if(r.GetBool())
{
this.cSld.name = r.GetString2();
}
else
{
this.cSld.name = null;
}
break;
}
case historyitem_SetClrMapOverride:
{
if(r.GetBool())
{
this.clrMap = new ClrMap();
this.clrMap.Read_FromBinary2(r);
}
break;
}
case historyitem_SetShow:
{
this.show = r.GetBool();
break;
}
case historyitem_SetShowPhAnim:
{
this.showMasterPhAnim = r.GetBool();
break;
}
case historyitem_SetShowMasterSp:
{
this.showMasterSp = r.GetBool();
break;
}
}
}
};
......@@ -1609,7 +1609,7 @@ CGraphicObjects.prototype = {
image.spPr.xfrm.offY = (this.slide.presentation.Height - H)/2;
image.spPr.xfrm.extX = W;
image.spPr.xfrm.extY = H;
this.slide.addSp(image);
this.slide.addToSpTreeToPos(this.slide.cSld.spTree.length, image);
editor.WordControl.m_oLogicDocument.recalcMap[image.Id] = image;
},
......
......@@ -230,6 +230,17 @@ var historyitem_SetShowMasterSp = 12;
var historyitem_AddComment = 13;
var historyitem_RemoveComment = 14;
var historyitem_MoveComment = 15;
var historyitem_SetTxStyles = 16;
var historyitem_AddLayout = 17;
var historyitem_SetLayoutMatchingName = 18;
var historyitem_SetLayoutMaster = 19;
var historyitem_SetLayoutType = 20;
var historyitem_SetMasterTheme = 21;
......@@ -248,6 +259,8 @@ var historyitem_PropLockerSetId = 0;
var historyitem_Presenattion_AddSlide = 1; // Добавляем слайд
var historyitem_Presenattion_RemoveSlide = 2; // Удаляем слайд
var historyitem_Presenattion_SlideSize = 3; // Меняем размер слайда
var historyitem_Presenattion_AddSlideMaster = 4; // Меняем размер слайда
......@@ -414,6 +427,8 @@ var historyitem_type_Layout = 31;
var historyitem_type_TextBody = 32;
var historyitem_type_GraphicFrame = 33;
var historyitem_type_Theme = 34;
var historyitem_type_SlideMaster = 35;
......
......@@ -6761,7 +6761,7 @@ CParaPr.prototype =
if ( Flags & 256 )
{
this.Brd.Between = new CDocumentBorder();
this.Brd.Bottom.Read_FromBinary( Reader );
this.Brd.Between.Read_FromBinary( Reader );
}
if ( Flags & 512 )
......
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