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

DuplicateSlide

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58568 954022d7-b5bf-4e40-9824-e11837661b57
parent 4d3c1f80
...@@ -83,7 +83,6 @@ CGroupShape.prototype = ...@@ -83,7 +83,6 @@ CGroupShape.prototype =
this.bDeleted = pr; this.bDeleted = pr;
}, },
setBDeleted2: function(pr) setBDeleted2: function(pr)
{ {
this.bDeleted = pr; this.bDeleted = pr;
...@@ -100,7 +99,6 @@ CGroupShape.prototype = ...@@ -100,7 +99,6 @@ CGroupShape.prototype =
} }
}, },
documentUpdateSelectionState: function() documentUpdateSelectionState: function()
{ {
if(this.selection.textSelection) if(this.selection.textSelection)
...@@ -134,6 +132,7 @@ CGroupShape.prototype = ...@@ -134,6 +132,7 @@ CGroupShape.prototype =
this.selection.chartSelection.selection.textSelection.getDocContent().Selection_Draw_Page(pageIndex); this.selection.chartSelection.selection.textSelection.getDocContent().Selection_Draw_Page(pageIndex);
} }
}, },
Write_ToBinary2: function(w) Write_ToBinary2: function(w)
{ {
w.WriteLong(historyitem_type_GroupShape); w.WriteLong(historyitem_type_GroupShape);
...@@ -199,7 +198,6 @@ CGroupShape.prototype = ...@@ -199,7 +198,6 @@ CGroupShape.prototype =
return this.spTree.splice(pos, 1)[0]; return this.spTree.splice(pos, 1)[0];
}, },
handleUpdateSpTree: function() handleUpdateSpTree: function()
{ {
if(!this.group) if(!this.group)
...@@ -524,7 +522,6 @@ CGroupShape.prototype = ...@@ -524,7 +522,6 @@ CGroupShape.prototype =
object.select(this, pageIndex); object.select(this, pageIndex);
}, },
recalculate: function() recalculate: function()
{ {
var recalcInfo = this.recalcInfo; var recalcInfo = this.recalcInfo;
...@@ -577,7 +574,6 @@ CGroupShape.prototype = ...@@ -577,7 +574,6 @@ CGroupShape.prototype =
} }
}, },
canRotate: function() canRotate: function()
{ {
//TODO: сделать еще проверку SpLock //TODO: сделать еще проверку SpLock
...@@ -612,11 +608,11 @@ CGroupShape.prototype = ...@@ -612,11 +608,11 @@ CGroupShape.prototype =
return true;//TODO return true;//TODO
}, },
canChangeAdjustments: function() canChangeAdjustments: function()
{ {
return false; return false;
}, },
drawAdjustments: function() drawAdjustments: function()
{}, {},
......
...@@ -1983,8 +1983,8 @@ CShape.prototype = ...@@ -1983,8 +1983,8 @@ CShape.prototype =
this.recalcTransform && this.recalcTransform(); this.recalcTransform && this.recalcTransform();
}, },
recalculateTransform: function () { recalculateTransform: function ()
{
this.cachedImage = null; this.cachedImage = null;
this.recalculateLocalTransform(this.transform); this.recalculateLocalTransform(this.transform);
this.invertTransform = global_MatrixTransformer.Invert(this.transform); this.invertTransform = global_MatrixTransformer.Invert(this.transform);
......
...@@ -16,6 +16,22 @@ function CContentChangesElement(Type, Pos, Count, Data) ...@@ -16,6 +16,22 @@ function CContentChangesElement(Type, Pos, Count, Data)
this.Refresh_BinaryData = function() this.Refresh_BinaryData = function()
{ {
this.m_pData.Pos = this.m_aPositions[0]; this.m_pData.Pos = this.m_aPositions[0];
if(editor && editor.isPresentationEditor)
{
var Binary_Writer = History.BinaryWriter;
var Binary_Pos = Binary_Writer.GetCurPosition();
this.m_pData.Data.UseArray = true;
this.m_pData.Data.PosArray = this.m_aPositions;
this.m_pData.Class.Save_Changes( this.m_pData.Data, Binary_Writer );
var Binary_Len = Binary_Writer.GetCurPosition() - Binary_Pos;
this.m_pData.Binary.Pos = Binary_Pos;
this.m_pData.Binary.Len = Binary_Len;
}
}; };
this.Check_Changes = function(Type, Pos) this.Check_Changes = function(Type, Pos)
......
...@@ -3,6 +3,29 @@ ...@@ -3,6 +3,29 @@
var History = null; var History = null;
var recalcSlideInterval = 30; var recalcSlideInterval = 30;
function SlideCopyObject(Slide, ImageUrl)
{
this.Slide = Slide;
this.ImageUrl = ImageUrl;
}
function DrawingCopyObject(Drawing, X, Y, ExtX, ExtY, ImageUrl)
{
this.Drawing = Drawing;
this.X = X;
this.Y = Y;
this.ExtX = ExtX;
this.ExtY = ExtY;
this.ImageUrl = ImageUrl;
}
function PresentationSelectedContent()
{
this.SlideObjects = [];
this.Drawings = [];
this.DocContent = null;
}
function CreatePresentationTableStyles(Styles, IdMap) function CreatePresentationTableStyles(Styles, IdMap)
{ {
function CreateMiddleStyle2(schemeId) function CreateMiddleStyle2(schemeId)
...@@ -2507,6 +2530,136 @@ CPresentation.prototype = ...@@ -2507,6 +2530,136 @@ CPresentation.prototype =
return s; return s;
}, },
Get_SelectedContent : function()
{
var ret = new PresentationSelectedContent(), i;
if(this.Slides.length > 0)
{
switch(editor.WordControl.Thumbnails.FocusObjType)
{
case FOCUS_OBJECT_MAIN:
{
var target_text_object = getTargetTextObject(this.Slides[this.CurPage].graphicObjects);
if(target_text_object)
{
var doc_content = this.Slides[this.CurPage].graphicObjects.getTargetDocContent();
if(target_text_object.getObjectType() === historyitem_type_GraphicFrame && !doc_content)
{
if(target_text_object.graphicObject)
{
var GraphicFrame = target_text_object.copy();
var SelectedContent = new CSelectedContent();
target_text_object.graphicObject.Get_SelectedContent(SelectedContent);
var Table = SelectedContent.Elements[0].Element;
GraphicFrame.setGraphicObject(Table);
Table.Set_Parent(GraphicFrame);
ret.Drawings.push(GraphicFrame);
}
}
else
{
if(doc_content)
{
var SelectedContent = new CSelectedContent();
doc_content.Get_SelectedContent(SelectedContent);
ret.DocContent = SelectedContent;
}
}
}
else
{
var selector = this.Slides[this.CurPage].graphicObjects.groupSelection ? this.Slides[this.CurPage].graphicObjects.groupSelection : this.Slides[this.CurPage].graphicObjects;
if(selector.selection.chartSelection && selector.selection.chartSelection.selection.title)
{
var doc_content = selector.selection.chartSelection.selection.title.getDocContent();
if(doc_content)
{
var SelectedContent = new CSelectedContent();
doc_content.Set_ApplyToAll(true);
doc_content.Get_SelectedContent(SelectedContent);
doc_content.Set_ApplyToAll(false);
ret.DocContent = SelectedContent;
}
}
else
{
for(i = 0; i < selector.selectedObjects.length; ++i)
{
var Drawing = selector.selectedObjects[i];
ret.Drawings.push(new DrawingCopyObject(Drawing.copy(), Drawing.x, Drawing.y, Drawing.extX, Drawing.extY, Drawing.getBase64Img()));
}
}
}
break;
}
case FOCUS_OBJECT_THUMBNAILS :
{
var selected_slides = editor.WordControl.Thumbnails.GetSelectedArray();
for(i = 0; i < selected_slides.length; ++i)
{
ret.SlideObjects.push(new SlideCopyObject(this.Slides[selected_slides[i]], this.Slides[selected_slides[i]].getBase64Img()));
}
}
}
}
return ret;
},
Insert_Content : function(Content)
{
var selected_slides = editor.WordControl.Thumbnails.GetSelectedArray(), i;
if(Content.SlideObjects.length > 0)
{
var las_slide_index = selected_slides[selected_slides.length-1];
for(i = 0; i < Content.SlideObjects.length; ++i)
{
this.insertSlide(las_slide_index + i + 1, Content.SlideObjects[i].Slide);
}
}
else if(this.Slides[this.CurPage])
{
if(Content.Drawings.length > 0)
{
for(i = 0; i < Content.Drawings.length; ++i)
{
Content.Drawings[i].setParent(this.Slides[this.CurPage]);
Content.Drawings[i].addToDrawingObjects();
}
}
else if(Content.DocContent)
{
var target_doc_content = this.Slides[this.CurPage].graphicObjects.getTargetDocContent(true);
if(target_doc_content)
{
var paragraph = target_doc_content.Content[target_doc_content.CurPos.ContentPos];
if (null != paragraph && type_Paragraph == paragraph.GetType())
{
var NearPos = { Paragraph: paragraph, ContentPos: paragraph.Get_ParaContentPos(false, false) };
paragraph.Check_NearestPos(NearPos);
target_doc_content.Insert_Content(Content.DocContent, NearPos);
}
}
else
{
var track_object = new NewShapeTrack("textRect", 0, 0, this.Slides[this.CurPage].Layout.Master.Theme, this.Slides[this.CurPage].Layout.Master, this.Slides[this.CurPage].Layout, this.Slides[this.CurPage], this.CurPage);
track_object.track({}, 0, 0);
var shape = track_object.getShape(false, this.DrawingDocument, this.Slides[this.CurPage]);
var body_pr = shape.getBodyPr();
var w = shape.txBody.getMaxContentWidth(this.Width/2, true) + body_pr.lIns + body_pr.rIns;
var h = shape.txBody.content.Get_SummaryHeight() + body_pr.tIns + body_pr.bIns;
shape.spPr.xfrm.setExtX(w);
shape.spPr.xfrm.setExtY(h);
shape.spPr.xfrm.setOffX((this.Width - w) / 2);
shape.spPr.xfrm.setOffY((this.Height - h) / 2);
shape.setParent(this.Slides[this.CurPage]);
shape.addToDrawingObjects();
}
}
}
this.Recalculate();
},
Set_SelectionState : function(State) Set_SelectionState : function(State)
{ {
if(State.CurPage > -1) if(State.CurPage > -1)
...@@ -2901,22 +3054,39 @@ CPresentation.prototype = ...@@ -2901,22 +3054,39 @@ CPresentation.prototype =
}, },
shiftSlides: function(pos, array) DublicateSlide: function()
{
var selected_slides = editor.WordControl.Thumbnails.GetSelectedArray();
this.shiftSlides(Math.max.apply(Math, selected_slides) + 1, selected_slides, true);
},
shiftSlides: function(pos, array, bCopy)
{ {
History.Create_NewPoint(); History.Create_NewPoint();
array.sort(fSortAscending); array.sort(fSortAscending);
var deleted = [], i; var deleted = [], i;
for(i = array.length -1; i > - 1; --i)
if(!(bCopy === true || global_mouseEvent.CtrlKey))
{ {
deleted.push(this.removeSlide(array[i])); for(i = array.length -1; i > - 1; --i)
} {
deleted.push(this.removeSlide(array[i]));
}
for(i = 0; i < array.length; ++i) for(i = 0; i < array.length; ++i)
{
if(array[i] < pos)
--pos;
else
break;
}
}
else
{ {
if(array[i] < pos) for(i = array.length -1; i > - 1; --i)
--pos; {
else deleted.push(this.Slides[array[i]].createDuplicate());
break; }
} }
var _selectedPage = this.CurPage; var _selectedPage = this.CurPage;
...@@ -2934,7 +3104,7 @@ CPresentation.prototype = ...@@ -2934,7 +3104,7 @@ CPresentation.prototype =
this.Slides[i].changeNum(i); this.Slides[i].changeNum(i);
} }
this.Recalculate();
this.Document_UpdateUndoRedoState(); this.Document_UpdateUndoRedoState();
this.DrawingDocument.OnEndRecalculate(); this.DrawingDocument.OnEndRecalculate();
this.DrawingDocument.UpdateThumbnailsAttack(); this.DrawingDocument.UpdateThumbnailsAttack();
......
...@@ -4,7 +4,7 @@ function Slide(presentation, slideLayout, slideNum) ...@@ -4,7 +4,7 @@ function Slide(presentation, slideLayout, slideNum)
{ {
this.kind = SLIDE_KIND; this.kind = SLIDE_KIND;
this.presentation = editor.WordControl.m_oLogicDocument; this.presentation = editor && editor.WordControl && editor.WordControl.m_oLogicDocument;
this.graphicObjects = new DrawingObjectsController(this); this.graphicObjects = new DrawingObjectsController(this);
this.maxId = 0; this.maxId = 0;
this.cSld = new CSld(); this.cSld = new CSld();
...@@ -81,6 +81,45 @@ Slide.prototype = ...@@ -81,6 +81,45 @@ Slide.prototype =
return editor.WordControl.m_oLogicDocument.DrawingDocument; return editor.WordControl.m_oLogicDocument.DrawingDocument;
}, },
createDuplicate: function()
{
var copy = new Slide(this.presentation, this.Layout, 0), i;
if(typeof this.cSld.name === "string" && this.cSld.name.length > 0)
{
copy.setCSldName(this.cSld.name);
}
if(this.cSld.Bg)
{
this.changeBackground(this.cSld.Bg.createFullCopy());
}
for(i = 0; i < this.cSld.spTree.length; ++i)
{
copy.shapeAdd(copy.cSld.spTree.length, this.cSld.spTree[i].copy());
copy.cSld.spTree[copy.cSld.spTree.length - 1].setParent2(copy);
}
if(this.clrMap)
{
copy.setClMapOverride(this.clrMap.createDuplicate());
}
if(isRealBool(this.show))
{
copy.setShow(this.show);
}
if(isRealBool(this.showMasterPhAnim))
{
copy.setShowPhAnim(this.showMasterPhAnim);
}
if(isRealBool(this.showMasterSp))
{
copy.setShowMasterSp(this.showMasterSp);
}
copy.applyTiming(this.timing.createDuplicate());
copy.setSlideSize(this.Width, this.Height);
return copy;
},
getMatchingShape: function(type, idx, bSingleBody) getMatchingShape: function(type, idx, bSingleBody)
{ {
......
...@@ -4092,18 +4092,7 @@ asc_docs_api.prototype.DeleteSlide = function() ...@@ -4092,18 +4092,7 @@ asc_docs_api.prototype.DeleteSlide = function()
} }
asc_docs_api.prototype.DublicateSlide = function() asc_docs_api.prototype.DublicateSlide = function()
{ {
var selectionArray = this.WordControl.Thumbnails.GetSelectedArray(); this.WordControl.m_oLogicDocument.DublicateSlide();
var _presentation = this.WordControl.m_oLogicDocument;
var div = document.createElement("div");
var copy_processor = new CopyProcessor(editor, div);
copy_processor.oPresentationWriter.End_UseFullUrl();
copy_processor.Start();
var oPasteProcessor = new PasteProcessor(this, true, true, false);
//oPasteProcessor.End_UseFullUrl();
History.Create_NewPoint();
oPasteProcessor.Start(copy_processor.ElemToSelect, copy_processor.ElemToSelect, true);
this.WordControl.m_oLogicDocument.Document_UpdateInterfaceState();
} }
asc_docs_api.prototype.SelectAllSlides = function(layoutType) asc_docs_api.prototype.SelectAllSlides = function(layoutType)
......
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