Commit c13af914 authored by SergeyLuzyanin's avatar SergeyLuzyanin

notes; fix Bug 34764

parent 3b8e6261
......@@ -546,7 +546,9 @@ var TYPE_TRACK = {
var TYPE_KIND = {
SLIDE : 0,
LAYOUT : 1,
MASTER : 2
MASTER : 2,
NOTES : 3,
NOTES_MASTER: 4
};
var TYPE_TRACK_SHAPE = 0;
......
......@@ -1177,6 +1177,7 @@ CShape.prototype.getHierarchy = function () {
}
case AscFormat.TYPE_KIND.LAYOUT:
case AscFormat.TYPE_KIND.NOTES:
{
hierarchy.push(this.parent.Master.getMatchingShape(ph_type, ph_index));
break;
......@@ -2627,6 +2628,7 @@ CShape.prototype.checkExtentsByAutofit = function(oShape)
CShape.prototype.recalculateLocalTransform = function(transform)
{
var bNotesShape = false;
if (!isRealObject(this.group))
{
if(this.drawingBase && this.fromSerialize)
......@@ -2685,7 +2687,17 @@ CShape.prototype.recalculateLocalTransform = function(transform)
this.y = metrics.y + metricExtY/2 - metricExtX/2;
}
}
else if(typeof AscCommonSlide !== "undefined" && AscCommonSlide
&& AscCommonSlide.CNotes && this.parent && this.parent instanceof AscCommonSlide.CNotes){
bNotesShape = true;
this.x = 0;
this.y = 0;
this.extX = this.parent.getWidth();
this.extY = 2000;
this.rot = 0;
this.flipH = false;
this.flipV = false;
}
else if (this.spPr && this.spPr.xfrm && this.spPr.xfrm.isNotNull())
{
var xfrm = this.spPr.xfrm;
......@@ -2901,7 +2913,7 @@ CShape.prototype.recalculateLocalTransform = function(transform)
}
if(this.checkAutofit && this.checkAutofit() && (!this.bWordShape || !this.group || this.bCheckAutoFitFlag)) {
if(this.checkAutofit && this.checkAutofit() && (!this.bWordShape || !this.group || this.bCheckAutoFitFlag) && !bNotesShape) {
var oBodyPr = this.getBodyPr();
if (this.bWordShape) {
if (this.recalcInfo.recalculateTxBoxContent) {
......
......@@ -2461,6 +2461,7 @@
window['AscDFH'].historyitem_SlideAddToSpTree = window['AscDFH'].historyitem_type_Slide | 12;
window['AscDFH'].historyitem_SlideSetCSldName = window['AscDFH'].historyitem_type_Slide | 13;
window['AscDFH'].historyitem_SlideSetClrMapOverride = window['AscDFH'].historyitem_type_Slide | 14;
window['AscDFH'].historyitem_SlideSetNotes = window['AscDFH'].historyitem_type_Slide | 15;
window['AscDFH'].historyitem_SlideLayoutSetMaster = window['AscDFH'].historyitem_type_SlideLayout | 1;
window['AscDFH'].historyitem_SlideLayoutSetMatchingName = window['AscDFH'].historyitem_type_SlideLayout | 2;
......@@ -2548,6 +2549,8 @@
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;
window['AscDFH'].historyitem_NotesSetSlide = window['AscDFH'].historyitem_type_Notes | 8;
window['AscDFH'].historyitem_NotesSetNotesMaster = window['AscDFH'].historyitem_type_Notes | 9;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -493,8 +493,10 @@ function BinaryPPTYLoader()
s.Seek2(_main_tables["25"]);
var _nm_count = s.GetULong();
for (var i = 0; i < _nm_count; i++)
for (var i = 0; i < _nm_count; i++){
this.presentation.notesMasters[i] = this.ReadNoteMaster();
this.presentation.notesMasters[i].setTheme(this.presentation.themes[0]);//TODO: убрать после того как будут сделаны рельсы
}
}
if (undefined != _main_tables["26"])
......@@ -676,7 +678,7 @@ function BinaryPPTYLoader()
s.Seek2(_main_tables["45"]);
s.Skip2(6); // type + len + start attr
var _noteNum = 0;
var _slideNum = 0;
while (true)
{
var _at = s.GetUChar();
......@@ -684,7 +686,8 @@ function BinaryPPTYLoader()
break;
var indexL = s.GetLong();
var note = this.presentation.notes[indexL];
this.presentation.Slides[_slideNum].setNotes(this.presentation.notes[indexL]);
++_slideNum;
}
}
if (undefined != _main_tables["46"])
......@@ -700,6 +703,7 @@ function BinaryPPTYLoader()
break;
var indexL = s.GetLong();
this.presentation.notes[_noteNum].setNotesMaster(this.presentation.notesMasters[indexL]);
_noteNum++;
}
}
......@@ -3475,6 +3479,7 @@ function BinaryPPTYLoader()
{
var oNotesMaster = new AscCommonSlide.CNotesMaster();
this.TempMainObject = oNotesMaster;
this.stream.Skip2(1); // type
var end = this.stream.cur + this.stream.GetLong() + 4;
while(this.stream.cur < end){
......@@ -3520,12 +3525,14 @@ function BinaryPPTYLoader()
}
this.stream.Seek2(end);
this.TempMainObject = null;
return oNotesMaster;
}
this.ReadNote = function()
{
var oNotes = new AscCommonSlide.CNotes();
this.TempMainObject = oNotes;
var _s = this.stream;
_s.Skip2(1); // type
var _end = _s.cur + _s.GetLong() + 4;
......@@ -3556,6 +3563,11 @@ function BinaryPPTYLoader()
for(var i = 0; i < cSld.spTree.length; ++i){
oNotes.addToSpTreeToPos(i, cSld.spTree[i]);
}
if(cSld.Bg)
{
oNotes.changeBackground(cSld.Bg);
}
oNotes.setCSldName(cSld.name);
break;
}
case 1:
......@@ -3570,7 +3582,7 @@ function BinaryPPTYLoader()
}
}
}
this.TempMainObject = null;
_s.Seek2(_end);
return oNotes;
}
......@@ -4490,8 +4502,15 @@ function BinaryPPTYLoader()
s.GetUChar();
break;
}
case 7:
{
s.GetString2();
break;
}
default:
{
break;
}
}
}
if (dxaOrig > 0 && dyaOrig > 0) {
......@@ -5617,7 +5636,7 @@ function BinaryPPTYLoader()
var _length = s.GetLong();
var _pos = s.cur;
if(typeof AscFormat.CChartSpace !== "undefined")
if(typeof AscFormat.CChartSpace !== "undefined" && _length)
{
var _stream = new AscCommon.FT_Stream2();
_stream.data = s.data;
......@@ -9265,6 +9284,11 @@ function CPres()
s.GetUChar();
break;
}
case 7:
{
var sFileName = s.GetString2();
break;
}
default:
break;
}
......
......@@ -9,12 +9,16 @@
AscDFH.changesFactory[AscDFH.historyitem_NotesRemoveFromTree] = AscDFH.CChangesDrawingsContentPresentation;
AscDFH.changesFactory[AscDFH.historyitem_NotesSetBg] = AscDFH.CChangesDrawingsObjectNoId;
AscDFH.changesFactory[AscDFH.historyitem_NotesSetName] = AscDFH.CChangesDrawingsString;
AscDFH.changesFactory[AscDFH.historyitem_NotesSetSlide] = AscDFH.CChangesDrawingsObject;
AscDFH.changesFactory[AscDFH.historyitem_NotesSetNotesMaster] = AscDFH.CChangesDrawingsObject;
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_NotesSetSlide] = function(oClass, value){oClass.slide = value;};
AscDFH.drawingsChangesMap[AscDFH.historyitem_NotesSetNotesMaster] = function(oClass, value){oClass.Master = value;};
AscDFH.drawingsChangesMap[AscDFH.historyitem_NotesSetBg] = function(oClass, value, FromLoad){
oClass.cSld.Bg = value;
if(FromLoad){
......@@ -38,16 +42,38 @@
AscDFH.drawingContentChanges[AscDFH.historyitem_NotesAddToSpTree] = function(oClass){return oClass.cSld.spTree;};
AscDFH.drawingContentChanges[AscDFH.historyitem_NotesRemoveFromTree] = function(oClass){return oClass.cSld.spTree;};
//Temporary function
function GetNotesWidth(){
return editor.WordControl.m_oNotes.HtmlElement.width/g_dKoef_mm_to_pix;
}
function CNotes(){
this.clrMap = null;
this.cSld = new AscFormat.CSld();
this.showMasterPhAnim = null;
this.showMasterSp = null;
this.slide = null;
this.Master = null;
this.kind = AscFormat.TYPE_KIND.NOTES;
this.Id = AscCommon.g_oIdCounter.Get_NewId();
AscCommon.g_oTableId.Add(this, this.Id);
}
CNotes.prototype.getObjectType = function(){
return AscDFH.historyitem_type_Notes;
};
CNotes.prototype.Write_ToBinary2 = function(w){
w.WriteLong(this.getObjectType());
w.WriteString2(this.Id);
};
CNotes.prototype.Read_FromBinary2 = function(r){
this.Id = r.GetString();
};
CNotes.prototype.setClMapOverride = function(pr){
History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_NotesSetClrMap, this.clrMap, pr));
this.clrMap = pr;
......@@ -93,7 +119,21 @@
History.Add(new AscDFH.CChangesDrawingsString(this, AscDFH.historyitem_NotesSetName, this.cSld.name , pr));
this.cSld.name = pr;
};
CNotes.prototype.setSlide = function(pr){
History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_NotesSetSlide, this.slide , pr));
this.slide = pr;
};
CNotes.prototype.setNotesMaster = function(pr){
History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_NotesSetNotesMaster, this.Master , pr));
this.Master = pr;
};
CNotes.prototype.getMatchingShape = Slide.prototype.getMatchingShape;
CNotes.prototype.getWidth = function(){
return GetNotesWidth();
};
CNotes.prototype.recalculate = function(){
var aSpTree = this.cSld.spTree;
......@@ -101,7 +141,21 @@
var sp = aSpTree[i];
if(sp.isPlaceholder()){
if(sp.getPlaceholderType() === AscFormat.phType_body){
sp.recalculate();
return;
}
}
}
};
CNotes.prototype.draw = function(graphics){
return;
var aSpTree = this.cSld.spTree;
for(var i = 0; i < aSpTree.length; ++i){
var sp = aSpTree[i];
if(sp.isPlaceholder()){
if(sp.getPlaceholderType() === AscFormat.phType_body){
sp.draw(graphics);
return;
}
}
......
......@@ -13,9 +13,9 @@
AscDFH.changesFactory[AscDFH.historyitem_NotesMasterSetName] = AscDFH.CChangesDrawingsString;
AscDFH.drawingsChangesMap[AscDFH.historyitem_NotesMasterSetNotesTheme] = function(oClass, value){oClass.theme = value;};
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_NotesMasterSetNotesStyle] = function(oClass, value){oClass.txStyles = 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;
......@@ -46,17 +46,24 @@
this.clrMap = new AscFormat.ClrMap();
this.cSld = new AscFormat.CSld();
this.hf = null;
this.notesStyle = null;
this.txStyles = null;
this.theme = null;
this.Theme = null;
this.kind = AscFormat.TYPE_KIND.NOTES_MASTER;
this.notesLst = [];
this.Id = AscCommon.g_oIdCounter.Get_NewId();
AscCommon.g_oTableId.Add(this, this.Id);
}
CNotesMaster.prototype.getObjectType = function(){
return AscDFH.historyitem_type_NotesMaster;
};
CNotesMaster.prototype.Write_ToBinary2 = function(w){
w.WriteLong(AscDFH.historyitem_type_NotesMaster);
w.WriteLong(this.getObjectType());
w.WriteString2(this.Id);
};
......@@ -65,8 +72,8 @@
};
CNotesMaster.prototype.setTheme = function(pr){
History.Add(AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_NotesMasterSetNotesTheme, this.theme, pr));
this.theme = pr;
History.Add(AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_NotesMasterSetNotesTheme, this.Theme, pr));
this.Theme = pr;
};
CNotesMaster.prototype.setHF = function(pr){
......@@ -75,8 +82,8 @@
};
CNotesMaster.prototype.setNotesStyle = function(pr){
History.Add(new AscDFH.CChangesDrawingsObjectNoId(this, AscDFH.historyitem_NotesMasterSetNotesStyle, this.notesStyle, pr));
this.notesStyle = pr;
History.Add(new AscDFH.CChangesDrawingsObjectNoId(this, AscDFH.historyitem_NotesMasterSetNotesStyle, this.txStyles, pr));
this.txStyles = pr;
};
CNotesMaster.prototype.addToSpTreeToPos = function(pos, obj){
......@@ -109,6 +116,9 @@
this.cSld.name = pr;
};
CNotesMaster.prototype.getMatchingShape = Slide.prototype.getMatchingShape;
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));
......
......@@ -497,6 +497,9 @@ function CPresentation(DrawingDocument)
this.oLastCheckContent = null;
this.CompositeInput = null;
this.Spelling = new CDocumentSpelling();
// Добавляем данный класс в таблицу Id (обязательно в конце конструктора)
g_oTableId.Add( this, this.Id );
//
......
......@@ -434,6 +434,17 @@ CShape.prototype.getParentObjects = function ()
theme: this.themeOverride ? this.themeOverride : this.parent.Theme
};
}
case AscDFH.historyitem_type_Notes:
{
return {
presentation: editor.WordControl.m_oLogicDocument,
slide: null,
layout: null,
master: this.parent.Master,
theme: this.themeOverride ? this.themeOverride : (this.parent.Master ? this.parent.Master.Theme : null)
}
}
}
}
return { slide: null, layout: null, master: null, theme: null};
......@@ -450,7 +461,7 @@ CShape.prototype.recalculate = function ()
{
if(this.bDeleted || !this.parent)
return;
var check_slide_placeholder = !this.isPlaceholder() || (this.parent && this.parent.getObjectType() === AscDFH.historyitem_type_Slide);
var check_slide_placeholder = !this.isPlaceholder() || (this.parent && (this.parent.getObjectType() === AscDFH.historyitem_type_Slide || this.parent.getObjectType() === AscDFH.historyitem_type_Notes));
AscFormat.ExecuteNoHistory(function(){
......
......@@ -104,6 +104,7 @@ AscDFH.changesFactory[AscDFH.historyitem_SlideSetClrMapOverride ] = AscDFH.CC
AscDFH.changesFactory[AscDFH.historyitem_PropLockerSetId ] = AscDFH.CChangesDrawingsString ;
AscDFH.changesFactory[AscDFH.historyitem_SlideCommentsAddComment ] = AscDFH.CChangesDrawingsContentComments ;
AscDFH.changesFactory[AscDFH.historyitem_SlideCommentsRemoveComment] = AscDFH.CChangesDrawingsContentComments ;
AscDFH.changesFactory[AscDFH.historyitem_SlideSetNotes ] = AscDFH.CChangesDrawingsObject ;
AscDFH.drawingsChangesMap[AscDFH.historyitem_SlideSetComments ] = function(oClass, value){oClass.slideComments = value;};
......@@ -134,6 +135,7 @@ AscDFH.drawingsChangesMap[AscDFH.historyitem_SlideSetBg ] = funct
AscDFH.drawingsChangesMap[AscDFH.historyitem_SlideSetCSldName ] = function(oClass, value){oClass.cSld.name = value;};
AscDFH.drawingsChangesMap[AscDFH.historyitem_SlideSetClrMapOverride ] = function(oClass, value){oClass.clrMap = value;};
AscDFH.drawingsChangesMap[AscDFH.historyitem_PropLockerSetId ] = function(oClass, value){oClass.objectId = value;};
AscDFH.drawingsChangesMap[AscDFH.historyitem_SlideSetNotes ] = function(oClass, value){oClass.notes = value;};
......@@ -161,6 +163,7 @@ function Slide(presentation, slideLayout, slideNum)
this.backgroundFill = null;
this.notes = null;
this.timing = new CAscSlideTiming();
this.timing.setDefaultParams();
......@@ -542,6 +545,11 @@ Slide.prototype =
this.Id = r.GetString2();
},
setNotes: function(pr){
History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_SlideSetNotes, this.notes, pr));
this.notes = pr;
},
setSlideComments: function(comments)
{
History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_SlideSetComments, this.slideComments, comments));
......@@ -924,6 +932,9 @@ Slide.prototype =
this.recalculateSpTree();
this.recalcInfo.recalculateSpTree = false;
}
if(this.notes){
this.notes.recalculate();
}
this.cachedImage = null;
},
......@@ -1021,6 +1032,9 @@ Slide.prototype =
comments[i].draw(graphics);
}
}
if(this.notes){
this.notes.draw(graphics);
}
},
drawSelect: function(_type)
......
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