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
7fd7bae2
Commit
7fd7bae2
authored
Apr 11, 2016
by
Sergey Luzyanin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
https://github.com/ONLYOFFICE/sdkjs
into develop
parents
49301f9a
e9b86a74
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
487 additions
and
93 deletions
+487
-93
common/Native/Wrappers/memory.js
common/Native/Wrappers/memory.js
+1
-1
common/commonDefines.js
common/commonDefines.js
+3
-0
word/Drawing/DrawingDocument.js
word/Drawing/DrawingDocument.js
+28
-26
word/Drawing/HtmlPage.js
word/Drawing/HtmlPage.js
+2
-2
word/Editor/Field.js
word/Editor/Field.js
+2
-1
word/Editor/Serialize2.js
word/Editor/Serialize2.js
+56
-61
word/apiBuilder.js
word/apiBuilder.js
+395
-2
No files found.
common/Native/Wrappers/memory.js
View file @
7fd7bae2
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
* Pursuant to Section 7 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* Pursuant to Section 7 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*
*/
*/
function
CPointer
()
function
CPointer
()
{
{
this
.
obj
=
null
;
this
.
obj
=
null
;
this
.
data
=
null
;
this
.
data
=
null
;
...
...
common/commonDefines.js
View file @
7fd7bae2
...
@@ -855,6 +855,9 @@ window['Asc']['c_oAscAsyncActionType'] = c_oAscAsyncActionType;
...
@@ -855,6 +855,9 @@ window['Asc']['c_oAscAsyncActionType'] = c_oAscAsyncActionType;
window
[
'
Asc
'
][
'
c_oAscNumFormatType
'
]
=
c_oAscNumFormatType
;
window
[
'
Asc
'
][
'
c_oAscNumFormatType
'
]
=
c_oAscNumFormatType
;
window
[
'
Asc
'
][
'
c_oAscDrawingLayerType
'
]
=
c_oAscDrawingLayerType
;
window
[
'
Asc
'
][
'
c_oAscDrawingLayerType
'
]
=
c_oAscDrawingLayerType
;
window
[
'
Asc
'
][
'
c_oAscTypeSelectElement
'
]
=
c_oAscTypeSelectElement
;
window
[
'
Asc
'
][
'
c_oAscTypeSelectElement
'
]
=
c_oAscTypeSelectElement
;
window
[
'
Asc
'
][
'
linerule_AtLeast
'
]
=
linerule_AtLeast
;
window
[
'
Asc
'
][
'
linerule_Auto
'
]
=
linerule_Auto
;
window
[
'
Asc
'
][
'
linerule_Exact
'
]
=
linerule_Exact
;
window
[
'
Asc
'
][
'
c_oAscShdClear
'
]
=
shd_Clear
;
//ToDo по идее должны совпадать переменные
window
[
'
Asc
'
][
'
c_oAscShdClear
'
]
=
shd_Clear
;
//ToDo по идее должны совпадать переменные
window
[
'
Asc
'
][
'
c_oAscShdNil
'
]
=
shd_Nil
;
window
[
'
Asc
'
][
'
c_oAscShdNil
'
]
=
shd_Nil
;
window
[
'
Asc
'
][
'
c_oAscChartTitleShowSettings
'
]
=
c_oAscChartTitleShowSettings
;
window
[
'
Asc
'
][
'
c_oAscChartTitleShowSettings
'
]
=
c_oAscChartTitleShowSettings
;
...
...
word/Drawing/DrawingDocument.js
View file @
7fd7bae2
...
@@ -2734,8 +2734,10 @@ function CDrawingDocument()
...
@@ -2734,8 +2734,10 @@ function CDrawingDocument()
var
page
=
this
.
m_arrPages
[
pageIndex
];
var
page
=
this
.
m_arrPages
[
pageIndex
];
var
w
=
(
this
.
m_oWordControl
.
m_nZoomValue
*
g_dKoef_mm_to_pix
*
page
.
width_mm
/
100
)
>>
0
;
var
dKoef
=
(
this
.
m_oWordControl
.
m_nZoomValue
*
g_dKoef_mm_to_pix
/
100
);
var
h
=
(
this
.
m_oWordControl
.
m_nZoomValue
*
g_dKoef_mm_to_pix
*
page
.
height_mm
/
100
)
>>
0
;
var
w
=
(
page
.
width_mm
*
dKoef
+
0.5
)
>>
0
;
var
h
=
(
page
.
height_mm
*
dKoef
+
0.5
)
>>
0
;
if
(
this
.
m_oWordControl
.
bIsRetinaSupport
)
if
(
this
.
m_oWordControl
.
bIsRetinaSupport
)
{
{
...
...
word/Drawing/HtmlPage.js
View file @
7fd7bae2
...
@@ -3291,8 +3291,8 @@ function CEditorPage(api)
...
@@ -3291,8 +3291,8 @@ function CEditorPage(api)
var
lStart
=
0
;
var
lStart
=
0
;
for
(
var
i
=
0
;
i
<
this
.
m_oDrawingDocument
.
m_lPagesCount
;
i
++
)
for
(
var
i
=
0
;
i
<
this
.
m_oDrawingDocument
.
m_lPagesCount
;
i
++
)
{
{
var
_pageWidth
=
parseInt
(
this
.
m_oDrawingDocument
.
m_arrPages
[
i
].
width_mm
*
dKoef
)
;
var
_pageWidth
=
(
this
.
m_oDrawingDocument
.
m_arrPages
[
i
].
width_mm
*
dKoef
+
0.5
)
>>
0
;
var
_pageHeight
=
parseInt
(
this
.
m_oDrawingDocument
.
m_arrPages
[
i
].
height_mm
*
dKoef
)
;
var
_pageHeight
=
(
this
.
m_oDrawingDocument
.
m_arrPages
[
i
].
height_mm
*
dKoef
+
0.5
)
>>
0
;
if
(
false
===
bIsFoundFirst
)
if
(
false
===
bIsFoundFirst
)
{
{
...
...
word/Editor/Field.js
View file @
7fd7bae2
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
var
fieldtype_UNKNOWN
=
0x0000
;
var
fieldtype_UNKNOWN
=
0x0000
;
var
fieldtype_MERGEFIELD
=
0x0001
;
var
fieldtype_MERGEFIELD
=
0x0001
;
var
fieldtype_PAGENUM
=
0x0002
;
/**
/**
*
*
...
...
word/Editor/Serialize2.js
View file @
7fd7bae2
...
@@ -7988,22 +7988,16 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow
...
@@ -7988,22 +7988,16 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow
//для случая гиперссылок на несколько строк в конце параграфа завершаем начатые, а начале - продолжаем незавершенные
//для случая гиперссылок на несколько строк в конце параграфа завершаем начатые, а начале - продолжаем незавершенные
if
(
this
.
aFields
.
length
>
0
)
{
if
(
this
.
aFields
.
length
>
0
)
{
for
(
var
i
=
0
;
i
<
this
.
aFields
.
length
;
++
i
)
{
for
(
var
i
=
0
;
i
<
this
.
aFields
.
length
;
++
i
)
{
var
elem
=
this
.
aFields
[
i
];
var
oField
=
this
.
aFields
[
i
];
elem
.
commitElem
=
false
;
if
(
null
!=
oField
&&
para_Hyperlink
==
oField
.
Get_Type
())
{
var
oField
=
elem
.
field
;
if
(
null
!=
oField
){
if
(
para_Hyperlink
==
oField
.
Get_Type
()){
var
oHyperlink
=
new
ParaHyperlink
();
var
oHyperlink
=
new
ParaHyperlink
();
oHyperlink
.
Set_Paragraph
(
paragraph
);
oHyperlink
.
Set_Paragraph
(
paragraph
);
oHyperlink
.
Set_Value
(
oField
.
Get_Value
());
oHyperlink
.
Set_Value
(
oField
.
Get_Value
());
oHyperlink
.
Set_ToolTip
(
oField
.
Get_ToolTip
());
oHyperlink
.
Set_ToolTip
(
oField
.
Get_ToolTip
());
oParStruct
.
addElem
(
oHyperlink
);
oParStruct
.
addElem
(
oHyperlink
);
elem
.
commitElem
=
true
;
}
else
{
}
//зануляем, чтобы когда придет fldend ничего не делать
else
if
(
para_PageNum
==
oField
.
Get_Type
()){
this
.
aFields
[
i
]
=
null
;
oParStruct
.
addElem
(
null
);
elem
.
commitElem
=
true
;
}
}
}
}
}
}
}
...
@@ -8124,18 +8118,9 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow
...
@@ -8124,18 +8118,9 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow
return
oThis
.
ReadFldSimple
(
t
,
l
,
oFldSimpleObj
,
oParStruct
);
return
oThis
.
ReadFldSimple
(
t
,
l
,
oFldSimpleObj
,
oParStruct
);
});
});
if
(
null
!=
oFldSimpleObj
.
ParaField
){
if
(
null
!=
oFldSimpleObj
.
ParaField
){
var
oField
=
oFldSimpleObj
.
ParaField
;
//чтобы не писать здесь логику для pagenum
var
nFieldType
=
oField
.
Get_Type
();
oParStruct
.
addElem
(
oFldSimpleObj
.
ParaField
);
if
(
para_PageNum
==
nFieldType
)
oParStruct
.
commitElem
();
{
var
oNewRun
=
new
ParaRun
(
oParStruct
.
paragraph
);
oNewRun
.
Add_ToContent
(
0
,
oField
);
oParStruct
.
addToContent
(
oNewRun
);
}
else
oParStruct
.
addToContent
(
oField
);
if
(
para_Field
==
nFieldType
&&
editor
)
editor
.
WordControl
.
m_oLogicDocument
.
Register_Field
(
oField
);
}
}
}
else
if
(
c_oSerParType
.
Del
==
type
)
{
}
else
if
(
c_oSerParType
.
Del
==
type
)
{
var
reviewInfo
=
new
CReviewInfo
();
var
reviewInfo
=
new
CReviewInfo
();
...
@@ -8176,19 +8161,13 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow
...
@@ -8176,19 +8161,13 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow
oFldSimpleObj
.
ParaField
=
this
.
parseField
(
Instr
,
oParStruct
.
paragraph
);
oFldSimpleObj
.
ParaField
=
this
.
parseField
(
Instr
,
oParStruct
.
paragraph
);
}
}
else
if
(
c_oSer_FldSimpleType
.
Content
===
type
)
{
else
if
(
c_oSer_FldSimpleType
.
Content
===
type
)
{
if
(
null
!=
oFldSimpleObj
.
ParaField
){
if
(
null
!=
oFldSimpleObj
.
ParaField
)
{
if
(
para_PageNum
!=
oFldSimpleObj
.
ParaField
.
Get_Type
())
{
var
oFldStruct
=
new
OpenParStruct
(
oFldSimpleObj
.
ParaField
,
oParStruct
.
Content
,
oParStruct
.
paragraph
);
var
oFldStruct
=
new
OpenParStruct
(
oFldSimpleObj
.
ParaField
,
oParStruct
.
Content
,
oParStruct
.
paragraph
);
res
=
this
.
bcr
.
Read1
(
length
,
function
(
t
,
l
)
{
res
=
this
.
bcr
.
Read1
(
length
,
function
(
t
,
l
)
{
return
oThis
.
ReadParagraphContent
(
t
,
l
,
oFldStruct
);
return
oThis
.
ReadParagraphContent
(
t
,
l
,
oFldStruct
);
});
});
oFldStruct
.
commitAll
();
oFldStruct
.
commitAll
();
}
}
else
{
else
res
=
c_oSerConstants
.
ReadUnknown
;
}
else
{
res
=
this
.
bcr
.
Read1
(
length
,
function
(
t
,
l
)
{
res
=
this
.
bcr
.
Read1
(
length
,
function
(
t
,
l
)
{
return
oThis
.
ReadParagraphContent
(
t
,
l
,
oParStruct
);
return
oThis
.
ReadParagraphContent
(
t
,
l
,
oParStruct
);
});
});
...
@@ -8398,28 +8377,19 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow
...
@@ -8398,28 +8377,19 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow
oRes
.
bRes
=
false
;
oRes
.
bRes
=
false
;
var
sField
=
this
.
stream
.
GetString2LE
(
length
);
var
sField
=
this
.
stream
.
GetString2LE
(
length
);
var
oField
=
this
.
parseField
(
sField
,
oParStruct
.
paragraph
);
var
oField
=
this
.
parseField
(
sField
,
oParStruct
.
paragraph
);
var
commitElem
=
false
;
if
(
null
!=
oField
)
{
if
(
null
!=
oField
)
{
if
(
para_PageNum
==
oField
.
Get_Type
()){
oNewElem
=
oField
;
//досрочно добавляем oPos.run потому что после oParStruct.addElem(null); он никуда не добавится
oParStruct
.
addToContent
(
oPos
.
run
);
oParStruct
.
addElem
(
null
);
}
else
oParStruct
.
addElem
(
oField
);
oParStruct
.
addElem
(
oField
);
commitElem
=
true
;
}
}
this
.
aFields
.
push
(
{
field
:
oField
,
commitElem
:
commitElem
}
);
this
.
aFields
.
push
(
oField
);
}
}
else
if
(
c_oSerRunType
.
fldend
===
type
)
else
if
(
c_oSerRunType
.
fldend
===
type
)
{
{
oRes
.
bRes
=
false
;
oRes
.
bRes
=
false
;
var
elem
=
this
.
aFields
.
pop
();
var
elem
=
this
.
aFields
.
pop
();
if
(
elem
.
commitElem
)
if
(
elem
)
{
oParStruct
.
commitElem
();
oParStruct
.
commitElem
();
}
}
}
else
if
(
c_oSerRunType
.
_LastRun
===
type
)
else
if
(
c_oSerRunType
.
_LastRun
===
type
)
this
.
oReadResult
.
bLastRun
=
true
;
this
.
oReadResult
.
bLastRun
=
true
;
else
if
(
c_oSerRunType
.
object
===
type
)
else
if
(
c_oSerRunType
.
object
===
type
)
...
@@ -8596,10 +8566,12 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow
...
@@ -8596,10 +8566,12 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, bAllow
}
}
}
}
else
if
(
"
PAGE
"
==
sFieldType
){
else
if
(
"
PAGE
"
==
sFieldType
){
oRes
=
new
ParaPageNum
(
);
oRes
=
new
ParaField
(
fieldtype_PAGENUM
,
aArguments
,
aSwitches
);
}
}
else
if
(
"
MERGEFIELD
"
==
sFieldType
){
else
if
(
"
MERGEFIELD
"
==
sFieldType
){
oRes
=
new
ParaField
(
fieldtype_MERGEFIELD
,
aArguments
,
aSwitches
);
oRes
=
new
ParaField
(
fieldtype_MERGEFIELD
,
aArguments
,
aSwitches
);
if
(
editor
)
editor
.
WordControl
.
m_oLogicDocument
.
Register_Field
(
oRes
);
}
}
return
oRes
;
return
oRes
;
}
}
...
@@ -12417,7 +12389,18 @@ CFontsCharMap.prototype =
...
@@ -12417,7 +12389,18 @@ CFontsCharMap.prototype =
this
.
CurrentFontInfo
.
CharArray
[
_find
]
=
true
;
this
.
CurrentFontInfo
.
CharArray
[
_find
]
=
true
;
}
}
}
}
function
getStyleFirstRun
(
oField
){
var
res
=
null
;
//берем первый с непустым Content, потому что в случае fldstart первым будет run fldstart
for
(
var
i
=
0
;
i
<
oField
.
Content
.
length
;
++
i
)
{
var
run
=
oField
.
Content
[
i
];
if
(
run
.
Content
.
length
>
0
)
{
res
=
run
.
Get_FirstTextPr
();
break
;
}
}
return
res
;
}
function
OpenParStruct
(
oContainer
,
Content
,
paragraph
)
{
function
OpenParStruct
(
oContainer
,
Content
,
paragraph
)
{
this
.
DocContent
=
Content
;
this
.
DocContent
=
Content
;
this
.
paragraph
=
paragraph
;
this
.
paragraph
=
paragraph
;
...
@@ -12474,8 +12457,20 @@ OpenParStruct.prototype = {
...
@@ -12474,8 +12457,20 @@ OpenParStruct.prototype = {
if
(
this
.
stack
.
length
>
1
)
{
if
(
this
.
stack
.
length
>
1
)
{
var
oPrevElem
=
this
.
stack
.
pop
();
var
oPrevElem
=
this
.
stack
.
pop
();
this
.
cur
=
this
.
stack
[
this
.
stack
.
length
-
1
];
this
.
cur
=
this
.
stack
[
this
.
stack
.
length
-
1
];
if
(
null
!=
oPrevElem
.
elem
&&
oPrevElem
.
elem
.
Content
&&
oPrevElem
.
elem
.
Content
.
length
>
0
)
var
elem
=
oPrevElem
.
elem
;
this
.
addToContent
(
oPrevElem
.
elem
);
if
(
null
!=
elem
&&
elem
.
Content
&&
elem
.
Content
.
length
>
0
)
{
if
(
para_Field
==
elem
.
Get_Type
()
&&
fieldtype_PAGENUM
==
elem
.
Get_FieldType
())
{
var
oNewRun
=
new
ParaRun
(
this
.
paragraph
);
var
rPr
=
getStyleFirstRun
(
elem
);
if
(
rPr
)
{
oNewRun
.
Set_Pr
(
rPr
);
}
oNewRun
.
Add_ToContent
(
0
,
new
ParaPageNum
());
this
.
addToContent
(
oNewRun
);
}
else
{
this
.
addToContent
(
elem
);
}
}
bRes
=
true
;
bRes
=
true
;
}
}
return
bRes
;
return
bRes
;
...
...
word/apiBuilder.js
View file @
7fd7bae2
This diff is collapsed.
Click to expand it.
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