Commit 3820f109 authored by Dmitry.Vikulov's avatar Dmitry.Vikulov Committed by Alexander.Trofimov

- Add asc_CTexture

- Add asc_onInitStandartTextures event
- Add asc_canGroupGraphicsObjects/asc_canUnGroupGraphicsObjects methods
- Add textured fill

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48180 954022d7-b5bf-4e40-9824-e11837661b57
parent ca11ad91
......@@ -2241,6 +2241,29 @@ prot["asc_getImageHeight"] = prot.asc_getImageHeight;
prot["asc_getIsCorrect"] = prot.asc_getIsCorrect;
//}
//-----------------------------------------------------------------------------------
// CTexture
//-----------------------------------------------------------------------------------
function asc_CTexture() {
this.Id = 0;
this.Image = "";
}
asc_CTexture.prototype = {
asc_getId: function() { return this.Id; },
asc_getImage: function() { return this.Image; }
}
//{ asc_CTexture export
window["Asc"].asc_CTexture = asc_CTexture;
window["Asc"]["asc_CTexture"] = asc_CTexture;
prot = asc_CTexture.prototype;
prot["asc_getId"] = prot.asc_getId;
prot["asc_getImage"] = prot.asc_getImage;
//}
//-----------------------------------------------------------------------------------
// Undo/Redo
//-----------------------------------------------------------------------------------
......
......@@ -980,6 +980,19 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this._gui_color_schemes = null;
} else if ("asc_onInitEditorShapes" === name) {
this.handlers.trigger("asc_onInitEditorShapes", g_oAutoShapesGroups, g_oAutoShapesTypes);
} else if ("asc_onInitStandartTextures" === name) {
var _count = g_oUserTexturePresets.length;
var arr = new Array(_count);
for (var i = 0; i < _count; ++i) {
arr[i] = new asc_CTexture();
arr[i].Id = i;
arr[i].Image = g_oUserTexturePresets[i];
}
this.ImageLoader.bIsAsyncLoadDocumentImages = false;
this.ImageLoader.LoadDocumentImages(g_oUserTexturePresets, false);
this.ImageLoader.bIsAsyncLoadDocumentImages = true;
this.handlers.trigger("asc_onInitStandartTextures", arr);
}
},
......@@ -2091,11 +2104,21 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.isStartAddShape = false;
},
asc_canGroupGraphicsObjects: function() {
var ws = this.wb.getWorksheet();
return ws.objectRender.controller.canGroup();
},
asc_groupGraphicsObjects: function() {
var ws = this.wb.getWorksheet();
ws.objectRender.groupGraphicObjects();
},
asc_canUnGroupGraphicsObjects: function() {
var ws = this.wb.getWorksheet();
return ws.objectRender.controller.canUnGroup();
},
asc_unGroupGraphicsObjects: function() {
var ws = this.wb.getWorksheet();
ws.objectRender.unGroupGraphicObjects();
......@@ -2124,18 +2147,22 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
},
asyncImageEndLoaded: function(_image) {
if ( this.wb ) {
var ws = this.wb.getWorksheet();
if ( ws.objectRender.asyncImageEndLoaded )
ws.objectRender.asyncImageEndLoaded(_image);
}
},
asyncImagesDocumentStartLoaded: function() {
},
asyncImagesDocumentEndLoaded: function() {
if ( this.wb ) {
var ws = this.wb.getWorksheet();
if ( ws.objectRender.asyncImagesDocumentEndLoaded )
ws.objectRender.asyncImagesDocumentEndLoaded();
}
},
// Cell interface
......@@ -2909,7 +2936,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
// Shapes
prot["asc_startAddShape"] = prot.asc_startAddShape;
prot["asc_endAddShape"] = prot.asc_endAddShape;
prot["asc_canGroupGraphicsObjects"] = prot.asc_canGroupGraphicsObjects;
prot["asc_groupGraphicsObjects"] = prot.asc_groupGraphicsObjects;
prot["asc_canUnGroupGraphicsObjects"] = prot.asc_canUnGroupGraphicsObjects;
prot["asc_unGroupGraphicsObjects"] = prot.asc_unGroupGraphicsObjects;
prot["asc_getGraphicObjectProps"] = prot.asc_getGraphicObjectProps;
prot["asc_setGraphicObjectProps"] = prot.asc_setGraphicObjectProps;
......
......@@ -376,8 +376,8 @@ DrawingObjectsController.prototype =
shape_props.ShapeProperties = new asc_CShapeProperty();
shape_props.ShapeProperties.type = c_obj.getPresetGeom();
shape_props.ShapeProperties.fill = CreateAscFill2(c_obj.getFill());
shape_props.ShapeProperties.stroke = CreateAscStroke2(c_obj.getStroke());
shape_props.ShapeProperties.fill = CreateAscFillEx(c_obj.getFill());
shape_props.ShapeProperties.stroke = CreateAscStrokeEx(c_obj.getStroke());
shape_props.ShapeProperties.canChangeArrows = c_obj.canChangeArrows();
//shape_props.verticalTextAlign = c_obj.bodyPr.anchor;
......@@ -650,6 +650,7 @@ DrawingObjectsController.prototype =
}
}
this.drawingObjects.showDrawingObjects(true);
this.drawingObjects.selectGraphicObject();
}
};
......@@ -723,7 +724,7 @@ prot["asc_getHex"] = prot.asc_getHex;
prot["asc_getColor"] = prot.asc_getColor;
//}
function CreateAscColorCustom2(r, g, b) {
function CreateAscColorCustomEx(r, g, b) {
var ret = new asc_CColor();
ret.type = c_oAscColor.COLOR_TYPE_SRGB;
ret.r = r;
......@@ -733,7 +734,7 @@ function CreateAscColorCustom2(r, g, b) {
return ret;
}
function CreateAscColor2(unicolor) {
function CreateAscColorEx(unicolor) {
if (null == unicolor || null == unicolor.color)
return new asc_CColor();
......@@ -769,7 +770,7 @@ function CreateAscColor2(unicolor) {
return ret;
}
function CorrectUniColor2(asc_color, unicolor) {
function CorrectUniColorEx(asc_color, unicolor) {
if (null == asc_color)
return unicolor;
......@@ -828,10 +829,10 @@ function CorrectUniColor2(asc_color, unicolor) {
{
ret.color = new CRGBColor();
}
ret.color.RGBA.R = asc_color.get_r();
ret.color.RGBA.G = asc_color.get_g();
ret.color.RGBA.B = asc_color.get_b();
ret.color.RGBA.A = asc_color.get_a();
ret.color.RGBA.R = asc_color.asc_getR();
ret.color.RGBA.G = asc_color.asc_getG();
ret.color.RGBA.B = asc_color.asc_getB();
ret.color.RGBA.A = asc_color.asc_getA();
}
}
return ret;
......@@ -915,7 +916,7 @@ prot["asc_getColor"] = prot.asc_getColor;
prot["asc_putColor"] = prot.asc_putColor;
//}
function CreateAscFill2(unifill) {
function CreateAscFillEx(unifill) {
if (null == unifill || null == unifill.fill)
return new asc_CShapeFill();
......@@ -928,14 +929,14 @@ function CreateAscFill2(unifill) {
{
ret.type = c_oAscFill.FILL_TYPE_SOLID;
ret.fill = new asc_CFillSolid();
ret.fill.color = CreateAscColor2(_fill.color);
ret.fill.color = CreateAscColorEx(_fill.color);
break;
}
case FILL_TYPE_PATT:
{
ret.type = c_oAscFill.FILL_TYPE_SOLID;
ret.fill = new asc_CFillSolid();
ret.fill.color = CreateAscColor2(_fill.fgClr);
ret.fill.color = CreateAscColorEx(_fill.fgClr);
break;
}
case FILL_TYPE_GRAD:
......@@ -944,7 +945,7 @@ function CreateAscFill2(unifill) {
ret.fill = new asc_CFillSolid();
if (_fill.colors.length > 0)
ret.fill.color = CreateAscColor2(_fill.colors[0].color);
ret.fill.color = CreateAscColorEx(_fill.colors[0].color);
break;
}
case FILL_TYPE_BLIP:
......@@ -964,7 +965,7 @@ function CreateAscFill2(unifill) {
return ret;
}
function CorrectUniFill2(asc_fill, unifill) {
function CorrectUniFillEx(asc_fill, unifill) {
if (null == asc_fill)
return unifill;
......@@ -991,8 +992,8 @@ function CorrectUniFill2(asc_fill, unifill) {
ret.fill = new CBlipFill();
}
var _url = _fill.get_url();
var _tx_id = _fill.get_texture_id();
var _url = _fill.asc_getUrl();
var _tx_id = _fill.asc_getTextureId();
if (null != _tx_id && (0 <= _tx_id) && (_tx_id < g_oUserTexturePresets.length))
{
_url = g_oUserTexturePresets[_tx_id];
......@@ -1004,7 +1005,7 @@ function CorrectUniFill2(asc_fill, unifill) {
if (ret.fill.RasterImageId == null)
ret.fill.RasterImageId = "";
var tile = _fill.get_type();
var tile = _fill.asc_getType();
if (tile == c_oAscFillBlipType.STRETCH)
ret.fill.tile = null;
else if (tile == c_oAscFillBlipType.TILE)
......@@ -1018,7 +1019,7 @@ function CorrectUniFill2(asc_fill, unifill) {
{
ret.fill = new CSolidFill();
}
ret.fill.color = CorrectUniColor2(_fill.asc_getColor(), ret.fill.color);
ret.fill.color = CorrectUniColorEx(_fill.asc_getColor(), ret.fill.color);
}
}
}
......@@ -1101,7 +1102,7 @@ prot["asc_putLineendsize"] = prot.asc_putLineendsize;
prot["asc_getCanChangeArrows"] = prot.asc_getCanChangeArrows;
//}
function CreateAscStroke2(ln, _canChangeArrows) {
function CreateAscStrokeEx(ln, _canChangeArrows) {
if (null == ln || null == ln.Fill || ln.Fill.fill == null)
return new asc_CStroke();
......@@ -1118,7 +1119,7 @@ function CreateAscStroke2(ln, _canChangeArrows) {
}
case FILL_TYPE_SOLID:
{
ret.color = CreateAscColor2(_fill.color);
ret.color = CreateAscColorEx(_fill.color);
ret.type = c_oAscStrokeType.STROKE_COLOR;
break;
}
......@@ -1127,7 +1128,7 @@ function CreateAscStroke2(ln, _canChangeArrows) {
var _c = _fill.colors;
if (_c != 0)
{
ret.color = CreateAscColor2(_fill.colors[0]);
ret.color = CreateAscColorEx(_fill.colors[0]);
ret.type = c_oAscStrokeType.STROKE_COLOR;
}
......@@ -1135,7 +1136,7 @@ function CreateAscStroke2(ln, _canChangeArrows) {
}
case FILL_TYPE_PATT:
{
ret.color = CreateAscColor2(_fill.fgClr);
ret.color = CreateAscColorEx(_fill.fgClr);
ret.type = c_oAscStrokeType.STROKE_COLOR;
break;
}
......@@ -1196,7 +1197,7 @@ function CreateAscStroke2(ln, _canChangeArrows) {
return ret;
}
function CorrectUniStroke2(asc_stroke, unistroke) {
function CorrectUniStrokeEx(asc_stroke, unistroke) {
if (null == asc_stroke)
return unistroke;
......@@ -1223,7 +1224,7 @@ function CorrectUniStroke2(asc_stroke, unistroke) {
ret.Fill = new CUniFill();
ret.Fill.type = FILL_TYPE_SOLID;
ret.Fill.fill = new CSolidFill();
ret.Fill.fill.color = CorrectUniColor2(_color, ret.Fill.fill.color);
ret.Fill.fill.color = CorrectUniColorEx(_color, ret.Fill.fill.color);
}
}
......
......@@ -1254,7 +1254,7 @@ CShape.prototype =
this.spPr.Fill = new CUniFill();
}
this.spPr.Fill = CorrectUniFill2(ascFill, this.spPr.Fill);
this.spPr.Fill = CorrectUniFillEx(ascFill, this.spPr.Fill);
if(this.spPr.Fill == null)
{
//historyObj.new_Fill = null;
......@@ -1283,7 +1283,7 @@ CShape.prototype =
//historyObj.old_Line = null;
}
//this.spPr.ln.merge(line);
this.spPr.ln = CorrectUniStroke2(line, this.spPr.ln);
this.spPr.ln = CorrectUniStrokeEx(line, this.spPr.ln);
//historyObj.new_Line = this.spPr.ln.createDuplicate();
//History.Add(this, historyObj);
......
......@@ -749,6 +749,7 @@ CShapeDrawer.prototype =
}
else
{
var editor = window["Asc"]["editor"];
var _img = editor.ImageLoader.map_image_index[getFullImageSrc(this.UniFill.fill.RasterImageId)];
var _img_native = this.UniFill.fill.canvas;
if ((!_img_native) && (_img == undefined || _img.Image == null || _img.Status == ImageLoadStatus.Loading))
......@@ -793,8 +794,8 @@ CShapeDrawer.prototype =
_ctx.save();
var koefX = editor.WordControl.m_nZoomValue / 100;
var koefY = editor.WordControl.m_nZoomValue / 100;
var koefX = editor.asc_getZoom();
var koefY = editor.asc_getZoom();
// TODO: !!!
_ctx.translate(this.min_x, this.min_y);
......
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