Commit 3a0a3d30 authored by Oleg.Korshul's avatar Oleg.Korshul

copy paste native

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@59128 954022d7-b5bf-4e40-9824-e11837661b57
parent 4068ef89
......@@ -1116,72 +1116,5 @@ CShapeDrawer.prototype =
function ShapeToImageConverter(shape, pageIndex)
{
window.IsShapeToImageConverter = true;
var _bounds_cheker = new CSlideBoundsChecker();
var dKoef = g_dKoef_mm_to_pix;
var w_mm = 210;
var h_mm = 297;
var w_px = (w_mm * dKoef) >> 0;
var h_px = (h_mm * dKoef) >> 0;
_bounds_cheker.init(w_px, h_px, w_mm, h_mm);
_bounds_cheker.transform(1,0,0,1,0,0);
_bounds_cheker.AutoCheckLineWidth = true;
_bounds_cheker.CheckLineWidth(shape);
shape.draw(_bounds_cheker, /*pageIndex*/0);
_bounds_cheker.CorrectBounds2();
var _need_pix_width = _bounds_cheker.Bounds.max_x - _bounds_cheker.Bounds.min_x + 1;
var _need_pix_height = _bounds_cheker.Bounds.max_y - _bounds_cheker.Bounds.min_y + 1;
if (_need_pix_width <= 0 || _need_pix_height <= 0)
return null;
/*
if (shape.pen)
{
var _w_pen = (shape.pen.w == null) ? 12700 : parseInt(shape.pen.w);
_w_pen /= 36000.0;
_w_pen *= g_dKoef_mm_to_pix;
_need_pix_width += (2 * _w_pen);
_need_pix_height += (2 * _w_pen);
_bounds_cheker.Bounds.min_x -= _w_pen;
_bounds_cheker.Bounds.min_y -= _w_pen;
}*/
var _canvas = document.createElement('canvas');
_canvas.width = _need_pix_width;
_canvas.height = _need_pix_height;
var _ctx = _canvas.getContext('2d');
var g = new CGraphics();
g.init(_ctx, w_px, h_px, w_mm, h_mm);
g.m_oFontManager = g_fontManager;
g.m_oCoordTransform.tx = -_bounds_cheker.Bounds.min_x;
g.m_oCoordTransform.ty = -_bounds_cheker.Bounds.min_y;
g.transform(1,0,0,1,0,0);
shape.draw(g, /*pageIndex*/0);
window.IsShapeToImageConverter = false;
var _ret = { ImageNative : _canvas, ImageUrl : "" };
try
{
_ret.ImageUrl = _canvas.toDataURL("image/png");
}
catch (err)
{
if (shape.brush != null && shape.brush.fill && shape.brush.fill.RasterImageId)
_ret.ImageUrl = _getFullImageSrc(shape.brush.fill.RasterImageId);
else
_ret.ImageUrl = "";
}
return _ret;
return "";
}
\ No newline at end of file
......@@ -4994,7 +4994,7 @@ asc_docs_api.prototype.Call_Menu_Context_Cut = function()
if (null != _binary_data.drawingUrls && _binary_data.drawingUrls.length > 0)
{
_stream["WriteByte"](1);
_stream["WriteString2"](_binary_data.drawingUrls[0]);
_stream["WriteStringA"](_binary_data.drawingUrls[0]);
}
// owner format
......@@ -5012,7 +5012,7 @@ asc_docs_api.prototype.Call_Menu_Context_Paste = function(type, param)
}
else if (1 == type)
{
this.AddImageUrlNative(param, 50, 50);
this.AddImageUrlNative(param, 200, 200);
}
else if (2 == type)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment