diff --git a/DesktopEditor/doctrenderer/jsgraphics/graphics.cpp b/DesktopEditor/doctrenderer/jsgraphics/graphics.cpp index 0b9e4634e8..fa536818b1 100644 --- a/DesktopEditor/doctrenderer/jsgraphics/graphics.cpp +++ b/DesktopEditor/doctrenderer/jsgraphics/graphics.cpp @@ -1129,3 +1129,1729 @@ void CJSGraphics::tg(const v8::Local& text, double x, double y) } */ } + +void CJSGraphics::private_FillGlyph(const v8::Local& pGlyph, const v8::Local& _bounds) +{ + /* + var nW = pGlyph.oBitmap.nWidth; + var nH = pGlyph.oBitmap.nHeight; + + if (0 == nW || 0 == nH) + return; + + var _font_manager = this.IsUseFonts2 ? this.m_oFontManager2 : this.m_oFontManager; + + var nX = (_font_manager.m_oGlyphString.m_fX >> 0) + (pGlyph.fX + pGlyph.oBitmap.nX) >> 0; + var nY = (_font_manager.m_oGlyphString.m_fY >> 0) + (pGlyph.fY - pGlyph.oBitmap.nY) >> 0; + + pGlyph.oBitmap.oGlyphData.checkColor(this.m_oBrush.Color1.R,this.m_oBrush.Color1.G,this.m_oBrush.Color1.B,nW,nH); + + if (null == this.TextClipRect) + pGlyph.oBitmap.draw(this.m_oContext, nX, nY, this.TextClipRect); + else + pGlyph.oBitmap.drawCropInRect(this.m_oContext, nX, nY, this.TextClipRect); + + if (_bounds) + { + var _r = nX + pGlyph.oBitmap.nWidth; + var _b = nY + pGlyph.oBitmap.nHeight; + if (_bounds.x > nX) + _bounds.x = nX; + if (_bounds.y > nY) + _bounds.y = nY; + if (_bounds.r < _r) + _bounds.r = _r; + if (_bounds.b < _b) + _bounds.b = _b; + } + */ +} + +void CJSGraphics::private_FillGlyphC(const v8::Local& pGlyph, double cropX, double cropW) +{ + /* + var nW = pGlyph.oBitmap.nWidth; + var nH = pGlyph.oBitmap.nHeight; + + if (0 == nW || 0 == nH) + return; + + var _font_manager = this.IsUseFonts2 ? this.m_oFontManager2 : this.m_oFontManager; + + var nX = (_font_manager.m_oGlyphString.m_fX + pGlyph.fX + pGlyph.oBitmap.nX) >> 0; + var nY = (_font_manager.m_oGlyphString.m_fY + pGlyph.fY - pGlyph.oBitmap.nY) >> 0; + + var d_koef = this.m_dDpiX / 25.4; + + var cX = Math.max((cropX * d_koef) >> 0, 0); + var cW = Math.min((cropW * d_koef) >> 0, nW); + if (cW <= 0) + cW = 1; + + pGlyph.oBitmap.oGlyphData.checkColor(this.m_oBrush.Color1.R,this.m_oBrush.Color1.G,this.m_oBrush.Color1.B,nW,nH); + pGlyph.oBitmap.drawCrop(this.m_oContext, nX, nY, cW, nH, cX); + */ +} + +void CJSGraphics::private_FillGlyph2(const v8::Local& pGlyph) +{ + /* + var i = 0; + var j = 0; + + var nW = pGlyph.oBitmap.nWidth; + var nH = pGlyph.oBitmap.nHeight; + + if (0 == nW || 0 == nH) + return; + + var _font_manager = this.IsUseFonts2 ? this.m_oFontManager2 : this.m_oFontManager; + + var nX = (_font_manager.m_oGlyphString.m_fX + pGlyph.fX + pGlyph.oBitmap.nX) >> 0; + var nY = (_font_manager.m_oGlyphString.m_fY + pGlyph.fY - pGlyph.oBitmap.nY) >> 0; + + var imageData = this.m_oContext.getImageData(nX,nY,nW,nH); + var pPixels = imageData.data; + + var _r = this.m_oBrush.Color1.R; + var _g = this.m_oBrush.Color1.G; + var _b = this.m_oBrush.Color1.B; + + for (; j < nH; ++j) + { + var indx = 4 * j * nW; + for (i = 0; i < nW; ++i) + { + var weight = pGlyph.oBitmap.pData[j * pGlyph.oBitmap.nWidth + i]; + + if (255 == weight) + { + pPixels[indx] = _r; + pPixels[indx + 1] = _g; + pPixels[indx + 2] = _b; + pPixels[indx + 3] = 255; + } + else + { + var r = pPixels[indx]; + var g = pPixels[indx + 1]; + var b = pPixels[indx + 2]; + var a = pPixels[indx + 3]; + + pPixels[indx] = ((_r - r) * weight + (r << 8)) >>> 8; + pPixels[indx + 1] = ((_g - g) * weight + (g << 8)) >>> 8; + pPixels[indx + 2] = ((_b - b) * weight + (b << 8)) >>> 8; + pPixels[indx + 3] = (weight + a) - ((weight * a + 256) >>> 8); + } + + indx += 4; + } + } + this.m_oContext.putImageData(imageData,nX,nY); + */ +} + +void CJSGraphics::SetIntegerGrid(bool param) +{ + /* + if (true == param) + { + this.m_bIntegerGrid = true; + this.m_oContext.setTransform(1,0,0,1,0,0); + } + else + { + this.m_bIntegerGrid = false; + this.m_oContext.setTransform(this.m_oFullTransform.sx,this.m_oFullTransform.shy,this.m_oFullTransform.shx, + this.m_oFullTransform.sy,this.m_oFullTransform.tx,this.m_oFullTransform.ty); + } + */ +} + +bool CJSGraphics::GetIntegerGrid() +{ + return m_bIntegerGrid; +} + +void CJSGraphics::DrawStringASCII(const std::string& name, int size, bool bold, bool italic, const v8::Local& text, double x, double y, bool bIsHeader) +{ + /* + var _textProp = { + RFonts : { Ascii : { Name : name, Index : -1 } }, + FontSize : (((size * 2 * 96 / this.m_dDpiY) + 0.5) >> 0) / 2, + Bold : false, + Italic : false + }; + + this.m_oTextPr = _textProp; + this.m_oGrFonts.Ascii.Name = this.m_oTextPr.RFonts.Ascii.Name; + this.m_oGrFonts.Ascii.Index = -1; + + this.SetFontSlot(fontslot_ASCII, 1); + + this.m_oFontManager.LoadString2(text, 0, 0); + var measure = this.m_oFontManager.MeasureString2(); + + var _ctx = this.m_oContext; + _ctx.beginPath(); + _ctx.fillStyle = "#E1E1E1"; + _ctx.strokeStyle = GlobalSkin.RulerOutline; + this.m_bBrushColorInit = false; + this.m_bPenColorInit = false; + + var _xPxOffset = 10; + var _yPxOffset = 5; + if (AscBrowser.isRetina) + { + _xPxOffset = (_xPxOffset * AscCommon.AscBrowser.retinaPixelRatio) >> 0; + _yPxOffset = (_yPxOffset * AscCommon.AscBrowser.retinaPixelRatio) >> 0; + } + + var __x = this.m_oFullTransform.TransformPointX(x, y) >> 0; + var __y = this.m_oFullTransform.TransformPointY(x, y) >> 0; + var __w = (measure.fWidth >> 0) + 2 * _xPxOffset; + var __h = (Math.abs(measure.fY) >> 0) + 2 * _yPxOffset; + + if (!bIsHeader) + __y -= __h; + + if (!AscBrowser.isRetina) + _ctx.rect(__x + 0.5, __y + 0.5, __w, __h); + else + _ctx.rect(__x, __y, __w, __h); + + _ctx.fill(); + _ctx.stroke(); + _ctx.beginPath(); + + this.b_color1(68, 68, 68, 255); + + var _koef_px_to_mm = 25.4 / this.m_dDpiY; + + if (bIsHeader) + this.t(text, x + _xPxOffset * _koef_px_to_mm, y + (__h - _yPxOffset) * _koef_px_to_mm); + else + this.t(text, x + _xPxOffset * _koef_px_to_mm, y - _yPxOffset * _koef_px_to_mm); + */ +} + +void CJSGraphics::DrawStringASCII2(const std::string& name, int size, bool bold, bool italic, const v8::Local& text, double x, double y, bool bIsHeader) +{ + /* + var _textProp = { + RFonts : { Ascii : { Name : name, Index : -1 } }, + FontSize : (((size * 2 * 96 / this.m_dDpiY) + 0.5) >> 0) / 2, + Bold : false, + Italic : false + }; + + this.m_oTextPr = _textProp; + this.m_oGrFonts.Ascii.Name = this.m_oTextPr.RFonts.Ascii.Name; + this.m_oGrFonts.Ascii.Index = -1; + + this.SetFontSlot(fontslot_ASCII, 1); + + this.m_oFontManager.LoadString2(text, 0, 0); + var measure = this.m_oFontManager.MeasureString2(); + + var _ctx = this.m_oContext; + _ctx.beginPath(); + _ctx.fillStyle = "#E1E1E1"; + _ctx.strokeStyle = GlobalSkin.RulerOutline; + this.m_bBrushColorInit = false; + this.m_bPenColorInit = false; + + var _xPxOffset = 10; + var _yPxOffset = 5; + if (AscBrowser.isRetina) + { + _xPxOffset = (_xPxOffset * AscCommon.AscBrowser.retinaPixelRatio) >> 0; + _yPxOffset = (_yPxOffset * AscCommon.AscBrowser.retinaPixelRatio) >> 0; + } + + var __x = this.m_oFullTransform.TransformPointX(this.m_dWidthMM - x, y) >> 0; + var __y = this.m_oFullTransform.TransformPointY(this.m_dWidthMM - x, y) >> 0; + var __w = (measure.fWidth >> 0) + 2 * _xPxOffset; + var __h = (Math.abs(measure.fY) >> 0) + 2 * _yPxOffset; + __x -= __w; + + if (!bIsHeader) + __y -= __h; + + if (!AscBrowser.isRetina) + _ctx.rect(__x + 0.5, __y + 0.5, __w, __h); + else + _ctx.rect(__x, __y, __w, __h); + + _ctx.fill(); + _ctx.stroke(); + _ctx.beginPath(); + + this.b_color1(68, 68, 68, 255); + + var _koef_px_to_mm = 25.4 / this.m_dDpiY; + + var xPos = this.m_dWidthMM - x - (__w - _xPxOffset) * _koef_px_to_mm; + + if (bIsHeader) + this.t(text, xPos, y + (__h - _yPxOffset) * _koef_px_to_mm); + else + this.t(text, xPos, y - _yPxOffset * _koef_px_to_mm); + */ +} + +void CJSGraphics::DrawHeaderEdit(double yPos, const v8::Local& lock_type, int sectionNum, bool bIsRepeat, const v8::Local& type) +{ + /* + var _y = this.m_oFullTransform.TransformPointY(0,yPos); + _y = (_y >> 0) + 0.5; + var _x = 0; + var _wmax = this.m_lWidthPix; + + var _w1 = 6; + var _w2 = 3; + + var _lineWidth = 1; + var _isRetina = AscBrowser.isRetina; + if (_isRetina && !editor.WordControl.bIsRetinaSupport) + _isRetina = false; + + if (_isRetina) + { + _y >>= 0; + _lineWidth = 2; + } + + + var ctx = this.m_oContext; + + switch (lock_type) + { + case locktype_None: + case locktype_Mine: + { + //this.p_color(155, 187, 277, 255); + //ctx.lineWidth = 2; + // GlobalSkin.RulerOutline + this.p_color(0xBB, 0xBE, 0xC2, 255); + ctx.lineWidth = _lineWidth; + break; + } + case locktype_Other: + case locktype_Other2: + { + this.p_color(238, 53, 37, 255); + ctx.lineWidth = _lineWidth; + _w1 = 2; + _w2 = 1; + break; + } + default: + { + this.p_color(155, 187, 277, 255); + ctx.lineWidth = _lineWidth; + _w1 = 2; + _w2 = 1; + } + } + + if (_isRetina) + { + _w1 = (_w1 * AscCommon.AscBrowser.retinaPixelRatio) >> 0; + _w2 = (_w2 * AscCommon.AscBrowser.retinaPixelRatio) >> 0; + } + + var bIsNoIntGrid = this.m_bIntegerGrid; + + if (false == bIsNoIntGrid) + this.SetIntegerGrid(true); + + this._s(); + while (true) + { + if (_x > _wmax) + break; + ctx.moveTo(_x,_y); + _x+=_w1; + ctx.lineTo(_x,_y); + _x+=_w2; + } + this.ds(); + + var _header_text = AscCommon.translateManager.getValue("Header"); + if (-1 != sectionNum) + _header_text += (AscCommon.translateManager.getValue(" -Section ") + (sectionNum + 1) + "-"); + + if (type) + { + if (type.bFirst) + _header_text = AscCommon.translateManager.getValue("First Page ") + _header_text; + else if (EvenAndOddHeaders) + { + if (type.bEven) + _header_text = AscCommon.translateManager.getValue("Even Page ") + _header_text; + else + _header_text = AscCommon.translateManager.getValue("Odd Page ") + _header_text; + } + } + + var _fontSize = _isRetina ? ((9 * AscCommon.AscBrowser.retinaPixelRatio) >> 0) : 9; + this.DrawStringASCII("Courier New", _fontSize, false, false, _header_text, 2, yPos, true); + + if (bIsRepeat) + this.DrawStringASCII2("Courier New", _fontSize, false, false, AscCommon.translateManager.getValue("Same as Previous"), 2, yPos, true); + + if (false == bIsNoIntGrid) + this.SetIntegerGrid(false); + */ +} + +void CJSGraphics::DrawFooterEdit(double yPos, const v8::Local& lock_type, int sectionNum, bool bIsRepeat, const v8::Local& type) +{ + /* + var _y = this.m_oFullTransform.TransformPointY(0,yPos); + _y = (_y >> 0) + 0.5; + var _x = 0; + var _w1 = 6; + var _w2 = 3; + + var _lineWidth = 1; + var _isRetina = AscBrowser.isRetina; + if (_isRetina && !editor.WordControl.bIsRetinaSupport) + _isRetina = false; + + if (_isRetina) + { + _y >>= 0; + _lineWidth = 2; + } + + var ctx = this.m_oContext; + + switch (lock_type) + { + case locktype_None: + case locktype_Mine: + { + //this.p_color(155, 187, 277, 255); + //ctx.lineWidth = 2; + // GlobalSkin.RulerOutline + this.p_color(0xBB, 0xBE, 0xC2, 255); + ctx.lineWidth = _lineWidth; + break; + } + case locktype_Other: + case locktype_Other2: + { + this.p_color(238, 53, 37, 255); + ctx.lineWidth = _lineWidth; + _w1 = 2; + _w2 = 1; + break; + } + default: + { + this.p_color(155, 187, 277, 255); + ctx.lineWidth = _lineWidth; + _w1 = 2; + _w2 = 1; + } + } + + if (_isRetina) + { + _w1 = (_w1 * AscCommon.AscBrowser.retinaPixelRatio) >> 0; + _w2 = (_w2 * AscCommon.AscBrowser.retinaPixelRatio) >> 0; + } + + var _wmax = this.m_lWidthPix; + + var bIsNoIntGrid = this.m_bIntegerGrid; + + if (false == bIsNoIntGrid) + this.SetIntegerGrid(true); + + this._s(); + while (true) + { + if (_x > _wmax) + break; + ctx.moveTo(_x,_y); + _x+=_w1; + ctx.lineTo(_x,_y); + _x+=_w2; + } + this.ds(); + + var _header_text = AscCommon.translateManager.getValue("Footer"); + if (-1 != sectionNum) + _header_text += (AscCommon.translateManager.getValue(" -Section ") + (sectionNum + 1) + "-"); + + if (type) + { + if (type.bFirst) + _header_text = AscCommon.translateManager.getValue("First Page ") + _header_text; + else if (EvenAndOddHeaders) + { + if (type.bEven) + _header_text = AscCommon.translateManager.getValue("Even Page ") + _header_text; + else + _header_text = AscCommon.translateManager.getValue("Odd Page ") + _header_text; + } + } + + var _fontSize = _isRetina ? ((9 * AscCommon.AscBrowser.retinaPixelRatio) >> 0) : 9; + this.DrawStringASCII("Courier New", _fontSize, false, false, _header_text, 2, yPos, false); + + if (bIsRepeat) + this.DrawStringASCII2("Courier New", _fontSize, false, false, AscCommon.translateManager.getValue("Same as Previous"), 2, yPos, false); + + if (false == bIsNoIntGrid) + this.SetIntegerGrid(false); + */ +} + +void CJSGraphics::DrawLockParagraph(const v8::Local& lock_type, double x, double y1, double y2) +{ + /* + if (lock_type == locktype_None || editor.WordControl.m_oDrawingDocument.IsLockObjectsEnable === false || editor.isViewMode || (lock_type === locktype_Mine && true === AscCommon.CollaborativeEditing.Is_Fast())) + return; + + if (lock_type == locktype_Mine) + { + this.p_color(22, 156, 0, 255); + //this.p_color(155, 187, 277, 255); + } + else + this.p_color(238, 53, 37, 255); + + var _x = this.m_oFullTransform.TransformPointX(x, y1) >> 0; + var _xT = this.m_oFullTransform.TransformPointX(x, y2) >> 0; + var _y1 = (this.m_oFullTransform.TransformPointY(x, y1) >> 0) + 0.5; + var _y2 = (this.m_oFullTransform.TransformPointY(x, y2) >> 0) - 1.5; + + var ctx = this.m_oContext; + if (_x != _xT) + { + // значит какой-то трансформ + var dKoefMMToPx = 1 / Math.max(this.m_oCoordTransform.sx, 0.001); + this.p_width(1000 * dKoefMMToPx); + + var w_dot = 2 * dKoefMMToPx; + var w_dist = 1 * dKoefMMToPx; + var w_len_indent = 3; + + var _interf = editor.WordControl.m_oDrawingDocument.AutoShapesTrack; + + this._s(); + _interf.AddLineDash(ctx, x, y1, x, y2, w_dot, w_dist); + _interf.AddLineDash(ctx, x, y1, x + w_len_indent, y1, w_dot, w_dist); + _interf.AddLineDash(ctx, x, y2, x + w_len_indent, y2, w_dot, w_dist); + + this.ds(); + return; + } + + var bIsInt = this.m_bIntegerGrid; + if (!bIsInt) + this.SetIntegerGrid(true); + + ctx.lineWidth = 1; + + var w_dot = 2; + var w_dist = 1; + var w_len_indent = (3 * this.m_oCoordTransform.sx) >> 0; + + this._s(); + + var y_mem = _y1 - 0.5; + while (true) + { + if ((y_mem + w_dot) > _y2) + break; + ctx.moveTo(_x + 0.5,y_mem); + y_mem+=w_dot; + ctx.lineTo(_x + 0.5,y_mem); + y_mem+=w_dist; + } + + var x_max = _x + w_len_indent; + + var x_mem = _x; + while (true) + { + if (x_mem > x_max) + break; + ctx.moveTo(x_mem,_y1); + x_mem+=w_dot; + ctx.lineTo(x_mem,_y1); + x_mem+=w_dist; + } + x_mem = _x; + while (true) + { + if (x_mem > x_max) + break; + ctx.moveTo(x_mem,_y2); + x_mem+=w_dot; + ctx.lineTo(x_mem,_y2); + x_mem+=w_dist; + } + + this.ds(); + + if (!bIsInt) + this.SetIntegerGrid(false); + */ +} + +void CJSGraphics::DrawLockObjectRect(const v8::Local& lock_type, double x, double y, double w, double h) +{ + /* + if (editor.isViewMode || this.IsThumbnail || lock_type == locktype_None || this.IsDemonstrationMode || (lock_type === locktype_Mine && true === AscCommon.CollaborativeEditing.Is_Fast())) + return; + + if (editor.WordControl.m_oDrawingDocument.IsLockObjectsEnable === false && lock_type == locktype_Mine) + return; + + if (lock_type == locktype_Mine) + { + this.p_color(22, 156, 0, 255); + //this.p_color(155, 187, 277, 255); + } + else + this.p_color(238, 53, 37, 255); + + var ctx = this.m_oContext; + + var _m = this.m_oTransform; + if (_m.sx != 1.0 || _m.shx != 0.0 || _m.shy != 0.0 || _m.sy != 1.0) + { + // значит какой-то трансформ + var dKoefMMToPx = 1 / Math.max(this.m_oCoordTransform.sx, 0.001); + this.p_width(1000 * dKoefMMToPx); + + var w_dot = 2 * dKoefMMToPx; + var w_dist = 1 * dKoefMMToPx; + + var _interf = editor.WordControl.m_oDrawingDocument.AutoShapesTrack; + + var eps = 5 * dKoefMMToPx; + var _x = x - eps; + var _y = y - eps; + var _r = x + w + eps; + var _b = y + h + eps; + + this._s(); + _interf.AddRectDash(ctx, _x, _y, _r, _y, _x, _b, _r, _b, w_dot, w_dist, true); + this._s(); + return; + } + + var bIsInt = this.m_bIntegerGrid; + if (!bIsInt) + this.SetIntegerGrid(true); + + ctx.lineWidth = 1; + + var w_dot = 2; + var w_dist = 2; + + var eps = 5; + + var _x = (this.m_oFullTransform.TransformPointX(x, y) >> 0) - eps + 0.5; + var _y = (this.m_oFullTransform.TransformPointY(x, y) >> 0) - eps + 0.5; + + var _r = (this.m_oFullTransform.TransformPointX(x+w, y+h) >> 0) + eps + 0.5; + var _b = (this.m_oFullTransform.TransformPointY(x+w, y+h) >> 0) + eps + 0.5; + + this._s(); + + 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); + } + + this.ds(); + + if (!bIsInt) + this.SetIntegerGrid(false); + */ +} + +void CJSGraphics::DrawEmptyTableLine(double x1, double y1, double x2, double y2) +{ + /* + if ((!editor.isShowTableEmptyLine || editor.isViewMode) && (editor.isShowTableEmptyLineAttack === false)) + return; + + 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); + + _x1 = (_x1 >> 0) + 0.5; + _y1 = (_y1 >> 0) + 0.5; + _x2 = (_x2 >> 0) + 0.5; + _y2 = (_y2 >> 0) + 0.5; + + this.p_color(138, 162, 191, 255); + var ctx = this.m_oContext; + + if (_x1 != _x2 && _y1 != _y2) + { + // значит какой-то трансформ + var dKoefMMToPx = 1 / Math.max(this.m_oCoordTransform.sx, 0.001); + + this.p_width(1000 * dKoefMMToPx); + this._s(); + editor.WordControl.m_oDrawingDocument.AutoShapesTrack.AddLineDash(ctx, x1, y1, x2, y2, 2 * dKoefMMToPx, 2 * dKoefMMToPx); + this.ds(); + return; + } + + ctx.lineWidth = 1; + var bIsInt = this.m_bIntegerGrid; + if (!bIsInt) + this.SetIntegerGrid(true); + if (_x1 == _x2) + { + var _y = Math.min(_y1, _y2) + 0.5; + var _w1 = 2; + var _w2 = 2; + var _wmax = Math.max(_y1, _y2) - 0.5; + this._s(); + while (true) + { + if (_y > _wmax) + break; + ctx.moveTo(_x1,_y); + _y+=_w1; + if (_y > _wmax) + { + ctx.lineTo(_x1,_y - _w1 + 1); + } + else + { + ctx.lineTo(_x1,_y); + } + _y+=_w2; + } + this.ds(); + } + else if (_y1 == _y2) + { + var _x = Math.min(_x1, _x2) + 0.5; + var _w1 = 2; + var _w2 = 2; + var _wmax = Math.max(_x1, _x2) - 0.5; + this._s(); + while (true) + { + if (_x > _wmax) + break; + ctx.moveTo(_x,_y1); + _x+=_w1; + + if (_x > _wmax) + { + ctx.lineTo(_x - _w2 + 1,_y1); + } + else + { + ctx.lineTo(_x,_y1); + } + _x+=_w2; + } + this.ds(); + } + else + { + // значит какой-то трансформ + this._s(); + editor.WordControl.m_oDrawingDocument.AutoShapesTrack.AddLineDash(ctx, _x1, _y1, _x2, _y2, 2, 2); + this.ds(); + } + if (!bIsInt) + this.SetIntegerGrid(false); + */ +} + +void CJSGraphics::DrawSpellingLine(double y0, double x0, double x1, double w) +{ + /* + if (!editor.isViewMode) + this.drawHorLine(0, y0, x0, x1, w ); + */ +} + +void CJSGraphics::drawHorLine(int align, double y, double x, double r, int penW) +{ + /* + var _check_transform = global_MatrixTransformer.IsIdentity2(this.m_oTransform); + if (!this.m_bIntegerGrid || !_check_transform) + { + if (_check_transform) + { + this.SetIntegerGrid(true); + this.drawHorLine(align, y, x, r, penW); + this.SetIntegerGrid(false); + return; + } + + this.p_width(penW * 1000); + this._s(); + this._m(x, y); + this._l(r, y); + this.ds(); + return; + } + + var pen_w = ((this.m_dDpiX * penW / g_dKoef_in_to_mm) + 0.5) >> 0; + if (0 == pen_w) + pen_w = 1; + + var _x = (this.m_oFullTransform.TransformPointX(x,y) >> 0) + 0.5 - 0.5; + var _r = (this.m_oFullTransform.TransformPointX(r,y) >> 0) + 0.5 + 0.5; + + var ctx = this.m_oContext; + + ctx.setTransform(1,0,0,1,0,0); + + ctx.lineWidth = pen_w; + + switch (align) + { + case 0: + { + // top + var _top = (this.m_oFullTransform.TransformPointY(x,y) >> 0) + 0.5; + + ctx.beginPath(); + ctx.moveTo(_x, _top + pen_w / 2 - 0.5); + ctx.lineTo(_r, _top + pen_w / 2 - 0.5); + ctx.stroke(); + + break; + } + case 1: + { + // center + var _center = (this.m_oFullTransform.TransformPointY(x,y) >> 0) + 0.5; + + ctx.beginPath(); + if (0 == (pen_w % 2)) + { + ctx.moveTo(_x, _center - 0.5); + ctx.lineTo(_r, _center - 0.5); + } + else + { + ctx.moveTo(_x, _center); + ctx.lineTo(_r, _center); + } + ctx.stroke(); + + break; + } + case 2: + { + // bottom + var _bottom = (this.m_oFullTransform.TransformPointY(x,y) >> 0) + 0.5; + + ctx.beginPath(); + ctx.moveTo(_x, _bottom - pen_w / 2 + 0.5); + ctx.lineTo(_r, _bottom - pen_w / 2 + 0.5); + ctx.stroke(); + + break; + } + } + */ +} + +void CJSGraphics::drawHorLine2(int align, double y, double x, double r, int penW) +{ + /* + var _check_transform = global_MatrixTransformer.IsIdentity2(this.m_oTransform); + if (!this.m_bIntegerGrid || !_check_transform) + { + if (_check_transform) + { + this.SetIntegerGrid(true); + this.drawHorLine2(align, y, x, r, penW); + this.SetIntegerGrid(false); + return; + } + + var _y1 = y - penW / 2; + var _y2 = _y1 + 2 * penW; + + this.p_width(penW * 1000); + this._s(); + this._m(x, _y1); + this._l(r, _y1); + this.ds(); + + this._s(); + this._m(x, _y2); + this._l(r, _y2); + this.ds(); + return; + } + + var pen_w = ((this.m_dDpiX * penW / g_dKoef_in_to_mm) + 0.5) >> 0; + if (0 == pen_w) + pen_w = 1; + + var _x = (this.m_oFullTransform.TransformPointX(x,y) >> 0) + 0.5 - 0.5; + var _r = (this.m_oFullTransform.TransformPointX(r,y) >> 0) + 0.5 + 0.5; + + var ctx = this.m_oContext; + ctx.lineWidth = pen_w; + + switch (align) + { + case 0: + { + // top + var _top = (this.m_oFullTransform.TransformPointY(x,y) >> 0) + 0.5; + + var _pos1 = _top + pen_w / 2 - 0.5 - pen_w; + var _pos2 = _pos1 + pen_w * 2; + + ctx.beginPath(); + ctx.moveTo(_x, _pos1); + ctx.lineTo(_r, _pos1); + ctx.stroke(); + + ctx.beginPath(); + ctx.moveTo(_x, _pos2); + ctx.lineTo(_r, _pos2); + ctx.stroke(); + + break; + } + case 1: + { + // center + // TODO: + + break; + } + case 2: + { + // bottom + // TODO: + + break; + } + } + */ +} + +void CJSGraphics::drawVerLine(int align, double x, double y, double b, int penW) +{ + /* + var _check_transform = global_MatrixTransformer.IsIdentity2(this.m_oTransform); + if (!this.m_bIntegerGrid || !_check_transform) + { + if (_check_transform) + { + this.SetIntegerGrid(true); + this.drawVerLine(align, x, y, b, penW); + this.SetIntegerGrid(false); + return; + } + + this.p_width(penW * 1000); + this._s(); + this._m(x, y); + this._l(x, b); + this.ds(); + return; + } + + var pen_w = ((this.m_dDpiX * penW / g_dKoef_in_to_mm) + 0.5) >> 0; + if (0 == pen_w) + pen_w = 1; + + var _y = (this.m_oFullTransform.TransformPointY(x,y) >> 0) + 0.5 - 0.5; + var _b = (this.m_oFullTransform.TransformPointY(x,b) >> 0) + 0.5 + 0.5; + + var ctx = this.m_oContext; + ctx.lineWidth = pen_w; + + switch (align) + { + case 0: + { + // left + var _left = (this.m_oFullTransform.TransformPointX(x,y) >> 0) + 0.5; + + ctx.beginPath(); + ctx.moveTo(_left + pen_w / 2 - 0.5, _y); + ctx.lineTo(_left + pen_w / 2 - 0.5, _b); + ctx.stroke(); + + break; + } + case 1: + { + // center + var _center = (this.m_oFullTransform.TransformPointX(x,y) >> 0) + 0.5; + + ctx.beginPath(); + if (0 == (pen_w % 2)) + { + ctx.moveTo(_center - 0.5, _y); + ctx.lineTo(_center - 0.5, _b); + } + else + { + ctx.moveTo(_center, _y); + ctx.lineTo(_center, _b); + } + ctx.stroke(); + + break; + } + case 2: + { + // right + var _right = (this.m_oFullTransform.TransformPointX(x,y) >> 0) + 0.5; + + ctx.beginPath(); + ctx.moveTo(_right - pen_w / 2 + 0.5, _y); + ctx.lineTo(_right - pen_w / 2 + 0.5, _b); + ctx.stroke(); + + break; + } + } + */ +} + +void CJSGraphics::drawHorLineExt(int align, double y, double x, double r, int penW, double leftMW, double rightMW) +{ + /* + var _check_transform = global_MatrixTransformer.IsIdentity2(this.m_oTransform); + if (!this.m_bIntegerGrid || !_check_transform) + { + if (_check_transform) + { + this.SetIntegerGrid(true); + this.drawHorLineExt(align, y, x, r, penW, leftMW, rightMW); + this.SetIntegerGrid(false); + return; + } + + this.p_width(penW * 1000); + this._s(); + this._m(x, y); + this._l(r, y); + this.ds(); + return; + } + + var pen_w = Math.max(((this.m_dDpiX * penW / g_dKoef_in_to_mm) + 0.5) >> 0, 1); + + var _x = (this.m_oFullTransform.TransformPointX(x,y) >> 0) + 0.5; + var _r = (this.m_oFullTransform.TransformPointX(r,y) >> 0) + 0.5; + + if (leftMW != 0) + { + var _center = _x; + var pen_mw = Math.max(((this.m_dDpiX * Math.abs(leftMW) * 2 / g_dKoef_in_to_mm) + 0.5) >> 0, 1); + if (leftMW < 0) + { + if ((pen_mw % 2) == 0) + { + _x = _center - (pen_mw / 2); + } + else + { + _x = _center - ((pen_mw / 2) >> 0); + } + } + else + { + if ((pen_mw % 2) == 0) + { + _x = _center + ((pen_mw / 2) - 1.0); + } + else + { + _x = _center + ((pen_mw / 2) >> 0); + } + } + } + if (rightMW != 0) + { + var _center = _r; + var pen_mw = Math.max(((this.m_dDpiX * Math.abs(rightMW) * 2 / g_dKoef_in_to_mm) + 0.5) >> 0, 1); + if (rightMW < 0) + { + if ((pen_mw % 2) == 0) + { + _r = _center - (pen_mw / 2); + } + else + { + _r = _center - ((pen_mw / 2) >> 0); + } + } + else + { + if ((pen_mw % 2) == 0) + { + _r = _center + (pen_mw / 2) - 1.0; + } + else + { + _r = _center + ((pen_mw / 2) >> 0); + } + } + } + + var ctx = this.m_oContext; + ctx.lineWidth = pen_w; + + _x -= 0.5; + _r += 0.5; + + switch (align) + { + case 0: + { + // top + var _top = (this.m_oFullTransform.TransformPointY(x,y) >> 0) + 0.5; + + ctx.beginPath(); + ctx.moveTo(_x, _top + pen_w / 2 - 0.5); + ctx.lineTo(_r, _top + pen_w / 2 - 0.5); + ctx.stroke(); + + break; + } + case 1: + { + // center + var _center = (this.m_oFullTransform.TransformPointY(x,y) >> 0) + 0.5; + + ctx.beginPath(); + if (0 == (pen_w % 2)) + { + ctx.moveTo(_x, _center - 0.5); + ctx.lineTo(_r, _center - 0.5); + } + else + { + ctx.moveTo(_x, _center); + ctx.lineTo(_r, _center); + } + ctx.stroke(); + + break; + } + case 2: + { + // bottom + var _bottom = (this.m_oFullTransform.TransformPointY(x,y) >> 0) + 0.5; + + ctx.beginPath(); + ctx.moveTo(_x, _bottom - pen_w / 2 + 0.5); + ctx.lineTo(_r, _bottom - pen_w / 2 + 0.5); + ctx.stroke(); + + break; + } + } + */ +} + +void CJSGraphics::rect(double x, double y, double w, double h) +{ + /* + var ctx = this.m_oContext; + ctx.beginPath(); + + if (this.m_bIntegerGrid) + { + if (AscCommon.global_MatrixTransformer.IsIdentity2(this.m_oFullTransform)) + { + var _x = (this.m_oFullTransform.TransformPointX(x, y) + 0.5) >> 0; + var _y = (this.m_oFullTransform.TransformPointY(x, y) + 0.5) >> 0; + var _r = (this.m_oFullTransform.TransformPointX(x + w, y) + 0.5) >> 0; + var _b = (this.m_oFullTransform.TransformPointY(x, y + h) + 0.5) >> 0; + + ctx.rect(_x, _y, _r - _x, _b - _y); + } + else + { + 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); + + ctx.moveTo(x1, y1); + ctx.lineTo(x2, y2); + ctx.lineTo(x3, y3); + ctx.lineTo(x4, y4); + ctx.closePath(); + } + } + else + { + ctx.rect(x, y, w, h); + } + */ +} + +void CJSGraphics::TableRect(double x, double y, double w, double h) +{ + /* + var ctx = this.m_oContext; + + if (this.m_bIntegerGrid) + { + var _x = (this.m_oFullTransform.TransformPointX(x,y) >> 0) + 0.5; + var _y = (this.m_oFullTransform.TransformPointY(x,y) >> 0) + 0.5; + var _r = (this.m_oFullTransform.TransformPointX(x+w,y) >> 0) + 0.5; + var _b = (this.m_oFullTransform.TransformPointY(x,y+h) >> 0) + 0.5; + + ctx.fillRect(_x - 0.5, _y - 0.5, _r - _x + 1, _b - _y + 1); + } + else + { + ctx.fillRect(x, y, w, h); + } + */ +} + +void CJSGraphics::AddClipRect(double x, double y, double w, double h) +{ + /* + var __rect = new AscCommon._rect(); + __rect.x = x; + __rect.y = y; + __rect.w = w; + __rect.h = h; + this.GrState.AddClipRect(__rect); + */ +} + +void CJSGraphics::SetClip(const v8::Local& r) +{ + /* + var ctx = this.m_oContext; + ctx.save(); + + ctx.beginPath(); + if (!global_MatrixTransformer.IsIdentity(this.m_oTransform)) + { + ctx.rect(r.x, r.y, r.w, r.h); + } + else + { + var _x = (this.m_oFullTransform.TransformPointX(r.x,r.y) + 1) >> 0; + var _y = (this.m_oFullTransform.TransformPointY(r.x,r.y) + 1) >> 0; + var _r = (this.m_oFullTransform.TransformPointX(r.x+r.w,r.y) - 1) >> 0; + var _b = (this.m_oFullTransform.TransformPointY(r.x,r.y+r.h) - 1) >> 0; + + ctx.rect(_x, _y, _r - _x + 1, _b - _y + 1); + } + + this.clip(); + ctx.beginPath(); + */ +} + +void CJSGraphics::RemoveClip() +{ + /* + this.m_oContext.restore(); + this.m_oContext.save(); + + this.m_bPenColorInit = false; + this.m_bBrushColorInit = false; + + if (this.m_oContext.globalAlpha != this.globalAlpha) + this.m_oContext.globalAlpha = this.globalAlpha; + */ +} + +void CJSGraphics::drawCollaborativeChanges(double x, double y, double w, double h, const v8::Local& Color) +{ + /* + this.b_color1( Color.r, Color.g, Color.b, 255 ); + this.rect( x, y, w, h ); + this.df(); + */ +} + +void CJSGraphics::drawMailMergeField(double x, double y, double w, double h) +{ + /* + this.b_color1(206, 212, 223, 204); + //this.b_color1(216, 221, 230, 255); + this.rect( x, y, w, h ); + this.df(); + */ +} + +void CJSGraphics::drawSearchResult(double x, double y, double w, double h) +{ + /* + this.b_color1( 255, 238, 128, 255 ); + this.rect( x, y, w, h ); + this.df(); + */ +} + +void CJSGraphics::drawFlowAnchor(double x, double y) +{ + /* + if (!AscCommon.g_flow_anchor || !AscCommon.g_flow_anchor.asc_complete || (!editor || !editor.ShowParaMarks)) + return; + + if (false === this.m_bIntegerGrid) + { + this.m_oContext.setTransform(1,0,0,1,0,0); + } + + var _x = this.m_oFullTransform.TransformPointX(x,y) >> 0; + var _y = this.m_oFullTransform.TransformPointY(x,y) >> 0; + + this.m_oContext.drawImage(AscCommon.g_flow_anchor, _x, _y); + + if (false === this.m_bIntegerGrid) + { + this.m_oContext.setTransform(this.m_oFullTransform.sx,this.m_oFullTransform.shy,this.m_oFullTransform.shx, + this.m_oFullTransform.sy,this.m_oFullTransform.tx,this.m_oFullTransform.ty); + } + */ +} + +void CJSGraphics::SavePen() +{ + // this.GrState.SavePen(); +} + +void CJSGraphics::RestorePen() +{ + // this.GrState.RestorePen(); +} + +void CJSGraphics::SaveBrush() +{ + // this.GrState.SaveBrush(); +} + +void CJSGraphics::RestoreBrush() +{ + // this.GrState.RestoreBrush(); +} + +void CJSGraphics::SavePenBrush() +{ + // this.GrState.SavePenBrush(); +} + +void CJSGraphics::RestorePenBrush() +{ + // this.GrState.RestorePenBrush(); +} + +void CJSGraphics::SaveGrState() +{ + // this.GrState.SaveGrState(); +} + +void CJSGraphics::RestoreGrState() +{ + // this.GrState.RestoreGrState(); +} + +void CJSGraphics::EndClipPath() +{ + // this.m_oContext.clip(); +} + +void CJSGraphics::StartCheckTableDraw() +{ + /* + if (!this.m_bIntegerGrid && global_MatrixTransformer.IsIdentity2(this.m_oTransform)) + { + this.SaveGrState(); + this.SetIntegerGrid(true); + return true; + } + return false; + */ +} + +void CJSGraphics::EndCheckTableDraw(bool bIsRestore) +{ + if (bIsRestore) + RestoreGrState(); +} + +void CJSGraphics::SetTextClipRect(double _l, double _t, double _r, double _b) +{ + /* + this.TextClipRect = { + l : (_l * this.m_oCoordTransform.sx) >> 0, + t : (_t * this.m_oCoordTransform.sy) >> 0, + r : (_r * this.m_oCoordTransform.sx) >> 0, + b : (_b * this.m_oCoordTransform.sy) >> 0 + }; + */ +} + +void CJSGraphics::AddSmartRect(double x, double y, double w, double h, int pen_w) +{ + /* + if (!global_MatrixTransformer.IsIdentity2(this.m_oTransform)) + { + // проверим - может все-таки можно нарисовать как надо? + var r = x + w; + var b = y + h; + var dx1 = this.m_oFullTransform.TransformPointX(x, y); + var dy1 = this.m_oFullTransform.TransformPointY(x, y); + + var dx2 = this.m_oFullTransform.TransformPointX(r, y); + var dy2 = this.m_oFullTransform.TransformPointY(r, y); + + var dx3 = this.m_oFullTransform.TransformPointX(x, b); + var dy3 = this.m_oFullTransform.TransformPointY(x, b); + + var dx4 = this.m_oFullTransform.TransformPointX(r, b); + var dy4 = this.m_oFullTransform.TransformPointY(r, b); + + var _eps = 0.001; + var bIsClever = false; + var _type = 1; + if (Math.abs(dx1 - dx3) < _eps && + Math.abs(dx2 - dx4) < _eps && + Math.abs(dy1 - dy2) < _eps && + Math.abs(dy3 - dy4) < _eps) + { + bIsClever = true; + _type = 1; + } + if (!bIsClever && + Math.abs(dx1 - dx2) < _eps && + Math.abs(dx3 - dx4) < _eps && + Math.abs(dy1 - dy3) < _eps && + Math.abs(dy2 - dy4) < _eps) + { + _type = 2; + bIsClever = true; + } + + if (!bIsClever) + { + this.ds(); + return; + } + + var _xI = (_type == 1) ? Math.min(dx1, dx2) : Math.min(dx1, dx3); + var _rI = (_type == 1) ? Math.max(dx1, dx2) : Math.max(dx1, dx3); + var _yI = (_type == 1) ? Math.min(dy1, dy3) : Math.min(dy1, dy2); + var _bI = (_type == 1) ? Math.max(dy1, dy3) : Math.max(dy1, dy2); + + var bIsSmartAttack = false; + if (!this.m_bIntegerGrid) + { + this.SetIntegerGrid(true); + bIsSmartAttack = true; + + if (this.dash_no_smart) + { + for (var index = 0; index < this.dash_no_smart.length; index++) + this.dash_no_smart[index] = (this.m_oCoordTransform.sx * this.dash_no_smart[index] + 0.5) >> 0; + + this.m_oContext.setLineDash(this.dash_no_smart); + this.dash_no_smart = null; + } + } + + var _pen_w = (pen_w * this.m_oCoordTransform.sx + 0.5) >> 0; + if (0 >= _pen_w) + _pen_w = 1; + + this._s(); + + if ((_pen_w & 0x01) == 0x01) + { + var _x = (_xI >> 0) + 0.5; + var _y = (_yI >> 0) + 0.5; + var _r = (_rI >> 0) + 0.5; + var _b = (_bI >> 0) + 0.5; + + this.m_oContext.rect(_x, _y, _r - _x, _b - _y); + } + else + { + var _x = (_xI + 0.5) >> 0; + var _y = (_yI + 0.5) >> 0; + var _r = (_rI + 0.5) >> 0; + var _b = (_bI + 0.5) >> 0; + + this.m_oContext.rect(_x, _y, _r - _x, _b - _y); + } + + this.m_oContext.lineWidth = _pen_w; + this.ds(); + + if (bIsSmartAttack) + { + this.SetIntegerGrid(false); + } + return; + } + + var bIsSmartAttack = false; + if (!this.m_bIntegerGrid) + { + this.SetIntegerGrid(true); + bIsSmartAttack = true; + + if (this.dash_no_smart) + { + for (var index = 0; index < this.dash_no_smart.length; index++) + this.dash_no_smart[index] = (this.m_oCoordTransform.sx * this.dash_no_smart[index] + 0.5) >> 0; + + this.m_oContext.setLineDash(this.dash_no_smart); + this.dash_no_smart = null; + } + } + + var _pen_w = (pen_w * this.m_oCoordTransform.sx + 0.5) >> 0; + if (0 >= _pen_w) + _pen_w = 1; + + this._s(); + + if ((_pen_w & 0x01) == 0x01) + { + var _x = (this.m_oFullTransform.TransformPointX(x, y) >> 0) + 0.5; + var _y = (this.m_oFullTransform.TransformPointY(x, y) >> 0) + 0.5; + var _r = (this.m_oFullTransform.TransformPointX(x+w, y+h) >> 0) + 0.5; + var _b = (this.m_oFullTransform.TransformPointY(x+w, y+h) >> 0) + 0.5; + + this.m_oContext.rect(_x, _y, _r - _x, _b - _y); + } + else + { + var _x = (this.m_oFullTransform.TransformPointX(x, y) + 0.5) >> 0; + var _y = (this.m_oFullTransform.TransformPointY(x, y) + 0.5) >> 0; + var _r = (this.m_oFullTransform.TransformPointX(x+w, y+h) + 0.5) >> 0; + var _b = (this.m_oFullTransform.TransformPointY(x+w, y+h) + 0.5) >> 0; + + this.m_oContext.rect(_x, _y, _r - _x, _b - _y); + } + + this.m_oContext.lineWidth = _pen_w; + this.ds(); + + if (bIsSmartAttack) + { + this.SetIntegerGrid(false); + } + */ +} + +void CJSGraphics::CheckUseFonts2(const v8::Local& _transform) +{ + /* + if (!global_MatrixTransformer.IsIdentity2(_transform)) + { + if (!AscCommon.g_fontManager2) + { + AscCommon.g_fontManager2 = new AscFonts.CFontManager(); + AscCommon.g_fontManager2.Initialize(true); + } + + this.m_oFontManager2 = AscCommon.g_fontManager2; + + if (null == this.m_oLastFont2) + this.m_oLastFont2 = new AscCommon.CFontSetup(); + + this.IsUseFonts2 = true; + } + */ +} + +void CJSGraphics::UncheckUseFonts2() +{ + // IsUseFonts2 = false; +} + +void CJSGraphics::DrawPresentationComment(const v8::Local& type, double x, double y, double w, double h) +{ + /* + if (this.IsThumbnail || this.IsDemonstrationMode) + return; + + if (this.m_bIntegerGrid) + { + if (AscCommon.g_comment_image && AscCommon.g_comment_image.asc_complete === true) + { + var _x = (this.m_oFullTransform.TransformPointX(x,y) >> 0); + var _y = (this.m_oFullTransform.TransformPointY(x,y) >> 0); + + var _index = 0; + if ((type & 0x02) == 0x02) + _index = 2; + if ((type & 0x01) == 0x01) + _index += 1; + + if (this.IsRetina) + _index += 4; + + var _offset = AscCommon.g_comment_image_offsets[_index]; + this.m_oContext.drawImage(AscCommon.g_comment_image, _offset[0], _offset[1], _offset[2], _offset[3], _x, _y, _offset[2], _offset[3]); + } + } + else + { + this.SetIntegerGrid(true); + this.DrawPresentationComment(type, x, y, w, h); + this.SetIntegerGrid(false); + } + */ +} + +void CJSGraphics::DrawPolygon(const v8::Local& oPath, int lineWidth, double shift) +{ + /* + this.m_oContext.lineWidth = lineWidth; + this.m_oContext.beginPath(); + + var Points = oPath.Points; + + var nCount = Points.length; + // берем предпоследнюю точку, т.к. последняя совпадает с первой + var PrevX = Points[nCount - 2].X, PrevY = Points[nCount - 2].Y; + var _x = Points[nCount - 2].X, + _y = Points[nCount - 2].Y; + var StartX, StartY ; + + for (var nIndex = 0; nIndex < nCount; nIndex++) + { + if(PrevX > Points[nIndex].X) + { + _y = Points[nIndex].Y - shift; + } + else if(PrevX < Points[nIndex].X) + { + _y = Points[nIndex].Y + shift; + } + + if(PrevY < Points[nIndex].Y) + { + _x = Points[nIndex].X - shift; + } + else if(PrevY > Points[nIndex].Y) + { + _x = Points[nIndex].X + shift; + } + + PrevX = Points[nIndex].X; + PrevY = Points[nIndex].Y; + + if(nIndex > 0) + { + if (1 == nIndex) + { + StartX = _x; + StartY = _y; + this._m(_x, _y); + } + else + { + this._l(_x, _y); + } + } + } + + this._l(StartX, StartY); + this.m_oContext.closePath(); + this.m_oContext.stroke(); + this.m_oContext.beginPath(); + */ +} + +void CJSGraphics::DrawFootnoteRect(double x, double y, double w, double h) +{ + /* + var _old = this.m_bIntegerGrid; + if (!_old) + this.SetIntegerGrid(true); + + this.p_dash([1, 1]); + + this._s(); + + var l = x; + var t = y; + var r = x + w; + var b = y + h; + + this.drawHorLineExt(c_oAscLineDrawingRule.Top, t, l, r, 0, 0, 0); + this.drawVerLine(c_oAscLineDrawingRule.Right, l, t, b, 0); + this.drawVerLine(c_oAscLineDrawingRule.Left, r, t, b, 0); + this.drawHorLineExt(c_oAscLineDrawingRule.Top, b, l, r, 0, 0, 0); + + this.ds(); + this._s(); + + this.p_dash(null); + + if (!_old) + this.SetIntegerGrid(false); + */ +} diff --git a/DesktopEditor/doctrenderer/jsgraphics/graphics.h b/DesktopEditor/doctrenderer/jsgraphics/graphics.h index 18e75372f1..d0a11d7f2a 100644 --- a/DesktopEditor/doctrenderer/jsgraphics/graphics.h +++ b/DesktopEditor/doctrenderer/jsgraphics/graphics.h @@ -108,6 +108,58 @@ public: void FillTextCode(double x, double y, const v8::Local& lUnicode); void tg(const v8::Local& text, double x, double y); void charspace(const v8::Local& space) {} + // private methods + void private_FillGlyph(const v8::Local& pGlyph, const v8::Local& _bounds); + void private_FillGlyphC(const v8::Local& pGlyph, double cropX, double cropW); + void private_FillGlyph2(const v8::Local& pGlyph); + void SetIntegerGrid(bool param); + bool GetIntegerGrid(); + void DrawStringASCII(const std::string& name, int size, bool bold, bool italic, const v8::Local& text, double x, double y, bool bIsHeader); + void DrawStringASCII2(const std::string& name, int size, bool bold, bool italic, const v8::Local& text, double x, double y, bool bIsHeader); + void DrawHeaderEdit(double yPos, const v8::Local& lock_type, int sectionNum, bool bIsRepeat, const v8::Local& type); + void DrawFooterEdit(double yPos, const v8::Local& lock_type, int sectionNum, bool bIsRepeat, const v8::Local& type); + void DrawLockParagraph(const v8::Local& lock_type, double x, double y1, double y2); + void DrawLockObjectRect(const v8::Local& lock_type, double x, double y, double w, double h); + void DrawEmptyTableLine(double x1, double y1, double x2, double y2); + void DrawSpellingLine(double y0, double x0, double x1, double w); + // smart methods for horizontal / vertical lines + void drawHorLine(int align, double y, double x, double r, int penW); + void drawHorLine2(int align, double y, double x, double r, int penW); + void drawVerLine(int align, double x, double y, double b, int penW); + // мега крутые функции для таблиц + void drawHorLineExt(int align, double y, double x, double r, int penW, double leftMW, double rightMW); + void rect(double x, double y, double w, double h); + void TableRect(double x, double y, double w, double h); + // функции клиппирования + void AddClipRect(double x, double y, double w, double h); + void RemoveClipRect() {} + void SetClip(const v8::Local& r); + void RemoveClip(); + void drawCollaborativeChanges(double x, double y, double w, double h, const v8::Local& Color); + void drawMailMergeField(double x, double y, double w, double h); + void drawSearchResult(double x, double y, double w, double h); + void drawFlowAnchor(double x, double y); + void SavePen(); + void RestorePen(); + void SaveBrush(); + void RestoreBrush(); + void SavePenBrush(); + void RestorePenBrush(); + void SaveGrState(); + void RestoreGrState(); + void StartClipPath() {} + void EndClipPath(); + void StartCheckTableDraw(); + void EndCheckTableDraw(bool bIsRestore); + void SetTextClipRect(double _l, double _t, double _r, double _b); + void AddSmartRect(double x, double y, double w, double h, int pen_w); + void CheckUseFonts2(const v8::Local& _transform); + void UncheckUseFonts2(); + void Drawing_StartCheckBounds(double x, double y, double w, double h) {} + void Drawing_EndCheckBounds() {} + void DrawPresentationComment(const v8::Local& type, double x, double y, double w, double h); + void DrawPolygon(const v8::Local& oPath, int lineWidth, double shift); + void DrawFootnoteRect(double x, double y, double w, double h); double m_dDpiX_get() { return m_dDpiX; } int globalAlpha_get() { return globalAlpha; } diff --git a/DesktopEditor/doctrenderer/jsgraphics/graphics_wrapper.cpp b/DesktopEditor/doctrenderer/jsgraphics/graphics_wrapper.cpp index 3f4197c2fd..ffe691740d 100644 --- a/DesktopEditor/doctrenderer/jsgraphics/graphics_wrapper.cpp +++ b/DesktopEditor/doctrenderer/jsgraphics/graphics_wrapper.cpp @@ -1,21 +1,30 @@ #include "graphics_wrapper.h" -double to_double(const v8::Local& v) +#include + +static double to_double(const v8::Local& v) { return v->ToNumber(v8::Isolate::GetCurrent()->GetCurrentContext()).FromMaybe(v8::Local())->Value(); } -bool to_bool (const v8::Local& v) +static bool to_bool (const v8::Local& v) { return v->ToBoolean(v8::Isolate::GetCurrent()->GetCurrentContext()).FromMaybe(v8::Local())->Value(); } -int to_int (const v8::Local& v) +static int to_int (const v8::Local& v) { return v->ToInt32(v8::Isolate::GetCurrent()->GetCurrentContext()).FromMaybe(v8::Local())->Value(); } -int to_uint (const v8::Local& v) +static int to_uint (const v8::Local& v) { return v->ToUint32(v8::Isolate::GetCurrent()->GetCurrentContext()).FromMaybe(v8::Local())->Value(); } +static std::string to_string(const v8::Local& v) +{ + v8::String::Utf8Value data(v); + const char* p = *data; + if (p == NULL) return std::string(); + return std::string(p); +} CJSGraphics* unwrap_Graphics(v8::Handle obj) { @@ -23,7 +32,7 @@ CJSGraphics* unwrap_Graphics(v8::Handle obj) return static_cast(field->Value()); } -void init_w (const v8::FunctionCallbackInfo& args) +void init_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 5) @@ -31,13 +40,13 @@ void init_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->init(args[0], to_double(args[1]), to_double(args[2]), to_double(args[3]), to_double(args[4])); } -void EndDraw_w (const v8::FunctionCallbackInfo& args) +void EndDraw_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->EndDraw(); } -void put_GlobalAlpha_w (const v8::FunctionCallbackInfo& args) +void put_GlobalAlpha_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 2) @@ -45,19 +54,19 @@ void put_GlobalAlpha_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->put_GlobalAlpha(to_bool(args[0]), to_int(args[1])); } -void Start_GlobalAlpha_w (const v8::FunctionCallbackInfo& args) +void Start_GlobalAlpha_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->Start_GlobalAlpha(); } -void End_GlobalAlpha_w (const v8::FunctionCallbackInfo& args) +void End_GlobalAlpha_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->End_GlobalAlpha(); } -void p_color_w (const v8::FunctionCallbackInfo& args) +void p_color_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 4) @@ -65,7 +74,7 @@ void p_color_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->p_color(to_int(args[0]), to_int(args[1]), to_int(args[2]), to_int(args[3])); } -void p_width_w (const v8::FunctionCallbackInfo& args) +void p_width_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 1) @@ -73,7 +82,7 @@ void p_width_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->p_width(to_int(args[0])); } -void p_dash_w (const v8::FunctionCallbackInfo& args) +void p_dash_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 1) @@ -81,7 +90,7 @@ void p_dash_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->p_dash(args[0]); } -void b_color1_w (const v8::FunctionCallbackInfo& args) +void b_color1_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 4) @@ -89,7 +98,7 @@ void b_color1_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->b_color1(to_int(args[0]), to_int(args[1]), to_int(args[2]), to_int(args[3])); } -void b_color2_w (const v8::FunctionCallbackInfo& args) +void b_color2_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 4) @@ -97,7 +106,7 @@ void b_color2_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->b_color2(to_int(args[0]), to_int(args[1]), to_int(args[2]), to_int(args[3])); } -void transform_w (const v8::FunctionCallbackInfo& args) +void transform_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 6) @@ -105,7 +114,7 @@ void transform_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->transform(to_double(args[0]), to_double(args[1]), to_double(args[2]), to_double(args[3]), to_double(args[4]), to_double(args[5])); } -void CalculateFullTransform_w(const v8::FunctionCallbackInfo& args) +void CalculateFullTransform_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 1) @@ -113,25 +122,25 @@ void CalculateFullTransform_w(const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->CalculateFullTransform(to_bool(args[0])); } -void _s_w (const v8::FunctionCallbackInfo& args) +void _s_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->_s(); } -void _e_w (const v8::FunctionCallbackInfo& args) +void _e_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->_e(); } -void _z_w (const v8::FunctionCallbackInfo& args) +void _z_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->_z(); } -void _m_w (const v8::FunctionCallbackInfo& args) +void _m_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 2) @@ -139,7 +148,7 @@ void _m_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->_m(to_double(args[0]), to_double(args[1])); } -void _l_w (const v8::FunctionCallbackInfo& args) +void _l_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 2) @@ -147,7 +156,7 @@ void _l_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->_l(to_double(args[0]), to_double(args[1])); } -void _c_w (const v8::FunctionCallbackInfo& args) +void _c_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 6) @@ -155,7 +164,7 @@ void _c_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->_c(to_double(args[0]), to_double(args[1]), to_double(args[2]), to_double(args[3]), to_double(args[4]), to_double(args[5])); } -void _c2_w (const v8::FunctionCallbackInfo& args) +void _c2_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 4) @@ -163,43 +172,43 @@ void _c2_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->_c2(to_double(args[0]), to_double(args[1]), to_double(args[2]), to_double(args[3])); } -void ds_w (const v8::FunctionCallbackInfo& args) +void ds_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->ds(); } -void df_w (const v8::FunctionCallbackInfo& args) +void df_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->df(); } -void save_w (const v8::FunctionCallbackInfo& args) +void save_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->save(); } -void restore_w (const v8::FunctionCallbackInfo& args) +void restore_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->restore(); } -void clip_w (const v8::FunctionCallbackInfo& args) +void clip_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->clip(); } -void reset_w (const v8::FunctionCallbackInfo& args) +void reset_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->reset(); } -void transform3_w (const v8::FunctionCallbackInfo& args) +void transform3_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 2) @@ -207,19 +216,19 @@ void transform3_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->transform3(args[0], to_bool(args[1])); } -void FreeFont_w (const v8::FunctionCallbackInfo& args) +void FreeFont_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->FreeFont(); } -void ClearLastFont_w (const v8::FunctionCallbackInfo& args) +void ClearLastFont_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->ClearLastFont(); } -void drawImage2_w (const v8::FunctionCallbackInfo& args) +void drawImage2_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 7) @@ -227,7 +236,7 @@ void drawImage2_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->drawImage2(args[0], to_double(args[1]), to_double(args[2]), to_double(args[3]), to_double(args[4]), to_int(args[5]), args[6]); } -void drawImage_w (const v8::FunctionCallbackInfo& args) +void drawImage_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 8) @@ -235,13 +244,13 @@ void drawImage_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->drawImage(args[0], to_double(args[1]), to_double(args[2]), to_double(args[3]), to_double(args[4]), to_int(args[5]), args[6], args[7]); } -void GetFont_w (const v8::FunctionCallbackInfo& args) +void GetFont_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->GetFont(); } -void font_w (const v8::FunctionCallbackInfo& args) +void font_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 2) @@ -249,7 +258,7 @@ void font_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->font(to_uint(args[0]), to_int(args[1])); } -void SetFont_w (const v8::FunctionCallbackInfo& args) +void SetFont_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 1) @@ -257,7 +266,7 @@ void SetFont_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->SetFont(args[0]); } -void SetTextPr_w (const v8::FunctionCallbackInfo& args) +void SetTextPr_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 2) @@ -267,7 +276,7 @@ void SetTextPr_w (const v8::FunctionCallbackInfo& args) v8::Local args1 = args[1]; pGraphics->SetTextPr(&args0, &args1); } -void SetFontSlot_w (const v8::FunctionCallbackInfo& args) +void SetFontSlot_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 2) @@ -275,13 +284,13 @@ void SetFontSlot_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->SetFontSlot(args[0], to_double(args[1])); } -void GetTextPr_w (const v8::FunctionCallbackInfo& args) +void GetTextPr_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->GetTextPr(); } -void FillText_w (const v8::FunctionCallbackInfo& args) +void FillText_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 3) @@ -289,7 +298,7 @@ void FillText_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->FillText(to_double(args[0]), to_double(args[1]), args[2]); } -void t_w (const v8::FunctionCallbackInfo& args) +void t_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 4) @@ -297,7 +306,7 @@ void t_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->t(args[0], to_double(args[1]), to_double(args[2]), to_bool(args[3])); } -void FillText2_w (const v8::FunctionCallbackInfo& args) +void FillText2_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 5) @@ -305,7 +314,7 @@ void FillText2_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->FillText2(to_double(args[0]), to_double(args[1]), args[2], to_double(args[3]), to_double(args[4])); } -void t2_w (const v8::FunctionCallbackInfo& args) +void t2_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 5) @@ -313,7 +322,7 @@ void t2_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->t2(args[0], to_double(args[1]), to_double(args[2]), to_double(args[3]), to_double(args[4])); } -void FillTextCode_w (const v8::FunctionCallbackInfo& args) +void FillTextCode_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 3) @@ -321,7 +330,7 @@ void FillTextCode_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->FillTextCode(to_double(args[0]), to_double(args[1]), args[2]); } -void tg_w (const v8::FunctionCallbackInfo& args) +void tg_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 3) @@ -329,7 +338,7 @@ void tg_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->tg(args[0], to_double(args[1]), to_double(args[2])); } -void charspace_w (const v8::FunctionCallbackInfo& args) +void charspace_w (const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); if (args.Length() < 1) @@ -337,6 +346,358 @@ void charspace_w (const v8::FunctionCallbackInfo& args) CJSGraphics* pGraphics = unwrap_Graphics(args.This()); pGraphics->charspace(args[0]); } +void private_FillGlyph_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 2) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->private_FillGlyph(args[0], args[1]); +} +void private_FillGlyphC_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 3) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->private_FillGlyphC(args[0], to_double(args[1]), to_double(args[2])); +} +void private_FillGlyph2_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 1) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->private_FillGlyph2(args[0]); +} +void SetIntegerGrid_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 1) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->SetIntegerGrid(to_bool(args[0])); +} +void GetIntegerGrid_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->GetIntegerGrid(); +} +void DrawStringASCII_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 8) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->DrawStringASCII(to_string(args[0]), to_int(args[1]), to_bool(args[2]), to_bool(args[3]), args[4], to_double(args[5]), to_double(args[6]), to_bool(args[7])); +} +void DrawStringASCII2_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 8) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->DrawStringASCII2(to_string(args[0]), to_int(args[1]), to_bool(args[2]), to_bool(args[3]), args[4], to_double(args[5]), to_double(args[6]), to_bool(args[7])); +} +void DrawHeaderEdit_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 5) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->DrawHeaderEdit(to_double(args[0]), args[1], to_int(args[2]), to_bool(args[3]), args[4]); +} +void DrawFooterEdit_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 5) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->DrawFooterEdit(to_double(args[0]), args[1], to_int(args[2]), to_bool(args[3]), args[4]); +} +void DrawLockParagraph_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 4) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->DrawLockParagraph(args[0], to_double(args[1]), to_double(args[2]), to_double(args[3])); +} +void DrawLockObjectRect_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 5) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->DrawLockObjectRect(args[0], to_double(args[1]), to_double(args[2]), to_double(args[3]), to_double(args[4])); +} +void DrawEmptyTableLine_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 4) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->DrawEmptyTableLine(to_double(args[0]), to_double(args[1]), to_double(args[2]), to_double(args[3])); +} +void DrawSpellingLine_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 4) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->DrawSpellingLine(to_double(args[0]), to_double(args[1]), to_double(args[2]), to_double(args[3])); +} +void drawHorLine_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 5) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->drawHorLine(to_int(args[0]), to_double(args[1]), to_double(args[2]), to_double(args[3]), to_int(args[4])); +} +void drawHorLine2_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 5) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->drawHorLine2(to_int(args[0]), to_double(args[1]), to_double(args[2]), to_double(args[3]), to_int(args[4])); +} +void drawVerLine_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 5) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->drawVerLine(to_int(args[0]), to_double(args[1]), to_double(args[2]), to_double(args[3]), to_int(args[4])); +} +void drawHorLineExt_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 7) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->drawHorLineExt(to_int(args[0]), to_double(args[1]), to_double(args[2]), to_double(args[3]), to_int(args[4]), to_double(args[5]), to_double(args[6])); +} +void rect_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 4) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->rect(to_double(args[0]), to_double(args[1]), to_double(args[2]), to_double(args[3])); +} +void TableRect_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 4) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->TableRect(to_double(args[0]), to_double(args[1]), to_double(args[2]), to_double(args[3])); +} +void AddClipRect_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 4) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->AddClipRect(to_double(args[0]), to_double(args[1]), to_double(args[2]), to_double(args[3])); +} +void RemoveClipRect_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->RemoveClipRect(); +} +void SetClip_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 1) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->SetClip(args[0]); +} +void RemoveClip_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->RemoveClip(); +} +void drawCollaborativeChanges_w(const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 5) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->drawCollaborativeChanges(to_double(args[0]), to_double(args[1]), to_double(args[2]), to_double(args[3]), args[4]); +} +void drawMailMergeField_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 4) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->drawMailMergeField(to_double(args[0]), to_double(args[1]), to_double(args[2]), to_double(args[3])); +} +void drawSearchResult_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 4) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->drawSearchResult(to_double(args[0]), to_double(args[1]), to_double(args[2]), to_double(args[3])); +} +void drawFlowAnchor_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 2) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->drawFlowAnchor(to_double(args[0]), to_double(args[1])); +} +void SavePen_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->SavePen(); +} +void RestorePen_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->RestorePen(); +} +void SaveBrush_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->SaveBrush(); +} +void RestoreBrush_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->RestoreBrush(); +} +void SavePenBrush_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->SavePenBrush(); +} +void RestorePenBrush_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->RestorePenBrush(); +} +void SaveGrState_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->SaveGrState(); +} +void RestoreGrState_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->RestoreGrState(); +} +void StartClipPath_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->StartClipPath(); +} +void EndClipPath_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->EndClipPath(); +} +void StartCheckTableDraw_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->StartCheckTableDraw(); +} +void EndCheckTableDraw_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 1) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->EndCheckTableDraw(to_bool(args[0])); +} +void SetTextClipRect_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 4) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->SetTextClipRect(to_double(args[0]), to_double(args[1]), to_double(args[2]), to_double(args[3])); +} +void AddSmartRect_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 5) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->AddSmartRect(to_double(args[0]), to_double(args[1]), to_double(args[2]), to_double(args[3]), to_int(args[4])); +} +void CheckUseFonts2_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 1) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->CheckUseFonts2(args[0]); +} +void UncheckUseFonts2_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->UncheckUseFonts2(); +} +void Drawing_StartCheckBounds_w(const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 4) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->Drawing_StartCheckBounds(to_double(args[0]), to_double(args[1]), to_double(args[2]), to_double(args[3])); +} +void Drawing_EndCheckBounds_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->Drawing_EndCheckBounds(); +} +void DrawPresentationComment_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 5) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->DrawPresentationComment(args[0], to_double(args[1]), to_double(args[2]), to_double(args[3]), to_double(args[4])); +} +void DrawPolygon_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 4) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->DrawPolygon(args[0], to_int(args[1]), to_double(args[2])); +} +void DrawFootnoteRect_w (const v8::FunctionCallbackInfo& args) +{ + args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); + if (args.Length() < 4) + return; + CJSGraphics* pGraphics = unwrap_Graphics(args.This()); + pGraphics->DrawFootnoteRect(to_double(args[0]), to_double(args[1]), to_double(args[2]), to_double(args[3])); +} void m_dDpiX_get_w (v8::Local _name, const v8::PropertyCallbackInfo& info) { @@ -361,49 +722,97 @@ v8::Handle CreateGraphicsTemplate(v8::Isolate* isolate) result->SetAccessor(v8::String::NewFromUtf8(current, "globalAlpha"), globalAlpha_get_w); // методы - result->Set(current, "init", v8::FunctionTemplate::New(current, init_w)); - result->Set(current, "EndDraw", v8::FunctionTemplate::New(current, EndDraw_w)); - result->Set(current, "put_GlobalAlpha", v8::FunctionTemplate::New(current, put_GlobalAlpha_w)); - result->Set(current, "Start_GlobalAlpha", v8::FunctionTemplate::New(current, Start_GlobalAlpha_w)); - result->Set(current, "End_GlobalAlpha", v8::FunctionTemplate::New(current, End_GlobalAlpha_w)); - result->Set(current, "p_color", v8::FunctionTemplate::New(current, p_color_w)); - result->Set(current, "p_width", v8::FunctionTemplate::New(current, p_width_w)); - result->Set(current, "p_dash", v8::FunctionTemplate::New(current, p_dash_w)); - result->Set(current, "b_color1", v8::FunctionTemplate::New(current, b_color1_w)); - result->Set(current, "b_color2", v8::FunctionTemplate::New(current, b_color2_w)); - result->Set(current, "transform", v8::FunctionTemplate::New(current, transform_w)); - result->Set(current, "CalculateFullTransform", v8::FunctionTemplate::New(current, CalculateFullTransform_w)); - result->Set(current, "_s", v8::FunctionTemplate::New(current, _s_w)); - result->Set(current, "_e", v8::FunctionTemplate::New(current, _e_w)); - result->Set(current, "_z", v8::FunctionTemplate::New(current, _z_w)); - result->Set(current, "_m", v8::FunctionTemplate::New(current, _m_w)); - result->Set(current, "_l", v8::FunctionTemplate::New(current, _l_w)); - result->Set(current, "_c", v8::FunctionTemplate::New(current, _c_w)); - result->Set(current, "_c2", v8::FunctionTemplate::New(current, _c2_w)); - result->Set(current, "ds", v8::FunctionTemplate::New(current, ds_w)); - result->Set(current, "df", v8::FunctionTemplate::New(current, df_w)); - result->Set(current, "save", v8::FunctionTemplate::New(current, save_w)); - result->Set(current, "restore", v8::FunctionTemplate::New(current, restore_w)); - result->Set(current, "clip", v8::FunctionTemplate::New(current, clip_w)); - result->Set(current, "reset", v8::FunctionTemplate::New(current, reset_w)); - result->Set(current, "transform3", v8::FunctionTemplate::New(current, transform3_w)); - result->Set(current, "FreeFont", v8::FunctionTemplate::New(current, FreeFont_w)); - result->Set(current, "ClearLastFont", v8::FunctionTemplate::New(current, ClearLastFont_w)); - result->Set(current, "drawImage2", v8::FunctionTemplate::New(current, drawImage2_w)); - result->Set(current, "drawImage", v8::FunctionTemplate::New(current, drawImage_w)); - result->Set(current, "GetFont", v8::FunctionTemplate::New(current, GetFont_w)); - result->Set(current, "font", v8::FunctionTemplate::New(current, font_w)); - result->Set(current, "SetFont", v8::FunctionTemplate::New(current, SetFont_w)); - result->Set(current, "SetTextPr", v8::FunctionTemplate::New(current, SetTextPr_w)); - result->Set(current, "SetFontSlot", v8::FunctionTemplate::New(current, SetFontSlot_w)); - result->Set(current, "GetTextPr", v8::FunctionTemplate::New(current, GetTextPr_w)); - result->Set(current, "FillText", v8::FunctionTemplate::New(current, FillText_w)); - result->Set(current, "t", v8::FunctionTemplate::New(current, t_w)); - result->Set(current, "FillText2", v8::FunctionTemplate::New(current, FillText2_w)); - result->Set(current, "t2", v8::FunctionTemplate::New(current, t2_w)); - result->Set(current, "FillTextCode", v8::FunctionTemplate::New(current, FillTextCode_w)); - result->Set(current, "tg", v8::FunctionTemplate::New(current, tg_w)); - result->Set(current, "charspace", v8::FunctionTemplate::New(current, charspace_w)); + result->Set(current, "init", v8::FunctionTemplate::New(current, init_w)); + result->Set(current, "EndDraw", v8::FunctionTemplate::New(current, EndDraw_w)); + result->Set(current, "put_GlobalAlpha", v8::FunctionTemplate::New(current, put_GlobalAlpha_w)); + result->Set(current, "Start_GlobalAlpha", v8::FunctionTemplate::New(current, Start_GlobalAlpha_w)); + result->Set(current, "End_GlobalAlpha", v8::FunctionTemplate::New(current, End_GlobalAlpha_w)); + result->Set(current, "p_color", v8::FunctionTemplate::New(current, p_color_w)); + result->Set(current, "p_width", v8::FunctionTemplate::New(current, p_width_w)); + result->Set(current, "p_dash", v8::FunctionTemplate::New(current, p_dash_w)); + result->Set(current, "b_color1", v8::FunctionTemplate::New(current, b_color1_w)); + result->Set(current, "b_color2", v8::FunctionTemplate::New(current, b_color2_w)); + result->Set(current, "transform", v8::FunctionTemplate::New(current, transform_w)); + result->Set(current, "CalculateFullTransform", v8::FunctionTemplate::New(current, CalculateFullTransform_w)); + result->Set(current, "_s", v8::FunctionTemplate::New(current, _s_w)); + result->Set(current, "_e", v8::FunctionTemplate::New(current, _e_w)); + result->Set(current, "_z", v8::FunctionTemplate::New(current, _z_w)); + result->Set(current, "_m", v8::FunctionTemplate::New(current, _m_w)); + result->Set(current, "_l", v8::FunctionTemplate::New(current, _l_w)); + result->Set(current, "_c", v8::FunctionTemplate::New(current, _c_w)); + result->Set(current, "_c2", v8::FunctionTemplate::New(current, _c2_w)); + result->Set(current, "ds", v8::FunctionTemplate::New(current, ds_w)); + result->Set(current, "df", v8::FunctionTemplate::New(current, df_w)); + result->Set(current, "save", v8::FunctionTemplate::New(current, save_w)); + result->Set(current, "restore", v8::FunctionTemplate::New(current, restore_w)); + result->Set(current, "clip", v8::FunctionTemplate::New(current, clip_w)); + result->Set(current, "reset", v8::FunctionTemplate::New(current, reset_w)); + result->Set(current, "transform3", v8::FunctionTemplate::New(current, transform3_w)); + result->Set(current, "FreeFont", v8::FunctionTemplate::New(current, FreeFont_w)); + result->Set(current, "ClearLastFont", v8::FunctionTemplate::New(current, ClearLastFont_w)); + result->Set(current, "drawImage2", v8::FunctionTemplate::New(current, drawImage2_w)); + result->Set(current, "drawImage", v8::FunctionTemplate::New(current, drawImage_w)); + result->Set(current, "GetFont", v8::FunctionTemplate::New(current, GetFont_w)); + result->Set(current, "font", v8::FunctionTemplate::New(current, font_w)); + result->Set(current, "SetFont", v8::FunctionTemplate::New(current, SetFont_w)); + result->Set(current, "SetTextPr", v8::FunctionTemplate::New(current, SetTextPr_w)); + result->Set(current, "SetFontSlot", v8::FunctionTemplate::New(current, SetFontSlot_w)); + result->Set(current, "GetTextPr", v8::FunctionTemplate::New(current, GetTextPr_w)); + result->Set(current, "FillText", v8::FunctionTemplate::New(current, FillText_w)); + result->Set(current, "t", v8::FunctionTemplate::New(current, t_w)); + result->Set(current, "FillText2", v8::FunctionTemplate::New(current, FillText2_w)); + result->Set(current, "t2", v8::FunctionTemplate::New(current, t2_w)); + result->Set(current, "FillTextCode", v8::FunctionTemplate::New(current, FillTextCode_w)); + result->Set(current, "tg", v8::FunctionTemplate::New(current, tg_w)); + result->Set(current, "charspace", v8::FunctionTemplate::New(current, charspace_w)); + result->Set(current, "private_FillGlyph", v8::FunctionTemplate::New(current, private_FillGlyph_w)); + result->Set(current, "private_FillGlyphC", v8::FunctionTemplate::New(current, private_FillGlyphC_w)); + result->Set(current, "private_FillGlyph2", v8::FunctionTemplate::New(current, private_FillGlyph2_w)); + result->Set(current, "SetIntegerGrid", v8::FunctionTemplate::New(current, SetIntegerGrid_w)); + result->Set(current, "GetIntegerGrid", v8::FunctionTemplate::New(current, GetIntegerGrid_w)); + result->Set(current, "DrawStringASCII", v8::FunctionTemplate::New(current, DrawStringASCII_w)); + result->Set(current, "DrawStringASCII2", v8::FunctionTemplate::New(current, DrawStringASCII2_w)); + result->Set(current, "DrawHeaderEdit", v8::FunctionTemplate::New(current, DrawHeaderEdit_w)); + result->Set(current, "DrawFooterEdit", v8::FunctionTemplate::New(current, DrawFooterEdit_w)); + result->Set(current, "DrawLockParagraph", v8::FunctionTemplate::New(current, DrawLockParagraph_w)); + result->Set(current, "DrawLockObjectRect", v8::FunctionTemplate::New(current, DrawLockObjectRect_w)); + result->Set(current, "DrawEmptyTableLine", v8::FunctionTemplate::New(current, DrawEmptyTableLine_w)); + result->Set(current, "DrawSpellingLine", v8::FunctionTemplate::New(current, DrawSpellingLine_w)); + result->Set(current, "drawHorLine", v8::FunctionTemplate::New(current, drawHorLine_w)); + result->Set(current, "drawHorLine2", v8::FunctionTemplate::New(current, drawHorLine2_w)); + result->Set(current, "drawVerLine", v8::FunctionTemplate::New(current, drawVerLine_w)); + result->Set(current, "drawHorLineExt", v8::FunctionTemplate::New(current, drawHorLineExt_w)); + result->Set(current, "rect", v8::FunctionTemplate::New(current, rect_w)); + result->Set(current, "TableRect", v8::FunctionTemplate::New(current, TableRect_w)); + result->Set(current, "AddClipRect", v8::FunctionTemplate::New(current, AddClipRect_w)); + result->Set(current, "RemoveClipRect", v8::FunctionTemplate::New(current, RemoveClipRect_w)); + result->Set(current, "SetClip", v8::FunctionTemplate::New(current, SetClip_w)); + result->Set(current, "RemoveClip", v8::FunctionTemplate::New(current, RemoveClip_w)); + result->Set(current, "drawCollaborativeChanges", v8::FunctionTemplate::New(current, drawCollaborativeChanges_w)); + result->Set(current, "drawMailMergeField", v8::FunctionTemplate::New(current, drawMailMergeField_w)); + result->Set(current, "drawSearchResult", v8::FunctionTemplate::New(current, drawSearchResult_w)); + result->Set(current, "drawFlowAnchor", v8::FunctionTemplate::New(current, drawFlowAnchor_w)); + result->Set(current, "SavePen", v8::FunctionTemplate::New(current, SavePen_w)); + result->Set(current, "RestorePen", v8::FunctionTemplate::New(current, RestorePen_w)); + result->Set(current, "SaveBrush", v8::FunctionTemplate::New(current, SaveBrush_w)); + result->Set(current, "RestoreBrush", v8::FunctionTemplate::New(current, RestoreBrush_w)); + result->Set(current, "SavePenBrush", v8::FunctionTemplate::New(current, SavePenBrush_w)); + result->Set(current, "RestorePenBrush", v8::FunctionTemplate::New(current, RestorePenBrush_w)); + result->Set(current, "SaveGrState", v8::FunctionTemplate::New(current, SaveGrState_w)); + result->Set(current, "RestoreGrState", v8::FunctionTemplate::New(current, RestoreGrState_w)); + result->Set(current, "StartClipPath", v8::FunctionTemplate::New(current, StartClipPath_w)); + result->Set(current, "EndClipPath", v8::FunctionTemplate::New(current, EndClipPath_w)); + result->Set(current, "StartCheckTableDraw", v8::FunctionTemplate::New(current, StartCheckTableDraw_w)); + result->Set(current, "EndCheckTableDraw", v8::FunctionTemplate::New(current, EndCheckTableDraw_w)); + result->Set(current, "SetTextClipRect", v8::FunctionTemplate::New(current, SetTextClipRect_w)); + result->Set(current, "AddSmartRect", v8::FunctionTemplate::New(current, AddSmartRect_w)); + result->Set(current, "CheckUseFonts2", v8::FunctionTemplate::New(current, CheckUseFonts2_w)); + result->Set(current, "UncheckUseFonts2", v8::FunctionTemplate::New(current, UncheckUseFonts2_w)); + result->Set(current, "Drawing_StartCheckBounds", v8::FunctionTemplate::New(current, Drawing_StartCheckBounds_w)); + result->Set(current, "Drawing_EndCheckBounds", v8::FunctionTemplate::New(current, Drawing_EndCheckBounds_w)); + result->Set(current, "DrawPresentationComment", v8::FunctionTemplate::New(current, DrawPresentationComment_w)); + result->Set(current, "DrawPolygon", v8::FunctionTemplate::New(current, DrawPolygon_w)); + result->Set(current, "DrawFootnoteRect", v8::FunctionTemplate::New(current, DrawFootnoteRect_w)); return result; } diff --git a/DesktopEditor/doctrenderer/jsgraphics/graphics_wrapper.h b/DesktopEditor/doctrenderer/jsgraphics/graphics_wrapper.h index 48e62bdd1a..b540ae2680 100644 --- a/DesktopEditor/doctrenderer/jsgraphics/graphics_wrapper.h +++ b/DesktopEditor/doctrenderer/jsgraphics/graphics_wrapper.h @@ -1,55 +1,106 @@ #include "graphics.h" -double to_double(const v8::Local& v); -bool to_bool (const v8::Local& v); -int to_int (const v8::Local& v); -int to_uint (const v8::Local& v); +#include + +double to_double(const v8::Local& v); +bool to_bool (const v8::Local& v); +int to_int (const v8::Local& v); +int to_uint (const v8::Local& v); +std::string to_string(const v8::Local& v); CJSGraphics* unwrap_Graphics(v8::Handle obj); -void init_w (const v8::FunctionCallbackInfo& args); -void EndDraw_w (const v8::FunctionCallbackInfo& args); -void put_GlobalAlpha_w (const v8::FunctionCallbackInfo& args); -void Start_GlobalAlpha_w (const v8::FunctionCallbackInfo& args); -void End_GlobalAlpha_w (const v8::FunctionCallbackInfo& args); -void p_color_w (const v8::FunctionCallbackInfo& args); -void p_width_w (const v8::FunctionCallbackInfo& args); -void p_dash_w (const v8::FunctionCallbackInfo& args); -void b_color1_w (const v8::FunctionCallbackInfo& args); -void b_color2_w (const v8::FunctionCallbackInfo& args); -void transform_w (const v8::FunctionCallbackInfo& args); -void CalculateFullTransform_w(const v8::FunctionCallbackInfo& args); -void _s_w (const v8::FunctionCallbackInfo& args); -void _e_w (const v8::FunctionCallbackInfo& args); -void _z_w (const v8::FunctionCallbackInfo& args); -void _m_w (const v8::FunctionCallbackInfo& args); -void _l_w (const v8::FunctionCallbackInfo& args); -void _c_w (const v8::FunctionCallbackInfo& args); -void _c2_w (const v8::FunctionCallbackInfo& args); -void ds_w (const v8::FunctionCallbackInfo& args); -void df_w (const v8::FunctionCallbackInfo& args); -void save_w (const v8::FunctionCallbackInfo& args); -void restore_w (const v8::FunctionCallbackInfo& args); -void clip_w (const v8::FunctionCallbackInfo& args); -void reset_w (const v8::FunctionCallbackInfo& args); -void transform3_w (const v8::FunctionCallbackInfo& args); -void FreeFont_w (const v8::FunctionCallbackInfo& args); -void ClearLastFont_w (const v8::FunctionCallbackInfo& args); -void drawImage2_w (const v8::FunctionCallbackInfo& args); -void drawImage_w (const v8::FunctionCallbackInfo& args); -void GetFont_w (const v8::FunctionCallbackInfo& args); -void font_w (const v8::FunctionCallbackInfo& args); -void SetFont_w (const v8::FunctionCallbackInfo& args); -void SetTextPr_w (const v8::FunctionCallbackInfo& args); -void SetFontSlot_w (const v8::FunctionCallbackInfo& args); -void GetTextPr_w (const v8::FunctionCallbackInfo& args); -void FillText_w (const v8::FunctionCallbackInfo& args); -void t_w (const v8::FunctionCallbackInfo& args); -void FillText2_w (const v8::FunctionCallbackInfo& args); -void t2_w (const v8::FunctionCallbackInfo& args); -void FillTextCode_w (const v8::FunctionCallbackInfo& args); -void tg_w (const v8::FunctionCallbackInfo& args); -void charspace_w (const v8::FunctionCallbackInfo& args); +void init_w (const v8::FunctionCallbackInfo& args); +void EndDraw_w (const v8::FunctionCallbackInfo& args); +void put_GlobalAlpha_w (const v8::FunctionCallbackInfo& args); +void Start_GlobalAlpha_w (const v8::FunctionCallbackInfo& args); +void End_GlobalAlpha_w (const v8::FunctionCallbackInfo& args); +void p_color_w (const v8::FunctionCallbackInfo& args); +void p_width_w (const v8::FunctionCallbackInfo& args); +void p_dash_w (const v8::FunctionCallbackInfo& args); +void b_color1_w (const v8::FunctionCallbackInfo& args); +void b_color2_w (const v8::FunctionCallbackInfo& args); +void transform_w (const v8::FunctionCallbackInfo& args); +void CalculateFullTransform_w (const v8::FunctionCallbackInfo& args); +void _s_w (const v8::FunctionCallbackInfo& args); +void _e_w (const v8::FunctionCallbackInfo& args); +void _z_w (const v8::FunctionCallbackInfo& args); +void _m_w (const v8::FunctionCallbackInfo& args); +void _l_w (const v8::FunctionCallbackInfo& args); +void _c_w (const v8::FunctionCallbackInfo& args); +void _c2_w (const v8::FunctionCallbackInfo& args); +void ds_w (const v8::FunctionCallbackInfo& args); +void df_w (const v8::FunctionCallbackInfo& args); +void save_w (const v8::FunctionCallbackInfo& args); +void restore_w (const v8::FunctionCallbackInfo& args); +void clip_w (const v8::FunctionCallbackInfo& args); +void reset_w (const v8::FunctionCallbackInfo& args); +void transform3_w (const v8::FunctionCallbackInfo& args); +void FreeFont_w (const v8::FunctionCallbackInfo& args); +void ClearLastFont_w (const v8::FunctionCallbackInfo& args); +void drawImage2_w (const v8::FunctionCallbackInfo& args); +void drawImage_w (const v8::FunctionCallbackInfo& args); +void GetFont_w (const v8::FunctionCallbackInfo& args); +void font_w (const v8::FunctionCallbackInfo& args); +void SetFont_w (const v8::FunctionCallbackInfo& args); +void SetTextPr_w (const v8::FunctionCallbackInfo& args); +void SetFontSlot_w (const v8::FunctionCallbackInfo& args); +void GetTextPr_w (const v8::FunctionCallbackInfo& args); +void FillText_w (const v8::FunctionCallbackInfo& args); +void t_w (const v8::FunctionCallbackInfo& args); +void FillText2_w (const v8::FunctionCallbackInfo& args); +void t2_w (const v8::FunctionCallbackInfo& args); +void FillTextCode_w (const v8::FunctionCallbackInfo& args); +void tg_w (const v8::FunctionCallbackInfo& args); +void charspace_w (const v8::FunctionCallbackInfo& args); +void private_FillGlyph_w (const v8::FunctionCallbackInfo& args); +void private_FillGlyphC_w (const v8::FunctionCallbackInfo& args); +void private_FillGlyph2_w (const v8::FunctionCallbackInfo& args); +void SetIntegerGrid_w (const v8::FunctionCallbackInfo& args); +void GetIntegerGrid_w (const v8::FunctionCallbackInfo& args); +void DrawStringASCII_w (const v8::FunctionCallbackInfo& args); +void DrawStringASCII2_w (const v8::FunctionCallbackInfo& args); +void DrawHeaderEdit_w (const v8::FunctionCallbackInfo& args); +void DrawFooterEdit_w (const v8::FunctionCallbackInfo& args); +void DrawLockParagraph_w (const v8::FunctionCallbackInfo& args); +void DrawLockObjectRect_w (const v8::FunctionCallbackInfo& args); +void DrawEmptyTableLine_w (const v8::FunctionCallbackInfo& args); +void DrawSpellingLine_w (const v8::FunctionCallbackInfo& args); +void drawHorLine_w (const v8::FunctionCallbackInfo& args); +void drawHorLine2_w (const v8::FunctionCallbackInfo& args); +void drawVerLine_w (const v8::FunctionCallbackInfo& args); +void drawHorLineExt_w (const v8::FunctionCallbackInfo& args); +void rect_w (const v8::FunctionCallbackInfo& args); +void TableRect_w (const v8::FunctionCallbackInfo& args); +void AddClipRect_w (const v8::FunctionCallbackInfo& args); +void RemoveClipRect_w (const v8::FunctionCallbackInfo& args); +void SetClip_w (const v8::FunctionCallbackInfo& args); +void RemoveClip_w (const v8::FunctionCallbackInfo& args); +void drawCollaborativeChanges_w(const v8::FunctionCallbackInfo& args); +void drawMailMergeField_w (const v8::FunctionCallbackInfo& args); +void drawSearchResult_w (const v8::FunctionCallbackInfo& args); +void drawFlowAnchor_w (const v8::FunctionCallbackInfo& args); +void SavePen_w (const v8::FunctionCallbackInfo& args); +void RestorePen_w (const v8::FunctionCallbackInfo& args); +void SaveBrush_w (const v8::FunctionCallbackInfo& args); +void RestoreBrush_w (const v8::FunctionCallbackInfo& args); +void SavePenBrush_w (const v8::FunctionCallbackInfo& args); +void RestorePenBrush_w (const v8::FunctionCallbackInfo& args); +void SaveGrState_w (const v8::FunctionCallbackInfo& args); +void RestoreGrState_w (const v8::FunctionCallbackInfo& args); +void StartClipPath_w (const v8::FunctionCallbackInfo& args); +void EndClipPath_w (const v8::FunctionCallbackInfo& args); +void StartCheckTableDraw_w (const v8::FunctionCallbackInfo& args); +void EndCheckTableDraw_w (const v8::FunctionCallbackInfo& args); +void SetTextClipRect_w (const v8::FunctionCallbackInfo& args); +void AddSmartRect_w (const v8::FunctionCallbackInfo& args); +void CheckUseFonts2_w (const v8::FunctionCallbackInfo& args); +void UncheckUseFonts2_w (const v8::FunctionCallbackInfo& args); +void Drawing_StartCheckBounds_w(const v8::FunctionCallbackInfo& args); +void Drawing_EndCheckBounds_w (const v8::FunctionCallbackInfo& args); +void DrawPresentationComment_w (const v8::FunctionCallbackInfo& args); +void DrawPolygon_w (const v8::FunctionCallbackInfo& args); +void DrawFootnoteRect_w (const v8::FunctionCallbackInfo& args); void m_dDpiX_get_w (v8::Local _name, const v8::PropertyCallbackInfo& info); void globalAlpha_get_w(v8::Local _name, const v8::PropertyCallbackInfo& info);