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
b5e5aacd
Commit
b5e5aacd
authored
Oct 27, 2017
by
Sergey Konovalov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed all stubs for FldChar
parent
97ac4291
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
91 additions
and
44 deletions
+91
-44
word/Editor/Serialize2.js
word/Editor/Serialize2.js
+91
-44
No files found.
word/Editor/Serialize2.js
View file @
b5e5aacd
...
...
@@ -391,8 +391,8 @@ var c_oSerRunType = {
image
:
6
,
table
:
7
,
Content
:
8
,
fldstart
:
9
,
flden
d
:
10
,
fldstart_deprecated
:
9
,
fldend_deprecate
d
:
10
,
CommentReference
:
11
,
pptxDrawing
:
12
,
_LastRun
:
13
,
//для копирования через бинарник
...
...
@@ -410,7 +410,10 @@ var c_oSerRunType = {
endnoteRef
:
25
,
footnoteReference
:
26
,
endnoteReference
:
27
,
arPr
:
28
arPr
:
28
,
fldChar
:
29
,
instrText
:
30
,
delInstrText
:
31
};
var
c_oSerImageType
=
{
MediaId
:
0
,
...
...
@@ -754,7 +757,8 @@ var c_oSer_HyperlinkType = {
var
c_oSer_FldSimpleType
=
{
Content
:
0
,
Instr
:
1
,
FFData
:
2
FFData
:
2
,
CharType
:
3
};
var
c_oSerProp_RevisionType
=
{
Author
:
0
,
...
...
@@ -4521,15 +4525,11 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
oThis
.
WriteParagraphContent
(
oHyperlink
,
bUseSelection
,
false
);
});
}
this
.
WriteText
=
function
(
sCurText
,
delText
)
this
.
WriteText
=
function
(
sCurText
,
type
)
{
if
(
""
!=
sCurText
)
{
if
(
delText
)
{
this
.
memory
.
WriteByte
(
c_oSerRunType
.
delText
);
}
else
{
this
.
memory
.
WriteByte
(
c_oSerRunType
.
run
);
}
this
.
memory
.
WriteByte
(
type
);
this
.
memory
.
WriteString2
(
sCurText
.
toString
());
sCurText
=
""
;
}
...
...
@@ -4611,12 +4611,20 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
oThis
.
WriteRun2
(
function
()
{
//todo не писать через fldsimple
var
num
=
elem
.
pageNum
.
Type
==
para_PageCount
?
elem
.
pageNum
.
GetPageCountValue
()
:
elem
.
pageNum
.
GetPageNumValue
();
oThis
.
WriteText
(
num
.
toString
(),
delText
);
var
textType
=
delText
?
c_oSerRunType
.
delText
:
c_oSerRunType
.
run
;
oThis
.
WriteText
(
num
.
toString
(),
textType
);
},
oRun
);
});});
}
}
}
this
.
WriteFldChar
=
function
(
fldChar
)
{
var
oThis
=
this
;
this
.
bs
.
WriteItem
(
c_oSer_FldSimpleType
.
CharType
,
function
()
{
oThis
.
memory
.
WriteByte
(
fldChar
.
CharType
);
});
};
this
.
WriteFldSimple
=
function
(
Instr
,
oFFData
,
fWriteContent
)
{
var
oThis
=
this
;
...
...
@@ -4778,14 +4786,18 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
var
Content
=
oRun
.
Content
;
var
sCurText
=
""
;
var
sCurInstrText
=
""
;
var
textType
=
delText
?
c_oSerRunType
.
delText
:
c_oSerRunType
.
run
;
var
instrTextType
=
delText
?
c_oSerRunType
.
delInstrText
:
c_oSerRunType
.
instrText
;
for
(
var
i
=
nStart
;
i
<
nEnd
&&
i
<
Content
.
length
;
++
i
)
{
var
item
=
Content
[
i
];
switch
(
item
.
Type
)
{
case
para_Text
:
sCurInstrText
=
this
.
WriteText
(
sCurInstrText
,
instrTextType
);
if
(
item
.
Is_NoBreakHyphen
())
{
sCurText
=
this
.
WriteText
(
sCurText
,
delText
);
sCurText
=
this
.
WriteText
(
sCurText
,
textType
);
oThis
.
memory
.
WriteByte
(
c_oSerRunType
.
nonBreakHyphen
);
oThis
.
memory
.
WriteLong
(
c_oSerPropLenType
.
Null
);
}
else
{
...
...
@@ -4796,12 +4808,14 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
sCurText
+=
"
"
;
break
;
case
para_Tab
:
sCurText
=
this
.
WriteText
(
sCurText
,
delText
);
sCurText
=
this
.
WriteText
(
sCurText
,
textType
);
sCurInstrText
=
this
.
WriteText
(
sCurInstrText
,
instrTextType
);
oThis
.
memory
.
WriteByte
(
c_oSerRunType
.
tab
);
oThis
.
memory
.
WriteLong
(
c_oSerPropLenType
.
Null
);
break
;
case
para_NewLine
:
sCurText
=
this
.
WriteText
(
sCurText
,
delText
);
sCurText
=
this
.
WriteText
(
sCurText
,
textType
);
sCurInstrText
=
this
.
WriteText
(
sCurInstrText
,
instrTextType
);
switch
(
item
.
BreakType
)
{
case
break_Column
:
oThis
.
memory
.
WriteByte
(
c_oSerRunType
.
columnbreak
);
...
...
@@ -4830,8 +4844,16 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
case
para_FootnoteReference
:
oThis
.
bs
.
WriteItem
(
c_oSerRunType
.
footnoteReference
,
function
()
{
oThis
.
WriteFootnoteRef
(
item
);});
break
;
case
para_FieldChar
:
oThis
.
bs
.
WriteItem
(
c_oSerRunType
.
fldChar
,
function
()
{
oThis
.
WriteFldChar
(
item
);});
break
;
case
para_InstrText
:
sCurText
=
this
.
WriteText
(
sCurText
,
textType
);
sCurInstrText
+=
AscCommon
.
encodeSurrogateChar
(
item
.
Value
);
break
;
case
para_Drawing
:
sCurText
=
this
.
WriteText
(
sCurText
,
delText
);
sCurText
=
this
.
WriteText
(
sCurText
,
textType
);
sCurInstrText
=
this
.
WriteText
(
sCurInstrText
,
instrTextType
);
//if (item.Extent && item.GraphicObj && item.GraphicObj.spPr && item.GraphicObj.spPr.xfrm) {
// item.Extent.W = item.GraphicObj.spPr.xfrm.extX;
// item.Extent.H = item.GraphicObj.spPr.xfrm.extY;
...
...
@@ -4854,7 +4876,8 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
break
;
}
}
sCurText
=
this
.
WriteText
(
sCurText
,
delText
);
sCurText
=
this
.
WriteText
(
sCurText
,
textType
);
sCurInstrText
=
this
.
WriteText
(
sCurInstrText
,
instrTextType
);
};
this
.
WriteFootnoteRef
=
function
(
footnoteReference
)
{
...
...
@@ -9456,6 +9479,17 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, curFoo
res
=
c_oSerConstants
.
ReadUnknown
;
return
res
;
};
this
.
ReadFldChar
=
function
(
type
,
length
,
oPos
)
{
var
res
=
c_oSerConstants
.
ReadOk
;
var
oThis
=
this
;
if
(
c_oSer_FldSimpleType
.
CharType
===
type
)
{
oPos
.
run
.
Add_ToContent
(
oPos
.
pos
,
new
ParaFieldChar
(
this
.
stream
.
GetUChar
()),
false
);
oPos
.
pos
++
;
}
else
res
=
c_oSerConstants
.
ReadUnknown
;
return
res
;
}
this
.
ReadFldSimple
=
function
(
type
,
length
,
oFldSimpleObj
,
oParStruct
)
{
var
res
=
c_oSerConstants
.
ReadOk
;
var
oThis
=
this
;
...
...
@@ -9652,6 +9686,34 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, curFoo
res
=
c_oSerConstants
.
ReadUnknown
;
return
res
;
};
this
.
ReadText
=
function
(
text
,
oPos
,
isInstrText
){
for
(
var
i
=
0
;
i
<
text
.
length
;
++
i
)
{
var
nUnicode
=
null
;
var
nCharCode
=
text
.
charCodeAt
(
i
);
if
(
AscCommon
.
isLeadingSurrogateChar
(
nCharCode
))
{
if
(
i
+
1
<
text
.
length
)
{
i
++
;
var
nTrailingChar
=
text
.
charCodeAt
(
i
);
nUnicode
=
AscCommon
.
decodeSurrogateChar
(
nCharCode
,
nTrailingChar
);
}
}
else
nUnicode
=
nCharCode
;
if
(
null
!==
nUnicode
)
{
if
(
0x20
!==
nUnicode
||
isInstrText
)
{
var
oNewParaText
=
isInstrText
?
new
ParaInstrText
()
:
new
ParaText
();
oNewParaText
.
Set_CharCode
(
nUnicode
);
oPos
.
run
.
Add_ToContent
(
oPos
.
pos
,
oNewParaText
,
false
);
}
else
oPos
.
run
.
Add_ToContent
(
oPos
.
pos
,
new
ParaSpace
(),
false
);
oPos
.
pos
++
;
}
}
};
this
.
ReadRunContent
=
function
(
type
,
length
,
oPos
,
oParStruct
,
oRes
)
{
var
res
=
c_oSerConstants
.
ReadOk
;
...
...
@@ -9672,32 +9734,7 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, curFoo
this
.
oCurComments
[
i
]
+=
text
;
}
for
(
var
i
=
0
;
i
<
text
.
length
;
++
i
)
{
var
nUnicode
=
null
;
var
nCharCode
=
text
.
charCodeAt
(
i
);
if
(
AscCommon
.
isLeadingSurrogateChar
(
nCharCode
))
{
if
(
i
+
1
<
text
.
length
)
{
i
++
;
var
nTrailingChar
=
text
.
charCodeAt
(
i
);
nUnicode
=
AscCommon
.
decodeSurrogateChar
(
nCharCode
,
nTrailingChar
);
}
}
else
nUnicode
=
nCharCode
;
if
(
null
!=
nUnicode
)
{
if
(
0x20
!=
nUnicode
)
{
var
oNewParaText
=
new
ParaText
();
oNewParaText
.
Set_CharCode
(
nUnicode
);
oPos
.
run
.
Add_ToContent
(
oPos
.
pos
,
oNewParaText
,
false
);
}
else
oPos
.
run
.
Add_ToContent
(
oPos
.
pos
,
new
ParaSpace
(),
false
);
oPos
.
pos
++
;
}
}
this
.
ReadText
(
text
,
oPos
,
false
);
}
else
if
(
c_oSerRunType
.
tab
===
type
)
{
...
...
@@ -9759,7 +9796,7 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, curFoo
if
(
null
!=
oDrawing
.
content
.
GraphicObj
)
oNewElem
=
oDrawing
.
content
;
}
else
if
(
c_oSerRunType
.
fldstart
===
type
)
else
if
(
c_oSerRunType
.
fldstart_deprecated
===
type
)
{
oRes
.
bRes
=
false
;
var
sField
=
this
.
stream
.
GetString2LE
(
length
);
...
...
@@ -9769,7 +9806,7 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, curFoo
}
this
.
aFields
.
push
(
oField
);
}
else
if
(
c_oSerRunType
.
flden
d
===
type
)
else
if
(
c_oSerRunType
.
fldend_deprecate
d
===
type
)
{
oRes
.
bRes
=
false
;
var
elem
=
this
.
aFields
.
pop
();
...
...
@@ -9777,6 +9814,16 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, curFoo
oParStruct
.
commitElem
();
}
}
else
if
(
c_oSerRunType
.
fldChar
===
type
)
{
res
=
this
.
bcr
.
Read1
(
length
,
function
(
t
,
l
){
return
oThis
.
ReadFldChar
(
t
,
l
,
oPos
);
});
}
else
if
(
c_oSerRunType
.
instrText
===
type
||
c_oSerRunType
.
delInstrText
===
type
)
{
this
.
ReadText
(
this
.
stream
.
GetString2LE
(
length
),
oPos
,
true
);
}
else
if
(
c_oSerRunType
.
_LastRun
===
type
)
this
.
oReadResult
.
bLastRun
=
true
;
else
if
(
c_oSerRunType
.
object
===
type
)
...
...
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