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
65de99f7
Commit
65de99f7
authored
May 20, 2016
by
konovalovsergey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
open/save oleObj
parent
885d3717
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
204 additions
and
12 deletions
+204
-12
common/Shapes/Serialize.js
common/Shapes/Serialize.js
+159
-9
common/Shapes/SerializeWriter.js
common/Shapes/SerializeWriter.js
+45
-3
No files found.
common/Shapes/Serialize.js
View file @
65de99f7
...
...
@@ -4205,6 +4205,70 @@ function BinaryPPTYLoader()
return
def
;
}
this
.
ReadOleInfo
=
function
(
ole
)
{
var
s
=
this
.
stream
;
var
_rec_start
=
s
.
cur
;
var
_end_rec
=
_rec_start
+
s
.
GetLong
()
+
4
;
s
.
Skip2
(
1
);
// start attributes
var
dxaOrig
=
0
;
var
dyaOrig
=
0
;
while
(
true
)
{
var
_at
=
s
.
GetUChar
();
if
(
_at
==
g_nodeAttributeEnd
)
break
;
switch
(
_at
)
{
case
0
:
{
ole
.
setApplicationId
(
s
.
GetString2
());
break
;
}
case
1
:
{
ole
.
setData
(
s
.
GetString2
());
break
;
}
case
2
:
{
dxaOrig
=
s
.
GetULong
();
break
;
}
case
3
:
{
dyaOrig
=
s
.
GetULong
();
break
;
}
case
4
:
{
s
.
GetUChar
();
break
;
}
case
5
:
{
s
.
GetUChar
();
break
;
}
case
6
:
{
s
.
GetUChar
();
break
;
}
default
:
break
;
}
}
if
(
dxaOrig
>
0
&&
dyaOrig
>
0
)
{
var
ratio
=
4
/
3
/
20
;
//twips to px
ole
.
setPixSizes
(
ratio
*
dxaOrig
,
ratio
*
dyaOrig
);
}
s
.
Seek2
(
_end_rec
);
}
this
.
ReadGeometry
=
function
(
_xfrm
)
{
var
geom
=
null
;
...
...
@@ -4677,9 +4741,10 @@ function BinaryPPTYLoader()
_object
=
this
.
ReadShape
();
break
;
}
case
6
:
case
2
:
{
_object
=
this
.
ReadPic
();
_object
=
this
.
ReadPic
(
6
===
_type
);
break
;
}
case
3
:
...
...
@@ -4832,9 +4897,10 @@ function BinaryPPTYLoader()
}
break
;
}
case
6
:
case
2
:
{
_object
=
this
.
ReadPic
();
_object
=
this
.
ReadPic
(
6
===
_type
);
if
(
!
IsHiddenObj
(
_object
))
{
shape
.
addToSpTree
(
shape
.
spTree
.
length
,
_object
);
...
...
@@ -4948,9 +5014,10 @@ function BinaryPPTYLoader()
}
break
;
}
case
6
:
case
2
:
{
var
_object
=
this
.
ReadPic
();
var
_object
=
this
.
ReadPic
(
6
===
_type
);
if
(
!
IsHiddenObj
(
_object
))
{
shapes
[
shapes
.
length
]
=
_object
;
...
...
@@ -5006,11 +5073,11 @@ function BinaryPPTYLoader()
}
this
.
ReadPic
=
function
()
this
.
ReadPic
=
function
(
isOle
)
{
var
s
=
this
.
stream
;
var
pic
=
new
AscFormat
.
CImageShape
(
this
.
TempMainObject
);
var
pic
=
isOle
?
new
AscFormat
.
COleObject
(
this
.
TempMainObject
)
:
new
AscFormat
.
CImageShape
(
this
.
TempMainObject
);
pic
.
setBDeleted
(
false
);
...
...
@@ -5046,6 +5113,15 @@ function BinaryPPTYLoader()
pic
.
setStyle
(
this
.
ReadShapeStyle
());
break
;
}
case
4
:
{
if
(
isOle
)
{
this
.
ReadOleInfo
(
pic
);
}
else
{
s
.
SkipRecord
();
}
break
;
}
default
:
{
break
;
...
...
@@ -7986,9 +8062,10 @@ function CPres()
GrObject
=
this
.
ReadShape
();
break
;
}
case
6
:
case
2
:
{
GrObject
=
this
.
ReadPic
();
GrObject
=
this
.
ReadPic
(
6
==
_type
);
break
;
}
case
3
:
...
...
@@ -8349,11 +8426,11 @@ function CPres()
s
.
Seek2
(
_end_rec
);
return
shape
;
}
this
.
ReadPic
=
function
()
this
.
ReadPic
=
function
(
isOle
)
{
var
s
=
this
.
stream
;
var
pic
=
new
AscFormat
.
CImageShape
();
var
pic
=
isOle
?
new
AscFormat
.
COleObject
()
:
new
AscFormat
.
CImageShape
();
pic
.
setBDeleted
(
false
);
pic
.
setParent
(
this
.
TempMainObject
==
null
?
this
.
ParaDrawing
:
null
);
...
...
@@ -8394,6 +8471,15 @@ function CPres()
pic
.
setStyle
(
this
.
Reader
.
ReadShapeStyle
());
break
;
}
case
4
:
{
if
(
isOle
)
{
this
.
ReadOleInfo
(
pic
);
}
else
{
s
.
SkipRecord
();
}
break
;
}
default
:
{
break
;
...
...
@@ -8404,6 +8490,69 @@ function CPres()
s
.
Seek2
(
_end_rec
);
return
pic
;
}
this
.
ReadOleInfo
=
function
(
ole
)
{
var
s
=
this
.
stream
;
var
_rec_start
=
s
.
cur
;
var
_end_rec
=
_rec_start
+
s
.
GetLong
()
+
4
;
s
.
Skip2
(
1
);
// start attributes
var
dxaOrig
=
0
;
var
dyaOrig
=
0
;
while
(
true
)
{
var
_at
=
s
.
GetUChar
();
if
(
_at
==
g_nodeAttributeEnd
)
break
;
switch
(
_at
)
{
case
0
:
{
ole
.
setApplicationId
(
s
.
GetString2
());
break
;
}
case
1
:
{
ole
.
setData
(
s
.
GetString2
());
break
;
}
case
2
:
{
dxaOrig
=
s
.
GetULong
();
break
;
}
case
3
:
{
dyaOrig
=
s
.
GetULong
();
break
;
}
case
4
:
{
s
.
GetUChar
();
break
;
}
case
5
:
{
s
.
GetUChar
();
break
;
}
case
6
:
{
s
.
GetUChar
();
break
;
}
default
:
break
;
}
}
if
(
dxaOrig
>
0
&&
dyaOrig
>
0
)
{
var
ratio
=
4
/
3
/
20
;
//twips to px
ole
.
setPixSizes
(
ratio
*
dxaOrig
,
ratio
*
dyaOrig
);
}
s
.
Seek2
(
_end_rec
);
}
this
.
ReadGroupShape
=
function
()
{
var
s
=
this
.
stream
;
...
...
@@ -8461,9 +8610,10 @@ function CPres()
shape
.
addToSpTree
(
shape
.
spTree
.
length
,
sp
);
break
;
}
case
6
:
case
2
:
{
sp
=
this
.
ReadPic
();
sp
=
this
.
ReadPic
(
6
==
_type
);
sp
.
setGroup
(
shape
);
shape
.
addToSpTree
(
shape
.
spTree
.
length
,
sp
);
break
;
...
...
common/Shapes/SerializeWriter.js
View file @
65de99f7
...
...
@@ -1515,6 +1515,7 @@ function CBinaryFileWriter()
oThis
.
WriteShape
(
spTree
[
i
]);
break
;
}
case
AscDFH
.
historyitem_type_OleObject
:
case
AscDFH
.
historyitem_type_ImageShape
:
{
oThis
.
WriteImage
(
spTree
[
i
]);
...
...
@@ -2818,7 +2819,14 @@ function CBinaryFileWriter()
this
.
WriteImage
=
function
(
image
)
{
oThis
.
StartRecord
(
2
);
var
isOle
=
AscDFH
.
historyitem_type_OleObject
==
image
.
getObjectType
();
if
(
isOle
){
oThis
.
StartRecord
(
6
);
//важно писать в начале
oThis
.
WriteRecord1
(
4
,
image
,
oThis
.
WriteOleInfo
);
}
else
{
oThis
.
StartRecord
(
2
);
}
oThis
.
WriteRecord1
(
0
,
image
.
nvPicPr
,
this
.
WriteUniNvPr
);
...
...
@@ -2840,7 +2848,18 @@ function CBinaryFileWriter()
oThis
.
EndRecord
();
}
this
.
WriteOleInfo
=
function
(
ole
)
{
var
ratio
=
20
*
3
/
4
;
//px to twips
oThis
.
WriteUChar
(
g_nodeAttributeStart
);
oThis
.
_WriteString2
(
0
,
ole
.
m_sApplicationId
);
oThis
.
_WriteString2
(
1
,
ole
.
m_sData
);
oThis
.
_WriteInt2
(
2
,
ratio
*
ole
.
m_nPixWidth
);
oThis
.
_WriteInt2
(
3
,
ratio
*
ole
.
m_nPixHeight
);
oThis
.
_WriteUChar2
(
4
,
0
);
oThis
.
_WriteUChar2
(
5
,
0
);
oThis
.
WriteUChar
(
g_nodeAttributeEnd
);
}
this
.
WriteTable
=
function
(
grObj
)
{
oThis
.
StartRecord
(
5
);
...
...
@@ -3247,6 +3266,7 @@ function CBinaryFileWriter()
oThis
.
WriteShape
(
spTree
[
i
]);
break
;
}
case
AscDFH
.
historyitem_type_OleObject
:
case
AscDFH
.
historyitem_type_ImageShape
:
{
oThis
.
WriteImage
(
spTree
[
i
]);
...
...
@@ -4275,6 +4295,7 @@ function CBinaryFileWriter()
}
break
;
}
case
AscDFH
.
historyitem_type_OleObject
:
case
AscDFH
.
historyitem_type_ImageShape
:
{
this
.
WriteImage
(
grObject
);
...
...
@@ -4376,7 +4397,14 @@ function CBinaryFileWriter()
{
var
_writer
=
this
.
BinaryFileWriter
;
_writer
.
StartRecord
(
2
);
var
isOle
=
AscDFH
.
historyitem_type_OleObject
==
image
.
getObjectType
();
if
(
isOle
){
_writer
.
StartRecord
(
6
);
//важно писать в начале
_writer
.
WriteRecord1
(
4
,
image
,
_writer
.
WriteOleInfo
);
}
else
{
_writer
.
StartRecord
(
2
);
}
//_writer.WriteRecord1(0, image.nvPicPr, _writer.WriteUniNvPr);
image
.
spPr
.
WriteXfrm
=
image
.
spPr
.
xfrm
;
...
...
@@ -4408,6 +4436,19 @@ function CBinaryFileWriter()
_writer
.
EndRecord
();
}
this
.
WriteOleInfo
=
function
(
ole
)
{
var
ratio
=
20
*
3
/
4
;
//px to twips
var
_writer
=
this
.
BinaryFileWriter
;
_writer
.
WriteUChar
(
g_nodeAttributeStart
);
_writer
.
_WriteString2
(
0
,
ole
.
m_sApplicationId
);
_writer
.
_WriteString2
(
1
,
ole
.
m_sData
);
_writer
.
_WriteInt2
(
2
,
ratio
*
ole
.
m_nPixWidth
);
_writer
.
_WriteInt2
(
3
,
ratio
*
ole
.
m_nPixHeight
);
_writer
.
_WriteUChar2
(
4
,
0
);
_writer
.
_WriteUChar2
(
5
,
0
);
_writer
.
WriteUChar
(
g_nodeAttributeEnd
);
}
this
.
WriteImageBySrc
=
function
(
memory
,
src
,
w
,
h
)
{
...
...
@@ -4495,6 +4536,7 @@ function CBinaryFileWriter()
}
break
;
}
case
AscDFH
.
historyitem_type_OleObject
:
case
AscDFH
.
historyitem_type_ImageShape
:
{
this
.
WriteImage
(
elem
);
...
...
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