Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
5965a15b
Commit
5965a15b
authored
Jan 13, 2017
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add dash border cell styles
parent
4d7d067c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
365 additions
and
301 deletions
+365
-301
cell/graphics/DrawingContext.js
cell/graphics/DrawingContext.js
+5
-0
cell/graphics/pdfprinter.js
cell/graphics/pdfprinter.js
+9
-1
cell/model/WorkbookElems.js
cell/model/WorkbookElems.js
+83
-53
cell/view/WorksheetView.js
cell/view/WorksheetView.js
+268
-247
No files found.
cell/graphics/DrawingContext.js
View file @
5965a15b
...
...
@@ -776,6 +776,11 @@
return
this
;
};
DrawingContext
.
prototype
.
setLineDash
=
function
(
segments
)
{
this
.
ctx
.
setLineDash
(
segments
);
return
this
;
};
DrawingContext
.
prototype
.
fillRect
=
function
(
x
,
y
,
w
,
h
)
{
var
r
=
this
.
_calcRect
(
x
,
y
,
w
,
h
);
this
.
ctx
.
fillRect
(
r
.
x
,
r
.
y
,
r
.
w
,
r
.
h
);
...
...
cell/graphics/pdfprinter.js
View file @
5965a15b
...
...
@@ -214,6 +214,14 @@ CPdfPrinter.prototype =
this
.
DocumentRenderer
.
p_width
(
val
*
1000
*
vector_koef
);
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
)
{
return
this
;
...
...
@@ -458,7 +466,7 @@ CPdfPrinter.prototype =
},
p_dash
:
function
(
params
)
{
// TODO:
return
this
.
DocumentRenderer
.
p_dash
(
params
);
},
// brush methods
b_color1
:
function
(
r
,
g
,
b
,
a
)
...
...
cell/model/WorkbookElems.js
View file @
5965a15b
...
...
@@ -856,19 +856,18 @@ Fill.prototype =
}
}
};
var
g_oBorderPropProperties
=
{
s
:
0
,
c
:
1
var
g_oBorderPropProperties
=
{
s
:
0
,
c
:
1
};
function
BorderProp
()
{
function
BorderProp
()
{
this
.
Properties
=
g_oBorderPropProperties
;
this
.
s
=
c_oAscBorderStyles
.
None
;
this
.
w
=
c_oAscBorderWidth
.
None
;
this
.
c
=
g_oColorManager
.
getThemeColor
(
1
);
}
BorderProp
.
prototype
=
{
setStyle
:
function
(
style
)
{
}
BorderProp
.
prototype
.
setStyle
=
function
(
style
)
{
this
.
s
=
style
;
switch
(
this
.
s
)
{
case
c_oAscBorderStyles
.
Thin
:
...
...
@@ -894,63 +893,94 @@ BorderProp.prototype = {
this
.
w
=
c_oAscBorderWidth
.
None
;
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
;
if
(
null
!=
this
.
c
)
if
(
null
!=
this
.
c
)
{
nRes
=
this
.
c
.
getRgb
();
}
return
nRes
;
},
isEmpty
:
function
()
{
};
BorderProp
.
prototype
.
isEmpty
=
function
()
{
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
);
},
clone
:
function
()
{
};
BorderProp
.
prototype
.
clone
=
function
()
{
var
res
=
new
BorderProp
();
res
.
merge
(
this
);
return
res
;
},
merge
:
function
(
oBorderProp
)
{
if
(
null
!=
oBorderProp
.
s
&&
c_oAscBorderStyles
.
None
!==
oBorderProp
.
s
)
{
};
BorderProp
.
prototype
.
merge
=
function
(
oBorderProp
)
{
if
(
null
!=
oBorderProp
.
s
&&
c_oAscBorderStyles
.
None
!==
oBorderProp
.
s
)
{
this
.
s
=
oBorderProp
.
s
;
this
.
w
=
oBorderProp
.
w
;
if
(
null
!=
oBorderProp
.
c
)
if
(
null
!=
oBorderProp
.
c
)
{
this
.
c
=
oBorderProp
.
c
;
}
},
getType
:
function
()
{
}
};
BorderProp
.
prototype
.
getType
=
function
()
{
return
UndoRedoDataTypes
.
StyleBorderProp
;
},
getProperties
:
function
()
{
};
BorderProp
.
prototype
.
getProperties
=
function
()
{
return
this
.
Properties
;
},
getProperty
:
function
(
nType
)
{
switch
(
nType
)
{
case
this
.
Properties
.
s
:
return
this
.
s
;
break
;
case
this
.
Properties
.
c
:
return
this
.
c
;
break
;
}
},
setProperty
:
function
(
nType
,
value
)
{
switch
(
nType
)
{
case
this
.
Properties
.
s
:
this
.
setStyle
(
value
);
break
;
case
this
.
Properties
.
c
:
this
.
c
=
value
;
break
;
};
BorderProp
.
prototype
.
getProperty
=
function
(
nType
)
{
switch
(
nType
)
{
case
this
.
Properties
.
s
:
return
this
.
s
;
break
;
case
this
.
Properties
.
c
:
return
this
.
c
;
break
;
}
};
BorderProp
.
prototype
.
setProperty
=
function
(
nType
,
value
)
{
switch
(
nType
)
{
case
this
.
Properties
.
s
:
this
.
setStyle
(
value
);
break
;
case
this
.
Properties
.
c
:
this
.
c
=
value
;
break
;
}
};
};
var
g_oBorderProperties
=
{
l
:
0
,
t
:
1
,
...
...
cell/view/WorksheetView.js
View file @
5965a15b
...
...
@@ -2934,7 +2934,7 @@
};
/** Рисует рамки для ячеек */
WorksheetView
.
prototype
.
_drawCellsBorders
=
function
(
drawingCtx
,
range
,
offsetX
,
offsetY
,
mergedCells
)
{
WorksheetView
.
prototype
.
_drawCellsBorders
=
function
(
drawingCtx
,
range
,
offsetX
,
offsetY
,
mergedCells
)
{
//TODO: использовать стили линий при рисовании границ
var
t
=
this
;
var
ctx
=
(
drawingCtx
)
?
drawingCtx
:
this
.
drawingCtx
;
...
...
@@ -2943,95 +2943,104 @@
var
objectMergedCells
=
{};
// Двумерный map вида строка-колонка {1: {1: range, 4: range}}
var
i
,
mergeCellInfo
,
startCol
,
endRow
,
endCol
,
col
,
row
;
for
(
i
in
mergedCells
)
{
for
(
i
in
mergedCells
)
{
mergeCellInfo
=
mergedCells
[
i
];
startCol
=
Math
.
max
(
range
.
c1
,
mergeCellInfo
.
c1
);
endRow
=
Math
.
min
(
mergeCellInfo
.
r2
,
range
.
r2
,
this
.
nRowsCount
);
endCol
=
Math
.
min
(
mergeCellInfo
.
c2
,
range
.
c2
,
this
.
nColsCount
);
for
(
row
=
Math
.
max
(
range
.
r1
,
mergeCellInfo
.
r1
);
row
<=
endRow
;
++
row
)
{
if
(
!
objectMergedCells
.
hasOwnProperty
(
row
)
)
{
startCol
=
Math
.
max
(
range
.
c1
,
mergeCellInfo
.
c1
);
endRow
=
Math
.
min
(
mergeCellInfo
.
r2
,
range
.
r2
,
this
.
nRowsCount
);
endCol
=
Math
.
min
(
mergeCellInfo
.
c2
,
range
.
c2
,
this
.
nColsCount
);
for
(
row
=
Math
.
max
(
range
.
r1
,
mergeCellInfo
.
r1
);
row
<=
endRow
;
++
row
)
{
if
(
!
objectMergedCells
.
hasOwnProperty
(
row
)
)
{
objectMergedCells
[
row
]
=
{};
}
for
(
col
=
startCol
;
col
<=
endCol
;
++
col
)
for
(
col
=
startCol
;
col
<=
endCol
;
++
col
)
{
objectMergedCells
[
row
][
col
]
=
mergeCellInfo
;
}
}
}
var
bc
=
null
,
bw
=
-
1
,
isNotFirst
=
false
;
// cached border color
var
bc
=
null
,
bs
=
c_oAscBorderStyles
.
None
,
isNotFirst
=
false
;
// cached border color
function
drawBorder
(
type
,
border
,
x1
,
y1
,
x2
,
y2
)
{
var
isStroke
=
false
,
isNewColor
=
!
AscCommonExcel
.
g_oColorManager
.
isEqual
(
bc
,
border
.
c
),
isNewWidth
=
bw
!==
border
.
w
;
if
(
isNotFirst
&&
(
isNewColor
||
isNewWidth
)
)
{
function
drawBorder
(
type
,
border
,
x1
,
y1
,
x2
,
y2
)
{
var
isStroke
=
false
,
isNewColor
=
!
AscCommonExcel
.
g_oColorManager
.
isEqual
(
bc
,
border
.
c
),
isNewStyle
=
bs
!==
border
.
s
;
if
(
isNotFirst
&&
(
isNewColor
||
isNewStyle
))
{
ctx
.
stroke
();
isStroke
=
true
;
}
if
(
isNewColor
)
{
if
(
isNewColor
)
{
bc
=
border
.
c
;
ctx
.
setStrokeStyle
(
bc
);
ctx
.
setStrokeStyle
(
bc
);
}
if
(
isNewWidth
)
{
bw
=
border
.
w
;
ctx
.
setLineWidth
(
border
.
w
);
if
(
isNewStyle
)
{
bs
=
border
.
s
;
ctx
.
setLineWidth
(
border
.
w
);
ctx
.
setLineDash
(
border
.
getDashSegments
());
}
if
(
isStroke
||
false
===
isNotFirst
)
{
if
(
isStroke
||
false
===
isNotFirst
)
{
isNotFirst
=
true
;
ctx
.
beginPath
();
}
switch
(
type
)
{
switch
(
type
)
{
case
c_oAscBorderType
.
Hor
:
ctx
.
lineHor
(
x1
,
y1
,
x2
);
ctx
.
lineHor
(
x1
,
y1
,
x2
);
break
;
case
c_oAscBorderType
.
Ver
:
ctx
.
lineVer
(
x1
,
y1
,
y2
);
ctx
.
lineVer
(
x1
,
y1
,
y2
);
break
;
case
c_oAscBorderType
.
Diag
:
ctx
.
lineDiag
(
x1
,
y1
,
x2
,
y2
);
ctx
.
lineDiag
(
x1
,
y1
,
x2
,
y2
);
break
;
}
}
function
drawVerticalBorder
(
borderLeftObject
,
borderRightObject
,
x
,
y1
,
y2
)
{
var
border
,
borderLeft
=
borderLeftObject
?
borderLeftObject
.
borders
:
null
,
borderRight
=
borderRightObject
?
borderRightObject
.
borders
:
null
;
function
drawVerticalBorder
(
borderLeftObject
,
borderRightObject
,
x
,
y1
,
y2
)
{
var
border
,
borderLeft
=
borderLeftObject
?
borderLeftObject
.
borders
:
null
,
borderRight
=
borderRightObject
?
borderRightObject
.
borders
:
null
;
if
(
borderLeft
&&
borderLeft
.
r
.
w
)
{
if
(
borderLeft
&&
borderLeft
.
r
.
w
)
{
border
=
borderLeft
.
r
;
}
else
if
(
borderRight
&&
borderRight
.
l
.
w
)
{
}
else
if
(
borderRight
&&
borderRight
.
l
.
w
)
{
border
=
borderRight
.
l
;
}
if
(
!
border
||
border
.
w
<
1
)
{
if
(
!
border
||
border
.
w
<
1
)
{
return
;
}
// ToDo переделать рассчет
var
tbw
=
t
.
_calcMaxBorderWidth
(
borderLeftObject
&&
borderLeftObject
.
getTopBorder
(),
borderRightObject
&&
borderRightObject
.
getTopBorder
()
);
// top border width
var
bbw
=
t
.
_calcMaxBorderWidth
(
borderLeftObject
&&
borderLeftObject
.
getBottomBorder
(),
borderRightObject
&&
borderRightObject
.
getBottomBorder
()
);
// bottom border width
var
tbw
=
t
.
_calcMaxBorderWidth
(
borderLeftObject
&&
borderLeftObject
.
getTopBorder
(),
borderRightObject
&&
borderRightObject
.
getTopBorder
());
// top border width
var
bbw
=
t
.
_calcMaxBorderWidth
(
borderLeftObject
&&
borderLeftObject
.
getBottomBorder
(),
borderRightObject
&&
borderRightObject
.
getBottomBorder
());
// bottom border width
var
dy1
=
tbw
>
border
.
w
?
tbw
-
1
:
(
tbw
>
1
?
-
1
:
0
);
var
dy2
=
bbw
>
border
.
w
?
-
2
:
(
bbw
>
2
?
1
:
0
);
drawBorder
(
c_oAscBorderType
.
Ver
,
border
,
x
,
y1
+
(
-
1
+
dy1
)
*
t
.
height_1px
,
x
,
y2
+
(
1
+
dy2
)
*
t
.
height_1px
);
drawBorder
(
c_oAscBorderType
.
Ver
,
border
,
x
,
y1
+
(
-
1
+
dy1
)
*
t
.
height_1px
,
x
,
y2
+
(
1
+
dy2
)
*
t
.
height_1px
);
}
function
drawHorizontalBorder
(
borderTopObject
,
borderBottomObject
,
x1
,
y
,
x2
)
{
var
border
,
borderTop
=
borderTopObject
?
borderTopObject
.
borders
:
null
,
borderBottom
=
borderBottomObject
?
borderBottomObject
.
borders
:
null
;
function
drawHorizontalBorder
(
borderTopObject
,
borderBottomObject
,
x1
,
y
,
x2
)
{
var
border
,
borderTop
=
borderTopObject
?
borderTopObject
.
borders
:
null
,
borderBottom
=
borderBottomObject
?
borderBottomObject
.
borders
:
null
;
if
(
borderTop
&&
borderTop
.
b
.
w
)
{
if
(
borderTop
&&
borderTop
.
b
.
w
)
{
border
=
borderTop
.
b
;
}
else
if
(
borderBottom
&&
borderBottom
.
t
.
w
)
{
}
else
if
(
borderBottom
&&
borderBottom
.
t
.
w
)
{
border
=
borderBottom
.
t
;
}
if
(
border
&&
border
.
w
>
0
)
{
if
(
border
&&
border
.
w
>
0
)
{
// ToDo переделать рассчет
var
lbw
=
t
.
_calcMaxBorderWidth
(
borderTopObject
&&
borderTopObject
.
getLeftBorder
(),
borderBottomObject
&&
borderBottomObject
.
getLeftBorder
()
);
var
rbw
=
t
.
_calcMaxBorderWidth
(
borderTopObject
&&
borderTopObject
.
getRightBorder
(),
borderTopObject
&&
borderTopObject
.
getRightBorder
()
);
var
lbw
=
t
.
_calcMaxBorderWidth
(
borderTopObject
&&
borderTopObject
.
getLeftBorder
(),
borderBottomObject
&&
borderBottomObject
.
getLeftBorder
());
var
rbw
=
t
.
_calcMaxBorderWidth
(
borderTopObject
&&
borderTopObject
.
getRightBorder
(),
borderTopObject
&&
borderTopObject
.
getRightBorder
());
var
dx1
=
border
.
w
>
lbw
?
(
lbw
>
1
?
-
1
:
0
)
:
(
lbw
>
2
?
2
:
1
);
var
dx2
=
border
.
w
>
rbw
?
(
rbw
>
2
?
1
:
0
)
:
(
rbw
>
1
?
-
2
:
-
1
);
drawBorder
(
c_oAscBorderType
.
Hor
,
border
,
x1
+
(
-
1
+
dx1
)
*
t
.
width_1px
,
y
,
x2
+
(
1
+
dx2
)
*
t
.
width_1px
,
y
);
drawBorder
(
c_oAscBorderType
.
Hor
,
border
,
x1
+
(
-
1
+
dx1
)
*
t
.
width_1px
,
y
,
x2
+
(
1
+
dx2
)
*
t
.
width_1px
,
y
);
}
}
...
...
@@ -3042,18 +3051,20 @@
row
=
range
.
r1
-
1
;
var
prevCol
=
range
.
c1
-
1
;
// Определим первую колонку (т.к. могут быть скрытые колонки)
while
(
0
<=
prevCol
&&
c
[
prevCol
].
width
<
t
.
width_1px
)
while
(
0
<=
prevCol
&&
c
[
prevCol
].
width
<
t
.
width_1px
)
--
prevCol
;
// Сначала пройдемся по верхней строке (над отрисовываемым диапазоном)
while
(
0
<=
row
)
{
if
(
r
[
row
].
height
>=
t
.
height_1px
)
{
while
(
0
<=
row
)
{
if
(
r
[
row
].
height
>=
t
.
height_1px
)
{
objMCPrevRow
=
objectMergedCells
[
row
];
for
(
col
=
prevCol
;
col
<=
range
.
c2
&&
col
<
t
.
nColsCount
;
++
col
)
{
if
(
0
>
col
||
c
[
col
].
width
<
t
.
width_1px
)
{
for
(
col
=
prevCol
;
col
<=
range
.
c2
&&
col
<
t
.
nColsCount
;
++
col
)
{
if
(
0
>
col
||
c
[
col
].
width
<
t
.
width_1px
)
{
continue
;
}
arrPrevRow
[
col
]
=
new
CellBorderObject
(
t
.
_getVisibleCell
(
col
,
row
).
getBorder
(),
objMCPrevRow
?
objMCPrevRow
[
col
]
:
null
,
col
,
row
);
arrPrevRow
[
col
]
=
new
CellBorderObject
(
t
.
_getVisibleCell
(
col
,
row
).
getBorder
(),
objMCPrevRow
?
objMCPrevRow
[
col
]
:
null
,
col
,
row
);
}
break
;
}
...
...
@@ -3062,16 +3073,17 @@
var
mc
=
null
,
nextRow
,
isFirstRow
=
true
;
var
isPrevColExist
=
(
0
<=
prevCol
);
for
(
row
=
range
.
r1
;
row
<=
range
.
r2
&&
row
<
t
.
nRowsCount
;
row
=
nextRow
)
{
for
(
row
=
range
.
r1
;
row
<=
range
.
r2
&&
row
<
t
.
nRowsCount
;
row
=
nextRow
)
{
nextRow
=
row
+
1
;
if
(
r
[
row
].
height
<
t
.
height_1px
)
{
if
(
r
[
row
].
height
<
t
.
height_1px
)
{
continue
;
}
// Нужно отсеять пустые снизу
for
(
;
nextRow
<=
range
.
r2
&&
nextRow
<
t
.
nRowsCount
;
++
nextRow
)
if
(
r
[
nextRow
].
height
>=
t
.
height_1px
)
{
for
(;
nextRow
<=
range
.
r2
&&
nextRow
<
t
.
nRowsCount
;
++
nextRow
)
{
if
(
r
[
nextRow
].
height
>=
t
.
height_1px
)
{
break
;
}
}
var
isFirstRowTmp
=
isFirstRow
,
isLastRow
=
nextRow
>
range
.
r2
||
nextRow
>=
t
.
nRowsCount
;
isFirstRow
=
false
;
// Это уже не первая строка (определяем не по совпадению с range.r1, а по видимости)
...
...
@@ -3079,21 +3091,22 @@
objMCRow
=
isFirstRowTmp
?
objectMergedCells
[
row
]
:
objMCNextRow
;
objMCNextRow
=
objectMergedCells
[
nextRow
];
var
rowCache
=
t
.
_fetchRowCache
(
row
);
var
rowCache
=
t
.
_fetchRowCache
(
row
);
var
y1
=
r
[
row
].
top
-
offsetY
;
var
y2
=
y1
+
r
[
row
].
height
-
t
.
height_1px
;
var
nextCol
,
isFirstCol
=
true
;
for
(
col
=
range
.
c1
;
col
<=
range
.
c2
&&
col
<
t
.
nColsCount
;
col
=
nextCol
)
{
for
(
col
=
range
.
c1
;
col
<=
range
.
c2
&&
col
<
t
.
nColsCount
;
col
=
nextCol
)
{
nextCol
=
col
+
1
;
if
(
c
[
col
].
width
<
t
.
width_1px
)
{
if
(
c
[
col
].
width
<
t
.
width_1px
)
{
continue
;
}
// Нужно отсеять пустые справа
for
(
;
nextCol
<=
range
.
c2
&&
nextCol
<
t
.
nColsCount
;
++
nextCol
)
if
(
c
[
nextCol
].
width
>=
t
.
width_1px
)
{
for
(;
nextCol
<=
range
.
c2
&&
nextCol
<
t
.
nColsCount
;
++
nextCol
)
{
if
(
c
[
nextCol
].
width
>=
t
.
width_1px
)
{
break
;
}
}
var
isFirstColTmp
=
isFirstCol
,
isLastCol
=
nextCol
>
range
.
c2
||
nextCol
>=
t
.
nColsCount
;
isFirstCol
=
false
;
// Это уже не первая колонка (определяем не по совпадению с range.c1, а по видимости)
...
...
@@ -3103,58 +3116,64 @@
var
x1
=
c
[
col
].
left
-
offsetX
;
var
x2
=
x1
+
c
[
col
].
width
-
this
.
width_1px
;
if
(
row
===
t
.
nRowsCount
)
{
if
(
row
===
t
.
nRowsCount
)
{
bBotPrev
=
bBotCur
=
bBotNext
=
null
;
}
else
{
if
(
isFirstColTmp
)
{
bBotPrev
=
arrNextRow
[
prevCol
]
=
new
CellBorderObject
(
isPrevColExist
?
t
.
_getVisibleCell
(
prevCol
,
nextRow
).
getBorder
()
:
null
,
objMCNextRow
?
objMCNextRow
[
prevCol
]
:
null
,
prevCol
,
nextRow
);
bBotCur
=
arrNextRow
[
col
]
=
new
CellBorderObject
(
t
.
_getVisibleCell
(
col
,
nextRow
).
getBorder
(),
objMCNextRow
?
objMCNextRow
[
col
]
:
null
,
col
,
nextRow
);
}
else
{
}
else
{
if
(
isFirstColTmp
)
{
bBotPrev
=
arrNextRow
[
prevCol
]
=
new
CellBorderObject
(
isPrevColExist
?
t
.
_getVisibleCell
(
prevCol
,
nextRow
).
getBorder
()
:
null
,
objMCNextRow
?
objMCNextRow
[
prevCol
]
:
null
,
prevCol
,
nextRow
);
bBotCur
=
arrNextRow
[
col
]
=
new
CellBorderObject
(
t
.
_getVisibleCell
(
col
,
nextRow
).
getBorder
(),
objMCNextRow
?
objMCNextRow
[
col
]
:
null
,
col
,
nextRow
);
}
else
{
bBotPrev
=
bBotCur
;
bBotCur
=
bBotNext
;
}
}
if
(
isFirstColTmp
)
{
bPrev
=
arrCurrRow
[
prevCol
]
=
new
CellBorderObject
(
isPrevColExist
?
t
.
_getVisibleCell
(
prevCol
,
row
).
getBorder
()
:
null
,
objMCRow
?
objMCRow
[
prevCol
]
:
null
,
prevCol
,
row
);
bCur
=
arrCurrRow
[
col
]
=
new
CellBorderObject
(
t
.
_getVisibleCell
(
col
,
row
).
getBorder
(),
mc
,
col
,
row
);
if
(
isFirstColTmp
)
{
bPrev
=
arrCurrRow
[
prevCol
]
=
new
CellBorderObject
(
isPrevColExist
?
t
.
_getVisibleCell
(
prevCol
,
row
).
getBorder
()
:
null
,
objMCRow
?
objMCRow
[
prevCol
]
:
null
,
prevCol
,
row
);
bCur
=
arrCurrRow
[
col
]
=
new
CellBorderObject
(
t
.
_getVisibleCell
(
col
,
row
).
getBorder
(),
mc
,
col
,
row
);
bTopPrev
=
arrPrevRow
[
prevCol
];
bTopCur
=
arrPrevRow
[
col
];
}
else
{
}
else
{
bPrev
=
bCur
;
bCur
=
bNext
;
bTopPrev
=
bTopCur
;
bTopCur
=
bTopNext
;
}
if
(
col
===
t
.
nColsCount
)
{
if
(
col
===
t
.
nColsCount
)
{
bNext
=
null
;
bTopNext
=
null
;
}
else
{
bNext
=
arrCurrRow
[
nextCol
]
=
new
CellBorderObject
(
t
.
_getVisibleCell
(
nextCol
,
row
).
getBorder
(),
objMCRow
?
objMCRow
[
nextCol
]
:
null
,
nextCol
,
row
);
}
else
{
bNext
=
arrCurrRow
[
nextCol
]
=
new
CellBorderObject
(
t
.
_getVisibleCell
(
nextCol
,
row
).
getBorder
(),
objMCRow
?
objMCRow
[
nextCol
]
:
null
,
nextCol
,
row
);
bTopNext
=
arrPrevRow
[
nextCol
];
if
(
row
===
t
.
nRowsCount
)
{
if
(
row
===
t
.
nRowsCount
)
{
bBotNext
=
null
;
}
else
{
bBotNext
=
arrNextRow
[
nextCol
]
=
new
CellBorderObject
(
t
.
_getVisibleCell
(
nextCol
,
nextRow
).
getBorder
(),
objMCNextRow
?
objMCNextRow
[
nextCol
]
:
null
,
nextCol
,
nextRow
);
}
else
{
bBotNext
=
arrNextRow
[
nextCol
]
=
new
CellBorderObject
(
t
.
_getVisibleCell
(
nextCol
,
nextRow
).
getBorder
(),
objMCNextRow
?
objMCNextRow
[
nextCol
]
:
null
,
nextCol
,
nextRow
);
}
}
if
(
mc
&&
row
!==
mc
.
r1
&&
row
!==
mc
.
r2
&&
col
!==
mc
.
c1
&&
col
!==
mc
.
c2
)
{
if
(
mc
&&
row
!==
mc
.
r1
&&
row
!==
mc
.
r2
&&
col
!==
mc
.
c1
&&
col
!==
mc
.
c2
)
{
continue
;
}
// draw diagonal borders
if
(
(
bCur
.
borders
.
dd
||
bCur
.
borders
.
du
)
&&
(
!
mc
||
(
row
===
mc
.
r1
&&
col
===
mc
.
c1
))
)
{
if
((
bCur
.
borders
.
dd
||
bCur
.
borders
.
du
)
&&
(
!
mc
||
(
row
===
mc
.
r1
&&
col
===
mc
.
c1
))
)
{
var
x2Diagonal
=
x2
;
var
y2Diagonal
=
y2
;
if
(
mc
)
{
if
(
mc
)
{
// Merge cells
x2Diagonal
=
c
[
mc
.
c2
].
left
+
c
[
mc
.
c2
].
width
-
offsetX
-
t
.
width_1px
;
y2Diagonal
=
r
[
mc
.
r2
].
top
+
r
[
mc
.
r2
].
height
-
offsetY
-
t
.
height_1px
;
...
...
@@ -3168,13 +3187,15 @@
r[row].height + this.height_1px * ( -1 + (tb.w < 1 ? +1 : (tb.w < 3 ? 0 : -1)) + (bb.w < 1 ? +1 : (bb.w < 2 ? 0 : -1)) ))
.clip();
*/
if
(
bCur
.
borders
.
dd
)
{
if
(
bCur
.
borders
.
dd
)
{
// draw diagonal line l,t - r,b
drawBorder
(
c_oAscBorderType
.
Diag
,
bCur
.
borders
.
d
,
x1
-
t
.
width_1px
,
y1
-
t
.
height_1px
,
x2Diagonal
,
y2Diagonal
);
drawBorder
(
c_oAscBorderType
.
Diag
,
bCur
.
borders
.
d
,
x1
-
t
.
width_1px
,
y1
-
t
.
height_1px
,
x2Diagonal
,
y2Diagonal
);
}
if
(
bCur
.
borders
.
du
)
{
if
(
bCur
.
borders
.
du
)
{
// draw diagonal line l,b - r,t
drawBorder
(
c_oAscBorderType
.
Diag
,
bCur
.
borders
.
d
,
x1
-
t
.
width_1px
,
y2Diagonal
,
x2Diagonal
,
y1
-
t
.
height_1px
);
drawBorder
(
c_oAscBorderType
.
Diag
,
bCur
.
borders
.
d
,
x1
-
t
.
width_1px
,
y2Diagonal
,
x2Diagonal
,
y1
-
t
.
height_1px
);
}
// ToDo Clip diagonal borders
//ctx.restore();
...
...
@@ -3183,8 +3204,8 @@
}
// draw left border
if
(
isFirstColTmp
&&
!
t
.
_isLeftBorderErased
(
col
,
rowCache
)
)
{
drawVerticalBorder
(
bPrev
,
bCur
,
x1
-
t
.
width_1px
,
y1
,
y2
);
if
(
isFirstColTmp
&&
!
t
.
_isLeftBorderErased
(
col
,
rowCache
)
)
{
drawVerticalBorder
(
bPrev
,
bCur
,
x1
-
t
.
width_1px
,
y1
,
y2
);
// Если мы в печати и печатаем первый столбец, то нужно напечатать бордеры
// if (lb.w >= 1 && drawingCtx && 0 === col) {
// Иначе они будут не такой ширины
...
...
@@ -3193,21 +3214,21 @@
// }
}
// draw right border
if
(
(
!
mc
||
col
===
mc
.
c2
)
&&
!
t
.
_isRightBorderErased
(
col
,
rowCache
)
)
{
drawVerticalBorder
(
bCur
,
bNext
,
x2
,
y1
,
y2
);
if
((
!
mc
||
col
===
mc
.
c2
)
&&
!
t
.
_isRightBorderErased
(
col
,
rowCache
)
)
{
drawVerticalBorder
(
bCur
,
bNext
,
x2
,
y1
,
y2
);
}
// draw top border
if
(
isFirstRowTmp
)
{
drawHorizontalBorder
(
bTopCur
,
bCur
,
x1
,
y1
-
t
.
height_1px
,
x2
);
if
(
isFirstRowTmp
)
{
drawHorizontalBorder
(
bTopCur
,
bCur
,
x1
,
y1
-
t
.
height_1px
,
x2
);
// Если мы в печати и печатаем первую строку, то нужно напечатать бордеры
// if (tb.w > 0 && drawingCtx && 0 === row) {
// ToDo посмотреть что с этим ? в печати будет обрезка
// drawHorizontalBorder.call(this, tb, lb, lbPrev, rb, rbPrev, x1, y1, x2);
// }
}
if
(
!
mc
||
row
===
mc
.
r2
)
{
if
(
!
mc
||
row
===
mc
.
r2
)
{
// draw bottom border
drawHorizontalBorder
(
bCur
,
bBotCur
,
x1
,
y2
,
x2
);
drawHorizontalBorder
(
bCur
,
bBotCur
,
x1
,
y2
,
x2
);
}
}
...
...
@@ -3216,7 +3237,7 @@
arrNextRow
=
[];
}
if
(
isNotFirst
)
{
if
(
isNotFirst
)
{
ctx
.
stroke
();
}
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment