Commit aea82a77 authored by Oleg.Korshul's avatar Oleg.Korshul

git-svn-id:...

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@51398 954022d7-b5bf-4e40-9824-e11837661b57
parent 55910e48
...@@ -5838,7 +5838,7 @@ PasteProcessor.prototype = ...@@ -5838,7 +5838,7 @@ PasteProcessor.prototype =
} }
else else
{ {
Drawing = CreateImageFromBinary(sSrc); Drawing = CreateImageFromBinary(sSrc, nWidth, nHeight);
// oTargetDocument.DrawingObjects.Add( Drawing ); // oTargetDocument.DrawingObjects.Add( Drawing );
} }
......
...@@ -6959,43 +6959,52 @@ function CreateGraphicObjectFromBinary(bin) ...@@ -6959,43 +6959,52 @@ function CreateGraphicObjectFromBinary(bin)
} }
function CreateImageFromBinary(bin) function CreateImageFromBinary(bin, nW, nH)
{ {
var w, h; var w, h;
var _image = editor.ImageLoader.map_image_index[bin];
if (_image != undefined && _image.Image != null && _image.Status == ImageLoadStatus.Complete)
{
var _w = Math.max(1, Page_Width - (X_Left_Margin + X_Right_Margin));
var _h = Math.max(1, Page_Height - (Y_Top_Margin + Y_Bottom_Margin));
var bIsCorrect = false; if (nW === undefined || nH === undefined)
if (_image.Image != null) {
var _image = editor.ImageLoader.map_image_index[bin];
if (_image != undefined && _image.Image != null && _image.Status == ImageLoadStatus.Complete)
{ {
var __w = Math.max(parseInt(_image.Image.width * g_dKoef_pix_to_mm), 1); var _w = Math.max(1, Page_Width - (X_Left_Margin + X_Right_Margin));
var __h = Math.max(parseInt(_image.Image.height * g_dKoef_pix_to_mm), 1); var _h = Math.max(1, Page_Height - (Y_Top_Margin + Y_Bottom_Margin));
var dKoef = Math.max(__w / _w, __h / _h); var bIsCorrect = false;
if (dKoef > 1) if (_image.Image != null)
{ {
_w = Math.max(5, __w / dKoef); var __w = Math.max(parseInt(_image.Image.width * g_dKoef_pix_to_mm), 1);
_h = Math.max(5, __h / dKoef); var __h = Math.max(parseInt(_image.Image.height * g_dKoef_pix_to_mm), 1);
bIsCorrect = true; var dKoef = Math.max(__w / _w, __h / _h);
} if (dKoef > 1)
else {
{ _w = Math.max(5, __w / dKoef);
_w = __w; _h = Math.max(5, __h / dKoef);
_h = __h;
bIsCorrect = true;
}
else
{
_w = __w;
_h = __h;
}
} }
}
w = __w; w = __w;
h = __h; h = __h;
}
else
{
w = 50;
h = 50;
}
} }
else else
{ {
w = 50; w = nW;
h = 50; h = nH;
} }
var para_drawing = new ParaDrawing(w, h, null, editor.WordControl.m_oLogicDocument.DrawingDocument, editor.WordControl.m_oLogicDocument, null); var para_drawing = new ParaDrawing(w, h, null, editor.WordControl.m_oLogicDocument.DrawingDocument, editor.WordControl.m_oLogicDocument, null);
var word_image = new WordImage(para_drawing, editor.WordControl.m_oLogicDocument, editor.WordControl.m_oLogicDocument.DrawingDocument, null); var word_image = new WordImage(para_drawing, editor.WordControl.m_oLogicDocument, editor.WordControl.m_oLogicDocument.DrawingDocument, null);
......
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