Commit 68673581 authored by SergeyLuzyanin's avatar SergeyLuzyanin

Added Notes and NotesMaster classes

parent 01ff19da
......@@ -131,6 +131,8 @@
"../slide/Editor/Format/SlideMaster.js",
"../slide/Editor/Format/Layout.js",
"../slide/Editor/Format/Comments.js",
"../slide/Editor/Format/NotesMaster.js",
"../slide/Editor/Format/Notes.js",
"../word/Editor/DocumentContentElementBase.js",
"../word/Editor/StructuredDocumentTags/BlockLevel.js",
"../word/Editor/Styles.js",
......
......@@ -1233,6 +1233,8 @@
window['AscDFH'].historyitem_type_OleObject = 1125 << 16;
window['AscDFH'].historyitem_type_DrawingContent = 1126 << 16;
window['AscDFH'].historyitem_type_Sparkline = 1127 << 16;
window['AscDFH'].historyitem_type_NotesMaster = 1128 << 16;
window['AscDFH'].historyitem_type_Notes = 1129 << 16;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
......@@ -2529,6 +2531,25 @@
window['AscDFH'].historyitem_Sparkline_RemoveSparkline = window['AscDFH'].historyitem_type_Sparkline | 29;
window['AscDFH'].historyitem_NotesMasterSetHF = window['AscDFH'].historyitem_type_NotesMaster | 1;
window['AscDFH'].historyitem_NotesMasterSetNotesStyle = window['AscDFH'].historyitem_type_NotesMaster | 2;
window['AscDFH'].historyitem_NotesMasterSetNotesTheme = window['AscDFH'].historyitem_type_NotesMaster | 3;
window['AscDFH'].historyitem_NotesMasterAddToSpTree = window['AscDFH'].historyitem_type_NotesMaster | 4;
window['AscDFH'].historyitem_NotesMasterRemoveFromTree = window['AscDFH'].historyitem_type_NotesMaster | 5;
window['AscDFH'].historyitem_NotesMasterSetBg = window['AscDFH'].historyitem_type_NotesMaster | 6;
window['AscDFH'].historyitem_NotesMasterAddToNotesLst = window['AscDFH'].historyitem_type_NotesMaster | 7;
window['AscDFH'].historyitem_NotesMasterSetName = window['AscDFH'].historyitem_type_NotesMaster | 8;
window['AscDFH'].historyitem_NotesSetClrMap = window['AscDFH'].historyitem_type_Notes | 1;
window['AscDFH'].historyitem_NotesSetShowMasterPhAnim = window['AscDFH'].historyitem_type_Notes | 2;
window['AscDFH'].historyitem_NotesSetShowMasterSp = window['AscDFH'].historyitem_type_Notes | 3;
window['AscDFH'].historyitem_NotesAddToSpTree = window['AscDFH'].historyitem_type_Notes | 4;
window['AscDFH'].historyitem_NotesRemoveFromTree = window['AscDFH'].historyitem_type_Notes | 5;
window['AscDFH'].historyitem_NotesSetBg = window['AscDFH'].historyitem_type_Notes | 6;
window['AscDFH'].historyitem_NotesSetName = window['AscDFH'].historyitem_type_Notes | 7;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
......
......@@ -3420,12 +3420,106 @@ function BinaryPPTYLoader()
this.ReadNoteMaster = function()
{
return null;
var oNotesMaster = new AscFormat.CNotesMaster();
this.stream.Skip2(1); // type
var end = this.stream.cur + this.stream.GetLong() + 4;
while(this.stream.cur < end){
var at = this.stream.GetUChar();
switch (at)
{
case 0:
{
var cSld = new AscFormat.CSld();
this.ReadCSld(cSld);
for(var i = 0; i < cSld.spTree.length; ++i){
oNotesMaster.addToSpTreeToPos(i, cSld.spTree[i]);
}
if(cSld.Bg)
{
oNotesMaster.changeBackground(cSld.Bg);
}
oNotesMaster.setCSldName(cSld.name);
break;
}
case 1:
{
this.ReadClrMap(oNotesMaster.clrMap);
break;
}
case 2:
{
oNotesMaster.setHF(this.ReadHF());
break;
}
case 3:
{
oNotesMaster.setNotesStyle(this.ReadTxStyles());
break;
}
default:
{
this.stream.SkipRecord();
break;
}
}
}
this.stream.Seek2(end);
return oNotesMaster;
}
this.ReadNote = function()
{
return null;
var oNotes = new AscCommonSlide.CNotes();
var _s = this.stream;
_s.Skip2(1); // type
var _end = _s.GetPos() + _s.GetLong() + 4;
_s.Skip2(1); // attribute start
while (true)
{
var _at = _s.GetUChar();
if (_at == g_nodeAttributeEnd)
break;
if (0 == _at)
oNotes.setShowMasterPhAnim(_s.GetBool());
else if (1 == _at)
oNotes.setShowMasterSp(_s.GetBool());
}
while (_s.cur < _end)
{
var _rec = _s.GetUChar();
switch (_rec)
{
case 0:
{
var cSld = new AscFormat.CSld();
this.ReadCSld(cSld);
for(var i = 0; i < cSld.spTree.length; ++i){
oNotes.addToSpTreeToPos(i, cSld.spTree[i]);
}
break;
}
case 1:
{
oNotes.setClMapOverride(this.ReadClrOverride());
break;
}
default:
{
_s.SkipRecord();
break;
}
}
}
_s.Seek2(_end);
return oNotes;
}
this.ReadCSld = function(csld)
......
/**
* Created by Sergey.Luzyanin on 4/11/2017.
*/
(function(){
AscDFH.changesFactory[AscDFH.historyitem_NotesSetClrMap] = AscDFH.CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_NotesSetShowMasterPhAnim] = AscDFH.CChangesDrawingsBool;
AscDFH.changesFactory[AscDFH.historyitem_NotesSetShowMasterSp] = AscDFH.CChangesDrawingsBool;
AscDFH.changesFactory[AscDFH.historyitem_NotesAddToSpTree] = AscDFH.CChangesDrawingsContentPresentation;
AscDFH.changesFactory[AscDFH.historyitem_NotesRemoveFromTree] = AscDFH.CChangesDrawingsContentPresentation;
AscDFH.changesFactory[AscDFH.historyitem_NotesSetBg] = AscDFH.CChangesDrawingsObjectNoId;
AscDFH.changesFactory[AscDFH.historyitem_NotesSetName] = AscDFH.CChangesDrawingsString;
AscDFH.drawingsChangesMap[AscDFH.historyitem_NotesSetClrMap] = function(oClass, value){oClass.clrMap = value;};
AscDFH.drawingsChangesMap[AscDFH.historyitem_NotesSetShowMasterPhAnim] = function(oClass, value){oClass.showMasterPhAnim = value;};
AscDFH.drawingsChangesMap[AscDFH.historyitem_NotesSetShowMasterSp] = function(oClass, value){oClass.showMasterSp = value;};
AscDFH.drawingsChangesMap[AscDFH.historyitem_NotesSetName] = function(oClass, value){oClass.cSld.name = value;};
AscDFH.drawingsChangesMap[AscDFH.historyitem_NotesSetBg] = function(oClass, value, FromLoad){
oClass.cSld.Bg = value;
if(FromLoad){
var Fill;
if(oClass.cSld.Bg && oClass.cSld.Bg.bgPr && oClass.cSld.Bg.bgPr.Fill)
{
Fill = oClass.cSld.Bg.bgPr.Fill;
}
if(typeof AscCommon.CollaborativeEditing !== "undefined")
{
if(Fill && Fill.fill && Fill.fill.type === Asc.c_oAscFill.FILL_TYPE_BLIP && typeof Fill.fill.RasterImageId === "string" && Fill.fill.RasterImageId.length > 0)
{
AscCommon.CollaborativeEditing.Add_NewImage(AscCommon.getFullImageSrc2(Fill.fill.RasterImageId));
}
}
}
};
AscDFH.drawingsConstructorsMap[AscDFH.historyitem_NotesSetBg] = AscFormat.CBg;
AscDFH.drawingContentChanges[AscDFH.historyitem_NotesAddToSpTree] = function(oClass){return oClass.cSld.spTree;};
AscDFH.drawingContentChanges[AscDFH.historyitem_NotesRemoveFromTree] = function(oClass){return oClass.cSld.spTree;};
function CNotes(){
this.clrMap = null;
this.cSld = new AscFormat.CSld();
this.showMasterPhAnim = null;
this.showMasterSp = null;
this.Id = AscCommon.g_oIdCounter.Get_NewId();
AscCommon.g_oTableId.Add(this, this.Id);
}
CNotes.prototype.setClMapOverride = function(pr){
History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_NotesSetClrMap, this.clrMap, pr));
this.clrMap = pr;
};
CNotes.prototype.setShowMasterPhAnim = function(pr){
History.Add(new AscDFH.CChangesDrawingsBool(this, AscDFH.historyitem_NotesSetShowMasterPhAnim, this.showMasterPhAnim, pr));
this.showMasterPhAnim = pr;
};
CNotes.prototype.setShowMasterSp = function (pr) {
History.Add(new AscDFH.CChangesDrawingsBool(this, AscDFH.historyitem_NotesSetShowMasterSp, this.showMasterSp, pr));
this.showMasterSp = pr;
};
CNotes.prototype.addToSpTreeToPos = function(pos, obj){
var _pos = Math.max(0, Math.min(pos, this.cSld.spTree.length));
History.Add(new AscDFH.CChangesDrawingsContentPresentation(this, AscDFH.historyitem_NotesAddToSpTree, _pos, [obj], true));
this.cSld.spTree.splice(_pos, 0, obj);
};
CNotes.prototype.removeFromSpTreeByPos = function(pos){
if(pos > -1 && pos < this.cSld.spTree.length){
History.Add(new AscDFH.CChangesDrawingsContentPresentation(this, AscDFH.historyitem_NotesRemoveFromTree, pos, this.cSld.spTree.splice(pos, 1), false));
}
};
CNotes.prototype.removeFromSpTreeById = function(id){
for(var i = this.cSld.spTree.length - 1; i > -1; --i){
if(this.cSld.spTree[i].Get_Id() === id){
this.removeFromSpTreeByPos(i);
}
}
};
CNotes.prototype.changeBackground = function(bg){
History.Add(new AscDFH.CChangesDrawingsObjectNoId(this, AscDFH.historyitem_NotesSetBg, this.cSld.Bg , bg));
this.cSld.Bg = bg;
};
CNotesMaster.prototype.setCSldName = function(pr){
History.Add(new AscDFH.CChangesDrawingsString(this, AscDFH.historyitem_NotesSetName, this.cSld.name , pr));
this.cSld.name = pr;
};
window['AscCommonSlide'] = window['AscCommonSlide'] || {};
window['AscCommonSlide'].CNotes = CNotes;
})();
/**
* Created by Sergey.Luzyanin on 4/11/2017.
*/
(function(){
AscDFH.changesFactory[AscDFH.historyitem_NotesMasterSetNotesTheme] = AscDFH.CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_NotesMasterSetHF] = AscDFH.CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_NotesMasterSetNotesStyle] = AscDFH.CChangesDrawingsObjectNoId;
AscDFH.changesFactory[AscDFH.historyitem_NotesMasterAddToSpTree] = AscDFH.CChangesDrawingsContentPresentation;
AscDFH.changesFactory[AscDFH.historyitem_NotesMasterRemoveFromTree] = AscDFH.CChangesDrawingsContentPresentation;
AscDFH.changesFactory[AscDFH.historyitem_NotesMasterSetBg] = AscDFH.CChangesDrawingsObjectNoId;
AscDFH.changesFactory[AscDFH.historyitem_NotesMasterAddToNotesLst] = AscDFH.CChangesDrawingsContentPresentation;
AscDFH.changesFactory[AscDFH.historyitem_NotesMasterSetName] = AscDFH.CChangesDrawingsString;
AscDFH.drawingsChangesMap[AscDFH.historyitem_NotesMasterSetNotesTheme] = function(oClass, value){oClass.theme = value;};
AscDFH.drawingsChangesMap[AscDFH.historyitem_NotesMasterSetHF] = function(oClass, value){oClass.hf = value;};
AscDFH.drawingsChangesMap[AscDFH.historyitem_NotesMasterSetNotesStyle] = function(oClass, value){oClass.notesStyle = value;};
AscDFH.drawingsChangesMap[AscDFH.historyitem_NotesMasterSetName] = function(oClass, value){oClass.cSld.name = value;};
AscDFH.drawingsChangesMap[AscDFH.historyitem_NotesMasterSetBg] = function(oClass, value, FromLoad){
oClass.cSld.Bg = value;
if(FromLoad){
var Fill;
if(oClass.cSld.Bg && oClass.cSld.Bg.bgPr && oClass.cSld.Bg.bgPr.Fill)
{
Fill = oClass.cSld.Bg.bgPr.Fill;
}
if(typeof AscCommon.CollaborativeEditing !== "undefined")
{
if(Fill && Fill.fill && Fill.fill.type === Asc.c_oAscFill.FILL_TYPE_BLIP && typeof Fill.fill.RasterImageId === "string" && Fill.fill.RasterImageId.length > 0)
{
AscCommon.CollaborativeEditing.Add_NewImage(AscCommon.getFullImageSrc2(Fill.fill.RasterImageId));
}
}
}
};
AscDFH.drawingsConstructorsMap[AscDFH.historyitem_NotesMasterSetNotesStyle] = AscFormat.CTextStyles;
AscDFH.drawingsConstructorsMap[AscDFH.historyitem_NotesMasterSetBg] = AscFormat.CBg;
AscDFH.drawingContentChanges[AscDFH.historyitem_NotesMasterAddToSpTree] = function(oClass){return oClass.cSld.spTree;};
AscDFH.drawingContentChanges[AscDFH.historyitem_NotesMasterRemoveFromTree] = function(oClass){return oClass.cSld.spTree;};
AscDFH.drawingContentChanges[AscDFH.historyitem_NotesMasterAddToNotesLst] = function(oClass){return oClass.notesLst;};
function CNotesMaster(){
this.clrMap = new AscFormat.ClrMap();
this.cSld = new AscFormat.CSld();
this.hf = null;
this.notesStyle = null;
this.theme = null;
this.notesLst = [];
this.Id = AscCommon.g_oIdCounter.Get_NewId();
AscCommon.g_oTableId.Add(this, this.Id);
}
CNotesMaster.prototype.Write_ToBinary2 = function(w){
w.WriteLong(AscDFH.historyitem_type_NotesMaster);
w.WriteString2(this.Id);
};
CNotesMaster.prototype.Read_FromBinary2 = function(r){
this.Id = r.GetString();
};
CNotesMaster.prototype.setTheme = function(pr){
History.Add(AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_NotesMasterSetNotesTheme, this.theme, pr));
this.theme = pr;
};
CNotesMaster.prototype.setHF = function(pr){
History.Add(AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_NotesMasterSetHF, this.hf, pr));
this.hf = pr;
};
CNotesMaster.prototype.setNotesStyle = function(pr){
History.Add(new AscDFH.CChangesDrawingsObjectNoId(this, AscDFH.historyitem_NotesMasterSetNotesStyle, this.notesStyle, pr));
this.notesStyle = pr;
};
CNotesMaster.prototype.addToSpTreeToPos = function(pos, obj){
var _pos = Math.max(0, Math.min(pos, this.cSld.spTree.length));
History.Add(new AscDFH.CChangesDrawingsContentPresentation(this, AscDFH.historyitem_NotesMasterAddToSpTree, _pos, [obj], true));
this.cSld.spTree.splice(_pos, 0, obj);
};
CNotesMaster.prototype.removeFromSpTreeByPos = function(pos){
if(pos > -1 && pos < this.cSld.spTree.length){
History.Add(new AscDFH.CChangesDrawingsContentPresentation(this, AscDFH.historyitem_NotesMasterRemoveFromTree, pos, this.cSld.spTree.splice(pos, 1), false));
}
};
CNotesMaster.prototype.removeFromSpTreeById = function(id){
for(var i = this.cSld.spTree.length - 1; i > -1; --i){
if(this.cSld.spTree[i].Get_Id() === id){
this.removeFromSpTreeByPos(i);
}
}
};
CNotesMaster.prototype.changeBackground = function(bg){
History.Add(new AscDFH.CChangesDrawingsObjectNoId(this, AscDFH.historyitem_NotesMasterSetBg, this.cSld.Bg , bg));
this.cSld.Bg = bg;
};
CNotesMaster.prototype.setCSldName = function(pr){
History.Add(new AscDFH.CChangesDrawingsString(this, AscDFH.historyitem_NotesMasterSetName, this.cSld.name , pr));
this.cSld.name = pr;
};
CNotesMaster.prototype.addToNotesLst = function (pr, pos) {
var _pos = AscFormat.isRealNumber(pos) ? Math.max(0, Math.min(pos, this.notesLst.length)) : this.notesLst.length;
History.Add(new AscDFH.CChangesDrawingsContentPresentation(this, AscDFH.historyitem_NotesMasterAddToNotesLst, _pos, [pr], true));
this.notesLst.splice(_pos, 0, pr);
};
window['AscCommonSlide'] = window['AscCommonSlide'] || {};
window['AscCommonSlide'].CNotesMaster = CNotesMaster;
})();
\ No newline at end of file
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