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
d45ec47e
Commit
d45ec47e
authored
Jun 03, 2016
by
Oleg Korshul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
line dash
parent
54e66ab2
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
2981 additions
and
2806 deletions
+2981
-2806
cell/graphics/pdfprinter.js
cell/graphics/pdfprinter.js
+4
-0
cell/model/DrawingObjects/Graphics.js
cell/model/DrawingObjects/Graphics.js
+8
-0
cell/model/DrawingObjects/ShapeDrawer.js
cell/model/DrawingObjects/ShapeDrawer.js
+10
-0
common/Drawings/CommonController.js
common/Drawings/CommonController.js
+3
-0
common/Drawings/Metafile.js
common/Drawings/Metafile.js
+2885
-2805
common/Drawings/TextDrawer.js
common/Drawings/TextDrawer.js
+3
-0
common/Overlay.js
common/Overlay.js
+4
-0
common/Shapes/Serialize.js
common/Shapes/Serialize.js
+34
-1
common/Shapes/SerializeWriter.js
common/Shapes/SerializeWriter.js
+11
-0
word/Drawing/Graphics.js
word/Drawing/Graphics.js
+9
-0
word/Drawing/ShapeDrawer.js
word/Drawing/ShapeDrawer.js
+10
-0
No files found.
cell/graphics/pdfprinter.js
View file @
d45ec47e
...
...
@@ -424,6 +424,10 @@ CPdfPrinter.prototype =
{
return
this
.
DocumentRenderer
.
p_width
(
w
);
},
p_dash
:
function
(
params
)
{
// TODO:
},
// brush methods
b_color1
:
function
(
r
,
g
,
b
,
a
)
{
...
...
cell/model/DrawingObjects/Graphics.js
View file @
d45ec47e
...
...
@@ -183,6 +183,14 @@ CGraphics.prototype =
}
}
},
p_dash
:
function
(
params
)
{
if
(
!
this
.
m_oContext
.
setLineDash
)
return
;
this
.
m_oContext
.
setLineDash
(
params
?
params
:
[]);
},
// brush methods
b_color1
:
function
(
r
,
g
,
b
,
a
)
{
...
...
cell/model/DrawingObjects/ShapeDrawer.js
View file @
d45ec47e
...
...
@@ -658,6 +658,14 @@ CShapeDrawer.prototype =
this
.
p_width
(
1000
*
this
.
StrokeWidth
);
if
(
this
.
Ln
.
prstDash
!=
null
&&
AscCommon
.
DashPatternPresets
[
this
.
Ln
.
prstDash
])
{
var
_arr
=
AscCommon
.
DashPatternPresets
[
this
.
Ln
.
prstDash
].
slice
();;
for
(
var
indexD
=
0
;
indexD
<
_arr
.
length
;
indexD
++
)
_arr
[
indexD
]
*=
this
.
StrokeWidth
;
this
.
Graphics
.
p_dash
(
_arr
);
}
if
(
graphics
.
IsSlideBoundsCheckerType
&&
!
this
.
bIsNoStrokeAttack
)
graphics
.
LineWidth
=
this
.
StrokeWidth
;
...
...
@@ -738,6 +746,8 @@ CShapeDrawer.prototype =
{
this
.
Graphics
.
m_oContext
.
globalCompositeOperation
=
_old_composite
;
}
this
.
Graphics
.
p_dash
(
null
);
},
p_width
:
function
(
w
)
...
...
common/Drawings/CommonController.js
View file @
d45ec47e
...
...
@@ -8126,6 +8126,9 @@ CSlideBoundsChecker.prototype =
p_width
:
function
(
w
)
{
},
p_dash
:
function
(
params
)
{
},
// brush methods
b_color1
:
function
(
r
,
g
,
b
,
a
)
{
...
...
common/Drawings/Metafile.js
View file @
d45ec47e
"
use strict
"
;
(
function
(
window
,
undefined
){
(
function
(
window
,
undefined
)
{
// Import
var
g_fontApplication
=
AscFonts
.
g_fontApplication
;
// Import
var
g_fontApplication
=
AscFonts
.
g_fontApplication
;
function
CGrRFonts
()
{
this
.
Ascii
=
{
Name
:
"
Empty
"
,
Index
:
-
1
};
this
.
EastAsia
=
{
Name
:
"
Empty
"
,
Index
:
-
1
};
this
.
HAnsi
=
{
Name
:
"
Empty
"
,
Index
:
-
1
};
this
.
CS
=
{
Name
:
"
Empty
"
,
Index
:
-
1
};
}
CGrRFonts
.
prototype
=
{
function
CGrRFonts
()
{
this
.
Ascii
=
{
Name
:
"
Empty
"
,
Index
:
-
1
};
this
.
EastAsia
=
{
Name
:
"
Empty
"
,
Index
:
-
1
};
this
.
HAnsi
=
{
Name
:
"
Empty
"
,
Index
:
-
1
};
this
.
CS
=
{
Name
:
"
Empty
"
,
Index
:
-
1
};
}
CGrRFonts
.
prototype
=
{
checkFromTheme
:
function
(
fontScheme
,
rFonts
)
{
this
.
Ascii
.
Name
=
fontScheme
.
checkFont
(
rFonts
.
Ascii
.
Name
);
...
...
@@ -26,16 +28,16 @@ CGrRFonts.prototype =
this
.
HAnsi
.
Index
=
-
1
;
this
.
CS
.
Index
=
-
1
;
}
};
};
var
gr_state_pen
=
0
;
var
gr_state_brush
=
1
;
var
gr_state_pen_brush
=
2
;
var
gr_state_state
=
3
;
var
gr_state_all
=
4
;
var
gr_state_pen
=
0
;
var
gr_state_brush
=
1
;
var
gr_state_pen_brush
=
2
;
var
gr_state_state
=
3
;
var
gr_state_all
=
4
;
function
CFontSetup
()
{
function
CFontSetup
()
{
this
.
Name
=
""
;
this
.
Index
=
-
1
;
this
.
Size
=
12
;
...
...
@@ -48,9 +50,10 @@ function CFontSetup()
this
.
SetUpStyle
=
-
1
;
this
.
SetUpMatrix
=
new
CMatrix
();
}
CFontSetup
.
prototype
=
{
}
CFontSetup
.
prototype
=
{
Clear
:
function
()
{
this
.
Name
=
""
;
...
...
@@ -66,45 +69,48 @@ CFontSetup.prototype =
this
.
SetUpMatrix
=
new
CMatrix
();
}
};
};
function
CGrState_Pen
()
{
function
CGrState_Pen
()
{
this
.
Type
=
gr_state_pen
;
this
.
Pen
=
null
;
}
CGrState_Pen
.
prototype
=
{
}
CGrState_Pen
.
prototype
=
{
Init
:
function
(
_pen
)
{
if
(
_pen
!==
undefined
)
this
.
Pen
=
_pen
.
CreateDublicate
();
}
};
};
function
CGrState_Brush
()
{
function
CGrState_Brush
()
{
this
.
Type
=
gr_state_brush
;
this
.
Brush
=
null
;
}
CGrState_Brush
.
prototype
=
{
}
CGrState_Brush
.
prototype
=
{
Init
:
function
(
_brush
)
{
if
(
undefined
!==
_brush
)
this
.
Brush
=
_brush
.
CreateDublicate
();
}
};
};
function
CGrState_PenBrush
()
{
function
CGrState_PenBrush
()
{
this
.
Type
=
gr_state_pen_brush
;
this
.
Pen
=
null
;
this
.
Brush
=
null
;
}
CGrState_PenBrush
.
prototype
=
{
Init
:
function
(
_pen
,
_brush
)
}
CGrState_PenBrush
.
prototype
=
{
Init
:
function
(
_pen
,
_brush
)
{
if
(
undefined
!==
_pen
&&
undefined
!==
_brush
)
{
...
...
@@ -112,17 +118,18 @@ CGrState_PenBrush.prototype =
this
.
Brush
=
_brush
.
CreateDublicate
();
}
}
};
};
function
CHist_Clip
()
{
function
CHist_Clip
()
{
this
.
Path
=
null
;
// clipPath
this
.
Rect
=
null
;
// clipRect. clipRect - is a simple clipPath.
this
.
IsIntegerGrid
=
false
;
this
.
Transform
=
new
CMatrix
();
}
CHist_Clip
.
prototype
=
{
}
CHist_Clip
.
prototype
=
{
Init
:
function
(
path
,
rect
,
isIntegerGrid
,
transform
)
{
this
.
Path
=
path
;
...
...
@@ -157,18 +164,19 @@ CHist_Clip.prototype =
// TODO: пока не используется
}
}
};
};
function
CGrState_State
()
{
function
CGrState_State
()
{
this
.
Type
=
gr_state_state
;
this
.
Transform
=
null
;
this
.
IsIntegerGrid
=
false
;
this
.
Clips
=
null
;
}
CGrState_State
.
prototype
=
{
}
CGrState_State
.
prototype
=
{
Init
:
function
(
_transform
,
_isIntegerGrid
,
_clips
)
{
if
(
undefined
!==
_transform
)
...
...
@@ -189,18 +197,18 @@ CGrState_State.prototype =
this
.
Clips
[
i
].
ToRenderer
(
renderer
);
}
}
};
};
function
CGrState
()
{
function
CGrState
()
{
this
.
Parent
=
null
;
this
.
States
=
[];
this
.
Clips
=
[];
}
}
CGrState
.
prototype
=
{
CGrState
.
prototype
=
{
SavePen
:
function
()
{
if
(
null
==
this
.
Parent
)
...
...
@@ -393,18 +401,18 @@ CGrState.prototype =
//this.Parent._e();
}
};
};
var
g_stringBase64
=
"
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
"
;
var
g_arrayBase64
=
[];
for
(
var
index64
=
0
;
index64
<
g_stringBase64
.
length
;
index64
++
)
{
var
g_stringBase64
=
"
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
"
;
var
g_arrayBase64
=
[];
for
(
var
index64
=
0
;
index64
<
g_stringBase64
.
length
;
index64
++
)
{
g_arrayBase64
.
push
(
g_stringBase64
.
charAt
(
index64
));
}
}
function
Base64Encode
(
srcData
,
nSrcLen
,
nOffset
)
{
if
(
"
undefined
"
===
typeof
(
nOffset
)
)
function
Base64Encode
(
srcData
,
nSrcLen
,
nOffset
)
{
if
(
"
undefined
"
===
typeof
(
nOffset
)
)
nOffset
=
0
;
var
nWritten
=
0
;
...
...
@@ -415,24 +423,24 @@ function Base64Encode(srcData, nSrcLen, nOffset)
var
dstStr
=
[];
var
_s
=
""
;
for
(
var
i
=
0
;
i
<=
nLen2
;
i
++
)
for
(
var
i
=
0
;
i
<=
nLen2
;
i
++
)
{
if
(
i
==
nLen2
)
nLen3
=
((
nLen1
%
76
)
/
4
)
>>
0
;
nLen3
=
((
nLen1
%
76
)
/
4
)
>>
0
;
for
(
var
j
=
0
;
j
<
nLen3
;
j
++
)
for
(
var
j
=
0
;
j
<
nLen3
;
j
++
)
{
var
dwCurr
=
0
;
for
(
var
n
=
0
;
n
<
3
;
n
++
)
for
(
var
n
=
0
;
n
<
3
;
n
++
)
{
dwCurr
|=
srcData
[
srcInd
++
+
nOffset
];
dwCurr
<<=
8
;
}
_s
=
""
;
for
(
var
k
=
0
;
k
<
4
;
k
++
)
for
(
var
k
=
0
;
k
<
4
;
k
++
)
{
var
b
=
(
dwCurr
>>>
26
)
&
0xFF
;
var
b
=
(
dwCurr
>>>
26
)
&
0xFF
;
_s
+=
g_arrayBase64
[
b
];
dwCurr
<<=
6
;
dwCurr
&=
0xFFFFFFFF
;
...
...
@@ -440,27 +448,27 @@ function Base64Encode(srcData, nSrcLen, nOffset)
dstStr
.
push
(
_s
);
}
}
nLen2
=
(
nSrcLen
%
3
!=
0
)
?
(
nSrcLen
%
3
+
1
)
:
0
;
nLen2
=
(
nSrcLen
%
3
!=
0
)
?
(
nSrcLen
%
3
+
1
)
:
0
;
if
(
nLen2
)
{
var
dwCurr
=
0
;
for
(
var
n
=
0
;
n
<
3
;
n
++
)
for
(
var
n
=
0
;
n
<
3
;
n
++
)
{
if
(
n
<
(
nSrcLen
%
3
))
if
(
n
<
(
nSrcLen
%
3
))
dwCurr
|=
srcData
[
srcInd
++
+
nOffset
];
dwCurr
<<=
8
;
}
_s
=
""
;
for
(
var
k
=
0
;
k
<
nLen2
;
k
++
)
for
(
var
k
=
0
;
k
<
nLen2
;
k
++
)
{
var
b
=
(
dwCurr
>>>
26
)
&
0xFF
;
var
b
=
(
dwCurr
>>>
26
)
&
0xFF
;
_s
+=
g_arrayBase64
[
b
];
dwCurr
<<=
6
;
}
nLen3
=
(
nLen2
!=
0
)
?
4
-
nLen2
:
0
;
for
(
var
j
=
0
;
j
<
nLen3
;
j
++
)
nLen3
=
(
nLen2
!=
0
)
?
4
-
nLen2
:
0
;
for
(
var
j
=
0
;
j
<
nLen3
;
j
++
)
{
_s
+=
'
=
'
;
}
...
...
@@ -468,15 +476,15 @@ function Base64Encode(srcData, nSrcLen, nOffset)
}
return
dstStr
.
join
(
""
);
}
}
function
CMemory
(
bIsNoInit
)
{
function
CMemory
(
bIsNoInit
)
{
this
.
Init
=
function
()
{
var
_canvas
=
document
.
createElement
(
'
canvas
'
);
var
_ctx
=
_canvas
.
getContext
(
'
2d
'
);
this
.
len
=
1024
*
1024
*
5
;
this
.
len
=
1024
*
1024
*
5
;
this
.
ImData
=
_ctx
.
createImageData
(
this
.
len
/
4
,
1
);
this
.
data
=
this
.
ImData
.
data
;
this
.
pos
=
0
;
...
...
@@ -492,7 +500,7 @@ function CMemory(bIsNoInit)
this
.
Copy
=
function
(
oMemory
,
nPos
,
nLen
)
{
for
(
var
Index
=
0
;
Index
<
nLen
;
Index
++
)
for
(
var
Index
=
0
;
Index
<
nLen
;
Index
++
)
{
this
.
CheckSize
(
1
);
this
.
data
[
this
.
pos
++
]
=
oMemory
.
data
[
Index
+
nPos
];
...
...
@@ -516,13 +524,13 @@ function CMemory(bIsNoInit)
this
.
data
=
this
.
ImData
.
data
;
var
newData
=
this
.
data
;
for
(
var
i
=
0
;
i
<
this
.
pos
;
i
++
)
newData
[
i
]
=
oldData
[
i
];
for
(
var
i
=
0
;
i
<
this
.
pos
;
i
++
)
newData
[
i
]
=
oldData
[
i
];
}
}
this
.
GetBase64Memory
=
function
()
{
return
Base64Encode
(
this
.
data
,
this
.
pos
,
0
);
return
Base64Encode
(
this
.
data
,
this
.
pos
,
0
);
}
this
.
GetBase64Memory2
=
function
(
nPos
,
nLen
)
{
...
...
@@ -543,7 +551,7 @@ function CMemory(bIsNoInit)
this
.
WriteBool
=
function
(
val
)
{
this
.
CheckSize
(
1
);
if
(
false
==
val
)
if
(
false
==
val
)
this
.
data
[
this
.
pos
++
]
=
0
;
else
this
.
data
[
this
.
pos
++
]
=
1
;
...
...
@@ -563,19 +571,19 @@ function CMemory(bIsNoInit)
this
.
WriteLong
=
function
(
val
)
{
this
.
CheckSize
(
4
);
this
.
data
[
this
.
pos
++
]
=
(
val
)
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
(
val
>>>
8
)
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
(
val
>>>
16
)
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
(
val
>>>
24
)
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
(
val
)
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
(
val
>>>
8
)
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
(
val
>>>
16
)
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
(
val
>>>
24
)
&
0xFF
;
}
this
.
WriteDouble
=
function
(
val
)
{
this
.
CheckSize
(
4
);
var
lval
=
((
val
*
100000
)
>>
0
)
&
0xFFFFFFFF
;
// спасаем пять знаков после запятой.
this
.
data
[
this
.
pos
++
]
=
(
lval
)
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
(
lval
>>>
8
)
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
(
lval
>>>
16
)
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
(
lval
>>>
24
)
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
(
lval
)
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
(
lval
>>>
8
)
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
(
lval
>>>
16
)
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
(
lval
>>>
24
)
&
0xFF
;
}
this
.
WriteDouble2
=
function
(
val
)
{
...
...
@@ -594,96 +602,110 @@ function CMemory(bIsNoInit)
{
//код взят из jspack.js на основе стандарта Little-endian N-bit IEEE 754 floating point
var
s
,
e
,
m
,
i
,
d
,
c
,
mLen
,
eLen
,
eBias
,
eMax
;
var
el
=
{
len
:
8
,
mLen
:
52
,
rt
:
0
};
mLen
=
el
.
mLen
,
eLen
=
el
.
len
*
8
-
el
.
mLen
-
1
,
eMax
=
(
1
<<
eLen
)
-
1
,
eBias
=
eMax
>>
1
;
var
el
=
{
len
:
8
,
mLen
:
52
,
rt
:
0
};
mLen
=
el
.
mLen
,
eLen
=
el
.
len
*
8
-
el
.
mLen
-
1
,
eMax
=
(
1
<<
eLen
)
-
1
,
eBias
=
eMax
>>
1
;
s
=
v
<
0
?
1
:
0
;
s
=
v
<
0
?
1
:
0
;
v
=
Math
.
abs
(
v
);
if
(
isNaN
(
v
)
||
(
v
==
Infinity
))
{
m
=
isNaN
(
v
)?
1
:
0
;
m
=
isNaN
(
v
)
?
1
:
0
;
e
=
eMax
;
}
else
{
e
=
Math
.
floor
(
Math
.
log
(
v
)
/
Math
.
LN2
);
// Calculate log2 of the value
if
(
v
*
(
c
=
Math
.
pow
(
2
,
-
e
))
<
1
)
{
e
--
;
c
*=
2
;
}
// Math.log() isn't 100% reliable
e
=
Math
.
floor
(
Math
.
log
(
v
)
/
Math
.
LN2
);
// Calculate log2 of the value
if
(
v
*
(
c
=
Math
.
pow
(
2
,
-
e
))
<
1
)
{
e
--
;
c
*=
2
;
}
// Math.log() isn't 100% reliable
// Round by adding 1/2 the significand's LSD
if
(
e
+
eBias
>=
1
)
{
v
+=
el
.
rt
/
c
;
}
// Normalized: mLen significand digits
else
{
v
+=
el
.
rt
*
Math
.
pow
(
2
,
1
-
eBias
);
}
// Denormalized: <= mLen significand digits
if
(
v
*
c
>=
2
)
{
e
++
;
c
/=
2
;
}
// Rounding can increment the exponent
if
(
e
+
eBias
>=
1
)
{
v
+=
el
.
rt
/
c
;
}
// Normalized: mLen significand digits
else
{
v
+=
el
.
rt
*
Math
.
pow
(
2
,
1
-
eBias
);
}
// Denormalized: <= mLen significand digits
if
(
v
*
c
>=
2
)
{
e
++
;
c
/=
2
;
}
// Rounding can increment the exponent
if
(
e
+
eBias
>=
eMax
)
if
(
e
+
eBias
>=
eMax
)
{
// Overflow
m
=
0
;
e
=
eMax
;
}
else
if
(
e
+
eBias
>=
1
)
else
if
(
e
+
eBias
>=
1
)
{
// Normalized - term order matters, as Math.pow(2, 52-e) and v*Math.pow(2, 52) can overflow
m
=
(
v
*
c
-
1
)
*
Math
.
pow
(
2
,
mLen
);
m
=
(
v
*
c
-
1
)
*
Math
.
pow
(
2
,
mLen
);
e
=
e
+
eBias
;
}
else
{
// Denormalized - also catches the '0' case, somewhat by chance
m
=
v
*
Math
.
pow
(
2
,
eBias
-
1
)
*
Math
.
pow
(
2
,
mLen
);
m
=
v
*
Math
.
pow
(
2
,
eBias
-
1
)
*
Math
.
pow
(
2
,
mLen
);
e
=
0
;
}
}
var
a
=
new
Array
(
8
);
for
(
i
=
0
,
d
=
1
;
mLen
>=
8
;
a
[
i
]
=
m
&
0xff
,
i
+=
d
,
m
/=
256
,
mLen
-=
8
);
for
(
e
=
(
e
<<
mLen
)
|
m
,
eLen
+=
mLen
;
eLen
>
0
;
a
[
i
]
=
e
&
0xff
,
i
+=
d
,
e
/=
256
,
eLen
-=
8
);
a
[
i
-
d
]
|=
s
*
128
;
for
(
i
=
0
,
d
=
1
;
mLen
>=
8
;
a
[
i
]
=
m
&
0xff
,
i
+=
d
,
m
/=
256
,
mLen
-=
8
);
for
(
e
=
(
e
<<
mLen
)
|
m
,
eLen
+=
mLen
;
eLen
>
0
;
a
[
i
]
=
e
&
0xff
,
i
+=
d
,
e
/=
256
,
eLen
-=
8
);
a
[
i
-
d
]
|=
s
*
128
;
return
a
;
}
this
.
WriteString
=
function
(
text
)
{
if
(
"
string
"
!=
typeof
text
)
if
(
"
string
"
!=
typeof
text
)
text
=
text
+
""
;
var
count
=
text
.
length
&
0xFFFF
;
this
.
CheckSize
(
count
+
2
);
this
.
data
[
this
.
pos
++
]
=
count
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
(
count
>>>
8
)
&
0xFF
;
for
(
var
i
=
0
;
i
<
count
;
i
++
)
var
count
=
text
.
length
&
0xFFFF
;
this
.
CheckSize
(
count
+
2
);
this
.
data
[
this
.
pos
++
]
=
count
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
(
count
>>>
8
)
&
0xFF
;
for
(
var
i
=
0
;
i
<
count
;
i
++
)
{
var
c
=
text
.
charCodeAt
(
i
)
&
0xFFFF
;
this
.
data
[
this
.
pos
++
]
=
c
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
(
c
>>>
8
)
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
c
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
(
c
>>>
8
)
&
0xFF
;
}
}
this
.
WriteString2
=
function
(
text
)
{
if
(
"
string
"
!=
typeof
text
)
if
(
"
string
"
!=
typeof
text
)
text
=
text
+
""
;
var
count
=
text
.
length
&
0x7FFFFFFF
;
var
countWrite
=
2
*
count
;
this
.
WriteLong
(
countWrite
);
this
.
CheckSize
(
countWrite
);
for
(
var
i
=
0
;
i
<
count
;
i
++
)
for
(
var
i
=
0
;
i
<
count
;
i
++
)
{
var
c
=
text
.
charCodeAt
(
i
)
&
0xFFFF
;
this
.
data
[
this
.
pos
++
]
=
c
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
(
c
>>>
8
)
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
c
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
(
c
>>>
8
)
&
0xFF
;
}
}
this
.
WriteString3
=
function
(
text
)
{
if
(
"
string
"
!=
typeof
text
)
if
(
"
string
"
!=
typeof
text
)
text
=
text
+
""
;
var
count
=
text
.
length
&
0x7FFFFFFF
;
var
countWrite
=
2
*
count
;
this
.
CheckSize
(
countWrite
);
for
(
var
i
=
0
;
i
<
count
;
i
++
)
for
(
var
i
=
0
;
i
<
count
;
i
++
)
{
var
c
=
text
.
charCodeAt
(
i
)
&
0xFFFF
;
this
.
data
[
this
.
pos
++
]
=
c
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
(
c
>>>
8
)
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
c
&
0xFF
;
this
.
data
[
this
.
pos
++
]
=
(
c
>>>
8
)
&
0xFF
;
}
}
this
.
ClearNoAttack
=
function
()
...
...
@@ -693,10 +715,10 @@ function CMemory(bIsNoInit)
this
.
WriteLongAt
=
function
(
_pos
,
val
)
{
this
.
data
[
_pos
++
]
=
(
val
)
&
0xFF
;
this
.
data
[
_pos
++
]
=
(
val
>>>
8
)
&
0xFF
;
this
.
data
[
_pos
++
]
=
(
val
>>>
16
)
&
0xFF
;
this
.
data
[
_pos
++
]
=
(
val
>>>
24
)
&
0xFF
;
this
.
data
[
_pos
++
]
=
(
val
)
&
0xFF
;
this
.
data
[
_pos
++
]
=
(
val
>>>
8
)
&
0xFF
;
this
.
data
[
_pos
++
]
=
(
val
>>>
16
)
&
0xFF
;
this
.
data
[
_pos
++
]
=
(
val
>>>
24
)
&
0xFF
;
}
this
.
WriteBuffer
=
function
(
data
,
_pos
,
count
)
...
...
@@ -704,13 +726,13 @@ function CMemory(bIsNoInit)
this
.
CheckSize
(
count
);
for
(
var
i
=
0
;
i
<
count
;
i
++
)
{
this
.
data
[
this
.
pos
++
]
=
data
[
_pos
+
i
];
this
.
data
[
this
.
pos
++
]
=
data
[
_pos
+
i
];
}
}
}
}
function
CCommandsType
()
{
function
CCommandsType
()
{
this
.
ctPenXML
=
0
;
this
.
ctPenColor
=
1
;
this
.
ctPenAlpha
=
2
;
...
...
@@ -813,18 +835,45 @@ function CCommandsType()
this
.
ctPageEnd
=
203
;
this
.
ctError
=
255
;
}
}
var
CommandType
=
new
CCommandsType
();
var
CommandType
=
new
CCommandsType
();
var
MetaBrushType
=
{
var
MetaBrushType
=
{
Solid
:
0
,
Gradient
:
1
,
Texture
:
2
};
};
function
CMetafile
(
width
,
height
)
{
// 0 - dash
// 1 - dashDot
// 2 - dot
// 3 - lgDash
// 4 - lgDashDot
// 5 - lgDashDotDot
// 6 - solid
// 7 - sysDash
// 8 - sysDashDot
// 9 - sysDashDotDot
// 10- sysDot
var
DashPatternPresets
=
[
[
4
,
3
],
[
4
,
3
,
1
,
3
],
[
1
,
3
],
[
8
,
3
],
[
8
,
3
,
1
,
3
],
[
8
,
3
,
1
,
3
,
1
,
3
],
[
1
],
[
3
,
1
],
[
3
,
1
,
1
,
1
],
[
3
,
1
,
1
,
1
,
1
,
1
],
[
1
,
1
]
];
function
CMetafile
(
width
,
height
)
{
this
.
Width
=
width
;
this
.
Height
=
height
;
...
...
@@ -857,15 +906,15 @@ function CMetafile(width, height)
// просто чтобы не создавать каждый раз
this
.
m_oFontSlotFont
=
new
CFontSetup
();
this
.
LastFontOriginInfo
=
{
Name
:
""
,
Replace
:
null
};
this
.
LastFontOriginInfo
=
{
Name
:
""
,
Replace
:
null
};
this
.
StartOffset
=
0
;
}
}
CMetafile
.
prototype
=
{
CMetafile
.
prototype
=
{
// pen methods
p_color
:
function
(
r
,
g
,
b
,
a
)
p_color
:
function
(
r
,
g
,
b
,
a
)
{
if
(
this
.
m_oPen
.
Color
.
R
!=
r
||
this
.
m_oPen
.
Color
.
G
!=
g
||
this
.
m_oPen
.
Color
.
B
!=
b
)
{
...
...
@@ -894,8 +943,12 @@ CMetafile.prototype =
this
.
Memory
.
WriteDouble
(
val
);
}
},
p_dash
:
function
(
params
)
{
// TODO:
},
// brush methods
b_color1
:
function
(
r
,
g
,
b
,
a
)
b_color1
:
function
(
r
,
g
,
b
,
a
)
{
if
(
this
.
BrushType
!=
MetaBrushType
.
Solid
)
{
...
...
@@ -921,7 +974,7 @@ CMetafile.prototype =
this
.
Memory
.
WriteByte
(
a
);
}
},
b_color2
:
function
(
r
,
g
,
b
,
a
)
b_color2
:
function
(
r
,
g
,
b
,
a
)
{
if
(
this
.
m_oBrush
.
Color2
.
R
!=
r
||
this
.
m_oBrush
.
Color2
.
G
!=
g
||
this
.
m_oBrush
.
Color2
.
B
!=
b
)
{
...
...
@@ -959,7 +1012,8 @@ CMetafile.prototype =
var
_src
=
src
;
var
srcLocal
=
AscCommon
.
g_oDocumentUrls
.
getLocal
(
_src
);
if
(
srcLocal
){
if
(
srcLocal
)
{
_src
=
srcLocal
;
}
...
...
@@ -1039,7 +1093,7 @@ CMetafile.prototype =
this
.
Memory
.
WriteByte
(
AscCommon
.
g_nodeAttributeEnd
);
},
transform
:
function
(
sx
,
shy
,
shx
,
sy
,
tx
,
ty
)
transform
:
function
(
sx
,
shy
,
shx
,
sy
,
tx
,
ty
)
{
if
(
this
.
m_oTransform
.
sx
!=
sx
||
this
.
m_oTransform
.
shx
!=
shx
||
this
.
m_oTransform
.
shy
!=
shy
||
this
.
m_oTransform
.
sy
!=
sy
||
this
.
m_oTransform
.
tx
!=
tx
||
this
.
m_oTransform
.
ty
!=
ty
)
...
...
@@ -1079,21 +1133,21 @@ CMetafile.prototype =
var
_memory
=
(
null
==
this
.
VectorMemoryForPrint
)
?
this
.
Memory
:
this
.
VectorMemoryForPrint
;
_memory
.
WriteByte
(
CommandType
.
ctPathCommandClose
);
},
_m
:
function
(
x
,
y
)
_m
:
function
(
x
,
y
)
{
var
_memory
=
(
null
==
this
.
VectorMemoryForPrint
)
?
this
.
Memory
:
this
.
VectorMemoryForPrint
;
_memory
.
WriteByte
(
CommandType
.
ctPathCommandMoveTo
);
_memory
.
WriteDouble
(
x
);
_memory
.
WriteDouble
(
y
);
},
_l
:
function
(
x
,
y
)
_l
:
function
(
x
,
y
)
{
var
_memory
=
(
null
==
this
.
VectorMemoryForPrint
)
?
this
.
Memory
:
this
.
VectorMemoryForPrint
;
_memory
.
WriteByte
(
CommandType
.
ctPathCommandLineTo
);
_memory
.
WriteDouble
(
x
);
_memory
.
WriteDouble
(
y
);
},
_c
:
function
(
x1
,
y1
,
x2
,
y2
,
x3
,
y3
)
_c
:
function
(
x1
,
y1
,
x2
,
y2
,
x3
,
y3
)
{
var
_memory
=
(
null
==
this
.
VectorMemoryForPrint
)
?
this
.
Memory
:
this
.
VectorMemoryForPrint
;
_memory
.
WriteByte
(
CommandType
.
ctPathCommandCurveTo
);
...
...
@@ -1104,7 +1158,7 @@ CMetafile.prototype =
_memory
.
WriteDouble
(
x3
);
_memory
.
WriteDouble
(
y3
);
},
_c2
:
function
(
x1
,
y1
,
x2
,
y2
)
_c2
:
function
(
x1
,
y1
,
x2
,
y2
)
{
var
_memory
=
(
null
==
this
.
VectorMemoryForPrint
)
?
this
.
Memory
:
this
.
VectorMemoryForPrint
;
_memory
.
WriteByte
(
CommandType
.
ctPathCommandCurveTo
);
...
...
@@ -1177,7 +1231,7 @@ CMetafile.prototype =
},
// images
drawImage
:
function
(
img
,
x
,
y
,
w
,
h
)
drawImage
:
function
(
img
,
x
,
y
,
w
,
h
)
{
if
(
!
window
.
editor
)
{
...
...
@@ -1185,9 +1239,12 @@ CMetafile.prototype =
this
.
Memory
.
WriteByte
(
CommandType
.
ctDrawImageFromFile
);
var
imgLocal
=
AscCommon
.
g_oDocumentUrls
.
getLocal
(
img
);
if
(
imgLocal
){
if
(
imgLocal
)
{
this
.
Memory
.
WriteString2
(
imgLocal
);
}
else
{
}
else
{
this
.
Memory
.
WriteString2
(
img
);
}
...
...
@@ -1213,7 +1270,8 @@ CMetafile.prototype =
}
var
srcLocal
=
AscCommon
.
g_oDocumentUrls
.
getLocal
(
_src
);
if
(
srcLocal
){
if
(
srcLocal
)
{
_src
=
srcLocal
;
}
...
...
@@ -1258,7 +1316,7 @@ CMetafile.prototype =
this
.
Memory
.
WriteLong
(
style
);
}
},
FillText
:
function
(
x
,
y
,
text
,
isNoReplaceAttack
)
FillText
:
function
(
x
,
y
,
text
,
isNoReplaceAttack
)
{
this
.
Memory
.
WriteByte
(
CommandType
.
ctDrawText
);
...
...
@@ -1273,7 +1331,7 @@ CMetafile.prototype =
this
.
Memory
.
WriteDouble
(
x
);
this
.
Memory
.
WriteDouble
(
y
);
},
FillTextCode
:
function
(
x
,
y
,
code
)
FillTextCode
:
function
(
x
,
y
,
code
)
{
var
_font_info
=
AscFonts
.
g_font_infos
[
AscFonts
.
g_map_font_index
[
this
.
m_oFont
.
Name
]];
...
...
@@ -1315,7 +1373,7 @@ CMetafile.prototype =
this.Memory.WriteDouble(y);
*/
},
tg
:
function
(
gid
,
x
,
y
)
tg
:
function
(
gid
,
x
,
y
)
{
if
(
window
[
"
native
"
]
!==
undefined
)
{
...
...
@@ -1465,10 +1523,10 @@ CMetafile.prototype =
this
.
Memory
.
WriteLong
(
style
);
}
}
};
};
function
CDocumentRenderer
()
{
function
CDocumentRenderer
()
{
this
.
m_arrayPages
=
[];
this
.
m_lPagesCount
=
0
;
//this.DocumentInfo = "";
...
...
@@ -1491,21 +1549,21 @@ function CDocumentRenderer()
this
.
_restoreDumpedVectors
=
null
;
this
.
m_oBaseTransform
=
null
;
}
}
CDocumentRenderer
.
prototype
=
{
CDocumentRenderer
.
prototype
=
{
SetBaseTransform
:
function
(
_matrix
)
{
this
.
m_oBaseTransform
=
_matrix
;
},
BeginPage
:
function
(
width
,
height
)
BeginPage
:
function
(
width
,
height
)
{
this
.
m_arrayPages
[
this
.
m_arrayPages
.
length
]
=
new
CMetafile
(
width
,
height
);
this
.
m_arrayPages
[
this
.
m_arrayPages
.
length
]
=
new
CMetafile
(
width
,
height
);
this
.
m_lPagesCount
=
this
.
m_arrayPages
.
length
;
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
Memory
=
this
.
Memory
;
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
StartOffset
=
this
.
Memory
.
pos
;
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
VectorMemoryForPrint
=
this
.
VectorMemoryForPrint
;
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
Memory
=
this
.
Memory
;
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
StartOffset
=
this
.
Memory
.
pos
;
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
VectorMemoryForPrint
=
this
.
VectorMemoryForPrint
;
this
.
Memory
.
WriteByte
(
CommandType
.
ctPageStart
);
...
...
@@ -1524,33 +1582,38 @@ CDocumentRenderer.prototype =
this
.
Memory
.
WriteByte
(
CommandType
.
ctPageEnd
);
},
p_color
:
function
(
r
,
g
,
b
,
a
)
p_color
:
function
(
r
,
g
,
b
,
a
)
{
if
(
0
!=
this
.
m_lPagesCount
)
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
p_color
(
r
,
g
,
b
,
a
);
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
p_color
(
r
,
g
,
b
,
a
);
},
p_width
:
function
(
w
)
{
if
(
0
!=
this
.
m_lPagesCount
)
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
p_width
(
w
);
},
p_dash
:
function
(
params
)
{
if
(
0
!=
this
.
m_lPagesCount
)
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
p_dash
(
params
);
},
// brush methods
b_color1
:
function
(
r
,
g
,
b
,
a
)
b_color1
:
function
(
r
,
g
,
b
,
a
)
{
if
(
0
!=
this
.
m_lPagesCount
)
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
b_color1
(
r
,
g
,
b
,
a
);
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
b_color1
(
r
,
g
,
b
,
a
);
},
b_color2
:
function
(
r
,
g
,
b
,
a
)
b_color2
:
function
(
r
,
g
,
b
,
a
)
{
if
(
0
!=
this
.
m_lPagesCount
)
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
b_color2
(
r
,
g
,
b
,
a
);
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
b_color2
(
r
,
g
,
b
,
a
);
},
transform
:
function
(
sx
,
shy
,
shx
,
sy
,
tx
,
ty
)
transform
:
function
(
sx
,
shy
,
shx
,
sy
,
tx
,
ty
)
{
if
(
0
!=
this
.
m_lPagesCount
)
{
if
(
null
==
this
.
m_oBaseTransform
)
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
transform
(
sx
,
shy
,
shx
,
sy
,
tx
,
ty
);
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
transform
(
sx
,
shy
,
shx
,
sy
,
tx
,
ty
);
else
{
var
_transform
=
new
CMatrix
();
...
...
@@ -1561,7 +1624,7 @@ CDocumentRenderer.prototype =
_transform
.
tx
=
tx
;
_transform
.
ty
=
ty
;
AscCommon
.
global_MatrixTransformer
.
MultiplyAppend
(
_transform
,
this
.
m_oBaseTransform
);
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
transform
(
_transform
.
sx
,
_transform
.
shy
,
_transform
.
shx
,
_transform
.
sy
,
_transform
.
tx
,
_transform
.
ty
);
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
transform
(
_transform
.
sx
,
_transform
.
shy
,
_transform
.
shx
,
_transform
.
sy
,
_transform
.
tx
,
_transform
.
ty
);
}
}
},
...
...
@@ -1589,43 +1652,43 @@ CDocumentRenderer.prototype =
if
(
0
!=
this
.
m_lPagesCount
)
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
_z
();
},
_m
:
function
(
x
,
y
)
_m
:
function
(
x
,
y
)
{
if
(
0
!=
this
.
m_lPagesCount
)
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
_m
(
x
,
y
);
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
_m
(
x
,
y
);
if
(
this
.
ArrayPoints
!=
null
)
this
.
ArrayPoints
[
this
.
ArrayPoints
.
length
]
=
{
x
:
x
,
y
:
y
};
this
.
ArrayPoints
[
this
.
ArrayPoints
.
length
]
=
{
x
:
x
,
y
:
y
};
},
_l
:
function
(
x
,
y
)
_l
:
function
(
x
,
y
)
{
if
(
0
!=
this
.
m_lPagesCount
)
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
_l
(
x
,
y
);
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
_l
(
x
,
y
);
if
(
this
.
ArrayPoints
!=
null
)
this
.
ArrayPoints
[
this
.
ArrayPoints
.
length
]
=
{
x
:
x
,
y
:
y
};
this
.
ArrayPoints
[
this
.
ArrayPoints
.
length
]
=
{
x
:
x
,
y
:
y
};
},
_c
:
function
(
x1
,
y1
,
x2
,
y2
,
x3
,
y3
)
_c
:
function
(
x1
,
y1
,
x2
,
y2
,
x3
,
y3
)
{
if
(
0
!=
this
.
m_lPagesCount
)
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
_c
(
x1
,
y1
,
x2
,
y2
,
x3
,
y3
);
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
_c
(
x1
,
y1
,
x2
,
y2
,
x3
,
y3
);
if
(
this
.
ArrayPoints
!=
null
)
{
this
.
ArrayPoints
[
this
.
ArrayPoints
.
length
]
=
{
x
:
x1
,
y
:
y1
};
this
.
ArrayPoints
[
this
.
ArrayPoints
.
length
]
=
{
x
:
x2
,
y
:
y2
};
this
.
ArrayPoints
[
this
.
ArrayPoints
.
length
]
=
{
x
:
x3
,
y
:
y3
};
this
.
ArrayPoints
[
this
.
ArrayPoints
.
length
]
=
{
x
:
x1
,
y
:
y1
};
this
.
ArrayPoints
[
this
.
ArrayPoints
.
length
]
=
{
x
:
x2
,
y
:
y2
};
this
.
ArrayPoints
[
this
.
ArrayPoints
.
length
]
=
{
x
:
x3
,
y
:
y3
};
}
},
_c2
:
function
(
x1
,
y1
,
x2
,
y2
)
_c2
:
function
(
x1
,
y1
,
x2
,
y2
)
{
if
(
0
!=
this
.
m_lPagesCount
)
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
_c2
(
x1
,
y1
,
x2
,
y2
);
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
_c2
(
x1
,
y1
,
x2
,
y2
);
if
(
this
.
ArrayPoints
!=
null
)
{
this
.
ArrayPoints
[
this
.
ArrayPoints
.
length
]
=
{
x
:
x1
,
y
:
y1
};
this
.
ArrayPoints
[
this
.
ArrayPoints
.
length
]
=
{
x
:
x2
,
y
:
y2
};
this
.
ArrayPoints
[
this
.
ArrayPoints
.
length
]
=
{
x
:
x1
,
y
:
y1
};
this
.
ArrayPoints
[
this
.
ArrayPoints
.
length
]
=
{
x
:
x2
,
y
:
y2
};
}
},
ds
:
function
()
...
...
@@ -1656,7 +1719,7 @@ CDocumentRenderer.prototype =
},
// images
drawImage
:
function
(
img
,
x
,
y
,
w
,
h
,
alpha
,
srcRect
)
drawImage
:
function
(
img
,
x
,
y
,
w
,
h
,
alpha
,
srcRect
)
{
if
(
img
==
null
||
img
==
undefined
||
img
==
""
)
return
;
...
...
@@ -1664,7 +1727,7 @@ CDocumentRenderer.prototype =
if
(
0
!=
this
.
m_lPagesCount
)
{
if
(
!
srcRect
)
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
drawImage
(
img
,
x
,
y
,
w
,
h
);
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
drawImage
(
img
,
x
,
y
,
w
,
h
);
else
{
/*
...
...
@@ -1691,7 +1754,7 @@ CDocumentRenderer.prototype =
if
(
w0
==
0
||
h0
==
0
)
{
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
drawImage
(
img
,
x
,
y
,
w
,
h
);
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
drawImage
(
img
,
x
,
y
,
w
,
h
);
return
;
}
...
...
@@ -1767,7 +1830,7 @@ CDocumentRenderer.prototype =
_b
+=
(((
100
-
srcRect
.
b
)
*
_hk
*
h
)
/
100
);
}
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
drawImage
(
img
,
x
,
y
,
_r
-
x
,
_b
-
y
);
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
drawImage
(
img
,
x
,
y
,
_r
-
x
,
_b
-
y
);
if
(
bIsClip
)
{
...
...
@@ -1782,25 +1845,25 @@ CDocumentRenderer.prototype =
if
(
0
!=
this
.
m_lPagesCount
)
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
SetFont
(
font
);
},
FillText
:
function
(
x
,
y
,
text
,
cropX
,
cropW
)
FillText
:
function
(
x
,
y
,
text
,
cropX
,
cropW
)
{
if
(
0
!=
this
.
m_lPagesCount
)
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
FillText
(
x
,
y
,
text
);
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
FillText
(
x
,
y
,
text
);
},
FillTextCode
:
function
(
x
,
y
,
text
,
cropX
,
cropW
)
FillTextCode
:
function
(
x
,
y
,
text
,
cropX
,
cropW
)
{
if
(
0
!=
this
.
m_lPagesCount
)
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
FillTextCode
(
x
,
y
,
text
);
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
FillTextCode
(
x
,
y
,
text
);
},
tg
:
function
(
gid
,
x
,
y
)
tg
:
function
(
gid
,
x
,
y
)
{
if
(
0
!=
this
.
m_lPagesCount
)
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
tg
(
gid
,
x
,
y
);
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
tg
(
gid
,
x
,
y
);
},
FillText2
:
function
(
x
,
y
,
text
)
FillText2
:
function
(
x
,
y
,
text
)
{
if
(
0
!=
this
.
m_lPagesCount
)
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
FillText
(
x
,
y
,
text
);
this
.
m_arrayPages
[
this
.
m_lPagesCount
-
1
].
FillText
(
x
,
y
,
text
);
},
charspace
:
function
(
space
)
{
...
...
@@ -1839,7 +1902,7 @@ CDocumentRenderer.prototype =
{
},
DrawEmptyTableLine
:
function
(
x1
,
y1
,
x2
,
y2
)
DrawEmptyTableLine
:
function
(
x1
,
y1
,
x2
,
y2
)
{
// эта функция не для печати или сохранения вообще
},
...
...
@@ -1957,7 +2020,7 @@ CDocumentRenderer.prototype =
this
.
drawHorLine
(
align
,
y
,
x
+
leftMW
,
r
+
rightMW
,
penW
);
},
rect
:
function
(
x
,
y
,
w
,
h
)
rect
:
function
(
x
,
y
,
w
,
h
)
{
var
_x
=
x
;
var
_y
=
y
;
...
...
@@ -1972,9 +2035,9 @@ CDocumentRenderer.prototype =
this
.
_l
(
_x
,
_y
);
},
TableRect
:
function
(
x
,
y
,
w
,
h
)
TableRect
:
function
(
x
,
y
,
w
,
h
)
{
this
.
rect
(
x
,
y
,
w
,
h
);
this
.
rect
(
x
,
y
,
w
,
h
);
this
.
df
();
},
...
...
@@ -2202,31 +2265,35 @@ CDocumentRenderer.prototype =
}
this
.
_restoreDumpedVectors
=
null
;
}
};
};
var
MATRIX_ORDER_PREPEND
=
0
;
var
MATRIX_ORDER_APPEND
=
1
;
var
MATRIX_ORDER_PREPEND
=
0
;
var
MATRIX_ORDER_APPEND
=
1
;
function
deg2rad
(
deg
){
function
deg2rad
(
deg
)
{
return
deg
*
Math
.
PI
/
180.0
;
}
function
rad2deg
(
rad
){
function
rad2deg
(
rad
)
{
return
rad
*
180.0
/
Math
.
PI
;
}
function
CMatrix
()
{
function
CMatrix
()
{
this
.
sx
=
1.0
;
this
.
shx
=
0.0
;
this
.
shy
=
0.0
;
this
.
sy
=
1.0
;
this
.
tx
=
0.0
;
this
.
ty
=
0.0
;
}
}
CMatrix
.
prototype
=
{
Reset
:
function
(){
CMatrix
.
prototype
=
{
Reset
:
function
()
{
this
.
sx
=
1.0
;
this
.
shx
=
0.0
;
this
.
shy
=
0.0
;
...
...
@@ -2235,7 +2302,8 @@ CMatrix.prototype =
this
.
ty
=
0.0
;
},
// ���������
Multiply
:
function
(
matrix
,
order
){
Multiply
:
function
(
matrix
,
order
)
{
if
(
MATRIX_ORDER_PREPEND
==
order
)
{
var
m
=
new
CMatrix
();
...
...
@@ -2268,38 +2336,44 @@ CMatrix.prototype =
return
this
;
},
// � ������ ������� ������ ���������� (��� �������� �����������)
Translate
:
function
(
x
,
y
,
order
){
Translate
:
function
(
x
,
y
,
order
)
{
var
m
=
new
CMatrix
();
m
.
tx
=
x
;
m
.
ty
=
y
;
this
.
Multiply
(
m
,
order
);
this
.
Multiply
(
m
,
order
);
},
Scale
:
function
(
x
,
y
,
order
){
Scale
:
function
(
x
,
y
,
order
)
{
var
m
=
new
CMatrix
();
m
.
sx
=
x
;
m
.
sy
=
y
;
this
.
Multiply
(
m
,
order
);
this
.
Multiply
(
m
,
order
);
},
Rotate
:
function
(
a
,
order
){
Rotate
:
function
(
a
,
order
)
{
var
m
=
new
CMatrix
();
var
rad
=
deg2rad
(
a
);
m
.
sx
=
Math
.
cos
(
rad
);
m
.
shx
=
Math
.
sin
(
rad
);
m
.
shy
=
-
Math
.
sin
(
rad
);
m
.
sy
=
Math
.
cos
(
rad
);
this
.
Multiply
(
m
,
order
);
this
.
Multiply
(
m
,
order
);
},
RotateAt
:
function
(
a
,
x
,
y
,
order
){
this
.
Translate
(
-
x
,
-
y
,
order
);
this
.
Rotate
(
a
,
order
);
this
.
Translate
(
x
,
y
,
order
);
RotateAt
:
function
(
a
,
x
,
y
,
order
)
{
this
.
Translate
(
-
x
,
-
y
,
order
);
this
.
Rotate
(
a
,
order
);
this
.
Translate
(
x
,
y
,
order
);
},
// determinant
Determinant
:
function
(){
Determinant
:
function
()
{
return
this
.
sx
*
this
.
sy
-
this
.
shy
*
this
.
shx
;
},
// invert
Invert
:
function
(){
Invert
:
function
()
{
var
det
=
this
.
Determinant
();
if
(
0.0001
>
Math
.
abs
(
det
))
return
;
...
...
@@ -2318,14 +2392,17 @@ CMatrix.prototype =
return
this
;
},
// transform point
TransformPointX
:
function
(
x
,
y
){
TransformPointX
:
function
(
x
,
y
)
{
return
x
*
this
.
sx
+
y
*
this
.
shx
+
this
.
tx
;
},
TransformPointY
:
function
(
x
,
y
){
TransformPointY
:
function
(
x
,
y
)
{
return
x
*
this
.
shy
+
y
*
this
.
sy
+
this
.
ty
;
},
// calculate rotate angle
GetRotation
:
function
(){
GetRotation
:
function
()
{
var
x1
=
0.0
;
var
y1
=
0.0
;
var
x2
=
1.0
;
...
...
@@ -2353,14 +2430,15 @@ CMatrix.prototype =
return
270
;
}
var
a
=
Math
.
atan2
(
_y
,
_x
);
var
a
=
Math
.
atan2
(
_y
,
_x
);
a
=
rad2deg
(
a
);
if
(
a
<
0
)
a
+=
360
;
return
a
;
},
// ������� ���������
CreateDublicate
:
function
(){
CreateDublicate
:
function
()
{
var
m
=
new
CMatrix
();
m
.
sx
=
this
.
sx
;
m
.
shx
=
this
.
shx
;
...
...
@@ -2395,7 +2473,7 @@ CMatrix.prototype =
}
return
false
;
}
};
};
function
GradientGetAngleNoRotate
(
_angle
,
_transform
)
{
...
...
@@ -2439,7 +2517,7 @@ CMatrix.prototype =
}
else
{
a
=
Math
.
atan2
(
_y
,
_x
);
a
=
Math
.
atan2
(
_y
,
_x
);
a
=
rad2deg
(
a
);
}
...
...
@@ -2450,7 +2528,7 @@ CMatrix.prototype =
return
a
*
60000
;
};
var
CMatrixL
=
CMatrix
;
var
CMatrixL
=
CMatrix
;
function
CGlobalMatrixTransformer
()
{
...
...
@@ -2665,7 +2743,7 @@ var CMatrixL = CMatrix;
function
CPen
()
{
this
.
Color
=
{
R
:
255
,
G
:
255
,
B
:
255
,
A
:
255
};
this
.
Color
=
{
R
:
255
,
G
:
255
,
B
:
255
,
A
:
255
};
this
.
Style
=
0
;
this
.
LineCap
=
0
;
this
.
LineJoin
=
0
;
...
...
@@ -2675,8 +2753,8 @@ var CMatrixL = CMatrix;
function
CBrush
()
{
this
.
Color1
=
{
R
:
255
,
G
:
255
,
B
:
255
,
A
:
255
};
this
.
Color2
=
{
R
:
255
,
G
:
255
,
B
:
255
,
A
:
255
};
this
.
Color1
=
{
R
:
255
,
G
:
255
,
B
:
255
,
A
:
255
};
this
.
Color2
=
{
R
:
255
,
G
:
255
,
B
:
255
,
A
:
255
};
this
.
Type
=
0
;
}
...
...
@@ -2710,7 +2788,7 @@ var CMatrixL = CMatrix;
{
var
obj
=
new
CTableMarkup
(
this
.
Table
);
obj
.
Internal
=
{
RowIndex
:
this
.
Internal
.
RowIndex
,
CellIndex
:
this
.
Internal
.
CellIndex
,
PageNum
:
this
.
Internal
.
PageNum
};
obj
.
Internal
=
{
RowIndex
:
this
.
Internal
.
RowIndex
,
CellIndex
:
this
.
Internal
.
CellIndex
,
PageNum
:
this
.
Internal
.
PageNum
};
obj
.
X
=
this
.
X
;
var
len
=
this
.
Cols
.
length
;
...
...
@@ -2719,11 +2797,11 @@ var CMatrixL = CMatrix;
len
=
this
.
Margins
.
length
;
for
(
var
i
=
0
;
i
<
len
;
i
++
)
obj
.
Margins
[
i
]
=
{
Left
:
this
.
Margins
[
i
].
Left
,
Right
:
this
.
Margins
[
i
].
Right
};
obj
.
Margins
[
i
]
=
{
Left
:
this
.
Margins
[
i
].
Left
,
Right
:
this
.
Margins
[
i
].
Right
};
len
=
this
.
Rows
.
length
;
for
(
var
i
=
0
;
i
<
len
;
i
++
)
obj
.
Rows
[
i
]
=
{
Y
:
this
.
Rows
[
i
].
Y
,
H
:
this
.
Rows
[
i
].
H
};
obj
.
Rows
[
i
]
=
{
Y
:
this
.
Rows
[
i
].
Y
,
H
:
this
.
Rows
[
i
].
H
};
obj
.
CurRow
=
this
.
CurRow
;
obj
.
CurCol
=
this
.
CurCol
;
...
...
@@ -2857,4 +2935,6 @@ var CMatrixL = CMatrix;
window
[
'
AscCommon
'
].
g_dKoef_mm_to_pix
=
g_dKoef_mm_to_pix
;
window
[
'
AscCommon
'
].
g_dKoef_pix_to_mm
=
g_dKoef_pix_to_mm
;
window
[
'
AscCommon
'
].
GradientGetAngleNoRotate
=
GradientGetAngleNoRotate
;
window
[
'
AscCommon
'
].
DashPatternPresets
=
DashPatternPresets
;
})(
window
);
common/Drawings/TextDrawer.js
View file @
d45ec47e
...
...
@@ -931,6 +931,9 @@ CTextDrawer.prototype =
}
this
.
Get_PathToDraw
(
false
,
true
);
},
p_dash
:
function
(
w
)
{
},
// brush methods
b_color1
:
function
(
r
,
g
,
b
,
a
)
{
...
...
common/Overlay.js
View file @
d45ec47e
...
...
@@ -590,6 +590,10 @@ CAutoshapeTrack.prototype =
if
(
_EpsLine
>
this
.
MaxEpsLine
)
this
.
MaxEpsLine
=
_EpsLine
;
},
p_dash
:
function
(
params
)
{
this
.
Graphics
.
p_dash
(
params
);
},
b_color1
:
function
(
r
,
g
,
b
,
a
)
{
this
.
Graphics
.
b_color1
(
r
,
g
,
b
,
a
);
...
...
common/Shapes/Serialize.js
View file @
d45ec47e
...
...
@@ -2524,7 +2524,7 @@ function BinaryPPTYLoader()
}
case
1
:
{
s
.
SkipRecord
(
);
ln
.
setPrstDash
(
this
.
ReadLineDash
()
);
break
;
}
case
2
:
...
...
@@ -2594,6 +2594,39 @@ function BinaryPPTYLoader()
return
endL
;
}
this
.
ReadLineDash
=
function
()
{
var
s
=
this
.
stream
;
var
_rec_start
=
s
.
cur
;
var
_end_rec
=
_rec_start
+
s
.
GetLong
()
+
4
;
var
_dash
=
6
;
// solid
s
.
Skip2
(
1
);
// start attributes
while
(
true
)
{
var
_at
=
s
.
GetUChar
();
if
(
_at
==
g_nodeAttributeEnd
)
break
;
switch
(
_at
)
{
case
0
:
{
_dash
=
s
.
GetUChar
();
break
;
}
default
:
break
;
}
}
s
.
Seek2
(
_end_rec
);
return
_dash
;
}
this
.
ReadLineJoin
=
function
()
{
var
s
=
this
.
stream
;
...
...
common/Shapes/SerializeWriter.js
View file @
d45ec47e
...
...
@@ -2460,6 +2460,7 @@ function CBinaryFileWriter()
oThis
.
WriteUChar
(
g_nodeAttributeEnd
);
oThis
.
WriteRecord2
(
0
,
ln
.
Fill
,
oThis
.
WriteUniFill
);
oThis
.
WriteRecord2
(
1
,
ln
.
prstDash
,
oThis
.
WriteLineDash
);
oThis
.
WriteRecord1
(
2
,
ln
.
Join
,
oThis
.
WriteLineJoin
);
oThis
.
WriteRecord2
(
3
,
ln
.
headEnd
,
oThis
.
WriteLineEnd
);
oThis
.
WriteRecord2
(
4
,
ln
.
tailEnd
,
oThis
.
WriteLineEnd
);
...
...
@@ -2481,6 +2482,16 @@ function CBinaryFileWriter()
oThis
.
WriteUChar
(
g_nodeAttributeEnd
);
}
this
.
WriteLineDash
=
function
(
dash
)
{
if
(
dash
==
null
||
dash
===
undefined
)
return
;
oThis
.
WriteUChar
(
g_nodeAttributeStart
);
oThis
.
_WriteLimit2
(
0
,
dash
);
oThis
.
WriteUChar
(
g_nodeAttributeEnd
);
}
this
.
WriteLineEnd
=
function
(
end
)
{
oThis
.
WriteUChar
(
g_nodeAttributeStart
);
...
...
word/Drawing/Graphics.js
View file @
d45ec47e
...
...
@@ -207,6 +207,15 @@ CGraphics.prototype =
}
}
},
p_dash
:
function
(
params
)
{
if
(
!
this
.
m_oContext
.
setLineDash
)
return
;
this
.
m_oContext
.
setLineDash
(
params
?
params
:
[]);
},
// brush methods
b_color1
:
function
(
r
,
g
,
b
,
a
)
{
...
...
word/Drawing/ShapeDrawer.js
View file @
d45ec47e
...
...
@@ -631,6 +631,14 @@ CShapeDrawer.prototype =
this
.
p_width
(
1000
*
this
.
StrokeWidth
);
if
(
this
.
Ln
.
prstDash
!=
null
&&
AscCommon
.
DashPatternPresets
[
this
.
Ln
.
prstDash
])
{
var
_arr
=
AscCommon
.
DashPatternPresets
[
this
.
Ln
.
prstDash
].
slice
();;
for
(
var
indexD
=
0
;
indexD
<
_arr
.
length
;
indexD
++
)
_arr
[
indexD
]
*=
this
.
StrokeWidth
;
this
.
Graphics
.
p_dash
(
_arr
);
}
if
(
graphics
.
IsSlideBoundsCheckerType
&&
!
this
.
bIsNoStrokeAttack
)
graphics
.
LineWidth
=
this
.
StrokeWidth
;
...
...
@@ -699,6 +707,8 @@ CShapeDrawer.prototype =
{
this
.
Graphics
.
CorrectBounds2
();
}
this
.
Graphics
.
p_dash
(
null
);
},
p_width
:
function
(
w
)
...
...
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