Commit 5965a15b authored by Alexander.Trofimov's avatar Alexander.Trofimov

add dash border cell styles

parent 4d7d067c
...@@ -776,6 +776,11 @@ ...@@ -776,6 +776,11 @@
return this; return this;
}; };
DrawingContext.prototype.setLineDash = function (segments) {
this.ctx.setLineDash(segments);
return this;
};
DrawingContext.prototype.fillRect = function (x, y, w, h) { DrawingContext.prototype.fillRect = function (x, y, w, h) {
var r = this._calcRect(x, y, w, h); var r = this._calcRect(x, y, w, h);
this.ctx.fillRect(r.x, r.y, r.w, r.h); this.ctx.fillRect(r.x, r.y, r.w, r.h);
......
...@@ -214,6 +214,14 @@ CPdfPrinter.prototype = ...@@ -214,6 +214,14 @@ CPdfPrinter.prototype =
this.DocumentRenderer.p_width(val * 1000 * vector_koef); this.DocumentRenderer.p_width(val * 1000 * vector_koef);
return this; return this;
}, },
setLineDash : function(params)
{
var tmp = [];
for (var i = 0; i < params.length; ++i) {
tmp.push(params[i] * vector_koef);
}
return this.DocumentRenderer.p_dash(tmp);
},
setLineCap : function(cap) setLineCap : function(cap)
{ {
return this; return this;
...@@ -458,7 +466,7 @@ CPdfPrinter.prototype = ...@@ -458,7 +466,7 @@ CPdfPrinter.prototype =
}, },
p_dash : function(params) p_dash : function(params)
{ {
// TODO: return this.DocumentRenderer.p_dash(params);
}, },
// brush methods // brush methods
b_color1 : function(r,g,b,a) b_color1 : function(r,g,b,a)
......
...@@ -856,19 +856,18 @@ Fill.prototype = ...@@ -856,19 +856,18 @@ Fill.prototype =
} }
} }
}; };
var g_oBorderPropProperties = { var g_oBorderPropProperties = {
s: 0, s: 0, c: 1
c: 1
}; };
function BorderProp()
{ function BorderProp() {
this.Properties = g_oBorderPropProperties; this.Properties = g_oBorderPropProperties;
this.s = c_oAscBorderStyles.None; this.s = c_oAscBorderStyles.None;
this.w = c_oAscBorderWidth.None; this.w = c_oAscBorderWidth.None;
this.c = g_oColorManager.getThemeColor(1); this.c = g_oColorManager.getThemeColor(1);
} }
BorderProp.prototype = {
setStyle : function (style) { BorderProp.prototype.setStyle = function (style) {
this.s = style; this.s = style;
switch (this.s) { switch (this.s) {
case c_oAscBorderStyles.Thin: case c_oAscBorderStyles.Thin:
...@@ -894,63 +893,94 @@ BorderProp.prototype = { ...@@ -894,63 +893,94 @@ BorderProp.prototype = {
this.w = c_oAscBorderWidth.None; this.w = c_oAscBorderWidth.None;
break; break;
} }
}, };
getRgbOrNull : function() BorderProp.prototype.getDashSegments = function () {
{ var res;
switch (this.s) {
case c_oAscBorderStyles.Hair:
res = [1, 1];
break;
case c_oAscBorderStyles.Dotted:
res = [2, 2];
break;
case c_oAscBorderStyles.DashDotDot:
case c_oAscBorderStyles.MediumDashDotDot:
res = [3, 3, 3, 3, 9, 3];
break;
case c_oAscBorderStyles.DashDot:
case c_oAscBorderStyles.MediumDashDot:
case c_oAscBorderStyles.SlantDashDot:
res = [3, 3, 9, 3];
break;
case c_oAscBorderStyles.Dashed:
res = [3, 1];
break;
case c_oAscBorderStyles.MediumDashed:
res = [9, 3];
break;
case c_oAscBorderStyles.Thin:
case c_oAscBorderStyles.Medium:
case c_oAscBorderStyles.Thick:
case c_oAscBorderStyles.Double:
default:
res = [];
break;
}
return res;
};
BorderProp.prototype.getRgbOrNull = function () {
var nRes = null; var nRes = null;
if(null != this.c) if (null != this.c) {
nRes = this.c.getRgb(); nRes = this.c.getRgb();
}
return nRes; return nRes;
}, };
isEmpty : function() BorderProp.prototype.isEmpty = function () {
{
return c_oAscBorderStyles.None === this.s; return c_oAscBorderStyles.None === this.s;
}, };
isEqual : function(val) BorderProp.prototype.isEqual = function (val) {
{
return this.s === val.s && g_oColorManager.isEqual(this.c, val.c); return this.s === val.s && g_oColorManager.isEqual(this.c, val.c);
}, };
clone : function() BorderProp.prototype.clone = function () {
{
var res = new BorderProp(); var res = new BorderProp();
res.merge(this); res.merge(this);
return res; return res;
}, };
merge : function(oBorderProp) BorderProp.prototype.merge = function (oBorderProp) {
{ if (null != oBorderProp.s && c_oAscBorderStyles.None !== oBorderProp.s) {
if(null != oBorderProp.s && c_oAscBorderStyles.None !== oBorderProp.s)
{
this.s = oBorderProp.s; this.s = oBorderProp.s;
this.w = oBorderProp.w; this.w = oBorderProp.w;
if(null != oBorderProp.c) if (null != oBorderProp.c) {
this.c = oBorderProp.c; this.c = oBorderProp.c;
}
} }
}, };
getType : function() BorderProp.prototype.getType = function () {
{
return UndoRedoDataTypes.StyleBorderProp; return UndoRedoDataTypes.StyleBorderProp;
}, };
getProperties : function() BorderProp.prototype.getProperties = function () {
{
return this.Properties; return this.Properties;
}, };
getProperty : function(nType) BorderProp.prototype.getProperty = function (nType) {
{ switch (nType) {
switch(nType) case this.Properties.s:
{ return this.s;
case this.Properties.s: return this.s;break; break;
case this.Properties.c: return this.c;break; case this.Properties.c:
return this.c;
break;
} }
}, };
setProperty : function(nType, value) BorderProp.prototype.setProperty = function (nType, value) {
{ switch (nType) {
switch(nType) case this.Properties.s:
{ this.setStyle(value);
case this.Properties.s: this.setStyle(value);break; break;
case this.Properties.c: this.c = value;break; case this.Properties.c:
this.c = value;
break;
} }
} };
};
var g_oBorderProperties = { var g_oBorderProperties = {
l: 0, l: 0,
t: 1, t: 1,
......
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