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
97cacc45
Commit
97cacc45
authored
Jul 01, 2016
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved some code into separate function
parent
2074c0f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
60 deletions
+50
-60
cell/model/clipboard.js
cell/model/clipboard.js
+50
-60
No files found.
cell/model/clipboard.js
View file @
97cacc45
...
...
@@ -845,36 +845,8 @@
var
insertContent
=
new
CSelectedContent
();
var
target_doc_content
=
isIntoShape
;
var
elements
=
[],
selectedElement
,
element
,
drawings
=
[],
pDrawings
=
[],
drawingCopyObject
;
for
(
var
i
=
0
;
i
<
pasteData
.
content
.
length
;
++
i
)
{
selectedElement
=
new
CSelectedElement
();
element
=
pasteData
.
content
[
i
];
if
(
type_Paragraph
==
element
.
GetType
())
//paragraph
{
selectedElement
.
Element
=
AscFormat
.
ConvertParagraphToPPTX
(
element
);
elements
.
push
(
selectedElement
);
}
else
if
(
type_Table
==
element
.
GetType
())
//table
{
//TODO вырезать из таблицы параграфы
}
}
insertContent
.
Elements
=
elements
;
var
paragraph
=
target_doc_content
.
Content
[
target_doc_content
.
CurPos
.
ContentPos
];
if
(
null
!=
paragraph
&&
type_Paragraph
==
paragraph
.
GetType
())
{
var
NearPos
=
{
Paragraph
:
paragraph
,
ContentPos
:
paragraph
.
Get_ParaContentPos
(
false
,
false
)};
paragraph
.
Check_NearestPos
(
NearPos
);
target_doc_content
.
Insert_Content
(
insertContent
,
NearPos
);
var
oTargetTextObject
=
AscFormat
.
getTargetTextObject
(
worksheet
.
objectRender
.
controller
);
oTargetTextObject
&&
oTargetTextObject
.
checkExtentsByDocContent
&&
oTargetTextObject
.
checkExtentsByDocContent
();
worksheet
.
objectRender
.
controller
.
startRecalculate
();
}
insertContent
.
Elements
=
this
.
_convertBeforeInsertIntoShapeContent
(
pasteData
.
content
,
true
);
this
.
_insertSelectedContentIntoShapeContent
(
worksheet
,
insertContent
,
target_doc_content
);
}
else
{
...
...
@@ -907,37 +879,9 @@
var
pasteData
=
this
.
ReadPresentationText
(
stream
,
worksheet
);
var
insertContent
=
new
CSelectedContent
();
var
target_doc_content
=
isIntoShape
;
var
elements
=
[],
selectedElement
,
element
;
for
(
var
i
=
0
;
i
<
pasteData
.
length
;
++
i
)
{
selectedElement
=
new
CSelectedElement
();
element
=
pasteData
[
i
];
if
(
type_Paragraph
==
element
.
GetType
())
//paragraph
{
selectedElement
.
Element
=
element
;
elements
.
push
(
selectedElement
);
}
else
if
(
type_Table
==
element
.
GetType
())
//table
{
//TODO вырезать из таблицы параграфы
}
}
insertContent
.
Elements
=
elements
;
var
paragraph
=
target_doc_content
.
Content
[
target_doc_content
.
CurPos
.
ContentPos
];
if
(
null
!=
paragraph
&&
type_Paragraph
==
paragraph
.
GetType
())
{
var
NearPos
=
{
Paragraph
:
paragraph
,
ContentPos
:
paragraph
.
Get_ParaContentPos
(
false
,
false
)};
paragraph
.
Check_NearestPos
(
NearPos
);
target_doc_content
.
Insert_Content
(
insertContent
,
NearPos
);
var
oTargetTextObject
=
AscFormat
.
getTargetTextObject
(
worksheet
.
objectRender
.
controller
);
oTargetTextObject
&&
oTargetTextObject
.
checkExtentsByDocContent
&&
oTargetTextObject
.
checkExtentsByDocContent
();
worksheet
.
objectRender
.
controller
.
startRecalculate
();
}
insertContent
.
Elements
=
this
.
_convertBeforeInsertIntoShapeContent
(
pasteData
);
this
.
_insertSelectedContentIntoShapeContent
(
worksheet
,
insertContent
,
target_doc_content
);
return
true
;
}
...
...
@@ -1012,6 +956,52 @@
return
false
;
},
_convertBeforeInsertIntoShapeContent
:
function
(
content
,
isConvertToPPTX
)
{
var
elements
=
[],
selectedElement
,
element
;
for
(
var
i
=
0
;
i
<
content
.
length
;
i
++
)
{
selectedElement
=
new
CSelectedElement
();
element
=
content
[
i
];
if
(
type_Paragraph
==
element
.
GetType
())
//paragraph
{
if
(
isConvertToPPTX
)
{
selectedElement
.
Element
=
AscFormat
.
ConvertParagraphToPPTX
(
element
);
}
else
{
selectedElement
.
Element
=
element
;
}
elements
.
push
(
selectedElement
);
}
else
if
(
type_Table
==
element
.
GetType
())
//table
{
//TODO вырезать из таблицы параграфы
}
}
return
elements
;
},
_insertSelectedContentIntoShapeContent
:
function
(
worksheet
,
selectedContent
,
target_doc_content
)
{
var
paragraph
=
target_doc_content
.
Content
[
target_doc_content
.
CurPos
.
ContentPos
];
if
(
null
!=
paragraph
&&
type_Paragraph
==
paragraph
.
GetType
()
&&
selectedContent
.
Elements
&&
selectedContent
.
Elements
.
length
)
{
var
NearPos
=
{
Paragraph
:
paragraph
,
ContentPos
:
paragraph
.
Get_ParaContentPos
(
false
,
false
)};
paragraph
.
Check_NearestPos
(
NearPos
);
target_doc_content
.
Insert_Content
(
selectedContent
,
NearPos
);
var
oTargetTextObject
=
AscFormat
.
getTargetTextObject
(
worksheet
.
objectRender
.
controller
);
oTargetTextObject
&&
oTargetTextObject
.
checkExtentsByDocContent
&&
oTargetTextObject
.
checkExtentsByDocContent
();
worksheet
.
objectRender
.
controller
.
startRecalculate
();
}
},
_insertImagesFromBinary
:
function
(
ws
,
data
,
isIntoShape
)
{
var
activeRange
=
ws
.
activeRange
;
...
...
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