Commit d47be5b3 authored by Sergey.Luzyanin's avatar Sergey.Luzyanin

отрисовка текстуры в настройках текстарта

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@64131 954022d7-b5bf-4e40-9824-e11837661b57
parent 2bef826d
......@@ -5834,10 +5834,10 @@ DrawingObjectsController.prototype =
{
oTextArtProperties.Fill = oTextPr.Unifill;
}
// else if(oTextPr.Color)
// {
// oTextArtProperties.Fill = CreateUnfilFromRGB(oTextPr.Color.r, oTextPr.Color.g, oTextPr.Color.b);
// }
else if(oTextPr.Color)
{
oTextArtProperties.Fill = CreateUnfilFromRGB(oTextPr.Color.r, oTextPr.Color.g, oTextPr.Color.b);
}
oTextArtProperties.Line = oTextPr.TextOutline;
if(oTextArtProperties.Fill)
{
......@@ -5903,6 +5903,7 @@ DrawingObjectsController.prototype =
shape_props.Width = props.shapeChartProps.w;
shape_props.Height = props.shapeChartProps.h;
var pr = shape_props.ShapeProperties;
var oTextArtProperties;
if (!isRealObject(props.shapeProps))
{
if (pr.fill != null && pr.fill.fill != null && pr.fill.fill.type == FILL_TYPE_BLIP)
......@@ -5918,6 +5919,24 @@ DrawingObjectsController.prototype =
this.drawingObjects.drawingDocument.InitGuiCanvasShape(api.shapeElementId);
this.drawingObjects.drawingDocument.DrawImageTextureFillShape(null);
}
if(pr.textArtProperties)
{
oTextArtProperties = pr.textArtProperties;
if(oTextArtProperties && oTextArtProperties.Fill && oTextArtProperties.Fill.fill && oTextArtProperties.Fill.fill.type == FILL_TYPE_BLIP)
{
if(api)
this.drawingObjects.drawingDocument.InitGuiCanvasTextArt(api.textArtElementId);
this.drawingObjects.drawingDocument.LastDrawingUrlTextArt = null;
this.WordControl.m_oDrawingDocument.DrawImageTextureFillTextArt(oTextArtProperties.Fill.fill.RasterImageId);
}
else
{
this.WordControl.m_oDrawingDocument.DrawImageTextureFillTextArt(null);
}
}
}
shape_props.ShapeProperties.fill = CreateAscFill(shape_props.ShapeProperties.fill);
shape_props.ShapeProperties.stroke = CreateAscStroke(shape_props.ShapeProperties.stroke, shape_props.ShapeProperties.canChangeArrows === true);
......@@ -5938,6 +5957,22 @@ DrawingObjectsController.prototype =
shape_props.ShapeProperties.bFromChart = props.shapeProps.bFromChart;
shape_props.ShapeProperties.textArtProperties = CreateAscTextArtProps(props.shapeProps.textArtProperties);
if(props.shapeProps.textArtProperties)
{
oTextArtProperties = props.shapeProps.textArtProperties;
if(oTextArtProperties && oTextArtProperties.Fill && oTextArtProperties.Fill.fill && oTextArtProperties.Fill.fill.type == FILL_TYPE_BLIP)
{
if(api)
this.drawingObjects.drawingDocument.InitGuiCanvasTextArt(api.textArtElementId);
this.drawingObjects.drawingDocument.LastDrawingUrlTextArt = null;
this.drawingObjects.drawingDocument.DrawImageTextureFillTextArt(oTextArtProperties.Fill.fill.RasterImageId);
}
else
{
this.drawingObjects.drawingDocument.DrawImageTextureFillTextArt(null);
}
}
if(props.shapeProps.paddings)
{
shape_props.ShapeProperties.paddings = new asc_CPaddings(props.shapeProps.paddings);
......
......@@ -133,6 +133,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.ImageLoader = window.g_image_loader;
this.ImageLoader.put_Api(this);
this.shapeElementId = null;
this.textArtElementId = null;
this.isImageChangeUrl = false;
this.isShapeImageChangeUrl = false;
......@@ -2782,6 +2783,10 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.shapeElementId = elementId;
};
spreadsheet_api.prototype.asc_setInterfaceDrawImagePlaceTextArt = function(elementId) {
this.textArtElementId = elementId;
};
spreadsheet_api.prototype.asc_changeImageFromFile = function() {
this.isImageChangeUrl = true;
this.asc_showImageFileDialog();
......@@ -3872,6 +3877,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
prot["asc_getOriginalImageSize"] = prot.asc_getOriginalImageSize;
prot["asc_changeShapeType"] = prot.asc_changeShapeType;
prot["asc_setInterfaceDrawImagePlaceShape"] = prot.asc_setInterfaceDrawImagePlaceShape;
prot["asc_setInterfaceDrawImagePlaceTextArt"] = prot.asc_setInterfaceDrawImagePlaceTextArt;
prot["asc_changeImageFromFile"] = prot.asc_changeImageFromFile;
prot["asc_putPrLineSpacing"] = prot.asc_putPrLineSpacing;
prot["asc_addTextArt"] = prot.asc_addTextArt;
......
......@@ -1797,6 +1797,13 @@ function CDrawingDocument(drawingObjects)
this.GuiCanvasFillTextureCtx = null;
this.LastDrawingUrl = "";
this.GuiCanvasFillTextureParentIdTextArt = "";
this.GuiCanvasFillTextureTextArt = null;
this.GuiCanvasFillTextureCtxTextArt = null;
this.LastDrawingUrlTextArt = "";
this.GuiCanvasTextProps = null;
this.GuiCanvasTextPropsId = "gui_textprops_canvas_id";
this.GuiLastTextProps = null;
......@@ -4368,6 +4375,79 @@ function CDrawingDocument(drawingObjects)
}
}
this.DrawImageTextureFillTextArt = function(url)
{
if (this.GuiCanvasFillTextureTextArt == null)
{
this.InitGuiCanvasTextArt(this.GuiCanvasFillTextureParentIdTextArt);
}
if (this.GuiCanvasFillTextureTextArt == null || this.GuiCanvasFillTextureCtxTextArt == null || url == this.LastDrawingUrlTextArt)
return;
this.LastDrawingUrlTextArt = url;
var _width = this.GuiCanvasFillTextureTextArt.width;
var _height = this.GuiCanvasFillTextureTextArt.height;
this.GuiCanvasFillTextureCtxTextArt.clearRect(0, 0, _width, _height);
if (null == this.LastDrawingUrlTextArt)
return;
var _img = this.m_oWordControl.m_oApi.ImageLoader.map_image_index[getFullImageSrc2(this.LastDrawingUrlTextArt)];
if (_img != undefined && _img.Image != null && _img.Status != ImageLoadStatus.Loading)
{
var _x = 0;
var _y = 0;
var _w = Math.max(_img.Image.width, 1);
var _h = Math.max(_img.Image.height, 1);
var dAspect1 = _width / _height;
var dAspect2 = _w / _h;
_w = _width;
_h = _height;
if (dAspect1 >= dAspect2)
{
_w = dAspect2 * _height;
_x = (_width - _w) / 2;
}
else
{
_h = _w / dAspect2;
_y = (_height - _h) / 2;
}
this.GuiCanvasFillTextureCtxTextArt.drawImage(_img.Image, _x, _y, _w, _h);
}
else
{
this.GuiCanvasFillTextureCtxTextArt.lineWidth = 1;
this.GuiCanvasFillTextureCtxTextArt.beginPath();
this.GuiCanvasFillTextureCtxTextArt.moveTo(0, 0);
this.GuiCanvasFillTextureCtxTextArt.lineTo(_width, _height);
this.GuiCanvasFillTextureCtxTextArt.moveTo(_width, 0);
this.GuiCanvasFillTextureCtxTextArt.lineTo(0, _height);
this.GuiCanvasFillTextureCtxTextArt.strokeStyle = "#FF0000";
this.GuiCanvasFillTextureCtxTextArt.stroke();
this.GuiCanvasFillTextureCtxTextArt.beginPath();
this.GuiCanvasFillTextureCtxTextArt.moveTo(0, 0);
this.GuiCanvasFillTextureCtxTextArt.lineTo(_width, 0);
this.GuiCanvasFillTextureCtxTextArt.lineTo(_width, _height);
this.GuiCanvasFillTextureCtxTextArt.lineTo(0, _height);
this.GuiCanvasFillTextureCtxTextArt.closePath();
this.GuiCanvasFillTextureCtxTextArt.strokeStyle = "#000000";
this.GuiCanvasFillTextureCtxTextArt.stroke();
this.GuiCanvasFillTextureCtxTextArt.beginPath();
}
}
this.InitGuiCanvasShape = function(div_id)
{
if (this.GuiCanvasFillTextureParentId == div_id && null != this.GuiCanvasFillTexture)
......@@ -4457,6 +4537,33 @@ function CDrawingDocument(drawingObjects)
}
}
this.InitGuiCanvasTextArt = function(div_id)
{
if (null != this.GuiCanvasFillTextureTextArt)
{
var _div_elem = document.getElementById(this.GuiCanvasFillTextureParentIdTextArt);
if (!_div_elem)
_div_elem.removeChild(this.GuiCanvasFillTextureTextArt);
this.GuiCanvasFillTextureTextArt = null;
this.GuiCanvasFillTextureCtxTextArt = null;
}
this.GuiCanvasFillTextureParentIdTextArt = div_id;
var _div_elem = document.getElementById(this.GuiCanvasFillTextureParentIdTextArt);
if (!_div_elem)
return;
this.GuiCanvasFillTextureTextArt = document.createElement('canvas');
this.GuiCanvasFillTextureTextArt.width = parseInt(_div_elem.style.width);
this.GuiCanvasFillTextureTextArt.height = parseInt(_div_elem.style.height);
this.LastDrawingUrlTextArt = "";
this.GuiCanvasFillTextureCtxTextArt = this.GuiCanvasFillTextureTextArt.getContext('2d');
_div_elem.appendChild(this.GuiCanvasFillTextureTextArt);
}
this.DrawGuiCanvasTextProps = function(props)
{
var bIsChange = false;
......
......@@ -1040,6 +1040,11 @@ function CDrawingDocument()
this.GuiCanvasFillTextureCtxSlide = null;
this.LastDrawingUrlSlide = "";
this.GuiCanvasFillTextureParentIdTextArt = "";
this.GuiCanvasFillTextureTextArt = null;
this.GuiCanvasFillTextureCtxTextArt = null;
this.LastDrawingUrlTextArt = "";
this.AutoShapesTrack = null;
this.TransitionSlide = new CTransitionAnimation(null);
......@@ -2980,6 +2985,78 @@ function CDrawingDocument()
}
}
this.DrawImageTextureFillTextArt = function(url)
{
if (this.GuiCanvasFillTextureTextArt == null)
{
this.InitGuiCanvasTextArt(this.GuiCanvasFillTextureParentIdTextArt);
}
if (this.GuiCanvasFillTextureTextArt == null || this.GuiCanvasFillTextureCtxTextArt == null || url == this.LastDrawingUrlTextArt)
return;
this.LastDrawingUrlTextArt = url;
var _width = this.GuiCanvasFillTextureTextArt.width;
var _height = this.GuiCanvasFillTextureTextArt.height;
this.GuiCanvasFillTextureCtxTextArt.clearRect(0, 0, _width, _height);
if (null == this.LastDrawingUrlTextArt)
return;
var _img = this.m_oWordControl.m_oApi.ImageLoader.map_image_index[getFullImageSrc2(this.LastDrawingUrlTextArt)];
if (_img != undefined && _img.Image != null && _img.Status != ImageLoadStatus.Loading)
{
var _x = 0;
var _y = 0;
var _w = Math.max(_img.Image.width, 1);
var _h = Math.max(_img.Image.height, 1);
var dAspect1 = _width / _height;
var dAspect2 = _w / _h;
_w = _width;
_h = _height;
if (dAspect1 >= dAspect2)
{
_w = dAspect2 * _height;
_x = (_width - _w) / 2;
}
else
{
_h = _w / dAspect2;
_y = (_height - _h) / 2;
}
this.GuiCanvasFillTextureCtxTextArt.drawImage(_img.Image, _x, _y, _w, _h);
}
else
{
this.GuiCanvasFillTextureCtxTextArt.lineWidth = 1;
this.GuiCanvasFillTextureCtxTextArt.beginPath();
this.GuiCanvasFillTextureCtxTextArt.moveTo(0, 0);
this.GuiCanvasFillTextureCtxTextArt.lineTo(_width, _height);
this.GuiCanvasFillTextureCtxTextArt.moveTo(_width, 0);
this.GuiCanvasFillTextureCtxTextArt.lineTo(0, _height);
this.GuiCanvasFillTextureCtxTextArt.strokeStyle = "#FF0000";
this.GuiCanvasFillTextureCtxTextArt.stroke();
this.GuiCanvasFillTextureCtxTextArt.beginPath();
this.GuiCanvasFillTextureCtxTextArt.moveTo(0, 0);
this.GuiCanvasFillTextureCtxTextArt.lineTo(_width, 0);
this.GuiCanvasFillTextureCtxTextArt.lineTo(_width, _height);
this.GuiCanvasFillTextureCtxTextArt.lineTo(0, _height);
this.GuiCanvasFillTextureCtxTextArt.closePath();
this.GuiCanvasFillTextureCtxTextArt.strokeStyle = "#000000";
this.GuiCanvasFillTextureCtxTextArt.stroke();
this.GuiCanvasFillTextureCtxTextArt.beginPath();
}
}
this.InitGuiCanvasShape = function(div_id)
{
if (null != this.GuiCanvasFillTexture)
......@@ -3034,6 +3111,33 @@ function CDrawingDocument()
_div_elem.appendChild(this.GuiCanvasFillTextureSlide);
}
this.InitGuiCanvasTextArt = function(div_id)
{
if (null != this.GuiCanvasFillTextureTextArt)
{
var _div_elem = document.getElementById(this.GuiCanvasFillTextureParentIdTextArt);
if (!_div_elem)
_div_elem.removeChild(this.GuiCanvasFillTextureTextArt);
this.GuiCanvasFillTextureTextArt = null;
this.GuiCanvasFillTextureCtxTextArt = null;
}
this.GuiCanvasFillTextureParentIdTextArt = div_id;
var _div_elem = document.getElementById(this.GuiCanvasFillTextureParentIdTextArt);
if (!_div_elem)
return;
this.GuiCanvasFillTextureTextArt = document.createElement('canvas');
this.GuiCanvasFillTextureTextArt.width = parseInt(_div_elem.style.width);
this.GuiCanvasFillTextureTextArt.height = parseInt(_div_elem.style.height);
this.LastDrawingUrlTextArt = "";
this.GuiCanvasFillTextureCtxTextArt = this.GuiCanvasFillTextureTextArt.getContext('2d');
_div_elem.appendChild(this.GuiCanvasFillTextureTextArt);
}
this.CheckTableStyles = function()
{
// сначала проверим, подписан ли кто на этот евент
......
This diff is collapsed.
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