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
9bfb5710
Commit
9bfb5710
authored
Nov 17, 2016
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug 33420
parent
a6c4c975
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
152 additions
and
57 deletions
+152
-57
cell/model/clipboard.js
cell/model/clipboard.js
+92
-45
common/Drawings/Format/Shape.js
common/Drawings/Format/Shape.js
+5
-1
common/wordcopypaste.js
common/wordcopypaste.js
+55
-11
No files found.
cell/model/clipboard.js
View file @
9bfb5710
...
...
@@ -847,16 +847,25 @@
}
else
if
(
!
(
window
[
"
Asc
"
][
"
editor
"
]
&&
window
[
"
Asc
"
][
"
editor
"
].
isChartEditor
))
{
if
(
aPastedImages
&&
aPastedImages
.
length
)
{
t
.
_loadImagesOnServer
(
aPastedImages
,
function
()
{
t
.
_insertImagesFromBinary
(
worksheet
,
pasteData
,
isIntoShape
);
});
}
else
{
t
.
_insertImagesFromBinary
(
worksheet
,
pasteData
,
isIntoShape
);
}
var
newFonts
=
{};
for
(
var
i
=
0
;
i
<
pasteData
.
Drawings
.
length
;
i
++
)
{
pasteData
.
Drawings
[
i
].
graphicObject
.
getAllFonts
(
newFonts
);
}
worksheet
.
_loadFonts
(
newFonts
,
function
()
{
if
(
aPastedImages
&&
aPastedImages
.
length
)
{
t
.
_loadImagesOnServer
(
aPastedImages
,
function
()
{
t
.
_insertImagesFromBinary
(
worksheet
,
pasteData
,
isIntoShape
);
});
}
else
{
t
.
_insertImagesFromBinary
(
worksheet
,
pasteData
,
isIntoShape
);
}
});
}
}
else
...
...
@@ -988,11 +997,16 @@
var
objects
=
this
.
ReadPresentationShapes
(
stream
,
worksheet
);
var
arr_shapes
=
objects
.
arrShapes
;
if
(
arr_shapes
&&
arr_shapes
.
length
)
if
(
arr_shapes
&&
arr_shapes
.
length
&&
!
(
window
[
"
Asc
"
][
"
editor
"
]
&&
window
[
"
Asc
"
][
"
editor
"
].
isChartEditor
)
)
{
var
aPastedImages
=
objects
.
arrImages
;
if
(
!
(
window
[
"
Asc
"
][
"
editor
"
]
&&
window
[
"
Asc
"
][
"
editor
"
].
isChartEditor
)
)
var
newFonts
=
{}
;
for
(
var
i
=
0
;
i
<
arr_shapes
.
length
;
i
++
)
{
arr_shapes
[
i
].
graphicObject
.
getAllFonts
(
newFonts
);
}
var
aPastedImages
=
objects
.
arrImages
;
worksheet
.
_loadFonts
(
newFonts
,
function
()
{
if
(
aPastedImages
&&
aPastedImages
.
length
)
{
t
.
_loadImagesOnServer
(
aPastedImages
,
function
()
{
...
...
@@ -1000,8 +1014,10 @@
});
}
else
{
t
.
_insertImagesFromBinary
(
worksheet
,
{
Drawings
:
arr_shapes
},
isIntoShape
);
}
}
});
}
return
true
;
...
...
@@ -1664,18 +1680,26 @@
//определяем стартовую позицию, если изображений несколько вставляется
for
(
var
i
=
0
;
i
<
addImagesFromWord
.
length
;
i
++
)
{
graphicObject
=
addImagesFromWord
[
i
].
image
.
GraphicObj
;
if
(
para_Math
===
addImagesFromWord
[
i
].
image
.
Type
)
{
graphicObject
=
ws
.
objectRender
.
createShapeAndInsertContent
(
addImagesFromWord
[
i
].
image
);
}
else
{
graphicObject
=
addImagesFromWord
[
i
].
image
.
GraphicObj
;
//convert from word
if
(
graphicObject
.
setBDeleted2
)
{
graphicObject
.
setBDeleted2
(
true
);
}
else
{
graphicObject
.
bDeleted
=
true
;
}
graphicObject
=
graphicObject
.
convertToPPTX
(
ws
.
model
.
DrawingDocument
,
ws
.
model
);
}
//convert from word
if
(
graphicObject
.
setBDeleted2
)
{
graphicObject
.
setBDeleted2
(
true
);
}
else
{
graphicObject
.
bDeleted
=
true
;
}
graphicObject
=
graphicObject
.
convertToPPTX
(
ws
.
model
.
DrawingDocument
,
ws
.
model
);
//create new drawingBase
drawingObject
=
ws
.
objectRender
.
createDrawingObject
();
...
...
@@ -2584,8 +2608,8 @@
this
.
aResult
.
props
.
fontsNew
=
this
.
fontsNew
;
this
.
aResult
.
props
.
rowSpanSpCount
=
0
;
this
.
aResult
.
props
.
cellCount
=
coverDocument
.
width
;
this
.
aResult
.
props
.
_images
=
pasteData
.
images
?
pasteData
.
images
:
this
.
aResult
.
props
.
_images
;
this
.
aResult
.
props
.
_aPastedImages
=
pasteData
.
aPastedImages
?
pasteData
.
aPastedImages
:
this
.
aResult
.
props
.
_aPastedImages
;
this
.
aResult
.
props
.
_images
=
pasteData
.
images
&&
pasteData
.
images
.
length
?
pasteData
.
images
:
this
.
aResult
.
props
.
_images
;
this
.
aResult
.
props
.
_aPastedImages
=
pasteData
.
aPastedImages
&&
pasteData
.
aPastedImages
.
length
?
pasteData
.
aPastedImages
:
this
.
aResult
.
props
.
_aPastedImages
;
worksheet
.
setSelectionInfo
(
'
paste
'
,
this
.
aResult
,
this
);
},
...
...
@@ -2766,7 +2790,7 @@
{
s
=
this
.
_parseParaRun
(
content
[
n
],
oNewItem
,
paraPr
,
s
,
row
,
c1
,
text
);
break
;
}
;
}
case
para_Hyperlink
:
//*hyperLink*
{
//если несколько ссылок в одном параграфе, то отменяем ссылки
...
...
@@ -2793,13 +2817,36 @@
{
s
=
this
.
_parseParaRun
(
content
[
n
].
Content
[
h
],
oNewItem
,
paraPr
,
s
,
row
,
c1
,
text
);
break
;
}
;
}
;
}
;
}
}
}
break
;
};
};
};
}
case
para_Math
:
//*para_Math*
{
var
tempFonts
=
[];
content
[
n
].
Get_AllFontNames
(
tempFonts
);
for
(
var
i
in
tempFonts
)
{
this
.
fontsNew
[
i
]
=
1
;
}
if
(
!
aResult
.
props
.
addImagesFromWord
)
{
aResult
.
props
.
addImagesFromWord
=
[];
}
aResult
.
props
.
addImagesFromWord
.
push
({
image
:
content
[
n
],
col
:
s
+
c1
,
row
:
row
});
if
(
null
===
this
.
isUsuallyPutImages
)
{
this
.
_addImageToMap
(
content
[
n
]);
}
break
;
}
}
}
},
...
...
@@ -2826,14 +2873,12 @@
{
text
+=
String
.
fromCharCode
(
paraRunContent
[
pR
].
Value
);
break
;
};
}
case
para_Space
:
//*paraSpace*
{
text
+=
"
"
;
break
;
};
}
case
para_Tab
:
//*paraEnd / paraTab*
{
this
.
fontsNew
[
paragraphFontFamily
]
=
1
;
...
...
@@ -2853,8 +2898,7 @@
s
++
;
break
;
};
}
case
para_Drawing
:
{
if
(
!
aResult
.
props
.
addImagesFromWord
)
...
...
@@ -2863,8 +2907,9 @@
if
(
null
===
this
.
isUsuallyPutImages
)
this
.
_addImageToMap
(
paraRunContent
[
pR
]);
};
break
;
}
case
para_End
:
{
var
cell
=
aResult
.
getCell
(
row
,
s
+
c1
);
...
...
@@ -2876,9 +2921,11 @@
aResult
.
content
=
checkMaxTextLength
.
aResult
.
content
;
this
.
maxLengthRowCount
+=
checkMaxTextLength
.
r
-
row
;
}
};
break
;
}
}
}
;
}
if
(
text
!=
""
)
{
...
...
@@ -2893,7 +2940,7 @@
cloneNewItem
=
oNewItem
.
clone
();
text
=
""
;
}
;
}
return
s
;
},
...
...
common/Drawings/Format/Shape.js
View file @
9bfb5710
...
...
@@ -260,7 +260,7 @@ function CopyRunToPPTX(Run, Paragraph, bHyper)
return
NewRun
;
}
function
ConvertParagraphToPPTX
(
paragraph
,
drawingDocument
,
newParent
)
function
ConvertParagraphToPPTX
(
paragraph
,
drawingDocument
,
newParent
,
bIsAddMath
)
{
var
_drawing_document
=
isRealObject
(
drawingDocument
)
?
drawingDocument
:
paragraph
.
DrawingDocument
;
var
_new_parent
=
isRealObject
(
newParent
)
?
newParent
:
paragraph
.
Parent
;
...
...
@@ -310,6 +310,10 @@ function ConvertParagraphToPPTX(paragraph, drawingDocument, newParent)
{
new_paragraph
.
Internal_Content_Add
(
new_paragraph
.
Content
.
length
,
ConvertHyperlinkToPPTX
(
Item
,
new_paragraph
),
false
);
}
else
if
(
true
===
bIsAddMath
&&
Item
.
Type
===
para_Math
)
{
new_paragraph
.
Internal_Content_Add
(
new_paragraph
.
Content
.
length
,
Item
,
false
);
}
}
var
EndRun
=
new
ParaRun
(
new_paragraph
);
EndRun
.
Add_ToContent
(
0
,
new
ParaEnd
()
);
...
...
common/wordcopypaste.js
View file @
9bfb5710
...
...
@@ -2585,7 +2585,7 @@ PasteProcessor.prototype =
element
.
Get_AllDrawingObjects
(
drawings
);
if
(
type_Paragraph
==
element
.
GetType
())
//paragraph
{
selectedElement
.
Element
=
AscFormat
.
ConvertParagraphToPPTX
(
element
);
selectedElement
.
Element
=
AscFormat
.
ConvertParagraphToPPTX
(
element
,
null
,
null
,
true
);
elements
.
push
(
selectedElement
);
}
else
if
(
type_Table
==
element
.
GetType
())
//table
...
...
@@ -2738,6 +2738,11 @@ PasteProcessor.prototype =
case
"
Content
"
:
{
var
docContent
=
this
.
ReadPresentationText
(
stream
);
for
(
var
i
in
this
.
oFonts
)
{
fonts
.
push
(
new
CFont
(
i
,
0
,
""
,
0
));
}
var
aContent
=
[];
for
(
var
i
=
0
;
i
<
docContent
.
length
;
i
++
)
{
...
...
@@ -2745,7 +2750,7 @@ PasteProcessor.prototype =
}
this
.
aContent
=
aContent
;
oThis
.
api
.
pre_Paste
(
aContent
.
fonts
,
aContent
.
images
,
fPrepasteCallback
);
oThis
.
api
.
pre_Paste
(
fonts
,
aContent
.
images
,
fPrepasteCallback
);
return
;
}
case
"
Drawings
"
:
...
...
@@ -2755,6 +2760,8 @@ PasteProcessor.prototype =
var
objects
=
this
.
ReadPresentationShapes
(
stream
);
History
.
TurnOn
();
var
font_map
=
{};
var
arr_shapes
=
objects
.
arrShapes
;
//****если записана одна табличка, то вставляем html и поддерживаем все цвета и стили****
if
(
!
objects
.
arrImages
.
length
&&
objects
.
arrShapes
.
length
===
1
&&
objects
.
arrShapes
[
0
]
&&
objects
.
arrShapes
[
0
].
Drawing
&&
objects
.
arrShapes
[
0
].
Drawing
.
graphicObject
)
...
...
@@ -2765,13 +2772,20 @@ PasteProcessor.prototype =
{
var
aContent
=
[];
var
table
=
AscFormat
.
ConvertGraphicFrameToWordTable
(
drawing
,
this
.
oLogicDocument
);
table
.
Document_Get_AllFontNames
(
font_map
);
//перебираем шрифты
for
(
var
i
in
font_map
)
{
fonts
.
push
(
new
CFont
(
i
,
0
,
""
,
0
));
}
//TODO стиль не прокидывается. в будущем нужно реализовать
table
.
TableStyle
=
null
;
aContent
.
push
(
table
);
this
.
aContent
=
aContent
;
oThis
.
api
.
pre_Paste
(
aContent
.
fonts
,
aContent
.
images
,
fPrepasteCallback
);
oThis
.
api
.
pre_Paste
(
fonts
,
aContent
.
images
,
fPrepasteCallback
);
return
;
}
...
...
@@ -2796,6 +2810,24 @@ PasteProcessor.prototype =
}
}
}
//get fonts from shapes
var
images
=
[];
for
(
var
i
=
0
;
i
<
objects
.
arrShapes
.
length
;
++
i
)
{
if
(
objects
.
arrShapes
[
i
].
Drawing
.
getAllFonts
)
{
objects
.
arrShapes
[
i
].
Drawing
.
getAllFonts
(
font_map
);
}
/*if(objects.arrShapes[i].Drawing.getAllImages)
objects.arrShapes[i].Drawing.getAllImages(images);*/
}
//перебираем шрифты
for
(
var
i
in
font_map
)
{
fonts
.
push
(
new
CFont
(
i
,
0
,
""
,
0
));
}
//в конце добавляем ссылки на wmf, ole
for
(
var
i
=
0
;
i
<
objects
.
arrImages
.
length
;
++
i
)
{
...
...
@@ -2840,7 +2872,7 @@ PasteProcessor.prototype =
aContent
=
oThis
.
_convertExcelBinary
(
null
,
arr_shapes
);
oThis
.
aContent
=
aContent
.
content
;
oThis
.
api
.
pre_Paste
(
aContent
.
fonts
,
image_map
,
fPrepasteCallback
);
oThis
.
api
.
pre_Paste
(
fonts
,
image_map
,
fPrepasteCallback
);
});
return
;
...
...
@@ -2932,9 +2964,10 @@ PasteProcessor.prototype =
//shape.getAllFonts(font_map);
//перебираем шрифты
var
fonts
=
[];
for
(
var
i
in
font_map
)
for
(
var
i
in
this
.
oFonts
)
{
fonts
.
push
(
new
CFont
(
i
,
0
,
""
,
0
));
}
//вставка
var
paste_callback
=
function
()
...
...
@@ -3516,6 +3549,7 @@ PasteProcessor.prototype =
aContent
=
[];
var
font_map
=
{};
//из excel в word они вставляются в один параграф
for
(
var
i
=
0
;
i
<
drawings
.
length
;
i
++
)
{
...
...
@@ -3552,6 +3586,8 @@ PasteProcessor.prototype =
copyObj
.
Set_Parent
(
this
.
oDocument
);
aContent
[
aContent
.
length
]
=
copyObj
;
drawing
.
setWordFlag
(
true
);
drawing
.
getAllFonts
(
font_map
);
}
else
{
...
...
@@ -3561,7 +3597,8 @@ PasteProcessor.prototype =
extX
=
drawings
[
i
].
ExtX
;
extY
=
drawings
[
i
].
ExtY
;
graphicObj
=
drawing
.
graphicObject
?
drawing
.
graphicObject
.
convertToWord
(
this
.
oLogicDocument
)
:
drawing
.
convertToWord
(
this
.
oLogicDocument
)
;
drawing
.
getAllFonts
(
font_map
);
graphicObj
=
drawing
.
graphicObject
?
drawing
.
graphicObject
.
convertToWord
(
this
.
oLogicDocument
)
:
drawing
.
convertToWord
(
this
.
oLogicDocument
);
tempParaRun
=
new
ParaRun
();
tempParaRun
.
Paragraph
=
null
;
...
...
@@ -3581,6 +3618,12 @@ PasteProcessor.prototype =
}
}
fonts
=
[];
for
(
var
i
in
font_map
)
{
fonts
.
push
(
new
CFont
(
i
,
0
,
""
,
0
));
}
if
(
tempParagraph
)
aContent
[
aContent
.
length
]
=
tempParagraph
;
}
...
...
@@ -4036,12 +4079,13 @@ PasteProcessor.prototype =
{
loader
.
stream
.
Skip2
(
1
);
// must be 0
paragraph
=
loader
.
ReadParagraph
(
newDocContent
);
selectedElement
=
new
CSelectedElement
();
selectedElement
.
Element
=
paragraph
;
//FONTS
paragraph
.
Document_Get_AllFontNames
(
this
.
oFonts
)
selectedElement
=
new
CSelectedElement
();
selectedElement
.
Element
=
paragraph
;
elements
.
push
(
selectedElement
);
//shape.txBody.content.Internal_Content_Add(shape.txBody.content.Content.length, _paragraph);
}
return
elements
;
},
...
...
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