Commit 1cbefcc6 authored by Alexander.Trofimov's avatar Alexander.Trofimov

move GraphicFrame to common

parent 41a6fcf9
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
"../common/Drawings/Format/ChartSpace.js", "../common/Drawings/Format/ChartSpace.js",
"../common/Drawings/Format/ChartFormat.js", "../common/Drawings/Format/ChartFormat.js",
"../common/Drawings/Format/TextBody.js", "../common/Drawings/Format/TextBody.js",
"../common/Drawings/Format/GraphicFrame.js",
"../common/Charts/charts.js", "../common/Charts/charts.js",
"../common/Charts/DrawingArea.js", "../common/Charts/DrawingArea.js",
"../common/Charts/DrawingObjects.js", "../common/Charts/DrawingObjects.js",
...@@ -120,7 +121,6 @@ ...@@ -120,7 +121,6 @@
"../cell/model/DrawingObjects/Format/GroupPrototype.js", "../cell/model/DrawingObjects/Format/GroupPrototype.js",
"../cell/model/DrawingObjects/Format/ChartSpacePrototype.js", "../cell/model/DrawingObjects/Format/ChartSpacePrototype.js",
"../slide/Editor/Format/GraphicFrame.js",
"../word/Editor/Comments.js", "../word/Editor/Comments.js",
"../word/Editor/Styles.js", "../word/Editor/Styles.js",
"../word/Editor/FlowObjects.js", "../word/Editor/FlowObjects.js",
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
"../common/Drawings/Format/ChartSpace.js", "../common/Drawings/Format/ChartSpace.js",
"../common/Drawings/Format/ChartFormat.js", "../common/Drawings/Format/ChartFormat.js",
"../common/Drawings/Format/TextBody.js", "../common/Drawings/Format/TextBody.js",
"../common/Drawings/Format/GraphicFrame.js",
"../common/Charts/charts.js", "../common/Charts/charts.js",
"../common/Charts/DrawingArea.js", "../common/Charts/DrawingArea.js",
"../common/Charts/DrawingObjects.js", "../common/Charts/DrawingObjects.js",
...@@ -146,7 +147,6 @@ ...@@ -146,7 +147,6 @@
"../slide/Editor/Format/ImagePrototype.js", "../slide/Editor/Format/ImagePrototype.js",
"../slide/Editor/Format/GroupPrototype.js", "../slide/Editor/Format/GroupPrototype.js",
"../slide/Editor/Format/ChartSpacePrototype.js", "../slide/Editor/Format/ChartSpacePrototype.js",
"../slide/Editor/Format/GraphicFrame.js",
"../common/apiBase.js", "../common/apiBase.js",
"../slide/api.js", "../slide/api.js",
"../slide/apiCommon.js", "../slide/apiCommon.js",
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
"../common/Drawings/Format/ChartSpace.js", "../common/Drawings/Format/ChartSpace.js",
"../common/Drawings/Format/ChartFormat.js", "../common/Drawings/Format/ChartFormat.js",
"../common/Drawings/Format/TextBody.js", "../common/Drawings/Format/TextBody.js",
"../common/Drawings/Format/GraphicFrame.js",
"../common/Charts/charts.js", "../common/Charts/charts.js",
"../common/Charts/DrawingArea.js", "../common/Charts/DrawingArea.js",
"../common/Charts/DrawingObjects.js", "../common/Charts/DrawingObjects.js",
...@@ -90,7 +91,6 @@ ...@@ -90,7 +91,6 @@
"../word/Editor/GraphicObjects/Format/ImagePrototype.js", "../word/Editor/GraphicObjects/Format/ImagePrototype.js",
"../word/Editor/GraphicObjects/Format/GroupPrototype.js", "../word/Editor/GraphicObjects/Format/GroupPrototype.js",
"../word/Editor/GraphicObjects/Format/ChartSpacePrototype.js", "../word/Editor/GraphicObjects/Format/ChartSpacePrototype.js",
"../slide/Editor/Format/GraphicFrame.js",
"../word/Editor/GraphicObjects/GraphicObjects.js", "../word/Editor/GraphicObjects/GraphicObjects.js",
"../word/Editor/GraphicObjects/GraphicPage.js", "../word/Editor/GraphicObjects/GraphicPage.js",
"../word/Editor/GraphicObjects/WrapManager.js", "../word/Editor/GraphicObjects/WrapManager.js",
......
/* /*
* *
* (c) Copyright Ascensio System Limited 2010-2016 * (c) Copyright Ascensio System Limited 2010-2016
* *
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU * This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html). * General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that * In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights. * Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* *
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html * FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* *
* You can contact Ascensio System SIA by email at sales@onlyoffice.com * You can contact Ascensio System SIA by email at sales@onlyoffice.com
* *
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display * The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3. * Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
* *
* Pursuant to Section 7  3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains * Pursuant to Section 7  3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic * relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE" * form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute. * in every copy of the program you distribute.
* Pursuant to Section 7  3(e) we decline to grant you any rights under trademark law for use of our trademarks. * Pursuant to Section 7  3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* *
*/ */
"use strict"; "use strict";
// Import // Import
var CShape = AscFormat.CShape; var CShape = AscFormat.CShape;
var HitInLine = AscFormat.HitInLine; var HitInLine = AscFormat.HitInLine;
var isRealObject = AscCommon.isRealObject; var isRealObject = AscCommon.isRealObject;
var History = AscCommon.History; var History = AscCommon.History;
function CGraphicFrame() function CGraphicFrame()
{ {
this.parent = null; this.parent = null;
this.graphicObject = null; this.graphicObject = null;
this.nvGraphicFramePr = null; this.nvGraphicFramePr = null;
this.spPr = null; this.spPr = null;
this.group = null; this.group = null;
this.x = null; this.x = null;
this.y = null; this.y = null;
this.extX = null; this.extX = null;
this.extY = null; this.extY = null;
this.transform = new AscCommon.CMatrix(); this.transform = new AscCommon.CMatrix();
this.compiledHierarchy = []; this.compiledHierarchy = [];
this.snapArrayX = []; this.snapArrayX = [];
this.snapArrayY = []; this.snapArrayY = [];
this.Pages = []; this.Pages = [];
this.Lock = new AscCommon.CLock(); this.Lock = new AscCommon.CLock();
this.Id = AscCommon.g_oIdCounter.Get_NewId(); this.Id = AscCommon.g_oIdCounter.Get_NewId();
AscCommon.g_oTableId.Add(this, this.Id); AscCommon.g_oTableId.Add(this, this.Id);
this.compiledStyles = []; this.compiledStyles = [];
this.recalcInfo = this.recalcInfo =
{ {
recalculateTransform: true, recalculateTransform: true,
recalculateSizes: true, recalculateSizes: true,
recalculateNumbering: true, recalculateNumbering: true,
recalculateShapeHierarchy: true, recalculateShapeHierarchy: true,
recalculateTable: true recalculateTable: true
}; };
this.bounds = this.bounds =
{ {
l: 0, l: 0,
t: 0, t: 0,
r: 0, r: 0,
b: 0, b: 0,
x: 0, x: 0,
y: 0, y: 0,
w: 0, w: 0,
h: 0 h: 0
}; };
this.RecalcInfo = {}; this.RecalcInfo = {};
this.bDeleted = true; this.bDeleted = true;
} }
CGraphicFrame.prototype = CGraphicFrame.prototype =
{ {
addToRecalculate: CShape.prototype.addToRecalculate, addToRecalculate: CShape.prototype.addToRecalculate,
Get_Theme: CShape.prototype.Get_Theme, Get_Theme: CShape.prototype.Get_Theme,
Get_ColorMap: CShape.prototype.Get_ColorMap, Get_ColorMap: CShape.prototype.Get_ColorMap,
setBDeleted: CShape.prototype.setBDeleted, setBDeleted: CShape.prototype.setBDeleted,
getBase64Img: CShape.prototype.getBase64Img, getBase64Img: CShape.prototype.getBase64Img,
checkDrawingBaseCoords: CShape.prototype.checkDrawingBaseCoords, checkDrawingBaseCoords: CShape.prototype.checkDrawingBaseCoords,
getSlideIndex: CShape.prototype.getSlideIndex, getSlideIndex: CShape.prototype.getSlideIndex,
calculateSnapArrays: CShape.prototype.calculateSnapArrays, calculateSnapArrays: CShape.prototype.calculateSnapArrays,
Is_UseInDocument: CShape.prototype.Is_UseInDocument, Is_UseInDocument: CShape.prototype.Is_UseInDocument,
Get_DocumentPositionFromObject: function(PosArray) Get_DocumentPositionFromObject: function(PosArray)
{ {
if (!PosArray) if (!PosArray)
PosArray = []; PosArray = [];
return PosArray; return PosArray;
}, },
Is_DrawingShape: function(bRetShape) Is_DrawingShape: function(bRetShape)
{ {
if(bRetShape === true) if(bRetShape === true)
{ {
return null; return null;
} }
return false; return false;
}, },
handleUpdatePosition: function() handleUpdatePosition: function()
{ {
this.recalcInfo.recalculateTransform = true; this.recalcInfo.recalculateTransform = true;
this.addToRecalculate(); this.addToRecalculate();
}, },
handleUpdateTheme: function() handleUpdateTheme: function()
{ {
this.compiledStyles = []; this.compiledStyles = [];
if(this.graphicObject) if(this.graphicObject)
{ {
this.graphicObject.Recalc_CompiledPr2(); this.graphicObject.Recalc_CompiledPr2();
this.graphicObject.RecalcInfo.Recalc_AllCells(); this.graphicObject.RecalcInfo.Recalc_AllCells();
this.recalcInfo.recalculateSizes = true; this.recalcInfo.recalculateSizes = true;
this.recalcInfo.recalculateShapeHierarchy = true; this.recalcInfo.recalculateShapeHierarchy = true;
this.recalcInfo.recalculateTable = true; this.recalcInfo.recalculateTable = true;
this.addToRecalculate(); this.addToRecalculate();
} }
}, },
handleUpdateFill: function() handleUpdateFill: function()
{}, {},
handleUpdateLn: function() handleUpdateLn: function()
{}, {},
handleUpdateExtents: function() handleUpdateExtents: function()
{ {
this.recalcInfo.recalculateTransform = true; this.recalcInfo.recalculateTransform = true;
this.addToRecalculate(); this.addToRecalculate();
}, },
recalcText: function() recalcText: function()
{ {
this.compiledStyles = []; this.compiledStyles = [];
if(this.graphicObject) if(this.graphicObject)
{ {
this.graphicObject.Recalc_CompiledPr2(); this.graphicObject.Recalc_CompiledPr2();
this.graphicObject.RecalcInfo.Reset(true); this.graphicObject.RecalcInfo.Reset(true);
} }
this.recalcInfo.recalculateTable = true; this.recalcInfo.recalculateTable = true;
this.recalcInfo.recalculateSizes = true; this.recalcInfo.recalculateSizes = true;
}, },
Get_TextBackGroundColor: function() Get_TextBackGroundColor: function()
{ {
return undefined; return undefined;
}, },
Get_PrevElementEndInfo: function() Get_PrevElementEndInfo: function()
{ {
return null; return null;
}, },
Get_PageFields: function() Get_PageFields: function()
{ {
return editor.WordControl.m_oLogicDocument.Get_PageFields(); return editor.WordControl.m_oLogicDocument.Get_PageFields();
}, },
Get_ParentTextTransform: function() Get_ParentTextTransform: function()
{ {
return this.transformText; return this.transformText;
}, },
getDocContent: function() getDocContent: function()
{ {
if(this.graphicObject && this.graphicObject.CurCell && ( false === this.graphicObject.Selection.Use || ( true === this.graphicObject.Selection.Use && table_Selection_Text === this.graphicObject.Selection.Type ) ) ) if(this.graphicObject && this.graphicObject.CurCell && ( false === this.graphicObject.Selection.Use || ( true === this.graphicObject.Selection.Use && table_Selection_Text === this.graphicObject.Selection.Type ) ) )
{ {
return this.graphicObject.CurCell.Content; return this.graphicObject.CurCell.Content;
} }
return null; return null;
}, },
setSpPr: function(spPr) setSpPr: function(spPr)
{ {
History.Add(this, {Type:AscDFH.historyitem_GraphicFrameSetSpPr, oldPr: this.spPr, newPr: spPr}); History.Add(this, {Type:AscDFH.historyitem_GraphicFrameSetSpPr, oldPr: this.spPr, newPr: spPr});
this.spPr = spPr; this.spPr = spPr;
}, },
setGraphicObject: function(graphicObject) setGraphicObject: function(graphicObject)
{ {
History.Add(this, {Type: AscDFH.historyitem_GraphicFrameSetGraphicObject, oldPr: this.graphicObject, newPr: graphicObject}); History.Add(this, {Type: AscDFH.historyitem_GraphicFrameSetGraphicObject, oldPr: this.graphicObject, newPr: graphicObject});
this.graphicObject = graphicObject; this.graphicObject = graphicObject;
if(this.graphicObject) if(this.graphicObject)
{ {
this.graphicObject.Index = 0; this.graphicObject.Index = 0;
} }
}, },
setNvSpPr: function(pr) setNvSpPr: function(pr)
{ {
History.Add(this, {Type: AscDFH.historyitem_GraphicFrameSetSetNvSpPr, oldPr: this.nvGraphicFramePr, newPr: pr}); History.Add(this, {Type: AscDFH.historyitem_GraphicFrameSetSetNvSpPr, oldPr: this.nvGraphicFramePr, newPr: pr});
this.nvGraphicFramePr = pr; this.nvGraphicFramePr = pr;
}, },
setParent: function(parent) setParent: function(parent)
{ {
History.Add(this, {Type:AscDFH.historyitem_GraphicFrameSetSetParent, oldPr: this.parent, newPr: parent}); History.Add(this, {Type:AscDFH.historyitem_GraphicFrameSetSetParent, oldPr: this.parent, newPr: parent});
this.parent = parent; this.parent = parent;
}, },
setGroup: function(group) setGroup: function(group)
{ {
History.Add(this, {Type: AscDFH.historyitem_GraphicFrameSetSetGroup, oldPr: this.group, newPr: group}); History.Add(this, {Type: AscDFH.historyitem_GraphicFrameSetSetGroup, oldPr: this.group, newPr: group});
this.group = group; this.group = group;
}, },
getObjectType: function() getObjectType: function()
{ {
return AscDFH.historyitem_type_GraphicFrame; return AscDFH.historyitem_type_GraphicFrame;
}, },
Search : function(Str, Props, SearchEngine, Type) Search : function(Str, Props, SearchEngine, Type)
{ {
if(this.graphicObject) if(this.graphicObject)
{ {
this.graphicObject.Search(Str, Props, SearchEngine, Type); this.graphicObject.Search(Str, Props, SearchEngine, Type);
} }
}, },
Search_GetId : function(bNext, bCurrent) Search_GetId : function(bNext, bCurrent)
{ {
if(this.graphicObject) if(this.graphicObject)
{ {
return this.graphicObject.Search_GetId(bNext, bCurrent); return this.graphicObject.Search_GetId(bNext, bCurrent);
} }
return null; return null;
}, },
copy: function() copy: function()
{ {
var ret = new CGraphicFrame(); var ret = new CGraphicFrame();
if(this.graphicObject) if(this.graphicObject)
{ {
ret.setGraphicObject(this.graphicObject.Copy(ret)); ret.setGraphicObject(this.graphicObject.Copy(ret));
if(editor && editor.WordControl && editor.WordControl.m_oLogicDocument && isRealObject(editor.WordControl.m_oLogicDocument.globalTableStyles)) if(editor && editor.WordControl && editor.WordControl.m_oLogicDocument && isRealObject(editor.WordControl.m_oLogicDocument.globalTableStyles))
{ {
ret.graphicObject.Reset(0, 0, this.graphicObject.XLimit, this.graphicObject.YLimit, ret.graphicObject.PageNum); ret.graphicObject.Reset(0, 0, this.graphicObject.XLimit, this.graphicObject.YLimit, ret.graphicObject.PageNum);
} }
} }
if(this.nvGraphicFramePr) if(this.nvGraphicFramePr)
{ {
ret.setNvSpPr(this.nvGraphicFramePr.createDuplicate()); ret.setNvSpPr(this.nvGraphicFramePr.createDuplicate());
} }
if(this.spPr) if(this.spPr)
{ {
ret.setSpPr(this.spPr.createDuplicate()); ret.setSpPr(this.spPr.createDuplicate());
ret.spPr.setParent(ret); ret.spPr.setParent(ret);
} }
ret.setBDeleted(false); ret.setBDeleted(false);
if(!this.recalcInfo.recalculateTable && !this.recalcInfo.recalculateSizes && !this.recalcInfo.recalculateTransform) if(!this.recalcInfo.recalculateTable && !this.recalcInfo.recalculateSizes && !this.recalcInfo.recalculateTransform)
{ {
ret.cachedImage = this.getBase64Img(); ret.cachedImage = this.getBase64Img();
ret.cachedPixW = this.cachedPixW; ret.cachedPixW = this.cachedPixW;
ret.cachedPixH = this.cachedPixH; ret.cachedPixH = this.cachedPixH;
} }
return ret; return ret;
}, },
isEmptyPlaceholder: function() isEmptyPlaceholder: function()
{ {
return false; return false;
}, },
getAllFonts: function(fonts) getAllFonts: function(fonts)
{ {
if(this.graphicObject) if(this.graphicObject)
{ {
for(var i = 0; i < this.graphicObject.Content.length; ++i) for(var i = 0; i < this.graphicObject.Content.length; ++i)
{ {
var row = this.graphicObject.Content[i]; var row = this.graphicObject.Content[i];
var cells = row.Content; var cells = row.Content;
for(var j = 0; j < cells.length;++j) for(var j = 0; j < cells.length;++j)
{ {
cells[j].Content.Document_Get_AllFontNames(fonts); cells[j].Content.Document_Get_AllFontNames(fonts);
} }
} }
delete fonts["+mj-lt"]; delete fonts["+mj-lt"];
delete fonts["+mn-lt"]; delete fonts["+mn-lt"];
delete fonts["+mj-ea"]; delete fonts["+mj-ea"];
delete fonts["+mn-ea"]; delete fonts["+mn-ea"];
delete fonts["+mj-cs"]; delete fonts["+mj-cs"];
delete fonts["+mn-cs"]; delete fonts["+mn-cs"];
} }
}, },
Cursor_MoveToStartPos : function() Cursor_MoveToStartPos : function()
{ {
if(isRealObject(this.graphicObject)) if(isRealObject(this.graphicObject))
{ {
this.graphicObject.Cursor_MoveToStartPos(); this.graphicObject.Cursor_MoveToStartPos();
this.graphicObject.RecalculateCurPos(); this.graphicObject.RecalculateCurPos();
} }
}, },
Cursor_MoveToEndPos : function() Cursor_MoveToEndPos : function()
{ {
if(isRealObject(this.graphicObject)) if(isRealObject(this.graphicObject))
{ {
this.graphicObject.Cursor_MoveToEndPos(); this.graphicObject.Cursor_MoveToEndPos();
this.graphicObject.RecalculateCurPos(); this.graphicObject.RecalculateCurPos();
} }
}, },
hitInPath: function() hitInPath: function()
{ {
return false; return false;
}, },
paragraphFormatPaste: function(CopyTextPr, CopyParaPr, Bool) paragraphFormatPaste: function(CopyTextPr, CopyParaPr, Bool)
{ {
if(isRealObject(this.graphicObject)) if(isRealObject(this.graphicObject))
{ {
this.graphicObject.Paragraph_Format_Paste(CopyTextPr, CopyParaPr, Bool); this.graphicObject.Paragraph_Format_Paste(CopyTextPr, CopyParaPr, Bool);
this.recalcInfo.recalculateContent = true; this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateTransformText = true; this.recalcInfo.recalculateTransformText = true;
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this; editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
} }
}, },
Paragraph_ClearFormatting: function() Paragraph_ClearFormatting: function()
{ {
if(isRealObject(this.graphicObject)) if(isRealObject(this.graphicObject))
{ {
this.graphicObject.Paragraph_ClearFormatting(); this.graphicObject.Paragraph_ClearFormatting();
this.recalcInfo.recalculateContent = true; this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateTransformText = true; this.recalcInfo.recalculateTransformText = true;
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this; editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
} }
}, },
Set_Props: function(props) Set_Props: function(props)
{ {
if(this.graphicObject) if(this.graphicObject)
{ {
var bApplyToAll = this.parent.graphicObjects.State.textObject !== this; var bApplyToAll = this.parent.graphicObjects.State.textObject !== this;
// if(bApplyToAll) // if(bApplyToAll)
// this.graphicObject.Set_ApplyToAll(true); // this.graphicObject.Set_ApplyToAll(true);
this.graphicObject.Set_Props(props, bApplyToAll); this.graphicObject.Set_Props(props, bApplyToAll);
//if(bApplyToAll) //if(bApplyToAll)
// this.graphicObject.Set_ApplyToAll(false); // this.graphicObject.Set_ApplyToAll(false);
this.OnContentRecalculate(); this.OnContentRecalculate();
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this; editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
} }
}, },
updateCursorType: function(x, y, e) updateCursorType: function(x, y, e)
{ {
var tx = this.invertTransform.TransformPointX(x, y); var tx = this.invertTransform.TransformPointX(x, y);
var ty = this.invertTransform.TransformPointY(x, y); var ty = this.invertTransform.TransformPointY(x, y);
this.graphicObject.Update_CursorType(tx, ty, 0) this.graphicObject.Update_CursorType(tx, ty, 0)
}, },
Get_Id: function() Get_Id: function()
{ {
return this.Id; return this.Id;
}, },
getIsSingleBody: CShape.prototype.getIsSingleBody, getIsSingleBody: CShape.prototype.getIsSingleBody,
getHierarchy: CShape.prototype.getHierarchy, getHierarchy: CShape.prototype.getHierarchy,
getAllImages: function (images) { getAllImages: function (images) {
}, },
recalculate: function() recalculate: function()
{ {
if(this.bDeleted || !this.parent) if(this.bDeleted || !this.parent)
return; return;
AscFormat.ExecuteNoHistory(function(){ AscFormat.ExecuteNoHistory(function(){
if(this.recalcInfo.recalculateTable) if(this.recalcInfo.recalculateTable)
{ {
if(this.graphicObject) if(this.graphicObject)
{ {
this.graphicObject.Set_PositionH(Asc.c_oAscHAnchor.Page, false, 0, false); this.graphicObject.Set_PositionH(Asc.c_oAscHAnchor.Page, false, 0, false);
this.graphicObject.Set_PositionV(Asc.c_oAscVAnchor.Page, false, 0, false); this.graphicObject.Set_PositionV(Asc.c_oAscVAnchor.Page, false, 0, false);
this.graphicObject.Parent = this; this.graphicObject.Parent = this;
this.graphicObject.Reset(0, 0, this.spPr.xfrm.extX, 10000, 0); this.graphicObject.Reset(0, 0, this.spPr.xfrm.extX, 10000, 0);
this.graphicObject.Recalculate_Page(0); this.graphicObject.Recalculate_Page(0);
} }
this.recalcInfo.recalculateTable = false; this.recalcInfo.recalculateTable = false;
} }
if(this.recalcInfo.recalculateSizes) if(this.recalcInfo.recalculateSizes)
{ {
this.recalculateSizes(); this.recalculateSizes();
this.recalcInfo.recalculateSizes = false; this.recalcInfo.recalculateSizes = false;
} }
if(this.recalcInfo.recalculateTransform) if(this.recalcInfo.recalculateTransform)
{ {
this.recalculateTransform(); this.recalculateTransform();
this.calculateSnapArrays(); this.calculateSnapArrays();
this.recalcInfo.recalculateTransform = false; this.recalcInfo.recalculateTransform = false;
this.transformText = this.transform; this.transformText = this.transform;
this.invertTransformText = this.invertTransform; this.invertTransformText = this.invertTransform;
this.cachedImage = null; this.cachedImage = null;
this.bounds.l = this.x; this.bounds.l = this.x;
this.bounds.t = this.y; this.bounds.t = this.y;
this.bounds.r = this.x + this.extX; this.bounds.r = this.x + this.extX;
this.bounds.b = this.y + this.extY; this.bounds.b = this.y + this.extY;
this.bounds.x = this.x; this.bounds.x = this.x;
this.bounds.y = this.y; this.bounds.y = this.y;
this.bounds.w = this.extX; this.bounds.w = this.extX;
this.bounds.h = this.extY; this.bounds.h = this.extY;
} }
}, this, []); }, this, []);
}, },
recalculateSizes: function() recalculateSizes: function()
{ {
if(this.graphicObject) if(this.graphicObject)
{ {
this.graphicObject.XLimit -= this.graphicObject.X; this.graphicObject.XLimit -= this.graphicObject.X;
this.graphicObject.X = 0; this.graphicObject.X = 0;
this.graphicObject.Y = 0; this.graphicObject.Y = 0;
this.graphicObject.X_origin = 0; this.graphicObject.X_origin = 0;
var _page_bounds = this.graphicObject.Get_PageBounds(0); var _page_bounds = this.graphicObject.Get_PageBounds(0);
this.spPr.xfrm.extY = _page_bounds.Bottom - _page_bounds.Top; this.spPr.xfrm.extY = _page_bounds.Bottom - _page_bounds.Top;
this.spPr.xfrm.extX = _page_bounds.Right - _page_bounds.Left; this.spPr.xfrm.extX = _page_bounds.Right - _page_bounds.Left;
this.extX = this.spPr.xfrm.extX; this.extX = this.spPr.xfrm.extX;
this.extY = this.spPr.xfrm.extY; this.extY = this.spPr.xfrm.extY;
} }
}, },
Selection_Is_OneElement : function() Selection_Is_OneElement : function()
{ {
return 0; return 0;
}, },
recalculateCurPos: function() recalculateCurPos: function()
{ {
this.graphicObject.RecalculateCurPos(); this.graphicObject.RecalculateCurPos();
}, },
isShape: function() isShape: function()
{ {
return false; return false;
}, },
isImage: function() isImage: function()
{ {
return false; return false;
}, },
isGroup: function() isGroup: function()
{ {
return false; return false;
}, },
isChart: function() isChart: function()
{ {
return false; return false;
}, },
isTable: function() isTable: function()
{ {
return this.graphicObject instanceof CTable; return this.graphicObject instanceof CTable;
}, },
Hyperlink_CanAdd: function(bCheck) Hyperlink_CanAdd: function(bCheck)
{ {
if(this.graphicObject) if(this.graphicObject)
return this.graphicObject.Hyperlink_CanAdd(bCheck); return this.graphicObject.Hyperlink_CanAdd(bCheck);
return false; return false;
}, },
Hyperlink_Check: function(bCheck) Hyperlink_Check: function(bCheck)
{ {
if(this.graphicObject) if(this.graphicObject)
return this.graphicObject.Hyperlink_Check(bCheck); return this.graphicObject.Hyperlink_Check(bCheck);
return false; return false;
}, },
getTransformMatrix: function() getTransformMatrix: function()
{ {
return this.transform; return this.transform;
if(this.recalcInfo.recalculateTransform) if(this.recalcInfo.recalculateTransform)
{ {
this.recalculateTransform(); this.recalculateTransform();
this.recalcInfo.recalculateTransform = false; this.recalcInfo.recalculateTransform = false;
} }
return this.transform; return this.transform;
}, },
OnContentReDraw: function() OnContentReDraw: function()
{}, {},
getRectBounds: function() getRectBounds: function()
{ {
var transform = this.getTransformMatrix(); var transform = this.getTransformMatrix();
var w = this.extX; var w = this.extX;
var h = this.extY; var h = this.extY;
var rect_points = [{x:0, y:0}, {x: w, y: 0}, {x: w, y: h}, {x: 0, y: h}]; var rect_points = [{x:0, y:0}, {x: w, y: 0}, {x: w, y: h}, {x: 0, y: h}];
var min_x, max_x, min_y, max_y; var min_x, max_x, min_y, max_y;
min_x = transform.TransformPointX(rect_points[0].x, rect_points[0].y); min_x = transform.TransformPointX(rect_points[0].x, rect_points[0].y);
min_y = transform.TransformPointY(rect_points[0].x, rect_points[0].y); min_y = transform.TransformPointY(rect_points[0].x, rect_points[0].y);
max_x = min_x; max_x = min_x;
max_y = min_y; max_y = min_y;
var cur_x, cur_y; var cur_x, cur_y;
for(var i = 1; i < 4; ++i) for(var i = 1; i < 4; ++i)
{ {
cur_x = transform.TransformPointX(rect_points[i].x, rect_points[i].y); cur_x = transform.TransformPointX(rect_points[i].x, rect_points[i].y);
cur_y = transform.TransformPointY(rect_points[i].x, rect_points[i].y); cur_y = transform.TransformPointY(rect_points[i].x, rect_points[i].y);
if(cur_x < min_x) if(cur_x < min_x)
min_x = cur_x; min_x = cur_x;
if(cur_x > max_x) if(cur_x > max_x)
max_x = cur_x; max_x = cur_x;
if(cur_y < min_y) if(cur_y < min_y)
min_y = cur_y; min_y = cur_y;
if(cur_y > max_y) if(cur_y > max_y)
max_y = cur_y; max_y = cur_y;
} }
return {minX: min_x, maxX: max_x, minY: min_y, maxY: max_y}; return {minX: min_x, maxX: max_x, minY: min_y, maxY: max_y};
}, },
changeSize: function(kw, kh) changeSize: function(kw, kh)
{ {
if (this.spPr && this.spPr.xfrm && this.spPr.xfrm.isNotNull()) { if (this.spPr && this.spPr.xfrm && this.spPr.xfrm.isNotNull()) {
var xfrm = this.spPr.xfrm; var xfrm = this.spPr.xfrm;
xfrm.setOffX(xfrm.offX * kw); xfrm.setOffX(xfrm.offX * kw);
xfrm.setOffY(xfrm.offY * kh); xfrm.setOffY(xfrm.offY * kh);
} }
this.recalcTransform && this.recalcTransform(); this.recalcTransform && this.recalcTransform();
}, },
recalcTransform: function() recalcTransform: function()
{ {
this.recalcInfo.recalculateTransform = true; this.recalcInfo.recalculateTransform = true;
}, },
getTransform: function() getTransform: function()
{ {
if(this.recalcInfo.recalculateTransform) if(this.recalcInfo.recalculateTransform)
{ {
this.recalculateTransform(); this.recalculateTransform();
this.recalcInfo.recalculateTransform = false; this.recalcInfo.recalculateTransform = false;
} }
return {x: this.x, y: this.y, extX: this.extX, extY: this.extY, rot: this.rot, flipH: this.flipH, flipV: this.flipV}; return {x: this.x, y: this.y, extX: this.extX, extY: this.extY, rot: this.rot, flipH: this.flipH, flipV: this.flipV};
}, },
canRotate: function() canRotate: function()
{ {
return false; return false;
}, },
canResize: function() canResize: function()
{ {
return false; return false;
}, },
canMove: function() canMove: function()
{ {
return true; return true;
}, },
canGroup: function() canGroup: function()
{ {
return false; return false;
}, },
createRotateTrack: function() createRotateTrack: function()
{ {
return new AscFormat.RotateTrackShapeImage(this); return new AscFormat.RotateTrackShapeImage(this);
}, },
createResizeTrack: function(cardDirection) createResizeTrack: function(cardDirection)
{ {
return new AscFormat.ResizeTrackShapeImage(this, cardDirection); return new AscFormat.ResizeTrackShapeImage(this, cardDirection);
}, },
createMoveTrack: function() createMoveTrack: function()
{ {
return new AscFormat.MoveShapeImageTrack(this); return new AscFormat.MoveShapeImageTrack(this);
}, },
getSnapArrays: function(snapX, snapY) getSnapArrays: function(snapX, snapY)
{ {
var transform = this.getTransformMatrix(); var transform = this.getTransformMatrix();
snapX.push(transform.tx); snapX.push(transform.tx);
snapX.push(transform.tx + this.extX*0.5); snapX.push(transform.tx + this.extX*0.5);
snapX.push(transform.tx + this.extX); snapX.push(transform.tx + this.extX);
snapY.push(transform.ty); snapY.push(transform.ty);
snapY.push(transform.ty + this.extY*0.5); snapY.push(transform.ty + this.extY*0.5);
snapY.push(transform.ty + this.extY); snapY.push(transform.ty + this.extY);
}, },
hitInInnerArea: function(x, y) hitInInnerArea: function(x, y)
{ {
var invert_transform = this.getInvertTransform(); var invert_transform = this.getInvertTransform();
var x_t = invert_transform.TransformPointX(x, y); var x_t = invert_transform.TransformPointX(x, y);
var y_t = invert_transform.TransformPointY(x, y); var y_t = invert_transform.TransformPointY(x, y);
return x_t > 0 && x_t < this.extX && y_t > 0 && y_t < this.extY; return x_t > 0 && x_t < this.extX && y_t > 0 && y_t < this.extY;
}, },
hitInTextRect: function(x, y) hitInTextRect: function(x, y)
{ {
return this.hitInInnerArea(x, y); return this.hitInInnerArea(x, y);
}, },
getInvertTransform: function() getInvertTransform: function()
{ {
if(this.recalcInfo.recalculateTransform) if(this.recalcInfo.recalculateTransform)
this.recalculateTransform(); this.recalculateTransform();
return this.invertTransform; return this.invertTransform;
}, },
hitInBoundingRect: function(x, y) hitInBoundingRect: function(x, y)
{ {
var invert_transform = this.getInvertTransform(); var invert_transform = this.getInvertTransform();
var x_t = invert_transform.TransformPointX(x, y); var x_t = invert_transform.TransformPointX(x, y);
var y_t = invert_transform.TransformPointY(x, y); var y_t = invert_transform.TransformPointY(x, y);
var _hit_context = this.getParentObjects().presentation.DrawingDocument.CanvasHitContext; var _hit_context = this.getParentObjects().presentation.DrawingDocument.CanvasHitContext;
return (HitInLine(_hit_context, x_t, y_t, 0, 0, this.extX, 0) || return (HitInLine(_hit_context, x_t, y_t, 0, 0, this.extX, 0) ||
HitInLine(_hit_context, x_t, y_t, this.extX, 0, this.extX, this.extY)|| HitInLine(_hit_context, x_t, y_t, this.extX, 0, this.extX, this.extY)||
HitInLine(_hit_context, x_t, y_t, this.extX, this.extY, 0, this.extY)|| HitInLine(_hit_context, x_t, y_t, this.extX, this.extY, 0, this.extY)||
HitInLine(_hit_context, x_t, y_t, 0, this.extY, 0, 0)); HitInLine(_hit_context, x_t, y_t, 0, this.extY, 0, 0));
}, },
Document_UpdateRulersState : function(margins) Document_UpdateRulersState : function(margins)
{ {
if(this.graphicObject) if(this.graphicObject)
{ {
this.graphicObject.Document_UpdateRulersState(this.parent.num); this.graphicObject.Document_UpdateRulersState(this.parent.num);
} }
}, },
Get_PageLimits : function(PageIndex) Get_PageLimits : function(PageIndex)
{ {
return { X : 0, Y : 0, XLimit : Page_Width, YLimit : Page_Height }; return { X : 0, Y : 0, XLimit : Page_Width, YLimit : Page_Height };
}, },
getParentObjects: CShape.prototype.getParentObjects, getParentObjects: CShape.prototype.getParentObjects,
Is_HdrFtr: function(bool) Is_HdrFtr: function(bool)
{ {
if(bool) return null; if(bool) return null;
return false; return false;
}, },
Is_TableCellContent: function() Is_TableCellContent: function()
{ {
return false; return false;
}, },
Check_AutoFit: function() Check_AutoFit: function()
{ {
return false; return false;
}, },
Is_InTable: function() Is_InTable: function()
{ {
return null; return null;
}, },
selectionSetStart: function(e, x, y, slideIndex) selectionSetStart: function(e, x, y, slideIndex)
{ {
if ( AscCommon.g_mouse_button_right === e.Button ) if ( AscCommon.g_mouse_button_right === e.Button )
{ {
this.rightButtonFlag = true; this.rightButtonFlag = true;
return; return;
} }
if(isRealObject(this.graphicObject)) if(isRealObject(this.graphicObject))
{ {
var tx, ty; var tx, ty;
tx = this.invertTransform.TransformPointX(x, y); tx = this.invertTransform.TransformPointX(x, y);
ty = this.invertTransform.TransformPointY(x, y); ty = this.invertTransform.TransformPointY(x, y);
if(AscCommon.g_mouse_event_type_down === e.Type) if(AscCommon.g_mouse_event_type_down === e.Type)
{ {
if(this.graphicObject.Is_TableBorder( tx, ty, 0)) if(this.graphicObject.Is_TableBorder( tx, ty, 0))
{ {
if(!editor.isViewMode && editor.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_Drawing_Props) === false) if(!editor.isViewMode && editor.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_Drawing_Props) === false)
{ {
History.Create_NewPoint(AscDFH.historydescription_Presentation_TableBorder); History.Create_NewPoint(AscDFH.historydescription_Presentation_TableBorder);
} }
else else
{ {
return; return;
} }
} }
} }
this.graphicObject.Selection_SetStart(tx, ty, this.parent.num, e); this.graphicObject.Selection_SetStart(tx, ty, this.parent.num, e);
this.graphicObject.RecalculateCurPos(); this.graphicObject.RecalculateCurPos();
return; return;
} }
}, },
selectionSetEnd: function(e, x, y, slideIndex) selectionSetEnd: function(e, x, y, slideIndex)
{ {
if(AscCommon.g_mouse_event_type_move === e.Type) if(AscCommon.g_mouse_event_type_move === e.Type)
{ {
this.rightButtonFlag = false; this.rightButtonFlag = false;
} }
if(this.rightButtonFlag && AscCommon.g_mouse_event_type_up === e.Type) if(this.rightButtonFlag && AscCommon.g_mouse_event_type_up === e.Type)
{ {
this.rightButtonFlag = false; this.rightButtonFlag = false;
return; return;
} }
if(isRealObject(this.graphicObject)) if(isRealObject(this.graphicObject))
{ {
var tx, ty; var tx, ty;
tx = this.invertTransform.TransformPointX(x, y); tx = this.invertTransform.TransformPointX(x, y);
ty = this.invertTransform.TransformPointY(x, y); ty = this.invertTransform.TransformPointY(x, y);
//var bBorder = this.graphicObject.Selection.Type2 === table_Selection_Border; //var bBorder = this.graphicObject.Selection.Type2 === table_Selection_Border;
this.graphicObject.Selection_SetEnd(tx, ty, 0, e); this.graphicObject.Selection_SetEnd(tx, ty, 0, e);
//if(g_mouse_event_type_up === e.Type && bBorder) //if(g_mouse_event_type_up === e.Type && bBorder)
// editor.WordControl.m_oLogicDocument.Recalculate(); TODO: пересчет вызывается в CTable // editor.WordControl.m_oLogicDocument.Recalculate(); TODO: пересчет вызывается в CTable
} }
}, },
updateSelectionState: function() updateSelectionState: function()
{ {
if(isRealObject(this.graphicObject)) if(isRealObject(this.graphicObject))
{ {
var drawingDocument = this.parent.presentation.DrawingDocument; var drawingDocument = this.parent.presentation.DrawingDocument;
var Doc = this.graphicObject; var Doc = this.graphicObject;
if ( true === Doc.Is_SelectionUse() && !Doc.Selection_IsEmpty()) { if ( true === Doc.Is_SelectionUse() && !Doc.Selection_IsEmpty()) {
drawingDocument.UpdateTargetTransform(this.transform); drawingDocument.UpdateTargetTransform(this.transform);
drawingDocument.TargetEnd(); drawingDocument.TargetEnd();
drawingDocument.SelectEnabled(true); drawingDocument.SelectEnabled(true);
drawingDocument.SelectClear(); drawingDocument.SelectClear();
Doc.Selection_Draw_Page(0); Doc.Selection_Draw_Page(0);
drawingDocument.SelectShow(); drawingDocument.SelectShow();
} }
else else
{ {
drawingDocument.SelectEnabled(false); drawingDocument.SelectEnabled(false);
Doc.RecalculateCurPos(); Doc.RecalculateCurPos();
drawingDocument.UpdateTargetTransform(this.transform); drawingDocument.UpdateTargetTransform(this.transform);
drawingDocument.TargetShow(); drawingDocument.TargetShow();
} }
} }
else else
{ {
this.parent.presentation.DrawingDocument.UpdateTargetTransform(null); this.parent.presentation.DrawingDocument.UpdateTargetTransform(null);
this.parent.presentation.DrawingDocument.TargetEnd(); this.parent.presentation.DrawingDocument.TargetEnd();
this.parent.presentation.DrawingDocument.SelectEnabled(false); this.parent.presentation.DrawingDocument.SelectEnabled(false);
this.parent.presentation.DrawingDocument.SelectClear(); this.parent.presentation.DrawingDocument.SelectClear();
this.parent.presentation.DrawingDocument.SelectShow(); this.parent.presentation.DrawingDocument.SelectShow();
} }
}, },
Get_AbsolutePage : function(CurPage) Get_AbsolutePage : function(CurPage)
{ {
return this.Get_StartPage_Absolute(); return this.Get_StartPage_Absolute();
}, },
Get_AbsoluteColumn : function(CurPage) Get_AbsoluteColumn : function(CurPage)
{ {
return 0; return 0;
}, },
Is_TopDocument: function() Is_TopDocument: function()
{ {
return false; return false;
}, },
drawAdjustments: function() drawAdjustments: function()
{}, {},
recalculateTransform: CShape.prototype.recalculateTransform, recalculateTransform: CShape.prototype.recalculateTransform,
recalculateLocalTransform: CShape.prototype.recalculateLocalTransform, recalculateLocalTransform: CShape.prototype.recalculateLocalTransform,
deleteDrawingBase: CShape.prototype.deleteDrawingBase, deleteDrawingBase: CShape.prototype.deleteDrawingBase,
addToDrawingObjects: CShape.prototype.addToDrawingObjects, addToDrawingObjects: CShape.prototype.addToDrawingObjects,
select: CShape.prototype.select, select: CShape.prototype.select,
deselect: CShape.prototype.deselect, deselect: CShape.prototype.deselect,
Update_ContentIndexing: function() Update_ContentIndexing: function()
{}, {},
draw: function(graphics) draw: function(graphics)
{ {
if (graphics.IsSlideBoundsCheckerType === true) { if (graphics.IsSlideBoundsCheckerType === true) {
graphics.transform3(this.transform); graphics.transform3(this.transform);
graphics._s(); graphics._s();
graphics._m(0, 0); graphics._m(0, 0);
graphics._l(this.extX, 0); graphics._l(this.extX, 0);
graphics._l(this.extX, this.extY); graphics._l(this.extX, this.extY);
graphics._l(0, this.extY); graphics._l(0, this.extY);
graphics._e(); graphics._e();
return; return;
} }
if(this.graphicObject) if(this.graphicObject)
{ {
graphics.transform3(this.transform); graphics.transform3(this.transform);
graphics.SetIntegerGrid(true); graphics.SetIntegerGrid(true);
this.graphicObject.Draw(0, graphics); this.graphicObject.Draw(0, graphics);
if(AscCommon.locktype_None != this.Lock.Get_Type() && !this.group) if(AscCommon.locktype_None != this.Lock.Get_Type() && !this.group)
graphics.DrawLockObjectRect(this.Lock.Get_Type() , 0, 0, this.extX, this.extY); graphics.DrawLockObjectRect(this.Lock.Get_Type() , 0, 0, this.extX, this.extY);
graphics.reset(); graphics.reset();
graphics.SetIntegerGrid(true); graphics.SetIntegerGrid(true);
} }
}, },
Select: function() Select: function()
{}, {},
Set_CurrentElement: function() Set_CurrentElement: function()
{ {
if(this.parent && this.parent.graphicObjects) if(this.parent && this.parent.graphicObjects)
{ {
this.parent.graphicObjects.resetSelection(true); this.parent.graphicObjects.resetSelection(true);
if(this.group) if(this.group)
{ {
var main_group = this.group.getMainGroup(); var main_group = this.group.getMainGroup();
this.parent.graphicObjects.selectObject(main_group, 0); this.parent.graphicObjects.selectObject(main_group, 0);
main_group.selectObject(this, 0); main_group.selectObject(this, 0);
main_group.selection.textSelection = this; main_group.selection.textSelection = this;
} }
else else
{ {
this.parent.graphicObjects.selectObject(this, 0); this.parent.graphicObjects.selectObject(this, 0);
this.parent.graphicObjects.selection.textSelection = this; this.parent.graphicObjects.selection.textSelection = this;
} }
if(editor.WordControl.m_oLogicDocument.CurPage !== this.parent.num) if(editor.WordControl.m_oLogicDocument.CurPage !== this.parent.num)
{ {
editor.WordControl.m_oLogicDocument.Set_CurPage(this.parent.num); editor.WordControl.m_oLogicDocument.Set_CurPage(this.parent.num);
editor.WordControl.GoToPage(this.parent.num); editor.WordControl.GoToPage(this.parent.num);
} }
} }
}, },
OnContentRecalculate: function() OnContentRecalculate: function()
{ {
this.recalcInfo.recalculateSizes = true; this.recalcInfo.recalculateSizes = true;
this.recalcInfo.recalculateTransform = true; this.recalcInfo.recalculateTransform = true;
editor.WordControl.m_oLogicDocument.Document_UpdateRulersState(); editor.WordControl.m_oLogicDocument.Document_UpdateRulersState();
}, },
getTextSelectionState: function() getTextSelectionState: function()
{ {
return this.graphicObject.Get_SelectionState(); return this.graphicObject.Get_SelectionState();
}, },
setTextSelectionState: function(Sate) setTextSelectionState: function(Sate)
{ {
return this.graphicObject.Set_SelectionState(Sate, Sate.length-1); return this.graphicObject.Set_SelectionState(Sate, Sate.length-1);
}, },
isPlaceholder: function() isPlaceholder: function()
{ {
return this.nvGraphicFramePr && this.nvGraphicFramePr.nvPr && this.nvGraphicFramePr.nvPr.ph !== null; return this.nvGraphicFramePr && this.nvGraphicFramePr.nvPr && this.nvGraphicFramePr.nvPr.ph !== null;
}, },
getPhType: function() getPhType: function()
{ {
if(this.isPlaceholder()) if(this.isPlaceholder())
{ {
return this.nvGraphicFramePr.nvPr.ph.type; return this.nvGraphicFramePr.nvPr.ph.type;
} }
return null; return null;
}, },
getPhIndex: function() getPhIndex: function()
{ {
if(this.isPlaceholder()) if(this.isPlaceholder())
{ {
return this.nvGraphicFramePr.nvPr.ph.idx; return this.nvGraphicFramePr.nvPr.ph.idx;
} }
return null; return null;
}, },
getPlaceholderType: function() getPlaceholderType: function()
{ {
return this.getPhType(); return this.getPhType();
}, },
getPlaceholderIndex: function() getPlaceholderIndex: function()
{ {
return this.getPhIndex(); return this.getPhIndex();
}, },
paragraphAdd: function(paraItem, bRecalculate) paragraphAdd: function(paraItem, bRecalculate)
{ {
}, },
applyTextFunction: function(docContentFunction, tableFunction, args) applyTextFunction: function(docContentFunction, tableFunction, args)
{ {
if(tableFunction === CTable.prototype.Paragraph_Add) if(tableFunction === CTable.prototype.Paragraph_Add)
{ {
if((args[0].Type === para_NewLine if((args[0].Type === para_NewLine
|| args[0].Type === para_Text || args[0].Type === para_Text
|| args[0].Type === para_Space || args[0].Type === para_Space
|| args[0].Type === para_Tab || args[0].Type === para_Tab
|| args[0].Type === para_PageNum) || args[0].Type === para_PageNum)
&& this.graphicObject.Selection.Use) && this.graphicObject.Selection.Use)
{ {
this.graphicObject.Remove(1, true, undefined, true); this.graphicObject.Remove(1, true, undefined, true);
} }
} }
else if(tableFunction === CTable.prototype.Add_NewParagraph) else if(tableFunction === CTable.prototype.Add_NewParagraph)
{ {
this.graphicObject.Selection.Use && this.graphicObject.Remove(1, true, undefined, true); this.graphicObject.Selection.Use && this.graphicObject.Remove(1, true, undefined, true);
} }
tableFunction.apply(this.graphicObject, args); tableFunction.apply(this.graphicObject, args);
}, },
remove: function(Count, bOnlyText, bRemoveOnlySelection) remove: function(Count, bOnlyText, bRemoveOnlySelection)
{ {
this.graphicObject.Remove(Count, bOnlyText, bRemoveOnlySelection); this.graphicObject.Remove(Count, bOnlyText, bRemoveOnlySelection);
this.recalcInfo.recalculateSizes = true; this.recalcInfo.recalculateSizes = true;
this.recalcInfo.recalculateTransform = true; this.recalcInfo.recalculateTransform = true;
}, },
addNewParagraph: function() addNewParagraph: function()
{ {
this.graphicObject.Add_NewParagraph(false); this.graphicObject.Add_NewParagraph(false);
this.recalcInfo.recalculateContent = true; this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateTransformText = true; this.recalcInfo.recalculateTransformText = true;
}, },
setParagraphAlign: function(val) setParagraphAlign: function(val)
{ {
if(isRealObject(this.graphicObject)) if(isRealObject(this.graphicObject))
{ {
this.graphicObject.Set_ParagraphAlign(val); this.graphicObject.Set_ParagraphAlign(val);
this.recalcInfo.recalculateContent = true; this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateTransform = true; this.recalcInfo.recalculateTransform = true;
} }
}, },
applyAllAlign: function(val) applyAllAlign: function(val)
{ {
if(isRealObject(this.graphicObject)) if(isRealObject(this.graphicObject))
{ {
this.graphicObject.Set_ApplyToAll(true); this.graphicObject.Set_ApplyToAll(true);
this.graphicObject.Set_ParagraphAlign(val); this.graphicObject.Set_ParagraphAlign(val);
this.graphicObject.Set_ApplyToAll(false); this.graphicObject.Set_ApplyToAll(false);
} }
}, },
setParagraphSpacing: function(val) setParagraphSpacing: function(val)
{ {
if(isRealObject(this.graphicObject)) if(isRealObject(this.graphicObject))
{ {
this.graphicObject.Set_ParagraphSpacing(val); this.graphicObject.Set_ParagraphSpacing(val);
} }
}, },
applyAllSpacing: function(val) applyAllSpacing: function(val)
{ {
if(isRealObject(this.graphicObject)) if(isRealObject(this.graphicObject))
{ {
this.graphicObject.Set_ApplyToAll(true); this.graphicObject.Set_ApplyToAll(true);
this.graphicObject.Set_ParagraphSpacing(val); this.graphicObject.Set_ParagraphSpacing(val);
this.graphicObject.Set_ApplyToAll(false); this.graphicObject.Set_ApplyToAll(false);
} }
}, },
setParagraphNumbering: function(val) setParagraphNumbering: function(val)
{ {
if(isRealObject(this.graphicObject)) if(isRealObject(this.graphicObject))
{ {
this.graphicObject.Set_ParagraphNumbering(val); this.graphicObject.Set_ParagraphNumbering(val);
} }
}, },
setParagraphIndent: function(val) setParagraphIndent: function(val)
{ {
if(isRealObject(this.graphicObject)) if(isRealObject(this.graphicObject))
{ {
this.graphicObject.Set_ParagraphIndent(val); this.graphicObject.Set_ParagraphIndent(val);
} }
}, },
setParent2: function(parent) setParent2: function(parent)
{ {
History.Add(this, {Type:AscDFH.historyitem_GraphicFrameSetSetParent, oldPr: this.parent, newPr: parent}); History.Add(this, {Type:AscDFH.historyitem_GraphicFrameSetSetParent, oldPr: this.parent, newPr: parent});
this.parent = parent; this.parent = parent;
}, },
setWordFlag: function(bPresentation, Document) setWordFlag: function(bPresentation, Document)
{ {
if(this.graphicObject) if(this.graphicObject)
{ {
this.graphicObject.bPresentation = bPresentation; this.graphicObject.bPresentation = bPresentation;
for(var i = 0; i < this.graphicObject.Content.length; ++i) for(var i = 0; i < this.graphicObject.Content.length; ++i)
{ {
var row = this.graphicObject.Content[i]; var row = this.graphicObject.Content[i];
for(var j = 0; j < row.Content.length; ++j) for(var j = 0; j < row.Content.length; ++j)
{ {
var content = row.Content[j].Content; var content = row.Content[j].Content;
if(!bPresentation && Document) if(!bPresentation && Document)
{ {
content.Styles = Document.Styles; content.Styles = Document.Styles;
} }
else else
{ {
content.Styles = null; content.Styles = null;
} }
content.bPresentation = bPresentation; content.bPresentation = bPresentation;
for(var k = 0; k < content.Content.length; ++k) for(var k = 0; k < content.Content.length; ++k)
{ {
content.Content[k].bFromDocument = !bPresentation; content.Content[k].bFromDocument = !bPresentation;
} }
} }
} }
} }
}, },
Get_Styles: function(level) Get_Styles: function(level)
{ {
if(AscFormat.isRealNumber(level)) if(AscFormat.isRealNumber(level))
{ {
if(!this.compiledStyles[level]) if(!this.compiledStyles[level])
{ {
CShape.prototype.recalculateTextStyles.call(this, level); CShape.prototype.recalculateTextStyles.call(this, level);
} }
return this.compiledStyles[level]; return this.compiledStyles[level];
} }
else else
{ {
return editor.WordControl.m_oLogicDocument.globalTableStyles; return editor.WordControl.m_oLogicDocument.globalTableStyles;
} }
}, },
Get_StartPage_Absolute: function() Get_StartPage_Absolute: function()
{ {
return this.parent.num; return this.parent.num;
}, },
Get_PageContentStartPos: function(PageNum) Get_PageContentStartPos: function(PageNum)
{ {
var presentation = editor.WordControl.m_oLogicDocument; var presentation = editor.WordControl.m_oLogicDocument;
return { return {
X : 0, X : 0,
XLimit: presentation.Width, XLimit: presentation.Width,
Y : 0, Y : 0,
YLimit : presentation.Height, YLimit : presentation.Height,
MaxTopBorder : 0 MaxTopBorder : 0
}; };
}, },
Get_PageContentStartPos2: function() Get_PageContentStartPos2: function()
{ {
return this.Get_PageContentStartPos(); return this.Get_PageContentStartPos();
}, },
hitToHandles: function() hitToHandles: function()
{ {
return -1; return -1;
}, },
hitToAdjustment: function() hitToAdjustment: function()
{ {
return {hit:false}; return {hit:false};
}, },
Refresh_RecalcData: function() Refresh_RecalcData: function()
{ {
this.Refresh_RecalcData2(); this.Refresh_RecalcData2();
}, },
Refresh_RecalcData2: function() Refresh_RecalcData2: function()
{ {
this.recalcInfo.recalculateTable = true; this.recalcInfo.recalculateTable = true;
this.recalcInfo.recalculateSizes = true; this.recalcInfo.recalculateSizes = true;
this.addToRecalculate(); this.addToRecalculate();
}, },
Undo: function(data) Undo: function(data)
{ {
switch(data.Type) switch(data.Type)
{ {
case AscDFH.historyitem_ShapeSetBDeleted: case AscDFH.historyitem_ShapeSetBDeleted:
{ {
this.bDeleted = data.oldPr; this.bDeleted = data.oldPr;
break; break;
} }
case AscDFH.historyitem_GraphicFrameSetSpPr : case AscDFH.historyitem_GraphicFrameSetSpPr :
{ {
this.spPr = data.oldPr; this.spPr = data.oldPr;
break; break;
} }
case AscDFH.historyitem_GraphicFrameSetGraphicObject: case AscDFH.historyitem_GraphicFrameSetGraphicObject:
{ {
this.graphicObject = data.oldPr; this.graphicObject = data.oldPr;
if(this.graphicObject) if(this.graphicObject)
{ {
this.graphicObject.Index = 0; this.graphicObject.Index = 0;
} }
break; break;
} }
case AscDFH.historyitem_GraphicFrameSetSetNvSpPr : case AscDFH.historyitem_GraphicFrameSetSetNvSpPr :
{ {
this.nvGraphicFramePr = data.oldPr; this.nvGraphicFramePr = data.oldPr;
break; break;
} }
case AscDFH.historyitem_GraphicFrameSetSetParent : case AscDFH.historyitem_GraphicFrameSetSetParent :
{ {
this.parent = data.oldPr; this.parent = data.oldPr;
break; break;
} }
case AscDFH.historyitem_GraphicFrameSetSetGroup : case AscDFH.historyitem_GraphicFrameSetSetGroup :
{ {
this.group = data.oldPr; this.group = data.oldPr;
break; break;
} }
} }
}, },
Redo: function(data) Redo: function(data)
{ {
switch(data.Type) switch(data.Type)
{ {
case AscDFH.historyitem_ShapeSetBDeleted: case AscDFH.historyitem_ShapeSetBDeleted:
{ {
this.bDeleted = data.newPr; this.bDeleted = data.newPr;
break; break;
} }
case AscDFH.historyitem_GraphicFrameSetSpPr : case AscDFH.historyitem_GraphicFrameSetSpPr :
{ {
this.spPr = data.newPr; this.spPr = data.newPr;
break; break;
} }
case AscDFH.historyitem_GraphicFrameSetGraphicObject: case AscDFH.historyitem_GraphicFrameSetGraphicObject:
{ {
this.graphicObject = data.newPr; this.graphicObject = data.newPr;
if(this.graphicObject) if(this.graphicObject)
{ {
this.graphicObject.Index = 0; this.graphicObject.Index = 0;
} }
break; break;
} }
case AscDFH.historyitem_GraphicFrameSetSetNvSpPr : case AscDFH.historyitem_GraphicFrameSetSetNvSpPr :
{ {
this.nvGraphicFramePr = data.newPr; this.nvGraphicFramePr = data.newPr;
break; break;
} }
case AscDFH.historyitem_GraphicFrameSetSetParent : case AscDFH.historyitem_GraphicFrameSetSetParent :
{ {
this.parent = data.newPr; this.parent = data.newPr;
break; break;
} }
case AscDFH.historyitem_GraphicFrameSetSetGroup : case AscDFH.historyitem_GraphicFrameSetSetGroup :
{ {
this.group = data.newPr; this.group = data.newPr;
break; break;
} }
} }
}, },
Save_Changes: function(data, w) Save_Changes: function(data, w)
{ {
w.WriteLong(data.Type); w.WriteLong(data.Type);
switch(data.Type) switch(data.Type)
{ {
case AscDFH.historyitem_GraphicFrameSetSpPr : case AscDFH.historyitem_GraphicFrameSetSpPr :
case AscDFH.historyitem_GraphicFrameSetGraphicObject : case AscDFH.historyitem_GraphicFrameSetGraphicObject :
case AscDFH.historyitem_GraphicFrameSetSetNvSpPr : case AscDFH.historyitem_GraphicFrameSetSetNvSpPr :
case AscDFH.historyitem_GraphicFrameSetSetParent : case AscDFH.historyitem_GraphicFrameSetSetParent :
case AscDFH.historyitem_GraphicFrameSetSetGroup : case AscDFH.historyitem_GraphicFrameSetSetGroup :
{ {
AscFormat.writeObject(w, data.newPr); AscFormat.writeObject(w, data.newPr);
break; break;
} }
case AscDFH.historyitem_ShapeSetBDeleted: case AscDFH.historyitem_ShapeSetBDeleted:
{ {
AscFormat.writeBool(w, data.newPr); AscFormat.writeBool(w, data.newPr);
break; break;
} }
} }
}, },
Load_Changes: function(r) Load_Changes: function(r)
{ {
var type = r.GetLong(); var type = r.GetLong();
switch(type) switch(type)
{ {
case AscDFH.historyitem_ShapeSetBDeleted: case AscDFH.historyitem_ShapeSetBDeleted:
{ {
this.bDeleted = AscFormat.readBool(r); this.bDeleted = AscFormat.readBool(r);
break; break;
} }
case AscDFH.historyitem_GraphicFrameSetSpPr : case AscDFH.historyitem_GraphicFrameSetSpPr :
{ {
this.spPr = AscFormat.readObject(r); this.spPr = AscFormat.readObject(r);
break; break;
} }
case AscDFH.historyitem_GraphicFrameSetGraphicObject: case AscDFH.historyitem_GraphicFrameSetGraphicObject:
{ {
this.graphicObject = AscFormat.readObject(r); this.graphicObject = AscFormat.readObject(r);
if(this.graphicObject) if(this.graphicObject)
{ {
this.graphicObject.Index = 0; this.graphicObject.Index = 0;
} }
break; break;
} }
case AscDFH.historyitem_GraphicFrameSetSetNvSpPr : case AscDFH.historyitem_GraphicFrameSetSetNvSpPr :
{ {
this.nvGraphicFramePr = AscFormat.readObject(r); this.nvGraphicFramePr = AscFormat.readObject(r);
break; break;
} }
case AscDFH.historyitem_GraphicFrameSetSetParent : case AscDFH.historyitem_GraphicFrameSetSetParent :
{ {
this.parent = AscFormat.readObject(r); this.parent = AscFormat.readObject(r);
break; break;
} }
case AscDFH.historyitem_GraphicFrameSetSetGroup : case AscDFH.historyitem_GraphicFrameSetSetGroup :
{ {
this.group = AscFormat.readObject(r); this.group = AscFormat.readObject(r);
break; break;
} }
} }
}, },
Write_ToBinary2: function(w) Write_ToBinary2: function(w)
{ {
w.WriteLong(AscDFH.historyitem_type_GraphicFrame); w.WriteLong(AscDFH.historyitem_type_GraphicFrame);
w.WriteString2(this.Id); w.WriteString2(this.Id);
}, },
Read_FromBinary2: function(r) Read_FromBinary2: function(r)
{ {
this.Id = r.GetString2(); this.Id = r.GetString2();
} }
}; };
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