Commit fd462fe2 authored by SergeyLuzyanin's avatar SergeyLuzyanin

show/hide slides

parent 4eedc6c5
......@@ -595,13 +595,14 @@
window['AscDFH'].CChangesDrawingChangeTheme = CChangesDrawingChangeTheme;
function CChangesDrawingTimingLocks(Class, deleteLock, backgroundLock, timingLock, transitionLock, layoutLock){
function CChangesDrawingTimingLocks(Class, deleteLock, backgroundLock, timingLock, transitionLock, layoutLock, showLock){
this.Type = AscDFH.historyitem_SlideSetLocks;
this.deleteLock = deleteLock;
this.backgroundLock = backgroundLock;
this.timingLock = timingLock;
this.transitionLock = transitionLock;
this.layoutLock = layoutLock;
this.showLock = showLock;
AscDFH.CChangesBase.call(this, Class);
}
......@@ -614,6 +615,7 @@
AscFormat.writeObject(Writer, this.timingLock);
AscFormat.writeObject(Writer, this.transitionLock);
AscFormat.writeObject(Writer, this.layoutLock);
AscFormat.writeObject(Writer, this.showLock);
};
CChangesDrawingTimingLocks.prototype.ReadFromBinary = function(Reader){
......@@ -622,6 +624,7 @@
this.timingLock = AscFormat.readObject(Reader);
this.transitionLock = AscFormat.readObject(Reader);
this.layoutLock = AscFormat.readObject(Reader);
this.showLock = AscFormat.readObject(Reader);
};
CChangesDrawingTimingLocks.prototype.Undo = function(){
......@@ -631,6 +634,7 @@
oSlide.timingLock = null;
oSlide.transitionLock = null;
oSlide.layoutLock = null;
oSlide.showLock = null;
};
CChangesDrawingTimingLocks.prototype.Redo = function(){
......@@ -640,6 +644,7 @@
oSlide.timingLock = this.timingLock;
oSlide.transitionLock = this.transitionLock;
oSlide.layoutLock = this.layoutLock;
oSlide.showLock = this.showLock;
};
CChangesDrawingTimingLocks.prototype.Load = function(){
this.Redo();
......
......@@ -2924,6 +2924,7 @@
window['AscDFH'].historydescription_Document_RemoveContentControl = 0x0143;
window['AscDFH'].historydescription_Document_RemoveContentControlWrapper = 0x0144;
window['AscDFH'].historydescription_Document_ChangeContentControlProperties = 0x0145;
window['AscDFH'].historydescription_Presentation_HideSlides = 0x0146;
......
......@@ -891,6 +891,20 @@ if(typeof CPresentation !== "undefined")
this.Slides[selected_slides[i]].backgroundLock.Lock.Check(check_obj);
}
}
if(CheckType === AscCommon.changestype_SlideHide)
{
var selected_slides = editor.WordControl.Thumbnails.GetSelectedArray();
for(var i = 0; i < selected_slides.length; ++i)
{
var check_obj =
{
"type": c_oAscLockTypeElemPresentation.Slide,
"val": this.Slides[selected_slides[i]].showLock.Get_Id(),
"guid": this.Slides[selected_slides[i]].showLock.Get_Id()
};
this.Slides[selected_slides[i]].showLock.Lock.Check(check_obj);
}
}
if(CheckType === AscCommon.changestype_SlideTiming)
{
......
......@@ -1071,6 +1071,7 @@
var changestype_AddShape = 72;
var changestype_AddShapes = 73;
var changestype_PresDefaultLang = 74;
var changestype_SlideHide = 75;
var changestype_2_InlineObjectMove = 1; // Передвигаем объект в заданную позцию (проверяем место, в которое пытаемся передвинуть)
var changestype_2_HdrFtr = 2; // Изменения с колонтитулом
......@@ -1768,6 +1769,7 @@
window["AscCommon"].changestype_AddShape = changestype_AddShape;
window["AscCommon"].changestype_AddShapes = changestype_AddShapes;
window["AscCommon"].changestype_PresDefaultLang = changestype_PresDefaultLang;
window["AscCommon"].changestype_SlideHide = changestype_SlideHide;
window["AscCommon"].changestype_2_InlineObjectMove = changestype_2_InlineObjectMove;
window["AscCommon"].changestype_2_HdrFtr = changestype_2_HdrFtr;
window["AscCommon"].changestype_2_Comment = changestype_2_Comment;
......
......@@ -3518,6 +3518,16 @@ function CThumbnailsManager()
return _MinPositionPage;
}
this.IsSlideHidden = function(aSelected){
var oPresentation = oThis.m_oWordControl.m_oLogicDocument;
for(var i = 0; i < aSelected.length; ++i){
if(oPresentation.IsVisibleSlide(aSelected[i])){
return false;
}
}
return true;
};
this.onMouseDown = function(e)
{
if (oThis.m_oWordControl)
......@@ -3561,6 +3571,7 @@ function CThumbnailsManager()
_data.X_abs = global_mouseEvent.X - ((oThis.m_oWordControl.m_oThumbnails.AbsolutePosition.L * g_dKoef_mm_to_pix) >> 0) - oThis.m_oWordControl.X;
_data.Y_abs = global_mouseEvent.Y - ((oThis.m_oWordControl.m_oThumbnails.AbsolutePosition.T * g_dKoef_mm_to_pix) >> 0) - oThis.m_oWordControl.Y;
_data.IsSlideSelect = false;
_data.IsSlideHidden = oThis.IsSlideHidden(oThis.GetSelectedArray());
oThis.m_oWordControl.m_oApi.sync_ContextMenuCallback(_data);
}
return false;
......@@ -3647,6 +3658,7 @@ function CThumbnailsManager()
{
var _data = new AscCommonSlide.CContextMenuData();
_data.Type = Asc.c_oAscContextMenuTypes.Thumbnails;
_data.IsSlideHidden = oThis.IsSlideHidden(oThis.GetSelectedArray());
_data.X_abs = global_mouseEvent.X - ((oThis.m_oWordControl.m_oThumbnails.AbsolutePosition.L * g_dKoef_mm_to_pix) >> 0) - oThis.m_oWordControl.X;
_data.Y_abs = global_mouseEvent.Y - ((oThis.m_oWordControl.m_oThumbnails.AbsolutePosition.T * g_dKoef_mm_to_pix) >> 0) - oThis.m_oWordControl.Y;
oThis.m_oWordControl.m_oApi.sync_ContextMenuCallback(_data);
......@@ -3676,6 +3688,7 @@ function CThumbnailsManager()
{
var _data = new AscCommonSlide.CContextMenuData();
_data.Type = Asc.c_oAscContextMenuTypes.Thumbnails;
_data.IsSlideHidden = oThis.IsSlideHidden(oThis.GetSelectedArray());
_data.X_abs = global_mouseEvent.X - ((oThis.m_oWordControl.m_oThumbnails.AbsolutePosition.L * g_dKoef_mm_to_pix) >> 0) - oThis.m_oWordControl.X;
_data.Y_abs = global_mouseEvent.Y - ((oThis.m_oWordControl.m_oThumbnails.AbsolutePosition.T * g_dKoef_mm_to_pix) >> 0) - oThis.m_oWordControl.Y;
oThis.m_oWordControl.m_oApi.sync_ContextMenuCallback(_data);
......@@ -5153,7 +5166,9 @@ function CThumbnailsManager()
var ConvertedPos = this.GetThumbnailPagePosition(nSlideIndex);
if (ConvertedPos)
{
editor.sync_ContextMenuCallback(new AscCommonSlide.CContextMenuData({Type : Asc.c_oAscContextMenuTypes.Thumbnails, X_abs : ConvertedPos.X, Y_abs : ConvertedPos.Y, IsSlideSelect : true}));
var bIsSlideHidden = this.IsSlideHidden(aSelected);
editor.sync_ContextMenuCallback(new AscCommonSlide.CContextMenuData({Type : Asc.c_oAscContextMenuTypes.Thumbnails, X_abs : ConvertedPos.X, Y_abs : ConvertedPos.Y, IsSlideSelect : true,
IsSlideHidden: bIsSlideHidden}));
}
return false;
}
......@@ -5167,7 +5182,9 @@ function CThumbnailsManager()
var ConvertedPos = this.GetThumbnailPagePosition(nSlideIndex);
if (ConvertedPos)
{
editor.sync_ContextMenuCallback(new AscCommonSlide.CContextMenuData({Type : Asc.c_oAscContextMenuTypes.Thumbnails, X_abs : ConvertedPos.X, Y_abs : ConvertedPos.Y, IsSlideSelect : true}));
var bIsSlideHidden = this.IsSlideHidden(aSelected);
editor.sync_ContextMenuCallback(new AscCommonSlide.CContextMenuData({Type : Asc.c_oAscContextMenuTypes.Thumbnails, X_abs : ConvertedPos.X, Y_abs : ConvertedPos.Y, IsSlideSelect : true,
IsSlideHidden: bIsSlideHidden}));
}
return false;
}
......
......@@ -2479,6 +2479,35 @@ CPresentation.prototype =
return this.globalTableStyles;
},
IsVisibleSlide: function (nIndex) {
var oSlide = this.Slides[nIndex];
if(!oSlide){
return false;
}
return oSlide.isVisible();
},
hideSlides: function(isHide){
var aSelectedArray = editor.WordControl.Thumbnails.GetSelectedArray();
if(false === this.Document_Is_SelectionLocked(AscCommon.changestype_SlideHide, aSelectedArray)){
History.Create_NewPoint(AscDFH.historydescription_Presentation_HideSlides);
var bShow = !isHide;
var oSlide;
var nIndex;
for(var i = 0; i < aSelectedArray.length; ++i){
nIndex = aSelectedArray[i];
oSlide = this.Slides[nIndex];
if(oSlide){
oSlide.setShow(bShow);
this.DrawingDocument.OnRecalculatePage(nIndex, oSlide);//need only for update index label in thumbnails; TODO: remove it
}
}
this.DrawingDocument.OnEndRecalculate(false, false);
this.Document_UpdateUndoRedoState();
}
},
SelectAll : function()
{
......
......@@ -194,6 +194,7 @@ function Slide(presentation, slideLayout, slideNum)
this.timingLock = null;
this.transitionLock = null;
this.layoutLock = null;
this.showLock = null;
this.Lock = new AscCommon.CLock();
this.Id = AscCommon.g_oIdCounter.Get_NewId();
......@@ -213,7 +214,7 @@ function Slide(presentation, slideLayout, slideNum)
this.Width = presentation.Width;
this.Height = presentation.Height;
this.setSlideComments(new SlideComments(this));
this.setLocks(new PropLocker(this.Id), new PropLocker(this.Id), new PropLocker(this.Id), new PropLocker(this.Id), new PropLocker(this.Id));
this.setLocks(new PropLocker(this.Id), new PropLocker(this.Id), new PropLocker(this.Id), new PropLocker(this.Id), new PropLocker(this.Id), new PropLocker(this.Id));
}
if(slideLayout)
......@@ -633,14 +634,15 @@ Slide.prototype =
this.cSld.Bg = bg;
},
setLocks: function(deleteLock, backgroundLock, timingLock, transitionLock, layoutLock)
setLocks: function(deleteLock, backgroundLock, timingLock, transitionLock, layoutLock, showLock)
{
this.deleteLock = deleteLock;
this.backgroundLock = backgroundLock;
this.timingLock = timingLock;
this.transitionLock = transitionLock;
this.layoutLock = layoutLock;
History.Add(new AscDFH.CChangesDrawingTimingLocks(this, deleteLock, backgroundLock, timingLock, transitionLock, layoutLock));
this.showLock = showLock;
History.Add(new AscDFH.CChangesDrawingTimingLocks(this, deleteLock, backgroundLock, timingLock, transitionLock, layoutLock, showLock));
},
shapeAdd: function(pos, item)
......@@ -651,6 +653,10 @@ Slide.prototype =
this.cSld.spTree.splice(_pos, 0, item);
},
isVisible: function(){
return this.show !== false;
},
checkDrawingUniNvPr: function(drawing)
{
var nv_sp_pr;
......
......@@ -5917,6 +5917,11 @@ background-repeat: no-repeat;\
_tr.Start(true);
};
asc_docs_api.prototype.asc_HideSlides = function(isHide)
{
this.WordControl.m_oLogicDocument.hideSlides(isHide);
};
asc_docs_api.prototype.sync_EndAddShape = function()
{
editor.sendEvent("asc_onEndAddShape");
......@@ -5983,6 +5988,7 @@ background-repeat: no-repeat;\
this.X_abs = oData.X_abs;
this.Y_abs = oData.Y_abs;
this.IsSlideSelect = oData.IsSlideSelect;
this.IsSlideHidden = oData.IsSlideHidden;
}
else
{
......@@ -5990,6 +5996,7 @@ background-repeat: no-repeat;\
this.X_abs = 0;
this.Y_abs = 0;
this.IsSlideSelect = true;
this.IsSlideHidden = false;
}
}
......@@ -6921,6 +6928,7 @@ background-repeat: no-repeat;\
asc_docs_api.prototype['ApplySlideTiming'] = asc_docs_api.prototype.ApplySlideTiming;
asc_docs_api.prototype['SlideTimingApplyToAll'] = asc_docs_api.prototype.SlideTimingApplyToAll;
asc_docs_api.prototype['SlideTransitionPlay'] = asc_docs_api.prototype.SlideTransitionPlay;
asc_docs_api.prototype['asc_HideSlides'] = asc_docs_api.prototype.asc_HideSlides;
asc_docs_api.prototype['SetTextBoxInputMode'] = asc_docs_api.prototype.SetTextBoxInputMode;
asc_docs_api.prototype['GetTextBoxInputMode'] = asc_docs_api.prototype.GetTextBoxInputMode;
asc_docs_api.prototype['sync_EndAddShape'] = asc_docs_api.prototype.sync_EndAddShape;
......
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