Commit 8db2fd76 authored by Ilya Kirillov's avatar Ilya Kirillov

Changes for CTableId were reworked into a new classes. File...

Changes for CTableId were reworked into a new classes. File "Format/Constants.js" was replaced with "HistoryCommon.js" in the parent "common" directory.
parent 208acf31
......@@ -16,12 +16,14 @@
"../common/downloaderfiles.js",
"../common/commonDefines.js",
"../common/editorscommon.js",
"../common/HistoryCommon.js",
"../common/TableId.js",
"../common/TableIdChanges.js",
"../common/Private/editorscommon.js",
"../common/Shapes/Serialize.js",
"../common/Shapes/SerializeWriter.js",
"../common/SerializeCommonWordExcel.js",
"../common/SerializeChart.js",
"../common/Drawings/Format/Constants.js",
"../common/Drawings/Format/Format.js",
"../common/FontsFreeType/font_map.js",
......
......@@ -9,6 +9,9 @@
"../common/apiCommon.js",
"../common/SerializeCommonWordExcel.js",
"../common/editorscommon.js",
"../common/HistoryCommon.js",
"../common/TableId.js",
"../common/TableIdChanges.js",
"../common/AdvancedOptions.js",
"../cell/apiDefines.js",
"../cell/utils/utils.js",
......@@ -42,7 +45,6 @@
"../common/Drawings/ArcTo.js",
"../common/Drawings/ColorArray.js",
"../common/Drawings/Format/Constants.js",
"../common/Drawings/CommonController.js",
"../common/Drawings/States.js",
"../common/Drawings/Format/CreateGeometry.js",
......
......@@ -9,6 +9,9 @@
"../common/apiCommon.js",
"../common/SerializeCommonWordExcel.js",
"../common/editorscommon.js",
"../common/HistoryCommon.js",
"../common/TableId.js",
"../common/TableIdChanges.js",
"../common/AdvancedOptions.js",
"../slide/apiDefines.js",
"../common/CollaborativeEditingBase.js",
......@@ -41,7 +44,6 @@
"../common/Drawings/ArcTo.js",
"../common/Drawings/ColorArray.js",
"../common/Drawings/Format/Constants.js",
"../common/Drawings/CommonController.js",
"../common/Drawings/States.js",
"../common/Drawings/Format/CreateGeometry.js",
......
......@@ -12,6 +12,9 @@
"../common/apiCommon.js",
"../common/SerializeCommonWordExcel.js",
"../common/editorscommon.js",
"../common/HistoryCommon.js",
"../common/TableId.js",
"../common/TableIdChanges.js",
"../common/AdvancedOptions.js",
"../word/apiDefines.js",
"../common/CollaborativeEditingBase.js",
......@@ -44,7 +47,6 @@
"../common/Drawings/ArcTo.js",
"../common/Drawings/ColorArray.js",
"../common/Drawings/Format/Constants.js",
"../common/Drawings/CommonController.js",
"../word/Editor/GraphicObjects/DrawingStates.js",
"../common/Drawings/Format/CreateGeometry.js",
......
/*
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* This program is a free software product. You can redistribute it and/or
......@@ -32,6 +32,12 @@
"use strict";
/**
* User: Ilja.Kirillov
* Date: 27.10.2016
* Time: 12:11
*/
(/**
* @param {Window} window
* @param {undefined} undefined
......
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL 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.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
"use strict";
/**
* User: Ilja.Kirillov
* Date: 26.10.2016
* Time: 18:45
*/
(/**
* @param {Window} window
* @param {undefined} undefined
*/
function(window, undefined)
{
function CTableId()
{
this.m_aPairs = null;
this.m_bTurnOff = false;
this.m_oFactoryClass = {};
this.Id = null;
this.isInit = false;
}
CTableId.prototype.checkInit = function()
{
return this.isInit;
};
CTableId.prototype.init = function()
{
this.m_aPairs = {};
this.m_bTurnOff = false;
this.m_oFactoryClass = {};
this.Id = AscCommon.g_oIdCounter.Get_NewId();
this.Add(this, this.Id);
this.private_InitFactoryClass();
this.isInit = true;
};
CTableId.prototype.Add = function(Class, Id)
{
if (false === this.m_bTurnOff)
{
Class.Id = Id;
this.m_aPairs[Id] = Class;
AscCommon.History.Add(new AscCommon.CChangesTableIdAdd(this, Id, Class));
}
};
CTableId.prototype.TurnOff = function()
{
this.m_bTurnOff = true;
};
CTableId.prototype.TurnOn = function()
{
this.m_bTurnOff = false;
};
/**
* Получаем указатель на класс по Id
* @param Id
* @returns {*}
*/
CTableId.prototype.Get_ById = function(Id)
{
if ("" === Id)
return null;
if (this.m_aPairs[Id])
return this.m_aPairs[Id];
return null;
};
/**
* Получаем Id, по классу (вообще, данную функцию лучше не использовать)
* @param Class
* @returns {*}
*/
CTableId.prototype.Get_ByClass = function(Class)
{
if (Class.Get_Id)
return Class.Get_Id();
if (Class.GetId())
return Class.GetId();
return null;
};
CTableId.prototype.Reset_Id = function(Class, Id_new, Id_old)
{
if (Class === this.m_aPairs[Id_old])
{
delete this.m_aPairs[Id_old];
this.m_aPairs[Id_new] = Class;
AscCommon.History.Add(new AscCommon.CChangesTableIdReset(this, Id_old, Id_new));
}
else
{
this.Add(Class, Id_new);
}
};
CTableId.prototype.Get_Id = function()
{
return this.Id;
};
CTableId.prototype.Clear = function()
{
this.m_aPairs = {};
this.m_bTurnOff = false;
this.Id = AscCommon.g_oIdCounter.Get_NewId();
this.Add(this, this.Id);
};
CTableId.prototype.private_InitFactoryClass = function()
{
this.m_oFactoryClass[AscDFH.historyitem_type_Paragraph] = AscCommonWord.Paragraph;
this.m_oFactoryClass[AscDFH.historyitem_type_TextPr] = AscCommonWord.ParaTextPr;
this.m_oFactoryClass[AscDFH.historyitem_type_Hyperlink] = AscCommonWord.ParaHyperlink;
this.m_oFactoryClass[AscDFH.historyitem_type_Drawing] = AscCommonWord.ParaDrawing;
this.m_oFactoryClass[AscDFH.historyitem_type_Table] = AscCommonWord.CTable;
this.m_oFactoryClass[AscDFH.historyitem_type_TableRow] = AscCommonWord.CTableRow;
this.m_oFactoryClass[AscDFH.historyitem_type_TableCell] = AscCommonWord.CTableCell;
this.m_oFactoryClass[AscDFH.historyitem_type_DocumentContent] = AscCommonWord.CDocumentContent;
this.m_oFactoryClass[AscDFH.historyitem_type_HdrFtr] = AscCommonWord.CHeaderFooter;
this.m_oFactoryClass[AscDFH.historyitem_type_AbstractNum] = AscCommonWord.CAbstractNum;
this.m_oFactoryClass[AscDFH.historyitem_type_Comment] = AscCommon.CComment;
this.m_oFactoryClass[AscDFH.historyitem_type_Style] = AscCommonWord.CStyle;
this.m_oFactoryClass[AscDFH.historyitem_type_CommentMark] = AscCommon.ParaComment;
this.m_oFactoryClass[AscDFH.historyitem_type_ParaRun] = AscCommonWord.ParaRun;
this.m_oFactoryClass[AscDFH.historyitem_type_Section] = AscCommonWord.CSectionPr;
this.m_oFactoryClass[AscDFH.historyitem_type_Field] = AscCommonWord.ParaField;
this.m_oFactoryClass[AscDFH.historyitem_type_FootEndNote] = AscCommonWord.CFootEndnote;
this.m_oFactoryClass[AscDFH.historyitem_type_DefaultShapeDefinition] = AscFormat.DefaultShapeDefinition;
this.m_oFactoryClass[AscDFH.historyitem_type_CNvPr] = AscFormat.CNvPr;
this.m_oFactoryClass[AscDFH.historyitem_type_NvPr] = AscFormat.NvPr;
this.m_oFactoryClass[AscDFH.historyitem_type_Ph] = AscFormat.Ph;
this.m_oFactoryClass[AscDFH.historyitem_type_UniNvPr] = AscFormat.UniNvPr;
this.m_oFactoryClass[AscDFH.historyitem_type_StyleRef] = AscFormat.StyleRef;
this.m_oFactoryClass[AscDFH.historyitem_type_FontRef] = AscFormat.FontRef;
this.m_oFactoryClass[AscDFH.historyitem_type_Chart] = AscFormat.CChart;
this.m_oFactoryClass[AscDFH.historyitem_type_ChartSpace] = AscFormat.CChartSpace;
this.m_oFactoryClass[AscDFH.historyitem_type_Legend] = AscFormat.CLegend;
this.m_oFactoryClass[AscDFH.historyitem_type_Layout] = AscFormat.CLayout;
this.m_oFactoryClass[AscDFH.historyitem_type_LegendEntry] = AscFormat.CLegendEntry;
this.m_oFactoryClass[AscDFH.historyitem_type_PivotFmt] = AscFormat.CPivotFmt;
this.m_oFactoryClass[AscDFH.historyitem_type_DLbl] = AscFormat.CDLbl;
this.m_oFactoryClass[AscDFH.historyitem_type_Marker] = AscFormat.CMarker;
this.m_oFactoryClass[AscDFH.historyitem_type_PlotArea] = AscFormat.CPlotArea;
this.m_oFactoryClass[AscDFH.historyitem_type_NumFmt] = AscFormat.CNumFmt;
this.m_oFactoryClass[AscDFH.historyitem_type_Scaling] = AscFormat.CScaling;
this.m_oFactoryClass[AscDFH.historyitem_type_DTable] = AscFormat.CDTable;
this.m_oFactoryClass[AscDFH.historyitem_type_LineChart] = AscFormat.CLineChart;
this.m_oFactoryClass[AscDFH.historyitem_type_DLbls] = AscFormat.CDLbls;
this.m_oFactoryClass[AscDFH.historyitem_type_UpDownBars] = AscFormat.CUpDownBars;
this.m_oFactoryClass[AscDFH.historyitem_type_BarChart] = AscFormat.CBarChart;
this.m_oFactoryClass[AscDFH.historyitem_type_BubbleChart] = AscFormat.CBubbleChart;
this.m_oFactoryClass[AscDFH.historyitem_type_DoughnutChart] = AscFormat.CDoughnutChart;
this.m_oFactoryClass[AscDFH.historyitem_type_OfPieChart] = AscFormat.COfPieChart;
this.m_oFactoryClass[AscDFH.historyitem_type_PieChart] = AscFormat.CPieChart;
this.m_oFactoryClass[AscDFH.historyitem_type_RadarChart] = AscFormat.CRadarChart;
this.m_oFactoryClass[AscDFH.historyitem_type_ScatterChart] = AscFormat.CScatterChart;
this.m_oFactoryClass[AscDFH.historyitem_type_StockChart] = AscFormat.CStockChart;
this.m_oFactoryClass[AscDFH.historyitem_type_SurfaceChart] = AscFormat.CSurfaceChart;
this.m_oFactoryClass[AscDFH.historyitem_type_BandFmt] = AscFormat.CBandFmt;
this.m_oFactoryClass[AscDFH.historyitem_type_AreaChart] = AscFormat.CAreaChart;
this.m_oFactoryClass[AscDFH.historyitem_type_ScatterSer] = AscFormat.CScatterSeries;
this.m_oFactoryClass[AscDFH.historyitem_type_DPt] = AscFormat.CDPt;
this.m_oFactoryClass[AscDFH.historyitem_type_ErrBars] = AscFormat.CErrBars;
this.m_oFactoryClass[AscDFH.historyitem_type_MinusPlus] = AscFormat.CMinusPlus;
this.m_oFactoryClass[AscDFH.historyitem_type_NumLit] = AscFormat.CNumLit;
this.m_oFactoryClass[AscDFH.historyitem_type_NumericPoint] = AscFormat.CNumericPoint;
this.m_oFactoryClass[AscDFH.historyitem_type_NumRef] = AscFormat.CNumRef;
this.m_oFactoryClass[AscDFH.historyitem_type_TrendLine] = AscFormat.CTrendLine;
this.m_oFactoryClass[AscDFH.historyitem_type_Tx] = AscFormat.CTx;
this.m_oFactoryClass[AscDFH.historyitem_type_StrRef] = AscFormat.CStrRef;
this.m_oFactoryClass[AscDFH.historyitem_type_StrCache] = AscFormat.CStrCache;
this.m_oFactoryClass[AscDFH.historyitem_type_StrPoint] = AscFormat.CStringPoint;
this.m_oFactoryClass[AscDFH.historyitem_type_XVal] = AscFormat.CXVal;
this.m_oFactoryClass[AscDFH.historyitem_type_MultiLvlStrRef] = AscFormat.CMultiLvlStrRef;
this.m_oFactoryClass[AscDFH.historyitem_type_MultiLvlStrCache] = AscFormat.CMultiLvlStrCache;
this.m_oFactoryClass[AscDFH.historyitem_type_StringLiteral] = AscFormat.CStringLiteral;
this.m_oFactoryClass[AscDFH.historyitem_type_YVal] = AscFormat.CYVal;
this.m_oFactoryClass[AscDFH.historyitem_type_AreaSeries] = AscFormat.CAreaSeries;
this.m_oFactoryClass[AscDFH.historyitem_type_Cat] = AscFormat.CCat;
this.m_oFactoryClass[AscDFH.historyitem_type_PictureOptions] = AscFormat.CPictureOptions;
this.m_oFactoryClass[AscDFH.historyitem_type_RadarSeries] = AscFormat.CRadarSeries;
this.m_oFactoryClass[AscDFH.historyitem_type_BarSeries] = AscFormat.CBarSeries;
this.m_oFactoryClass[AscDFH.historyitem_type_LineSeries] = AscFormat.CLineSeries;
this.m_oFactoryClass[AscDFH.historyitem_type_PieSeries] = AscFormat.CPieSeries;
this.m_oFactoryClass[AscDFH.historyitem_type_SurfaceSeries] = AscFormat.CSurfaceSeries;
this.m_oFactoryClass[AscDFH.historyitem_type_BubbleSeries] = AscFormat.CBubbleSeries;
this.m_oFactoryClass[AscDFH.historyitem_type_ExternalData] = AscFormat.CExternalData;
this.m_oFactoryClass[AscDFH.historyitem_type_PivotSource] = AscFormat.CPivotSource;
this.m_oFactoryClass[AscDFH.historyitem_type_Protection] = AscFormat.CProtection;
this.m_oFactoryClass[AscDFH.historyitem_type_ChartWall] = AscFormat.CChartWall;
this.m_oFactoryClass[AscDFH.historyitem_type_View3d] = AscFormat.CView3d;
this.m_oFactoryClass[AscDFH.historyitem_type_ChartText] = AscFormat.CChartText;
this.m_oFactoryClass[AscDFH.historyitem_type_ShapeStyle] = AscFormat.CShapeStyle;
this.m_oFactoryClass[AscDFH.historyitem_type_Xfrm] = AscFormat.CXfrm;
this.m_oFactoryClass[AscDFH.historyitem_type_SpPr] = AscFormat.CSpPr;
this.m_oFactoryClass[AscDFH.historyitem_type_ClrScheme] = AscFormat.ClrScheme;
this.m_oFactoryClass[AscDFH.historyitem_type_ClrMap] = AscFormat.ClrMap;
this.m_oFactoryClass[AscDFH.historyitem_type_ExtraClrScheme] = AscFormat.ExtraClrScheme;
this.m_oFactoryClass[AscDFH.historyitem_type_FontCollection] = AscFormat.FontCollection;
this.m_oFactoryClass[AscDFH.historyitem_type_FontScheme] = AscFormat.FontScheme;
this.m_oFactoryClass[AscDFH.historyitem_type_FormatScheme] = AscFormat.FmtScheme;
this.m_oFactoryClass[AscDFH.historyitem_type_ThemeElements] = AscFormat.ThemeElements;
this.m_oFactoryClass[AscDFH.historyitem_type_HF] = AscFormat.HF;
this.m_oFactoryClass[AscDFH.historyitem_type_BgPr] = AscFormat.CBgPr;
this.m_oFactoryClass[AscDFH.historyitem_type_Bg] = AscFormat.CBg;
this.m_oFactoryClass[AscDFH.historyitem_type_PrintSettings] = AscFormat.CPrintSettings;
this.m_oFactoryClass[AscDFH.historyitem_type_HeaderFooterChart] = AscFormat.CHeaderFooterChart;
this.m_oFactoryClass[AscDFH.historyitem_type_PageMarginsChart] = AscFormat.CPageMarginsChart;
this.m_oFactoryClass[AscDFH.historyitem_type_PageSetup] = AscFormat.CPageSetup;
this.m_oFactoryClass[AscDFH.historyitem_type_Shape] = AscFormat.CShape;
this.m_oFactoryClass[AscDFH.historyitem_type_DispUnits] = AscFormat.CDispUnits;
this.m_oFactoryClass[AscDFH.historyitem_type_GroupShape] = AscFormat.CGroupShape;
this.m_oFactoryClass[AscDFH.historyitem_type_ImageShape] = AscFormat.CImageShape;
this.m_oFactoryClass[AscDFH.historyitem_type_Geometry] = AscFormat.Geometry;
this.m_oFactoryClass[AscDFH.historyitem_type_Path] = AscFormat.Path;
this.m_oFactoryClass[AscDFH.historyitem_type_TextBody] = AscFormat.CTextBody;
this.m_oFactoryClass[AscDFH.historyitem_type_CatAx] = AscFormat.CCatAx;
this.m_oFactoryClass[AscDFH.historyitem_type_ValAx] = AscFormat.CValAx;
this.m_oFactoryClass[AscDFH.historyitem_type_WrapPolygon] = AscCommonWord.CWrapPolygon;
this.m_oFactoryClass[AscDFH.historyitem_type_DateAx] = AscFormat.CDateAx;
this.m_oFactoryClass[AscDFH.historyitem_type_SerAx] = AscFormat.CSerAx;
this.m_oFactoryClass[AscDFH.historyitem_type_Title] = AscFormat.CTitle;
this.m_oFactoryClass[AscDFH.historyitem_type_OleObject] = AscFormat.COleObject;
this.m_oFactoryClass[AscDFH.historyitem_type_DrawingContent] = AscFormat.CDrawingDocContent;
this.m_oFactoryClass[AscDFH.historyitem_type_Math] = AscCommonWord.ParaMath;
this.m_oFactoryClass[AscDFH.historyitem_type_MathContent] = AscCommonWord.CMathContent;
this.m_oFactoryClass[AscDFH.historyitem_type_acc] = AscCommonWord.CAccent;
this.m_oFactoryClass[AscDFH.historyitem_type_bar] = AscCommonWord.CBar;
this.m_oFactoryClass[AscDFH.historyitem_type_box] = AscCommonWord.CBox;
this.m_oFactoryClass[AscDFH.historyitem_type_borderBox] = AscCommonWord.CBorderBox;
this.m_oFactoryClass[AscDFH.historyitem_type_delimiter] = AscCommonWord.CDelimiter;
this.m_oFactoryClass[AscDFH.historyitem_type_eqArr] = AscCommonWord.CEqArray;
this.m_oFactoryClass[AscDFH.historyitem_type_frac] = AscCommonWord.CFraction;
this.m_oFactoryClass[AscDFH.historyitem_type_mathFunc] = AscCommonWord.CMathFunc;
this.m_oFactoryClass[AscDFH.historyitem_type_groupChr] = AscCommonWord.CGroupCharacter;
this.m_oFactoryClass[AscDFH.historyitem_type_lim] = AscCommonWord.CLimit;
this.m_oFactoryClass[AscDFH.historyitem_type_matrix] = AscCommonWord.CMathMatrix;
this.m_oFactoryClass[AscDFH.historyitem_type_nary] = AscCommonWord.CNary;
this.m_oFactoryClass[AscDFH.historyitem_type_phant] = AscCommonWord.CPhantom;
this.m_oFactoryClass[AscDFH.historyitem_type_rad] = AscCommonWord.CRadical;
this.m_oFactoryClass[AscDFH.historyitem_type_deg_subsup] = AscCommonWord.CDegreeSubSup;
this.m_oFactoryClass[AscDFH.historyitem_type_deg] = AscCommonWord.CDegree;
if (window.AscCommonSlide)
{
this.m_oFactoryClass[AscDFH.historyitem_type_Slide] = AscCommonSlide.Slide;
this.m_oFactoryClass[AscDFH.historyitem_type_SlideLayout] = AscCommonSlide.SlideLayout;
this.m_oFactoryClass[AscDFH.historyitem_type_SlideMaster] = AscCommonSlide.MasterSlide;
this.m_oFactoryClass[AscDFH.historyitem_type_SlideComments] = AscCommonSlide.SlideComments;
this.m_oFactoryClass[AscDFH.historyitem_type_PropLocker] = AscCommonSlide.PropLocker;
}
this.m_oFactoryClass[AscDFH.historyitem_type_Theme] = AscFormat.CTheme;
this.m_oFactoryClass[AscDFH.historyitem_type_GraphicFrame] = AscFormat.CGraphicFrame;
};
CTableId.prototype.GetClassFromFactory = function(nType)
{
if (this.m_oFactoryClass[nType])
return new this.m_oFactoryClass[nType]();
return null;
};
CTableId.prototype.Refresh_RecalcData = function(Data)
{
};
//-----------------------------------------------------------------------------------
// Функции для работы с совместным редактирования
//-----------------------------------------------------------------------------------
CTableId.prototype.Unlock = function(Data)
{
// Ничего не делаем
};
window["AscCommon"].g_oTableId = new CTableId();
})(window);
\ No newline at end of file
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL 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.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
"use strict";
/**
* User: Ilja.Kirillov
* Date: 26.10.2016
* Time: 18:53
*/
(/**
* @param {Window} window
* @param {undefined} undefined
*/
function(window, undefined)
{
/**
* @constructor
* @extends {AscDFH.CChangesBase}
*/
function CChangesTableIdAdd(Class, Id, NewClass)
{
CChangesTableIdAdd.superclass.constructor.call(this, Class);
this.Id = Id;
this.NewClass = NewClass;
}
AscCommon.extendClass(CChangesTableIdAdd, AscDFH.CChangesBase);
CChangesTableIdAdd.prototype.Type = AscDFH.historyitem_TableId_Add;
CChangesTableIdAdd.prototype.Undo = function()
{
};
CChangesTableIdAdd.prototype.Redo = function()
{
};
CChangesTableIdAdd.prototype.WriteToBinary = function(Writer)
{
// String : Id элемента
// Varibale : сам элемент
Writer.WriteString2(this.Id);
this.NewClass.Write_ToBinary2(Writer);
};
CChangesTableIdAdd.prototype.ReadFromBinary = function(Reader)
{
// String : Id элемента
// Varibale : сам элемент
this.Id = Reader.GetString2();
this.NewClass = this.private_ReadClassFromBinary(Reader);
};
CChangesTableIdAdd.prototype.Load = function(Color)
{
this.Class.m_aPairs[this.Id] = this.NewClass;
};
CChangesTableIdAdd.prototype.RefreshRecalcData = function()
{
};
CChangesTableIdAdd.prototype.private_ReadClassFromBinary = function(Reader)
{
var oTableId = this.Class;
var ElementType = Reader.GetLong();
oTableId.TurnOff();
var Element = oTableId.GetClassFromFactory(ElementType);
if (null !== Element)
Element.Read_FromBinary2(Reader);
oTableId.TurnOn();
return Element;
};
window["AscCommon"].CChangesTableIdAdd = CChangesTableIdAdd;
/**
* @constructor
* @extends {AscDFH.CChangesBase}
*/
function CChangesTableIdReset(Class, OldId, NewId)
{
CChangesTableIdReset.superclass.constructor.call(this, Class);
this.NewId = NewId;
this.OldId = OldId;
}
AscCommon.extendClass(CChangesTableIdReset, AscDFH.CChangesBase);
CChangesTableIdReset.prototype.Type = AscDFH.historyitem_TableId_Reset;
CChangesTableIdReset.prototype.Undo = function()
{
};
CChangesTableIdReset.prototype.Redo = function()
{
};
CChangesTableIdReset.prototype.WriteToBinary = function(Writer)
{
// String : New Id
// String : Old Id
Writer.WriteString2(this.NewId);
Writer.WriteString2(this.OldId);
};
CChangesTableIdReset.prototype.ReadFromBinary = function(Reader)
{
// String : New Id
// String : Old Id
this.NewId = Reader.GetString2();
this.OldId = Reader.GetString2();
};
CChangesTableIdReset.prototype.Load = function(Color)
{
var oTableId = this.Class;
if (oTableId.m_aPairs[this.OldId])
{
var Class = oTableId.m_aPairs[this.OldId];
delete oTableId.m_aPairs[this.OldId];
oTableId.m_aPairs[this.NewId] = Class;
Class.Id = this.NewId;
}
};
CChangesTableIdReset.prototype.RefreshRecalcData = function()
{
};
window["AscCommon"].CChangesTableIdReset = CChangesTableIdReset;
/**
* @constructor
* @extends {AscDFH.CChangesBase}
*/
function CChangesTableIdDescription(Class, FileCheckSum, FileSize, Description, ItemsCount, PointIndex, StartPoint, LastPoint, SumIndex, DeletedIndex)
{
CChangesTableIdDescription.superclass.constructor.call(this, Class);
this.FileCheckSum = FileCheckSum;
this.FileSize = FileSize;
this.Description = Description;
this.ItemsCount = ItemsCount;
this.PointIndex = PointIndex;
this.StartPoint = StartPoint;
this.LastPoint = LastPoint;
this.SumIndex = SumIndex;
this.DeletedIndex = DeletedIndex;
this.VersionString = "@@Version.@@Build.@@Rev";
}
AscCommon.extendClass(CChangesTableIdDescription, AscDFH.CChangesBase);
CChangesTableIdDescription.prototype.Type = AscDFH.historyitem_TableId_Description;
CChangesTableIdDescription.prototype.Undo = function()
{
};
CChangesTableIdDescription.prototype.Redo = function()
{
};
CChangesTableIdDescription.prototype.WriteToBinary = function(Writer)
{
// Long : FileCheckSum
// Long : FileSize
// Long : Description
// Long : ItemsCount
// Long : PointIndex
// Long : StartPoint
// Long : LastPoint
// Long : SumIndex
// Long : DeletedIndex
// String : Версия SDK
Writer.WriteLong(this.FileCheckSum);
Writer.WriteLong(this.FileSize);
Writer.WriteLong(this.Description);
Writer.WriteLong(this.ItemsCount);
Writer.WriteLong(this.PointIndex);
Writer.WriteLong(this.StartPoint);
Writer.WriteLong(this.LastPoint);
Writer.WriteLong(this.SumIndex);
Writer.WriteLong(null === this.DeletedIndex ? -10 : this.DeletedIndex);
Writer.WriteString2(this.VersionString);
};
CChangesTableIdDescription.prototype.ReadFromBinary = function(Reader)
{
// Long : FileCheckSum
// Long : FileSize
// Long : Description
// Long : ItemsCount
// Long : PointIndex
// Long : StartPoint
// Long : LastPoint
// Long : SumIndex
// Long : DeletedIndex
// String : Версия SDK
this.FileCheckSum = Reader.GetLong();
this.FileSize = Reader.GetLong();
this.Description = Reader.GetLong();
this.ItemsCount = Reader.GetLong();
this.PointIndex = Reader.GetLong();
this.StartPoint = Reader.GetLong();
this.LastPoint = Reader.GetLong();
this.SumIndex = Reader.GetLong();
this.DeletedIndex = Reader.GetLong();
this.VersionString = Reader.GetString2();
};
CChangesTableIdDescription.prototype.Load = function(Color)
{
// // CollaborativeEditing LOG
// console.log("ItemsCount2 " + CollaborativeEditing.m_nErrorLog_PointChangesCount);
// if (CollaborativeEditing.m_nErrorLog_PointChangesCount !== CollaborativeEditing.m_nErrorLog_SavedPCC)
// console.log("========================= BAD Changes Count in Point =============================");
// if (CollaborativeEditing.m_nErrorLog_CurPointIndex + 1 !== PointIndex && 0 !== PointIndex)
// console.log("========================= BAD Point index ========================================");
// var bBadSumIndex = false;
// if (0 === PointIndex)
// {
// CollaborativeEditing.m_nErrorLog_SumIndex = 0;
// }
// else
// {
// // Потому что мы не учитываем данное изменение
// CollaborativeEditing.m_nErrorLog_SumIndex += CollaborativeEditing.m_nErrorLog_SavedPCC + 1;
// if (PointIndex === StartPoint)
// {
// if (CollaborativeEditing.m_nErrorLog_SumIndex !== SumIndex)
// bBadSumIndex = true;
//
// console.log("SumIndex2 " + CollaborativeEditing.m_nErrorLog_SumIndex);
// CollaborativeEditing.m_nErrorLog_SumIndex = SumIndex;
// }
// }
//
// console.log("----------------------------");
// console.log("FileCheckSum " + FileCheckSum);
// console.log("FileSize " + FileSize);
// console.log("Description " + Description + " " +
// AscDFH.GetHistoryPointStringDescription(Description));
// console.log("PointIndex " + PointIndex);
// console.log("StartPoint " + StartPoint);
// console.log("LastPoint " + LastPoint);
// console.log("ItemsCount " + ItemsCount);
// console.log("SumIndex " + SumIndex);
// console.log("DeletedIndex " + (-10 === DeletedIndex ? null : DeletedIndex));
// // -1 Чтобы не учитывалось данное изменение
// CollaborativeEditing.m_nErrorLog_SavedPCC = ItemsCount;
// CollaborativeEditing.m_nErrorLog_PointChangesCount = -1;
// CollaborativeEditing.m_nErrorLog_CurPointIndex = PointIndex;
// if (bBadSumIndex)
// console.log("========================= BAD Sum index ==========================================");
};
CChangesTableIdDescription.prototype.RefreshRecalcData = function()
{
};
window["AscCommon"].CChangesTableIdDescription = CChangesTableIdDescription;
/**
* @constructor
* @extends {AscDFH.CChangesBase}
*/
function CChangesCommonAddWaterMark(Class, Url)
{
CChangesCommonAddWaterMark.superclass.constructor.call(this, Class);
this.Url = Url ? Url : "";
}
AscCommon.extendClass(CChangesCommonAddWaterMark, AscDFH.CChangesBase);
CChangesCommonAddWaterMark.prototype.Type = AscDFH.historyitem_Common_AddWatermark;
CChangesCommonAddWaterMark.prototype.Undo = function()
{
};
CChangesCommonAddWaterMark.prototype.Redo = function()
{
};
CChangesCommonAddWaterMark.prototype.WriteToBinary = function(Writer)
{
Writer.WriteString2(this.Url);
};
CChangesCommonAddWaterMark.prototype.ReadFromBinary = function(Reader)
{
this.Url = Reader.GetString2();
};
CChangesCommonAddWaterMark.prototype.Load = function(Color)
{
var sUrl = this.Url;
if (editor && editor.WordControl && editor.WordControl.m_oLogicDocument)
{
var oLogicDocument = editor.WordControl.m_oLogicDocument;
if (oLogicDocument instanceof AscCommonWord.CDocument)
{
var oParaDrawing = oLogicDocument.DrawingObjects.getTrialImage(sUrl);
var oFirstParagraph = oLogicDocument.Get_FirstParagraph();
AscFormat.ExecuteNoHistory(function()
{
var oRun = new AscCommonWord.ParaRun();
oRun.Content.splice(0, 0, oParaDrawing);
oFirstParagraph.Content.splice(0, 0, oRun);
oLogicDocument.DrawingObjects.addGraphicObject(oParaDrawing);
}, this, []);
}
else if (oLogicDocument instanceof AscCommonSlide.CPresentation)
{
if (oLogicDocument.Slides[0])
{
var oDrawing = oLogicDocument.Slides[0].graphicObjects.createWatermarkImage(sUrl);
oDrawing.spPr.xfrm.offX = (oLogicDocument.Width - oDrawing.spPr.xfrm.extX) / 2;
oDrawing.spPr.xfrm.offY = (oLogicDocument.Height - oDrawing.spPr.xfrm.extY) / 2;
oDrawing.parent = oLogicDocument.Slides[0];
oLogicDocument.Slides[0].cSld.spTree.push(oDrawing);
}
}
}
else
{
var oWsModel = window["Asc"]["editor"].wbModel.aWorksheets[0];
if (oWsModel)
{
var objectRender = new AscFormat.DrawingObjects();
var oNewDrawing = objectRender.createDrawingObject(AscCommon.c_oAscCellAnchorType.cellanchorAbsolute);
var oImage = AscFormat.DrawingObjectsController.prototype.createWatermarkImage(sUrl);
oNewDrawing.ext.cx = oImage.spPr.xfrm.extX;
oNewDrawing.ext.cy = oImage.spPr.xfrm.extY;
oNewDrawing.graphicObject = oImage;
oWsModel.Drawings.push(oNewDrawing);
}
}
};
CChangesCommonAddWaterMark.prototype.RefreshRecalcData = function()
{
};
window["AscCommon"].CChangesCommonAddWaterMark = CChangesCommonAddWaterMark;
})(window);
AscDFH.changesFactory[AscDFH.historyitem_TableId_Add] = AscCommon.CChangesTableIdAdd;
AscDFH.changesFactory[AscDFH.historyitem_TableId_Reset] = AscCommon.CChangesTableIdReset;
AscDFH.changesFactory[AscDFH.historyitem_TableId_Description] = AscCommon.CChangesTableIdDescription;
AscDFH.changesFactory[AscDFH.historyitem_Common_AddWatermark] = AscCommon.CChangesCommonAddWaterMark;
......@@ -1912,509 +1912,6 @@ CIdCounter.prototype.Clear = function()
this.m_nIdCounterEdit = 0; // Счетчик Id для работы
};
function CTableId()
{
this.m_aPairs = null;
this.m_bTurnOff = false;
this.Id = null;
this.isInit = false;
}
CTableId.prototype.checkInit = function()
{
return this.isInit;
};
CTableId.prototype.init = function()
{
this.m_aPairs = {};
this.m_bTurnOff = false;
this.Id = g_oIdCounter.Get_NewId();
this.Add(this, this.Id);
this.isInit = true;
};
CTableId.prototype.Add = function(Class, Id)
{
if (false === this.m_bTurnOff)
{
Class.Id = Id;
this.m_aPairs[Id] = Class;
AscCommon.History.Add(this, { Type : AscDFH.historyitem_TableId_Add, Id : Id, Class : Class });
}
};
CTableId.prototype.TurnOff = function()
{
this.m_bTurnOff = true;
};
CTableId.prototype.TurnOn = function()
{
this.m_bTurnOff = false;
};
/*
Получаем указатель на класс по Id
*/
CTableId.prototype.Get_ById = function(Id)
{
if ("" === Id)
return null;
if ("undefined" != typeof(this.m_aPairs[Id]))
return this.m_aPairs[Id];
return null;
};
/*
Получаем Id, по классу (вообще, данную функцию лучше не использовать)
*/
CTableId.prototype.Get_ByClass = function(Class)
{
if ("undefined" != typeof( Class.Get_Id ))
return Class.Get_Id();
if ("undefined" != typeof( Class.GetId() ))
return Class.GetId();
return null;
};
CTableId.prototype.Reset_Id = function(Class, Id_new, Id_old)
{
if (Class === this.m_aPairs[Id_old])
{
delete this.m_aPairs[Id_old];
this.m_aPairs[Id_new] = Class;
AscCommon.History.Add(this, { Type : AscDFH.historyitem_TableId_Reset, Id_new : Id_new, Id_old : Id_old });
}
else
{
this.Add(Class, Id_new);
}
};
CTableId.prototype.Get_Id = function()
{
return this.Id;
};
CTableId.prototype.Clear = function()
{
this.m_aPairs = {};
this.m_bTurnOff = false;
this.Add(this, g_oIdCounter.Get_NewId());
};
//-----------------------------------------------------------------------------------
// Функции для работы с Undo/Redo
//-----------------------------------------------------------------------------------
CTableId.prototype.Undo = function(Data)
{
// Ничего не делаем (можно удалять/добавлять ссылки на классы в данном классе
// но это не обяательно, т.к. Id всегда уникальные)
};
CTableId.prototype.Redo = function(Redo)
{
// Ничего не делаем (можно удалять/добавлять ссылки на классы в данном классе
// но это не обяательно, т.к. Id всегда уникальные)
};
CTableId.prototype.Refresh_RecalcData = function(Data)
{
// Ничего не делаем, добавление/удаление классов не влияет на пересчет
};
//-----------------------------------------------------------------------------------
// Функции для работы с совместным редактирования
//-----------------------------------------------------------------------------------
CTableId.prototype.Read_Class_FromBinary = function(Reader)
{
var ElementType = Reader.GetLong();
var Element = null;
// Временно отключаем регистрацию новых классов
this.m_bTurnOff = true;
switch( ElementType )
{
case AscDFH.historyitem_type_Paragraph : Element = new AscCommonWord.Paragraph(); break;
case AscDFH.historyitem_type_TextPr : Element = new AscCommonWord.ParaTextPr(); break;
case AscDFH.historyitem_type_Hyperlink : Element = new AscCommonWord.ParaHyperlink(); break;
case AscDFH.historyitem_type_Drawing : Element = new AscCommonWord.ParaDrawing(); break;
case AscDFH.historyitem_type_Table : Element = new AscCommonWord.CTable(); break;
case AscDFH.historyitem_type_TableRow : Element = new AscCommonWord.CTableRow(); break;
case AscDFH.historyitem_type_TableCell : Element = new AscCommonWord.CTableCell(); break;
case AscDFH.historyitem_type_DocumentContent : Element = new AscCommonWord.CDocumentContent(); break;
case AscDFH.historyitem_type_HdrFtr : Element = new AscCommonWord.CHeaderFooter(); break;
case AscDFH.historyitem_type_AbstractNum : Element = new AscCommonWord.CAbstractNum(); break;
case AscDFH.historyitem_type_Comment : Element = new AscCommon.CComment(); break;
case AscDFH.historyitem_type_Style : Element = new AscCommonWord.CStyle(); break;
case AscDFH.historyitem_type_CommentMark : Element = new AscCommon.ParaComment(); break;
case AscDFH.historyitem_type_ParaRun : Element = new AscCommonWord.ParaRun(); break;
case AscDFH.historyitem_type_Section : Element = new AscCommonWord.CSectionPr(); break;
case AscDFH.historyitem_type_Field : Element = new AscCommonWord.ParaField(); break;
case AscDFH.historyitem_type_FootEndNote : Element = new AscCommonWord.CFootEndnote(); break;
case AscDFH.historyitem_type_DefaultShapeDefinition : Element = new AscFormat.DefaultShapeDefinition(); break;
case AscDFH.historyitem_type_CNvPr : Element = new AscFormat.CNvPr(); break;
case AscDFH.historyitem_type_NvPr : Element = new AscFormat.NvPr(); break;
case AscDFH.historyitem_type_Ph : Element = new AscFormat.Ph(); break;
case AscDFH.historyitem_type_UniNvPr : Element = new AscFormat.UniNvPr(); break;
case AscDFH.historyitem_type_StyleRef : Element = new AscFormat.StyleRef(); break;
case AscDFH.historyitem_type_FontRef : Element = new AscFormat.FontRef(); break;
case AscDFH.historyitem_type_Chart : Element = new AscFormat.CChart(); break;
case AscDFH.historyitem_type_ChartSpace : Element = new AscFormat.CChartSpace(); break;
case AscDFH.historyitem_type_Legend : Element = new AscFormat.CLegend(); break;
case AscDFH.historyitem_type_Layout : Element = new AscFormat.CLayout(); break;
case AscDFH.historyitem_type_LegendEntry : Element = new AscFormat.CLegendEntry(); break;
case AscDFH.historyitem_type_PivotFmt : Element = new AscFormat.CPivotFmt(); break;
case AscDFH.historyitem_type_DLbl : Element = new AscFormat.CDLbl(); break;
case AscDFH.historyitem_type_Marker : Element = new AscFormat.CMarker(); break;
case AscDFH.historyitem_type_PlotArea : Element = new AscFormat.CPlotArea(); break;
case AscDFH.historyitem_type_NumFmt : Element = new AscFormat.CNumFmt(); break;
case AscDFH.historyitem_type_Scaling : Element = new AscFormat.CScaling(); break;
case AscDFH.historyitem_type_DTable : Element = new AscFormat.CDTable(); break;
case AscDFH.historyitem_type_LineChart : Element = new AscFormat.CLineChart(); break;
case AscDFH.historyitem_type_DLbls : Element = new AscFormat.CDLbls(); break;
case AscDFH.historyitem_type_UpDownBars : Element = new AscFormat.CUpDownBars(); break;
case AscDFH.historyitem_type_BarChart : Element = new AscFormat.CBarChart(); break;
case AscDFH.historyitem_type_BubbleChart : Element = new AscFormat.CBubbleChart(); break;
case AscDFH.historyitem_type_DoughnutChart : Element = new AscFormat.CDoughnutChart(); break;
case AscDFH.historyitem_type_OfPieChart : Element = new AscFormat.COfPieChart(); break;
case AscDFH.historyitem_type_PieChart : Element = new AscFormat.CPieChart(); break;
case AscDFH.historyitem_type_RadarChart : Element = new AscFormat.CRadarChart(); break;
case AscDFH.historyitem_type_ScatterChart : Element = new AscFormat.CScatterChart(); break;
case AscDFH.historyitem_type_StockChart : Element = new AscFormat.CStockChart(); break;
case AscDFH.historyitem_type_SurfaceChart : Element = new AscFormat.CSurfaceChart(); break;
case AscDFH.historyitem_type_BandFmt : Element = new AscFormat.CBandFmt(); break;
case AscDFH.historyitem_type_AreaChart : Element = new AscFormat.CAreaChart(); break;
case AscDFH.historyitem_type_ScatterSer : Element = new AscFormat.CScatterSeries(); break;
case AscDFH.historyitem_type_DPt : Element = new AscFormat.CDPt(); break;
case AscDFH.historyitem_type_ErrBars : Element = new AscFormat.CErrBars(); break;
case AscDFH.historyitem_type_MinusPlus : Element = new AscFormat.CMinusPlus(); break;
case AscDFH.historyitem_type_NumLit : Element = new AscFormat.CNumLit(); break;
case AscDFH.historyitem_type_NumericPoint : Element = new AscFormat.CNumericPoint(); break;
case AscDFH.historyitem_type_NumRef : Element = new AscFormat.CNumRef(); break;
case AscDFH.historyitem_type_TrendLine : Element = new AscFormat.CTrendLine(); break;
case AscDFH.historyitem_type_Tx : Element = new AscFormat.CTx(); break;
case AscDFH.historyitem_type_StrRef : Element = new AscFormat.CStrRef(); break;
case AscDFH.historyitem_type_StrCache : Element = new AscFormat.CStrCache(); break;
case AscDFH.historyitem_type_StrPoint : Element = new AscFormat.CStringPoint(); break;
case AscDFH.historyitem_type_XVal : Element = new AscFormat.CXVal(); break;
case AscDFH.historyitem_type_MultiLvlStrRef : Element = new AscFormat.CMultiLvlStrRef(); break;
case AscDFH.historyitem_type_MultiLvlStrCache : Element = new AscFormat.CMultiLvlStrCache(); break;
case AscDFH.historyitem_type_StringLiteral : Element = new AscFormat.CStringLiteral(); break;
case AscDFH.historyitem_type_YVal : Element = new AscFormat.CYVal(); break;
case AscDFH.historyitem_type_AreaSeries : Element = new AscFormat.CAreaSeries(); break;
case AscDFH.historyitem_type_Cat : Element = new AscFormat.CCat(); break;
case AscDFH.historyitem_type_PictureOptions : Element = new AscFormat.CPictureOptions(); break;
case AscDFH.historyitem_type_RadarSeries : Element = new AscFormat.CRadarSeries(); break;
case AscDFH.historyitem_type_BarSeries : Element = new AscFormat.CBarSeries(); break;
case AscDFH.historyitem_type_LineSeries : Element = new AscFormat.CLineSeries(); break;
case AscDFH.historyitem_type_PieSeries : Element = new AscFormat.CPieSeries(); break;
case AscDFH.historyitem_type_SurfaceSeries : Element = new AscFormat.CSurfaceSeries(); break;
case AscDFH.historyitem_type_BubbleSeries : Element = new AscFormat.CBubbleSeries(); break;
case AscDFH.historyitem_type_ExternalData : Element = new AscFormat.CExternalData(); break;
case AscDFH.historyitem_type_PivotSource : Element = new AscFormat.CPivotSource(); break;
case AscDFH.historyitem_type_Protection : Element = new AscFormat.CProtection(); break;
case AscDFH.historyitem_type_ChartWall : Element = new AscFormat.CChartWall(); break;
case AscDFH.historyitem_type_View3d : Element = new AscFormat.CView3d(); break;
case AscDFH.historyitem_type_ChartText : Element = new AscFormat.CChartText(); break;
case AscDFH.historyitem_type_ShapeStyle : Element = new AscFormat.CShapeStyle(); break;
case AscDFH.historyitem_type_Xfrm : Element = new AscFormat.CXfrm(); break;
case AscDFH.historyitem_type_SpPr : Element = new AscFormat.CSpPr(); break;
case AscDFH.historyitem_type_ClrScheme : Element = new AscFormat.ClrScheme(); break;
case AscDFH.historyitem_type_ClrMap : Element = new AscFormat.ClrMap(); break;
case AscDFH.historyitem_type_ExtraClrScheme : Element = new AscFormat.ExtraClrScheme(); break;
case AscDFH.historyitem_type_FontCollection : Element = new AscFormat.FontCollection(); break;
case AscDFH.historyitem_type_FontScheme : Element = new AscFormat.FontScheme(); break;
case AscDFH.historyitem_type_FormatScheme : Element = new AscFormat.FmtScheme(); break;
case AscDFH.historyitem_type_ThemeElements : Element = new AscFormat.ThemeElements(); break;
case AscDFH.historyitem_type_HF : Element = new AscFormat.HF(); break;
case AscDFH.historyitem_type_BgPr : Element = new AscFormat.CBgPr(); break;
case AscDFH.historyitem_type_Bg : Element = new AscFormat.CBg(); break;
case AscDFH.historyitem_type_PrintSettings : Element = new AscFormat.CPrintSettings(); break;
case AscDFH.historyitem_type_HeaderFooterChart : Element = new AscFormat.CHeaderFooterChart(); break;
case AscDFH.historyitem_type_PageMarginsChart : Element = new AscFormat.CPageMarginsChart(); break;
case AscDFH.historyitem_type_PageSetup : Element = new AscFormat.CPageSetup(); break;
case AscDFH.historyitem_type_Shape : Element = new AscFormat.CShape(); break;
case AscDFH.historyitem_type_DispUnits : Element = new AscFormat.CDispUnits(); break;
case AscDFH.historyitem_type_GroupShape : Element = new AscFormat.CGroupShape(); break;
case AscDFH.historyitem_type_ImageShape : Element = new AscFormat.CImageShape(); break;
case AscDFH.historyitem_type_Geometry : Element = new AscFormat.Geometry(); break;
case AscDFH.historyitem_type_Path : Element = new AscFormat.Path(); break;
case AscDFH.historyitem_type_TextBody : Element = new AscFormat.CTextBody(); break;
case AscDFH.historyitem_type_CatAx : Element = new AscFormat.CCatAx(); break;
case AscDFH.historyitem_type_ValAx : Element = new AscFormat.CValAx(); break;
case AscDFH.historyitem_type_WrapPolygon : Element = new AscCommonWord.CWrapPolygon(); break;
case AscDFH.historyitem_type_DateAx : Element = new AscFormat.CDateAx(); break;
case AscDFH.historyitem_type_SerAx : Element = new AscFormat.CSerAx(); break;
case AscDFH.historyitem_type_Title : Element = new AscFormat.CTitle(); break;
case AscDFH.historyitem_type_OleObject : Element = new AscFormat.COleObject(); break;
case AscDFH.historyitem_type_DrawingContent : Element = new AscFormat.CDrawingDocContent(); break;
case AscDFH.historyitem_type_Math : Element = new AscCommonWord.ParaMath(false); break;
case AscDFH.historyitem_type_MathContent : Element = new AscCommonWord.CMathContent(); break;
case AscDFH.historyitem_type_acc : Element = new AscCommonWord.CAccent(); break;
case AscDFH.historyitem_type_bar : Element = new AscCommonWord.CBar(); break;
case AscDFH.historyitem_type_box : Element = new AscCommonWord.CBox(); break;
case AscDFH.historyitem_type_borderBox : Element = new AscCommonWord.CBorderBox(); break;
case AscDFH.historyitem_type_delimiter : Element = new AscCommonWord.CDelimiter(); break;
case AscDFH.historyitem_type_eqArr : Element = new AscCommonWord.CEqArray(); break;
case AscDFH.historyitem_type_frac : Element = new AscCommonWord.CFraction(); break;
case AscDFH.historyitem_type_mathFunc : Element = new AscCommonWord.CMathFunc(); break;
case AscDFH.historyitem_type_groupChr : Element = new AscCommonWord.CGroupCharacter(); break;
case AscDFH.historyitem_type_lim : Element = new AscCommonWord.CLimit(); break;
case AscDFH.historyitem_type_matrix : Element = new AscCommonWord.CMathMatrix(); break;
case AscDFH.historyitem_type_nary : Element = new AscCommonWord.CNary(); break;
case AscDFH.historyitem_type_phant : Element = new AscCommonWord.CPhantom(); break;
case AscDFH.historyitem_type_rad : Element = new AscCommonWord.CRadical(); break;
case AscDFH.historyitem_type_deg_subsup : Element = new AscCommonWord.CDegreeSubSup(); break;
case AscDFH.historyitem_type_deg : Element = new AscCommonWord.CDegree(); break;
case AscDFH.historyitem_type_Slide : Element = new AscCommonSlide.Slide(); break;
case AscDFH.historyitem_type_SlideLayout : Element = new AscCommonSlide.SlideLayout(); break;
case AscDFH.historyitem_type_SlideMaster : Element = new AscCommonSlide.MasterSlide(); break;
case AscDFH.historyitem_type_SlideComments : Element = new AscCommonSlide.SlideComments(); break;
case AscDFH.historyitem_type_PropLocker : Element = new AscCommonSlide.PropLocker(); break;
case AscDFH.historyitem_type_Theme : Element = new AscFormat.CTheme(); break;
case AscDFH.historyitem_type_GraphicFrame : Element = new AscFormat.CGraphicFrame(); break;
}
if ( null !== Element )
Element.Read_FromBinary2(Reader);
// Включаем назад регистрацию новых классов
this.m_bTurnOff = false;
return Element;
};
CTableId.prototype.Save_Changes = function(Data, Writer)
{
// Сохраняем изменения из тех, которые используются для Undo/Redo в бинарный файл.
// Long : тип класса
// Long : тип изменений
Writer.WriteLong( AscDFH.historyitem_type_TableId );
var Type = Data.Type;
// Пишем тип
Writer.WriteLong( Type );
switch ( Type )
{
case AscDFH.historyitem_TableId_Add :
{
// String : Id элемента
// Varibale : сам элемент
Writer.WriteString2( Data.Id );
Data.Class.Write_ToBinary2( Writer );
break;
}
case AscDFH.historyitem_TableId_Reset:
{
// String : Id_new
// String : Id_old
Writer.WriteString2( Data.Id_new );
Writer.WriteString2( Data.Id_old );
break;
}
case AscDFH.historyitem_TableId_Description:
{
// Long : FileCheckSum
// Long : FileSize
// Long : Description
// Long : ItemsCount
// Long : PointIndex
// Long : StartPoint
// Long : LastPoint
// Long : SumIndex
// Long : DeletedIndex
// String : Версия SDK
Writer.WriteLong(Data.FileCheckSum);
Writer.WriteLong(Data.FileSize);
Writer.WriteLong(Data.Description);
Writer.WriteLong(Data.ItemsCount);
Writer.WriteLong(Data.PointIndex);
Writer.WriteLong(Data.StartPoint);
Writer.WriteLong(Data.LastPoint);
Writer.WriteLong(Data.SumIndex);
Writer.WriteLong(null === Data.DeletedIndex ? -10 : Data.DeletedIndex);
Writer.WriteString2("@@Version.@@Build.@@Rev");
break;
}
}
};
CTableId.prototype.Load_Changes = function(Reader, Reader2)
{
// Сохраняем изменения из тех, которые используются для Undo/Redo в бинарный файл.
// Long : тип класса
// Long : тип изменений
var ClassType = Reader.GetLong();
if ( AscDFH.historyitem_type_TableId != ClassType )
return;
var Type = Reader.GetLong();
switch ( Type )
{
case AscDFH.historyitem_Common_AddWatermark:
{
var sUrl = Reader.GetString2();
if('undefined' != typeof editor && editor.WordControl && editor.WordControl.m_oLogicDocument)
{
var oLogicDocument = editor.WordControl.m_oLogicDocument;
if(oLogicDocument instanceof AscCommonWord.CDocument)
{
var oParaDrawing = oLogicDocument.DrawingObjects.getTrialImage(sUrl);
var oFirstParagraph = oLogicDocument.Get_FirstParagraph();
AscFormat.ExecuteNoHistory(function(){
var oRun = new AscCommonWord.ParaRun();
oRun.Content.splice(0, 0, oParaDrawing);
oFirstParagraph.Content.splice(0, 0, oRun);
oLogicDocument.DrawingObjects.addGraphicObject(oParaDrawing);
}, this, []);
}
else if(oLogicDocument instanceof AscCommonSlide.CPresentation)
{
if(oLogicDocument.Slides[0])
{
var oDrawing = oLogicDocument.Slides[0].graphicObjects.createWatermarkImage(sUrl);
oDrawing.spPr.xfrm.offX = (oLogicDocument.Width - oDrawing.spPr.xfrm.extX)/2;
oDrawing.spPr.xfrm.offY = (oLogicDocument.Height - oDrawing.spPr.xfrm.extY)/2;
oDrawing.parent = oLogicDocument.Slides[0];
oLogicDocument.Slides[0].cSld.spTree.push(oDrawing);
}
}
}
else
{
var oWsModel = window["Asc"]["editor"].wbModel.aWorksheets[0];
if(oWsModel)
{
var objectRender = new AscFormat.DrawingObjects();
var oNewDrawing = objectRender.createDrawingObject(AscCommon.c_oAscCellAnchorType.cellanchorAbsolute);
var oImage = AscFormat.DrawingObjectsController.prototype.createWatermarkImage(sUrl);
oNewDrawing.ext.cx = oImage.spPr.xfrm.extX;
oNewDrawing.ext.cy = oImage.spPr.xfrm.extY;
oNewDrawing.graphicObject = oImage;
oWsModel.Drawings.push(oNewDrawing);
}
}
break;
}
case AscDFH.historyitem_TableId_Add:
{
// String : Id элемента
// Varibale : сам элемент
var Id = Reader.GetString2();
var Class = this.Read_Class_FromBinary( Reader );
this.m_aPairs[Id] = Class;
break;
}
case AscDFH.historyitem_TableId_Reset:
{
// String : Id_new
// String : Id_old
var Id_new = Reader.GetString2();
var Id_old = Reader.GetString2();
if ( "undefined" != this.m_aPairs[Id_old] )
{
var Class = this.m_aPairs[Id_old];
delete this.m_aPairs[Id_old];
this.m_aPairs[Id_new] = Class;
Class.Id = Id_new;
}
break;
}
case AscDFH.historyitem_TableId_Description:
{
// Long : FileCheckSum
// Long : FileSize
// Long : Description
// Long : ItemsCount
// Long : PointIndex
// Long : StartPoint
// Long : LastPoint
// Long : SumIndex
// Long : DeletedIndex
// String : Версия SDK
var FileCheckSum = Reader.GetLong();
var FileSize = Reader.GetLong();
var Description = Reader.GetLong();
var ItemsCount = Reader.GetLong();
var PointIndex = Reader.GetLong();
var StartPoint = Reader.GetLong();
var LastPoint = Reader.GetLong();
var SumIndex = Reader.GetLong();
var DeletedIndex = Reader.GetLong();
var VersionString= Reader.GetString2();
// // CollaborativeEditing LOG
// console.log("ItemsCount2 " + CollaborativeEditing.m_nErrorLog_PointChangesCount);
// if (CollaborativeEditing.m_nErrorLog_PointChangesCount !== CollaborativeEditing.m_nErrorLog_SavedPCC)
// console.log("========================= BAD Changes Count in Point =============================");
//
// if (CollaborativeEditing.m_nErrorLog_CurPointIndex + 1 !== PointIndex && 0 !== PointIndex)
// console.log("========================= BAD Point index ========================================");
//
// var bBadSumIndex = false;
// if (0 === PointIndex)
// {
// CollaborativeEditing.m_nErrorLog_SumIndex = 0;
// }
// else
// {
// CollaborativeEditing.m_nErrorLog_SumIndex += CollaborativeEditing.m_nErrorLog_SavedPCC + 1; // Потому что мы не учитываем данное изменение
// if (PointIndex === StartPoint)
// {
// if (CollaborativeEditing.m_nErrorLog_SumIndex !== SumIndex)
// bBadSumIndex = true;
//
// console.log("SumIndex2 " + CollaborativeEditing.m_nErrorLog_SumIndex);
// CollaborativeEditing.m_nErrorLog_SumIndex = SumIndex;
// }
// }
//
// console.log("----------------------------");
// console.log("FileCheckSum " + FileCheckSum);
// console.log("FileSize " + FileSize);
// console.log("Description " + Description + " " + AscDFH.GetHistoryPointStringDescription(Description));
// console.log("PointIndex " + PointIndex);
// console.log("StartPoint " + StartPoint);
// console.log("LastPoint " + LastPoint);
// console.log("ItemsCount " + ItemsCount);
// console.log("SumIndex " + SumIndex);
// console.log("DeletedIndex " + (-10 === DeletedIndex ? null : DeletedIndex));
//
// // -1 Чтобы не учитывалось данное изменение
// CollaborativeEditing.m_nErrorLog_SavedPCC = ItemsCount;
// CollaborativeEditing.m_nErrorLog_PointChangesCount = -1;
// CollaborativeEditing.m_nErrorLog_CurPointIndex = PointIndex;
//
// if (bBadSumIndex)
// console.log("========================= BAD Sum index ==========================================");
break;
}
}
return true;
};
CTableId.prototype.Unlock = function(Data)
{
// Ничего не делаем
};
function CLock()
{
this.Type = locktype_None;
......@@ -2732,7 +2229,6 @@ CUserCacheColor.prototype.init = function(nColor) {
}
var g_oIdCounter = new CIdCounter();
var g_oTableId = new CTableId();
window["SetDoctRendererParams"] = function(_params)
{
......@@ -2793,5 +2289,4 @@ window["SetDoctRendererParams"] = function(_params)
window["AscCommon"].kCurFormatPainterWord = kCurFormatPainterWord;
window["AscCommon"].parserHelp = parserHelp;
window["AscCommon"].g_oIdCounter = g_oIdCounter;
window["AscCommon"].g_oTableId = g_oTableId;
})(window);
......@@ -121,32 +121,29 @@ CHistory.prototype =
Point.Items.splice(0, 1);
}
var Data =
{
Type : AscDFH.historyitem_TableId_Description,
FileCheckSum : this.FileCheckSum,
FileSize : this.FileSize,
Description : Point.Description,
ItemsCount : Point.Items.length,
PointIndex : PointIndex,
StartPoint : StartPoint,
LastPoint : LastPoint,
SumIndex : SumIndex,
DeletedIndex : DeletedIndex
};
var Data = new AscCommon.CChangesTableIdDescription(Class,
this.FileCheckSum,
this.FileSize,
Point.Description,
Point.Items.length,
PointIndex,
StartPoint,
LastPoint,
SumIndex,
DeletedIndex
);
var Binary_Pos = this.BinaryWriter.GetCurPosition();
this.BinaryWriter.WriteString2(Class.Get_Id());
Class.Save_Changes(Data, this.BinaryWriter);
this.BinaryWriter.WriteLong(Data.Type);
Data.WriteToBinary(this.BinaryWriter);
var Binary_Len = this.BinaryWriter.GetCurPosition() - Binary_Pos;
var Item =
{
var Item = {
Class : Class,
Data : Data,
Binary:
{
Binary : {
Pos : Binary_Pos,
Len : Binary_Len
},
......
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