Commit 7812b3be authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander.Trofimov

git-svn-id:...

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48862 954022d7-b5bf-4e40-9824-e11837661b57
parent 305acfc1
......@@ -1805,6 +1805,9 @@ function BinaryPPTYLoader()
}
s.Seek2(_e);
uni_fill.fill.colors.sort(function(a,b){return a.pos- b.pos;});
break;
}
case 1:
......@@ -1835,19 +1838,50 @@ function BinaryPPTYLoader()
}
case FILL_TYPE_PATT:
{
s.Skip2(4);
uni_fill.fill = new CPattFill();
s.Skip2(1);
uni_fill.fill = new CPattFill();
uni_fill.fill.ftype = s.GetUChar();
while (true)
{
var _atPF = s.GetUChar();
if (_atPF == g_nodeAttributeEnd)
break;
if (g_nodeAttributeEnd == uni_fill.fill.ftype)
uni_fill.fill.ftype = 0;
else
s.Skip2(1);
switch (_atPF)
{
case 0:
{
uni_fill.fill.ftype = s.GetUChar();
break;
}
default:
break;
}
}
while (s.cur < _e)
{
var rec = s.GetUChar();
uni_fill.fill.fgClr = this.ReadUniColor();
uni_fill.fill.bgClr = this.ReadUniColor();
switch (rec)
{
case 0:
{
uni_fill.fill.fgClr = this.ReadUniColor();
break;
}
case 1:
{
uni_fill.fill.bgClr = this.ReadUniColor();
break;
}
default:
{
// пока никаких настроек градиента нет
s.SkipRecord();
}
}
}
break;
}
......
......@@ -1525,6 +1525,24 @@ function CBinaryFileWriter()
oThis.EndRecord();
}
if (fill.lin)
{
oThis.StartRecord(1);
oThis.WriteUChar(g_nodeAttributeStart);
oThis._WriteInt1(0, fill.lin.angle);
oThis._WriteBool1(1, fill.lin.scale);
oThis.WriteUChar(g_nodeAttributeEnd);
oThis.EndRecord();
}
if (fill.path)
{
oThis.StartRecord(2);
oThis.WriteUChar(g_nodeAttributeStart);
oThis._WriteUChar1(0, fill.path.path);
oThis.WriteUChar(g_nodeAttributeEnd);
oThis.EndRecord();
}
oThis.EndRecord();
oThis.EndRecord();
......
......@@ -847,6 +847,12 @@ CUniColor.prototype =
}
}
return _ret;
},
getCSSColor : function()
{
var _css = "rgba(" + this.RGBA.R + "," + this.RGBA.G + "," + this.RGBA.B + "," + (this.RGBA.A / 255) + ")";
return _css;
}
};
......@@ -1174,7 +1180,7 @@ CPattFill.prototype =
_ret.ftype = this.ftype;
}
_ret.fgClr = this.fgClr.compare(fill.fgClr);
_ret.fgClr = this.fgClr.compare(fill.fgClr);
_ret.bgClr = this.bgClr.compare(fill.bgClr);
return _ret;
}
};
......@@ -1237,6 +1243,10 @@ CUniFill.prototype =
this.fill.colors[i].color.Calculate(theme, slide, layout, masterSlide, RGBA);
}
}
if (this.fill.fgClr)
this.fill.fgClr.Calculate(theme, slide, layout, masterSlide, RGBA);
if (this.fill.bgClr)
this.fill.bgClr.Calculate(theme, slide, layout, masterSlide, RGBA);
}
},
......
......@@ -3043,10 +3043,86 @@ asc_docs_api.prototype.OpenDocumentEndCallback = function()
{
if(this.LoadedObject)
{
this.WordControl.m_oLogicDocument.Recalculate();
var presentation = this.WordControl.m_oLogicDocument;
/* for(var i = 0; i <presentation.slideLayouts.length; ++i)
{
presentation.slideLayouts[i].elementsManipulator = new AutoShapesContainer(presentation, 0);
for(var j = 0; j < presentation.slideLayouts[i].cSld.spTree.length; ++j)
{
presentation.slideLayouts[i].cSld.spTree[j].setParent(presentation.slideLayouts[i]);
presentation.slideLayouts[i].cSld.spTree[j].setContainer(presentation.slideLayouts[i].elementsManipulator);
presentation.slideLayouts[i].cSld.spTree[j].calculate();
}
}
for(i = 0; i <presentation.slideMasters.length; ++i)
{
presentation.slideMasters[i].elementsManipulator = new AutoShapesContainer(presentation, 0);
for(j = 0; j < presentation.slideMasters[i].cSld.spTree.length; ++j)
{
presentation.slideMasters[i].cSld.spTree[j].setParent(presentation.slideMasters[i]);
presentation.slideMasters[i].cSld.spTree[j].setContainer(presentation.slideMasters[i].elementsManipulator);
presentation.slideMasters[i].cSld.spTree[j].calculate();
}
} */
var _slides = presentation.Slides;
var _slide_index;
var _slide_count = _slides.length;
var _cur_slide;
for(_slide_index = 0; _slide_index < _slide_count; ++_slide_index)
{
_cur_slide = _slides[_slide_index];
if(!_cur_slide.Layout.calculated)
{
var _cur_layout = _cur_slide.Layout;
_cur_layout.elementsManipulator = new AutoShapesContainer(presentation, 0);
var _layout_shape_index;
var _layout_shapes = _cur_layout.cSld.spTree;
var _layout_shape_count = _layout_shapes.length;
var _layout_shape;
for(_layout_shape_index = 0; _layout_shape_index < _layout_shape_count; ++_layout_shape_index)
{
_layout_shape = _layout_shapes[_layout_shape_index];
if(!_layout_shape.isPlaceholder())
{
_layout_shape.setParent(_cur_layout);
_layout_shape.setContainer(_cur_layout.elementsManipulator);
_layout_shape.calculate();
}
}
_cur_layout.calculated = true;
}
if(!_cur_slide.Layout.Master.calculated)
{
var _cur_master = _cur_slide.Layout.Master;
_cur_master.elementsManipulator = new AutoShapesContainer(presentation, 0);
var _master_shape_index;
var _master_shapes = _cur_master.cSld.spTree;
var _master_shape_count = _master_shapes.length;
var _master_shape;
for(_master_shape_index = 0; _master_shape_index < _master_shape_count; ++_master_shape_index)
{
_master_shape = _master_shapes[_master_shape_index];
if(!_master_shape.isPlaceholder())
{
_master_shape.setParent(_cur_master);
_master_shape.setContainer(_cur_master.elementsManipulator);
_master_shape.calculate();
}
}
_cur_master.calculated = true;
}
_cur_slide.calculate();
presentation.DrawingDocument.OnRecalculatePage( _slide_index, _cur_slide );
}
presentation.DrawingDocument.OnEndRecalculate();
this.asc_fireCallback("asc_onPresentationSize", presentation.Width, presentation.Height);
this.WordControl.GoToPage(0);
bIsScroll = true;
}
......@@ -3070,8 +3146,8 @@ asc_docs_api.prototype.OpenDocumentEndCallback = function()
if (this.isViewMode)
this.SetViewMode(true);
// Запускаем таймер автосохранения
this.autoSaveInit();
// Запускаем таймер автосохранения
this.autoSaveInit();
};
asc_docs_api.prototype.asyncFontStartLoaded = function()
......
......@@ -572,7 +572,7 @@ global_hatch_offsets["narVert"] = 25;
global_hatch_offsets["openDmnd"] = 26;
global_hatch_offsets["pct10"] = 27;
global_hatch_offsets["pct20"] = 28;
global_hatch_offsets["pct25"] = 39;
global_hatch_offsets["pct25"] = 29;
global_hatch_offsets["pct30"] = 30;
global_hatch_offsets["pct40"] = 31;
global_hatch_offsets["pct5"] = 32;
......@@ -598,6 +598,62 @@ global_hatch_offsets["wdUpDiag"] = 51;
global_hatch_offsets["weave"] = 52;
global_hatch_offsets["zigZag"] = 53;
var global_hatch_names = [
"cross",
"dashDnDiag",
"dashHorz",
"dashUpDiag",
"dashVert",
"diagBrick",
"diagCross",
"divot",
"dkDnDiag",
"dkHorz",
"dkUpDiag",
"dkVert",
"dnDiag",
"dotDmnd",
"dotGrid",
"horz",
"horzBrick",
"lgCheck",
"lgConfetti",
"lgGrid",
"ltDnDiag",
"ltHorz",
"ltUpDiag",
"ltVert",
"narHorz",
"narVert",
"openDmnd",
"pct10",
"pct20",
"pct25",
"pct30",
"pct40",
"pct5",
"pct50",
"pct60",
"pct70",
"pct75",
"pct80",
"pct90",
"plaid",
"shingle",
"smCheck",
"smConfetti",
"smGrid",
"solidDmnd",
"sphere",
"trellis",
"upDiag",
"vert",
"wave",
"wdDnDiag",
"wdUpDiag",
"weave",
"zigZag"];
global_hatch_offsets_count = 54;
var global_hatch_brushes = {};
......
......@@ -475,6 +475,8 @@ CShapeDrawer.prototype =
this.max_x = -0xFFFF;
this.max_y = -0xFFFF;
var bIsCheckBounds = false;
if (this.UniFill == null || this.UniFill.fill == null)
this.bIsNoFillAttack = true;
else
......@@ -500,11 +502,13 @@ CShapeDrawer.prototype =
else
this.FillUniColor = _fill.colors[0].color.RGBA;
bIsCheckBounds = true;
break;
}
case FILL_TYPE_PATT:
{
this.FillUniColor = _fill.fgClr.RGBA;
bIsCheckBounds = true;
break;
}
case FILL_TYPE_NOFILL:
......@@ -584,7 +588,7 @@ CShapeDrawer.prototype =
this.OldLineJoin = this.Graphics.m_oContext.lineJoin;
}
if (this.bIsTexture)
if (this.bIsTexture || bIsCheckBounds)
{
// сначала нужно определить границы
this.bIsCheckBounds = true;
......@@ -784,11 +788,6 @@ CShapeDrawer.prototype =
var _ctx = (this.Graphics.IsTrack === true) ? this.Graphics.Graphics.m_oContext : this.Graphics.m_oContext;
/*
var _test_pattern = GetHatchBrush("horzBrick", 255, 255, 255, 240, 0, 0);
var patt = !_img_native ? _ctx.createPattern(_test_pattern.Canvas, "repeat") : _ctx.createPattern(_img_native, "repeat");
*/
var patt = !_img_native ? _ctx.createPattern(_img.Image, "repeat") : _ctx.createPattern(_img_native, "repeat");
_ctx.save();
......@@ -828,6 +827,114 @@ CShapeDrawer.prototype =
return;
}
if (this.UniFill != null && this.UniFill.fill != null)
{
var _fill = this.UniFill.fill;
if (_fill.type == FILL_TYPE_PATT)
{
var _is_ctx = false;
if (this.Graphics.IsNoSupportTextDraw === true || undefined === this.Graphics.m_oContext || (null == this.UniFill.transparent) || (this.UniFill.transparent == 255))
{
_is_ctx = false;
}
else
{
_is_ctx = true;
}
var _ctx = (this.Graphics.IsTrack === true) ? this.Graphics.Graphics.m_oContext : this.Graphics.m_oContext;
var _patt_name = global_hatch_names[_fill.ftype];
if (undefined == _patt_name)
_patt_name = "cross";
var _fc = _fill.fgClr.RGBA;
var _bc = _fill.bgClr.RGBA;
var _test_pattern = GetHatchBrush(_patt_name, _fc.R, _fc.G, _fc.B, _bc.R, _bc.G, _bc.B);
var patt = _ctx.createPattern(_test_pattern.Canvas, "repeat");
_ctx.save();
var koefX = editor.WordControl.m_nZoomValue / 100;
var koefY = editor.WordControl.m_nZoomValue / 100;
// TODO: !!!
_ctx.translate(this.min_x, this.min_y);
if (this.Graphics.MaxEpsLine === undefined)
{
_ctx.scale(koefX * this.Graphics.TextureFillTransformScaleX, koefY * this.Graphics.TextureFillTransformScaleY);
}
else
{
_ctx.scale(koefX * this.Graphics.Graphics.TextureFillTransformScaleX, koefY * this.Graphics.Graphics.TextureFillTransformScaleY);
}
if (_is_ctx === true)
{
var _old_global_alpha = _ctx.globalAlpha;
_ctx.globalAlpha = this.UniFill.transparent / 255;
_ctx.fillStyle = patt;
_ctx.fill();
_ctx.globalAlpha = _old_global_alpha;
}
else
{
_ctx.fillStyle = patt;
_ctx.fill();
}
_ctx.restore();
return;
}
else if (_fill.type == FILL_TYPE_GRAD)
{
var _is_ctx = false;
if (this.Graphics.IsNoSupportTextDraw === true || undefined === this.Graphics.m_oContext || (null == this.UniFill.transparent) || (this.UniFill.transparent == 255))
{
_is_ctx = false;
}
else
{
_is_ctx = true;
}
var _ctx = (this.Graphics.IsTrack === true) ? this.Graphics.Graphics.m_oContext : this.Graphics.m_oContext;
var gradObj = _ctx.createLinearGradient(this.min_x, this.min_y, (this.max_x - this.min_x), (this.max_y - this.min_y));
/*
var _max_ = Math.max((this.max_x - this.min_x), (this.max_y - this.min_y));
var _cx_ = (this.min_x + this.max_x) / 2;
var _cy_ = (this.min_y + this.max_y) / 2;
var _x_ = _cx_ - _max_ / 2;
var _y_ = _cy_ - _max_ / 2;
var gradObj = _ctx.createLinearGradient(_x_, _y_, _max_, _max_);
*/
/*
var _a_ = (this.max_x - this.min_x);
var _b_ = (this.max_y - this.min_y);
var _angle_ = Math.atan2(_b_, _a_);
var _x_ = 2 * _b_ * Math.sin(_angle_);
var _w_ = _x_ * Math.cos(_angle_);
var _h_ = 2 * _b_ - _x_ * Math.sin(_angle_);
var gradObj = _ctx.createLinearGradient(this.min_x, this.min_y, _w_, _h_);
*/
for (var i = 0; i < _fill.colors.length; i++)
{
gradObj.addColorStop(_fill.colors[i].pos / 100000, _fill.colors[i].color.getCSSColor());
}
_ctx.fillStyle = gradObj;
_ctx.fill();
return;
}
}
var rgba = this.FillUniColor;
if (mode == "darken")
{
......
......@@ -961,6 +961,12 @@ CUniColor.prototype =
}
}
return _ret;
},
getCSSColor : function()
{
var _css = "rgba(" + this.RGBA.R + "," + this.RGBA.G + "," + this.RGBA.B + "," + (this.RGBA.A / 255) + ")";
return _css;
}
};
......@@ -1260,11 +1266,96 @@ CGs.prototype =
}
};
function GradLin()
{
this.angle = 5400000;
this.scale = true;
}
GradLin.prototype =
{
Write_ToBinary2 : function(Writer)
{
Writer.WriteLong(this.angle);
Writer.WriteBool(this.scale)
},
Read_FromBinary2 : function(Reader)
{
this.angle = Reader.GetLong();
this.scale = (1 == Reader.GetBool()) ? true : false;
},
IsIdentical : function(lin)
{
if (this.angle != lin.angle)
return false;
if (this.scale != lin.scale)
return false;
return true;
},
createDuplicate : function()
{
var duplicate = new GradLin();
duplicate.angle = this.angle;
duplicate.scale = this.scale;
return duplicate;
},
compare : function(lin)
{
return null;
}
};
function GradPath()
{
this.path = 0;
this.rect = null;
}
GradPath.prototype =
{
Write_ToBinary2 : function(Writer)
{
Writer.WriteByte(this.path);
// TODO:
},
Read_FromBinary2 : function(Reader)
{
this.path = Reader.GetUChar();
// TODO:
},
IsIdentical : function(path)
{
if (this.path != path.path)
return false;
return true;
},
createDuplicate : function()
{
var duplicate = new GradPath();
duplicate.path = this.path;
return duplicate;
},
compare : function(path)
{
return null;
}
};
function CGradFill()
{
this.type = FILL_TYPE_GRAD;
// пока просто front color
this.colors = new Array();
this.lin = null;
this.path = null;
}
CGradFill.prototype =
......@@ -1322,6 +1413,12 @@ CGradFill.prototype =
duplicate.colors[i] = this.colors[i].createDuplicate();
}
if (this.lin)
duplicate.lin = this.lin.createDuplicate();
if (this.path)
duplicate.path = this.path.createDuplicate();
return duplicate;
},
......@@ -1400,7 +1497,7 @@ CPattFill.prototype =
_ret.ftype = this.ftype;
}
_ret.fgClr = this.fgClr.compare(fill.fgClr);
_ret.fgClr = this.fgClr.compare(fill.fgClr);
_ret.bgClr = this.bgClr.compare(fill.bgClr);
return _ret;
}
};
......
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