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
441584da
Commit
441584da
authored
May 23, 2017
by
SergeyLuzyanin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
opens/save connectors in presentations
parent
c4372698
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
212 additions
and
14 deletions
+212
-14
common/Shapes/Serialize.js
common/Shapes/Serialize.js
+142
-11
common/Shapes/SerializeWriter.js
common/Shapes/SerializeWriter.js
+70
-3
No files found.
common/Shapes/Serialize.js
View file @
441584da
...
...
@@ -163,6 +163,43 @@ function BinaryPPTYLoader()
this
.
textBodyTextFit
=
[];
this
.
DocReadResult
=
null
;
this
.
arr_connectors
=
[];
this
.
map_shapes_by_id
=
{};
this
.
ClearConnectorsMaps
=
function
(){
this
.
arr_connectors
.
length
=
0
;
this
.
map_shapes_by_id
=
{};
};
this
.
AssignConnectorsId
=
function
()
{
var
oPr
=
null
;
for
(
var
i
=
0
;
i
<
this
.
arr_connectors
.
length
;
++
i
){
oPr
=
this
.
arr_connectors
[
i
].
nvSpPr
.
nvUniSpPr
;
if
(
AscFormat
.
isRealNumber
(
oPr
.
stCnxId
)){
if
(
AscCommon
.
isRealObject
(
this
.
map_shapes_by_id
[
oPr
.
stCnxId
])){
oPr
.
stCnxId
=
this
.
map_shapes_by_id
[
oPr
.
stCnxId
].
Id
;
}
else
{
oPr
.
stCnxId
=
null
;
oPr
.
stCnxIdx
=
null
;
}
}
if
(
AscFormat
.
isRealNumber
(
oPr
.
endCnxId
)){
if
(
AscCommon
.
isRealObject
(
this
.
map_shapes_by_id
[
oPr
.
endCnxId
])){
oPr
.
endCnxId
=
this
.
map_shapes_by_id
[
oPr
.
endCnxId
].
Id
;
}
else
{
oPr
.
endCnxId
=
null
;
oPr
.
endCnxIdx
=
null
;
}
}
this
.
arr_connectors
[
i
].
nvSpPr
.
setUniSpPr
(
oPr
.
copy
());
}
this
.
ClearConnectorsMaps
();
};
this
.
Start_UseFullUrl
=
function
(
insertDocumentUrlsData
)
{
this
.
IsUseFullUrl
=
true
;
...
...
@@ -3563,7 +3600,9 @@ function BinaryPPTYLoader()
case
1
:
{
// SHAPES
this
.
ClearConnectorsMaps
();
csld
.
spTree
=
this
.
ReadGroupShapeMain
();
this
.
AssignConnectorsId
();
break
;
}
default
:
...
...
@@ -5094,7 +5133,7 @@ function BinaryPPTYLoader()
{
case
0
:
{
var
pr
=
this
.
ReadNvUniProp
(
shape
.
getObjectType
()
);
var
pr
=
this
.
ReadNvUniProp
(
shape
);
shape
.
setNvSpPr
(
pr
);
if
(
AscFormat
.
isRealNumber
(
pr
.
locks
))
{
...
...
@@ -5175,7 +5214,7 @@ function BinaryPPTYLoader()
{
case
0
:
{
var
pr
=
this
.
ReadNvUniProp
(
shape
.
getObjectType
()
);
var
pr
=
this
.
ReadNvUniProp
(
shape
);
shape
.
setNvSpPr
(
pr
);
if
(
AscFormat
.
isRealNumber
(
pr
.
locks
))
{
...
...
@@ -5412,7 +5451,7 @@ function BinaryPPTYLoader()
{
case
0
:
{
var
pr
=
this
.
ReadNvUniProp
(
pic
.
getObjectType
()
);
var
pr
=
this
.
ReadNvUniProp
(
pic
);
pic
.
setNvSpPr
(
pr
);
if
(
AscFormat
.
isRealNumber
(
pr
.
locks
)){
pic
.
setLocks
(
pr
.
locks
);
...
...
@@ -5461,7 +5500,7 @@ function BinaryPPTYLoader()
{
var
s
=
this
.
stream
;
var
shape
=
new
AscFormat
.
CShape
();
var
shape
=
new
AscFormat
.
C
Connection
Shape
();
shape
.
setBDeleted
(
false
);
var
_rec_start
=
s
.
cur
;
...
...
@@ -5501,7 +5540,7 @@ function BinaryPPTYLoader()
}
}
}
this
.
arr_connectors
.
push
(
shape
);
s
.
Seek2
(
_end_rec
);
return
shape
;
}
...
...
@@ -5538,7 +5577,6 @@ function BinaryPPTYLoader()
var
_nvGraphicFramePr
=
null
;
var
_xfrm
=
null
;
var
_chart
=
null
;
while
(
s
.
cur
<
_end_rec
)
{
var
_at
=
s
.
GetUChar
();
...
...
@@ -5546,7 +5584,9 @@ function BinaryPPTYLoader()
{
case
0
:
{
_nvGraphicFramePr
=
this
.
ReadNvUniProp
(
AscDFH
.
historyitem_type_GraphicFrame
);
_nvGraphicFramePr
=
this
.
ReadNvUniProp
(
AscFormat
.
ExecuteNoHistory
(
function
()
{
return
new
AscFormat
.
CGraphicFrame
();
},
this
,
[]));
break
;
}
case
1
:
...
...
@@ -5653,7 +5693,7 @@ function BinaryPPTYLoader()
{
case
0
:
{
_nvGraphicFramePr
=
this
.
ReadNvUniProp
(
AscDFH
.
historyitem_type_GraphicF
rame
);
_nvGraphicFramePr
=
this
.
ReadNvUniProp
(
_graphic_f
rame
);
break
;
}
case
1
:
...
...
@@ -5762,7 +5802,7 @@ function BinaryPPTYLoader()
return
_graphic_frame
;
}
this
.
ReadNvUniProp
=
function
(
drawing
Type
)
this
.
ReadNvUniProp
=
function
(
drawing
)
{
var
prop
=
new
AscFormat
.
UniNvPr
();
...
...
@@ -5779,6 +5819,12 @@ function BinaryPPTYLoader()
case
0
:
{
this
.
ReadCNvPr
(
prop
.
cNvPr
);
if
(
AscCommon
.
isRealObject
(
drawing
))
{
if
(
AscDFH
.
historyitem_type_Shape
===
drawing
.
getObjectType
()){
this
.
map_shapes_by_id
[
prop
.
cNvPr
.
id
]
=
drawing
;
}
}
break
;
}
case
1
:
...
...
@@ -5786,8 +5832,9 @@ function BinaryPPTYLoader()
var
end
=
s
.
cur
+
s
.
GetULong
()
+
4
;
var
locks
=
0
;
if
(
Asc
Format
.
isRealNumber
(
drawingType
))
if
(
Asc
Common
.
isRealObject
(
drawing
))
{
var
drawingType
=
drawing
.
getObjectType
();
switch
(
drawingType
)
{
case
AscDFH
.
historyitem_type_Shape
:
...
...
@@ -6045,6 +6092,90 @@ function BinaryPPTYLoader()
prop
.
locks
=
locks
;
break
;
}
case
AscDFH
.
historyitem_type_Cnx
:{
s
.
Skip2
(
1
);
// attribute start
while
(
true
)
{
var
_at2
=
s
.
GetUChar
();
if
(
_at2
==
g_nodeAttributeEnd
)
break
;
var
value
;
switch
(
_at2
)
{
case
0
:
{
value
=
s
.
GetBool
();
locks
|=
(
AscFormat
.
LOCKS_MASKS
.
noAdjustHandles
|
(
value
?
AscFormat
.
LOCKS_MASKS
.
noAdjustHandles
<<
1
:
0
));
break
;
}
case
1
:
{
value
=
s
.
GetBool
();
locks
|=
(
AscFormat
.
LOCKS_MASKS
.
noChangeArrowheads
|
(
value
?
AscFormat
.
LOCKS_MASKS
.
noChangeArrowheads
<<
1
:
0
));
break
;
}
case
2
:
{
value
=
s
.
GetBool
();
locks
|=
(
AscFormat
.
LOCKS_MASKS
.
noChangeAspect
|
(
value
?
AscFormat
.
LOCKS_MASKS
.
noChangeAspect
<<
1
:
0
));
break
;
}
case
3
:
{
value
=
s
.
GetBool
();
locks
|=
(
AscFormat
.
LOCKS_MASKS
.
noChangeShapeType
|
(
value
?
AscFormat
.
LOCKS_MASKS
.
noChangeShapeType
<<
1
:
0
));
break
;
}
case
4
:
{
value
=
s
.
GetBool
();
locks
|=
(
AscFormat
.
LOCKS_MASKS
.
noEditPoints
|
(
value
?
AscFormat
.
LOCKS_MASKS
.
noEditPoints
<<
1
:
0
));
break
;
}
case
5
:
{
value
=
s
.
GetBool
();
locks
|=
(
AscFormat
.
LOCKS_MASKS
.
noGrp
|
(
value
?
AscFormat
.
LOCKS_MASKS
.
noGrp
<<
1
:
0
));
break
;
}
case
6
:
{
value
=
s
.
GetBool
();
locks
|=
(
AscFormat
.
LOCKS_MASKS
.
noMove
|
(
value
?
AscFormat
.
LOCKS_MASKS
.
noMove
<<
1
:
0
));
break
;
}
case
7
:
{
value
=
s
.
GetBool
();
locks
|=
(
AscFormat
.
LOCKS_MASKS
.
noResize
|
(
value
?
AscFormat
.
LOCKS_MASKS
.
noResize
<<
1
:
0
));
break
;
}
case
8
:
{
value
=
s
.
GetBool
();
locks
|=
(
AscFormat
.
LOCKS_MASKS
.
noRot
|
(
value
?
AscFormat
.
LOCKS_MASKS
.
noRot
<<
1
:
0
));
break
;
}
case
9
:
{
value
=
s
.
GetBool
();
locks
|=
(
AscFormat
.
LOCKS_MASKS
.
noSelect
|
(
value
?
AscFormat
.
LOCKS_MASKS
.
noSelect
<<
1
:
0
));
break
;
}
case
10
:{
prop
.
nvUniSpPr
.
stCnxId
=
s
.
GetULong
();
break
;
}
case
11
:{
prop
.
nvUniSpPr
.
stCnxIdx
=
s
.
GetULong
();
break
;
}
case
12
:{
prop
.
nvUniSpPr
.
endCnxId
=
s
.
GetULong
();
break
;
}
case
13
:{
prop
.
nvUniSpPr
.
endCnxIdx
=
s
.
GetULong
();
break
;
}
}
}
prop
.
locks
=
locks
;
prop
.
setUniSpPr
(
prop
.
nvUniSpPr
.
copy
());
break
;
}
}
}
s
.
Seek2
(
end
);
...
...
@@ -9172,7 +9303,7 @@ function CPres()
{
var
s
=
this
.
stream
;
var
shape
=
new
AscFormat
.
CShape
(
);
var
shape
=
new
AscFormat
.
C
Connection
Shape
(
);
shape
.
setWordShape
(
true
);
shape
.
setParent
(
this
.
TempMainObject
==
null
?
this
.
ParaDrawing
:
null
);
var
_rec_start
=
s
.
cur
;
...
...
common/Shapes/SerializeWriter.js
View file @
441584da
...
...
@@ -124,6 +124,9 @@ function CBinaryFileWriter()
this
.
IsUseFullUrl
=
false
;
this
.
PresentationThemesOrigin
=
""
;
this
.
arr_connectors_pos
=
[];
this
.
max_shape_id
=
1
;
this
.
DocSaveParams
=
null
;
var
oThis
=
this
;
...
...
@@ -1539,6 +1542,7 @@ function CBinaryFileWriter()
oThis
.
StartRecord
(
2
);
oThis
.
WriteULong
(
_len
);
oThis
.
arr_connectors_pos
.
length
=
0
;
for
(
var
i
=
0
;
i
<
_len
;
i
++
)
{
oThis
.
StartRecord
(
0
);
...
...
@@ -1546,6 +1550,7 @@ function CBinaryFileWriter()
switch
(
spTree
[
i
].
getObjectType
())
{
case
AscDFH
.
historyitem_type_Shape
:
case
AscDFH
.
historyitem_type_Cnx
:
{
oThis
.
WriteShape
(
spTree
[
i
]);
break
;
...
...
@@ -1577,7 +1582,18 @@ function CBinaryFileWriter()
oThis
.
EndRecord
();
}
var
_oldPos
=
oThis
.
pos
;
for
(
var
i
=
0
;
i
<
oThis
.
arr_connectors_pos
.
length
;
++
i
){
var
oPos
=
oThis
.
arr_connectors_pos
[
i
];
var
oShape
=
AscCommon
.
g_oTableId
.
Get_ById
(
oPos
.
shapeId
);
if
(
oShape
&&
oShape
.
nvSpPr
&&
oShape
.
nvSpPr
.
cNvPr
){
oThis
.
Seek
(
oPos
.
pos
);
oThis
.
_WriteInt2
(
oPos
.
type
,
oShape
.
nvSpPr
.
cNvPr
.
id
);
}
}
oThis
.
arr_connectors_pos
.
length
=
0
;
oThis
.
Seek
(
_oldPos
);
oThis
.
EndRecord
();
}
...
...
@@ -2881,7 +2897,13 @@ function CBinaryFileWriter()
this
.
WriteShape
=
function
(
shape
)
{
oThis
.
StartRecord
(
1
);
if
(
shape
.
getObjectType
()
===
AscDFH
.
historyitem_type_Cnx
){
oThis
.
StartRecord
(
3
);
}
else
{
oThis
.
StartRecord
(
1
);
}
oThis
.
WriteUChar
(
g_nodeAttributeStart
);
oThis
.
_WriteBool2
(
0
,
shape
.
attrUseBgFill
);
...
...
@@ -3702,10 +3724,48 @@ function CBinaryFileWriter()
oThis
.
WriteUChar
(
g_nodeAttributeEnd
);
};
this
.
WriteCnxCNvPr
=
function
(
pr
){
var
locks
=
pr
.
locks
;
oThis
.
WriteUChar
(
g_nodeAttributeStart
);
if
(
locks
&
AscFormat
.
LOCKS_MASKS
.
noAdjustHandles
)
oThis
.
_WriteBool2
(
0
,
!!
(
locks
&
(
AscFormat
.
LOCKS_MASKS
.
noAdjustHandles
<<
1
)));
if
(
locks
&
AscFormat
.
LOCKS_MASKS
.
noChangeArrowheads
)
oThis
.
_WriteBool2
(
1
,
!!
(
locks
&
(
AscFormat
.
LOCKS_MASKS
.
noChangeArrowheads
<<
1
)));
if
(
locks
&
AscFormat
.
LOCKS_MASKS
.
noChangeAspect
)
oThis
.
_WriteBool2
(
2
,
!!
(
locks
&
(
AscFormat
.
LOCKS_MASKS
.
noChangeAspect
<<
1
)));
if
(
locks
&
AscFormat
.
LOCKS_MASKS
.
noChangeShapeType
)
oThis
.
_WriteBool2
(
3
,
!!
(
locks
&
(
AscFormat
.
LOCKS_MASKS
.
noChangeShapeType
<<
1
)));
if
(
locks
&
AscFormat
.
LOCKS_MASKS
.
noEditPoints
)
oThis
.
_WriteBool2
(
4
,
!!
(
locks
&
(
AscFormat
.
LOCKS_MASKS
.
noEditPoints
<<
1
)));
if
(
locks
&
AscFormat
.
LOCKS_MASKS
.
noGrp
)
oThis
.
_WriteBool2
(
5
,
!!
(
locks
&
(
AscFormat
.
LOCKS_MASKS
.
noGrp
<<
1
)));
if
(
locks
&
AscFormat
.
LOCKS_MASKS
.
noMove
)
oThis
.
_WriteBool2
(
6
,
!!
(
locks
&
(
AscFormat
.
LOCKS_MASKS
.
noMove
<<
1
)));
if
(
locks
&
AscFormat
.
LOCKS_MASKS
.
noResize
)
oThis
.
_WriteBool2
(
7
,
!!
(
locks
&
(
AscFormat
.
LOCKS_MASKS
.
noResize
<<
1
)));
if
(
locks
&
AscFormat
.
LOCKS_MASKS
.
noRot
)
oThis
.
_WriteBool2
(
8
,
!!
(
locks
&
(
AscFormat
.
LOCKS_MASKS
.
noRot
<<
1
)));
if
(
locks
&
AscFormat
.
LOCKS_MASKS
.
noSelect
)
oThis
.
_WriteBool2
(
9
,
!!
(
locks
&
(
AscFormat
.
LOCKS_MASKS
.
noSelect
<<
1
)));
if
(
pr
.
stCnxId
&&
AscFormat
.
isRealNumber
(
pr
.
stCnxIdx
)){
oThis
.
arr_connectors_pos
.
push
({
pos
:
oThis
.
pos
,
shapeId
:
pr
.
stCnxId
,
type
:
10
});
oThis
.
_WriteInt2
(
10
,
-
1
);
oThis
.
_WriteInt2
(
11
,
pr
.
stCnxIdx
);
}
if
(
pr
.
endCnxId
&&
AscFormat
.
isRealNumber
(
pr
.
endCnxIdx
)){
oThis
.
arr_connectors_pos
.
push
({
pos
:
oThis
.
pos
,
shapeId
:
pr
.
endCnxId
,
type
:
12
});
oThis
.
_WriteInt2
(
12
,
-
1
);
oThis
.
_WriteInt2
(
13
,
pr
.
endCnxIdx
);
}
oThis
.
WriteUChar
(
g_nodeAttributeEnd
);
};
this
.
WriteUniNvPr
=
function
(
nv
)
{
oThis
.
WriteRecord2
(
0
,
nv
.
cNvPr
,
oThis
.
Write_cNvPr
);
if
(
AscFormat
.
isRealNumber
(
nv
.
locks
)
&&
nv
.
locks
!==
0
&&
AscFormat
.
isRealNumber
(
nv
.
objectType
))
if
(
AscFormat
.
isRealNumber
(
nv
.
locks
)
&&
(
nv
.
locks
!==
0
||
nv
.
nvUniSpPr
)
&&
AscFormat
.
isRealNumber
(
nv
.
objectType
))
{
switch
(
nv
.
objectType
)
{
...
...
@@ -3730,6 +3790,12 @@ function CBinaryFileWriter()
oThis
.
WriteRecord1
(
1
,
nv
.
locks
,
oThis
.
WriteGrFrameCNvPr
);
break
;
}
case
AscDFH
.
historyitem_type_Cnx
:
{
nv
.
nvUniSpPr
.
locks
=
nv
.
locks
;
oThis
.
WriteRecord1
(
1
,
nv
.
nvUniSpPr
,
oThis
.
WriteCnxCNvPr
);
break
;
}
}
}
nv
.
locks
=
null
;
...
...
@@ -3740,6 +3806,7 @@ function CBinaryFileWriter()
this
.
Write_cNvPr
=
function
(
cNvPr
)
{
oThis
.
WriteUChar
(
g_nodeAttributeStart
);
cNvPr
.
id
=
++
oThis
.
max_shape_id
;
oThis
.
_WriteInt1
(
0
,
cNvPr
.
id
);
oThis
.
_WriteString1
(
1
,
cNvPr
.
name
);
oThis
.
_WriteBool1
(
2
,
cNvPr
.
isHidden
);
...
...
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