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
85e1c068
Commit
85e1c068
authored
Apr 25, 2016
by
Alexey.Musinov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[mobile] сборка скриптов для таблиц
parent
a1013b41
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
544 additions
and
280 deletions
+544
-280
build/configs/webexcel.json
build/configs/webexcel.json
+29
-3
cell/native/DrawingContext.js
cell/native/DrawingContext.js
+21
-23
cell/native/DrawingDocument.js
cell/native/DrawingDocument.js
+239
-87
cell/native/Graphics.js
cell/native/Graphics.js
+205
-6
cell/native/native.js
cell/native/native.js
+22
-137
common/Native/Wrappers/memory.js
common/Native/Wrappers/memory.js
+28
-24
No files found.
build/configs/webexcel.json
View file @
85e1c068
...
...
@@ -169,9 +169,35 @@
"../common/Local/common.js"
,
"../cell/Local/api.js"
],
"mobile_banners"
:
[],
"exclude_mobile"
:
[],
"dst"
:
"../cell/sdk-all.js"
,
"mobile"
:
[
"../../web-apps/vendor/xregexp/xregexp-all-min.js"
,
"../../web-apps/vendor/underscore/underscore-min.js"
,
"../common/Native/jquery_native.js"
,
"../common/Native/Wrappers/memory.js"
,
"../common/Native/Wrappers/TextMeasurerWrapper.js"
,
"../common/Native/Wrappers/DrawingStream.js"
,
"../cell/native/DrawingContext.js"
,
"../cell/native/Graphics.js"
,
"../cell/native/Overlay.js"
,
"../common/Native/Wrappers/ShapeDrawer.js"
,
"../cell/native/DrawingDocument.js"
],
"mobile_banners"
:
[
"../cell/native/native.js"
],
"exclude_mobile"
:
[
"../common/Overlay.js"
,
"../common/Controls.js"
,
"../cell/graphics/DrawingContext.js"
,
"../cell/model/DrawingObjects/ShapeDrawer.js"
,
"../cell/model/DrawingObjects/DrawingDocument.js"
,
"../common/FontsFreeType/font_engine.js"
,
"../common/FontsFreeType/FontFile.js"
,
"../common/FontsFreeType/FontManager.js"
,
"../common/FontsFreeType/TextMeasurer.js"
,
"../cell/model/DrawingObjects/Graphics.js"
],
"dst"
:
"../cell/script.bin"
,
"externs"
:
[
"../common/Build/Externs.js"
,
"../../web-apps/vendor/jquery/jquery.min.js"
,
...
...
cell/native/DrawingContext.js
View file @
85e1c068
...
...
@@ -29,7 +29,7 @@
* Author: Dmitry.Sokolov@avsmedia.net
* Date: Nov 21, 2011
*/
(
function
(
/**
jQuery */
$
,
/**
Window */
window
,
undefined
)
{
(
function
(
/** Window */
window
,
undefined
)
{
/*
* Import
...
...
@@ -37,8 +37,6 @@
*/
var
asc
=
window
[
"
Asc
"
];
var
asc_round
=
asc
.
round
;
var
asc_floor
=
asc
.
floor
;
function
colorObjToAscColor
(
color
)
{
var
oRes
=
null
;
...
...
@@ -592,10 +590,10 @@
DrawingContext
.
prototype
.
changeZoom
=
function
(
factor
)
{
if
(
factor
<=
0
)
{
throw
"
Scale factor must be >= 0
"
;}
factor
=
asc_
round
(
factor
*
1000
)
/
1000
;
factor
=
Asc
.
round
(
factor
*
1000
)
/
1000
;
this
.
ppiX
=
asc_
round
(
this
.
ppiX
/
this
.
scaleFactor
*
factor
*
1000
)
/
1000
;
this
.
ppiY
=
asc_
round
(
this
.
ppiY
/
this
.
scaleFactor
*
factor
*
1000
)
/
1000
;
this
.
ppiX
=
Asc
.
round
(
this
.
ppiX
/
this
.
scaleFactor
*
factor
*
1000
)
/
1000
;
this
.
ppiY
=
Asc
.
round
(
this
.
ppiY
/
this
.
scaleFactor
*
factor
*
1000
)
/
1000
;
this
.
scaleFactor
=
factor
;
// reinitialize
...
...
@@ -611,8 +609,8 @@
* @param {Number} height New height in current units
*/
DrawingContext
.
prototype
.
resetSize
=
function
(
width
,
height
)
{
var
w
=
asc_
round
(
width
*
getCvtRatio
(
this
.
units
,
0
/*px*/
,
this
.
ppiX
)
),
h
=
asc_
round
(
height
*
getCvtRatio
(
this
.
units
,
0
/*px*/
,
this
.
ppiY
)
);
var
w
=
Asc
.
round
(
width
*
getCvtRatio
(
this
.
units
,
0
/*px*/
,
this
.
ppiX
)
),
h
=
Asc
.
round
(
height
*
getCvtRatio
(
this
.
units
,
0
/*px*/
,
this
.
ppiY
)
);
if
(
w
!==
this
.
canvas
.
width
)
{
this
.
canvas
.
width
=
w
;
}
...
...
@@ -628,8 +626,8 @@
* @param {Number} height New height in current units
*/
DrawingContext
.
prototype
.
expand
=
function
(
width
,
height
)
{
var
w
=
asc_
round
(
width
*
getCvtRatio
(
this
.
units
,
0
/*px*/
,
this
.
ppiX
)
),
h
=
asc_
round
(
height
*
getCvtRatio
(
this
.
units
,
0
/*px*/
,
this
.
ppiY
)
);
var
w
=
Asc
.
round
(
width
*
getCvtRatio
(
this
.
units
,
0
/*px*/
,
this
.
ppiX
)
),
h
=
Asc
.
round
(
height
*
getCvtRatio
(
this
.
units
,
0
/*px*/
,
this
.
ppiY
)
);
if
(
w
>
this
.
canvas
.
width
)
{
this
.
canvas
.
width
=
w
;
}
...
...
@@ -849,7 +847,7 @@
res
.
descender
=
factor
*
d
;
res
.
lineGap
=
factor
*
(
fm
.
m_lLineHeight
-
fm
.
m_lAscender
-
d
);
var
face
=
AscCommon
.
g_oTextMeasurer
.
Measurer
[
'
GetFace
'
]();
var
face
=
g_oTextMeasurer
.
Measurer
[
'
GetFace
'
]();
res
.
nat_scale
=
face
[
0
];
res
.
nat_y1
=
face
[
1
];
res
.
nat_y2
=
face
[
2
];
...
...
@@ -897,7 +895,7 @@
if
(
_info
.
SrcBold
)
flag
|=
0x04
;
if
(
_info
.
SrcItalic
)
flag
|=
0x08
;
napi_fontInfo
=
AscCommon
.
g_oTextMeasurer
.
Measurer
[
"
LoadFont
"
](
_info
.
Path
,
_info
.
FaceIndex
,
this
.
font
.
FontSize
,
flag
);
napi_fontInfo
=
g_oTextMeasurer
.
Measurer
[
"
LoadFont
"
](
_info
.
Path
,
_info
.
FaceIndex
,
this
.
font
.
FontSize
,
flag
);
this
.
napi_fmt
[
1
].
m_lUnits_Per_Em
=
napi_fontInfo
[
3
];
this
.
napi_fmt
[
1
].
m_lAscender
=
napi_fontInfo
[
0
];
...
...
@@ -922,7 +920,7 @@
if
(
_info
.
SrcBold
)
flag
|=
0x04
;
if
(
_info
.
SrcItalic
)
flag
|=
0x08
;
napi_fontInfo
=
AscCommon
.
g_oTextMeasurer
.
Measurer
[
"
LoadFont
"
](
_info
.
Path
,
_info
.
FaceIndex
,
this
.
font
.
FontSize
,
flag
);
napi_fontInfo
=
g_oTextMeasurer
.
Measurer
[
"
LoadFont
"
](
_info
.
Path
,
_info
.
FaceIndex
,
this
.
font
.
FontSize
,
flag
);
this
.
nctx
[
"
PD_LoadFont
"
](
_info
.
Path
,
_info
.
FaceIndex
,
this
.
font
.
FontSize
,
flag
);
...
...
@@ -982,7 +980,7 @@
r
=
getCvtRatio
(
0
/*px*/
,
units
>=
0
&&
units
<=
3
?
units
:
this
.
units
,
this
.
ppiX
);
for
(
var
tmp
,
w
=
0
,
w2
=
0
,
i
=
0
;
i
<
text
.
length
;
++
i
)
{
var
bounds
=
AscCommon
.
g_oTextMeasurer
.
Measurer
[
"
GetDrawingBox
"
](
text
.
charCodeAt
(
i
));
var
bounds
=
g_oTextMeasurer
.
Measurer
[
"
GetDrawingBox
"
](
text
.
charCodeAt
(
i
));
tmp
=
{
fAdvanceX
:
bounds
[
0
],
oBBox
:
{
...
...
@@ -993,7 +991,7 @@
}
};
w
+=
asc_
round
(
tmp
.
fAdvanceX
);
// asc_round - убрали что бы текст не скакал
w
+=
Asc
.
round
(
tmp
.
fAdvanceX
);
// asc_round - убрали что бы текст не скакал
}
w2
=
w
-
tmp
.
fAdvanceX
+
tmp
.
oBBox
.
fMaxX
-
tmp
.
oBBox
.
fMinX
+
1
;
return
this
.
_calcTextMetrics
(
w
*
r
,
w2
*
r
,
fm
,
r
);
...
...
@@ -1005,8 +1003,8 @@
if
(
!
(
nW
>
0
&&
nH
>
0
)
)
{
return
;}
var
nX
=
asc_
floor
(
fmgr
.
m_oGlyphString
.
m_fX
+
pGlyph
.
fX
+
pGlyph
.
oBitmap
.
nX
);
var
nY
=
asc_
floor
(
fmgr
.
m_oGlyphString
.
m_fY
+
pGlyph
.
fY
-
pGlyph
.
oBitmap
.
nY
);
var
nX
=
Asc
.
floor
(
fmgr
.
m_oGlyphString
.
m_fX
+
pGlyph
.
fX
+
pGlyph
.
oBitmap
.
nX
);
var
nY
=
Asc
.
floor
(
fmgr
.
m_oGlyphString
.
m_fY
+
pGlyph
.
fY
-
pGlyph
.
oBitmap
.
nY
);
var
_r
=
this
.
fillColor
.
r
;
var
_g
=
this
.
fillColor
.
g
;
...
...
@@ -1059,7 +1057,7 @@
this
.
nctx
[
"
PD_FillText
"
](
_x
,
_y
,
lUnicode
);
_x
+=
asc_round
(
AscCommon
.
g_oTextMeasurer
.
Measurer
[
"
MeasureChar
"
](
lUnicode
));
_x
+=
Asc
.
round
(
g_oTextMeasurer
.
Measurer
[
"
MeasureChar
"
](
lUnicode
));
}
return
this
;
...
...
@@ -1307,10 +1305,10 @@
_x
=
this
.
_mft
.
transformPointX
(
x
,
y
),
_y
=
this
.
_mft
.
transformPointY
(
x
,
y
);
return
{
x
:
asc_
round
(
_x
),
y
:
asc_
round
(
_y
),
w
:
wh
?
asc_
round
(
this
.
_mft
.
transformPointX
(
x2
,
y2
)
-
_x
)
:
undefined
,
h
:
wh
?
asc_
round
(
this
.
_mft
.
transformPointY
(
x2
,
y2
)
-
_y
)
:
undefined
x
:
Asc
.
round
(
_x
),
y
:
Asc
.
round
(
_y
),
w
:
wh
?
Asc
.
round
(
this
.
_mft
.
transformPointX
(
x2
,
y2
)
-
_x
)
:
undefined
,
h
:
wh
?
Asc
.
round
(
this
.
_mft
.
transformPointY
(
x2
,
y2
)
-
_y
)
:
undefined
};
};
...
...
@@ -1355,4 +1353,4 @@
window
[
"
Asc
"
].
DrawingContext
=
DrawingContext
;
window
[
"
Asc
"
].
Matrix
=
Matrix
;
})(
jQuery
,
window
);
})(
window
);
cell/native/DrawingDocument.js
View file @
85e1c068
This diff is collapsed.
Click to expand it.
cell/native/Graphics.js
View file @
85e1c068
...
...
@@ -123,10 +123,8 @@ function CBrush()
this
.
Type
=
0
;
}
var
bIsChrome
=
AscCommon
.
AscBrowser
.
isChrome
;
var
bIsSafari
=
AscCommon
.
AscBrowser
.
isSafari
;
var
bIsIE
=
AscCommon
.
AscBrowser
.
isIE
;
var
bIsAndroid
=
AscCommon
.
AscBrowser
.
isAndroid
;
var
MATRIX_ORDER_PREPEND
=
0
;
var
MATRIX_ORDER_APPEND
=
1
;
function
deg2rad
(
deg
){
return
deg
*
Math
.
PI
/
180.0
;
...
...
@@ -135,6 +133,207 @@ function rad2deg(rad){
return
rad
*
180.0
/
Math
.
PI
;
}
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
(){
this
.
sx
=
1.0
;
this
.
shx
=
0.0
;
this
.
shy
=
0.0
;
this
.
sy
=
1.0
;
this
.
tx
=
0.0
;
this
.
ty
=
0.0
;
},
// ���������
Multiply
:
function
(
matrix
,
order
){
if
(
MATRIX_ORDER_PREPEND
==
order
)
{
var
m
=
new
CMatrix
();
m
.
sx
=
matrix
.
sx
;
m
.
shx
=
matrix
.
shx
;
m
.
shy
=
matrix
.
shy
;
m
.
sy
=
matrix
.
sy
;
m
.
tx
=
matrix
.
tx
;
m
.
ty
=
matrix
.
ty
;
m
.
Multiply
(
this
,
MATRIX_ORDER_APPEND
);
this
.
sx
=
m
.
sx
;
this
.
shx
=
m
.
shx
;
this
.
shy
=
m
.
shy
;
this
.
sy
=
m
.
sy
;
this
.
tx
=
m
.
tx
;
this
.
ty
=
m
.
ty
;
}
else
{
var
t0
=
this
.
sx
*
matrix
.
sx
+
this
.
shy
*
matrix
.
shx
;
var
t2
=
this
.
shx
*
matrix
.
sx
+
this
.
sy
*
matrix
.
shx
;
var
t4
=
this
.
tx
*
matrix
.
sx
+
this
.
ty
*
matrix
.
shx
+
matrix
.
tx
;
this
.
shy
=
this
.
sx
*
matrix
.
shy
+
this
.
shy
*
matrix
.
sy
;
this
.
sy
=
this
.
shx
*
matrix
.
shy
+
this
.
sy
*
matrix
.
sy
;
this
.
ty
=
this
.
tx
*
matrix
.
shy
+
this
.
ty
*
matrix
.
sy
+
matrix
.
ty
;
this
.
sx
=
t0
;
this
.
shx
=
t2
;
this
.
tx
=
t4
;
}
return
this
;
},
// � ������ ������� ������ ���������� (��� �������� �����������)
Translate
:
function
(
x
,
y
,
order
){
var
m
=
new
CMatrix
();
m
.
tx
=
x
;
m
.
ty
=
y
;
this
.
Multiply
(
m
,
order
);
},
Scale
:
function
(
x
,
y
,
order
){
var
m
=
new
CMatrix
();
m
.
sx
=
x
;
m
.
sy
=
y
;
this
.
Multiply
(
m
,
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
);
},
RotateAt
:
function
(
a
,
x
,
y
,
order
){
this
.
Translate
(
-
x
,
-
y
,
order
);
this
.
Rotate
(
a
,
order
);
this
.
Translate
(
x
,
y
,
order
);
},
// determinant
Determinant
:
function
(){
return
this
.
sx
*
this
.
sy
-
this
.
shy
*
this
.
shx
;
},
// invert
Invert
:
function
(){
var
det
=
this
.
Determinant
();
if
(
0.0001
>
Math
.
abs
(
det
))
return
;
var
d
=
1
/
det
;
var
t0
=
this
.
sy
*
d
;
this
.
sy
=
this
.
sx
*
d
;
this
.
shy
=
-
this
.
shy
*
d
;
this
.
shx
=
-
this
.
shx
*
d
;
var
t4
=
-
this
.
tx
*
t0
-
this
.
ty
*
this
.
shx
;
this
.
ty
=
-
this
.
tx
*
this
.
shy
-
this
.
ty
*
this
.
sy
;
this
.
sx
=
t0
;
this
.
tx
=
t4
;
return
this
;
},
// transform point
TransformPointX
:
function
(
x
,
y
){
return
x
*
this
.
sx
+
y
*
this
.
shx
+
this
.
tx
;
},
TransformPointY
:
function
(
x
,
y
){
return
x
*
this
.
shy
+
y
*
this
.
sy
+
this
.
ty
;
},
// calculate rotate angle
GetRotation
:
function
(){
var
x1
=
0.0
;
var
y1
=
0.0
;
var
x2
=
1.0
;
var
y2
=
0.0
;
this
.
TransformPoint
(
x1
,
y1
);
this
.
TransformPoint
(
x2
,
y2
);
var
a
=
Math
.
atan2
(
y2
-
y1
,
x2
-
x1
);
return
rad2deg
(
a
);
},
// ������� ���������
CreateDublicate
:
function
(){
var
m
=
new
CMatrix
();
m
.
sx
=
this
.
sx
;
m
.
shx
=
this
.
shx
;
m
.
shy
=
this
.
shy
;
m
.
sy
=
this
.
sy
;
m
.
tx
=
this
.
tx
;
m
.
ty
=
this
.
ty
;
return
m
;
},
IsIdentity
:
function
()
{
if
(
this
.
sx
==
1.0
&&
this
.
shx
==
0.0
&&
this
.
shy
==
0.0
&&
this
.
sy
==
1.0
&&
this
.
tx
==
0.0
&&
this
.
ty
==
0.0
)
{
return
true
;
}
return
false
;
},
IsIdentity2
:
function
()
{
if
(
this
.
sx
==
1.0
&&
this
.
shx
==
0.0
&&
this
.
shy
==
0.0
&&
this
.
sy
==
1.0
)
{
return
true
;
}
return
false
;
}
};
function
CMatrixL
()
{
this
.
sx
=
1.0
;
this
.
shx
=
0.0
;
this
.
shy
=
0.0
;
this
.
sy
=
1.0
;
this
.
tx
=
0.0
;
this
.
ty
=
0.0
;
}
CMatrixL
.
prototype
=
{
CreateDublicate
:
function
()
{
var
m
=
new
CMatrixL
();
m
.
sx
=
this
.
sx
;
m
.
shx
=
this
.
shx
;
m
.
shy
=
this
.
shy
;
m
.
sy
=
this
.
sy
;
m
.
tx
=
this
.
tx
;
m
.
ty
=
this
.
ty
;
return
m
;
},
Reset
:
function
()
{
this
.
sx
=
1.0
;
this
.
shx
=
0.0
;
this
.
shy
=
0.0
;
this
.
sy
=
1.0
;
this
.
tx
=
0.0
;
this
.
ty
=
0.0
;
},
TransformPointX
:
function
(
x
,
y
)
{
return
x
*
this
.
sx
+
y
*
this
.
shx
+
this
.
tx
;
},
TransformPointY
:
function
(
x
,
y
)
{
return
x
*
this
.
shy
+
y
*
this
.
sy
+
this
.
ty
;
}
};
function
CGlobalMatrixTransformer
()
{
this
.
TranslateAppend
=
function
(
m
,
_tx
,
_ty
)
...
...
@@ -1035,7 +1234,7 @@ CGraphics.prototype =
if
(
_info
.
SrcBold
)
flag
|=
0x04
;
if
(
_info
.
SrcItalic
)
flag
|=
0x08
;
AscCommon
.
g_oTextMeasurer
.
Measurer
[
"
LoadFont
"
](
_info
.
Path
,
_info
.
FaceIndex
,
font
.
FontSize
,
flag
);
g_oTextMeasurer
.
Measurer
[
"
LoadFont
"
](
_info
.
Path
,
_info
.
FaceIndex
,
font
.
FontSize
,
flag
);
this
.
Native
[
"
PD_LoadFont
"
](
_info
.
Path
,
_info
.
FaceIndex
,
font
.
FontSize
,
flag
);
},
...
...
@@ -1121,7 +1320,7 @@ CGraphics.prototype =
if
(
_info
.
SrcBold
)
flag
|=
0x04
;
if
(
_info
.
SrcItalic
)
flag
|=
0x08
;
AscCommon
.
g_oTextMeasurer
.
Measurer
[
"
LoadFont
"
](
_info
.
Path
,
_info
.
FaceIndex
,
_lastFont
.
SetUpSize
,
flag
);
g_oTextMeasurer
.
Measurer
[
"
LoadFont
"
](
_info
.
Path
,
_info
.
FaceIndex
,
_lastFont
.
SetUpSize
,
flag
);
this
.
Native
[
"
PD_LoadFont
"
](
_info
.
Path
,
_info
.
FaceIndex
,
_lastFont
.
SetUpSize
,
flag
);
}
...
...
cell/native/native.js
View file @
85e1c068
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
var
editor
=
undefined
;
var
window
=
{};
var
navigator
=
{};
...
...
@@ -540,114 +515,18 @@ window["NativeCorrectImageUrlOnCopy"] = function(url) {
return
window
[
"
native
"
][
"
CorrectImageUrlOnCopy
"
](
url
);
};
// FT_Common
function
_FT_Common
()
{
this
.
UintToInt
=
function
(
v
)
{
return
(
v
>
2147483647
)?
v
-
4294967296
:
v
;
};
this
.
UShort_To_Short
=
function
(
v
)
{
return
(
v
>
32767
)?
v
-
65536
:
v
;
};
this
.
IntToUInt
=
function
(
v
)
{
return
(
v
<
0
)?
v
+
4294967296
:
v
;
};
this
.
Short_To_UShort
=
function
(
v
)
{
return
(
v
<
0
)?
v
+
65536
:
v
;
};
this
.
memset
=
function
(
d
,
v
,
s
)
{
for
(
var
i
=
0
;
i
<
s
;
i
++
)
d
[
i
]
=
v
;
};
this
.
memcpy
=
function
(
d
,
s
,
l
)
{
for
(
var
i
=
0
;
i
<
l
;
i
++
)
d
[
i
]
=
s
[
i
];
};
this
.
memset_p
=
function
(
d
,
v
,
s
)
{
var
_d
=
d
.
data
;
var
_e
=
d
.
pos
+
s
;
for
(
var
i
=
d
.
pos
;
i
<
_e
;
i
++
)
_d
[
i
]
=
v
;
};
this
.
memcpy_p
=
function
(
d
,
s
,
l
)
{
var
_d1
=
d
.
data
;
var
_p1
=
d
.
pos
;
var
_d2
=
s
.
data
;
var
_p2
=
s
.
pos
;
for
(
var
i
=
0
;
i
<
l
;
i
++
)
_d1
[
_p1
++
]
=
_d2
[
_p2
++
];
};
this
.
memcpy_p2
=
function
(
d
,
s
,
p
,
l
)
{
var
_d1
=
d
.
data
;
var
_p1
=
d
.
pos
;
var
_p2
=
p
;
for
(
var
i
=
0
;
i
<
l
;
i
++
)
_d1
[
_p1
++
]
=
s
[
_p2
++
];
};
this
.
realloc
=
function
(
memory
,
pointer
,
cur_count
,
new_count
)
{
var
ret
=
{
block
:
null
,
err
:
0
,
size
:
new_count
};
if
(
cur_count
<
0
||
new_count
<
0
)
{
/* may help catch/prevent nasty security issues */
ret
.
err
=
6
;
}
else
if
(
new_count
==
0
)
{
ret
.
block
=
null
;
}
else
if
(
cur_count
==
0
)
{
ret
.
block
=
memory
.
Alloc
(
new_count
);
}
else
{
var
block2
=
memory
.
Alloc
(
new_count
);
FT_Common
.
memcpy_p
(
block2
,
pointer
,
cur_count
);
ret
.
block
=
block2
;
}
return
ret
;
};
this
.
realloc_long
=
function
(
memory
,
pointer
,
cur_count
,
new_count
)
{
var
ret
=
{
block
:
null
,
err
:
0
,
size
:
new_count
};
if
(
cur_count
<
0
||
new_count
<
0
)
{
/* may help catch/prevent nasty security issues */
ret
.
err
=
6
;
}
else
if
(
new_count
==
0
)
{
ret
.
block
=
null
;
}
else
if
(
cur_count
==
0
)
{
ret
.
block
=
CreateIntArray
(
new_count
);
}
else
{
var
block2
=
CreateIntArray
(
new_count
);
for
(
var
i
=
0
;
i
<
cur_count
;
i
++
)
block2
[
i
]
=
pointer
[
i
];
ret
.
block
=
block2
;
}
return
ret
;
};
}
//--------------------------------------------------------------------------------
// font engine
//--------------------------------------------------------------------------------
var
FONT_ITALIC_ANGLE
=
0.3090169943749
;
var
FT_ENCODING_UNICODE
=
1970170211
;
var
FT_ENCODING_NONE
=
0
;
var
FT_ENCODING_MS_SYMBOL
=
1937337698
;
var
FT_ENCODING_APPLE_ROMAN
=
1634889070
;
var
LOAD_MODE
=
40970
;
var
REND_MODE
=
0
;
var
FontStyle
=
{
FontStyleRegular
:
0
,
FontStyleBold
:
1
,
...
...
@@ -656,14 +535,19 @@ var FontStyle = {
FontStyleUnderline
:
4
,
FontStyleStrikeout
:
8
};
function
CFontManager
()
{
var
EGlyphState
=
{
glyphstateNormal
:
0
,
glyphstateDeafault
:
1
,
glyphstateMiss
:
2
};
window
[
'
AscFonts
'
].
CFontManager
=
function
CFontManager
()
{
this
.
m_oLibrary
=
{};
this
.
Initialize
=
function
(){};
this
.
ClearFontsRasterCache
=
function
(){};
}
}
;
window
[
"
use_native_fonts_only
"
]
=
true
;
window
[
"
ftm
"
]
=
FT_Memory
;
// FT_Common
function
_FT_Common
()
{
...
...
@@ -3243,7 +3127,7 @@ function OfflineEditor () {
worksheet
.
_drawSelection
();
}
AscFormat
.
DrawingArea
.
prototype
.
drawSelection
=
function
(
drawingDocument
)
{
window
[
'
AscFormat
'
]
.
DrawingArea
.
prototype
.
drawSelection
=
function
(
drawingDocument
)
{
offlineEditor
.
flushTextMeasurer
();
...
...
@@ -3317,7 +3201,7 @@ function OfflineEditor () {
}
};
Path
.
prototype
.
drawSmart
=
function
(
shape_drawer
)
{
window
[
'
AscFormat
'
].
Path
.
prototype
.
drawSmart
=
function
(
shape_drawer
)
{
var
_graphics
=
shape_drawer
.
Graphics
;
var
_full_trans
=
_graphics
.
m_oFullTransform
;
...
...
@@ -3459,7 +3343,6 @@ function OfflineEditor () {
};
var
asc_Range
=
window
[
"
Asc
"
].
Range
;
var
asc_round
=
window
[
"
Asc
"
].
round
;
var
asc_typeof
=
window
[
"
Asc
"
].
typeOf
;
/**
...
...
@@ -7612,4 +7495,6 @@ function offline_apply_event(type,params) {
}
return
_return
;
}
\ No newline at end of file
}
window
[
'
AscFonts
'
].
FT_Common
=
FT_Common
;
common/Native/Wrappers/memory.js
View file @
85e1c068
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
function
CPointer
()
{
this
.
obj
=
null
;
...
...
@@ -689,3 +689,7 @@ function FT_Stream(data, size)
}
window
[
"
fts
"
]
=
FT_Stream
;
window
[
'
AscFonts
'
].
FT_Memory
=
FT_Memory
;
window
[
'
AscFonts
'
].
FT_Stream
=
FT_Stream
;
window
[
'
AscFonts
'
].
g_memory
=
g_memory
;
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