From 9d33dc9d886a890477c22d7d7c7e2b208fbbdbda Mon Sep 17 00:00:00 2001 From: "Alexey.Musinov" <Alexey.Musinov@OnlyOffice.com> Date: Fri, 9 Oct 2015 14:34:30 +0000 Subject: [PATCH] [ios] insert shape git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@65245 954022d7-b5bf-4e40-9824-e11837661b57 --- Excel/native/DrawingDocument.js | 4337 +++++++++++++++++++++++++++++++ Excel/native/Overlay.js | 3017 +++++++++++++++++++++ Excel/native/native.js | 1536 ++++++++++- 3 files changed, 8822 insertions(+), 68 deletions(-) create mode 100644 Excel/native/DrawingDocument.js create mode 100644 Excel/native/Overlay.js diff --git a/Excel/native/DrawingDocument.js b/Excel/native/DrawingDocument.js new file mode 100644 index 000000000..fb4df3cb9 --- /dev/null +++ b/Excel/native/DrawingDocument.js @@ -0,0 +1,4337 @@ +"use strict"; + +var g_dDpiX = 96.0; +var g_dDpiY = 96.0; + +var g_dKoef_mm_to_pix = g_dDpiX / 25.4; +var g_dKoef_pix_to_mm = 25.4 / g_dDpiX; + +var g_fontManager = new CFontManager(); +g_fontManager.Initialize(true); + +function SetHintsProps(bIsHinting, bIsSubpixHinting) +{ + if (undefined === g_fontManager.m_oLibrary.tt_hint_props) + return; + + if (bIsHinting && bIsSubpixHinting) + { + g_fontManager.m_oLibrary.tt_hint_props.TT_USE_BYTECODE_INTERPRETER = true; + g_fontManager.m_oLibrary.tt_hint_props.TT_CONFIG_OPTION_SUBPIXEL_HINTING = true; + + g_fontManager.LOAD_MODE = 40968; + } + else if (bIsHinting) + { + g_fontManager.m_oLibrary.tt_hint_props.TT_USE_BYTECODE_INTERPRETER = true; + g_fontManager.m_oLibrary.tt_hint_props.TT_CONFIG_OPTION_SUBPIXEL_HINTING = false; + + g_fontManager.LOAD_MODE = 40968; + } + else + { + g_fontManager.m_oLibrary.tt_hint_props.TT_USE_BYTECODE_INTERPRETER = true; + g_fontManager.m_oLibrary.tt_hint_props.TT_CONFIG_OPTION_SUBPIXEL_HINTING = false; + + g_fontManager.LOAD_MODE = 40970; + } +} + +SetHintsProps(true, true); + +function CTableMarkup(Table) +{ + this.Internal = + { + RowIndex : 0, + CellIndex : 0, + PageNum : 0 + }; + this.Table = Table; + this.X = 0; // Смещение таблицы от начала Ñтраницы до первой колонки + + this.Cols = []; // маÑÑив ширин колонок + this.Margins = []; // маÑÑив левых и правых маргинов + + this.Rows = []; // маÑÑив позиций, выÑот Ñтрок(Ð´Ð»Ñ Ð´Ð°Ð½Ð½Ð¾Ð¹ Ñтраницы) + // Rows = [ { Y : , H : }, ... ] + + this.CurCol = 0; // Ñ‚ÐµÐºÑƒÑ‰Ð°Ñ ÐºÐ¾Ð»Ð¾Ð½ÐºÐ° + this.CurRow = 0; // Ñ‚ÐµÐºÑƒÑ‰Ð°Ñ Ñтрока + + this.TransformX = 0; + this.TransformY = 0; +} + +CTableMarkup.prototype = +{ + CreateDublicate : function() + { + var obj = new CTableMarkup(this.Table); + + obj.Internal = { RowIndex : this.Internal.RowIndex, CellIndex : this.Internal.CellIndex, PageNum : this.Internal.PageNum }; + obj.X = this.X; + + var len = this.Cols.length; + for (var i = 0; i < len; i++) + obj.Cols[i] = this.Cols[i]; + + len = this.Margins.length; + for (var i = 0; i < len; i++) + obj.Margins[i] = { Left : this.Margins[i].Left, Right : this.Margins[i].Right }; + + len = this.Rows.length; + for (var i = 0; i < len; i++) + obj.Rows[i] = { Y : this.Rows[i].Y, H : this.Rows[i].H }; + + obj.CurRow = this.CurRow; + obj.CurCol = this.CurCol; + + return obj; + }, + + CorrectFrom : function() + { + this.X += this.TransformX; + + var _len = this.Rows.length; + for (var i = 0; i < _len; i++) + { + this.Rows[i].Y += this.TransformY; + } + }, + + CorrectTo : function() + { + this.X -= this.TransformX; + + var _len = this.Rows.length; + for (var i = 0; i < _len; i++) + { + this.Rows[i].Y -= this.TransformY; + } + }, + + Get_X : function() + { + return this.X; + }, + + Get_Y : function() + { + var _Y = 0; + if (this.Rows.length > 0) + { + _Y = this.Rows[0].Y; + } + return _Y; + } +}; + +function CTableOutline(Table, PageNum, X, Y, W, H) +{ + this.Table = Table; + this.PageNum = PageNum; + + this.X = X; + this.Y = Y; + + this.W = W; + this.H = H; +} + +function CTextMeasurer() +{ + this.m_oManager = new CFontManager(); + + this.m_oFont = null; + + // RFonts + this.m_oTextPr = null; + this.m_oLastFont = new CFontSetup(); + this.LastFontOriginInfo = { Name : "", Replace : null }; + + this.Init = function() + { + this.m_oManager.Initialize(); + }; + + this.SetFont = function(font) + { + if (!font) + return; + + this.m_oFont = font; + + var bItalic = true === font.Italic; + var bBold = true === font.Bold; + + var oFontStyle = FontStyle.FontStyleRegular; + if ( !bItalic && bBold ) + oFontStyle = FontStyle.FontStyleBold; + else if ( bItalic && !bBold ) + oFontStyle = FontStyle.FontStyleItalic; + else if ( bItalic && bBold ) + oFontStyle = FontStyle.FontStyleBoldItalic; + + var _lastSetUp = this.m_oLastFont; + if (_lastSetUp.SetUpName != font.FontFamily.Name || _lastSetUp.SetUpSize != font.FontSize || _lastSetUp.SetUpStyle != oFontStyle) + { + _lastSetUp.SetUpName = font.FontFamily.Name; + _lastSetUp.SetUpSize = font.FontSize; + _lastSetUp.SetUpStyle = oFontStyle; + + g_fontApplication.LoadFont(_lastSetUp.SetUpName, window.g_font_loader, this.m_oManager, _lastSetUp.SetUpSize, _lastSetUp.SetUpStyle, 72, 72, undefined, this.LastFontOriginInfo); + } + }; + + this.SetFontInternal = function(_name, _size, _style) + { + var _lastSetUp = this.m_oLastFont; + if (_lastSetUp.SetUpName != _name || _lastSetUp.SetUpSize != _size || _lastSetUp.SetUpStyle != _style) + { + _lastSetUp.SetUpName = _name; + _lastSetUp.SetUpSize = _size; + _lastSetUp.SetUpStyle = _style; + + g_fontApplication.LoadFont(_lastSetUp.SetUpName, window.g_font_loader, this.m_oManager, _lastSetUp.SetUpSize, _lastSetUp.SetUpStyle, 72, 72, undefined, this.LastFontOriginInfo); + } + }; + + this.SetTextPr = function(textPr, theme) + { + this.m_oTextPr = textPr.Copy(); + this.theme = theme; + var FontScheme = theme.themeElements.fontScheme; + this.m_oTextPr.RFonts.Ascii = {Name: FontScheme.checkFont(this.m_oTextPr.RFonts.Ascii.Name), Index: -1}; + this.m_oTextPr.RFonts.EastAsia = {Name: FontScheme.checkFont(this.m_oTextPr.RFonts.EastAsia.Name), Index: -1}; + this.m_oTextPr.RFonts.HAnsi = {Name: FontScheme.checkFont(this.m_oTextPr.RFonts.HAnsi.Name), Index: -1}; + this.m_oTextPr.RFonts.CS = {Name: FontScheme.checkFont(this.m_oTextPr.RFonts.CS.Name), Index: -1}; + }; + + this.SetFontSlot = function(slot, fontSizeKoef) + { + var _rfonts = this.m_oTextPr.RFonts; + var _lastFont = this.m_oLastFont; + + switch (slot) + { + case fontslot_ASCII: + { + _lastFont.Name = _rfonts.Ascii.Name; + _lastFont.Index = _rfonts.Ascii.Index; + + _lastFont.Size = this.m_oTextPr.FontSize; + _lastFont.Bold = this.m_oTextPr.Bold; + _lastFont.Italic = this.m_oTextPr.Italic; + + break; + } + case fontslot_CS: + { + _lastFont.Name = _rfonts.CS.Name; + _lastFont.Index = _rfonts.CS.Index; + + _lastFont.Size = this.m_oTextPr.FontSizeCS; + _lastFont.Bold = this.m_oTextPr.BoldCS; + _lastFont.Italic = this.m_oTextPr.ItalicCS; + + break; + } + case fontslot_EastAsia: + { + _lastFont.Name = _rfonts.EastAsia.Name; + _lastFont.Index = _rfonts.EastAsia.Index; + + _lastFont.Size = this.m_oTextPr.FontSize; + _lastFont.Bold = this.m_oTextPr.Bold; + _lastFont.Italic = this.m_oTextPr.Italic; + + break; + } + case fontslot_HAnsi: + default: + { + _lastFont.Name = _rfonts.HAnsi.Name; + _lastFont.Index = _rfonts.HAnsi.Index; + + _lastFont.Size = this.m_oTextPr.FontSize; + _lastFont.Bold = this.m_oTextPr.Bold; + _lastFont.Italic = this.m_oTextPr.Italic; + + break; + } + } + + if (undefined !== fontSizeKoef) + _lastFont.Size *= fontSizeKoef; + + var _style = 0; + if (_lastFont.Italic) + _style += 2; + if (_lastFont.Bold) + _style += 1; + + if (_lastFont.Name != _lastFont.SetUpName || _lastFont.Size != _lastFont.SetUpSize || _style != _lastFont.SetUpStyle) + { + _lastFont.SetUpName = _lastFont.Name; + _lastFont.SetUpSize = _lastFont.Size; + _lastFont.SetUpStyle = _style; + + g_fontApplication.LoadFont(_lastFont.SetUpName, window.g_font_loader, this.m_oManager, _lastFont.SetUpSize, _lastFont.SetUpStyle, 72, 72, undefined, this.LastFontOriginInfo); + } + }; + + this.GetTextPr = function() + { + return this.m_oTextPr; + }; + + this.GetFont = function() + { + return this.m_oFont; + }; + + this.Measure = function(text) + { + var Width = 0; + var Height = 0; + + var _code = text.charCodeAt(0); + if (null != this.LastFontOriginInfo.Replace) + _code = g_fontApplication.GetReplaceGlyph(_code, this.LastFontOriginInfo.Replace); + + var Temp = this.m_oManager.MeasureChar( _code); + + Width = Temp.fAdvanceX * 25.4 / 72; + Height = 0;//Temp.fHeight; + + return { Width : Width, Height : Height }; + }; + this.Measure2 = function(text) + { + var Width = 0; + + var _code = text.charCodeAt(0); + if (null != this.LastFontOriginInfo.Replace) + _code = g_fontApplication.GetReplaceGlyph(_code, this.LastFontOriginInfo.Replace); + + var Temp = this.m_oManager.MeasureChar( _code ); + + Width = Temp.fAdvanceX * 25.4 / 72; + + return { Width : Width, Ascent : (Temp.oBBox.fMaxY * 25.4 / 72), Height : ((Temp.oBBox.fMaxY - Temp.oBBox.fMinY) * 25.4 / 72), + WidthG: ((Temp.oBBox.fMaxX - Temp.oBBox.fMinX) * 25.4 / 72)}; + }; + + this.MeasureCode = function(lUnicode) + { + var Width = 0; + var Height = 0; + + if (null != this.LastFontOriginInfo.Replace) + lUnicode = g_fontApplication.GetReplaceGlyph(lUnicode, this.LastFontOriginInfo.Replace); + + var Temp = this.m_oManager.MeasureChar( lUnicode ); + + Width = Temp.fAdvanceX * 25.4 / 72; + Height = 0;//Temp.fHeight; + + return { Width : Width, Height : Height }; + }; + this.Measure2Code = function(lUnicode) + { + var Width = 0; + + if (null != this.LastFontOriginInfo.Replace) + lUnicode = g_fontApplication.GetReplaceGlyph(lUnicode, this.LastFontOriginInfo.Replace); + + var Temp = this.m_oManager.MeasureChar( lUnicode ); + + Width = Temp.fAdvanceX * 25.4 / 72; + + return { Width : Width, Ascent : (Temp.oBBox.fMaxY * 25.4 / 72), Height : ((Temp.oBBox.fMaxY - Temp.oBBox.fMinY) * 25.4 / 72), + WidthG: ((Temp.oBBox.fMaxX - Temp.oBBox.fMinX) * 25.4 / 72)}; + }; + + this.GetAscender = function() + { + var UnitsPerEm = this.m_oManager.m_lUnits_Per_Em; + var Ascender = this.m_oManager.m_lAscender; + + return Ascender * this.m_oLastFont.SetUpSize / UnitsPerEm * g_dKoef_pt_to_mm; + }; + this.GetDescender = function() + { + var UnitsPerEm = this.m_oManager.m_lUnits_Per_Em; + var Descender = this.m_oManager.m_lDescender; + + return Descender * this.m_oLastFont.SetUpSize / UnitsPerEm * g_dKoef_pt_to_mm; + }; + this.GetHeight = function() + { + var UnitsPerEm = this.m_oManager.m_lUnits_Per_Em; + var Height = this.m_oManager.m_lLineHeight; + + return Height * this.m_oLastFont.SetUpSize / UnitsPerEm * g_dKoef_pt_to_mm; + }; +} + +var g_oTextMeasurer = new CTextMeasurer(); +g_oTextMeasurer.Init(); + +function CTableOutlineDr() +{ + var image_64 = "u7u7/7u7u/+7u7v/u7u7/7u7u/+7u7v/u7u7/7u7u/+7u7v/u7u7/7u7u/+7u7v/u7u7/7u7u//6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6/4+Pj/+7u7v/9vb2//b29v/39/f/9/f3//f39/83aMT/9/f3//f39//39/f/9/f3//f39/+Pj4//u7u7//Ly8v/y8vL/8vLy//Pz8/83aMT/N2jE/zdoxP/z8/P/8/Pz//Pz8//z8/P/j4+P/7u7u//u7u7/7u7u/+7u7v/u7u7/7u7u/zdoxP/u7u7/7u7u/+7u7v/u7u7/7u7u/4+Pj/+7u7v/6Ojo/+jo6P83aMT/6enp/+np6f83aMT/6enp/+np6f83aMT/6enp/+np6f+Pj4//u7u7/+Pj4/83aMT/N2jE/zdoxP83aMT/N2jE/zdoxP83aMT/N2jE/zdoxP/k5OT/j4+P/7u7u//o6Oj/6Ojo/zdoxP/o6Oj/6Ojo/zdoxP/o6Oj/6Ojo/zdoxP/o6Oj/6Ojo/4+Pj/+7u7v/7e3t/+3t7f/t7e3/7e3t/+3t7f83aMT/7e3t/+zs7P/s7Oz/7Ozs/+zs7P+Pj4//u7u7//Ly8v/y8vL/8vLy//Ly8v83aMT/N2jE/zdoxP/x8fH/8fHx//Hx8f/x8fH/j4+P/7u7u//19fX/9fX1//X19f/19fX/9fX1/zdoxP/19fX/9fX1//X19f/19fX/9fX1/4+Pj/+7u7v/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//j4+P+Pj4//u7u7/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/w=="; + + this.image = document.createElement('canvas'); + this.image.width = 13; + this.image.height = 13; + + var ctx = this.image.getContext('2d'); + var _data = ctx.createImageData(13, 13); + + DecodeBase64(_data, image_64); + ctx.putImageData(_data, 0, 0); + + _data = null; + image_64 = null; + + this.TableOutline = null; + this.Counter = 0; + this.bIsNoTable = true; + this.bIsTracked = false; + + this.CurPos = null; + this.TrackTablePos = 0; // 0 - left_top, 1 - right_top, 2 - right_bottom, 3 - left_bottom + this.TrackOffsetX = 0; + this.TrackOffsetY = 0; + + this.InlinePos = null; + + this.IsChangeSmall = true; + this.ChangeSmallPoint = null; + + this.TableMatrix = null; + this.CurrentPageIndex = null; + + this.checkMouseDown = function(pos, word_control) + { + if (null == this.TableOutline) + return false; + + var _table_track = this.TableOutline; + var _d = 13 * g_dKoef_pix_to_mm * 100 / word_control.m_nZoomValue; + + this.IsChangeSmall = true; + this.ChangeSmallPoint = pos; + + if (!this.TableMatrix || global_MatrixTransformer.IsIdentity(this.TableMatrix)) + { + if (word_control.MobileTouchManager) + { + var _move_point = word_control.MobileTouchManager.TableMovePoint; + + if (_move_point == null || pos.Page != _table_track.PageNum) + return false; + + var _pos1 = word_control.m_oDrawingDocument.ConvertCoordsToCursorWR(pos.X, pos.Y, pos.Page); + var _pos2 = word_control.m_oDrawingDocument.ConvertCoordsToCursorWR(_move_point.X, _move_point.Y, pos.Page); + + var _eps = word_control.MobileTouchManager.TrackTargetEps; + + var _offset1 = word_control.MobileTouchManager.TableRulersRectOffset; + var _offset2 = _offset1 + word_control.MobileTouchManager.TableRulersRectSize; + if ((_pos1.X >= (_pos2.X - _offset2 - _eps)) && (_pos1.X <= (_pos2.X - _offset1 + _eps)) && + (_pos1.Y >= (_pos2.Y - _offset2 - _eps)) && (_pos1.Y <= (_pos2.Y - _offset1 + _eps))) + { + this.TrackTablePos = 0; + return true; + } + + return false; + } + + switch (this.TrackTablePos) + { + case 1: + { + var _x = _table_track.X + _table_track.W; + var _b = _table_track.Y; + var _y = _b - _d; + var _r = _x + _d; + + if ((pos.X > _x) && (pos.X < _r) && (pos.Y > _y) && (pos.Y < _b)) + { + this.TrackOffsetX = pos.X - _x; + this.TrackOffsetY = pos.Y - _b; + return true; + } + return false; + } + case 2: + { + var _x = _table_track.X + _table_track.W; + var _y = _table_track.Y + _table_track.H; + var _r = _x + _d; + var _b = _y + _d; + + if ((pos.X > _x) && (pos.X < _r) && (pos.Y > _y) && (pos.Y < _b)) + { + this.TrackOffsetX = pos.X - _x; + this.TrackOffsetY = pos.Y - _y; + return true; + } + return false; + } + case 3: + { + var _r = _table_track.X; + var _x = _r - _d; + var _y = _table_track.Y + _table_track.H; + var _b = _y + _d; + + if ((pos.X > _x) && (pos.X < _r) && (pos.Y > _y) && (pos.Y < _b)) + { + this.TrackOffsetX = pos.X - _r; + this.TrackOffsetY = pos.Y - _y; + return true; + } + return false; + } + case 0: + default: + { + var _r = _table_track.X; + var _b = _table_track.Y; + var _x = _r - _d; + var _y = _b - _d; + + if ((pos.X > _x) && (pos.X < _r) && (pos.Y > _y) && (pos.Y < _b)) + { + this.TrackOffsetX = pos.X - _r; + this.TrackOffsetY = pos.Y - _b; + return true; + } + return false; + } + } + } + else + { + if (word_control.MobileTouchManager) + { + var _invert = global_MatrixTransformer.Invert(this.TableMatrix); + var _posx = _invert.TransformPointX(pos.X, pos.Y); + var _posy = _invert.TransformPointY(pos.X, pos.Y); + + var _move_point = word_control.MobileTouchManager.TableMovePoint; + + if (_move_point == null || pos.Page != _table_track.PageNum) + return false; + + var _koef = g_dKoef_pix_to_mm * 100 / word_control.m_nZoomValue; + var _eps = word_control.MobileTouchManager.TrackTargetEps * _koef; + + var _offset1 = word_control.MobileTouchManager.TableRulersRectOffset * _koef; + var _offset2 = _offset1 + word_control.MobileTouchManager.TableRulersRectSize * _koef; + if ((_posx >= (_move_point.X - _offset2 - _eps)) && (_posx <= (_move_point.X - _offset1 + _eps)) && + (_posy >= (_move_point.Y - _offset2 - _eps)) && (_posy <= (_move_point.Y - _offset1 + _eps))) + { + this.TrackTablePos = 0; + return true; + } + + return false; + } + + var _invert = global_MatrixTransformer.Invert(this.TableMatrix); + var _posx = _invert.TransformPointX(pos.X, pos.Y); + var _posy = _invert.TransformPointY(pos.X, pos.Y); + switch (this.TrackTablePos) + { + case 1: + { + var _x = _table_track.X + _table_track.W; + var _b = _table_track.Y; + var _y = _b - _d; + var _r = _x + _d; + + if ((_posx > _x) && (_posx < _r) && (_posy > _y) && (_posy < _b)) + { + this.TrackOffsetX = _posx - _x; + this.TrackOffsetY = _posy - _b; + return true; + } + return false; + } + case 2: + { + var _x = _table_track.X + _table_track.W; + var _y = _table_track.Y + _table_track.H; + var _r = _x + _d; + var _b = _y + _d; + + if ((_posx > _x) && (_posx < _r) && (_posy > _y) && (_posy < _b)) + { + this.TrackOffsetX = _posx - _x; + this.TrackOffsetY = _posy - _y; + return true; + } + return false; + } + case 3: + { + var _r = _table_track.X; + var _x = _r - _d; + var _y = _table_track.Y + _table_track.H; + var _b = _y + _d; + + if ((_posx > _x) && (_posx < _r) && (_posy > _y) && (_posy < _b)) + { + this.TrackOffsetX = _posx - _r; + this.TrackOffsetY = _posy - _y; + return true; + } + return false; + } + case 0: + default: + { + var _r = _table_track.X; + var _b = _table_track.Y; + var _x = _r - _d; + var _y = _b - _d; + + if ((_posx > _x) && (_posx < _r) && (_posy > _y) && (_posy < _b)) + { + this.TrackOffsetX = _posx - _r; + this.TrackOffsetY = _posy - _b; + return true; + } + return false; + } + } + } + + return false; + } + + this.checkMouseUp = function(X, Y, word_control) + { + this.bIsTracked = false; + + if (null == this.TableOutline || (true === this.IsChangeSmall) || word_control.m_oApi.isViewMode) + return false; + + var _d = 13 * g_dKoef_pix_to_mm * 100 / word_control.m_nZoomValue; + + var _outline = this.TableOutline; + var _table = _outline.Table; + + _table.Cursor_MoveToStartPos(); + _table.Document_SetThisElementCurrent(); + + if (!_table.Is_Inline()) + { + var pos; + switch (this.TrackTablePos) + { + case 1: + { + var _w_pix = this.TableOutline.W * g_dKoef_mm_to_pix * word_control.m_nZoomValue / 100; + pos = word_control.m_oDrawingDocument.ConvertCoordsFromCursor2(X - _w_pix, Y); + break; + } + case 2: + { + var _w_pix = this.TableOutline.W * g_dKoef_mm_to_pix * word_control.m_nZoomValue / 100; + var _h_pix = this.TableOutline.H * g_dKoef_mm_to_pix * word_control.m_nZoomValue / 100; + pos = word_control.m_oDrawingDocument.ConvertCoordsFromCursor2(X - _w_pix, Y - _h_pix); + break; + } + case 3: + { + var _h_pix = this.TableOutline.H * g_dKoef_mm_to_pix * word_control.m_nZoomValue / 100; + pos = word_control.m_oDrawingDocument.ConvertCoordsFromCursor2(X, Y - _h_pix); + break; + } + case 0: + default: + { + pos = word_control.m_oDrawingDocument.ConvertCoordsFromCursor2(X, Y); + break; + } + } + + var NearestPos = word_control.m_oLogicDocument.Get_NearestPos(pos.Page, pos.X - this.TrackOffsetX, pos.Y - this.TrackOffsetY); + _table.Move(pos.X - this.TrackOffsetX, pos.Y - this.TrackOffsetY, pos.Page, NearestPos); + _outline.X = pos.X - this.TrackOffsetX; + _outline.Y = pos.Y - this.TrackOffsetY; + _outline.PageNum = pos.Page; + } + else + { + if (null != this.InlinePos) + { + // inline move + _table.Move(this.InlinePos.X, this.InlinePos.Y, this.InlinePos.Page, this.InlinePos); + } + } + } + + this.checkMouseMove = function(X, Y, word_control) + { + if (null == this.TableOutline) + return false; + + if (true === this.IsChangeSmall) + { + var _pos = word_control.m_oDrawingDocument.ConvertCoordsFromCursor2(X, Y); + var _dist = 15 * g_dKoef_pix_to_mm * 100 / word_control.m_nZoomValue; + if ((Math.abs(_pos.X - this.ChangeSmallPoint.X) < _dist) && (Math.abs(_pos.Y - this.ChangeSmallPoint.Y) < _dist) && (_pos.Page == this.ChangeSmallPoint.Page)) + { + this.CurPos = { X: this.ChangeSmallPoint.X, Y : this.ChangeSmallPoint.Y, Page: this.ChangeSmallPoint.Page }; + + switch (this.TrackTablePos) + { + case 1: + { + this.CurPos.X -= this.TableOutline.W; + break; + } + case 2: + { + this.CurPos.X -= this.TableOutline.W; + this.CurPos.Y -= this.TableOutline.H; + break; + } + case 3: + { + this.CurPos.Y -= this.TableOutline.H; + break; + } + case 0: + default: + { + break; + } + } + + this.CurPos.X -= this.TrackOffsetX; + this.CurPos.Y -= this.TrackOffsetY; + return; + } + this.IsChangeSmall = false; + + this.TableOutline.Table.Selection_Remove(); + editor.WordControl.m_oLogicDocument.Document_UpdateSelectionState(); + } + + var _d = 13 * g_dKoef_pix_to_mm * 100 / word_control.m_nZoomValue; + switch (this.TrackTablePos) + { + case 1: + { + var _w_pix = this.TableOutline.W * g_dKoef_mm_to_pix * word_control.m_nZoomValue / 100; + this.CurPos = word_control.m_oDrawingDocument.ConvertCoordsFromCursor2(X - _w_pix, Y); + break; + } + case 2: + { + var _w_pix = this.TableOutline.W * g_dKoef_mm_to_pix * word_control.m_nZoomValue / 100; + var _h_pix = this.TableOutline.H * g_dKoef_mm_to_pix * word_control.m_nZoomValue / 100; + this.CurPos = word_control.m_oDrawingDocument.ConvertCoordsFromCursor2(X - _w_pix, Y - _h_pix); + break; + } + case 3: + { + var _h_pix = this.TableOutline.H * g_dKoef_mm_to_pix * word_control.m_nZoomValue / 100; + this.CurPos = word_control.m_oDrawingDocument.ConvertCoordsFromCursor2(X, Y - _h_pix); + break; + } + case 0: + default: + { + this.CurPos = word_control.m_oDrawingDocument.ConvertCoordsFromCursor2(X, Y); + break; + } + } + + this.CurPos.X -= this.TrackOffsetX; + this.CurPos.Y -= this.TrackOffsetY; + } + + this.CheckStartTrack = function(word_control, transform) + { + this.TableMatrix = null; + if (transform) + this.TableMatrix = transform.CreateDublicate(); + + if (!this.TableMatrix || global_MatrixTransformer.IsIdentity(this.TableMatrix)) + { + var pos = word_control.m_oDrawingDocument.ConvertCoordsToCursor(this.TableOutline.X, this.TableOutline.Y, this.TableOutline.PageNum, true); + + var _x0 = word_control.m_oEditor.AbsolutePosition.L; + var _y0 = word_control.m_oEditor.AbsolutePosition.T; + + if (pos.X < _x0 && pos.Y < _y0) + { + this.TrackTablePos = 2; + } + else if (pos.X < _x0) + { + this.TrackTablePos = 1; + } + else if (pos.Y < _y0) + { + this.TrackTablePos = 3; + } + else + { + this.TrackTablePos = 0; + } + } + else + { + var _x = this.TableOutline.X; + var _y = this.TableOutline.Y; + var _r = _x + this.TableOutline.W; + var _b = _y + this.TableOutline.H; + + var x0 = transform.TransformPointX(_x, _y); + var y0 = transform.TransformPointY(_x, _y); + + var x1 = transform.TransformPointX(_r, _y); + var y1 = transform.TransformPointY(_r, _y); + + var x2 = transform.TransformPointX(_r, _b); + var y2 = transform.TransformPointY(_r, _b); + + var x3 = transform.TransformPointX(_x, _b); + var y3 = transform.TransformPointY(_x, _b); + + var _x0 = word_control.m_oEditor.AbsolutePosition.L * g_dKoef_mm_to_pix; + var _y0 = word_control.m_oEditor.AbsolutePosition.T * g_dKoef_mm_to_pix; + var _x1 = word_control.m_oEditor.AbsolutePosition.R * g_dKoef_mm_to_pix; + var _y1 = word_control.m_oEditor.AbsolutePosition.B * g_dKoef_mm_to_pix; + + var pos0 = word_control.m_oDrawingDocument.ConvertCoordsToCursor(x0, y0, this.TableOutline.PageNum, true); + if (pos0.X > _x0 && pos0.X < _x1 && pos0.Y > _y0 && pos0.Y < _y1) + { + this.TrackTablePos = 0; + return; + } + + pos0 = word_control.m_oDrawingDocument.ConvertCoordsToCursor(x1, y1, this.TableOutline.PageNum, true); + if (pos0.X > _x0 && pos0.X < _x1 && pos0.Y > _y0 && pos0.Y < _y1) + { + this.TrackTablePos = 1; + return; + } + + pos0 = word_control.m_oDrawingDocument.ConvertCoordsToCursor(x3, y3, this.TableOutline.PageNum, true); + if (pos0.X > _x0 && pos0.X < _x1 && pos0.Y > _y0 && pos0.Y < _y1) + { + this.TrackTablePos = 3; + return; + } + + pos0 = word_control.m_oDrawingDocument.ConvertCoordsToCursor(x2, y2, this.TableOutline.PageNum, true); + if (pos0.X > _x0 && pos0.X < _x1 && pos0.Y > _y0 && pos0.Y < _y1) + { + this.TrackTablePos = 2; + return; + } + + this.TrackTablePos = 0; + } + } +} + +function CCacheImage() +{ + this.image = null; + this.image_locked = 0; + this.image_unusedCount = 0; +} + +function CCacheManager() +{ + this.arrayImages = []; + this.arrayCount = 0; + this.countValidImage = 1; + + this.CheckImagesForNeed = function() + { + for (var i = 0; i < this.arrayCount; ++i) + { + if ((this.arrayImages[i].image_locked == 0) && (this.arrayImages[i].image_unusedCount >= this.countValidImage)) + { + delete this.arrayImages[i].image; + this.arrayImages.splice(i, 1); + --i; + --this.arrayCount; + } + } + } + + this.UnLock = function(_cache_image) + { + if (null == _cache_image) + return; + + _cache_image.image_locked = 0; + _cache_image.image_unusedCount = 0; + // ����� ����� �������� ������ � ���� (_cache_image = null) <- ��� ����������� !!!!!!! + } + + this.Lock = function(_w, _h) + { + for (var i = 0; i < this.arrayCount; ++i) + { + if (this.arrayImages[i].image_locked) + continue; + var _wI = this.arrayImages[i].image.width; + var _hI = this.arrayImages[i].image.height; + if ((_wI == _w) && (_hI == _h)) + { + this.arrayImages[i].image_locked = 1; + this.arrayImages[i].image_unusedCount = 0; + + this.arrayImages[i].image.ctx.globalAlpha = 1.0; + this.arrayImages[i].image.ctx.setTransform(1, 0, 0, 1, 0, 0); + this.arrayImages[i].image.ctx.fillStyle = "#ffffff"; + this.arrayImages[i].image.ctx.fillRect(0, 0, _w, _h); + return this.arrayImages[i]; + } + this.arrayImages[i].image_unusedCount++; + } + this.CheckImagesForNeed(); + var index = this.arrayCount; + this.arrayCount++; + + this.arrayImages[index] = new CCacheImage(); + this.arrayImages[index].image = document.createElement('canvas'); + this.arrayImages[index].image.width = _w; + this.arrayImages[index].image.height = _h; + this.arrayImages[index].image.ctx = this.arrayImages[index].image.getContext('2d'); + this.arrayImages[index].image.ctx.globalAlpha = 1.0; + this.arrayImages[index].image.ctx.setTransform(1, 0, 0, 1, 0, 0); + this.arrayImages[index].image.ctx.fillStyle = "#ffffff"; + this.arrayImages[index].image.ctx.fillRect(0, 0, _w, _h); + this.arrayImages[index].image_locked = 1; + this.arrayImages[index].image_unusedCount = 0; + return this.arrayImages[index]; + } +} + +function _rect() +{ + this.x = 0; + this.y = 0; + this.w = 0; + this.h = 0; +} + +function CDrawingPage() +{ + this.left = 0; + this.top = 0; + this.right = 0; + this.bottom = 0; + + this.cachedImage = null; +} + +function CPage() +{ + this.width_mm = 210; + this.height_mm = 297; + + this.margin_left = 0; + this.margin_top = 0; + this.margin_right = 0; + this.margin_bottom = 0; + + this.pageIndex = -1; + + this.searchingArray = []; + this.selectionArray = []; + this.drawingPage = new CDrawingPage(); + + this.Draw = function(context, xDst, yDst, wDst, hDst, contextW, contextH) + { + if (null != this.drawingPage.cachedImage) + { + context.strokeStyle = "#81878F"; + context.strokeRect(xDst, yDst, wDst, hDst); + // ����� ���������� �� �������� ��������� + context.drawImage(this.drawingPage.cachedImage.image, xDst, yDst, wDst, hDst); + } + else + { + context.fillStyle = "#ffffff"; + context.strokeStyle = "#81878F"; + context.strokeRect(xDst, yDst, wDst, hDst); + context.fillRect(xDst, yDst, wDst, hDst); + } + } + + this.DrawSelection = function(overlay, xDst, yDst, wDst, hDst, TextMatrix) + { + var dKoefX = wDst / this.width_mm; + var dKoefY = hDst / this.height_mm; + + var selectionArray = this.selectionArray; + + if (null == TextMatrix || global_MatrixTransformer.IsIdentity(TextMatrix)) + { + for (var i = 0; i < selectionArray.length; i++) + { + var r = selectionArray[i]; + + var _x = ((xDst + dKoefX * r.x) >> 0) - 0.5; + var _y = ((yDst + dKoefY * r.y) >> 0) - 0.5; + + var _w = (dKoefX * r.w + 1) >> 0; + var _h = (dKoefY * r.h + 1) >> 0; + + if (_x < overlay.min_x) + overlay.min_x = _x; + if ((_x + _w) > overlay.max_x) + overlay.max_x = _x + _w; + + if (_y < overlay.min_y) + overlay.min_y = _y; + if ((_y + _h) > overlay.max_y) + overlay.max_y = _y + _h; + + overlay.m_oContext.rect(_x,_y,_w,_h); + } + } + else + { + for (var i = 0; i < selectionArray.length; i++) + { + var r = selectionArray[i]; + + var _x1 = TextMatrix.TransformPointX(r.x, r.y); + var _y1 = TextMatrix.TransformPointY(r.x, r.y); + + var _x2 = TextMatrix.TransformPointX(r.x + r.w, r.y); + var _y2 = TextMatrix.TransformPointY(r.x + r.w, r.y); + + var _x3 = TextMatrix.TransformPointX(r.x + r.w, r.y + r.h); + var _y3 = TextMatrix.TransformPointY(r.x + r.w, r.y + r.h); + + var _x4 = TextMatrix.TransformPointX(r.x, r.y + r.h); + var _y4 = TextMatrix.TransformPointY(r.x, r.y + r.h); + + var x1 = xDst + dKoefX * _x1; + var y1 = yDst + dKoefY * _y1; + + var x2 = xDst + dKoefX * _x2; + var y2 = yDst + dKoefY * _y2; + + var x3 = xDst + dKoefX * _x3; + var y3 = yDst + dKoefY * _y3; + + var x4 = xDst + dKoefX * _x4; + var y4 = yDst + dKoefY * _y4; + + overlay.CheckPoint(x1, y1); + overlay.CheckPoint(x2, y2); + overlay.CheckPoint(x3, y3); + overlay.CheckPoint(x4, y4); + + var ctx = overlay.m_oContext; + ctx.moveTo(x1, y1); + ctx.lineTo(x2, y2); + ctx.lineTo(x3, y3); + ctx.lineTo(x4, y4); + ctx.closePath(); + } + } + } + this.DrawSearch = function(overlay, xDst, yDst, wDst, hDst, drDoc) + { + var dKoefX = wDst / this.width_mm; + var dKoefY = hDst / this.height_mm; + + // проверÑем колонтитулы ------------ + var ret = this.drawInHdrFtr(overlay, xDst, yDst, wDst, hDst, dKoefX, dKoefY, drDoc._search_HdrFtr_All); + if (!ret && this.pageIndex != 0) + ret = this.drawInHdrFtr(overlay, xDst, yDst, wDst, hDst, dKoefX, dKoefY, drDoc._search_HdrFtr_All_no_First); + if (!ret && this.pageIndex == 0) + ret = this.drawInHdrFtr(overlay, xDst, yDst, wDst, hDst, dKoefX, dKoefY, drDoc._search_HdrFtr_First); + if (!ret && (this.pageIndex & 1) == 1) + ret = this.drawInHdrFtr(overlay, xDst, yDst, wDst, hDst, dKoefX, dKoefY, drDoc._search_HdrFtr_Even); + if (!ret && (this.pageIndex & 1) == 0) + ret = this.drawInHdrFtr(overlay, xDst, yDst, wDst, hDst, dKoefX, dKoefY, drDoc._search_HdrFtr_Odd); + if (!ret && (this.pageIndex != 0)) + ret = this.drawInHdrFtr(overlay, xDst, yDst, wDst, hDst, dKoefX, dKoefY, drDoc._search_HdrFtr_Odd_no_First); + // ---------------------------------- + + var ctx = overlay.m_oContext; + for (var i = 0; i < this.searchingArray.length; i++) + { + var place = this.searchingArray[i]; + + if (!place.Transform) + { + if (undefined === place.Ex) + { + var _x = parseInt(xDst + dKoefX * place.X) - 0.5; + var _y = parseInt(yDst + dKoefY * place.Y) - 0.5; + + var _w = parseInt(dKoefX * place.W) + 1; + var _h = parseInt(dKoefY * place.H) + 1; + + if (_x < overlay.min_x) + overlay.min_x = _x; + if ((_x + _w) > overlay.max_x) + overlay.max_x = _x + _w; + + if (_y < overlay.min_y) + overlay.min_y = _y; + if ((_y + _h) > overlay.max_y) + overlay.max_y = _y + _h; + + ctx.rect(_x,_y,_w,_h); + } + else + { + var _x1 = parseInt(xDst + dKoefX * place.X); + var _y1 = parseInt(yDst + dKoefY * place.Y); + + var x2 = place.X + place.W * place.Ex; + var y2 = place.Y + place.W * place.Ey; + var _x2 = parseInt(xDst + dKoefX * x2); + var _y2 = parseInt(yDst + dKoefY * y2); + + var x3 = x2 - place.H * place.Ey; + var y3 = y2 + place.H * place.Ex; + var _x3 = parseInt(xDst + dKoefX * x3); + var _y3 = parseInt(yDst + dKoefY * y3); + + var x4 = place.X - place.H * place.Ey; + var y4 = place.Y + place.H * place.Ex; + var _x4 = parseInt(xDst + dKoefX * x4); + var _y4 = parseInt(yDst + dKoefY * y4); + + overlay.CheckPoint(_x1, _y1); + overlay.CheckPoint(_x2, _y2); + overlay.CheckPoint(_x3, _y3); + overlay.CheckPoint(_x4, _y4); + + ctx.moveTo(_x1, _y1); + ctx.lineTo(_x2, _y2); + ctx.lineTo(_x3, _y3); + ctx.lineTo(_x4, _y4); + ctx.lineTo(_x1, _y1); + } + } + else + { + var _tr = place.Transform; + if (undefined === place.Ex) + { + var _x1 = xDst + dKoefX * _tr.TransformPointX(place.X, place.Y); + var _y1 = yDst + dKoefY * _tr.TransformPointY(place.X, place.Y); + + var _x2 = xDst + dKoefX * _tr.TransformPointX(place.X + place.W, place.Y); + var _y2 = yDst + dKoefY * _tr.TransformPointY(place.X + place.W, place.Y); + + var _x3 = xDst + dKoefX * _tr.TransformPointX(place.X + place.W, place.Y + place.H); + var _y3 = yDst + dKoefY * _tr.TransformPointY(place.X + place.W, place.Y + place.H); + + var _x4 = xDst + dKoefX * _tr.TransformPointX(place.X, place.Y + place.H); + var _y4 = yDst + dKoefY * _tr.TransformPointY(place.X, place.Y + place.H); + + overlay.CheckPoint(_x1, _y1); + overlay.CheckPoint(_x2, _y2); + overlay.CheckPoint(_x3, _y3); + overlay.CheckPoint(_x4, _y4); + + ctx.moveTo(_x1, _y1); + ctx.lineTo(_x2, _y2); + ctx.lineTo(_x3, _y3); + ctx.lineTo(_x4, _y4); + ctx.lineTo(_x1, _y1); + } + else + { + var x2 = place.X + place.W * place.Ex; + var y2 = place.Y + place.W * place.Ey; + + var x3 = x2 - place.H * place.Ey; + var y3 = y2 + place.H * place.Ex; + + var x4 = place.X - place.H * place.Ey; + var y4 = place.Y + place.H * place.Ex; + + var _x1 = xDst + dKoefX * _tr.TransformPointX(place.X, place.Y); + var _y1 = yDst + dKoefY * _tr.TransformPointY(place.X, place.Y); + + var _x2 = xDst + dKoefX * _tr.TransformPointX(x2, y2); + var _y2 = yDst + dKoefY * _tr.TransformPointY(x2, y2); + + var _x3 = xDst + dKoefX * _tr.TransformPointX(x3, y3); + var _y3 = yDst + dKoefY * _tr.TransformPointY(x3, y3); + + var _x4 = xDst + dKoefX * _tr.TransformPointX(x4, y4); + var _y4 = yDst + dKoefY * _tr.TransformPointY(x4, y4); + + overlay.CheckPoint(_x1, _y1); + overlay.CheckPoint(_x2, _y2); + overlay.CheckPoint(_x3, _y3); + overlay.CheckPoint(_x4, _y4); + + ctx.moveTo(_x1, _y1); + ctx.lineTo(_x2, _y2); + ctx.lineTo(_x3, _y3); + ctx.lineTo(_x4, _y4); + ctx.lineTo(_x1, _y1); + } + } + } + } + + this.drawInHdrFtr = function(overlay, xDst, yDst, wDst, hDst, dKoefX, dKoefY, arr) + { + var _c = arr.length; + if (0 == _c) + return false; + + var ctx = overlay.m_oContext; + for (var i = 0; i < _c; i++) + { + var place = arr[i]; + + if (!place.Transform) + { + if (undefined === place.Ex) + { + var _x = parseInt(xDst + dKoefX * place.X) - 0.5; + var _y = parseInt(yDst + dKoefY * place.Y) - 0.5; + + var _w = parseInt(dKoefX * place.W) + 1; + var _h = parseInt(dKoefY * place.H) + 1; + + if (_x < overlay.min_x) + overlay.min_x = _x; + if ((_x + _w) > overlay.max_x) + overlay.max_x = _x + _w; + + if (_y < overlay.min_y) + overlay.min_y = _y; + if ((_y + _h) > overlay.max_y) + overlay.max_y = _y + _h; + + ctx.rect(_x,_y,_w,_h); + } + else + { + var _x1 = parseInt(xDst + dKoefX * place.X); + var _y1 = parseInt(yDst + dKoefY * place.Y); + + var x2 = place.X + place.W * place.Ex; + var y2 = place.Y + place.W * place.Ey; + var _x2 = parseInt(xDst + dKoefX * x2); + var _y2 = parseInt(yDst + dKoefY * y2); + + var x3 = x2 - place.H * place.Ey; + var y3 = y2 + place.H * place.Ex; + var _x3 = parseInt(xDst + dKoefX * x3); + var _y3 = parseInt(yDst + dKoefY * y3); + + var x4 = place.X - place.H * place.Ey; + var y4 = place.Y + place.H * place.Ex; + var _x4 = parseInt(xDst + dKoefX * x4); + var _y4 = parseInt(yDst + dKoefY * y4); + + overlay.CheckPoint(_x1, _y1); + overlay.CheckPoint(_x2, _y2); + overlay.CheckPoint(_x3, _y3); + overlay.CheckPoint(_x4, _y4); + + ctx.moveTo(_x1, _y1); + ctx.lineTo(_x2, _y2); + ctx.lineTo(_x3, _y3); + ctx.lineTo(_x4, _y4); + ctx.lineTo(_x1, _y1); + } + } + else + { + var _tr = place.Transform; + if (undefined === place.Ex) + { + var _x1 = xDst + dKoefX * _tr.TransformPointX(place.X, place.Y); + var _y1 = yDst + dKoefY * _tr.TransformPointY(place.X, place.Y); + + var _x2 = xDst + dKoefX * _tr.TransformPointX(place.X + place.W, place.Y); + var _y2 = yDst + dKoefY * _tr.TransformPointY(place.X + place.W, place.Y); + + var _x3 = xDst + dKoefX * _tr.TransformPointX(place.X + place.W, place.Y + place.H); + var _y3 = yDst + dKoefY * _tr.TransformPointY(place.X + place.W, place.Y + place.H); + + var _x4 = xDst + dKoefX * _tr.TransformPointX(place.X, place.Y + place.H); + var _y4 = yDst + dKoefY * _tr.TransformPointY(place.X, place.Y + place.H); + + overlay.CheckPoint(_x1, _y1); + overlay.CheckPoint(_x2, _y2); + overlay.CheckPoint(_x3, _y3); + overlay.CheckPoint(_x4, _y4); + + ctx.moveTo(_x1, _y1); + ctx.lineTo(_x2, _y2); + ctx.lineTo(_x3, _y3); + ctx.lineTo(_x4, _y4); + ctx.lineTo(_x1, _y1); + } + else + { + var x2 = place.X + place.W * place.Ex; + var y2 = place.Y + place.W * place.Ey; + + var x3 = x2 - place.H * place.Ey; + var y3 = y2 + place.H * place.Ex; + + var x4 = place.X - place.H * place.Ey; + var y4 = place.Y + place.H * place.Ex; + + var _x1 = xDst + dKoefX * _tr.TransformPointX(place.X, place.Y); + var _y1 = yDst + dKoefY * _tr.TransformPointY(place.X, place.Y); + + var _x2 = xDst + dKoefX * _tr.TransformPointX(x2, y2); + var _y2 = yDst + dKoefY * _tr.TransformPointY(x2, y2); + + var _x3 = xDst + dKoefX * _tr.TransformPointX(x3, y3); + var _y3 = yDst + dKoefY * _tr.TransformPointY(x3, y3); + + var _x4 = xDst + dKoefX * _tr.TransformPointX(x4, y4); + var _y4 = yDst + dKoefY * _tr.TransformPointY(x4, y4); + + overlay.CheckPoint(_x1, _y1); + overlay.CheckPoint(_x2, _y2); + overlay.CheckPoint(_x3, _y3); + overlay.CheckPoint(_x4, _y4); + + ctx.moveTo(_x1, _y1); + ctx.lineTo(_x2, _y2); + ctx.lineTo(_x3, _y3); + ctx.lineTo(_x4, _y4); + ctx.lineTo(_x1, _y1); + } + } + } + return true; + } + + this.DrawSearchCur1 = function(overlay, xDst, yDst, wDst, hDst, place) + { + var dKoefX = wDst / this.width_mm; + var dKoefY = hDst / this.height_mm; + + var ctx = overlay.m_oContext; + + if (!place.Transform) + { + if (undefined === place.Ex) + { + var _x = parseInt(xDst + dKoefX * place.X) - 0.5; + var _y = parseInt(yDst + dKoefY * place.Y) - 0.5; + + var _w = parseInt(dKoefX * place.W) + 1; + var _h = parseInt(dKoefY * place.H) + 1; + + if (_x < overlay.min_x) + overlay.min_x = _x; + if ((_x + _w) > overlay.max_x) + overlay.max_x = _x + _w; + + if (_y < overlay.min_y) + overlay.min_y = _y; + if ((_y + _h) > overlay.max_y) + overlay.max_y = _y + _h; + + ctx.rect(_x,_y,_w,_h); + } + else + { + var _x1 = parseInt(xDst + dKoefX * place.X); + var _y1 = parseInt(yDst + dKoefY * place.Y); + + var x2 = place.X + place.W * place.Ex; + var y2 = place.Y + place.W * place.Ey; + var _x2 = parseInt(xDst + dKoefX * x2); + var _y2 = parseInt(yDst + dKoefY * y2); + + var x3 = x2 - place.H * place.Ey; + var y3 = y2 + place.H * place.Ex; + var _x3 = parseInt(xDst + dKoefX * x3); + var _y3 = parseInt(yDst + dKoefY * y3); + + var x4 = place.X - place.H * place.Ey; + var y4 = place.Y + place.H * place.Ex; + var _x4 = parseInt(xDst + dKoefX * x4); + var _y4 = parseInt(yDst + dKoefY * y4); + + overlay.CheckPoint(_x1, _y1); + overlay.CheckPoint(_x2, _y2); + overlay.CheckPoint(_x3, _y3); + overlay.CheckPoint(_x4, _y4); + + ctx.moveTo(_x1, _y1); + ctx.lineTo(_x2, _y2); + ctx.lineTo(_x3, _y3); + ctx.lineTo(_x4, _y4); + ctx.lineTo(_x1, _y1); + } + } + else + { + var _tr = place.Transform; + if (undefined === place.Ex) + { + var _x1 = xDst + dKoefX * _tr.TransformPointX(place.X, place.Y); + var _y1 = yDst + dKoefY * _tr.TransformPointY(place.X, place.Y); + + var _x2 = xDst + dKoefX * _tr.TransformPointX(place.X + place.W, place.Y); + var _y2 = yDst + dKoefY * _tr.TransformPointY(place.X + place.W, place.Y); + + var _x3 = xDst + dKoefX * _tr.TransformPointX(place.X + place.W, place.Y + place.H); + var _y3 = yDst + dKoefY * _tr.TransformPointY(place.X + place.W, place.Y + place.H); + + var _x4 = xDst + dKoefX * _tr.TransformPointX(place.X, place.Y + place.H); + var _y4 = yDst + dKoefY * _tr.TransformPointY(place.X, place.Y + place.H); + + overlay.CheckPoint(_x1, _y1); + overlay.CheckPoint(_x2, _y2); + overlay.CheckPoint(_x3, _y3); + overlay.CheckPoint(_x4, _y4); + + ctx.moveTo(_x1, _y1); + ctx.lineTo(_x2, _y2); + ctx.lineTo(_x3, _y3); + ctx.lineTo(_x4, _y4); + ctx.lineTo(_x1, _y1); + } + else + { + var x2 = place.X + place.W * place.Ex; + var y2 = place.Y + place.W * place.Ey; + + var x3 = x2 - place.H * place.Ey; + var y3 = y2 + place.H * place.Ex; + + var x4 = place.X - place.H * place.Ey; + var y4 = place.Y + place.H * place.Ex; + + var _x1 = xDst + dKoefX * _tr.TransformPointX(place.X, place.Y); + var _y1 = yDst + dKoefY * _tr.TransformPointY(place.X, place.Y); + + var _x2 = xDst + dKoefX * _tr.TransformPointX(x2, y2); + var _y2 = yDst + dKoefY * _tr.TransformPointY(x2, y2); + + var _x3 = xDst + dKoefX * _tr.TransformPointX(x3, y3); + var _y3 = yDst + dKoefY * _tr.TransformPointY(x3, y3); + + var _x4 = xDst + dKoefX * _tr.TransformPointX(x4, y4); + var _y4 = yDst + dKoefY * _tr.TransformPointY(x4, y4); + + overlay.CheckPoint(_x1, _y1); + overlay.CheckPoint(_x2, _y2); + overlay.CheckPoint(_x3, _y3); + overlay.CheckPoint(_x4, _y4); + + ctx.moveTo(_x1, _y1); + ctx.lineTo(_x2, _y2); + ctx.lineTo(_x3, _y3); + ctx.lineTo(_x4, _y4); + ctx.lineTo(_x1, _y1); + } + } + } + + this.DrawSearchCur = function(overlay, xDst, yDst, wDst, hDst, navi) + { + var dKoefX = wDst / this.width_mm; + var dKoefY = hDst / this.height_mm; + + var places = navi.Place; + var len = places.length; + + var ctx = overlay.m_oContext; + + ctx.globalAlpha = 0.2; + ctx.fillStyle = "rgba(51,102,204,255)"; + + for (var i = 0; i < len; i++) + { + var place = places[i]; + if (undefined === place.Ex) + { + var _x = parseInt(xDst + dKoefX * place.X) - 0.5; + var _y = parseInt(yDst + dKoefY * place.Y) - 0.5; + + var _w = parseInt(dKoefX * place.W) + 1; + var _h = parseInt(dKoefY * place.H) + 1; + + if (_x < overlay.min_x) + overlay.min_x = _x; + if ((_x + _w) > overlay.max_x) + overlay.max_x = _x + _w; + + if (_y < overlay.min_y) + overlay.min_y = _y; + if ((_y + _h) > overlay.max_y) + overlay.max_y = _y + _h; + + ctx.rect(_x,_y,_w,_h); + } + else + { + var _x1 = parseInt(xDst + dKoefX * place.X); + var _y1 = parseInt(yDst + dKoefY * place.Y); + + var x2 = place.X + place.W * place.Ex; + var y2 = place.Y + place.W * place.Ey; + var _x2 = parseInt(xDst + dKoefX * x2); + var _y2 = parseInt(yDst + dKoefY * y2); + + var x3 = x2 - place.H * place.Ey; + var y3 = y2 + place.H * place.Ex; + var _x3 = parseInt(xDst + dKoefX * x3); + var _y3 = parseInt(yDst + dKoefY * y3); + + var x4 = place.X - place.H * place.Ey; + var y4 = place.Y + place.H * place.Ex; + var _x4 = parseInt(xDst + dKoefX * x4); + var _y4 = parseInt(yDst + dKoefY * y4); + + overlay.CheckPoint(_x1, _y1); + overlay.CheckPoint(_x2, _y2); + overlay.CheckPoint(_x3, _y3); + overlay.CheckPoint(_x4, _y4); + + ctx.moveTo(_x1, _y1); + ctx.lineTo(_x2, _y2); + ctx.lineTo(_x3, _y3); + ctx.lineTo(_x4, _y4); + ctx.lineTo(_x1, _y1); + } + } + + ctx.fill(); + ctx.globalAlpha = 1.0; + } + + this.DrawTableOutline = function(overlay, xDst, yDst, wDst, hDst, table_outline_dr) + { + var transform = table_outline_dr.TableMatrix; + if (null == transform || transform.IsIdentity2()) + { + var dKoefX = wDst / this.width_mm; + var dKoefY = hDst / this.height_mm; + + var _offX = (null == transform) ? 0 : transform.tx; + var _offY = (null == transform) ? 0 : transform.ty; + + var _x = 0; + var _y = 0; + switch (table_outline_dr.TrackTablePos) + { + case 1: + { + _x = parseInt(xDst + dKoefX * (table_outline_dr.TableOutline.X + table_outline_dr.TableOutline.W + _offX)); + _y = parseInt(yDst + dKoefY * (table_outline_dr.TableOutline.Y + _offY)) - 13; + break; + } + case 2: + { + _x = parseInt(xDst + dKoefX * (table_outline_dr.TableOutline.X + table_outline_dr.TableOutline.W + _offX)); + _y = parseInt(yDst + dKoefY * (table_outline_dr.TableOutline.Y + table_outline_dr.TableOutline.H + _offY)); + break; + } + case 3: + { + _x = parseInt(xDst + dKoefX * (table_outline_dr.TableOutline.X + _offX)) - 13; + _y = parseInt(yDst + dKoefY * (table_outline_dr.TableOutline.Y + table_outline_dr.TableOutline.H + _offY)); + break; + } + case 0: + default: + { + _x = parseInt(xDst + dKoefX * (table_outline_dr.TableOutline.X + _offX)) - 13; + _y = parseInt(yDst + dKoefY * (table_outline_dr.TableOutline.Y + _offY)) - 13; + break; + } + } + + var _w = 13; + var _h = 13; + + if (_x < overlay.min_x) + overlay.min_x = _x; + if ((_x + _w) > overlay.max_x) + overlay.max_x = _x + _w; + + if (_y < overlay.min_y) + overlay.min_y = _y; + if ((_y + _h) > overlay.max_y) + overlay.max_y = _y + _h; + + overlay.m_oContext.drawImage(table_outline_dr.image, _x, _y); + } + else + { + var ctx = overlay.m_oContext; + + + var _ft = new CMatrix(); + _ft.sx = transform.sx; + _ft.shx = transform.shx; + _ft.shy = transform.shy; + _ft.sy = transform.sy; + _ft.tx = transform.tx; + _ft.ty = transform.ty; + + var coords = new CMatrix(); + coords.sx = wDst / this.width_mm; + coords.sy = hDst / this.height_mm; + coords.tx = xDst; + coords.ty = yDst; + + global_MatrixTransformer.MultiplyAppend(_ft, coords); + + ctx.transform(_ft.sx,_ft.shy,_ft.shx,_ft.sy,_ft.tx,_ft.ty); + + var _x = 0; + var _y = 0; + var _w = 13 / coords.sx; + var _h = 13 / coords.sy; + switch (table_outline_dr.TrackTablePos) + { + case 1: + { + _x = (table_outline_dr.TableOutline.X + table_outline_dr.TableOutline.W); + _y = (table_outline_dr.TableOutline.Y - _h); + break; + } + case 2: + { + _x = (table_outline_dr.TableOutline.X + table_outline_dr.TableOutline.W); + _y = (table_outline_dr.TableOutline.Y + table_outline_dr.TableOutline.H); + break; + } + case 3: + { + _x = (table_outline_dr.TableOutline.X - _w); + _y = (table_outline_dr.TableOutline.Y + table_outline_dr.TableOutline.H); + break; + } + case 0: + default: + { + _x = (table_outline_dr.TableOutline.X - _w); + _y = (table_outline_dr.TableOutline.Y - _h); + break; + } + } + + overlay.CheckPoint(_ft.TransformPointX(_x, _y), _ft.TransformPointY(_x, _y)); + overlay.CheckPoint(_ft.TransformPointX(_x + _w, _y), _ft.TransformPointY(_x + _w, _y)); + overlay.CheckPoint(_ft.TransformPointX(_x + _w, _y + _h), _ft.TransformPointY(_x + _w, _y + _h)); + overlay.CheckPoint(_ft.TransformPointX(_x, _y + _h), _ft.TransformPointY(_x, _y + _h)); + + overlay.m_oContext.drawImage(table_outline_dr.image, _x, _y, _w, _h); + ctx.setTransform(1,0,0,1,0,0); + } + } +} + +function CDrawingDocument(drawingObjects) +{ + this.Native = window["native"]; + this.Api = window.editor; + this.m_oApi = this.Api; + this.CanvasHitContext = CreateHitControl(); + + this.drawingObjects = drawingObjects; + this.IsLockObjectsEnable = false; + + this.cursorMarkerFormat = ""; + if (bIsIE) + { + // Пути указаны отноÑительно html в меню, не надо их иÑправлÑÑ‚ÑŒ + // и коммитить на пути отноÑительно теÑтового меню + this.cursorMarkerFormat = "url(../../../sdk/Common/Images/marker_format.cur), pointer"; + } + else if (window.opera) + { + this.cursorMarkerFormat = "pointer"; + } + else + { + this.cursorMarkerFormat = "url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAQCAYAAAAbBi9cAAAACXBIWXMAAAsTAAALEwEAmpwYAAAK\ + T2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AU\ + kSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXX\ + Pues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgAB\ + eNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAY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H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i\ + /suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8\ + IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADq\ + YAAAOpgAABdvkl/FRgAAANNJREFUeNq8VEsKhTAMnL5UDyMUPIsbF+4ET+VCXLjobQSh18nbPEs/\ + saKL11VmEoZJSKqYGcnLCABKyKkQa0mkaRpPOOdOXoU55xwHMVTiiI0xmZ3jODIHxpiTFx2BiLDv\ + u8dt24otElHEfVIhrXVUEOCrOtwJoSRUVVVZKC1I8f+F6rou4iu+5IifONJSQdd1j1sThay1Hvd9\ + /07IWothGCL8Zth+Cbdty5bzNzdO9osBsLhtRIRxHLGua5abpgkAsCyLj+d5zo5W+kbURS464u8A\ + mWhBvQBxpekAAAAASUVORK5CYII=') 14 8, pointer"; + } + + this.m_oWordControl = null; + this.m_oLogicDocument = null; + this.m_oDocumentRenderer = null; + + this.m_arrPages = []; + this.m_lPagesCount = 0; + + this.m_lDrawingFirst = -1; + this.m_lDrawingEnd = -1; + this.m_lCurrentPage = -1; + + this.m_oCacheManager = new CCacheManager(); + + this.m_lCountCalculatePages = 0; + + this.m_lTimerTargetId = -1; + this.m_dTargetX = -1; + this.m_dTargetY = -1; + this.m_lTargetPage = -1; + this.m_dTargetSize = 1; + + this.NeedScrollToTarget = true; + this.NeedScrollToTargetFlag = false; + + this.TargetHtmlElement = null; + + this.m_bIsBreakRecalculate = false; + this.m_bIsUpdateDocSize = false; + + this.m_bIsSelection = false; + this.m_bIsSearching = false; + this.m_lCountRect = 0; + + this.CurrentSearchNavi = null; + this.SearchTransform = null; + + this.m_lTimerUpdateTargetID = -1; + this.m_tempX = 0; + this.m_tempY = 0; + this.m_tempPageIndex = 0; + + var oThis = this; + this.m_sLockedCursorType = ""; + this.TableOutlineDr = new CTableOutlineDr(); + + this.m_lCurrentRendererPage = -1; + this.m_oDocRenderer = null; + this.m_bOldShowMarks = false; + + this.UpdateTargetFromPaint = false; + this.UpdateTargetCheck = false; + this.NeedTarget = true; + this.TextMatrix = null; + this.TargetShowFlag = false; + this.TargetShowNeedFlag = false; + +// this.CanvasHit = document.createElement('canvas'); +// this.CanvasHit.width = 10; +// this.CanvasHit.height = 10; +// this.CanvasHitContext = this.CanvasHit.getContext('2d'); + + this.TargetCursorColor = {R: 0, G: 0, B: 0}; + + this.GuiControlColorsMap = null; + this.IsSendStandartColors = false; + + this.GuiCanvasFillTextureParentId = ""; + this.GuiCanvasFillTexture = null; + this.GuiCanvasFillTextureCtx = null; + this.LastDrawingUrl = ""; + + this.GuiCanvasFillTextureParentIdTextArt = ""; + this.GuiCanvasFillTextureTextArt = null; + this.GuiCanvasFillTextureCtxTextArt = null; + this.LastDrawingUrlTextArt = ""; + + + + this.GuiCanvasTextProps = null; + this.GuiCanvasTextPropsId = "gui_textprops_canvas_id"; + this.GuiLastTextProps = null; + + this.TableStylesLastLook = null; + this.LastParagraphMargins = null; + + // параметры Ð´Ð»Ñ SelectShow + this.min_PageAddSelection = 100000; + this.max_PageAddSelection = -1; + this.IsShowSelectAttack = false; + + this.AutoShapesTrack = null; + this.AutoShapesTrackLockPageNum = -1; + + this.Overlay = null; + this.IsTextMatrixUse = false; + + // маÑÑивы ректов Ð´Ð»Ñ Ð¿Ð¾Ð¸Ñка + this._search_HdrFtr_All = []; // ПоиÑк в колонтитуле, который находитÑÑ Ð½Ð° вÑех Ñтраницах + this._search_HdrFtr_All_no_First = []; // ПоиÑк в колонтитуле, который находитÑÑ Ð½Ð° вÑех Ñтраницах, кроме первой + this._search_HdrFtr_First = []; // ПоиÑк в колонтитуле, который находитÑÑ Ñ‚Ð¾Ð»ÑŒÐºÐ¾ на первой Ñтранице + this._search_HdrFtr_Even = []; // ПоиÑк в колонтитуле, который находитÑÑ Ñ‚Ð¾Ð»ÑŒÐºÐ¾ на нечетных Ñтраницах + this._search_HdrFtr_Odd = []; // ПоиÑк в колонтитуле, который находитÑÑ Ñ‚Ð¾Ð»ÑŒÐºÐ¾ на четных Ñтраницах, Ð²ÐºÐ»ÑŽÑ‡Ð°Ñ Ð¿ÐµÑ€Ð²ÑƒÑŽ + this._search_HdrFtr_Odd_no_First = []; // ПоиÑк в колонтитуле, который находитÑÑ Ñ‚Ð¾Ð»ÑŒÐºÐ¾ на нечетных Ñтраницах, кроме первой + + this.Start_CollaborationEditing = function() + { + this.IsLockObjectsEnable = true; + this.Native["DD_Start_CollaborationEditing"](); + } + this.SetCursorType = function(sType, Data) + { + if ("" == this.m_sLockedCursorType) + this.Native["DD_SetCursorType"](sType, Data); + else + this.Native["DD_SetCursorType"](this.m_sLockedCursorType, Data); + +// if ("" == this.m_sLockedCursorType) +// { +// if (this.m_oWordControl.m_oApi.isPaintFormat && "default" == sType) +// this.m_oWordControl.m_oMainContent.HtmlElement.style.cursor = kCurFormatPainterWord; +// else if (this.m_oWordControl.m_oApi.isMarkerFormat && "default" == sType) +// this.m_oWordControl.m_oMainContent.HtmlElement.style.cursor = this.cursorMarkerFormat; +// else +// this.m_oWordControl.m_oMainContent.HtmlElement.style.cursor = sType; +// } +// else +// this.m_oWordControl.m_oMainContent.HtmlElement.style.cursor = this.m_sLockedCursorType; +// +// if ( "undefined" === typeof(Data) || null === Data ) +// Data = new CMouseMoveData(); +// +// editor.sync_MouseMoveCallback( Data ); + } + this.LockCursorType = function(sType) + { + this.m_sLockedCursorType = sType; + this.Native["DD_LockCursorType"](sType); + } + this.LockCursorTypeCur = function() + { + this.m_sLockedCursorType = this.Native["DD_get_LockCursorType"](); + } + this.UnlockCursorType = function() + { + this.m_sLockedCursorType = ""; + this.Native["DD_UnlockCursorType"](); + } + + this.OnStartRecalculate = function(pageCount) + { + this.Native["DD_OnStartRecalculate"](pageCount); + } + + this.OnRepaintPage = function(index) + { + this.Native["DD_OnRepaintPage"](index); + } + + this.OnRecalculatePage = function(index, pageObject) + { + this.TableOutlineDr.TableOutline = null; + + this.Native["DD_OnRecalculatePage"](index, pageObject.Width, pageObject.Height, + pageObject.Margins.Left, pageObject.Margins.Top, pageObject.Margins.Right, pageObject.Margins.Bottom); + } + + this.OnEndRecalculate = function(isFull, isBreak) + { + this.Native["DD_OnEndRecalculate"](isFull, isBreak); + } + + this.ChangePageAttack = function(pageIndex) + { +// if (pageIndex < this.m_lDrawingFirst || pageIndex > this.m_lDrawingEnd) +// return; +// +// this.StopRenderingPage(pageIndex); +// this.m_oWordControl.OnScroll(); + } + + this.StartRenderingPage = function(pageIndex) + { +// if (true === this.IsFreezePage(pageIndex)) +// { +// return; +// } +// +// var page = this.m_arrPages[pageIndex]; +// +// var w = parseInt(this.m_oWordControl.m_nZoomValue * g_dKoef_mm_to_pix * page.width_mm / 100); +// var h = parseInt(this.m_oWordControl.m_nZoomValue * g_dKoef_mm_to_pix * page.height_mm / 100); +// +// if (this.m_oWordControl.bIsRetinaSupport) +// { +// w *= 2; +// h *= 2; +// } +// +// // заглушка под мобильную верÑию (iPad не риÑует большие картинки (наверное Ñтраховка по памÑти)) +// if (g_bIsMobile) +// { +// var _mobile_max = 2000; +// if (w > _mobile_max || h > _mobile_max) +// { +// if (w > h) +// { +// h = parseInt(h * _mobile_max / w); +// w = _mobile_max; +// } +// else +// { +// w = parseInt(w * _mobile_max / h); +// h = _mobile_max; +// } +// } +// } +// +// page.drawingPage.cachedImage = this.m_oCacheManager.Lock(w, h); +// +// //var StartTime = new Date().getTime(); +// +// // ������ ����� ������� +// var g = new CGraphics(); +// g.init(page.drawingPage.cachedImage.image.ctx, w, h, page.width_mm, page.height_mm); +// g.m_oFontManager = g_fontManager; +// +// g.transform(1,0,0,1,0,0); +// +// if (null == this.m_oDocumentRenderer) +// this.m_oLogicDocument.DrawPage(pageIndex, g); +// else +// this.m_oDocumentRenderer.drawPage(pageIndex, g); +// +// //var EndTime = new Date().getTime(); +// +// //alert("" + ((EndTime - StartTime) / 1000)); + } + + this.IsFreezePage = function(pageIndex) + { + return this.Native["DD_IsFreezePage"](pageIndex); + } + + this.RenderDocument = function(Renderer) + { + for (var i = 0; i < this.m_lPagesCount; i++) + { + var page = this.m_arrPages[i]; + Renderer.BeginPage(page.width_mm, page.height_mm); + this.m_oLogicDocument.DrawPage(i, Renderer); + Renderer.EndPage(); + } + } + + this.ToRenderer = function() + { + var Renderer = new CDocumentRenderer(); + Renderer.VectorMemoryForPrint = new CMemory(); + var old_marks = this.m_oWordControl.m_oApi.ShowParaMarks; + this.m_oWordControl.m_oApi.ShowParaMarks = false; + this.RenderDocument(Renderer); + this.m_oWordControl.m_oApi.ShowParaMarks = old_marks; + var ret = Renderer.Memory.GetBase64Memory(); + //console.log(ret); + return ret; + } + + this.ToRenderer2 = function() + { + var Renderer = new CDocumentRenderer(); + + var old_marks = this.m_oWordControl.m_oApi.ShowParaMarks; + this.m_oWordControl.m_oApi.ShowParaMarks = false; + + var ret = ""; + for (var i = 0; i < this.m_lPagesCount; i++) + { + var page = this.m_arrPages[i]; + Renderer.BeginPage(page.width_mm, page.height_mm); + this.m_oLogicDocument.DrawPage(i, Renderer); + Renderer.EndPage(); + + ret += Renderer.Memory.GetBase64Memory(); + Renderer.Memory.Seek(0); + } + + this.m_oWordControl.m_oApi.ShowParaMarks = old_marks; + //console.log(ret); + return ret; + } + + this.isComleteRenderer = function() + { + var pagescount = Math.min(this.m_lPagesCount, this.m_lCountCalculatePages); + if (this.m_lCurrentRendererPage >= pagescount) + { + this.m_lCurrentRendererPage = -1; + this.m_oDocRenderer = null; + this.m_oWordControl.m_oApi.ShowParaMarks = this.m_bOldShowMarks; + return true; + } + return false; + } + this.isComleteRenderer2 = function() + { + var pagescount = Math.min(this.m_lPagesCount, this.m_lCountCalculatePages); + var start = Math.max(this.m_lCurrentRendererPage, 0); + var end = Math.min(start + 50, pagescount - 1); + + if ((end + 1) >= pagescount) + return true; + + return false; + } + this.ToRendererPart = function() + { + var pagescount = Math.min(this.m_lPagesCount, this.m_lCountCalculatePages); + + if (-1 == this.m_lCurrentRendererPage) + { + this.m_oDocRenderer = new CDocumentRenderer(); + this.m_oDocRenderer.VectorMemoryForPrint = new CMemory(); + this.m_lCurrentRendererPage = 0; + this.m_bOldShowMarks = this.m_oWordControl.m_oApi.ShowParaMarks; + this.m_oWordControl.m_oApi.ShowParaMarks = false; + } + + var start = this.m_lCurrentRendererPage; + var end = Math.min(this.m_lCurrentRendererPage + 50, pagescount - 1); + + var renderer = this.m_oDocRenderer; + renderer.Memory.Seek(0); + renderer.VectorMemoryForPrint.ClearNoAttack(); + + for (var i = start; i <= end; i++) + { + var page = this.m_arrPages[i]; + renderer.BeginPage(page.width_mm, page.height_mm); + this.m_oLogicDocument.DrawPage(i, renderer); + renderer.EndPage(); + + editor.async_SaveToPdf_Progress(parseInt((i + 1) * 100 / pagescount)); + } + + this.m_lCurrentRendererPage = end + 1; + + if (this.m_lCurrentRendererPage >= pagescount) + { + this.m_lCurrentRendererPage = -1; + this.m_oDocRenderer = null; + this.m_oWordControl.m_oApi.ShowParaMarks = this.m_bOldShowMarks; + } + + return renderer.Memory.GetBase64Memory(); + } + + this.StopRenderingPage = function(pageIndex) + { + if (null != this.m_oDocumentRenderer) + this.m_oDocumentRenderer.stopRenderingPage(pageIndex); + if (null != this.m_arrPages[pageIndex].drawingPage.cachedImage) + { + this.m_oCacheManager.UnLock(this.m_arrPages[pageIndex].drawingPage.cachedImage); + this.m_arrPages[pageIndex].drawingPage.cachedImage = null; + } + } + + this.ClearCachePages = function() + { + this.Native["DD_ClearCachePages"](); + } + + this.CheckRasterImageOnScreen = function(src) + { + if (null == this.m_oWordControl.m_oLogicDocument) + return; + + if (this.m_lDrawingFirst == -1 || this.m_lDrawingEnd == -1) + return; + + var bIsRaster = false; + var _checker = this.m_oWordControl.m_oLogicDocument.DrawingObjects; + for (var i = this.m_lDrawingFirst; i <= this.m_lDrawingEnd; i++) + { + var _imgs = _checker.getAllRasterImagesOnPage(i); + + var _len = _imgs.length; + for (var j = 0; j < _len; j++) + { + if (getFullImageSrc2(_imgs[j]) == src) + { + this.StopRenderingPage(i); + bIsRaster = true; + break; + } + } + } + + if (bIsRaster) + this.m_oWordControl.OnScroll(); + } + + this.FirePaint = function() + { + this.Native["DD_FirePaint"](); + } + + this.ConvertCoordsFromCursor = function(x, y, bIsRul) + { + var _x = x; + var _y = y; + + var dKoef = (100 * g_dKoef_pix_to_mm / this.m_oWordControl.m_nZoomValue); + + if (undefined == bIsRul) + { + var _xOffset = this.m_oWordControl.X; + var _yOffset = this.m_oWordControl.Y; + + /* + if (true == this.m_oWordControl.m_bIsRuler) + { + _xOffset += (5 * g_dKoef_mm_to_pix); + _yOffset += (7 * g_dKoef_mm_to_pix); + } + */ + + _x = x - _xOffset; + _y = y - _yOffset; + } + + for (var i = this.m_lDrawingFirst; i <= this.m_lDrawingEnd; i++) + { + var rect = this.m_arrPages[i].drawingPage; + + if ((rect.left <= _x) && (_x <= rect.right) && (rect.top <= _y) && (_y <= rect.bottom)) + { + var x_mm = (_x - rect.left) * dKoef; + var y_mm = (_y - rect.top) * dKoef; + + return { X : x_mm, Y : y_mm, Page: rect.pageIndex, DrawPage: i }; + } + } + + return { X : 0, Y : 0, Page: -1, DrawPage: -1 }; + } + + this.ConvertCoordsFromCursorPage = function(x, y, page, bIsRul) + { + var _x = x; + var _y = y; + + var dKoef = (100 * g_dKoef_pix_to_mm / this.m_oWordControl.m_nZoomValue); + + if (undefined == bIsRul) + { + var _xOffset = this.m_oWordControl.X; + var _yOffset = this.m_oWordControl.Y; + + /* + if (true == this.m_oWordControl.m_bIsRuler) + { + _xOffset += (5 * g_dKoef_mm_to_pix); + _yOffset += (7 * g_dKoef_mm_to_pix); + } + */ + + _x = x - _xOffset; + _y = y - _yOffset; + } + + if (page < 0 || page >= this.m_lPagesCount) + return { X : 0, Y : 0, Page: -1, DrawPage: -1 }; + + var rect = this.m_arrPages[page].drawingPage; + var x_mm = (_x - rect.left) * dKoef; + var y_mm = (_y - rect.top) * dKoef; + + return { X : x_mm, Y : y_mm, Page: rect.pageIndex, DrawPage: i }; + } + + this.ConvertCoordsToAnotherPage = function(x, y, pageCoord, pageNeed) + { + if (pageCoord < 0 || pageCoord >= this.m_lPagesCount || pageNeed < 0 || pageNeed >= this.m_lPagesCount) + return { X : 0, Y : 0, Error: true }; + + var dKoef1 = this.m_oWordControl.m_nZoomValue * g_dKoef_mm_to_pix / 100; + var dKoef2 = 100 * g_dKoef_pix_to_mm / this.m_oWordControl.m_nZoomValue; + + var page1 = this.m_arrPages[pageCoord].drawingPage; + var page2 = this.m_arrPages[pageNeed].drawingPage; + + var xCursor = page1.left + x * dKoef1; + var yCursor = page1.top + y * dKoef1; + + var _x = (xCursor - page2.left) * dKoef2; + var _y = (yCursor - page2.top) * dKoef2; + + return { X : _x, Y : _y, Error: false }; + } + + this.ConvertCoordsFromCursor2 = function(x, y, bIsRul, bIsNoNormalize, _zoomVal) + { + var _x = x; + var _y = y; + + var dKoef = (100 * g_dKoef_pix_to_mm / this.m_oWordControl.m_nZoomValue); + if (undefined !== _zoomVal) + dKoef = (100 * g_dKoef_pix_to_mm / _zoomVal); + + if (undefined == bIsRul) + { + var _xOffset = this.m_oWordControl.X; + var _yOffset = this.m_oWordControl.Y; + + if (true == this.m_oWordControl.m_bIsRuler) + { + _xOffset += (5 * g_dKoef_mm_to_pix); + _yOffset += (7 * g_dKoef_mm_to_pix); + } + + _x = x - _xOffset; + _y = y - _yOffset; + } + + if (-1 == this.m_lDrawingFirst || -1 == this.m_lDrawingEnd) + return { X : 0, Y : 0, Page: -1, DrawPage: -1 }; + + for (var i = this.m_lDrawingFirst; i <= this.m_lDrawingEnd; i++) + { + var rect = this.m_arrPages[i].drawingPage; + + if ((rect.left <= _x) && (_x <= rect.right) && (rect.top <= _y) && (_y <= rect.bottom)) + { + var x_mm = (_x - rect.left) * dKoef; + var y_mm = (_y - rect.top) * dKoef; + + if (x_mm > (this.m_arrPages[i].width_mm + 10)) + x_mm = this.m_arrPages[i].width_mm + 10; + if (x_mm < -10) + x_mm = -10; + + return { X : x_mm, Y : y_mm, Page: rect.pageIndex, DrawPage: i }; + } + } + + // в Ñтраницу не попали. Ð²Ñ‚Ð¾Ñ€Ð°Ñ Ð¿Ð¾Ð¿Ñ‹Ñ‚ÐºÐ° - Ñто попробовать найти Ñтраницу по вертикали + var _start = Math.max(this.m_lDrawingFirst - 1, 0); + var _end = Math.min(this.m_lDrawingEnd + 1, this.m_lPagesCount - 1); + for (var i = _start; i <= _end; i++) + { + var rect = this.m_arrPages[i].drawingPage; + + var bIsCurrent = false; + if (i == this.m_lDrawingFirst && rect.top > _y) + { + bIsCurrent = true; + } + else if ((rect.top <= _y) && (_y <= rect.bottom)) + { + bIsCurrent = true; + } + else if (i != this.m_lPagesCount - 1) + { + if (_y > rect.bottom && _y < this.m_arrPages[i+1].drawingPage.top) + bIsCurrent = true; + } + else if (_y < rect.top) + { + // либо вышли раньше, либо Ñто ÑÐ°Ð¼Ð°Ñ Ð¿ÐµÑ€Ð²Ð°Ñ Ð²Ð¸Ð´Ð¸Ð¼Ð°Ñ Ñтраница + bIsCurrent = true; + } + else if (i == this.m_lDrawingEnd) + { + if (_y > rect.bottom) + bIsCurrent = true; + } + + if (bIsCurrent) + { + var x_mm = (_x - rect.left) * dKoef; + var y_mm = (_y - rect.top) * dKoef; + + if (true === bIsNoNormalize) + { + if (x_mm > (this.m_arrPages[i].width_mm + 10)) + x_mm = this.m_arrPages[i].width_mm + 10; + if (x_mm < -10) + x_mm = -10; + } + + return { X : x_mm, Y : y_mm, Page: rect.pageIndex, DrawPage: i }; + } + } + + return { X : 0, Y : 0, Page: -1, DrawPage: -1 }; + } + + this.ConvetToPageCoords = function(x,y,pageIndex) + { + if (pageIndex < 0 || pageIndex >= this.m_lPagesCount) + { + return { X : 0, Y : 0, Page : pageIndex, Error: true }; + } + var dKoef = (100 * g_dKoef_pix_to_mm / this.m_oWordControl.m_nZoomValue); + var rect = this.m_arrPages[pageIndex].drawingPage; + + var _x = (x - rect.left) * dKoef; + var _y = (y - rect.top) * dKoef; + + return { X : _x, Y : _y, Page : pageIndex, Error: false }; + } + + this.IsCursorInTableCur = function(x, y, page) + { + var _table = this.TableOutlineDr.TableOutline; + if (_table == null) + return false; + + if (page != _table.PageNum) + return false; + + var _dist = this.TableOutlineDr.image.width * g_dKoef_pix_to_mm; + _dist *= (100 / this.m_oWordControl.m_nZoomValue); + + var _x = _table.X; + var _y = _table.Y; + var _r = _x + _table.W; + var _b = _y + _table.H; + + if ((x > (_x - _dist)) && (x < _r) && (y > (_y - _dist)) && (y < _b)) + { + if ((x < _x) || (y < _y)) + { + this.TableOutlineDr.Counter = 0; + this.TableOutlineDr.bIsNoTable = false; + return true; + } + } + return false; + } + + this.ConvertCoordsToCursorWR = function(x, y, pageIndex, transform) + { + return {X: 0, Y: 0, Error: false}; + +// var dKoef = (this.m_oWordControl.m_nZoomValue * g_dKoef_mm_to_pix / 100); +// +// var _x = 0; +// var _y = 0; +// if (true == this.m_oWordControl.m_bIsRuler) +// { +// _x = 5 * g_dKoef_mm_to_pix; +// _y = 7 * g_dKoef_mm_to_pix; +// } +// +// // теперь крутить вÑÑкие циклы нет ÑмыÑла +// if (pageIndex < 0 || pageIndex >= this.m_lPagesCount) +// { +// return { X : 0, Y : 0, Error: true }; +// } +// +// var __x = x; +// var __y = y; +// if (transform) +// { +// __x = transform.TransformPointX(x, y); +// __y = transform.TransformPointY(x, y); +// } +// +// var x_pix = parseInt(this.m_arrPages[pageIndex].drawingPage.left + __x * dKoef + _x); +// var y_pix = parseInt(this.m_arrPages[pageIndex].drawingPage.top + __y * dKoef + _y); +// +// return { X : x_pix, Y : y_pix, Error: false }; + } + + this.ConvertCoordsToCursor = function(x, y, pageIndex, bIsRul) + { +// var dKoef = (this.m_oWordControl.m_nZoomValue * g_dKoef_mm_to_pix / 100); +// +// var _x = 0; +// var _y = 0; +// if (true == this.m_oWordControl.m_bIsRuler) +// { +// if (undefined == bIsRul) +// { +// //_x = 5 * g_dKoef_mm_to_pix; +// //_y = 7 * g_dKoef_mm_to_pix; +// } +// } +// +// // теперь крутить вÑÑкие циклы нет ÑмыÑла +// if (pageIndex < 0 || pageIndex >= this.m_lPagesCount) +// { +// return { X : 0, Y : 0, Error: true }; +// } +// +// var x_pix = parseInt(this.m_arrPages[pageIndex].drawingPage.left + x * dKoef + _x); +// var y_pix = parseInt(this.m_arrPages[pageIndex].drawingPage.top + y * dKoef + _y); +// +// return { X : x_pix, Y : y_pix, Error: false }; +// +// // old version +// for (var i = this.m_lDrawingFirst; i <= this.m_lDrawingEnd; i++) +// { +// var rect = this.m_arrPages[i].drawingPage; +// +// if (this.m_arrPages[i].pageIndex == pageIndex) +// { +// var x_pix = parseInt(rect.left + x * dKoef + _x); +// var y_pix = parseInt(rect.top + y * dKoef + _y); +// +// return { X : x_pix, Y : y_pix, Error: false }; +// } +// } + + return { X : 0, Y : 0, Error: true }; + } + this.ConvertCoordsToCursor2 = function(x, y, pageIndex, bIsRul) + { + return {X: 0, Y: 0, Error: false}; + +// var dKoef = (this.m_oWordControl.m_nZoomValue * g_dKoef_mm_to_pix / 100); +// +// var _x = 0; +// var _y = 0; +// if (true == this.m_oWordControl.m_bIsRuler) +// { +// if (undefined == bIsRul) +// { +// //_x = 5 * g_dKoef_mm_to_pix; +// //_y = 7 * g_dKoef_mm_to_pix; +// } +// } +// +// // теперь крутить вÑÑкие циклы нет ÑмыÑла +// if (pageIndex < 0 || pageIndex >= this.m_lPagesCount) +// { +// return { X : 0, Y : 0, Error: true }; +// } +// +// var x_pix = parseInt(this.m_arrPages[pageIndex].drawingPage.left + x * dKoef + _x - 0.5); +// var y_pix = parseInt(this.m_arrPages[pageIndex].drawingPage.top + y * dKoef + _y - 0.5); +// +// return { X : x_pix, Y : y_pix, Error: false }; + } + this.ConvertCoordsToCursor3 = function(x, y, pageIndex) + { + return {X: 0, Y: 0, Error: false}; + //var _return = this.Native["DD_ConvertCoordsToAnotherPage"](x, y, pageCoord, pageNeed); + //return { X : _return[0], Y : _return[1], Error : _return[2] }; + +// // теперь крутить вÑÑкие циклы нет ÑмыÑла +// if (pageIndex < 0 || pageIndex >= this.m_lPagesCount) +// { +// return { X : 0, Y : 0, Error: true }; +// } +// +// var dKoef = (this.m_oWordControl.m_nZoomValue * g_dKoef_mm_to_pix / 100); +// +// var _x = this.m_oWordControl.X; +// var _y = this.m_oWordControl.Y; +// +// var x_pix = parseInt(this.m_arrPages[pageIndex].drawingPage.left + x * dKoef + _x + 0.5); +// var y_pix = parseInt(this.m_arrPages[pageIndex].drawingPage.top + y * dKoef + _y + 0.5); +// +// return { X : x_pix, Y : y_pix, Error: false }; + } + + this.InitViewer = function() + { + } + + this.TargetStart = function() + { + this.Native["DD_TargetStart"](); + } + this.TargetEnd = function() + { + this.TargetShowFlag = false; + this.TargetShowNeedFlag = false; + this.Native["DD_TargetEnd"](); + } + this.UpdateTargetNoAttack = function() + { + if (null == this.m_oWordControl) + return; + + this.CheckTargetDraw(this.m_dTargetX, this.m_dTargetY); + } + + this.GetTargetStyle = function() + { + return "rgb(" + this.TargetCursorColor.R + "," + this.TargetCursorColor.G + "," + this.TargetCursorColor.B + ")"; + } + + this.SetTargetColor = function(r, g, b) + { + this.Native["DD_SetTargetColor"](r, g, b); + } + + this.CheckTargetDraw = function(x, y) + { + //TODO: + +// var _oldW = this.TargetHtmlElement.width; +// var _oldH = this.TargetHtmlElement.height; +// +// var dKoef = this.drawingObjects.convertMetric(1, 3, 0); +// +// var _newW = 2; +// var _newH = this.m_dTargetSize * dKoef; +// +// var _offX = 0; +// var _offY = 0; +// if (this.AutoShapesTrack && this.AutoShapesTrack.Graphics && this.AutoShapesTrack.Graphics.m_oCoordTransform) +// { +// _offX = this.AutoShapesTrack.Graphics.m_oCoordTransform.tx; +// _offY = this.AutoShapesTrack.Graphics.m_oCoordTransform.ty; +// } +// +// var _factor = AscBrowser.isRetina ? 1 : 0; +// +// if (null != this.TextMatrix && !global_MatrixTransformer.IsIdentity2(this.TextMatrix)) +// { +// var _x1 = this.TextMatrix.TransformPointX(x, y); +// var _y1 = this.TextMatrix.TransformPointY(x, y); +// +// var _x2 = this.TextMatrix.TransformPointX(x, y + this.m_dTargetSize); +// var _y2 = this.TextMatrix.TransformPointY(x, y + this.m_dTargetSize); +// +// var pos1 = { X : _offX + dKoef * _x1, Y : _offY + dKoef * _y1 }; +// var pos2 = { X : _offX + dKoef * _x2, Y : _offY + dKoef * _y2 }; +// +// _newW = (((Math.abs(pos1.X - pos2.X) >> 0) + 1) >> 1) << 1; +// _newH = (((Math.abs(pos1.Y - pos2.Y) >> 0) + 1) >> 1) << 1; +// +// if (2 > _newW) +// _newW = 2; +// if (2 > _newH) +// _newH = 2; +// +// if (_oldW == _newW && _oldH == _newH) +// { +// // проÑто очищаем +// this.TargetHtmlElement.width = _newW; +// } +// else +// { +// this.TargetHtmlElement.style.width = (_newW >> _factor) + "px"; +// this.TargetHtmlElement.style.height = (_newH >> _factor) + "px"; +// +// this.TargetHtmlElement.width = _newW; +// this.TargetHtmlElement.height = _newH; +// } +// var ctx = this.TargetHtmlElement.getContext('2d'); +// +// if (_newW == 2 || _newH == 2) +// { +// ctx.fillStyle = this.GetTargetStyle(); +// ctx.fillRect(0, 0, _newW, _newH); +// } +// else +// { +// ctx.beginPath(); +// ctx.strokeStyle = this.GetTargetStyle(); +// ctx.lineWidth = 2; +// +// if (((pos1.X - pos2.X)*(pos1.Y - pos2.Y)) >= 0) +// { +// ctx.moveTo(0, 0); +// ctx.lineTo(_newW, _newH); +// } +// else +// { +// ctx.moveTo(0, _newH); +// ctx.lineTo(_newW, 0); +// } +// +// ctx.stroke(); +// } +// +// this.TargetHtmlElement.style.left = (Math.min(pos1.X, pos2.X) >> _factor) + "px"; +// this.TargetHtmlElement.style.top = (Math.min(pos1.Y, pos2.Y) >> _factor) + "px"; +// } +// else +// { +// if (_oldW == _newW && _oldH == _newH) +// { +// // проÑто очищаем +// this.TargetHtmlElement.width = _newW; +// } +// else +// { +// this.TargetHtmlElement.style.width = (_newW >> _factor) + "px"; +// this.TargetHtmlElement.style.height = (_newH >> _factor) + "px"; +// +// this.TargetHtmlElement.width = _newW; +// this.TargetHtmlElement.height = _newH; +// } +// +// var ctx = this.TargetHtmlElement.getContext('2d'); +// +// ctx.fillStyle = this.GetTargetStyle(); +// ctx.fillRect(0, 0, _newW, _newH); +// +// if (null != this.TextMatrix) +// { +// x += this.TextMatrix.tx; +// y += this.TextMatrix.ty; +// } +// +// var pos = { X : _offX + dKoef * x, Y : _offY + dKoef * y }; +// +// this.TargetHtmlElement.style.left = (pos.X >> _factor) + "px"; +// this.TargetHtmlElement.style.top = (pos.Y >> _factor) + "px"; +// } + } + + this.UpdateTargetTransform = function(matrix) + { + if (matrix) + { + if (null == this.TextMatrix) + this.TextMatrix = new CMatrix(); + this.TextMatrix.sx = matrix.sx; + this.TextMatrix.shy = matrix.shy; + this.TextMatrix.shx = matrix.shx; + this.TextMatrix.sy = matrix.sy; + this.TextMatrix.tx = matrix.tx; + this.TextMatrix.ty = matrix.ty; + + this.Native["DD_UpdateTargetTransform"](matrix.sx, matrix.shy, matrix.shx, matrix.sy, matrix.tx, matrix.ty); + } + else + { + this.TextMatrix = null; + this.Native["DD_RemoveTargetTransform"](); + } + } + + this.UpdateTarget = function(x, y, pageIndex) + { + /* + if (this.UpdateTargetFromPaint === false) + { + this.UpdateTargetCheck = true; + + if (this.NeedScrollToTargetFlag && this.m_dTargetX == x && this.m_dTargetY == y && this.m_lTargetPage == pageIndex) + this.NeedScrollToTarget = false; + else + this.NeedScrollToTarget = true; + + return; + } + */ + + if (-1 != this.m_lTimerUpdateTargetID) + { + clearTimeout(this.m_lTimerUpdateTargetID); + this.m_lTimerUpdateTargetID = -1; + } + + this.m_dTargetX = x; + this.m_dTargetY = y; + this.m_lTargetPage = pageIndex; + + this.Native["DD_UpdateTarget"](x, y, pageIndex); + + // this.CheckTargetDraw(x, y); + } + this.UpdateTarget2 = function(x, y, pageIndex) + { + //TODO: + +// if (pageIndex >= this.m_arrPages.length) +// return; +// +// this.m_oWordControl.m_oLogicDocument.Set_TargetPos( x, y, pageIndex ); +// +// var bIsPageChanged = false; +// if (this.m_lCurrentPage != pageIndex) +// { +// this.m_lCurrentPage = pageIndex; +// this.m_oWordControl.SetCurrentPage2(); +// this.m_oWordControl.OnScroll(); +// bIsPageChanged = true; +// } +// +// this.m_dTargetX = x; +// this.m_dTargetY = y; +// this.m_lTargetPage = pageIndex; +// +// var pos = this.ConvertCoordsToCursor(x, y, this.m_lCurrentPage); +// +// if (true == pos.Error && (false == bIsPageChanged)) +// return; +// +// // �������, ����� �� ������ �� ������ +// var boxX = 0; +// var boxY = 0; +// var boxR = this.m_oWordControl.m_oEditor.HtmlElement.width; +// var boxB = this.m_oWordControl.m_oEditor.HtmlElement.height; +// +// /* +// if (true == this.m_oWordControl.m_bIsRuler) +// { +// boxX += Number(5 * g_dKoef_mm_to_pix); +// boxY += Number(7 * g_dKoef_mm_to_pix); +// boxR += Number(5 * g_dKoef_mm_to_pix); +// boxB += Number(7 * g_dKoef_mm_to_pix); +// } +// */ +// +// var nValueScrollHor = 0; +// if (pos.X < boxX) +// { +// //nValueScrollHor = boxX - pos.X; +// //nValueScrollHor = pos.X; +// nValueScrollHor = this.m_oWordControl.GetHorizontalScrollTo(x - 5, pageIndex); +// } +// if (pos.X > boxR) +// { +// //nValueScrollHor = boxR - pos.X; +// //nValueScrollHor = pos.X + this.m_oWordControl.m_oEditor.HtmlElement.width; +// var _mem = x + 5 - g_dKoef_pix_to_mm * this.m_oWordControl.m_oEditor.HtmlElement.width * 100 / this.m_oWordControl.m_nZoomValue; +// nValueScrollHor = this.m_oWordControl.GetHorizontalScrollTo(_mem, pageIndex); +// } +// +// var nValueScrollVer = 0; +// if (pos.Y < boxY) +// { +// //nValueScrollVer = boxY - pos.Y; +// //nValueScrollVer = pos.Y; +// nValueScrollVer = this.m_oWordControl.GetVerticalScrollTo(y - 5, pageIndex); +// } +// if (pos.Y > boxB) +// { +// //nValueScrollVer = boxB - pos.Y; +// //nValueScrollHor = pos.Y + this.m_oWordControl.m_oEditor.HtmlElement.height; +// var _mem = y + this.m_dTargetSize + 5 - g_dKoef_pix_to_mm * this.m_oWordControl.m_oEditor.HtmlElement.height * 100 / this.m_oWordControl.m_nZoomValue; +// nValueScrollVer = this.m_oWordControl.GetVerticalScrollTo(_mem, pageIndex); +// } +// +// var isNeedScroll = false; +// if (0 != nValueScrollHor) +// { +// isNeedScroll = true; +// var temp = nValueScrollHor * this.m_oWordControl.m_dScrollX_max / (this.m_oWordControl.m_dDocumentWidth - this.m_oWordControl.m_oEditor.HtmlElement.width); +// this.m_oWordControl.m_oScrollHorApi.scrollToX(parseInt(temp), false); +// } +// if (0 != nValueScrollVer) +// { +// isNeedScroll = true; +// var temp = nValueScrollVer * this.m_oWordControl.m_dScrollY_max / (this.m_oWordControl.m_dDocumentHeight - this.m_oWordControl.m_oEditor.HtmlElement.height); +// this.m_oWordControl.m_oScrollVerApi.scrollToY(parseInt(temp), false); +// } +// +// if (true == isNeedScroll) +// { +// this.m_oWordControl.OnScroll(); +// return; +// } + } + + this.UpdateTargetTimer = function() + { + //TODO: +// var x = oThis.m_tempX; +// var y = oThis.m_tempY; +// var pageIndex = oThis.m_tempPageIndex; +// +// oThis.m_lTimerUpdateTargetID = -1; +// if (pageIndex >= oThis.m_arrPages.length) +// return; +// +// var oWordControl = oThis.m_oWordControl; +// +// var bIsPageChanged = false; +// if (oThis.m_lCurrentPage != pageIndex) +// { +// oThis.m_lCurrentPage = pageIndex; +// oWordControl.SetCurrentPage2(); +// oWordControl.OnScroll(); +// bIsPageChanged = true; +// } +// +// oThis.m_dTargetX = x; +// oThis.m_dTargetY = y; +// oThis.m_lTargetPage = pageIndex; +// +// var targetSize = Number(oThis.m_dTargetSize * oWordControl.m_nZoomValue * g_dKoef_mm_to_pix / 100); +// var pos = oThis.ConvertCoordsToCursor2(x, y, oThis.m_lCurrentPage); +// //pos.Y -= targetSize; +// +// if (true === pos.Error && (false === bIsPageChanged)) +// return; +// +// // �������, ����� �� ������ �� ������ +// var boxX = 0; +// var boxY = 0; +// var boxR = oWordControl.m_oEditor.HtmlElement.width - 2; +// var boxB = oWordControl.m_oEditor.HtmlElement.height - targetSize; +// +// /* +// if (true === oWordControl.m_bIsRuler) +// { +// boxX += Number(5 * g_dKoef_mm_to_pix); +// boxY += Number(7 * g_dKoef_mm_to_pix); +// boxR += Number(5 * g_dKoef_mm_to_pix); +// boxB += Number(7 * g_dKoef_mm_to_pix); +// } +// */ +// +// var nValueScrollHor = 0; +// if (pos.X < boxX) +// { +// nValueScrollHor = boxX - pos.X; +// } +// if (pos.X > boxR) +// { +// nValueScrollHor = boxR - pos.X; +// } +// +// var nValueScrollVer = 0; +// if (pos.Y < boxY) +// { +// nValueScrollVer = boxY - pos.Y; +// } +// if (pos.Y > boxB) +// { +// nValueScrollVer = boxB - pos.Y; +// } +// +// var isNeedScroll = false; +// if (0 != nValueScrollHor) +// { +// isNeedScroll = true; +// oWordControl.m_bIsUpdateTargetNoAttack = true; +// oWordControl.m_oScrollHorApi.scrollByX(-nValueScrollHor, false); +// } +// if (0 != nValueScrollVer) +// { +// isNeedScroll = true; +// oWordControl.m_bIsUpdateTargetNoAttack = true; +// oWordControl.m_oScrollVerApi.scrollByY(-nValueScrollVer, false); +// } +// +// if (true === isNeedScroll) +// { +// oWordControl.m_bIsUpdateTargetNoAttack = true; +// oWordControl.OnScroll(); +// return; +// } +// +// oThis.TargetHtmlElement.style.left = pos.X + "px"; +// oThis.TargetHtmlElement.style.top = pos.Y + "px"; +// +// this.m_oWordControl.CheckTextBoxInputPos(); +// +// if (this.m_bIsSearching && null != this.CurrentSearchNavi) +// { +// this.CurrentSearchNavi = null; +// this.drawingObjects.OnUpdateOverlay(); +// } + } + + this.SetTargetSize = function(size) + { + this.m_dTargetSize = size; + this.Native["DD_SetTargetSize"](size); + + //this.TargetHtmlElement.style.height = Number(this.m_dTargetSize * this.m_oWordControl.m_nZoomValue * g_dKoef_mm_to_pix / 100) + "px"; + //this.TargetHtmlElement.style.width = "2px"; + + } + this.DrawTarget = function() + { + //TODO: +// if ( "block" != oThis.TargetHtmlElement.style.display && oThis.NeedTarget ) +// oThis.TargetHtmlElement.style.display = "block"; +// else +// oThis.TargetHtmlElement.style.display = "none"; + } + + this.TargetShow = function() + { + this.TargetShowNeedFlag = true; + this.Native["DD_TargetShow"](); + } + this.CheckTargetShow = function() + { + //TODO: + +// if (this.TargetShowFlag && this.TargetShowNeedFlag) +// { +// this.TargetHtmlElement.style.display = "block"; +// this.TargetShowNeedFlag = false; +// return; +// } +// +// if (!this.TargetShowNeedFlag) +// return; +// +// this.TargetShowNeedFlag = false; +// +// if ( -1 == this.m_lTimerTargetId ) +// this.TargetStart(); +// +// if (oThis.NeedTarget) +// this.TargetHtmlElement.style.display = "block"; +// +// this.TargetShowFlag = true; + } + this.StartTrackImage = function(obj, x, y, w, h, type, pagenum) + { + } + this.StartTrackTable = function(obj, transform) + { + //TODO: +// if (this.m_oWordControl.MobileTouchManager) +// { +// if (!this.m_oWordControl.MobileTouchManager.TableStartTrack_Check) +// return; +// } +// +// this.TableOutlineDr.TableOutline = obj; +// this.TableOutlineDr.Counter = 0; +// this.TableOutlineDr.bIsNoTable = false; +// this.TableOutlineDr.CheckStartTrack(this.m_oWordControl, transform); +// +// if (this.m_oWordControl.MobileTouchManager) +// this.m_oWordControl.OnUpdateOverlay(); + } + this.EndTrackTable = function(pointer, bIsAttack) + { + if (this.TableOutlineDr.TableOutline != null) + { + if (pointer == this.TableOutlineDr.TableOutline.Table || bIsAttack) + { + this.TableOutlineDr.TableOutline = null; + this.TableOutlineDr.Counter = 0; + } + } + } + this.CheckTrackTable = function() + { + if (null == this.TableOutlineDr.TableOutline) + return; + + if (this.TableOutlineDr.bIsNoTable && this.TableOutlineDr.bIsTracked === false) + { + this.TableOutlineDr.Counter++; + if (this.TableOutlineDr.Counter > 100) + { + this.TableOutlineDr.TableOutline = null; + this.m_oWordControl.OnUpdateOverlay(); + } + } + } + this.DrawTableTrack = function(overlay) + { + //TODO: +// if (null == this.TableOutlineDr.TableOutline) +// return; +// +// var _table = this.TableOutlineDr.TableOutline.Table; +// +// if (!_table.Is_Inline()) +// { +// if (null == this.TableOutlineDr.CurPos) +// return; +// +// var _page = this.m_arrPages[this.TableOutlineDr.CurPos.Page]; +// var drPage = _page.drawingPage; +// +// var dKoefX = (drPage.right - drPage.left) / _page.width_mm; +// var dKoefY = (drPage.bottom - drPage.top) / _page.height_mm; +// +// if (!this.TableOutlineDr.TableMatrix || global_MatrixTransformer.IsIdentity(this.TableOutlineDr.TableMatrix)) +// { +// var _x = parseInt(drPage.left + dKoefX * (this.TableOutlineDr.CurPos.X + _table.Get_TableOffsetCorrection())) + 0.5; +// var _y = parseInt(drPage.top + dKoefY * this.TableOutlineDr.CurPos.Y) + 0.5; +// +// var _r = _x + parseInt(dKoefX * this.TableOutlineDr.TableOutline.W); +// var _b = _y + parseInt(dKoefY * this.TableOutlineDr.TableOutline.H); +// +// if (_x < overlay.min_x) +// overlay.min_x = _x; +// if (_r > overlay.max_x) +// overlay.max_x = _r; +// +// if (_y < overlay.min_y) +// overlay.min_y = _y; +// if (_b > overlay.max_y) +// overlay.max_y = _b; +// +// var ctx = overlay.m_oContext; +// ctx.strokeStyle = "#FFFFFF"; +// +// ctx.beginPath(); +// ctx.rect(_x, _y, _r - _x, _b - _y); +// ctx.stroke(); +// +// ctx.strokeStyle = "#000000"; +// ctx.beginPath(); +// +// // набиваем пунктир +// var dot_size = 3; +// for (var i = _x; i < _r; i += dot_size) +// { +// ctx.moveTo(i, _y); +// i += dot_size; +// +// if (i > _r) +// i = _r; +// +// ctx.lineTo(i, _y); +// } +// for (var i = _y; i < _b; i += dot_size) +// { +// ctx.moveTo(_r, i); +// i += dot_size; +// +// if (i > _b) +// i = _b; +// +// ctx.lineTo(_r, i); +// } +// for (var i = _r; i > _x; i -= dot_size) +// { +// ctx.moveTo(i, _b); +// i -= dot_size; +// +// if (i < _x) +// i = _x; +// +// ctx.lineTo(i, _b); +// } +// for (var i = _b; i > _y; i -= dot_size) +// { +// ctx.moveTo(_x, i); +// i -= dot_size; +// +// if (i < _y) +// i = _y; +// +// ctx.lineTo(_x, i); +// } +// +// ctx.stroke(); +// ctx.beginPath(); +// } +// else +// { +// var _x = this.TableOutlineDr.CurPos.X + _table.Get_TableOffsetCorrection(); +// var _y = this.TableOutlineDr.CurPos.Y; +// var _r = _x + this.TableOutlineDr.TableOutline.W; +// var _b = _y + this.TableOutlineDr.TableOutline.H; +// +// var transform = this.TableOutlineDr.TableMatrix; +// +// var x1 = transform.TransformPointX(_x, _y); +// var y1 = transform.TransformPointY(_x, _y); +// +// var x2 = transform.TransformPointX(_r, _y); +// var y2 = transform.TransformPointY(_r, _y); +// +// var x3 = transform.TransformPointX(_r, _b); +// var y3 = transform.TransformPointY(_r, _b); +// +// var x4 = transform.TransformPointX(_x, _b); +// var y4 = transform.TransformPointY(_x, _b); +// +// overlay.CheckPoint(x1, y1); +// overlay.CheckPoint(x2, y2); +// overlay.CheckPoint(x3, y3); +// overlay.CheckPoint(x4, y4); +// +// var ctx = overlay.m_oContext; +// ctx.strokeStyle = "#FFFFFF"; +// +// ctx.beginPath(); +// ctx.moveTo(x1, y1); +// ctx.lineTo(x2, y2); +// ctx.lineTo(x3, y3); +// ctx.lineTo(x4, y4); +// ctx.closePath(); +// ctx.stroke(); +// +// ctx.strokeStyle = "#000000"; +// ctx.beginPath(); +// +// this.AutoShapesTrack.AddRectDash(ctx, x1, y1, x2, y2, x4, y4, x3, y3, 3, 3); +// +// ctx.stroke(); +// ctx.beginPath(); +// } +// } +// else +// { +// this.LockCursorType("default"); +// +// var _x = global_mouseEvent.X; +// var _y = global_mouseEvent.Y; +// var posMouse = this.ConvertCoordsFromCursor2(_x, _y); +// +// this.TableOutlineDr.InlinePos = this.m_oWordControl.m_oLogicDocument.Get_NearestPos(posMouse.Page, posMouse.X, posMouse.Y); +// this.TableOutlineDr.InlinePos.Page = posMouse.Page; +// //var posView = this.ConvertCoordsToCursor(this.TableOutlineDr.InlinePos.X, this.TableOutlineDr.InlinePos.Y, posMouse.Page, true); +// +// var _near = this.TableOutlineDr.InlinePos; +// this.AutoShapesTrack.SetCurrentPage(_near.Page); +// this.AutoShapesTrack.DrawInlineMoveCursor(_near.X, _near.Y, _near.Height, _near.transform); +// } + } + this.SetCurrentPage = function(PageIndex) + { + this.m_lCurrentPage = this.Native["DD_SetCurrentPage"](PageIndex); + +// if (PageIndex >= this.m_arrPages.length) +// return; +// if (this.m_lCurrentPage == PageIndex) +// return; +// +// this.m_lCurrentPage = PageIndex; +// this.m_oWordControl.SetCurrentPage(); + } + + this.SelectEnabled = function(bIsEnabled) + { +// this.m_bIsSelection = bIsEnabled; +// if (false === this.m_bIsSelection) +// { +// this.SelectClear(); +// //this.m_oWordControl.CheckUnShowOverlay(); +// //this.drawingObjects.OnUpdateOverlay(); +// this.drawingObjects.getOverlay().m_oContext.globalAlpha = 1.0; +// } + } + this.SelectClear = function() + { + + } + this.SearchClear = function() + { + //TODO: +// for (var i = 0; i < this.m_lPagesCount; i++) +// { +// this.m_arrPages[i].searchingArray.splice(0, this.m_arrPages[i].searchingArray.length); +// } +// +// this._search_HdrFtr_All.splice(0, this._search_HdrFtr_All.length); +// this._search_HdrFtr_All_no_First.splice(0, this._search_HdrFtr_All_no_First.length); +// this._search_HdrFtr_First.splice(0, this._search_HdrFtr_First.length); +// this._search_HdrFtr_Even.splice(0, this._search_HdrFtr_Even.length); +// this._search_HdrFtr_Odd.splice(0, this._search_HdrFtr_Odd.length); +// this._search_HdrFtr_Odd_no_First.splice(0, this._search_HdrFtr_Odd_no_First.length); +// +// this.m_oWordControl.m_oOverlayApi.Clear(); +// this.m_bIsSearching = false; +// this.CurrentSearchNavi = null; + } + this.AddPageSearch = function(findText, rects, type) + { + //TODO: + +// var _len = rects.length; +// if (_len == 0) +// return; +// +// if (this.m_oWordControl.m_oOverlay.HtmlElement.style.display == "none") +// { +// this.m_oWordControl.ShowOverlay(); +// this.m_oWordControl.m_oOverlayApi.m_oContext.globalAlpha = 0.2; +// } +// +// var navigator = { Page : rects[0].PageNum, Place : rects, Type : type }; +// +// var _find = { text: findText, navigator : navigator }; +// this.m_oWordControl.m_oApi.sync_SearchFoundCallback(_find); +// +// var is_update = false; +// +// var _type = type & 0x00FF; +// switch (_type) +// { +// case search_Common: +// { +// var _pages = this.m_arrPages; +// for (var i = 0; i < _len; i++) +// { +// var r = rects[i]; +// +// if (this.SearchTransform) +// r.Transform = this.SearchTransform; +// +// _pages[r.PageNum].searchingArray[_pages[r.PageNum].searchingArray.length] = r; +// +// if (r.PageNum >= this.m_lDrawingFirst && r.PageNum <= this.m_lDrawingEnd) +// is_update = true; +// } +// break; +// } +// case search_HdrFtr_All: +// { +// for (var i = 0; i < _len; i++) +// { +// if (this.SearchTransform) +// rects[i].Transform = this.SearchTransform; +// +// this._search_HdrFtr_All[this._search_HdrFtr_All.length] = rects[i]; +// } +// is_update = true; +// +// break; +// } +// case search_HdrFtr_All_no_First: +// { +// for (var i = 0; i < _len; i++) +// { +// if (this.SearchTransform) +// rects[i].Transform = this.SearchTransform; +// +// this._search_HdrFtr_All_no_First[this._search_HdrFtr_All_no_First.length] = rects[i]; +// } +// if (this.m_lDrawingEnd > 0) +// is_update = true; +// +// break; +// } +// case search_HdrFtr_First: +// { +// for (var i = 0; i < _len; i++) +// { +// if (this.SearchTransform) +// rects[i].Transform = this.SearchTransform; +// +// this._search_HdrFtr_First[this._search_HdrFtr_First.length] = rects[i]; +// } +// if (this.m_lDrawingFirst == 0) +// is_update = true; +// +// break; +// } +// case search_HdrFtr_Even: +// { +// for (var i = 0; i < _len; i++) +// { +// if (this.SearchTransform) +// rects[i].Transform = this.SearchTransform; +// +// this._search_HdrFtr_Even[this._search_HdrFtr_Even.length] = rects[i]; +// } +// var __c = this.m_lDrawingEnd - this.m_lDrawingFirst; +// +// if (__c > 1) +// is_update = true; +// else if (__c == 1 && (this.m_lDrawingFirst & 1) == 1) +// is_update = true; +// +// break; +// } +// case search_HdrFtr_Odd: +// { +// for (var i = 0; i < _len; i++) +// { +// if (this.SearchTransform) +// rects[i].Transform = this.SearchTransform; +// +// this._search_HdrFtr_Odd[this._search_HdrFtr_Odd.length] = rects[i]; +// } +// var __c = this.m_lDrawingEnd - this.m_lDrawingFirst; +// +// if (__c > 1) +// is_update = true; +// else if (__c == 1 && (this.m_lDrawingFirst & 1) == 0) +// is_update = true; +// +// break; +// } +// case search_HdrFtr_Odd_no_First: +// { +// for (var i = 0; i < _len; i++) +// { +// if (this.SearchTransform) +// rects[i].Transform = this.SearchTransform; +// +// this._search_HdrFtr_Odd_no_First[this._search_HdrFtr_Odd_no_First.length] = rects[i]; +// } +// +// if (this.m_lDrawingEnd > 1) +// { +// var __c = this.m_lDrawingEnd - this.m_lDrawingFirst; +// if (__c > 1) +// is_update = true; +// else if (__c == 1 && (this.m_lDrawingFirst & 1) == 0) +// is_update = true; +// } +// +// break; +// } +// default: +// break; +// } +// +// if (is_update) +// this.drawingObjects.OnUpdateOverlay(); + + } + + this.StartSearchTransform = function(transform) + { + //TODO: + //this.SearchTransform = transform.CreateDublicate(); + } + + this.EndSearchTransform = function() + { + //TODO: + // this.SearchTransform = null; + } + + this.StartSearch = function() + { + //TODO: +// this.SearchClear(); +// if (this.m_bIsSelection) +// this.m_oWordControl.OnUpdateOverlay(); +// this.m_bIsSearching = true; +// this.CurrentSearchNavi = null; + } + this.EndSearch = function(bIsChange) + { + //TODO: + +// if (bIsChange) +// { +// this.SearchClear(); +// this.m_bIsSearching = false; +// this.m_oWordControl.OnUpdateOverlay(); +// } +// else +// { +// this.m_bIsSearching = true; +// this.m_oWordControl.OnUpdateOverlay(); +// } +// this.m_oWordControl.m_oApi.sync_SearchEndCallback(); + } + + this.private_StartDrawSelection = function(overlay) + { + //TODO: + +// this.Overlay = overlay; +// this.IsTextMatrixUse = ((null != this.TextMatrix) && !global_MatrixTransformer.IsIdentity(this.TextMatrix)); +// +// this.Overlay.m_oContext.fillStyle = "rgba(51,102,204,255)"; +// this.Overlay.m_oContext.beginPath(); +// +// if (this.IsTextMatrixUse) +// this.Overlay.m_oContext.strokeStyle = "#9ADBFE"; + } + this.private_EndDrawSelection = function() + { + //TODO: +// var ctx = this.Overlay.m_oContext; +// +// ctx.globalAlpha = 0.2; +// ctx.fill(); +// +// if (this.IsTextMatrixUse) +// { +// ctx.globalAlpha = 1.0; +// ctx.stroke(); +// } +// +// ctx.beginPath(); +// ctx.globalAlpha = 1.0; +// +// this.IsTextMatrixUse = false; +// this.Overlay = null; + } + + this.AddPageSelection = function(pageIndex, x, y, w, h) + { + this.Native["DD_AddPageSelection"](pageIndex, x, y, w, h); + } + + this.AddPageSelection2 = function(pageIndex, x, y, width, height) + { + //TODO: + +// //if (pageIndex < 0 || pageIndex >= Math.max(this.m_lPagesCount, this.m_lCountCalculatePages) || Math.abs(width) < 0.001 || Math.abs(height) < 0.001) +// // return; +// if (Math.abs(width) < 0.001 || Math.abs(height) < 0.001) +// return; +// +// if (undefined === this.m_arrPages[pageIndex]) +// this.m_arrPages[pageIndex] = new CPage(); +// +// if (this.min_PageAddSelection > pageIndex) +// this.min_PageAddSelection = pageIndex; +// if (this.max_PageAddSelection < pageIndex) +// this.max_PageAddSelection = pageIndex; +// +// if (this.m_bIsSelection && (this.m_oWordControl.m_oOverlay.HtmlElement.style.display == "none")) +// { +// this.m_oWordControl.ShowOverlay(); +// this.m_oWordControl.m_oOverlayApi.m_oContext.globalAlpha = 0.2; +// } +// +// var r = new _rect(); +// r.x = x; +// r.y = y; +// r.w = width; +// r.h = height; +// this.m_arrPages[pageIndex].selectionArray[this.m_arrPages[pageIndex].selectionArray.length] = r; +// +// if (this.m_oWordControl.MobileTouchManager) +// { +// if (null == this.m_oWordControl.MobileTouchManager.RectSelect1) +// { +// this.m_oWordControl.MobileTouchManager.RectSelect1 = r; +// this.m_oWordControl.MobileTouchManager.PageSelect1 = pageIndex; +// } +// +// this.m_oWordControl.MobileTouchManager.RectSelect2 = r; +// this.m_oWordControl.MobileTouchManager.PageSelect2 = pageIndex; +// } + } + + this.AddPageSelection2 = function(pageIndex, x, y, width, height) + { + //TODO: +// //if (pageIndex < 0 || pageIndex >= Math.max(this.m_lPagesCount, this.m_lCountCalculatePages) || Math.abs(width) < 0.001 || Math.abs(height) < 0.001) +// // return; +// if (Math.abs(width) < 0.001 || Math.abs(height) < 0.001) +// return; +// +// if (undefined === this.m_arrPages[pageIndex]) +// this.m_arrPages[pageIndex] = new CPage(); +// +// if (this.min_PageAddSelection > pageIndex) +// this.min_PageAddSelection = pageIndex; +// if (this.max_PageAddSelection < pageIndex) +// this.max_PageAddSelection = pageIndex; +// +// if (this.m_bIsSelection && (this.m_oWordControl.m_oOverlay.HtmlElement.style.display == "none")) +// { +// this.m_oWordControl.ShowOverlay(); +// this.m_oWordControl.m_oOverlayApi.m_oContext.globalAlpha = 0.2; +// } +// +// var r = new _rect(); +// r.x = x; +// r.y = y; +// r.w = width; +// r.h = height; +// this.m_arrPages[pageIndex].selectionArray[this.m_arrPages[pageIndex].selectionArray.length] = r; +// +// if (this.m_oWordControl.MobileTouchManager) +// { +// if (null == this.m_oWordControl.MobileTouchManager.RectSelect1) +// { +// this.m_oWordControl.MobileTouchManager.RectSelect1 = r; +// this.m_oWordControl.MobileTouchManager.PageSelect1 = pageIndex; +// } +// +// this.m_oWordControl.MobileTouchManager.RectSelect2 = r; +// this.m_oWordControl.MobileTouchManager.PageSelect2 = pageIndex; +// } + } + this.SelectShow = function() + { + this.drawingObjects.OnUpdateOverlay(); + } + + this.Set_RulerState_Table = function(markup, transform) + { + //TODO: + +// var hor_ruler = this.m_oWordControl.m_oHorRuler; +// var ver_ruler = this.m_oWordControl.m_oVerRuler; +// +// hor_ruler.CurrentObjectType = RULER_OBJECT_TYPE_TABLE; +// hor_ruler.m_oTableMarkup = markup.CreateDublicate(); +// +// ver_ruler.CurrentObjectType = RULER_OBJECT_TYPE_TABLE; +// ver_ruler.m_oTableMarkup = markup.CreateDublicate(); +// +// this.TableOutlineDr.TableMatrix = null; +// this.TableOutlineDr.CurrentPageIndex = this.m_lCurrentPage; +// if (transform) +// { +// hor_ruler.m_oTableMarkup.TransformX = transform.tx; +// hor_ruler.m_oTableMarkup.TransformY = transform.ty; +// +// ver_ruler.m_oTableMarkup.TransformX = transform.tx; +// ver_ruler.m_oTableMarkup.TransformY = transform.ty; +// +// hor_ruler.m_oTableMarkup.CorrectFrom(); +// ver_ruler.m_oTableMarkup.CorrectFrom(); +// +// this.TableOutlineDr.TableMatrix = transform.CreateDublicate(); +// } +// +// hor_ruler.CalculateMargins(); +// +// if (0 <= this.m_lCurrentPage && this.m_lCurrentPage < this.m_lPagesCount) +// { +// hor_ruler.CreateBackground(this.m_arrPages[this.m_lCurrentPage]); +// ver_ruler.CreateBackground(this.m_arrPages[this.m_lCurrentPage]); +// } +// +// this.m_oWordControl.UpdateHorRuler(); +// this.m_oWordControl.UpdateVerRuler(); +// +// if (this.m_oWordControl.MobileTouchManager) +// { +// this.m_oWordControl.MobileTouchManager.TableStartTrack_Check = true; +// markup.Table.Start_TrackTable(); +// this.m_oWordControl.MobileTouchManager.TableStartTrack_Check = false; +// } + } + + this.Set_RulerState_Paragraph = function(margins) + { + //TODO: +// var hor_ruler = this.m_oWordControl.m_oHorRuler; +// var ver_ruler = this.m_oWordControl.m_oVerRuler; +// +// if (hor_ruler.CurrentObjectType == RULER_OBJECT_TYPE_PARAGRAPH && ver_ruler.CurrentObjectType == RULER_OBJECT_TYPE_PARAGRAPH) +// { +// if ((margins && !hor_ruler.IsCanMoveMargins) || (!margins && hor_ruler.IsCanMoveMargins)) +// { +// var bIsNeedUpdate = false; +// if (margins && this.LastParagraphMargins) +// { +// if (margins.L != this.LastParagraphMargins.L || +// margins.T != this.LastParagraphMargins.T || +// margins.R != this.LastParagraphMargins.R || +// margins.B != this.LastParagraphMargins.B) +// { +// bIsNeedUpdate = true; +// } +// } +// +// if (!bIsNeedUpdate) +// return; +// } +// } +// +// hor_ruler.CurrentObjectType = RULER_OBJECT_TYPE_PARAGRAPH; +// hor_ruler.m_oTableMarkup = null; +// +// ver_ruler.CurrentObjectType = RULER_OBJECT_TYPE_PARAGRAPH; +// ver_ruler.m_oTableMarkup = null; +// +// // вообще надо поÑмотреть... может и был параграф до Ñтого. +// // тогда вÑкграунд перериÑовывать не нужно. Только надо знать, на той же Ñтранице Ñто было или нет +// if (-1 != this.m_lCurrentPage) +// { +// if (margins) +// { +// var cachedPage = {}; +// cachedPage.width_mm = this.m_arrPages[this.m_lCurrentPage].width_mm; +// cachedPage.height_mm = this.m_arrPages[this.m_lCurrentPage].height_mm; +// +// cachedPage.margin_left = margins.L; +// cachedPage.margin_top = margins.T; +// cachedPage.margin_right = margins.R; +// cachedPage.margin_bottom = margins.B; +// +// hor_ruler.CreateBackground(cachedPage); +// ver_ruler.CreateBackground(cachedPage); +// +// // disable margins +// hor_ruler.IsCanMoveMargins = false; +// ver_ruler.IsCanMoveMargins = false; +// +// this.LastParagraphMargins = {}; +// this.LastParagraphMargins.L = margins.L; +// this.LastParagraphMargins.T = margins.T; +// this.LastParagraphMargins.R = margins.R; +// this.LastParagraphMargins.B = margins.B; +// } +// else +// { +// hor_ruler.CreateBackground(this.m_arrPages[this.m_lCurrentPage]); +// ver_ruler.CreateBackground(this.m_arrPages[this.m_lCurrentPage]); +// +// // enable margins +// hor_ruler.IsCanMoveMargins = true; +// ver_ruler.IsCanMoveMargins = true; +// +// this.LastParagraphMargins = null; +// } +// } +// +// this.m_oWordControl.UpdateHorRuler(); +// this.m_oWordControl.UpdateVerRuler(); + } + + this.Set_RulerState_HdrFtr = function(bHeader, Y0, Y1) + { + var hor_ruler = this.m_oWordControl.m_oHorRuler; + var ver_ruler = this.m_oWordControl.m_oVerRuler; + + hor_ruler.CurrentObjectType = RULER_OBJECT_TYPE_PARAGRAPH; + hor_ruler.m_oTableMarkup = null; + + ver_ruler.CurrentObjectType = (true === bHeader) ? RULER_OBJECT_TYPE_HEADER : RULER_OBJECT_TYPE_FOOTER; + ver_ruler.header_top = Y0; + ver_ruler.header_bottom = Y1; + ver_ruler.m_oTableMarkup = null; + + // вообще надо поÑмотреть... может и бал параграф до Ñтого. + // тогда вÑкграунд перериÑовывать не нужно. Только надо знать, на той же Ñтранице Ñто было или нет + if (-1 != this.m_lCurrentPage) + { + hor_ruler.CreateBackground(this.m_arrPages[this.m_lCurrentPage]); + ver_ruler.CreateBackground(this.m_arrPages[this.m_lCurrentPage]); + } + + this.m_oWordControl.UpdateHorRuler(); + this.m_oWordControl.UpdateVerRuler(); + } + + this.Update_ParaTab = function(Default_Tab, ParaTabs) + { + //TODO: + +// var hor_ruler = this.m_oWordControl.m_oHorRuler; +// +// var __tabs = ParaTabs.Tabs; +// if (undefined === __tabs) +// __tabs = ParaTabs; +// +// var _len = __tabs.length; +// if ((Default_Tab == hor_ruler.m_dDefaultTab) && (hor_ruler.m_arrTabs.length == _len) && (_len == 0)) +// { +// // потом можно и проверить Ñами табы +// return; +// } +// +// hor_ruler.m_dDefaultTab = Default_Tab; +// hor_ruler.m_arrTabs = []; +// var _ar = hor_ruler.m_arrTabs; +// +// for (var i = 0; i < _len; i++) +// { +// if (__tabs[i].Value == tab_Left) +// _ar[i] = new CTab(__tabs[i].Pos, g_tabtype_left); +// else if (__tabs[i].Value == tab_Center) +// _ar[i] = new CTab(__tabs[i].Pos, g_tabtype_center); +// else if (__tabs[i].Value == tab_Right) +// _ar[i] = new CTab(__tabs[i].Pos, g_tabtype_right); +// } +// +// hor_ruler.CorrectTabs(); +// this.m_oWordControl.UpdateHorRuler(); + } + + this.UpdateTableRuler = function(isCols, index, position) + { + this.Native["DD_UpdateTableRuler"](isCols, index, position); + } + this.GetDotsPerMM = function(value) + { + return value * this.Native["DD_GetDotsPerMM"](); + // return value * this.m_oWordControl.m_nZoomValue * g_dKoef_mm_to_pix / 100; + } + + this.GetMMPerDot = function(value) + { + return value / this.GetDotsPerMM( 1 ); + } + this.GetVisibleMMHeight = function() + { + return this.Native["DD_GetVisibleMMHeight"](); + +// var pixHeigth = this.m_oWordControl.m_oEditor.HtmlElement.height; +// var pixBetweenPages = 20 * (this.m_lDrawingEnd - this.m_lDrawingFirst); +// +// return (pixHeigth - pixBetweenPages) * g_dKoef_pix_to_mm * 100 / this.m_oWordControl.m_nZoomValue; + } + + // вот оооочень Ð²Ð°Ð¶Ð½Ð°Ñ Ñ„ÑƒÐ½ÐºÑ†Ð¸Ñ. она выкидывает из кÑша неиÑпользуемые шрифты + this.CheckFontCache = function() + { + var map_used = this.LogicDocument.Document_CreateFontMap(); + + for (var i in map_used) + { + this.Native["DD_CheckFontCacheAdd"](map_used[i].Name, map_used[i].Style, map_used[i].Size); + } + this.Native["DD_CheckFontCache"](); + +// var map_used = this.m_oWordControl.m_oLogicDocument.Document_CreateFontMap(); +// +// var _measure_map = g_oTextMeasurer.m_oManager.m_oFontsCache.Fonts; +// var _drawing_map = g_fontManager.m_oFontsCache.Fonts; +// +// var map_keys = {}; +// var api = this.m_oWordControl.m_oApi; +// for (var i in map_used) +// { +// var key = GenerateMapId(api, map_used[i].Name, map_used[i].Style, map_used[i].Size); +// map_keys[key] = true; +// } +// +// // а теперь проÑто пробегаем по кÑшам и удалÑем ненужное +// for (var i in _measure_map) +// { +// if (map_keys[i] == undefined) +// { +// //_measure_map[i] = undefined; +// delete _measure_map[i]; +// } +// } +// for (var i in _drawing_map) +// { +// if (map_keys[i] == undefined) +// { +// //_drawing_map[i] = undefined; +// if (null != _drawing_map[i]) +// _drawing_map[i].Destroy(); +// delete _drawing_map[i]; +// } +// } + } + + // при загрузке документа - нужно понÑÑ‚ÑŒ какие шрифты иÑпользуютÑÑ + this.CheckFontNeeds = function() + { +// var map_keys = this.m_oWordControl.m_oLogicDocument.Document_Get_AllFontNames(); +// var dstfonts = []; +// for (var i in map_keys) +// { +// dstfonts[dstfonts.length] = new CFont(i, 0, "", 0, null); +// } +// this.m_oWordControl.m_oLogicDocument.Fonts = dstfonts; +// return; + + /* + var map_used = this.m_oWordControl.m_oLogicDocument.Document_CreateFontMap(); + + var map_keys = {}; + for (var i in map_used) + { + var search = map_used[i]; + var found = map_keys[search.Name]; + + var _need_style = 0; + switch (search.Style) + { + case FontStyle.FontStyleRegular: + { + _need_style = fontstyle_mask_regular; + break; + } + case FontStyle.FontStyleBold: + { + _need_style = fontstyle_mask_bold; + break; + } + case FontStyle.FontStyleItalic: + { + _need_style = fontstyle_mask_italic; + break; + } + case FontStyle.FontStyleBoldItalic: + { + _need_style = fontstyle_mask_bolditalic; + break; + } + default: + { + _need_style = fontstyle_mask_regular | fontstyle_mask_italic | fontstyle_mask_bold | fontstyle_mask_bolditalic; + break; + } + } + + if (undefined === found) + { + map_keys[search.Name] = _need_style; + } + else + { + map_keys[search.Name] |= _need_style; + } + } + + // теперь проÑто пробегаем и заполнÑем вÑе объектами + var dstfonts = []; + for (var i in map_keys) + { + dstfonts[dstfonts.length] = new CFont(i, 0, "", 0, map_keys[i]); + } + this.m_oWordControl.m_oLogicDocument.Fonts = dstfonts; + */ + } + + // фукнции Ð´Ð»Ñ Ñтарта работы + this.OpenDocument = function() + { + //SetHintsProps(false, false); +// this.m_oDocumentRenderer.InitDocument(this); +// +// this.m_oWordControl.CalculateDocumentSize(); +// this.m_oWordControl.OnScroll(); + } + + // вот здеÑÑŒ веÑÑŒ трекинг + this.DrawTrack = function(type, matrix, left, top, width, height, isLine, canRotate, isNoMove) + { + this.AutoShapesTrack.DrawTrack(type, matrix, left, top, width, height, isLine, canRotate, isNoMove); + } + + this.DrawTrackSelectShapes = function(x, y, w, h) + { + this.AutoShapesTrack.DrawTrackSelectShapes(x, y, w, h); + } + + this.DrawAdjustment = function(matrix, x, y, bTextWarp) + { + this.AutoShapesTrack.DrawAdjustment(matrix, x, y, bTextWarp); + } + + this.LockTrackPageNum = function(nPageNum) + { + this.AutoShapesTrackLockPageNum = nPageNum; + } + this.UnlockTrackPageNum = function() + { + this.AutoShapesTrackLockPageNum = -1; + } + + this.CheckGuiControlColors = function() + { + + } + + this.SendControlColors = function() + { + + } + + this.SendThemeColorScheme = function() + { + + } + + this.DrawImageTextureFillShape = function(url) + { + + } + + + this.DrawImageTextureFillTextArt = function(url) + { + + } + + + + this.InitGuiCanvasShape = function(div_id) + { + + } + + this.InitGuiCanvasTextProps = function(div_id) + { + + } + + this.InitGuiCanvasTextArt = function(div_id) + { + + } + + this.DrawGuiCanvasTextProps = function(props) + { + + }; + + this.CheckTableStyles = function(tableLook) + { + // Ñначала проверим, подпиÑан ли кто на Ñтот евент + // а то во вьюере не Ñтоит ничего поÑылать +// if (!this.m_oWordControl.m_oApi.asc_checkNeedCallback("asc_onInitTableTemplates")) +// return; + + var bIsChanged = false; + if (null == this.TableStylesLastLook) + { + this.TableStylesLastLook = new CTablePropLook(); + + this.TableStylesLastLook.FirstCol = tableLook.FirstCol; + this.TableStylesLastLook.FirstRow = tableLook.FirstRow; + this.TableStylesLastLook.LastCol = tableLook.LastCol; + this.TableStylesLastLook.LastRow = tableLook.LastRow; + this.TableStylesLastLook.BandHor = tableLook.BandHor; + this.TableStylesLastLook.BandVer = tableLook.BandVer; + bIsChanged = true; + } + else + { + if (this.TableStylesLastLook.FirstCol != tableLook.FirstCol) + { + this.TableStylesLastLook.FirstCol = tableLook.FirstCol; + bIsChanged = true; + } + if (this.TableStylesLastLook.FirstRow != tableLook.FirstRow) + { + this.TableStylesLastLook.FirstRow = tableLook.FirstRow; + bIsChanged = true; + } + if (this.TableStylesLastLook.LastCol != tableLook.LastCol) + { + this.TableStylesLastLook.LastCol = tableLook.LastCol; + bIsChanged = true; + } + if (this.TableStylesLastLook.LastRow != tableLook.LastRow) + { + this.TableStylesLastLook.LastRow = tableLook.LastRow; + bIsChanged = true; + } + if (this.TableStylesLastLook.BandHor != tableLook.BandHor) + { + this.TableStylesLastLook.BandHor = tableLook.BandHor; + bIsChanged = true; + } + if (this.TableStylesLastLook.BandVer != tableLook.BandVer) + { + this.TableStylesLastLook.BandVer = tableLook.BandVer; + bIsChanged = true; + } + } + + if (!bIsChanged) + return; + + var logicDoc = this.m_oWordControl.m_oLogicDocument; + var _dst_styles = []; + + var _styles = logicDoc.Styles.Get_AllTableStyles(); + var _styles_len = _styles.length; + + if (_styles_len == 0) + return _dst_styles; + + var _x_mar = 10; + var _y_mar = 10; + var _r_mar = 10; + var _b_mar = 10; + var _pageW = 297; + var _pageH = 210; + + var W = (_pageW - _x_mar - _r_mar); + var H = (_pageH - _y_mar - _b_mar); + var Grid = []; + + var Rows = 5; + var Cols = 5; + + for (var i = 0; i < Cols; i++) + Grid[i] = W / Cols; + + var _canvas = document.createElement('canvas'); + _canvas.width = TABLE_STYLE_WIDTH_PIX; + _canvas.height = TABLE_STYLE_HEIGHT_PIX; + var ctx = _canvas.getContext('2d'); + + History.TurnOff(); + for (var i1 = 0; i1 < _styles_len; i1++) + { + var i = _styles[i1]; + var _style = logicDoc.Styles.Style[i]; + + if (!_style || _style.Type != styletype_Table) + continue; + + var table = new CTable(this, logicDoc, true, 0, _x_mar, _y_mar, 1000, 1000, Rows, Cols, Grid); + table.Set_Props({TableStyle : i, TableLook : tableLook}); + + for (var j = 0; j < Rows; j++) + table.Content[j].Set_Height(H / Rows, heightrule_AtLeast); + + ctx.fillStyle = "#FFFFFF"; + ctx.fillRect(0, 0, _canvas.width, _canvas.height); + + var graphics = new CGraphics(); + graphics.init(ctx, _canvas.width, _canvas.height, _pageW, _pageH); + graphics.m_oFontManager = g_fontManager; + graphics.transform(1,0,0,1,0,0); + + table.Recalculate_Page(0); + table.Draw(0, graphics); + + var _styleD = new CAscTableStyle(); + _styleD.Type = 0; + _styleD.Image = _canvas.toDataURL("image/png"); + _styleD.Id = i; + _dst_styles.push(_styleD); + } + History.TurnOn(); + + this.m_oWordControl.m_oApi.sync_InitEditorTableStyles(_dst_styles); + } + + this.IsMobileVersion = function() + { + return this.IsMobile; + } + + this.OnSelectEnd = function() + { + + } +} + +function CStyleImage(_name, _ind, _type, _uiPriority) +{ + this.Name = _name; + this.ThumbnailOffset = _ind; + this.Type = _type; + this.uiPriority = _uiPriority; +} +function CStylesPainter() +{ + // base64 defaultStyles image + this.defaultStylesImage = ""; + this.defaultStyles = null; + + this.docStylesImage = ""; + this.docStyles = null; + + this.mergedStyles = null; + + this.STYLE_THUMBNAIL_WIDTH = 80; + this.STYLE_THUMBNAIL_HEIGHT = 40; + + this.CurrentTranslate = null; + + this.GenerateStyles = function(_api, ds) + { + this.CurrentTranslate = _api.CurrentTranslate; + + this.GenerateDefaultStyles(_api, ds); + this.GenerateDocumentStyles(_api); + + // Ñтили Ñформированы. оÑталоÑÑŒ проÑто Ñформировать единый ÑпиÑок + var _count_default = this.defaultStyles.length; + var _count_doc = 0; + if (null != this.docStyles) + _count_doc = this.docStyles.length; + + var aPriorityStyles = []; + var fAddToPriorityStyles = function(style){ + var index = style.uiPriority; + if(null == index) + index = 0; + var aSubArray = aPriorityStyles[index]; + if(null == aSubArray) + { + aSubArray = []; + aPriorityStyles[index] = aSubArray; + } + aSubArray.push(style); + } + var _map_document = {}; + + for (var i = 0; i < _count_doc; i++) + { + var style = this.docStyles[i]; + _map_document[style.Name] = 1; + fAddToPriorityStyles(style); + } + + for (var i = 0; i < _count_default; i++) + { + var style = this.defaultStyles[i]; + if(null == _map_document[style.Name]) + fAddToPriorityStyles(style); + } + + this.mergedStyles = []; + for(var index in aPriorityStyles) + { + var aSubArray = aPriorityStyles[index]; + aSubArray.sort(function(a, b){ + if(a.Name < b.Name) + return -1; + else if(a.Name > b.Name) + return 1; + else + return 0; + }); + for(var i = 0, length = aSubArray.length; i < length; ++i) + { + this.mergedStyles.push(aSubArray[i]); + } + } + + // теперь проÑто отдаем евент наверх + _api.sync_InitEditorStyles(this); + } + this.GenerateDefaultStyles = function(_api, ds) + { + var styles = ds; + var _count = 0; + for (var i in styles) + _count++; + + var cur_index = 0; + + if (false) + { + this.defaultStylesImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAAIIC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dn/QdgJYIWJo7BjoALRGwNHcMdABaImBp7hjoALREwNL8hTMwPLQZlnP2mIfHWJxOxOlERCdmOp2I04k4nYgOrk4n4nQinl3W6UQUFE4n4nQiTifidCJeX12cTiS8vseF03te+HfhcBr3/5nXOAAtl8IBGJ4AKoFxyNsgLDv4N5s7nYjl6rrsLAegJQKW5o6BDkBLBCzNHQMdgJYIWJo7BjoALRGwNHcMdABaImBp7hgY3gA6nUjYEHU6kbDh5fdpZA7/D6lBP7dW50kUAAAAAElFTkSuQmCC"; + this.defaultStyles = []; + for (var i in styles) + { + this.defaultStyles[cur_index] = new CStyleImage(styles[i].Name, cur_index, c_oAscStyleImage.Default); + cur_index++; + } + + return; + } + + // добавили переводы => Ð½ÐµÐ»ÑŒÐ·Ñ ÐºÑшировать + + var _canvas = document.createElement('canvas'); + _canvas.width = this.STYLE_THUMBNAIL_WIDTH; + _canvas.height = _count * this.STYLE_THUMBNAIL_HEIGHT; + var ctx = _canvas.getContext('2d'); + + ctx.fillStyle = "#FFFFFF"; + ctx.fillRect(0, 0, _canvas.width, _canvas.height); + + var graphics = new CGraphics(); + graphics.init(ctx, _canvas.width, _canvas.height, _canvas.width * g_dKoef_pix_to_mm, _canvas.height * g_dKoef_pix_to_mm); + graphics.m_oFontManager = g_fontManager; + + this.defaultStyles = []; + for (var i in styles) + { + var style = styles[i]; + if(true == style.qFormat) + { + this.drawStyle(graphics, style, cur_index); + this.defaultStyles[cur_index] = new CStyleImage(style.Name, cur_index, c_oAscStyleImage.Default, style.uiPriority); + cur_index++; + } + } + + this.defaultStylesImage = _canvas.toDataURL("image/png"); + } + + this.GenerateDocumentStyles = function(_api) + { + if (_api.WordControl.m_oLogicDocument == null) + return; + + var __Styles = _api.WordControl.m_oLogicDocument.Get_Styles(); + var styles = __Styles.Style; + + if (styles == null) + return; + + var _count = 0; + for (var i in styles) + _count++; + if (0 == _count) + return; + + var cur_index = 0; + + var _canvas = document.createElement('canvas'); + _canvas.width = this.STYLE_THUMBNAIL_WIDTH; + _canvas.height = _count * this.STYLE_THUMBNAIL_HEIGHT; + var ctx = _canvas.getContext('2d'); + + ctx.fillStyle = "#FFFFFF"; + ctx.fillRect(0, 0, _canvas.width, _canvas.height); + + var graphics = new CGraphics(); + graphics.init(ctx, _canvas.width, _canvas.height, _canvas.width * g_dKoef_pix_to_mm, _canvas.height * g_dKoef_pix_to_mm); + graphics.m_oFontManager = g_fontManager; + + this.docStyles = []; + for (var i in styles) + { + var style = styles[i]; + if(true == style.qFormat) + { + // как только менÑетÑÑ Ñериалайзер - менÑетÑÑ Ð¸ код здеÑÑŒ. Да, не очень удобно, + // зато быÑтро делаетÑÑ + var formalStyle = i.toLowerCase().replace(/\s/g, ""); + var res = formalStyle.match(/^heading([1-9][0-9]*)$/); + var index = (res) ? res[1] - 1 : -1; + + this.drawStyle(graphics, __Styles.Get_Pr(i, styletype_Paragraph), cur_index); + this.docStyles[cur_index] = new CStyleImage(style.Name, cur_index, c_oAscStyleImage.Document, style.uiPriority); + + // алгоритм Ñмены имени + if (style.Default) + { + switch (style.Default) + { + case 1: + break; + case 2: + this.docStyles[cur_index].Name = "No List"; + break; + case 3: + this.docStyles[cur_index].Name = "Normal"; + break; + case 4: + this.docStyles[cur_index].Name = "Normal Table"; + break; + } + } + else if (index != -1) + { + this.docStyles[cur_index].Name = "Heading ".concat(index + 1); + } + + cur_index++; + } + } + + this.docStylesImage = _canvas.toDataURL("image/png"); + } + + this.drawStyle = function(graphics, style, index) + { + var font = { FontFamily : { Name: "Times New Roman", Index : -1 }, Color : { r : 0, g : 0, b : 0 }, Bold : false, Italic : false, FontSize : 10 }; + + var textPr = style.TextPr; + if (textPr.FontFamily != undefined) + { + font.FontFamily.Name = textPr.FontFamily.Name; + font.FontFamily.Index = textPr.FontFamily.Index; + } + + if (textPr.Bold != undefined) + font.Bold = textPr.Bold; + if (textPr.Italic != undefined) + font.Italic = textPr.Italic; + + if (textPr.FontSize != undefined) + font.FontSize = textPr.FontSize; + + graphics.SetFont(font); + + if (textPr.Color == undefined) + graphics.b_color1(0, 0, 0, 255); + else + graphics.b_color1(textPr.Color.r, textPr.Color.g, textPr.Color.b, 255); + + var y = index * g_dKoef_pix_to_mm * this.STYLE_THUMBNAIL_HEIGHT; + var b = (index + 1) * g_dKoef_pix_to_mm * this.STYLE_THUMBNAIL_HEIGHT; + var w = g_dKoef_mm_to_pix * this.STYLE_THUMBNAIL_WIDTH; + + graphics.transform(1,0,0,1,0,0); + graphics.save(); + graphics._s(); + graphics._m(-0.5, y); + graphics._l(w, y); + graphics._l(w, b); + graphics._l(0, b); + graphics._z(); + graphics.clip(); + + graphics.t(this.CurrentTranslate.StylesText, 0.5, (y + b) / 2); + + var ctx = graphics.m_oContext; + ctx.setTransform(1,0,0,1,0,0); + ctx.fillStyle = "#E8E8E8"; + + var _b = (index + 1) * this.STYLE_THUMBNAIL_HEIGHT - 1.5; + var _x = 2; + var _w = this.STYLE_THUMBNAIL_WIDTH - 4; + var _h = parseInt(this.STYLE_THUMBNAIL_HEIGHT / 3); + ctx.beginPath(); + ctx.moveTo(_x, _b - _h); + ctx.lineTo(_x + _w, _b - _h); + ctx.lineTo(_x + _w, _b); + ctx.lineTo(_x, _b); + ctx.closePath(); + ctx.fill(); + + ctx.lineWidth = 1; + ctx.strokeStyle = "#D8D8D8"; + ctx.beginPath(); + ctx.rect(0.5, index * this.STYLE_THUMBNAIL_HEIGHT + 0.5, this.STYLE_THUMBNAIL_WIDTH - 1, this.STYLE_THUMBNAIL_HEIGHT - 1); + + ctx.stroke(); + + graphics.restore(); + } +} \ No newline at end of file diff --git a/Excel/native/Overlay.js b/Excel/native/Overlay.js new file mode 100644 index 000000000..b343a1473 --- /dev/null +++ b/Excel/native/Overlay.js @@ -0,0 +1,3017 @@ +"use strict"; + +var TRACK_CIRCLE_RADIUS = 5; +var TRACK_RECT_SIZE2 = 4; +var TRACK_RECT_SIZE = 8; +var TRACK_DISTANCE_ROTATE = 25; +var TRACK_DISTANCE_ROTATE2 = 25; +var TRACK_ADJUSTMENT_SIZE = 10; +var TRACK_WRAPPOINTS_SIZE = 6; +var IMAGE_ROTATE_TRACK_W = 21; + +var bIsUseImageRotateTrack = true; +if (bIsUseImageRotateTrack) +{ + window.g_track_rotate_marker = new Image(); + window.g_track_rotate_marker.asc_complete = false; + window.g_track_rotate_marker.onload = function(){ + window.g_track_rotate_marker.asc_complete = true; + }; + window.g_track_rotate_marker.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAMAAACeyVWkAAAAVFBMVEUAAAD///////////////////////////////////////////////////////98fHy2trb09PTT09OysrKqqqqJiYng4ODr6+uamprGxsbi4uKGhoYjgM0eAAAADnRSTlMAy00k7/z0jbeuMzDljsugwZgAAACpSURBVBjTdZHbEoMgDESDAl6bgIqX9v//s67UYpm6D0xyYMImoaiuUr3pVdVRUtnwqaY8YaE5SRcfaPgqc+DSIh7WIGGaEVoUqRGN4oZlcDIiqYlaPjQz5CNu6cFJwLiuSO3nlLBDrKhn3l4rcnH4NcAdGd5EZMfCsoMFBxM6CD57G+u6vC48PMVnHtrYhP/x+7+3cw7zdJnD3cyA7QXa4nYXaW+a9Xdvb6zqE5Jb7LmzAAAAAElFTkSuQmCC"; + + TRACK_DISTANCE_ROTATE2 = 18; +} + +// заглушка +function CHtmlPage() +{ + var drawingPage = { top: 0, left: 0, right: 0, bottom: 0 }; + var width_mm, height_mm; + + this.init = function(x, y, w_pix, h_pix, w_mm, h_mm) { + drawingPage.top = y; + drawingPage.left = x; + drawingPage.right = w_pix; + drawingPage.bottom = h_pix; + width_mm = w_mm; + height_mm = h_mm; + } + + this.GetDrawingPageInfo = function() { + + return { drawingPage: drawingPage, width_mm: width_mm, height_mm: height_mm }; + } +} + +function COverlay() +{ + this.m_oControl = null; + this.m_oContext = null; + + this.min_x = 0xFFFF; + this.min_y = 0xFFFF; + this.max_x = -0xFFFF; + this.max_y = -0xFFFF; + + this.m_bIsShow = false; + this.m_bIsAlwaysUpdateOverlay = false; + + this.m_oHtmlPage = null; +} + +COverlay.prototype = +{ + init : function(context, controlName, x, y, w_pix, h_pix, w_mm, h_mm) + { + this.m_oContext = context; +// this.m_oControl = CreateControl(controlName); +// +// this.m_oHtmlPage = new CHtmlPage(); +// this.m_oHtmlPage.init(x, y, w_pix, h_pix, w_mm, h_mm); + }, + + Clear : function() + { +// if (null == this.m_oContext) +// { +// this.m_oContext = this.m_oControl.HtmlElement.getContext('2d'); +// +// this.m_oContext.imageSmoothingEnabled = false; +// this.m_oContext.mozImageSmoothingEnabled = false; +// this.m_oContext.oImageSmoothingEnabled = false; +// this.m_oContext.webkitImageSmoothingEnabled = false; +// } +// +// this.m_oContext.beginPath(); +// if (this.max_x != -0xFFFF && this.max_y != -0xFFFF) +// { +// this.m_oContext.clearRect(this.min_x - 5, this.min_y - 5, this.max_x - this.min_x + 10, this.max_y - this.min_y + 10); +// } + this.min_x = 0xFFFF; + this.min_y = 0xFFFF; + this.max_x = -0xFFFF; + this.max_y = -0xFFFF; + }, + + Show : function() + { +// if (this.m_bIsShow) +// return; +// +// this.m_bIsShow = true; +// this.m_oControl.HtmlElement.style.display = "block"; + }, + UnShow : function() + { +// if (!this.m_bIsShow) +// return; +// +// this.m_bIsShow = false; +// this.m_oControl.HtmlElement.style.display = "none"; + }, + + VertLine : function(position) + { +// this.Clear(); +// if (this.m_bIsAlwaysUpdateOverlay || editor.WordControl.m_oDrawingDocument.m_bIsSelection) +// { +// if (!editor.WordControl.OnUpdateOverlay()) +// { +// editor.WordControl.EndUpdateOverlay(); +// } +// } +// +// if (this.min_x > position) +// this.min_x = position; +// if (this.max_x < position) +// this.max_x = position; +// +// //this.min_x = position; +// //this.max_x = position; +// this.min_y = 0; +// this.max_y = this.m_oControl.HtmlElement.height; +// +// this.m_oContext.lineWidth = 1; +// +// var x = ((position + 0.5) >> 0) + 0.5; +// var y = 0; +// +// this.m_oContext.strokeStyle = "#000000"; +// this.m_oContext.beginPath(); +// +// while (y < this.max_y) +// { +// this.m_oContext.moveTo(x, y); y++; +// this.m_oContext.lineTo(x, y); y+=1; +// this.m_oContext.moveTo(x, y); y++; +// this.m_oContext.lineTo(x, y); y+=1; +// this.m_oContext.moveTo(x, y); y++; +// this.m_oContext.lineTo(x, y); y++; +// +// y += 5; +// } +// +// this.m_oContext.stroke(); +// +// y = 1; +// this.m_oContext.strokeStyle = "#FFFFFF"; +// this.m_oContext.beginPath(); +// +// while (y < this.max_y) +// { +// this.m_oContext.moveTo(x, y); y++; +// this.m_oContext.lineTo(x, y); y+=1; +// this.m_oContext.moveTo(x, y); y++; +// this.m_oContext.lineTo(x, y); y+=1; +// this.m_oContext.moveTo(x, y); y++; +// this.m_oContext.lineTo(x, y); y++; +// +// y += 5; +// } +// +// this.m_oContext.stroke(); +// this.Show(); + }, + + HorLine : function(position) + { +// this.Clear(); +// if (this.m_bIsAlwaysUpdateOverlay || editor.WordControl.m_oDrawingDocument.m_bIsSelection) +// { +// if (!editor.WordControl.OnUpdateOverlay()) +// { +// editor.WordControl.EndUpdateOverlay(); +// } +// } +// +// this.min_x = 0; +// this.max_x = this.m_oControl.HtmlElement.width; +// +// //this.min_y = position; +// //this.max_y = position; +// if (this.min_y > position) +// this.min_y = position; +// if (this.max_y < position) +// this.max_y = position; +// +// this.m_oContext.lineWidth = 1; +// +// var y = ((position + 0.5) >> 0) + 0.5; +// var x = 0; +// +// this.m_oContext.strokeStyle = "#000000"; +// this.m_oContext.beginPath(); +// +// while (x < this.max_x) +// { +// this.m_oContext.moveTo(x, y); x++; +// this.m_oContext.lineTo(x, y); x+=1; +// this.m_oContext.moveTo(x, y); x++; +// this.m_oContext.lineTo(x, y); x+=1; +// this.m_oContext.moveTo(x, y); x++; +// this.m_oContext.lineTo(x, y); x++; +// +// x += 5; +// } +// +// this.m_oContext.stroke(); +// +// x = 1; +// this.m_oContext.strokeStyle = "#FFFFFF"; +// this.m_oContext.beginPath(); +// +// while (x < this.max_x) +// { +// this.m_oContext.moveTo(x, y); x++; +// this.m_oContext.lineTo(x, y); x+=1; +// this.m_oContext.moveTo(x, y); x++; +// this.m_oContext.lineTo(x, y); x+=1; +// this.m_oContext.moveTo(x, y); x++; +// this.m_oContext.lineTo(x, y); x++; +// +// x += 5; +// } +// +// this.m_oContext.stroke(); +// this.Show(); + }, + + CheckPoint1 : function(x,y) + { + if (x < this.min_x) + this.min_x = x; + if (y < this.min_y) + this.min_y = y; + }, + CheckPoint2 : function(x,y) + { + if (x > this.max_x) + this.max_x = x; + if (y > this.max_y) + this.max_y = y; + }, + CheckPoint : function(x,y) + { + if (x < this.min_x) + this.min_x = x; + if (y < this.min_y) + this.min_y = y; + if (x > this.max_x) + this.max_x = x; + if (y > this.max_y) + this.max_y = y; + }, + + AddRect2 : function(x,y,r) + { + console.log('AddRect2!!!!!!!!!!!!'); +// var _x = x - ((r / 2) >> 0); +// var _y = y - ((r / 2) >> 0); +// this.CheckPoint1(_x,_y); +// this.CheckPoint2(_x+r,_y+r); +// +// this.m_oContext.moveTo(_x,_y); +// this.m_oContext.rect(_x,_y,r,r); + }, + + AddRect3 : function(x,y,r, ex1, ey1, ex2, ey2) + { + console.log('AddRect2!!!!!!!!!!!!'); + +// var _r = r / 2; +// +// var x1 = x + _r * (ex2 - ex1); +// var y1 = y + _r * (ey2 - ey1); +// +// var x2 = x + _r * (ex2 + ex1); +// var y2 = y + _r * (ey2 + ey1); +// +// var x3 = x + _r * (-ex2 + ex1); +// var y3 = y + _r * (-ey2 + ey1); +// +// var x4 = x + _r * (-ex2 - ex1); +// var y4 = y + _r * (-ey2 - ey1); +// +// this.CheckPoint(x1,y1); +// this.CheckPoint(x2,y2); +// this.CheckPoint(x3,y3); +// this.CheckPoint(x4,y4); +// +// var ctx = this.m_oContext; +// ctx.moveTo(x1,y1); +// ctx.lineTo(x2,y2); +// ctx.lineTo(x3,y3); +// ctx.lineTo(x4,y4); +// ctx.closePath(); + }, + + AddRect : function(x,y,w,h) + { + console.log('AddRect!!!!!!!!!!!!'); + +// this.CheckPoint1(x,y); +// this.CheckPoint2(x + w,y + h); +// +// this.m_oContext.moveTo(x,y); +// this.m_oContext.rect(x,y,w,h); +// //this.m_oContext.closePath(); + }, + CheckRectT : function(x,y,w,h,trans,eps) + { + var x1 = trans.TransformPointX(x, y); + var y1 = trans.TransformPointY(x, y); + + var x2 = trans.TransformPointX(x+w, y); + var y2 = trans.TransformPointY(x+w, y); + + var x3 = trans.TransformPointX(x+w, y+h); + var y3 = trans.TransformPointY(x+w, y+h); + + var x4 = trans.TransformPointX(x, y+h); + var y4 = trans.TransformPointY(x, y+h); + + this.CheckPoint(x1, y1); + this.CheckPoint(x2, y2); + this.CheckPoint(x3, y3); + this.CheckPoint(x4, y4); + + if (eps !== undefined) + { + this.min_x -= eps; + this.min_y -= eps; + this.max_x += eps; + this.max_y += eps; + } + }, + CheckRect : function(x,y,w,h) + { + this.CheckPoint1(x,y); + this.CheckPoint2(x + w,y + h); + }, + AddEllipse : function(x,y,r) + { + this.CheckPoint1(x-r,y-r); + this.CheckPoint2(x+r,y+r); + + console.log('AddEllipse!!!!!!!!!!!!'); + +// this.m_oContext.moveTo(x+r,y); +// this.m_oContext.arc(x,y,r,0,Math.PI*2,false); +// //this.m_oContext.closePath(); + }, + + AddRoundRect : function(x, y, w, h, r) + { + console.log('AddRoundRect!!!!!!!!!!!!'); + + +// if (w < (2 * r) || h < (2 * r)) +// return this.AddRect(x, y, w, h); +// +// this.CheckPoint1(x,y); +// this.CheckPoint2(x + w,y + h); +// +// var _ctx = this.m_oContext; +// _ctx.moveTo(x + r, y); +// _ctx.lineTo(x + w - r, y); +// _ctx.quadraticCurveTo(x + w, y, x + w, y + r); +// _ctx.lineTo(x + w, y + h - r); +// _ctx.quadraticCurveTo(x + w, y + h, x + w - r, y + h); +// _ctx.lineTo(x + r, y + h); +// _ctx.quadraticCurveTo(x, y + h, x, y + h - r); +// _ctx.lineTo(x, y + r); +// _ctx.quadraticCurveTo(x, y, x + r, y); + }, + + AddRoundRectCtx : function(ctx, x, y, w, h, r) + { + console.log('AddRoundRectCtx!!!!!!!!!!!!'); + + // if (w < (2 * r) || h < (2 * r)) + // return ctx.rect(x, y, w, h); + +// var _ctx = this.m_oContext; +// _ctx.moveTo(x + r, y); +// _ctx.lineTo(x + w - r, y); +// _ctx.quadraticCurveTo(x + w, y, x + w, y + r); +// _ctx.lineTo(x + w, y + h - r); +// _ctx.quadraticCurveTo(x + w, y + h, x + w - r, y + h); +// _ctx.lineTo(x + r, y + h); +// _ctx.quadraticCurveTo(x, y + h, x, y + h - r); +// _ctx.lineTo(x, y + r); +// _ctx.quadraticCurveTo(x, y, x + r, y); + } +}; + +function CBoundsController() +{ + this.min_x = 0xFFFF; + this.min_y = 0xFFFF; + this.max_x = -0xFFFF; + this.max_y = -0xFFFF; +} + +CBoundsController.prototype = +{ + ClearNoAttack : function() + { + this.min_x = 0xFFFF; + this.min_y = 0xFFFF; + this.max_x = -0xFFFF; + this.max_y = -0xFFFF; + }, + + Clear : function(ctx) + { + if (this.max_x != -0xFFFF && this.max_y != -0xFFFF) + { + ctx.fillRect(this.min_x - 5, this.min_y - 5, this.max_x - this.min_x + 10, this.max_y - this.min_y + 10); + } + this.min_x = 0xFFFF; + this.min_y = 0xFFFF; + this.max_x = -0xFFFF; + this.max_y = -0xFFFF; + }, + + CheckPoint1 : function(x,y) + { + if (x < this.min_x) + this.min_x = x; + if (y < this.min_y) + this.min_y = y; + }, + CheckPoint2 : function(x,y) + { + if (x > this.max_x) + this.max_x = x; + if (y > this.max_y) + this.max_y = y; + }, + CheckPoint : function(x,y) + { + if (x < this.min_x) + this.min_x = x; + if (y < this.min_y) + this.min_y = y; + if (x > this.max_x) + this.max_x = x; + if (y > this.max_y) + this.max_y = y; + }, + CheckRect : function(x,y,w,h) + { + this.CheckPoint1(x,y); + this.CheckPoint2(x + w,y + h); + } +}; + +function CAutoshapeTrack() +{ + this.m_oContext = null; + this.m_oOverlay = null; + + this.Graphics = null; + + this.MaxEpsLine = 0; + this.IsTrack = true; + + this.PageIndex = -1; + this.CurrentPageInfo = null; + + this.Native = window["native"]["CreateAutoShapesTrackControl"](); +} + +CAutoshapeTrack.prototype = +{ + SetFont : function(font) + { + }, + + init : function(overlay, x, y, r, b, w_mm, h_mm) + { + this.m_oOverlay = overlay; + this.m_oContext = this.m_oOverlay.m_oContext; + + this.Graphics = new CGraphics(); + this.Graphics.init(this.m_oContext, r - x, b - y, w_mm, h_mm); + + this.Graphics.m_oCoordTransform.tx = x; + this.Graphics.m_oCoordTransform.ty = y; + + this.Graphics.SetIntegerGrid(false); + + this.m_oContext.globalAlpha = 0.5; + }, + SetIntegerGrid : function(b) + { + //this.Native["PD_SetIntegerGrid"](param); + }, + // draw styles + p_color : function(r,g,b,a) + { + this.Native["PD_p_color"](r,g,b,a); + }, + p_width : function(w) + { + this.Native["PD_p_width"](w); + +// this.Graphics.p_width(w); +// +// var xx1 = 0; +// var yy1 = 0; +// var xx2 = 1; +// var yy2 = 1; +// +// var xxx1 = this.Graphics.m_oFullTransform.TransformPointX(xx1, yy1); +// var yyy1 = this.Graphics.m_oFullTransform.TransformPointY(xx1, yy1); +// var xxx2 = this.Graphics.m_oFullTransform.TransformPointX(xx2, yy2); +// var yyy2 = this.Graphics.m_oFullTransform.TransformPointY(xx2, yy2); +// +// var _len2 = ((xxx2 - xxx1)*(xxx2 - xxx1) + (yyy2 - yyy1)*(yyy2 - yyy1)); +// var koef = Math.sqrt(_len2 / 2); +// +// var _EpsLine = (w * koef / 1000) >> 0; +// _EpsLine += 5; +// +// if (_EpsLine > this.MaxEpsLine) +// this.MaxEpsLine = _EpsLine; + }, + b_color1 : function(r,g,b,a) + { + this.Native["PD_b_color1"](r,g,b,a); + //this.Graphics.b_color1(r,g,b,a); + }, + b_color2 : function(r,g,b,a) + { + this.Native["PD_b_color2"](r,g,b,a); + }, + + // path commands + _s : function() + { + this.Native["PD_PathStart"](); + }, + _e : function() + { + this.Native["PD_PathEnd"](); + }, + _z : function() + { + this.Native["PD_PathClose"](); + }, + _m : function(x,y) + { + this.Native["PD_PathMoveTo"](x,y); + +// this.Graphics._m(x,y); +// +// var _x = this.Graphics.m_oFullTransform.TransformPointX(x,y); +// var _y = this.Graphics.m_oFullTransform.TransformPointY(x,y); +// this.m_oOverlay.CheckPoint(_x, _y); + }, + _l : function(x,y) + { + this.Native["PD_PathLineTo"](x,y); + +// this.Graphics._l(x,y); +// +// var _x = this.Graphics.m_oFullTransform.TransformPointX(x,y); +// var _y = this.Graphics.m_oFullTransform.TransformPointY(x,y); +// this.m_oOverlay.CheckPoint(_x, _y); + }, + _c : function(x1,y1,x2,y2,x3,y3) + { + this.Native["PD_PathCurveTo"](x1,y1,x2,y2,x3,y3); + +// this.Graphics._c(x1,y1,x2,y2,x3,y3); +// +// var _x1 = this.Graphics.m_oFullTransform.TransformPointX(x1,y1); +// var _y1 = this.Graphics.m_oFullTransform.TransformPointY(x1,y1); +// +// var _x2 = this.Graphics.m_oFullTransform.TransformPointX(x2,y2); +// var _y2 = this.Graphics.m_oFullTransform.TransformPointY(x2,y2); +// +// var _x3 = this.Graphics.m_oFullTransform.TransformPointX(x3,y3); +// var _y3 = this.Graphics.m_oFullTransform.TransformPointY(x3,y3); +// +// this.m_oOverlay.CheckPoint(_x1, _y1); +// this.m_oOverlay.CheckPoint(_x2, _y2); +// this.m_oOverlay.CheckPoint(_x3, _y3); + }, + _c2 : function(x1,y1,x2,y2) + { + this.Native["PD_PathCurveTo2"](x1,y1,x2,y2); + +// this.Graphics._c2(x1,y1,x2,y2); +// +// var _x1 = this.Graphics.m_oFullTransform.TransformPointX(x1,y1); +// var _y1 = this.Graphics.m_oFullTransform.TransformPointY(x1,y1); +// +// var _x2 = this.Graphics.m_oFullTransform.TransformPointX(x2,y2); +// var _y2 = this.Graphics.m_oFullTransform.TransformPointY(x2,y2); +// +// this.m_oOverlay.CheckPoint(_x1, _y1); +// this.m_oOverlay.CheckPoint(_x2, _y2); + }, + ds : function() + { + this.Native["PD_Stroke"](); + // this.Graphics.ds(); + }, + df : function() + { + this.Native["PD_Fill"](); + //this.Graphics.df(); + }, + + // canvas state + save : function() + { + this.Native["PD_Save"](); + }, + restore : function() + { + this.Native["PD_Restore"](); + }, + clip : function() + { + this.Native["PD_clip"](); + }, + + // transform + reset : function() + { + this.Native["PD_reset"](); + }, + transform3 : function(m) + { + var isNeedInvert = false; + this.Native["PD_transform3"](m.sx,m.shy,m.shx,m.sy,m.tx,m.ty,isNeedInvert); + }, + transform : function(sx,shy,shx,sy,tx,ty) + { + this.Native["PD_transform"](sx,shy,shx,sy,tx,ty); + }, + drawImage : function(image, x, y, w, h, alpha, srcRect, nativeImage) + { + if (!srcRect) + return this.Native["PD_drawImage"](image,x,y,w,h,alpha); + + return this.Native["PD_drawImage"](image,x,y,w,h,alpha,srcRect.l,srcRect.t,srcRect.r,srcRect.b); + +// this.Graphics.drawImage(image, x, y, w, h, undefined, srcRect, nativeImage); +// +// var _x1 = this.Graphics.m_oFullTransform.TransformPointX(x,y); +// var _y1 = this.Graphics.m_oFullTransform.TransformPointY(x,y); +// +// var _x2 = this.Graphics.m_oFullTransform.TransformPointX(x+w,y); +// var _y2 = this.Graphics.m_oFullTransform.TransformPointY(x+w,y); +// +// var _x3 = this.Graphics.m_oFullTransform.TransformPointX(x+w,(y+h)); +// var _y3 = this.Graphics.m_oFullTransform.TransformPointY(x+w,(y+h)); +// +// var _x4 = this.Graphics.m_oFullTransform.TransformPointX(x,(y+h)); +// var _y4 = this.Graphics.m_oFullTransform.TransformPointY(x,(y+h)); +// +// this.m_oOverlay.CheckPoint(_x1, _y1); +// this.m_oOverlay.CheckPoint(_x2, _y2); +// this.m_oOverlay.CheckPoint(_x3, _y3); +// this.m_oOverlay.CheckPoint(_x4, _y4); + }, + CorrectOverlayBounds : function() + { + this.Native["DD_CorrectOverlayBounds"](); + +// this.m_oContext.setTransform(1,0,0,1,0,0); +// +// this.m_oOverlay.min_x -= this.MaxEpsLine; +// this.m_oOverlay.min_y -= this.MaxEpsLine; +// this.m_oOverlay.max_x += this.MaxEpsLine; +// this.m_oOverlay.max_y += this.MaxEpsLine; + }, + + SetCurrentPage : function(nPageIndex) + { + this.PageIndex = nPageIndex; + this.Native["DD_SetCurrentPage"](nPageIndex); + +// if (nPageIndex == this.PageIndex) +// return; +// +// var oPage = this.m_oOverlay.m_oHtmlPage.GetDrawingPageInfo(nPageIndex); +// this.PageIndex = nPageIndex; +// +// var drawPage = oPage.drawingPage; +// +// this.Graphics = new CGraphics(); +// this.Graphics.init(this.m_oContext, drawPage.right - drawPage.left, drawPage.bottom - drawPage.top, oPage.width_mm, oPage.height_mm); +// +// this.Graphics.m_oCoordTransform.tx = drawPage.left; +// this.Graphics.m_oCoordTransform.ty = drawPage.top; +// +// this.Graphics.SetIntegerGrid(false); +// +// this.m_oContext.globalAlpha = 0.5; + }, + + init2 : function(overlay) + { + //this.m_oOverlay = overlay; + //this.m_oContext = this.m_oOverlay.m_oContext; + //this.PageIndex = -1; + }, + + SetClip : function(r) + { + this.Native["PD_SetClip"](r.x, r.y, r.w, r.h); + }, + RemoveClip : function() + { + this.Native["PD_RemoveClip"](); + }, + + SavePen : function() + { + this.Native["PD_SavePen"](); + }, + RestorePen : function() + { + this.Native["PD_RestorePen"](); + }, + + SaveBrush : function() + { + this.Native["PD_SaveBrush"](); + }, + RestoreBrush : function() + { + this.Native["PD_RestoreBrush"](); + }, + + SavePenBrush : function() + { + this.Native["PD_SavePenBrush"](); + }, + RestorePenBrush : function() + { + this.Native["PD_RestorePenBrush"](); + }, + + SaveGrState : function() + { + this.Native["PD_SaveGrState"](); + }, + RestoreGrState : function() + { + this.Native["PD_RestoreGrState"](); + }, + + StartClipPath : function() + { + this.Native["PD_StartClipPath"](); + }, + + EndClipPath : function() + { + this.Native["PD_EndClipPath"](); + }, + + /*************************************************************************/ + /******************************** TRACKS *********************************/ + /*************************************************************************/ + DrawTrack : function(type, matrix, left, top, width, height, isLine, isCanRotate, isNoMove) + { + if (!matrix) + this.Native["DD_DrawTrackTransform"](); + else + this.Native["DD_DrawTrackTransform"](matrix.sx, matrix.shy, matrix.shx, matrix.sy, matrix.tx, matrix.ty); + + this.Native["DD_DrawTrack"](type, left, top, width, height, isLine, isCanRotate); + + +// if (true === isNoMove) +// return; +// +// // Ñ Ñамого начала нужно понÑÑ‚ÑŒ, еÑÑ‚ÑŒ ли поворот. Потому что еÑли его нет, то можно +// // (и нужно!) риÑовать вÑе по-умному +// var overlay = this.m_oOverlay; +// overlay.Show(); +// +// var bIsClever = false; +// this.CurrentPageInfo = overlay.m_oHtmlPage.GetDrawingPageInfo(this.PageIndex); +// +// var drPage = this.CurrentPageInfo.drawingPage; +// +// var xDst = drPage.left + (this.Graphics ? this.Graphics.m_oCoordTransform.tx : 0); +// var yDst = drPage.top + (this.Graphics ? this.Graphics.m_oCoordTransform.ty : 0); +// var wDst = drPage.right - drPage.left; +// var hDst = drPage.bottom - drPage.top; +// +// var dKoefX = wDst / this.CurrentPageInfo.width_mm; +// var dKoefY = hDst / this.CurrentPageInfo.height_mm; +// +// var r = left + width; +// var b = top + height; +// +// // (x1,y1) --------- (x2,y2) +// // | | +// // | | +// // (x3,y3) --------- (x4,y4) +// +// var dx1 = xDst + dKoefX * (matrix.TransformPointX(left, top)); +// var dy1 = yDst + dKoefY * (matrix.TransformPointY(left, top)); +// +// var dx2 = xDst + dKoefX * (matrix.TransformPointX(r, top)); +// var dy2 = yDst + dKoefY * (matrix.TransformPointY(r, top)); +// +// var dx3 = xDst + dKoefX * (matrix.TransformPointX(left, b)); +// var dy3 = yDst + dKoefY * (matrix.TransformPointY(left, b)); +// +// var dx4 = xDst + dKoefX * (matrix.TransformPointX(r, b)); +// var dy4 = yDst + dKoefY * (matrix.TransformPointY(r, b)); +// +// var x1 = dx1 >> 0; +// var y1 = dy1 >> 0; +// +// var x2 = dx2 >> 0; +// var y2 = dy2 >> 0; +// +// var x3 = dx3 >> 0; +// var y3 = dy3 >> 0; +// +// var x4 = dx4 >> 0; +// var y4 = dy4 >> 0; +// +// var _eps = 0.001; +// if (Math.abs(dx1 - dx3) < _eps && +// Math.abs(dx2 - dx4) < _eps && +// Math.abs(dy1 - dy2) < _eps && +// Math.abs(dy3 - dy4) < _eps && +// x1 < x2 && y1 < y3) +// { +// x3 = x1; +// x4 = x2; +// y2 = y1; +// y4 = y3; +// bIsClever = true; +// } +// +// var nIsCleverWithTransform = bIsClever; +// var nType = 0; +// if (!nIsCleverWithTransform && +// Math.abs(dx1 - dx3) < _eps && +// Math.abs(dx2 - dx4) < _eps && +// Math.abs(dy1 - dy2) < _eps && +// Math.abs(dy3 - dy4) < _eps) +// { +// x3 = x1; +// x4 = x2; +// y2 = y1; +// y4 = y3; +// nIsCleverWithTransform = true; +// nType = 1; +// } +// if (!nIsCleverWithTransform && +// Math.abs(dx1 - dx2) < _eps && +// Math.abs(dx3 - dx4) < _eps && +// Math.abs(dy1 - dy3) < _eps && +// Math.abs(dy2 - dy4) < _eps) +// { +// x2 = x1; +// x4 = x3; +// y3 = y1; +// y4 = y2; +// nIsCleverWithTransform = true; +// nType = 2; +// } +// +// /* +// if (x1 == x3 && x2 == x4 && y1 == y2 && y3 == y4 && x1 < x2 && y1 < y3) +// bIsClever = true; +// +// var nIsCleverWithTransform = bIsClever; +// var nType = 0; +// if (!nIsCleverWithTransform && x1 == x3 && x2 == x4 && y1 == y2 && y3 == y4) +// { +// nIsCleverWithTransform = true; +// nType = 1; +// } +// if (!nIsCleverWithTransform && x1 == x2 && x3 == x4 && y1 == y3 && y2 == y4) +// { +// nIsCleverWithTransform = true; +// nType = 2; +// } +// */ +// +// var ctx = overlay.m_oContext; +// +// var bIsEllipceCorner = false; +// //var _style_blue = "#4D7399"; +// //var _style_blue = "#B2B2B2"; +// var _style_blue = "#939393"; +// var _style_green = "#84E036"; +// var _style_white = "#FFFFFF"; +// +// var _len_x = Math.sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2)); +// var _len_y = Math.sqrt((x1 - x3)*(x1 - x3) + (y1 - y3)*(y1 - y3)); +// +// if (_len_x < 1) +// _len_x = 1; +// if (_len_y < 1) +// _len_y = 1; +// +// var bIsRectsTrackX = (_len_x >= 30) ? true : false; +// var bIsRectsTrackY = (_len_y >= 30) ? true : false; +// var bIsRectsTrack = (bIsRectsTrackX || bIsRectsTrackY) ? true : false; +// +// if (nType == 2) +// { +// var _tmp = bIsRectsTrackX; +// bIsRectsTrackX = bIsRectsTrackY; +// bIsRectsTrackY = _tmp; +// } +// +// ctx.lineWidth = 1; +// ctx.beginPath(); +// +// var _oldGlobalAlpha = ctx.globalAlpha; +// ctx.globalAlpha = 1; +// +// switch (type) +// { +// case TYPE_TRACK_SHAPE: +// case TYPE_TRACK_GROUP: +// { +// if (bIsClever) +// { +// overlay.CheckRect(x1, y1, x4 - x1, y4 - y1); +// ctx.strokeStyle = _style_blue; +// +// if (!isLine) +// { +// ctx.rect(x1 + 0.5, y2 + 0.5, x4 - x1, y4 - y1); +// ctx.stroke(); +// ctx.beginPath(); +// } +// +// var xC = ((x1 + x2) / 2) >> 0; +// +// if (!isLine && isCanRotate) +// { +// if (!bIsUseImageRotateTrack) +// { +// ctx.beginPath(); +// overlay.AddEllipse(xC, y1 - TRACK_DISTANCE_ROTATE, TRACK_CIRCLE_RADIUS); +// +// ctx.fillStyle = _style_green; +// ctx.fill(); +// ctx.stroke(); +// } +// else +// { +// if (window.g_track_rotate_marker.asc_complete) +// { +// var _w = IMAGE_ROTATE_TRACK_W; +// var _xI = ((x1 + x2 - _w) / 2) >> 0; +// var _yI = y1 - TRACK_DISTANCE_ROTATE - (_w >> 1); +// +// overlay.CheckRect(_xI, _yI, _w, _w); +// ctx.drawImage(window.g_track_rotate_marker, _xI, _yI, _w, _w); +// } +// } +// +// ctx.beginPath(); +// ctx.moveTo(xC + 0.5, y1); +// ctx.lineTo(xC + 0.5, y1 - TRACK_DISTANCE_ROTATE2); +// ctx.stroke(); +// +// ctx.beginPath(); +// } +// +// ctx.fillStyle = _style_white; +// +// if (bIsEllipceCorner) +// { +// overlay.AddEllipse(x1, y1, TRACK_CIRCLE_RADIUS); +// if (!isLine) +// { +// overlay.AddEllipse(x2, y2, TRACK_CIRCLE_RADIUS); +// overlay.AddEllipse(x3, y3, TRACK_CIRCLE_RADIUS); +// } +// overlay.AddEllipse(x4, y4, TRACK_CIRCLE_RADIUS); +// } +// else +// { +// overlay.AddRect2(x1 + 0.5, y1 + 0.5, TRACK_RECT_SIZE); +// if (!isLine) +// { +// overlay.AddRect2(x2 + 0.5, y2 + 0.5, TRACK_RECT_SIZE); +// overlay.AddRect2(x3 + 0.5, y3 + 0.5, TRACK_RECT_SIZE); +// } +// overlay.AddRect2(x4 + 0.5, y4 + 0.5, TRACK_RECT_SIZE); +// } +// +// if (bIsRectsTrack && !isLine) +// { +// var _xC = (((x1 + x2) / 2) >> 0) + 0.5; +// var _yC = (((y1 + y3) / 2) >> 0) + 0.5; +// +// if (bIsRectsTrackX) +// { +// overlay.AddRect2(_xC, y1+0.5, TRACK_RECT_SIZE); +// overlay.AddRect2(_xC, y3+0.5, TRACK_RECT_SIZE); +// } +// +// if (bIsRectsTrackY) +// { +// overlay.AddRect2(x2+0.5, _yC, TRACK_RECT_SIZE); +// overlay.AddRect2(x1+0.5, _yC, TRACK_RECT_SIZE); +// } +// } +// +// ctx.fill(); +// ctx.stroke(); +// +// ctx.beginPath(); +// } +// else +// { +// var _x1 = x1; +// var _y1 = y1; +// var _x2 = x2; +// var _y2 = y2; +// var _x3 = x3; +// var _y3 = y3; +// var _x4 = x4; +// var _y4 = y4; +// +// if (nIsCleverWithTransform) +// { +// var _x1 = x1; +// if (x2 < _x1) +// _x1 = x2; +// if (x3 < _x1) +// _x1 = x3; +// if (x4 < _x1) +// _x1 = x4; +// +// var _x4 = x1; +// if (x2 > _x4) +// _x4 = x2; +// if (x3 > _x4) +// _x4 = x3; +// if (x4 > _x4) +// _x4 = x4; +// +// var _y1 = y1; +// if (y2 < _y1) +// _y1 = y2; +// if (y3 < _y1) +// _y1 = y3; +// if (y4 < _y1) +// _y1 = y4; +// +// var _y4 = y1; +// if (y2 > _y4) +// _y4 = y2; +// if (y3 > _y4) +// _y4 = y3; +// if (y4 > _y4) +// _y4 = y4; +// +// _x2 = _x4; +// _y2 = _y1; +// _x3 = _x1; +// _y3 = _y4; +// } +// +// ctx.strokeStyle = _style_blue; +// +// if (!isLine) +// { +// if (nIsCleverWithTransform) +// { +// ctx.rect(_x1 + 0.5, _y2 + 0.5, _x4 - _x1, _y4 - _y1); +// ctx.stroke(); +// ctx.beginPath(); +// } +// else +// { +// ctx.moveTo(x1, y1); +// ctx.lineTo(x2, y2); +// ctx.lineTo(x4, y4); +// ctx.lineTo(x3, y3); +// ctx.closePath(); +// ctx.stroke(); +// } +// } +// +// overlay.CheckPoint(x1, y1); +// overlay.CheckPoint(x2, y2); +// overlay.CheckPoint(x3, y3); +// overlay.CheckPoint(x4, y4); +// +// var ex1 = (x2 - x1) / _len_x; +// var ey1 = (y2 - y1) / _len_x; +// var ex2 = (x1 - x3) / _len_y; +// var ey2 = (y1 - y3) / _len_y; +// +// var _bAbsX1 = Math.abs(ex1) < 0.01; +// var _bAbsY1 = Math.abs(ey1) < 0.01; +// var _bAbsX2 = Math.abs(ex2) < 0.01; +// var _bAbsY2 = Math.abs(ey2) < 0.01; +// +// if (_bAbsX2 && _bAbsY2) +// { +// if (_bAbsX1 && _bAbsY1) +// { +// ex1 = 1; +// ey1 = 0; +// ex2 = 0; +// ey2 = 1; +// } +// else +// { +// ex2 = -ey1; +// ey2 = ex1; +// } +// } +// else if (_bAbsX1 && _bAbsY1) +// { +// ex1 = ey2; +// ey1 = -ex2; +// } +// +// var xc1 = (x1 + x2) / 2; +// var yc1 = (y1 + y2) / 2; +// +// ctx.beginPath(); +// +// if (!isLine && isCanRotate) +// { +// if (!bIsUseImageRotateTrack) +// { +// ctx.beginPath(); +// overlay.AddEllipse(xc1 + ex2 * TRACK_DISTANCE_ROTATE, yc1 + ey2 * TRACK_DISTANCE_ROTATE, TRACK_CIRCLE_RADIUS); +// +// ctx.fillStyle = _style_green; +// ctx.fill(); +// ctx.stroke(); +// } +// else +// { +// if (window.g_track_rotate_marker.asc_complete) +// { +// var _xI = xc1 + ex2 * TRACK_DISTANCE_ROTATE; +// var _yI = yc1 + ey2 * TRACK_DISTANCE_ROTATE; +// var _w = IMAGE_ROTATE_TRACK_W; +// var _w2 = IMAGE_ROTATE_TRACK_W / 2; +// +// if (nIsCleverWithTransform) +// { +// _xI >>= 0; +// _yI >>= 0; +// _w2 >>= 0; +// _w2 += 1; +// } +// +// //ctx.setTransform(ex1, ey1, -ey1, ex1, _xI, _yI); +// +// var _matrix = matrix.CreateDublicate(); +// _matrix.tx = 0; +// _matrix.ty = 0; +// var _xx = _matrix.TransformPointX(0, 1); +// var _yy = _matrix.TransformPointY(0, 1); +// var _angle = Math.atan2(_xx, -_yy) - Math.PI; +// var _px = Math.cos(_angle); +// var _py = Math.sin(_angle); +// +// ctx.translate(_xI, _yI); +// ctx.transform(_px, _py, -_py, _px, 0, 0); +// ctx.drawImage(window.g_track_rotate_marker, -_w2, -_w2, _w, _w); +// ctx.setTransform(1, 0, 0, 1, 0, 0); +// +// overlay.CheckRect(_xI - _w2, _yI - _w2, _w, _w); +// } +// } +// +// ctx.beginPath(); +// +// if (!nIsCleverWithTransform) +// { +// ctx.moveTo(xc1, yc1); +// ctx.lineTo(xc1 + ex2 * TRACK_DISTANCE_ROTATE2, yc1 + ey2 * TRACK_DISTANCE_ROTATE2); +// } +// else +// { +// ctx.moveTo((xc1 >> 0) + 0.5, (yc1 >> 0) + 0.5); +// ctx.lineTo(((xc1 + ex2 * TRACK_DISTANCE_ROTATE2) >> 0) + 0.5, ((yc1 + ey2 * TRACK_DISTANCE_ROTATE2) >> 0) + 0.5); +// } +// +// ctx.stroke(); +// +// ctx.beginPath(); +// } +// +// ctx.fillStyle = _style_white; +// +// if (!nIsCleverWithTransform) +// { +// if (bIsEllipceCorner) +// { +// overlay.AddEllipse(x1, y1, TRACK_CIRCLE_RADIUS); +// if (!isLine) +// { +// overlay.AddEllipse(x2, y2, TRACK_CIRCLE_RADIUS); +// overlay.AddEllipse(x3, y3, TRACK_CIRCLE_RADIUS); +// } +// overlay.AddEllipse(x4, y4, TRACK_CIRCLE_RADIUS); +// } +// else +// { +// overlay.AddRect3(x1, y1, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// if (!isLine) +// { +// overlay.AddRect3(x2, y2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// overlay.AddRect3(x3, y3, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// } +// overlay.AddRect3(x4, y4, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// } +// } +// else +// { +// if (bIsEllipceCorner) +// { +// overlay.AddEllipse(_x1, _y1, TRACK_CIRCLE_RADIUS); +// if (!isLine) +// { +// overlay.AddEllipse(_x2, _y2, TRACK_CIRCLE_RADIUS); +// overlay.AddEllipse(_x3, _y3, TRACK_CIRCLE_RADIUS); +// } +// overlay.AddEllipse(_x4, _y4, TRACK_CIRCLE_RADIUS); +// } +// else +// { +// if (!isLine) +// { +// overlay.AddRect2(_x1 + 0.5, _y1 + 0.5, TRACK_RECT_SIZE); +// overlay.AddRect2(_x2 + 0.5, _y2 + 0.5, TRACK_RECT_SIZE); +// overlay.AddRect2(_x3 + 0.5, _y3 + 0.5, TRACK_RECT_SIZE); +// overlay.AddRect2(_x4 + 0.5, _y4 + 0.5, TRACK_RECT_SIZE); +// } +// else +// { +// overlay.AddRect2(x1 + 0.5, y1 + 0.5, TRACK_RECT_SIZE); +// overlay.AddRect2(x4 + 0.5, y4 + 0.5, TRACK_RECT_SIZE); +// } +// } +// } +// +// if (!isLine) +// { +// if (!nIsCleverWithTransform) +// { +// if (bIsRectsTrack) +// { +// if (bIsRectsTrackX) +// { +// overlay.AddRect3((x1 + x2) / 2, (y1 + y2) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// overlay.AddRect3((x3 + x4) / 2, (y3 + y4) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// } +// if (bIsRectsTrackY) +// { +// overlay.AddRect3((x2 + x4) / 2, (y2 + y4) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// overlay.AddRect3((x3 + x1) / 2, (y3 + y1) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// } +// } +// } +// else +// { +// var _xC = (((_x1 + _x2) / 2) >> 0) + 0.5; +// var _yC = (((_y1 + _y3) / 2) >> 0) + 0.5; +// +// if (bIsRectsTrackX) +// { +// overlay.AddRect2(_xC, _y1+0.5, TRACK_RECT_SIZE); +// overlay.AddRect2(_xC, _y3+0.5, TRACK_RECT_SIZE); +// } +// +// if (bIsRectsTrackY) +// { +// overlay.AddRect2(_x2+0.5, _yC, TRACK_RECT_SIZE); +// overlay.AddRect2(_x1+0.5, _yC, TRACK_RECT_SIZE); +// } +// } +// } +// +// ctx.fill(); +// ctx.stroke(); +// +// ctx.beginPath(); +// } +// +// break; +// } +// case TYPE_TRACK_TEXT: +// case TYPE_TRACK_GROUP_PASSIVE: +// { +// if (bIsClever) +// { +// overlay.CheckRect(x1, y1, x4 - x1, y4 - y1); +// this.AddRectDashClever(ctx, x1, y1, x4, y4, 8, 3); +// +// ctx.strokeStyle = _style_blue; +// ctx.stroke(); +// +// ctx.beginPath(); +// +// if (isCanRotate) +// { +// if (!bIsUseImageRotateTrack) +// { +// ctx.beginPath(); +// overlay.AddEllipse(xC, y1 - TRACK_DISTANCE_ROTATE, TRACK_CIRCLE_RADIUS); +// +// ctx.fillStyle = _style_green; +// ctx.fill(); +// ctx.stroke(); +// } +// else +// { +// if (window.g_track_rotate_marker.asc_complete) +// { +// var _w = IMAGE_ROTATE_TRACK_W; +// var _xI = ((x1 + x2 - _w) / 2) >> 0; +// var _yI = y1 - TRACK_DISTANCE_ROTATE - (_w >> 1); +// +// overlay.CheckRect(_xI, _yI, _w, _w); +// ctx.drawImage(window.g_track_rotate_marker, _xI, _yI, _w, _w); +// } +// } +// +// ctx.beginPath(); +// +// var xC = ((x1 + x2) / 2) >> 0; +// ctx.moveTo(xC + 0.5, y1); +// ctx.lineTo(xC + 0.5, y1 - TRACK_DISTANCE_ROTATE2); +// ctx.stroke(); +// +// ctx.beginPath(); +// } +// +// ctx.fillStyle = _style_white; +// +// if (bIsEllipceCorner) +// { +// overlay.AddEllipse(x1, y1, TRACK_CIRCLE_RADIUS); +// overlay.AddEllipse(x2, y2, TRACK_CIRCLE_RADIUS); +// overlay.AddEllipse(x3, y3, TRACK_CIRCLE_RADIUS); +// overlay.AddEllipse(x4, y4, TRACK_CIRCLE_RADIUS); +// } +// else +// { +// overlay.AddRect2(x1 + 0.5, y1 + 0.5, TRACK_RECT_SIZE); +// overlay.AddRect2(x2 + 0.5, y2 + 0.5, TRACK_RECT_SIZE); +// overlay.AddRect2(x3 + 0.5, y3 + 0.5, TRACK_RECT_SIZE); +// overlay.AddRect2(x4 + 0.5, y4 + 0.5, TRACK_RECT_SIZE); +// } +// +// if (bIsRectsTrack) +// { +// var _xC = (((x1 + x2) / 2) >> 0) + 0.5; +// var _yC = (((y1 + y3) / 2) >> 0) + 0.5; +// +// if (bIsRectsTrackX) +// { +// overlay.AddRect2(_xC, y1+0.5, TRACK_RECT_SIZE); +// overlay.AddRect2(_xC, y3+0.5, TRACK_RECT_SIZE); +// } +// if (bIsRectsTrackY) +// { +// overlay.AddRect2(x2+0.5, _yC, TRACK_RECT_SIZE); +// overlay.AddRect2(x1+0.5, _yC, TRACK_RECT_SIZE); +// } +// } +// +// ctx.fill(); +// ctx.stroke(); +// +// ctx.beginPath(); +// } +// else +// { +// var _x1 = x1; +// var _y1 = y1; +// var _x2 = x2; +// var _y2 = y2; +// var _x3 = x3; +// var _y3 = y3; +// var _x4 = x4; +// var _y4 = y4; +// +// if (nIsCleverWithTransform) +// { +// var _x1 = x1; +// if (x2 < _x1) +// _x1 = x2; +// if (x3 < _x1) +// _x1 = x3; +// if (x4 < _x1) +// _x1 = x4; +// +// var _x4 = x1; +// if (x2 > _x4) +// _x4 = x2; +// if (x3 > _x4) +// _x4 = x3; +// if (x4 > _x4) +// _x4 = x4; +// +// var _y1 = y1; +// if (y2 < _y1) +// _y1 = y2; +// if (y3 < _y1) +// _y1 = y3; +// if (y4 < _y1) +// _y1 = y4; +// +// var _y4 = y1; +// if (y2 > _y4) +// _y4 = y2; +// if (y3 > _y4) +// _y4 = y3; +// if (y4 > _y4) +// _y4 = y4; +// +// _x2 = _x4; +// _y2 = _y1; +// _x3 = _x1; +// _y3 = _y4; +// } +// +// overlay.CheckPoint(x1, y1); +// overlay.CheckPoint(x2, y2); +// overlay.CheckPoint(x3, y3); +// overlay.CheckPoint(x4, y4); +// +// if (!nIsCleverWithTransform) +// { +// this.AddRectDash(ctx, x1, y1, x2, y2, x3, y3, x4, y4, 8, 3); +// } +// else +// { +// this.AddRectDashClever(ctx, _x1, _y1, _x4, _y4, 8, 3); +// } +// +// ctx.strokeStyle = _style_blue; +// ctx.stroke(); +// +// var ex1 = (x2 - x1) / _len_x; +// var ey1 = (y2 - y1) / _len_x; +// var ex2 = (x1 - x3) / _len_y; +// var ey2 = (y1 - y3) / _len_y; +// +// var _bAbsX1 = Math.abs(ex1) < 0.01; +// var _bAbsY1 = Math.abs(ey1) < 0.01; +// var _bAbsX2 = Math.abs(ex2) < 0.01; +// var _bAbsY2 = Math.abs(ey2) < 0.01; +// +// if (_bAbsX2 && _bAbsY2) +// { +// if (_bAbsX1 && _bAbsY1) +// { +// ex1 = 1; +// ey1 = 0; +// ex2 = 0; +// ey2 = 1; +// } +// else +// { +// ex2 = -ey1; +// ey2 = ex1; +// } +// } +// else if (_bAbsX1 && _bAbsY1) +// { +// ex1 = ey2; +// ey1 = -ex2; +// } +// +// var xc1 = (x1 + x2) / 2; +// var yc1 = (y1 + y2) / 2; +// +// ctx.beginPath(); +// +// if (isCanRotate) +// { +// if (!bIsUseImageRotateTrack) +// { +// ctx.beginPath(); +// overlay.AddEllipse(xc1 + ex2 * TRACK_DISTANCE_ROTATE, yc1 + ey2 * TRACK_DISTANCE_ROTATE, TRACK_CIRCLE_RADIUS); +// +// ctx.fillStyle = _style_green; +// ctx.fill(); +// ctx.stroke(); +// } +// else +// { +// if (window.g_track_rotate_marker.asc_complete) +// { +// var _xI = xc1 + ex2 * TRACK_DISTANCE_ROTATE; +// var _yI = yc1 + ey2 * TRACK_DISTANCE_ROTATE; +// var _w = IMAGE_ROTATE_TRACK_W; +// var _w2 = IMAGE_ROTATE_TRACK_W / 2; +// +// if (nIsCleverWithTransform) +// { +// _xI >>= 0; +// _yI >>= 0; +// _w2 >>= 0; +// _w2 += 1; +// } +// +// //ctx.setTransform(ex1, ey1, -ey1, ex1, _xI, _yI); +// +// var _matrix = matrix.CreateDublicate(); +// _matrix.tx = 0; +// _matrix.ty = 0; +// var _xx = _matrix.TransformPointX(0, 1); +// var _yy = _matrix.TransformPointY(0, 1); +// var _angle = Math.atan2(_xx, -_yy) - Math.PI; +// var _px = Math.cos(_angle); +// var _py = Math.sin(_angle); +// +// ctx.translate(_xI, _yI); +// ctx.transform(_px, _py, -_py, _px, 0, 0); +// ctx.drawImage(window.g_track_rotate_marker, -_w2, -_w2, _w, _w); +// ctx.setTransform(1, 0, 0, 1, 0, 0); +// +// overlay.CheckRect(_xI - _w2, _yI - _w2, _w, _w); +// } +// } +// +// ctx.beginPath(); +// +// if (!nIsCleverWithTransform) +// { +// ctx.moveTo(xc1, yc1); +// ctx.lineTo(xc1 + ex2 * TRACK_DISTANCE_ROTATE2, yc1 + ey2 * TRACK_DISTANCE_ROTATE2); +// } +// else +// { +// ctx.moveTo((xc1 >> 0) + 0.5, (yc1 >> 0) + 0.5); +// ctx.lineTo(((xc1 + ex2 * TRACK_DISTANCE_ROTATE2) >> 0) + 0.5, ((yc1 + ey2 * TRACK_DISTANCE_ROTATE2) >> 0) + 0.5); +// } +// +// ctx.stroke(); +// +// ctx.beginPath(); +// +// } +// +// ctx.fillStyle = _style_white; +// +// if (!nIsCleverWithTransform) +// { +// if (bIsEllipceCorner) +// { +// overlay.AddEllipse(x1, y1, TRACK_CIRCLE_RADIUS); +// overlay.AddEllipse(x2, y2, TRACK_CIRCLE_RADIUS); +// overlay.AddEllipse(x3, y3, TRACK_CIRCLE_RADIUS); +// overlay.AddEllipse(x4, y4, TRACK_CIRCLE_RADIUS); +// } +// else +// { +// overlay.AddRect3(x1, y1, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// overlay.AddRect3(x2, y2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// overlay.AddRect3(x3, y3, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// overlay.AddRect3(x4, y4, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// } +// } +// else +// { +// if (bIsEllipceCorner) +// { +// overlay.AddEllipse(x1, y1, TRACK_CIRCLE_RADIUS); +// overlay.AddEllipse(x2, y2, TRACK_CIRCLE_RADIUS); +// overlay.AddEllipse(x3, y3, TRACK_CIRCLE_RADIUS); +// overlay.AddEllipse(x4, y4, TRACK_CIRCLE_RADIUS); +// } +// else +// { +// overlay.AddRect2(_x1 + 0.5, _y1 + 0.5, TRACK_RECT_SIZE); +// overlay.AddRect2(_x2 + 0.5, _y2 + 0.5, TRACK_RECT_SIZE); +// overlay.AddRect2(_x3 + 0.5, _y3 + 0.5, TRACK_RECT_SIZE); +// overlay.AddRect2(_x4 + 0.5, _y4 + 0.5, TRACK_RECT_SIZE); +// } +// } +// +// if (!nIsCleverWithTransform) +// { +// if (bIsRectsTrack) +// { +// if (bIsRectsTrackX) +// { +// overlay.AddRect3((x1 + x2) / 2, (y1 + y2) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// overlay.AddRect3((x3 + x4) / 2, (y3 + y4) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// } +// if (bIsRectsTrackY) +// { +// overlay.AddRect3((x2 + x4) / 2, (y2 + y4) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// overlay.AddRect3((x3 + x1) / 2, (y3 + y1) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// } +// } +// } +// else +// { +// if (bIsRectsTrack) +// { +// var _xC = (((_x1 + _x2) / 2) >> 0) + 0.5; +// var _yC = (((_y1 + _y3) / 2) >> 0) + 0.5; +// +// if (bIsRectsTrackX) +// { +// overlay.AddRect2(_xC, _y1+0.5, TRACK_RECT_SIZE); +// overlay.AddRect2(_xC, _y3+0.5, TRACK_RECT_SIZE); +// } +// if (bIsRectsTrackY) +// { +// overlay.AddRect2(_x2+0.5, _yC, TRACK_RECT_SIZE); +// overlay.AddRect2(_x1+0.5, _yC, TRACK_RECT_SIZE); +// } +// } +// } +// +// ctx.fill(); +// ctx.stroke(); +// +// ctx.beginPath(); +// } +// +// break; +// } +// case TYPE_TRACK_EMPTY_PH: +// { +// if (bIsClever) +// { +// overlay.CheckRect(x1, y1, x4 - x1, y4 - y1); +// ctx.rect(x1 + 0.5, y2 + 0.5, x4 - x1 + 1, y4 - y1); +// ctx.fillStyle = _style_white; +// ctx.stroke(); +// +// ctx.beginPath(); +// +// this.AddRectDashClever(ctx, x1, y1, x4, y4, 8, 3); +// +// ctx.strokeStyle = _style_blue; +// ctx.stroke(); +// +// ctx.beginPath(); +// +// var xC = ((x1 + x2) / 2) >> 0; +// +// if (!bIsUseImageRotateTrack) +// { +// ctx.beginPath(); +// overlay.AddEllipse(xC, y1 - TRACK_DISTANCE_ROTATE); +// +// ctx.fillStyle = _style_green; +// ctx.fill(); +// ctx.stroke(); +// } +// else +// { +// if (window.g_track_rotate_marker.asc_complete) +// { +// var _w = IMAGE_ROTATE_TRACK_W; +// var _xI = ((x1 + x2 - _w) / 2) >> 0; +// var _yI = y1 - TRACK_DISTANCE_ROTATE - (_w >> 1); +// +// overlay.CheckRect(_xI, _yI, _w, _w); +// ctx.drawImage(window.g_track_rotate_marker, _xI, _yI, _w, _w); +// } +// } +// +// ctx.beginPath(); +// ctx.moveTo(xC + 0.5, y1); +// ctx.lineTo(xC + 0.5, y1 - TRACK_DISTANCE_ROTATE2); +// ctx.stroke(); +// +// ctx.beginPath(); +// +// ctx.fillStyle = _style_white; +// +// if (bIsEllipceCorner) +// { +// overlay.AddEllipse(x1, y1, TRACK_CIRCLE_RADIUS); +// overlay.AddEllipse(x2, y2, TRACK_CIRCLE_RADIUS); +// overlay.AddEllipse(x3, y3, TRACK_CIRCLE_RADIUS); +// overlay.AddEllipse(x4, y4, TRACK_CIRCLE_RADIUS); +// } +// else +// { +// overlay.AddRect2(x1 + 0.5, y1 + 0.5, TRACK_RECT_SIZE); +// overlay.AddRect2(x2 + 0.5, y2 + 0.5, TRACK_RECT_SIZE); +// overlay.AddRect2(x3 + 0.5, y3 + 0.5, TRACK_RECT_SIZE); +// overlay.AddRect2(x4 + 0.5, y4 + 0.5, TRACK_RECT_SIZE); +// } +// +// if (bIsRectsTrack && false) +// { +// var _xC = (((x1 + x2) / 2) >> 0) + 0.5; +// var _yC = (((y1 + y3) / 2) >> 0) + 0.5; +// +// overlay.AddRect2(_xC, y1+0.5, TRACK_RECT_SIZE); +// overlay.AddRect2(x2+0.5, _yC, TRACK_RECT_SIZE); +// overlay.AddRect2(_xC, y3+0.5, TRACK_RECT_SIZE); +// overlay.AddRect2(x1+0.5, _yC, TRACK_RECT_SIZE); +// } +// +// ctx.fill(); +// ctx.stroke(); +// +// ctx.beginPath(); +// } +// else +// { +// overlay.CheckPoint(x1, y1); +// overlay.CheckPoint(x2, y2); +// overlay.CheckPoint(x3, y3); +// overlay.CheckPoint(x4, y4); +// +// ctx.moveTo(x1, y1); +// ctx.lineTo(x2, y2); +// ctx.lineTo(x3, y3); +// ctx.lineTo(x4, y4); +// ctx.closePath(); +// +// overlay.CheckPoint(x1, y1); +// overlay.CheckPoint(x2, y2); +// overlay.CheckPoint(x3, y3); +// overlay.CheckPoint(x4, y4); +// +// ctx.strokeStyle = _style_white; +// ctx.stroke(); +// +// ctx.beginPath(); +// +// this.AddRectDash(ctx, x1, y1, x2, y2, x3, y3, x4, y4, 8, 3); +// +// ctx.strokeStyle = _style_blue; +// ctx.stroke(); +// +// var ex1 = (x2 - x1) / _len_x; +// var ey1 = (y2 - y1) / _len_x; +// var ex2 = (x1 - x3) / _len_y; +// var ey2 = (y1 - y3) / _len_y; +// +// var _bAbsX1 = Math.abs(ex1) < 0.01; +// var _bAbsY1 = Math.abs(ey1) < 0.01; +// var _bAbsX2 = Math.abs(ex2) < 0.01; +// var _bAbsY2 = Math.abs(ey2) < 0.01; +// +// if (_bAbsX2 && _bAbsY2) +// { +// if (_bAbsX1 && _bAbsY1) +// { +// ex1 = 1; +// ey1 = 0; +// ex2 = 0; +// ey2 = 1; +// } +// else +// { +// ex2 = -ey1; +// ey2 = ex1; +// } +// } +// else if (_bAbsX1 && _bAbsY1) +// { +// ex1 = ey2; +// ey1 = -ex2; +// } +// +// var xc1 = (x1 + x2) / 2; +// var yc1 = (y1 + y2) / 2; +// +// ctx.beginPath(); +// +// if (!bIsUseImageRotateTrack) +// { +// ctx.beginPath(); +// overlay.AddEllipse(xc1 + ex2 * TRACK_DISTANCE_ROTATE, yc1 + ey2 * TRACK_DISTANCE_ROTATE, TRACK_DISTANCE_ROTATE); +// +// ctx.fillStyle = _style_green; +// ctx.fill(); +// ctx.stroke(); +// } +// else +// { +// if (window.g_track_rotate_marker.asc_complete) +// { +// var _xI = xc1 + ex2 * TRACK_DISTANCE_ROTATE; +// var _yI = yc1 + ey2 * TRACK_DISTANCE_ROTATE; +// var _w = IMAGE_ROTATE_TRACK_W; +// var _w2 = IMAGE_ROTATE_TRACK_W / 2; +// +// ctx.setTransform(ex1, ey1, -ey1, ex1, _xI, _yI); +// ctx.drawImage(window.g_track_rotate_marker, -_w2, -_w2, _w, _w); +// ctx.setTransform(1, 0, 0, 1, 0, 0); +// +// overlay.CheckRect(_xI - _w2, _yI - _w2, _w, _w); +// } +// } +// +// ctx.beginPath(); +// ctx.moveTo(xc1, yc1); +// ctx.lineTo(xc1 + ex2 * TRACK_DISTANCE_ROTATE2, yc1 + ey2 * TRACK_DISTANCE_ROTATE2); +// ctx.stroke(); +// +// ctx.beginPath(); +// +// ctx.fillStyle = _style_white; +// +// if (bIsEllipceCorner) +// { +// overlay.AddEllipse(x1, y1, TRACK_CIRCLE_RADIUS); +// overlay.AddEllipse(x2, y2, TRACK_CIRCLE_RADIUS); +// overlay.AddEllipse(x3, y3, TRACK_CIRCLE_RADIUS); +// overlay.AddEllipse(x4, y4, TRACK_CIRCLE_RADIUS); +// } +// else +// { +// overlay.AddRect3(x1, y1, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// overlay.AddRect3(x2, y2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// overlay.AddRect3(x3, y3, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// overlay.AddRect3(x4, y4, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// } +// +// if (bIsRectsTrack) +// { +// overlay.AddRect3((x1 + x2) / 2, (y1 + y2) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// overlay.AddRect3((x2 + x4) / 2, (y2 + y4) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// overlay.AddRect3((x3 + x4) / 2, (y3 + y4) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// overlay.AddRect3((x3 + x1) / 2, (y3 + y1) / 2, TRACK_RECT_SIZE, ex1, ey1, ex2, ey2); +// } +// +// ctx.fill(); +// ctx.stroke(); +// +// ctx.beginPath(); +// } +// +// break; +// } +// +// default: +// break; +// } +// +// ctx.globalAlpha = _oldGlobalAlpha; + }, + + DrawTrackSelectShapes : function(x, y, w, h) + { + this.Native["DD_DrawTrackSelectShapes"](x, y, w, h); + +// var overlay = this.m_oOverlay; +// overlay.Show(); +// +// this.CurrentPageInfo = overlay.m_oHtmlPage.GetDrawingPageInfo(this.PageIndex); +// +// var drPage = this.CurrentPageInfo.drawingPage; +// +// var xDst = drPage.left + (this.Graphics ? this.Graphics.m_oCoordTransform.tx : 0); +// var yDst = drPage.top + (this.Graphics ? this.Graphics.m_oCoordTransform.ty : 0); +// var wDst = drPage.right - drPage.left; +// var hDst = drPage.bottom - drPage.top; +// +// var dKoefX = wDst / this.CurrentPageInfo.width_mm; +// var dKoefY = hDst / this.CurrentPageInfo.height_mm; +// +// var x1 = (xDst + dKoefX * x) >> 0; +// var y1 = (yDst + dKoefY * y) >> 0; +// +// var x2 = (xDst + dKoefX * (x + w)) >> 0; +// var y2 = (yDst + dKoefY * (y + h)) >> 0; +// +// if (x1 > x2) +// { +// var tmp = x1; +// x1 = x2; +// x2 = tmp; +// } +// if (y1 > y2) +// { +// var tmp = y1; +// y1 = y2; +// y2 = tmp; +// } +// +// overlay.CheckRect(x1, y1, x2 - x1, y2 - y1); +// var ctx = overlay.m_oContext; +// ctx.setTransform(1, 0, 0, 1, 0, 0); +// +// var globalAlphaOld = ctx.globalAlpha; +// ctx.globalAlpha = 0.5; +// ctx.beginPath(); +// ctx.fillStyle = "rgba(51,102,204,255)"; +// ctx.strokeStyle = "#9ADBFE"; +// ctx.lineWidth = 1; +// ctx.fillRect(x1, y1, x2 - x1, y2 - y1); +// ctx.beginPath(); +// ctx.strokeRect(x1 - 0.5, y1 - 0.5, x2 - x1 + 1, y2 - y1 + 1); +// ctx.globalAlpha = globalAlphaOld; + }, + + DrawTrackDashRect : function(left, top, width, height, matrix) + { + console.log('DrawTrackDashRect !!!!!!!!!!!!!!!!!'); + +// var overlay = this.m_oOverlay; +// overlay.Show(); +// +// this.CurrentPageInfo = overlay.m_oHtmlPage.GetDrawingPageInfo(this.PageIndex); +// +// var drPage = this.CurrentPageInfo.drawingPage; +// +// var xDst = drPage.left + (this.Graphics ? this.Graphics.m_oCoordTransform.tx : 0); +// var yDst = drPage.top + (this.Graphics ? this.Graphics.m_oCoordTransform.ty : 0); +// var wDst = drPage.right - drPage.left; +// var hDst = drPage.bottom - drPage.top; +// +// var dKoefX = wDst / this.CurrentPageInfo.width_mm; +// var dKoefY = hDst / this.CurrentPageInfo.height_mm; +// +// var r = x + width; +// var b = y + height; +// +// var x1 = (xDst + dKoefX * (matrix.TransformPointX(left, top))) >> 0; +// var y1 = (yDst + dKoefY * (matrix.TransformPointY(left, top))) >> 0; +// +// var x2 = (xDst + dKoefX * (matrix.TransformPointX(r, top))) >> 0; +// var y2 = (yDst + dKoefY * (matrix.TransformPointY(r, top))) >> 0; +// +// var x3 = (xDst + dKoefX * (matrix.TransformPointX(left, b))) >> 0; +// var y3 = (yDst + dKoefY * (matrix.TransformPointY(left, b))) >> 0; +// +// var x4 = (xDst + dKoefX * (matrix.TransformPointX(r, b))) >> 0; +// var y4 = (yDst + dKoefY * (matrix.TransformPointY(r, b))) >> 0; +// +// var bIsClever = false; +// if (x1 == x3 && x2 == x4 && y1 == y2 && y3 == y4 && x1 < x2 && y1 < y3) +// bIsClever = true; +// +// var ctx = overlay.m_oContext; +// ctx.beginPath(); +// ctx.lineWidth = 1; +// ctx.strokeStyle = "#0000FF"; +// +// overlay.CheckPoint(x1, y1); +// overlay.CheckPoint(x2, y2); +// overlay.CheckPoint(x3, y3); +// overlay.CheckPoint(x4, y4); +// +// if (bIsClever) +// this.AddRectDashClever(ctx, x1, y1, x4, y4, 3, 2); +// else +// this.AddRectDash(ctx, x1, y1, x2, y2, x3, y3, x4, y4, 3, 2); +// +// ctx.stroke(); +// ctx.beginPath(); + }, + + AddRect : function(ctx, x, y, r, b, bIsClever) + { + console.log('AddRect !!!!!!!!!!!!!!!'); + +// if (bIsClever) +// ctx.rect(x + 0.5, y + 0.5, r - x + 1, b - y + 1); +// else +// { +// ctx.moveTo(x,y); +// ctx.rect(x, y, r - x + 1, b - y + 1); +// } + }, + + AddRectDashClever : function(ctx, x, y, r, b, w_dot, w_dist, bIsStrokeAndCanUseNative) + { + console.log('AddRectDashClever !!!!!!!!!!!!!!!'); + +// var _support_native_dash = (undefined !== ctx.setLineDash); +// +// var _x = x + 0.5; +// var _y = y + 0.5; +// var _r = r + 0.5; +// var _b = b + 0.5; +// +// if (_support_native_dash && bIsStrokeAndCanUseNative === true) +// { +// ctx.setLineDash([w_dot, w_dist]); +// +// //ctx.rect(x + 0.5, y + 0.5, r - x, b - y); +// ctx.moveTo(x, _y); +// ctx.lineTo(r - 1, _y); +// +// ctx.moveTo(_r, y); +// ctx.lineTo(_r, b - 1); +// +// ctx.moveTo(r + 1, _b); +// ctx.lineTo(x + 2, _b); +// +// ctx.moveTo(_x, b + 1); +// ctx.lineTo(_x, y + 2); +// +// ctx.stroke(); +// ctx.setLineDash([]); +// return; +// } +// +// for (var i = _x; i < _r; i += w_dist) +// { +// ctx.moveTo(i, _y); +// i += w_dot; +// +// if (i > _r) +// i = _r; +// +// ctx.lineTo(i, _y); +// } +// for (var i = _y; i < _b; i += w_dist) +// { +// ctx.moveTo(_r, i); +// i += w_dot; +// +// if (i > _b) +// i = _b; +// +// ctx.lineTo(_r, i); +// } +// for (var i = _r; i > _x; i -= w_dist) +// { +// ctx.moveTo(i, _b); +// i -= w_dot; +// +// if (i < _x) +// i = _x; +// +// ctx.lineTo(i, _b); +// } +// for (var i = _b; i > _y; i -= w_dist) +// { +// ctx.moveTo(_x, i); +// i -= w_dot; +// +// if (i < _y) +// i = _y; +// +// ctx.lineTo(_x, i); +// } +// +// if (bIsStrokeAndCanUseNative) +// ctx.stroke(); + }, + + AddLineDash : function(ctx, x1, y1, x2, y2, w_dot, w_dist) + { + console.log('AddLineDash !!!!!!!!!!!!!!!'); + +// var len = Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)); +// if (len < 1) +// len = 1; +// +// var len_x1 = Math.abs(w_dot*(x2-x1)/len); +// var len_y1 = Math.abs(w_dot*(y2-y1)/len); +// var len_x2 = Math.abs(w_dist*(x2-x1)/len); +// var len_y2 = Math.abs(w_dist*(y2-y1)/len); +// +// if (x1 <= x2 && y1 <= y2) +// { +// for (var i = x1, j = y1; i < x2 || j < y2; i += len_x2, j += len_y2) +// { +// ctx.moveTo(i, j); +// +// i += len_x1; +// j += len_y1; +// +// if (i > x2) +// i = x2; +// if (j > y2) +// j = y2; +// +// ctx.lineTo(i, j); +// } +// } +// else if (x1 <= x2 && y1 > y2) +// { +// for (var i = x1, j = y1; i < x2 || j > y2; i += len_x2, j -= len_y2) +// { +// ctx.moveTo(i, j); +// +// i += len_x1; +// j -= len_y1; +// +// if (i > x2) +// i = x2; +// if (j < y2) +// j = y2; +// +// ctx.lineTo(i, j); +// } +// } +// else if (x1 > x2 && y1 <= y2) +// { +// for (var i = x1, j = y1; i > x2 || j < y2; i -= len_x2, j += len_y2) +// { +// ctx.moveTo(i, j); +// +// i -= len_x1; +// j += len_y1; +// +// if (i < x2) +// i = x2; +// if (j > y2) +// j = y2; +// +// ctx.lineTo(i, j); +// } +// } +// else +// { +// for (var i = x1, j = y1; i > x2 || j > y2; i -= len_x2, j -= len_y2) +// { +// ctx.moveTo(i, j); +// +// i -= len_x1; +// j -= len_y1; +// +// if (i < x2) +// i = x2; +// if (j < y2) +// j = y2; +// +// ctx.lineTo(i, j); +// } +// } + }, + + AddRectDash : function(ctx, x1, y1, x2, y2, x3, y3, x4, y4, w_dot, w_dist, bIsStrokeAndCanUseNative) + { + console.log('AddRectDash !!!!!!!!!!!!!!!'); + +// var _support_native_dash = (undefined !== ctx.setLineDash); +// +// if (_support_native_dash && bIsStrokeAndCanUseNative === true) +// { +// ctx.setLineDash([w_dot, w_dist]); +// +// ctx.moveTo(x1, y1); +// ctx.lineTo(x2, y2); +// ctx.lineTo(x4, y4); +// ctx.lineTo(x3, y3); +// ctx.closePath(); +// +// ctx.stroke(); +// ctx.setLineDash([]); +// return; +// } +// +// this.AddLineDash(ctx, x1, y1, x2, y2, w_dot, w_dist); +// this.AddLineDash(ctx, x2, y2, x4, y4, w_dot, w_dist); +// this.AddLineDash(ctx, x4, y4, x3, y3, w_dot, w_dist); +// this.AddLineDash(ctx, x3, y3, x1, y1, w_dot, w_dist); +// +// if (bIsStrokeAndCanUseNative) +// ctx.stroke(); + }, + + DrawAdjustment : function(matrix, x, y, bTextWarp) + { + if (!matrix) + this.Native["DD_DrawTrackTransform"](); + else + this.Native["DD_DrawTrackTransform"](matrix.sx, matrix.shy, matrix.shx, matrix.sy, matrix.tx, matrix.ty); + + this.Native["DD_DrawAdjustment"](x, y); + +// var overlay = this.m_oOverlay; +// this.CurrentPageInfo = overlay.m_oHtmlPage.GetDrawingPageInfo(this.PageIndex); +// +// var drPage = this.CurrentPageInfo.drawingPage; +// +// var xDst = drPage.left + (this.Graphics ? this.Graphics.m_oCoordTransform.tx : 0); +// var yDst = drPage.top + (this.Graphics ? this.Graphics.m_oCoordTransform.ty : 0); +// var wDst = drPage.right - drPage.left; +// var hDst = drPage.bottom - drPage.top; +// +// var dKoefX = wDst / this.CurrentPageInfo.width_mm; +// var dKoefY = hDst / this.CurrentPageInfo.height_mm; +// +// var cx = (xDst + dKoefX * (matrix.TransformPointX(x, y))) >> 0; +// var cy = (yDst + dKoefY * (matrix.TransformPointY(x, y))) >> 0; +// +// var _style_blue = "#4D7399"; +// var _style_yellow = "#FDF54A"; +// var _style_text_adj = "#F888FF"; +// +// var ctx = overlay.m_oContext; +// +// var dist = TRACK_ADJUSTMENT_SIZE / 2; +// ctx.moveTo(cx - dist, cy); +// ctx.lineTo(cx, cy - dist); +// ctx.lineTo(cx + dist, cy); +// ctx.lineTo(cx, cy + dist); +// ctx.closePath(); +// +// overlay.CheckRect(cx - dist, cy - dist, TRACK_ADJUSTMENT_SIZE, TRACK_ADJUSTMENT_SIZE); +// +// if(bTextWarp === true) +// { +// ctx.fillStyle = _style_text_adj; +// } +// else +// { +// ctx.fillStyle = _style_yellow; +// } +// ctx.strokeStyle = _style_blue; +// +// ctx.fill(); +// ctx.stroke(); +// ctx.beginPath(); + }, + + DrawEditWrapPointsPolygon : function(points, matrix) + { + if (!matrix) + this.Native["DD_DrawTrackTransform"](); + else + this.Native["DD_DrawTrackTransform"](matrix.sx, matrix.shy, matrix.shx, matrix.sy, matrix.tx, matrix.ty); + + this.Native["DD_DrawEditWrapPointsPolygon"](points); + +// var _len = points.length; +// if (0 == _len) +// return; +// +// var overlay = this.m_oOverlay; +// var ctx = overlay.m_oContext; +// +// this.CurrentPageInfo = overlay.m_oHtmlPage.GetDrawingPageInfo(this.PageIndex); +// +// var drPage = this.CurrentPageInfo.drawingPage; +// +// var xDst = drPage.left; +// var yDst = drPage.top; +// var wDst = drPage.right - drPage.left; +// var hDst = drPage.bottom - drPage.top; +// +// var dKoefX = wDst / this.CurrentPageInfo.width_mm; +// var dKoefY = hDst / this.CurrentPageInfo.height_mm; +// +// var _tr_points_x = new Array(_len); +// var _tr_points_y = new Array(_len); +// for (var i = 0; i < _len; i++) +// { +// _tr_points_x[i] = (xDst + dKoefX * (matrix.TransformPointX(points[i].x, points[i].y))) >> 0; +// _tr_points_y[i] = (yDst + dKoefY * (matrix.TransformPointY(points[i].x, points[i].y))) >> 0; +// } +// +// ctx.beginPath(); +// for (var i = 0; i < _len; i++) +// { +// if (0 == i) +// ctx.moveTo(_tr_points_x[i], _tr_points_y[i]); +// else +// ctx.lineTo(_tr_points_x[i], _tr_points_y[i]); +// +// overlay.CheckPoint(_tr_points_x[i], _tr_points_y[i]); +// } +// +// ctx.closePath(); +// ctx.lineWidth = 1; +// ctx.strokeStyle = "#FF0000"; +// ctx.stroke(); +// +// ctx.beginPath(); +// for (var i = 0; i < _len; i++) +// { +// overlay.AddRect2(_tr_points_x[i] + 0.5, _tr_points_y[i] + 0.5, TRACK_WRAPPOINTS_SIZE); +// } +// ctx.strokeStyle = "#FFFFFF"; +// ctx.fillStyle = "#000000"; +// ctx.fill(); +// ctx.stroke(); +// +// ctx.beginPath(); + }, + + DrawEditWrapPointsTrackLines : function(points, matrix) + { + if (!matrix) + this.Native["DD_DrawTrackTransform"](); + else + this.Native["DD_DrawTrackTransform"](matrix.sx, matrix.shy, matrix.shx, matrix.sy, matrix.tx, matrix.ty); + + this.Native["DD_DrawEditWrapPointsTrackLines"](points); + + +// var _len = points.length; +// if (0 == _len) +// return; +// +// var overlay = this.m_oOverlay; +// var ctx = overlay.m_oContext; +// +// this.CurrentPageInfo = overlay.m_oHtmlPage.GetDrawingPageInfo(this.PageIndex); +// +// var drPage = this.CurrentPageInfo.drawingPage; +// +// var xDst = drPage.left; +// var yDst = drPage.top; +// var wDst = drPage.right - drPage.left; +// var hDst = drPage.bottom - drPage.top; +// +// var dKoefX = wDst / this.CurrentPageInfo.width_mm; +// var dKoefY = hDst / this.CurrentPageInfo.height_mm; +// +// var _tr_points_x = new Array(_len); +// var _tr_points_y = new Array(_len); +// for (var i = 0; i < _len; i++) +// { +// _tr_points_x[i] = (xDst + dKoefX * (matrix.TransformPointX(points[i].x, points[i].y))) >> 0; +// _tr_points_y[i] = (yDst + dKoefY * (matrix.TransformPointY(points[i].x, points[i].y))) >> 0; +// } +// +// var globalAlpha = ctx.globalAlpha; +// ctx.globalAlpha = 1.0; +// +// ctx.beginPath(); +// for (var i = 0; i < _len; i++) +// { +// if (0 == i) +// ctx.moveTo(_tr_points_x[i], _tr_points_y[i]); +// else +// ctx.lineTo(_tr_points_x[i], _tr_points_y[i]); +// +// overlay.CheckPoint(_tr_points_x[i], _tr_points_y[i]); +// } +// ctx.lineWidth = 1; +// ctx.strokeStyle = "#FFFFFF"; +// ctx.stroke(); +// +// ctx.beginPath(); +// for (var i = 1; i < _len; i++) +// { +// this.AddLineDash(ctx, _tr_points_x[i-1], _tr_points_y[i-1], _tr_points_x[i], _tr_points_y[i], 4, 4); +// } +// ctx.lineWidth = 1; +// ctx.strokeStyle = "#000000"; +// ctx.stroke(); +// +// ctx.beginPath(); +// +// ctx.globalAlpha = globalAlpha; + }, + + DrawInlineMoveCursor : function(x, y, h, matrix) + { + if (!m) + { + this.Native["DD_DrawInlineMoveCursor"](this.PageIndex, x, y, h); + } + else + { + this.Native["DD_DrawInlineMoveCursor"](this.PageIndex, x, y, h, m.sx, m.shy, m.shx, m.sy, m.tx, m.ty); + } + +// var overlay = this.m_oOverlay; +// this.CurrentPageInfo = overlay.m_oHtmlPage.GetDrawingPageInfo(this.PageIndex); +// +// var drPage = this.CurrentPageInfo.drawingPage; +// +// var xDst = drPage.left; +// var yDst = drPage.top; +// var wDst = drPage.right - drPage.left; +// var hDst = drPage.bottom - drPage.top; +// +// var dKoefX = wDst / this.CurrentPageInfo.width_mm; +// var dKoefY = hDst / this.CurrentPageInfo.height_mm; +// +// var bIsIdentMatr = true; +// if (matrix !== undefined && matrix != null) +// { +// if (matrix.IsIdentity2()) +// { +// x += matrix.tx; +// y += matrix.ty; +// } +// else +// { +// bIsIdentMatr = false; +// } +// } +// +// if (bIsIdentMatr) +// { +// var __x = (xDst + dKoefX * x) >> 0; +// var __y = (yDst + dKoefY * y) >> 0; +// var __h = (h * dKoefY) >> 0; +// +// overlay.CheckRect(__x,__y,2,__h); +// +// var ctx = overlay.m_oContext; +// +// var _oldAlpha = ctx.globalAlpha; +// ctx.globalAlpha = 1; +// +// ctx.lineWidth = 1; +// ctx.strokeStyle = "#000000"; +// for (var i = 0; i < __h; i+=2) +// { +// ctx.moveTo(__x,__y+i+0.5); +// ctx.lineTo(__x+2,__y+i+0.5); +// } +// ctx.stroke(); +// +// ctx.beginPath(); +// ctx.strokeStyle = "#FFFFFF"; +// for (var i = 1; i < __h; i+=2) +// { +// ctx.moveTo(__x,__y+i+0.5); +// ctx.lineTo(__x+2,__y+i+0.5); +// } +// ctx.stroke(); +// +// ctx.globalAlpha = _oldAlpha; +// } +// else +// { +// var _x1 = matrix.TransformPointX(x, y); +// var _y1 = matrix.TransformPointY(x, y); +// +// var _x2 = matrix.TransformPointX(x, y + h); +// var _y2 = matrix.TransformPointY(x, y + h); +// +// _x1 = xDst + dKoefX * _x1; +// _y1 = yDst + dKoefY * _y1; +// +// _x2 = xDst + dKoefX * _x2; +// _y2 = yDst + dKoefY * _y2; +// +// overlay.CheckPoint(_x1, _y1); +// overlay.CheckPoint(_x2, _y2); +// +// var ctx = overlay.m_oContext; +// +// var _oldAlpha = ctx.globalAlpha; +// ctx.globalAlpha = 1; +// +// ctx.lineWidth = 2; +// ctx.beginPath(); +// ctx.strokeStyle = "#FFFFFF"; +// ctx.moveTo(_x1, _y1); +// ctx.lineTo(_x2, _y2); +// ctx.stroke(); +// ctx.beginPath(); +// +// ctx.strokeStyle = "#000000"; +// +// var _vec_len = Math.sqrt((_x2 - _x1)*(_x2 - _x1) + (_y2 - _y1)*(_y2 - _y1)); +// var _dx = (_x2 - _x1) / _vec_len; +// var _dy = (_y2 - _y1) / _vec_len; +// +// var __x = _x1; +// var __y = _y1; +// for (var i = 0; i < _vec_len; i += 2) +// { +// ctx.moveTo(__x, __y); +// +// __x += _dx; +// __y += _dy; +// +// ctx.lineTo(__x, __y); +// +// __x += _dx; +// __y += _dy; +// } +// ctx.stroke(); +// +// ctx.globalAlpha = _oldAlpha; +// } + }, + + drawFlowAnchor : function(x, y) + { + this.Native["PD_drawFlowAnchor"](x, y); + +// if (!window.g_flow_anchor || !window.g_flow_anchor.asc_complete || (!editor || !editor.ShowParaMarks)) +// return; +// +// var overlay = this.m_oOverlay; +// this.CurrentPageInfo = overlay.m_oHtmlPage.GetDrawingPageInfo(this.PageIndex); +// +// var drPage = this.CurrentPageInfo.drawingPage; +// +// var xDst = drPage.left; +// var yDst = drPage.top; +// var wDst = drPage.right - drPage.left; +// var hDst = drPage.bottom - drPage.top; +// +// var dKoefX = wDst / this.CurrentPageInfo.width_mm; +// var dKoefY = hDst / this.CurrentPageInfo.height_mm; +// +// var __x = (xDst + dKoefX * x) >> 0; +// var __y = (yDst + dKoefY * y) >> 0; +// +// __x -= 8; +// +// overlay.CheckRect(__x,__y,16,17); +// +// var ctx = overlay.m_oContext; +// var _oldAlpha = ctx.globalAlpha; +// ctx.globalAlpha = 1; +// +// ctx.setTransform(1,0,0,1,0,0); +// +// ctx.drawImage(window.g_flow_anchor, __x, __y); +// ctx.globalAlpha = _oldAlpha; + } +}; + +function CSlideBoundsChecker() +{ + this.map_bounds_shape = {}; + this.map_bounds_shape["heart"] = true; + + this.IsSlideBoundsCheckerType = true; + + this.Bounds = new CBoundsController(); + + this.m_oCurFont = null; + + this.m_oCoordTransform = new CMatrixL(); + this.m_oTransform = new CMatrixL(); + this.m_oFullTransform = new CMatrixL(); + + this.IsNoSupportTextDraw = true; + + this.LineWidth = null; + this.AutoCheckLineWidth = false; +} + +CSlideBoundsChecker.prototype = +{ + IsShapeNeedBounds : function(preset) + { + if (preset === undefined || preset == null) + return true; + return (true === this.map_bounds_shape[preset]) ? false : true; + }, + drawHorLine2 : function(preset) + { + }, + AddSmartRect: function() + {}, + + init : function(width_px, height_px, width_mm, height_mm) + { + this.m_lHeightPix = height_px; + this.m_lWidthPix = width_px; + this.m_dWidthMM = width_mm; + this.m_dHeightMM = height_mm; + this.m_dDpiX = 25.4 * this.m_lWidthPix / this.m_dWidthMM; + this.m_dDpiY = 25.4 * this.m_lHeightPix / this.m_dHeightMM; + + this.m_oCoordTransform.sx = this.m_dDpiX / 25.4; + this.m_oCoordTransform.sy = this.m_dDpiY / 25.4; + + this.Bounds.ClearNoAttack(); + }, + + SetCurrentPage: function() + {}, + + GetIntegerGrid: function() + { + return false; + }, + + GetTextPr: function() + {}, + + EndDraw : function(){}, + put_GlobalAlpha : function(enable, alpha) + { + }, + // pen methods + p_color : function(r,g,b,a) + { + }, + p_width : function(w) + { + }, + // brush methods + b_color1 : function(r,g,b,a) + { + }, + b_color2 : function(r,g,b,a) + { + }, + + SetIntegerGrid : function() + { + }, + + transform : function(sx,shy,shx,sy,tx,ty) + { + this.m_oTransform.sx = sx; + this.m_oTransform.shx = shx; + this.m_oTransform.shy = shy; + this.m_oTransform.sy = sy; + this.m_oTransform.tx = tx; + this.m_oTransform.ty = ty; + + this.CalculateFullTransform(); + }, + CalculateFullTransform : function() + { + this.m_oFullTransform.sx = this.m_oTransform.sx; + this.m_oFullTransform.shx = this.m_oTransform.shx; + this.m_oFullTransform.shy = this.m_oTransform.shy; + this.m_oFullTransform.sy = this.m_oTransform.sy; + this.m_oFullTransform.tx = this.m_oTransform.tx; + this.m_oFullTransform.ty = this.m_oTransform.ty; + global_MatrixTransformer.MultiplyAppend(this.m_oFullTransform, this.m_oCoordTransform); + }, + + SetTextPr: function() + {}, + + SetFontSlot: function() + {}, + + // path commands + _s : function() + { + }, + _e : function() + { + }, + _z : function() + { + }, + _m : function(x,y) + { + var _x = this.m_oFullTransform.TransformPointX(x,y); + var _y = this.m_oFullTransform.TransformPointY(x,y); + + this.Bounds.CheckPoint(_x, _y); + }, + _l : function(x,y) + { + var _x = this.m_oFullTransform.TransformPointX(x,y); + var _y = this.m_oFullTransform.TransformPointY(x,y); + + this.Bounds.CheckPoint(_x, _y); + }, + _c : function(x1,y1,x2,y2,x3,y3) + { + var _x1 = this.m_oFullTransform.TransformPointX(x1,y1); + var _y1 = this.m_oFullTransform.TransformPointY(x1,y1); + + var _x2 = this.m_oFullTransform.TransformPointX(x2,y2); + var _y2 = this.m_oFullTransform.TransformPointY(x2,y2); + + var _x3 = this.m_oFullTransform.TransformPointX(x3,y3); + var _y3 = this.m_oFullTransform.TransformPointY(x3,y3); + + this.Bounds.CheckPoint(_x1, _y1); + this.Bounds.CheckPoint(_x2, _y2); + this.Bounds.CheckPoint(_x3, _y3); + }, + _c2 : function(x1,y1,x2,y2) + { + var _x1 = this.m_oFullTransform.TransformPointX(x1,y1); + var _y1 = this.m_oFullTransform.TransformPointY(x1,y1); + + var _x2 = this.m_oFullTransform.TransformPointX(x2,y2); + var _y2 = this.m_oFullTransform.TransformPointY(x2,y2); + + this.Bounds.CheckPoint(_x1, _y1); + this.Bounds.CheckPoint(_x2, _y2); + }, + ds : function() + { + }, + df : function() + { + }, + + // canvas state + save : function() + { + }, + restore : function() + { + }, + clip : function() + { + }, + + reset : function() + { + this.m_oTransform.Reset(); + this.CalculateFullTransform(); + }, + + transform3 : function(m) + { + this.m_oTransform = m.CreateDublicate(); + this.CalculateFullTransform(); + }, + + transform00 : function(m) + { + this.m_oTransform = m.CreateDublicate(); + this.m_oTransform.tx = 0; + this.m_oTransform.ty = 0; + this.CalculateFullTransform(); + }, + + // images + drawImage2 : function(img,x,y,w,h) + { + var _x1 = this.m_oFullTransform.TransformPointX(x,y); + var _y1 = this.m_oFullTransform.TransformPointY(x,y); + + var _x2 = this.m_oFullTransform.TransformPointX(x+w,y); + var _y2 = this.m_oFullTransform.TransformPointY(x+w,y); + + var _x3 = this.m_oFullTransform.TransformPointX(x+w,y+h); + var _y3 = this.m_oFullTransform.TransformPointY(x+w,y+h); + + var _x4 = this.m_oFullTransform.TransformPointX(x,y+h); + var _y4 = this.m_oFullTransform.TransformPointY(x,y+h); + + this.Bounds.CheckPoint(_x1, _y1); + this.Bounds.CheckPoint(_x2, _y2); + this.Bounds.CheckPoint(_x3, _y3); + this.Bounds.CheckPoint(_x4, _y4); + }, + drawImage : function(img,x,y,w,h) + { + return this.drawImage2(img, x, y, w, h); + }, + + // text + font : function(font_id,font_size) + { + this.m_oFontManager.LoadFontFromFile(font_id, font_size, this.m_dDpiX, this.m_dDpiY); + }, + GetFont : function() + { + return this.m_oCurFont; + }, + SetFont : function(font) + { + this.m_oCurFont = font; + }, + FillText : function(x,y,text) + { + // убыÑтеренный вариант. здеÑÑŒ везде заточка на то, что приходит одна буква + if (this.m_bIsBreak) + return; + + // TODO: нужен другой метод отриÑовки!!! + var _x = this.m_oFullTransform.TransformPointX(x, y); + var _y = this.m_oFullTransform.TransformPointY(x, y); + this.Bounds.CheckRect(_x, _y, 1, 1); + }, + + FillTextCode : function(x,y,lUnicode) + { + // убыÑтеренный вариант. здеÑÑŒ везде заточка на то, что приходит одна буква + if (this.m_bIsBreak) + return; + + // TODO: нужен другой метод отриÑовки!!! + var _x = this.m_oFullTransform.TransformPointX(x, y); + var _y = this.m_oFullTransform.TransformPointY(x, y); + this.Bounds.CheckRect(_x, _y, 1, 1); + }, + + t : function(text,x,y) + { + if (this.m_bIsBreak) + return; + + // TODO: нужен другой метод отриÑовки!!! + var _x = this.m_oFullTransform.TransformPointX(x, y); + var _y = this.m_oFullTransform.TransformPointY(x, y); + this.Bounds.CheckRect(_x, _y, 1, 1); + }, + FillText2 : function(x,y,text,cropX,cropW) + { + // убыÑтеренный вариант. здеÑÑŒ везде заточка на то, что приходит одна буква + if (this.m_bIsBreak) + return; + + // TODO: нужен другой метод отриÑовки!!! + var _x = this.m_oFullTransform.TransformPointX(x, y); + var _y = this.m_oFullTransform.TransformPointY(x, y); + this.Bounds.CheckRect(_x, _y, 1, 1); + }, + t2 : function(text,x,y,cropX,cropW) + { + if (this.m_bIsBreak) + return; + + // TODO: нужен другой метод отриÑовки!!! + var _x = this.m_oFullTransform.TransformPointX(x, y); + var _y = this.m_oFullTransform.TransformPointY(x, y); + this.Bounds.CheckRect(_x, _y, 1, 1); + }, + charspace : function(space) + { + }, + + // private methods + DrawHeaderEdit : function(yPos) + { + }, + DrawFooterEdit : function(yPos) + { + }, + + DrawEmptyTableLine : function(x1,y1,x2,y2) + { + }, + + // smart methods for horizontal / vertical lines + drawHorLine : function(align, y, x, r, penW) + { + var _x1 = this.m_oFullTransform.TransformPointX(x,y-penW); + var _y1 = this.m_oFullTransform.TransformPointY(x,y-penW); + + var _x2 = this.m_oFullTransform.TransformPointX(x,y+penW); + var _y2 = this.m_oFullTransform.TransformPointY(x,y+penW); + + var _x3 = this.m_oFullTransform.TransformPointX(r,y-penW); + var _y3 = this.m_oFullTransform.TransformPointY(r,y-penW); + + var _x4 = this.m_oFullTransform.TransformPointX(r,y+penW); + var _y4 = this.m_oFullTransform.TransformPointY(r,y+penW); + + this.Bounds.CheckPoint(_x1, _y1); + this.Bounds.CheckPoint(_x2, _y2); + this.Bounds.CheckPoint(_x3, _y3); + this.Bounds.CheckPoint(_x4, _y4); + }, + drawVerLine : function(align, x, y, b, penW) + { + var _x1 = this.m_oFullTransform.TransformPointX(x-penW,y); + var _y1 = this.m_oFullTransform.TransformPointY(x-penW,y); + + var _x2 = this.m_oFullTransform.TransformPointX(x+penW,y); + var _y2 = this.m_oFullTransform.TransformPointY(x+penW,y); + + var _x3 = this.m_oFullTransform.TransformPointX(x-penW,b); + var _y3 = this.m_oFullTransform.TransformPointY(x-penW,b); + + var _x4 = this.m_oFullTransform.TransformPointX(x+penW,b); + var _y4 = this.m_oFullTransform.TransformPointY(x+penW,b); + + this.Bounds.CheckPoint(_x1, _y1); + this.Bounds.CheckPoint(_x2, _y2); + this.Bounds.CheckPoint(_x3, _y3); + this.Bounds.CheckPoint(_x4, _y4); + }, + + // мега крутые функции Ð´Ð»Ñ Ñ‚Ð°Ð±Ð»Ð¸Ñ† + drawHorLineExt : function(align, y, x, r, penW, leftMW, rightMW) + { + this.drawHorLine(align, y, x + leftMW, r + rightMW); + }, + + rect : function(x,y,w,h) + { + var _x1 = this.m_oFullTransform.TransformPointX(x,y); + var _y1 = this.m_oFullTransform.TransformPointY(x,y); + + var _x2 = this.m_oFullTransform.TransformPointX(x+w,y); + var _y2 = this.m_oFullTransform.TransformPointY(x+w,y); + + var _x3 = this.m_oFullTransform.TransformPointX(x+w,y+h); + var _y3 = this.m_oFullTransform.TransformPointY(x+w,y+h); + + var _x4 = this.m_oFullTransform.TransformPointX(x,y+h); + var _y4 = this.m_oFullTransform.TransformPointY(x,y+h); + + this.Bounds.CheckPoint(_x1, _y1); + this.Bounds.CheckPoint(_x2, _y2); + this.Bounds.CheckPoint(_x3, _y3); + this.Bounds.CheckPoint(_x4, _y4); + }, + + rect2 : function(x,y,w,h) + { + var _x1 = this.m_oFullTransform.TransformPointX(x,y); + var _y1 = this.m_oFullTransform.TransformPointY(x,y); + + var _x2 = this.m_oFullTransform.TransformPointX(x+w,y); + var _y2 = this.m_oFullTransform.TransformPointY(x+w,y); + + var _x3 = this.m_oFullTransform.TransformPointX(x+w,y-h); + var _y3 = this.m_oFullTransform.TransformPointY(x+w,y-h); + + var _x4 = this.m_oFullTransform.TransformPointX(x,y-h); + var _y4 = this.m_oFullTransform.TransformPointY(x,y-h); + + this.Bounds.CheckPoint(_x1, _y1); + this.Bounds.CheckPoint(_x2, _y2); + this.Bounds.CheckPoint(_x3, _y3); + this.Bounds.CheckPoint(_x4, _y4); + }, + + TableRect : function(x,y,w,h) + { + this.rect(x, y, w, h); + }, + + // функции ÐºÐ»Ð¸Ð¿Ð¿Ð¸Ñ€Ð¾Ð²Ð°Ð½Ð¸Ñ + AddClipRect : function(x, y, w, h) + { + }, + RemoveClipRect : function() + { + }, + + SetClip : function(r) + { + }, + RemoveClip : function() + { + }, + + SavePen : function() + { + }, + RestorePen : function() + { + }, + + SaveBrush : function() + { + }, + RestoreBrush : function() + { + }, + + SavePenBrush : function() + { + }, + RestorePenBrush : function() + { + }, + + SaveGrState : function() + { + }, + RestoreGrState : function() + { + }, + + StartClipPath : function() + { + }, + + EndClipPath : function() + { + }, + + CorrectBounds : function() + { + if (this.LineWidth != null) + { + var _correct = this.LineWidth / 2.0; + + this.Bounds.min_x -= _correct; + this.Bounds.min_y -= _correct; + this.Bounds.max_x += _correct; + this.Bounds.max_y += _correct; + } + }, + + CorrectBounds2 : function() + { + if (this.LineWidth != null) + { + var _correct = this.LineWidth * this.m_oCoordTransform.sx / 2; + + this.Bounds.min_x -= _correct; + this.Bounds.min_y -= _correct; + this.Bounds.max_x += _correct; + this.Bounds.max_y += _correct; + } + } +}; \ No newline at end of file diff --git a/Excel/native/native.js b/Excel/native/native.js index d9e674c47..e16c2e6ab 100644 --- a/Excel/native/native.js +++ b/Excel/native/native.js @@ -1381,6 +1381,1334 @@ function asc_menu_WriteFontFamily(_type, _family, _stream) { _stream["WriteByte"](255); } +function asc_menu_ReadAscFill_solid(_params, _cursor){ + var _fill = new asc_CFillSolid(); + + var _continue = true; + while (_continue) + { + var _attr = _params[_cursor.pos++]; + switch (_attr) + { + case 0: + { + _fill.color = asc_menu_ReadColor(_params, _cursor); + break; + } + case 255: + default: + { + _continue = false; + break; + } + } + } + + return _fill; +} +function asc_menu_WriteAscFill_solid(_type, _fill, _stream){ + if (!_fill) + return; + + _stream["WriteByte"](_type); + + asc_menu_WriteColor(0, _fill.color, _stream); + + _stream["WriteByte"](255); +} +function asc_menu_ReadAscFill_patt(_params, _cursor){ + var _fill = new asc_CFillHatch(); + + var _continue = true; + while (_continue) + { + var _attr = _params[_cursor.pos++]; + switch (_attr) + { + case 0: + { + _fill.PatternType = _params[_cursor.pos++]; + break; + } + case 1: + { + _fill.bgClr = asc_menu_ReadColor(_params, _cursor); + break; + } + case 2: + { + _fill.fgClr = asc_menu_ReadColor(_params, _cursor); + break; + } + case 255: + default: + { + _continue = false; + break; + } + } + } + + return _fill; +} +function asc_menu_WriteAscFill_patt(_type, _fill, _stream){ + if (!_fill) + return; + + _stream["WriteByte"](_type); + + if (_fill.PatternType !== undefined && _fill.PatternType !== null) + { + _stream["WriteByte"](0); + _stream["WriteLong"](_fill.PatternType); + } + + asc_menu_WriteColor(1, _fill.bgClr, _stream); + asc_menu_WriteColor(2, _fill.fgClr, _stream); + + _stream["WriteByte"](255); +} +function asc_menu_ReadAscFill_grad(_params, _cursor){ + var _fill = new asc_CFillGrad(); + + var _continue = true; + while (_continue) + { + var _attr = _params[_cursor.pos++]; + switch (_attr) + { + case 0: + { + _fill.GradType = _params[_cursor.pos++]; + break; + } + case 1: + { + _fill.LinearAngle = _params[_cursor.pos++]; + break; + } + case 2: + { + _fill.LinearScale = _params[_cursor.pos++]; + break; + } + case 3: + { + _fill.PathType = _params[_cursor.pos++]; + break; + } + case 4: + { + var _count = _params[_cursor.pos++]; + + if (_count > 0) + { + _fill.Colors = []; + _fill.Positions = []; + } + for (var i = 0; i < _count; i++) + { + _fill.Colors[i] = null; + _fill.Positions[i] = null; + + var _continue2 = true; + while (_continue2) + { + var _attr2 = _params[_cursor.pos++]; + switch (_attr2) + { + case 0: + { + _fill.Colors[i] = asc_menu_ReadColor(_params, _cursor); + break; + } + case 1: + { + _fill.Positions[i] = _params[_cursor.pos++]; + break; + } + case 255: + default: + { + _continue2 = false; + break; + } + } + } + } + break; + } + case 255: + default: + { + _continue = false; + break; + } + } + } + + return _fill; +} +function asc_menu_WriteAscFill_grad(_type, _fill, _stream){ + if (!_fill) + return; + + _stream["WriteByte"](_type); + + if (_fill.GradType !== undefined && _fill.GradType !== null) + { + _stream["WriteByte"](0); + _stream["WriteLong"](_fill.GradType); + } + + if (_fill.LinearAngle !== undefined && _fill.LinearAngle !== null) + { + _stream["WriteByte"](1); + _stream["WriteDouble2"](_fill.LinearAngle); + } + + if (_fill.LinearScale !== undefined && _fill.LinearScale !== null) + { + _stream["WriteByte"](2); + _stream["WriteBool"](_fill.LinearScale); + } + + if (_fill.PathType !== undefined && _fill.PathType !== null) + { + _stream["WriteByte"](3); + _stream["WriteLong"](_fill.PathType); + } + + if (_fill.Colors !== null && _fill.Colors !== undefined && _fill.Positions !== null && _fill.Positions !== undefined) + { + if (_fill.Colors.length == _fill.Positions.length) + { + var _count = _fill.Colors.length; + _stream["WriteByte"](4); + _stream["WriteLong"](_count); + + for (var i = 0; i < _count; i++) + { + asc_menu_WriteColor(0, _fill.Colors[i], _stream); + + if (_fill.Positions[i] !== undefined && _fill.Positions[i] !== null) + { + _stream["WriteByte"](1); + _stream["WriteDouble2"](_fill.Positions[i]); + } + + _stream["WriteByte"](255); + } + } + } + + _stream["WriteByte"](255); +} +function asc_menu_ReadAscFill_blip(_params, _cursor){ + var _fill = new asc_CFillBlip(); + + var _continue = true; + while (_continue) + { + var _attr = _params[_cursor.pos++]; + switch (_attr) + { + case 0: + { + _fill.type = _params[_cursor.pos++]; + break; + } + case 1: + { + _fill.url = _params[_cursor.pos++]; + break; + } + case 2: + { + _fill.texture_id = _params[_cursor.pos++]; + break; + } + case 255: + default: + { + _continue = false; + break; + } + } + } + + return _fill; +} +function asc_menu_WriteAscFill_blip(_type, _fill, _stream){ + if (!_fill) + return; + + _stream["WriteByte"](_type); + + if (_fill.type !== undefined && _fill.type !== null) + { + _stream["WriteByte"](0); + _stream["WriteLong"](_fill.type); + } + + if (_fill.url !== undefined && _fill.url !== null) + { + _stream["WriteByte"](1); + _stream["WriteString2"](_fill.url); + } + + if (_fill.texture_id !== undefined && _fill.texture_id !== null) + { + _stream["WriteByte"](2); + _stream["WriteLong"](_fill.texture_id); + } + + _stream["WriteByte"](255); +} +function asc_menu_ReadAscFill(_params, _cursor){ + var _fill = new asc_CShapeFill(); + + //_fill.type = c_oAscFill.FILL_TYPE_NOFILL; + var _continue = true; + while (_continue) + { + var _attr = _params[_cursor.pos++]; + switch (_attr) + { + case 0: + { + _fill.type = _params[_cursor.pos++]; + break; + } + case 1: + { + switch (_fill.type) + { + case c_oAscFill.FILL_TYPE_SOLID: + { + _fill.fill = asc_menu_ReadAscFill_solid(_params, _cursor); + break; + } + case c_oAscFill.FILL_TYPE_PATT: + { + _fill.fill = asc_menu_ReadAscFill_patt(_params, _cursor); + break; + } + case c_oAscFill.FILL_TYPE_GRAD: + { + _fill.fill = asc_menu_ReadAscFill_grad(_params, _cursor); + break; + } + case c_oAscFill.FILL_TYPE_BLIP: + { + _fill.fill = asc_menu_ReadAscFill_blip(_params, _cursor); + break; + } + default: + break; + } + break; + } + case 2: + { + _fill.transparent = _params[_cursor.pos++]; + break; + } + case 255: + default: + { + _continue = false; + break; + } + } + } + + return _fill; + +} +function asc_menu_WriteAscFill(_type, _fill, _stream){ + if (!_fill) + return; + + _stream["WriteByte"](_type); + + if (_fill.type !== undefined && _fill.type !== null) + { + _stream["WriteByte"](0); + _stream["WriteLong"](_fill.type); + } + + if (_fill.fill !== undefined && _fill.fill !== null) + { + switch (_fill.type) + { + case c_oAscFill.FILL_TYPE_SOLID: + { + _fill.fill = asc_menu_WriteAscFill_solid(1, _fill.fill, _stream); + break; + } + case c_oAscFill.FILL_TYPE_PATT: + { + _fill.fill = asc_menu_ReadAscFill_patt(1, _fill.fill, _stream); + break; + } + case c_oAscFill.FILL_TYPE_GRAD: + { + _fill.fill = asc_menu_ReadAscFill_grad(1, _fill.fill, _stream); + break; + } + case c_oAscFill.FILL_TYPE_BLIP: + { + _fill.fill = asc_menu_ReadAscFill_blip(1, _fill.fill, _stream); + break; + } + default: + break; + } + } + + if (_fill.transparent !== undefined && _fill.transparent !== null) + { + _stream["WriteByte"](2); + _stream["WriteLong"](_fill.transparent); + } + + _stream["WriteByte"](255); +} +function asc_menu_ReadAscStroke(_params, _cursor){ + var _stroke = new asc_CStroke(); + + var _continue = true; + while (_continue) + { + var _attr = _params[_cursor.pos++]; + switch (_attr) + { + case 0: + { + _stroke.type = _params[_cursor.pos++]; + break; + } + case 1: + { + _stroke.width = _params[_cursor.pos++]; + break; + } + case 2: + { + _stroke.color = asc_menu_ReadColor(_params, _cursor); + break; + } + case 3: + { + _stroke.LineJoin = _params[_cursor.pos++]; + break; + } + case 4: + { + _stroke.LineCap = _params[_cursor.pos++]; + break; + } + case 5: + { + _stroke.LineBeginStyle = _params[_cursor.pos++]; + break; + } + case 6: + { + _stroke.LineBeginSize = _params[_cursor.pos++]; + break; + } + case 7: + { + _stroke.LineEndStyle = _params[_cursor.pos++]; + break; + } + case 8: + { + _stroke.LineEndSize = _params[_cursor.pos++]; + break; + } + case 9: + { + _stroke.canChangeArrows = _params[_cursor.pos++]; + break; + } + case 255: + default: + { + _continue = false; + break; + } + } + } + + return _stroke; +} +function asc_menu_WriteAscStroke(_type, _stroke, _stream){ + if (!_stroke) + return; + + _stream["WriteByte"](_type); + + if (_stroke.type !== undefined && _stroke.type !== null) + { + _stream["WriteByte"](0); + _stream["WriteLong"](_stroke.type); + } + if (_stroke.width !== undefined && _stroke.width !== null) + { + _stream["WriteByte"](1); + _stream["WriteDouble2"](_stroke.width); + } + + asc_menu_WriteColor(2, _stroke.color, _stream); + + if (_stroke.LineJoin !== undefined && _stroke.LineJoin !== null) + { + _stream["WriteByte"](3); + _stream["WriteByte"](_stroke.LineJoin); + } + if (_stroke.LineCap !== undefined && _stroke.LineCap !== null) + { + _stream["WriteByte"](4); + _stream["WriteByte"](_stroke.LineCap); + } + if (_stroke.LineBeginStyle !== undefined && _stroke.LineBeginStyle !== null) + { + _stream["WriteByte"](5); + _stream["WriteByte"](_stroke.LineBeginStyle); + } + if (_stroke.LineBeginSize !== undefined && _stroke.LineBeginSize !== null) + { + _stream["WriteByte"](6); + _stream["WriteByte"](_stroke.LineBeginSize); + } + if (_stroke.LineEndStyle !== undefined && _stroke.LineEndStyle !== null) + { + _stream["WriteByte"](7); + _stream["WriteByte"](_stroke.LineEndStyle); + } + if (_stroke.LineEndSize !== undefined && _stroke.LineEndSize !== null) + { + _stream["WriteByte"](8); + _stream["WriteByte"](_stroke.LineEndSize); + } + + if (_stroke.canChangeArrows !== undefined && _stroke.canChangeArrows !== null) + { + _stream["WriteByte"](9); + _stream["WriteBool"](_stroke.canChangeArrows); + } + + _stream["WriteByte"](255); + +} +function asc_menu_ReadPaddings(_params, _cursor){ + var _paddings = new asc_CPaddings(); + var _continue = true; + while (_continue) + { + var _attr = _params[_cursor.pos++]; + switch (_attr) + { + case 0: + { + _paddings.Left = _params[_cursor.pos++]; + break; + } + case 1: + { + _paddings.Top = _params[_cursor.pos++]; + break; + } + case 2: + { + _paddings.Right = _params[_cursor.pos++]; + break; + } + case 3: + { + _paddings.Bottom = _params[_cursor.pos++]; + break; + } + case 255: + default: + { + _continue = false; + break; + } + } + } + return _paddings; +} +function asc_menu_WritePaddings(_type, _paddings, _stream){ + if (!_paddings) + return; + + _stream["WriteByte"](_type); + + if (_paddings.Left !== undefined && _paddings.Left !== null) + { + _stream["WriteByte"](0); + _stream["WriteDouble2"](_paddings.Left); + } + if (_paddings.Top !== undefined && _paddings.Top !== null) + { + _stream["WriteByte"](1); + _stream["WriteDouble2"](_paddings.Top); + } + if (_paddings.Right !== undefined && _paddings.Right !== null) + { + _stream["WriteByte"](2); + _stream["WriteDouble2"](_paddings.Right); + } + if (_paddings.Bottom !== undefined && _paddings.Bottom !== null) + { + _stream["WriteByte"](3); + _stream["WriteDouble2"](_paddings.Bottom); + } + + _stream["WriteByte"](255); +} +function asc_menu_ReadPosition(_params, _cursor){ + var _position = new CPosition(); + var _continue = true; + while (_continue) + { + var _attr = _params[_cursor.pos++]; + switch (_attr) + { + case 0: + { + _position.X = _params[_cursor.pos++]; + break; + } + case 1: + { + _position.Y = _params[_cursor.pos++]; + break; + } + case 255: + default: + { + _continue = false; + break; + } + } + } + return _position; +} +function asc_menu_WritePosition(_type, _position, _stream){ + if (!_position) + return; + + _stream["WriteByte"](_type); + + if (_position.X !== undefined && _position.X !== null) + { + _stream["WriteByte"](0); + _stream["WriteDouble2"](_position.X); + } + if (_position.Y !== undefined && _position.Y !== null) + { + _stream["WriteByte"](1); + _stream["WriteDouble2"](_position.Y); + } + + _stream["WriteByte"](255); +} +function asc_menu_ReadImagePosition(_params, _cursor){ + var _position = new CPosition(); + var _continue = true; + while (_continue) + { + var _attr = _params[_cursor.pos++]; + switch (_attr) + { + case 0: + { + _position.RelativeFrom = _params[_cursor.pos++]; + break; + } + case 1: + { + _position.UseAlign = _params[_cursor.pos++]; + break; + } + case 2: + { + _position.Align = _params[_cursor.pos++]; + break; + } + case 3: + { + _position.Value = _params[_cursor.pos++]; + break; + } + case 255: + default: + { + _continue = false; + break; + } + } + } + return _position; +} +function asc_menu_WriteImagePosition(_type, _position, _stream){ + if (!_position) + return; + + _stream["WriteByte"](_type); + + if (_position.RelativeFrom !== undefined && _position.RelativeFrom !== null) + { + _stream["WriteByte"](0); + _stream["WriteLong"](_position.RelativeFrom); + } + if (_position.UseAlign !== undefined && _position.UseAlign !== null) + { + _stream["WriteByte"](1); + _stream["WriteBool"](_position.UseAlign); + } + if (_position.Align !== undefined && _position.Align !== null) + { + _stream["WriteByte"](2); + _stream["WriteLong"](_position.Align); + } + if (_position.Value !== undefined && _position.Value !== null) + { + _stream["WriteByte"](3); + _stream["WriteLong"](_position.Value); + } + + _stream["WriteByte"](255); +} +function asc_menu_ReadAscValAxisSettings(_params, _cursor){ + var _settings = new asc_ValAxisSettings(); + + var _continue = true; + while (_continue) + { + var _attr = _params[_cursor.pos++]; + switch (_attr) + { + case 0: + { + _settings.minValRule = _params[_cursor.pos++]; + break; + } + case 1: + { + _settings.minVal = _params[_cursor.pos++]; + break; + } + case 2: + { + _settings.maxValRule = _params[_cursor.pos++]; + break; + } + case 3: + { + _settings.maxVal = _params[_cursor.pos++]; + break; + } + case 4: + { + _settings.invertValOrder = _params[_cursor.pos++]; + break; + } + case 5: + { + _settings.logScale = _params[_cursor.pos++]; + break; + } + case 6: + { + _settings.logBase = _params[_cursor.pos++]; + break; + } + case 7: + { + _settings.dispUnitsRule = _params[_cursor.pos++]; + break; + } + case 8: + { + _settings.units = _params[_cursor.pos++]; + break; + } + case 9: + { + _settings.showUnitsOnChart = _params[_cursor.pos++]; + break; + } + case 10: + { + _settings.majorTickMark = _params[_cursor.pos++]; + break; + } + case 11: + { + _settings.minorTickMark = _params[_cursor.pos++]; + break; + } + case 12: + { + _settings.tickLabelsPos = _params[_cursor.pos++]; + break; + } + case 13: + { + _settings.crossesRule = _params[_cursor.pos++]; + break; + } + case 14: + { + _settings.crosses = _params[_cursor.pos++]; + break; + } + case 15: + { + _settings.axisType = _params[_cursor.pos++]; + break; + } + case 255: + default: + { + _continue = false; + break; + } + } + } + + return _settings; +} +function asc_menu_WriteAscValAxisSettings(_type, _settings, _stream){ + if (!_settings) + return; + + _stream["WriteByte"](_type); + + if (_settings.minValRule !== undefined && _settings.minValRule !== null) + { + _stream["WriteByte"](0); + _stream["WriteLong"](_settings.minValRule); + } + if (_settings.minVal !== undefined && _settings.minVal !== null) + { + _stream["WriteByte"](1); + _stream["WriteLong"](_settings.minVal); + } + if (_settings.maxValRule !== undefined && _settings.maxValRule !== null) + { + _stream["WriteByte"](2); + _stream["WriteLong"](_settings.maxValRule); + } + if (_settings.maxVal !== undefined && _settings.maxVal !== null) + { + _stream["WriteByte"](3); + _stream["WriteLong"](_settings.maxVal); + } + if (_settings.invertValOrder !== undefined && _settings.invertValOrder !== null) + { + _stream["WriteByte"](4); + _stream["WriteBool"](_settings.invertValOrder); + } + if (_settings.logScale !== undefined && _settings.logScale !== null) + { + _stream["WriteByte"](5); + _stream["WriteBool"](_settings.logScale); + } + if (_settings.logBase !== undefined && _settings.logBase !== null) + { + _stream["WriteByte"](6); + _stream["WriteLong"](_settings.logBase); + } + if (_settings.dispUnitsRule !== undefined && _settings.dispUnitsRule !== null) + { + _stream["WriteByte"](7); + _stream["WriteLong"](_settings.dispUnitsRule); + } + if (_settings.units !== undefined && _settings.units !== null) + { + _stream["WriteByte"](8); + _stream["WriteLong"](_settings.units); + } + if (_settings.showUnitsOnChart !== undefined && _settings.showUnitsOnChart !== null) + { + _stream["WriteByte"](9); + _stream["WriteBool"](_settings.showUnitsOnChart); + } + if (_settings.majorTickMark !== undefined && _settings.majorTickMark !== null) + { + _stream["WriteByte"](10); + _stream["WriteLong"](_settings.majorTickMark); + } + if (_settings.minorTickMark !== undefined && _settings.minorTickMark !== null) + { + _stream["WriteByte"](11); + _stream["WriteLong"](_settings.minorTickMark); + } + if (_settings.tickLabelsPos !== undefined && _settings.tickLabelsPos !== null) + { + _stream["WriteByte"](12); + _stream["WriteLong"](_settings.tickLabelsPos); + } + if (_settings.crossesRule !== undefined && _settings.crossesRule !== null) + { + _stream["WriteByte"](13); + _stream["WriteLong"](_settings.crossesRule); + } + if (_settings.crosses !== undefined && _settings.crosses !== null) + { + _stream["WriteByte"](14); + _stream["WriteLong"](_settings.crosses); + } + if (_settings.axisType !== undefined && _settings.axisType !== null) + { + _stream["WriteByte"](15); + _stream["WriteLong"](_settings.axisType); + } + + _stream["WriteByte"](255); +} +function asc_menu_ReadChartPr(_params, _cursor){ + var _settings = new asc_ChartSettings(); + + var _continue = true; + while (_continue) + { + var _attr = _params[_cursor.pos++]; + switch (_attr) + { + case 0: + { + _settings.style = _params[_cursor.pos++]; + break; + } + case 1: + { + _settings.title = _params[_cursor.pos++]; + break; + } + case 2: + { + _settings.rowCols = _params[_cursor.pos++]; + break; + } + case 3: + { + _settings.horAxisLabel = _params[_cursor.pos++]; + break; + } + case 4: + { + _settings.vertAxisLabel = _params[_cursor.pos++]; + break; + } + case 5: + { + _settings.legendPos = _params[_cursor.pos++]; + break; + } + case 6: + { + _settings.dataLabelsPos = _params[_cursor.pos++]; + break; + } + case 7: + { + _settings.horAx = _params[_cursor.pos++]; + break; + } + case 8: + { + _settings.vertAx = _params[_cursor.pos++]; + break; + } + case 9: + { + _settings.horGridLines = _params[_cursor.pos++]; + break; + } + case 10: + { + _settings.vertGridLines = _params[_cursor.pos++]; + break; + } + case 11: + { + _settings.type = _params[_cursor.pos++]; + break; + } + case 12: + { + _settings.showSerName = _params[_cursor.pos++]; + break; + } + case 13: + { + _settings.showCatName = _params[_cursor.pos++]; + break; + } + case 14: + { + _settings.showVal = _params[_cursor.pos++]; + break; + } + case 15: + { + _settings.separator = _params[_cursor.pos++]; + break; + } + case 16: + { + _settings.horAxisProps = asc_menu_ReadAscValAxisSettings(_params, _cursor); + break; + } + case 17: + { + _settings.vertAxisProps = asc_menu_ReadAscValAxisSettings(_params, _cursor); + break; + } + case 18: + { + _settings.range = _params[_cursor.pos++]; + break; + } + case 19: + { + _settings.inColumns = _params[_cursor.pos++]; + break; + } + case 20: + { + _settings.showMarker = _params[_cursor.pos++]; + break; + } + case 21: + { + _settings.bLine = _params[_cursor.pos++]; + break; + } + case 22: + { + _settings.smooth = _params[_cursor.pos++]; + break; + } + case 255: + default: + { + _continue = false; + break; + } + } + } + + return _settings; +} +function asc_menu_WriteChartPr(_type, _chartPr, _stream){ + if (!_chartPr) + return; + + _stream["WriteByte"](_type); + + if (_chartPr.style !== undefined && _chartPr.style !== null) + { + _stream["WriteByte"](0); + _stream["WriteLong"](_chartPr.style); + } + if (_chartPr.title !== undefined && _chartPr.title !== null) + { + _stream["WriteByte"](1); + _stream["WriteLong"](_chartPr.title); + } + if (_chartPr.rowCols !== undefined && _chartPr.rowCols !== null) + { + _stream["WriteByte"](2); + _stream["WriteLong"](_chartPr.rowCols); + } + if (_chartPr.horAxisLabel !== undefined && _chartPr.horAxisLabel !== null) + { + _stream["WriteByte"](3); + _stream["WriteLong"](_chartPr.horAxisLabel); + } + if (_chartPr.vertAxisLabel !== undefined && _chartPr.vertAxisLabel !== null) + { + _stream["WriteByte"](4); + _stream["WriteLong"](_chartPr.vertAxisLabel); + } + if (_chartPr.legendPos !== undefined && _chartPr.legendPos !== null) + { + _stream["WriteByte"](5); + _stream["WriteLong"](_chartPr.legendPos); + } + if (_chartPr.dataLabelsPos !== undefined && _chartPr.dataLabelsPos !== null) + { + _stream["WriteByte"](6); + _stream["WriteLong"](_chartPr.dataLabelsPos); + } + if (_chartPr.horAx !== undefined && _chartPr.horAx !== null) + { + _stream["WriteByte"](7); + _stream["WriteLong"](_chartPr.horAx); + } + if (_chartPr.vertAx !== undefined && _chartPr.vertAx !== null) + { + _stream["WriteByte"](8); + _stream["WriteLong"](_chartPr.vertAx); + } + if (_chartPr.horGridLines !== undefined && _chartPr.horGridLines !== null) + { + _stream["WriteByte"](9); + _stream["WriteLong"](_chartPr.horGridLines); + } + if (_chartPr.vertGridLines !== undefined && _chartPr.vertGridLines !== null) + { + _stream["WriteByte"](10); + _stream["WriteLong"](_chartPr.vertGridLines); + } + if (_chartPr.type !== undefined && _chartPr.type !== null) + { + _stream["WriteByte"](11); + _stream["WriteLong"](_chartPr.type); + } + + if (_chartPr.showSerName !== undefined && _chartPr.showSerName !== null) + { + _stream["WriteByte"](12); + _stream["WriteBool"](_chartPr.showSerName); + } + if (_chartPr.showCatName !== undefined && _chartPr.showCatName !== null) + { + _stream["WriteByte"](13); + _stream["WriteBool"](_chartPr.showCatName); + } + if (_chartPr.showVal !== undefined && _chartPr.showVal !== null) + { + _stream["WriteByte"](14); + _stream["WriteBool"](_chartPr.showVal); + } + + if (_chartPr.separator !== undefined && _chartPr.separator !== null) + { + _stream["WriteByte"](15); + _stream["WriteString2"](_chartPr.separator); + } + + asc_menu_WriteAscValAxisSettings(16, _chartPr.horAxisProps, _stream); + asc_menu_WriteAscValAxisSettings(17, _chartPr.vertAxisProps, _stream); + + if (_chartPr.range !== undefined && _chartPr.range !== null) + { + _stream["WriteByte"](18); + _stream["WriteString2"](_chartPr.range); + } + + if (_chartPr.inColumns !== undefined && _chartPr.inColumns !== null) + { + _stream["WriteByte"](19); + _stream["WriteBool"](_chartPr.inColumns); + } + if (_chartPr.showMarker !== undefined && _chartPr.showMarker !== null) + { + _stream["WriteByte"](20); + _stream["WriteBool"](_chartPr.showMarker); + } + if (_chartPr.bLine !== undefined && _chartPr.bLine !== null) + { + _stream["WriteByte"](21); + _stream["WriteBool"](_chartPr.bLine); + } + if (_chartPr.smooth !== undefined && _chartPr.smooth !== null) + { + _stream["WriteByte"](22); + _stream["WriteBool"](_chartPr.showVal); + } + + _stream["WriteByte"](255); +} +function asc_menu_ReadShapePr(_params, _cursor){ + var _settings = new asc_CShapeProperty(); + + var _continue = true; + while (_continue) + { + var _attr = _params[_cursor.pos++]; + switch (_attr) + { + case 0: + { + _settings.type = _params[_cursor.pos++]; + break; + } + case 1: + { + _settings.fill = asc_menu_ReadAscFill(_params, _cursor); + break; + } + case 2: + { + _settings.stroke = asc_menu_ReadAscStroke(_params, _cursor); + break; + } + case 3: + { + _settings.paddings = asc_menu_ReadPaddings(_params, _cursor); + break; + } + case 4: + { + _settings.canFill = _params[_cursor.pos++]; + break; + } + case 5: + { + _settings.bFromChart = _params[_cursor.pos++]; + break; + } + case 6: + { + _settings.InsertPageNum = _params[_cursor.pos++]; + } + case 255: + default: + { + _continue = false; + break; + } + } + } + + return _settings; +} +function asc_menu_WriteShapePr(_type, _shapePr, _stream){ + if (!_shapePr) + return; + + _stream["WriteByte"](_type); + + if (_shapePr.type !== undefined && _shapePr.type !== null) + { + _stream["WriteByte"](0); + _stream["WriteString2"](_shapePr.type); + } + + asc_menu_WriteAscFill(1, _shapePr.fill, _stream); + asc_menu_WriteAscStroke(2, _shapePr.stroke, _stream); + asc_menu_WritePaddings(3, _shapePr.paddings, _stream); + + if (_shapePr.canFill !== undefined && _shapePr.canFill !== null) + { + _stream["WriteByte"](4); + _stream["WriteBool"](_shapePr.canFill); + } + if (_shapePr.bFromChart !== undefined && _shapePr.bFromChart !== null) + { + _stream["WriteByte"](5); + _stream["WriteBool"](_shapePr.bFromChart); + } + + _stream["WriteByte"](255); +} +function asc_menu_WriteImagePr(_imagePr, _stream){ + if (_imagePr.CanBeFlow !== undefined && _imagePr.CanBeFlow !== null) + { + _stream["WriteByte"](0); + _stream["WriteBool"](_imagePr.CanBeFlow); + } + if (_imagePr.Width !== undefined && _imagePr.Width !== null) + { + _stream["WriteByte"](1); + _stream["WriteDouble2"](_imagePr.Width); + } + if (_imagePr.Height !== undefined && _imagePr.Height !== null) + { + _stream["WriteByte"](2); + _stream["WriteDouble2"](_imagePr.Height); + } + if (_imagePr.WrappingStyle !== undefined && _imagePr.WrappingStyle !== null) + { + _stream["WriteByte"](3); + _stream["WriteLong"](_imagePr.WrappingStyle); + } + + asc_menu_WritePaddings(4, _imagePr.Paddings, _stream); + asc_menu_WritePosition(5, _imagePr.Position, _stream); + + if (_imagePr.AllowOverlap !== undefined && _imagePr.AllowOverlap !== null) + { + _stream["WriteByte"](6); + _stream["WriteBool"](_imagePr.AllowOverlap); + } + + asc_menu_WriteImagePosition(7, _imagePr.PositionH, _stream); + asc_menu_WriteImagePosition(8, _imagePr.PositionV, _stream); + + if (_imagePr.Internal_Position !== undefined && _imagePr.Internal_Position !== null) + { + _stream["WriteByte"](9); + _stream["WriteLong"](_imagePr.Internal_Position); + } + + if (_imagePr.ImageUrl !== undefined && _imagePr.ImageUrl !== null) + { + _stream["WriteByte"](10); + _stream["WriteString2"](_imagePr.ImageUrl); + } + + if (_imagePr.Locked !== undefined && _imagePr.Locked !== null) + { + _stream["WriteByte"](11); + _stream["WriteBool"](_imagePr.Locked); + } + + asc_menu_WriteChartPr(12, _imagePr.ChartProperties, _stream); + asc_menu_WriteShapePr(13, _imagePr.ShapeProperties, _stream); + + if (_imagePr.ChangeLevel !== undefined && _imagePr.ChangeLevel !== null) + { + _stream["WriteByte"](14); + _stream["WriteLong"](_imagePr.ChangeLevel); + } + + if (_imagePr.Group !== undefined && _imagePr.Group !== null) + { + _stream["WriteByte"](15); + _stream["WriteLong"](_imagePr.Group); + } + + if (_imagePr.fromGroup !== undefined && _imagePr.fromGroup !== null) + { + _stream["WriteByte"](16); + _stream["WriteBool"](_imagePr.fromGroup); + } + if (_imagePr.severalCharts !== undefined && _imagePr.severalCharts !== null) + { + _stream["WriteByte"](17); + _stream["WriteBool"](_imagePr.severalCharts); + } + + if (_imagePr.severalChartTypes !== undefined && _imagePr.severalChartTypes !== null) + { + _stream["WriteByte"](18); + _stream["WriteLong"](_imagePr.severalChartTypes); + } + if (_imagePr.severalChartStyles !== undefined && _imagePr.severalChartStyles !== null) + { + _stream["WriteByte"](19); + _stream["WriteLong"](_imagePr.severalChartStyles); + } + if (_imagePr.verticalTextAlign !== undefined && _imagePr.verticalTextAlign !== null) + { + _stream["WriteByte"](20); + _stream["WriteLong"](_imagePr.verticalTextAlign); + } + + _stream["WriteByte"](255); +} function asc_ReadCBorder(s, p) { var color = null; @@ -1843,6 +3171,8 @@ function OfflineEditor () { stream["ClearNoAttack"](); asc_WriteCCelInfo(cellInfo, stream); window["native"]["OnCallMenuEvent"](2402, stream); // ASC_SPREADSHEETS_EVENT_TYPE_SELECTION_CHANGED + + t.onSelectionChanged(cellInfo); }); _api.asc_registerCallback('asc_onEditorSelectionChanged', function(font) { var stream = global_memory_stream_menu; @@ -2169,27 +3499,73 @@ function OfflineEditor () { var pagesData = _api.wb.calcPagesPrint(adjustPrint); var pdfWriter = new CPdfPrinter(); var isEndPrint = _api.wb.printSheet(pdfWriter, pagesData); - var str = pdfWriter.DocumentRenderer.Memory.GetBase64Memory(); - return str; + return pdfWriter.DocumentRenderer.Memory.GetBase64Memory(); + }; + + this.onSelectionChanged = function(info) { + var stream = global_memory_stream_menu; + stream["ClearNoAttack"](); + + var SelectedObjects = [], selectType = info.asc_getFlags().asc_getSelectionType(); + if (selectType == c_oAscSelectionType.RangeImage || selectType == c_oAscSelectionType.RangeShape || + selectType == c_oAscSelectionType.RangeChart || selectType == c_oAscSelectionType.RangeChartText || + selectType == c_oAscSelectionType.RangeShapeText) + { + SelectedObjects = _api.asc_getGraphicObjectProps(); + + var count = SelectedObjects.length; + var naturalCount = count; + + stream["WriteLong"](naturalCount); + + for (var i = 0; i < count; i++) + { + switch (SelectedObjects[i].asc_getObjectType()) + { + case c_oAscTypeSelectElement.Image: + { + stream["WriteLong"](c_oAscTypeSelectElement.Image); + asc_menu_WriteImagePr(SelectedObjects[i].Value, stream); + break; + } + case c_oAscTypeSelectElement.Hyperlink: + { + stream["WriteLong"](c_oAscTypeSelectElement.Hyperlink); + asc_menu_WriteHyperPr(SelectedObjects[i].Value, stream); + break; + } + case c_oAscTypeSelectElement.SpellCheck: + default: + { + // none + break; + } + } + } + + if (count) + { + window["native"]["OnCallMenuEvent"](6, stream); + } + } }; - this.offline_addImageDrawingObject = function(imageUrl, options) { + this.offline_addImageDrawingObject = function(options) { var worksheet = _api.wb.getWorksheet(); var objectRender = worksheet.objectRender; var _this = objectRender; + var objectId = null; + var imageUrl = options[0]; function ascCvtRatio(fromUnits, toUnits) { return asc.getCvtRatio(fromUnits, toUnits, objectRender.getContext().getPPIX()); } - function ptToMm(val) { return val * ascCvtRatio(1, 3); } - function pxToPt(val) { return val * ascCvtRatio(0, 1); } - function pxToMm(val) { return val * ascCvtRatio(0, 3); } @@ -2241,7 +3617,7 @@ function OfflineEditor () { object.to.row = toCell.row; object.to.rowOff = ptToMm(toCell.rowOff); - // worksheet.handlers.trigger("reinitializeScroll"); + // worksheet.handlers.trigger("reinitializeScroll"); }; var addImageObject = function (_image) { @@ -2271,7 +3647,7 @@ function OfflineEditor () { //calculateObjectMetrics(drawingObject, isOption ? options.width : _image.Image.width, isOption ? options.height : _image.Image.height); - calculateObjectMetrics(drawingObject, options.width, options.height); + calculateObjectMetrics(drawingObject, options[1], options[2]); var coordsFrom = _this.coordsManager.calculateCoords(drawingObject.from); var coordsTo = _this.coordsManager.calculateCoords(drawingObject.to); @@ -2290,10 +3666,56 @@ function OfflineEditor () { //} worksheet.setSelectionShape(true); + + if (_this.controller.selectedObjects.length) { + objectId = _this.controller.selectedObjects[0].Id; + } }; addImageObject(new Image()); } + + return objectId; + }; + this.offline_addShapeDrawingObject = function(params) { + var ws = _api.wb.getWorksheet(); + var objectRender = ws.objectRender; + var objectId = null; + var current = {pos: 0}; + var shapeProp = asc_menu_ReadShapePr(params[0], current); + var left = params[1]; + var top = params[2]; + var right = params[3]; + var bottom = params[4]; + + function ascCvtRatio(fromUnits, toUnits) { + return asc.getCvtRatio(fromUnits, toUnits, objectRender.getContext().getPPIX()); + } + function ptToMm(val) { + return val * ascCvtRatio(1, 3); + } + function pxToPt(val) { + return val * ascCvtRatio(0, 1); + } + function pxToMm(val) { + return val * ascCvtRatio(0, 3); + } + + _api.asc_startAddShape(shapeProp.type); + + objectRender.controller.OnMouseDown({}, pxToMm(left), pxToMm(top), 0); + objectRender.controller.OnMouseMove({IsLocked: true}, pxToMm(right), pxToMm(bottom), 0); + objectRender.controller.OnMouseUp({}, pxToMm(left), pxToMm(bottom), 0); + + _api.asc_endAddShape(); + + if (objectRender.controller.selectedObjects.length) { + objectId = objectRender.controller.selectedObjects[0].Id; + } + + ws.setSelectionShape(true); + + return objectId; }; } var _s = new OfflineEditor(); @@ -2303,7 +3725,6 @@ function offline_stz(v) {_s.zoom = v; _api.asc_setZoom(v);} function offline_ds(x, y, width, height, ratio) {_s.drawSheet(x, y, width, height, ratio);} function offline_dh(x, y, width, height, type, ratio) {_s.drawHeader(x, y, width, height, type, ratio);} function offline_mouse_down(x, y, pin) { - _s.isShapeAction = false; var ws = _api.wb.getWorksheet(); @@ -2311,49 +3732,51 @@ function offline_mouse_down(x, y, pin) { ws.objectRender.drawingArea.reinitRanges(); var graphicsInfo = wb._onGetGraphicsInfo(x, y); if (graphicsInfo) { - //console.log('drawing onclick: ' + graphicsInfo.id); - - var e = {Button: 0, ClickCount: 1, shiftKey: false, metaKey: false, ctrlKey: false}; + var e = {isLocked: true, Button: 0, ClickCount: 1, shiftKey: false, metaKey: false, ctrlKey: false}; wb._onGraphicObjectMouseDown(e, x, y); wb._onUpdateSelectionShape(true); _s.isShapeAction = true; - - // _s.selectShapeWidth = graphicsInfo.object.graphicObject.extX; - // _s.selectShapeHeight = graphicsInfo.object.graphicObject.extY; - return {id:graphicsInfo.id}; } _s.cellPin = pin; + if (0 != _s.cellPin) { ws.leftTopRange = ws.activeRange.clone(); - return null; + } else { + ws.changeSelectionStartPoint(x, y, true, true); } - ws.changeSelectionStartPoint(x, y, true, true); return null; } function offline_mouse_move(x, y) { - if (-1 == _s.cellPin) - _api.wb.getWorksheet()._changeSelectionTopLeft(x, y, true, true, true); - else if (1 === _s.cellPin) - _api.wb.getWorksheet()._changeSelectionTopLeft(x, y, true, true, false); - else - _api.wb.getWorksheet().changeSelectionEndPoint(x, y, true, true); + var ws = _api.wb.getWorksheet(); + if (_s.isShapeAction) { + var wb = _api.wb; + var e = {isLocked: true, Button: 0, ClickCount: 1, shiftKey: false, metaKey: false, ctrlKey: false}; + ws.objectRender.graphicObjectMouseMove(e, x, y); + } else { + if (-1 == _s.cellPin) + ws._changeSelectionTopLeft(x, y, true, true, true); + else if (1 === _s.cellPin) + ws._changeSelectionTopLeft(x, y, true, true, false); + else + ws.changeSelectionEndPoint(x, y, true, true); + } } function offline_mouse_up(x, y) { var ws = _api.wb.getWorksheet(); var wb = _api.wb; if (_s.isShapeAction) { - var e = {Button: 0, ClickCount: 1, shiftKey: false, metaKey: false, ctrlKey: false}; + var e = {isLocked: true, Button: 0, ClickCount: 1, shiftKey: false, metaKey: false, ctrlKey: false}; wb._onGraphicObjectMouseUp(e, x, y); - return; + _s.isShapeAction = false; + } else { + wb._onChangeSelectionDone(-1, -1); + _s.cellPin = 0; + wb.getWorksheet().leftTopRange = undefined; } - - _api.wb._onChangeSelectionDone(-1, -1); - _s.cellPin = 0; - _api.wb.getWorksheet().leftTopRange = undefined; } function offline_get_selection(x, y, width, height) { return _s.getSelection(x, y, width, height); @@ -2389,12 +3812,12 @@ function offline_cell_editor_open(isSelectAll, x, y, width, height, ratio) { wb.cellEditor.isSelectAll = isSelectAll; - // if (isCoord) { - wb._onEditCell(x, y, true, undefined, undefined, true, false); - // } - // else { - // wb._onEditCell(parseInt(x), parseInt(y), false, undefined, undefined, true, false); - // } + // if (isCoord) { + wb._onEditCell(x, y, true, undefined, undefined, true, false); + // } + // else { + // wb._onEditCell(parseInt(x), parseInt(y), false, undefined, undefined, true, false); + // } return [wb.cellEditor.left, wb.cellEditor.top, wb.cellEditor.right, wb.cellEditor.bottom, wb.cellEditor.curLeft, wb.cellEditor.curTop, wb.cellEditor.curHeight]; @@ -2423,7 +3846,7 @@ function offline_cell_editor_key_event(keys, width, height, ratio) { wb.cellEditor._draw(); return [wb.cellEditor.left, wb.cellEditor.top, wb.cellEditor.right, wb.cellEditor.bottom, - wb.cellEditor.curLeft, wb.cellEditor.curTop, wb.cellEditor.curHeight]; + wb.cellEditor.curLeft, wb.cellEditor.curTop, wb.cellEditor.curHeight]; } function offline_cell_editor_mouse_event(events, width, height, ratio) { @@ -2503,29 +3926,6 @@ function offline_cell_editor_close(x, y, width, height, ratio) { function offline_cell_editor_selection() { return _api.wb.cellEditor._drawSelection(); } - -function offline_add_shape(x, y) { - -// var e = { -// ShiftKey: false, -// shiftKey: false, -// CtrlKey: false, -// metaKey: false, -// ctrlKey: false, -// Button: false, -// button: false, -// ClickCount: 1 -// }; -// -// var ws = _api.wb.getWorksheet(); -// _api.asc_startAddShape('leftRightArrow'); -// -// ws.objectRender.graphicObjectMouseDown(e, 0, 0); -// ws.objectRender.graphicObjectMouseUp(e, 200, 200); -// -// _api.asc_endAddShape(); -} - function offline_get_cell_in_coord (x, y) { var worksheet = _api.wb.getWorksheet(), activeCell = worksheet.getActiveCell(x, y, true); @@ -2578,12 +3978,12 @@ function offline_copy() { _stream["WriteByte"](1); _stream["WriteStringA"](sBase64.drawingUrls[0]); } - // else + // else //{ - // owner format - _stream["WriteByte"](2); - _stream["WriteStringA"](sBase64.sBase64); - // } + // owner format + _stream["WriteByte"](2); + _stream["WriteStringA"](sBase64.sBase64); + // } // _stream["WriteByte"](3); // _stream["WriteString2"](sBase64.html); @@ -2605,7 +4005,7 @@ function offline_paste(params) { else if (2 == type) { var worksheet = _api.wb.getWorksheet(); - _api.wb.clipboard._pasteFromBinaryExcel(worksheet, params[1]); + _api.wb.clipboard._pasteFromBinaryExcel(worksheet, params[1]); } } function offline_cut() { @@ -2782,13 +4182,13 @@ function offline_apply_event(type,params) { case 50: // ASC_MENU_EVENT_TYPE_INSERT_IMAGE { - _s.offline_addImageDrawingObject(params[0], {width: params[1], height: params[2]}); + _return = _s.offline_addImageDrawingObject(params); break; } case 53: // ASC_MENU_EVENT_TYPE_INSERT_SHAPE { - offline_add_shape(0, 0); + _return = _s.offline_addShapeDrawingObject(params); break; } -- 2.30.9