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
08709a29
Commit
08709a29
authored
Jan 27, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete last pasted images before special paste
parent
7df8b4a4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
172 additions
and
145 deletions
+172
-145
cell/model/clipboard.js
cell/model/clipboard.js
+156
-140
cell/view/WorksheetView.js
cell/view/WorksheetView.js
+16
-5
No files found.
cell/model/clipboard.js
View file @
08709a29
...
@@ -298,6 +298,7 @@
...
@@ -298,6 +298,7 @@
if
(
null
===
this
.
specialPasteProps
)
if
(
null
===
this
.
specialPasteProps
)
{
{
window
[
'
AscCommon
'
].
g_clipboardBase
.
specialPasteData
.
activeRange
=
ws
.
model
.
selectionRange
.
clone
(
ws
.
model
);
window
[
'
AscCommon
'
].
g_clipboardBase
.
specialPasteData
.
activeRange
=
ws
.
model
.
selectionRange
.
clone
(
ws
.
model
);
window
[
'
AscCommon
'
].
g_clipboardBase
.
specialPasteUndoData
.
images
=
[];
}
}
switch
(
_format
)
switch
(
_format
)
...
@@ -1496,6 +1497,12 @@
...
@@ -1496,6 +1497,12 @@
drawingObject
.
graphicObject
.
checkRemoveCache
&&
drawingObject
.
graphicObject
.
checkRemoveCache
();
drawingObject
.
graphicObject
.
checkRemoveCache
&&
drawingObject
.
graphicObject
.
checkRemoveCache
();
drawingObject
.
graphicObject
.
addToDrawingObjects
();
drawingObject
.
graphicObject
.
addToDrawingObjects
();
if
(
i
===
0
)
{
window
[
'
AscCommon
'
].
g_clipboardBase
.
specialPasteUndoData
.
images
=
[];
}
window
[
'
AscCommon
'
].
g_clipboardBase
.
specialPasteUndoData
.
images
.
push
(
drawingObject
.
graphicObject
.
Id
);
if
(
drawingObject
.
graphicObject
.
checkDrawingBaseCoords
)
if
(
drawingObject
.
graphicObject
.
checkDrawingBaseCoords
)
{
{
drawingObject
.
graphicObject
.
checkDrawingBaseCoords
();
drawingObject
.
graphicObject
.
checkDrawingBaseCoords
();
...
@@ -1530,6 +1537,153 @@
...
@@ -1530,6 +1537,153 @@
}
}
},
},
_insertImagesFromBinaryWord
:
function
(
ws
,
data
,
aImagesSync
)
{
var
activeRange
=
ws
.
model
.
selectionRange
.
getLast
().
clone
();
var
curCol
,
drawingObject
,
curRow
,
startCol
=
0
,
startRow
=
0
,
xfrm
,
drawingBase
,
graphicObject
,
offX
,
offY
,
rot
;
History
.
Create_NewPoint
();
History
.
StartTransaction
();
var
api
=
window
[
"
Asc
"
][
"
editor
"
];
var
addImagesFromWord
=
data
.
props
.
addImagesFromWord
;
//определяем стартовую позицию, если изображений несколько вставляется
for
(
var
i
=
0
;
i
<
addImagesFromWord
.
length
;
i
++
)
{
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
,
true
);
}
//create new drawingBase
drawingObject
=
ws
.
objectRender
.
createDrawingObject
();
drawingObject
.
graphicObject
=
graphicObject
;
if
(
drawingObject
.
graphicObject
.
spPr
&&
drawingObject
.
graphicObject
.
spPr
.
xfrm
)
{
xfrm
=
drawingObject
.
graphicObject
.
spPr
.
xfrm
;
offX
=
0
;
offY
=
0
;
rot
=
AscFormat
.
isRealNumber
(
xfrm
.
rot
)
?
xfrm
.
rot
:
0
;
rot
=
AscFormat
.
normalizeRotate
(
rot
);
if
(
AscFormat
.
checkNormalRotate
(
rot
))
{
if
(
AscFormat
.
isRealNumber
(
xfrm
.
offX
)
&&
AscFormat
.
isRealNumber
(
xfrm
.
offY
))
{
offX
=
xfrm
.
offX
;
offY
=
xfrm
.
offY
;
}
}
else
{
if
(
AscFormat
.
isRealNumber
(
xfrm
.
offX
)
&&
AscFormat
.
isRealNumber
(
xfrm
.
offY
)
&&
AscFormat
.
isRealNumber
(
xfrm
.
extX
)
&&
AscFormat
.
isRealNumber
(
xfrm
.
extY
))
{
offX
=
xfrm
.
offX
+
xfrm
.
extX
/
2
-
xfrm
.
extY
/
2
;
offY
=
xfrm
.
offY
+
xfrm
.
extY
/
2
-
xfrm
.
extX
/
2
;
}
}
if
(
i
==
0
)
{
startCol
=
offX
;
startRow
=
offY
;
}
else
{
if
(
startCol
>
offX
)
{
startCol
=
offX
;
}
if
(
startRow
>
offY
)
{
startRow
=
offY
;
}
}
}
else
{
if
(
i
==
0
)
{
startCol
=
drawingObject
.
from
.
col
;
startRow
=
drawingObject
.
from
.
row
;
}
else
{
if
(
startCol
>
drawingObject
.
from
.
col
)
{
startCol
=
drawingObject
.
from
.
col
;
}
if
(
startRow
>
drawingObject
.
from
.
row
)
{
startRow
=
drawingObject
.
from
.
row
;
}
}
}
AscFormat
.
CheckSpPrXfrm
(
drawingObject
.
graphicObject
);
xfrm
=
drawingObject
.
graphicObject
.
spPr
.
xfrm
;
curCol
=
xfrm
.
offX
-
startCol
+
ws
.
objectRender
.
convertMetric
(
ws
.
cols
[
addImagesFromWord
[
i
].
col
+
activeRange
.
c1
].
left
-
ws
.
getCellLeft
(
0
,
1
),
1
,
3
);
curRow
=
xfrm
.
offY
-
startRow
+
ws
.
objectRender
.
convertMetric
(
ws
.
rows
[
addImagesFromWord
[
i
].
row
+
activeRange
.
r1
].
top
-
ws
.
getCellTop
(
0
,
1
),
1
,
3
);
xfrm
.
setOffX
(
curCol
);
xfrm
.
setOffY
(
curRow
);
drawingObject
=
ws
.
objectRender
.
cloneDrawingObject
(
drawingObject
);
drawingObject
.
graphicObject
.
setDrawingBase
(
drawingObject
);
drawingObject
.
graphicObject
.
setDrawingObjects
(
ws
.
objectRender
);
drawingObject
.
graphicObject
.
setWorksheet
(
ws
.
model
);
drawingObject
.
graphicObject
.
checkRemoveCache
&&
drawingObject
.
graphicObject
.
checkRemoveCache
();
//drawingObject.graphicObject.setDrawingDocument(ws.objectRender.drawingDocument);
drawingObject
.
graphicObject
.
addToDrawingObjects
();
if
(
i
===
0
)
{
window
[
'
AscCommon
'
].
g_clipboardBase
.
specialPasteUndoData
.
images
=
[];
}
window
[
'
AscCommon
'
].
g_clipboardBase
.
specialPasteUndoData
.
images
.
push
(
drawingObject
.
graphicObject
.
Id
);
if
(
drawingObject
.
graphicObject
.
checkDrawingBaseCoords
)
{
drawingObject
.
graphicObject
.
checkDrawingBaseCoords
();
}
drawingObject
.
graphicObject
.
recalculate
();
drawingObject
.
graphicObject
.
select
(
ws
.
objectRender
.
controller
,
0
);
}
var
old_val
=
api
.
ImageLoader
.
bIsAsyncLoadDocumentImages
;
api
.
ImageLoader
.
bIsAsyncLoadDocumentImages
=
true
;
api
.
ImageLoader
.
LoadDocumentImages
(
aImagesSync
,
null
,
ws
.
objectRender
.
asyncImagesDocumentEndLoaded
);
api
.
ImageLoader
.
bIsAsyncLoadDocumentImages
=
old_val
;
ws
.
objectRender
.
showDrawingObjects
(
true
);
ws
.
setSelectionShape
(
true
);
ws
.
objectRender
.
controller
.
updateOverlay
();
History
.
EndTransaction
();
},
_loadImagesOnServer
:
function
(
aPastedImages
,
callback
)
_loadImagesOnServer
:
function
(
aPastedImages
,
callback
)
{
{
var
api
=
Asc
[
"
editor
"
];
var
api
=
Asc
[
"
editor
"
];
...
@@ -1648,7 +1802,8 @@
...
@@ -1648,7 +1802,8 @@
};
};
var
aImagesToDownload
=
this
.
_getImageFromHtml
(
node
,
true
);
var
aImagesToDownload
=
this
.
_getImageFromHtml
(
node
,
true
);
if
(
aImagesToDownload
!==
null
)
//load to server
var
specialPasteProps
=
this
.
Api
.
wb
.
clipboard
.
specialPasteProps
;
if
(
aImagesToDownload
!==
null
&&
(
!
specialPasteProps
||
(
specialPasteProps
&&
specialPasteProps
.
images
)))
//load to server
{
{
var
api
=
Asc
[
"
editor
"
];
var
api
=
Asc
[
"
editor
"
];
AscCommon
.
sendImgUrls
(
api
,
aImagesToDownload
,
function
(
data
)
{
AscCommon
.
sendImgUrls
(
api
,
aImagesToDownload
,
function
(
data
)
{
...
@@ -1898,145 +2053,6 @@
...
@@ -1898,145 +2053,6 @@
return
res
;
return
res
;
},
},
_insertImagesFromBinaryWord
:
function
(
ws
,
data
,
aImagesSync
)
{
var
activeRange
=
ws
.
model
.
selectionRange
.
getLast
().
clone
();
var
curCol
,
drawingObject
,
curRow
,
startCol
=
0
,
startRow
=
0
,
xfrm
,
drawingBase
,
graphicObject
,
offX
,
offY
,
rot
;
History
.
Create_NewPoint
();
History
.
StartTransaction
();
var
api
=
window
[
"
Asc
"
][
"
editor
"
];
var
addImagesFromWord
=
data
.
props
.
addImagesFromWord
;
//определяем стартовую позицию, если изображений несколько вставляется
for
(
var
i
=
0
;
i
<
addImagesFromWord
.
length
;
i
++
)
{
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
,
true
);
}
//create new drawingBase
drawingObject
=
ws
.
objectRender
.
createDrawingObject
();
drawingObject
.
graphicObject
=
graphicObject
;
if
(
drawingObject
.
graphicObject
.
spPr
&&
drawingObject
.
graphicObject
.
spPr
.
xfrm
)
{
xfrm
=
drawingObject
.
graphicObject
.
spPr
.
xfrm
;
offX
=
0
;
offY
=
0
;
rot
=
AscFormat
.
isRealNumber
(
xfrm
.
rot
)
?
xfrm
.
rot
:
0
;
rot
=
AscFormat
.
normalizeRotate
(
rot
);
if
(
AscFormat
.
checkNormalRotate
(
rot
))
{
if
(
AscFormat
.
isRealNumber
(
xfrm
.
offX
)
&&
AscFormat
.
isRealNumber
(
xfrm
.
offY
))
{
offX
=
xfrm
.
offX
;
offY
=
xfrm
.
offY
;
}
}
else
{
if
(
AscFormat
.
isRealNumber
(
xfrm
.
offX
)
&&
AscFormat
.
isRealNumber
(
xfrm
.
offY
)
&&
AscFormat
.
isRealNumber
(
xfrm
.
extX
)
&&
AscFormat
.
isRealNumber
(
xfrm
.
extY
))
{
offX
=
xfrm
.
offX
+
xfrm
.
extX
/
2
-
xfrm
.
extY
/
2
;
offY
=
xfrm
.
offY
+
xfrm
.
extY
/
2
-
xfrm
.
extX
/
2
;
}
}
if
(
i
==
0
)
{
startCol
=
offX
;
startRow
=
offY
;
}
else
{
if
(
startCol
>
offX
)
{
startCol
=
offX
;
}
if
(
startRow
>
offY
)
{
startRow
=
offY
;
}
}
}
else
{
if
(
i
==
0
)
{
startCol
=
drawingObject
.
from
.
col
;
startRow
=
drawingObject
.
from
.
row
;
}
else
{
if
(
startCol
>
drawingObject
.
from
.
col
)
{
startCol
=
drawingObject
.
from
.
col
;
}
if
(
startRow
>
drawingObject
.
from
.
row
)
{
startRow
=
drawingObject
.
from
.
row
;
}
}
}
AscFormat
.
CheckSpPrXfrm
(
drawingObject
.
graphicObject
);
xfrm
=
drawingObject
.
graphicObject
.
spPr
.
xfrm
;
curCol
=
xfrm
.
offX
-
startCol
+
ws
.
objectRender
.
convertMetric
(
ws
.
cols
[
addImagesFromWord
[
i
].
col
+
activeRange
.
c1
].
left
-
ws
.
getCellLeft
(
0
,
1
),
1
,
3
);
curRow
=
xfrm
.
offY
-
startRow
+
ws
.
objectRender
.
convertMetric
(
ws
.
rows
[
addImagesFromWord
[
i
].
row
+
activeRange
.
r1
].
top
-
ws
.
getCellTop
(
0
,
1
),
1
,
3
);
xfrm
.
setOffX
(
curCol
);
xfrm
.
setOffY
(
curRow
);
drawingObject
=
ws
.
objectRender
.
cloneDrawingObject
(
drawingObject
);
drawingObject
.
graphicObject
.
setDrawingBase
(
drawingObject
);
drawingObject
.
graphicObject
.
setDrawingObjects
(
ws
.
objectRender
);
drawingObject
.
graphicObject
.
setWorksheet
(
ws
.
model
);
drawingObject
.
graphicObject
.
checkRemoveCache
&&
drawingObject
.
graphicObject
.
checkRemoveCache
();
//drawingObject.graphicObject.setDrawingDocument(ws.objectRender.drawingDocument);
drawingObject
.
graphicObject
.
addToDrawingObjects
();
if
(
drawingObject
.
graphicObject
.
checkDrawingBaseCoords
)
{
drawingObject
.
graphicObject
.
checkDrawingBaseCoords
();
}
drawingObject
.
graphicObject
.
recalculate
();
drawingObject
.
graphicObject
.
select
(
ws
.
objectRender
.
controller
,
0
);
}
var
old_val
=
api
.
ImageLoader
.
bIsAsyncLoadDocumentImages
;
api
.
ImageLoader
.
bIsAsyncLoadDocumentImages
=
true
;
api
.
ImageLoader
.
LoadDocumentImages
(
aImagesSync
,
null
,
ws
.
objectRender
.
asyncImagesDocumentEndLoaded
);
api
.
ImageLoader
.
bIsAsyncLoadDocumentImages
=
old_val
;
ws
.
objectRender
.
showDrawingObjects
(
true
);
ws
.
setSelectionShape
(
true
);
ws
.
objectRender
.
controller
.
updateOverlay
();
History
.
EndTransaction
();
},
ReadPresentationShapes
:
function
(
stream
,
worksheet
)
ReadPresentationShapes
:
function
(
stream
,
worksheet
)
{
{
History
.
TurnOff
();
History
.
TurnOff
();
...
...
cell/view/WorksheetView.js
View file @
08709a29
...
@@ -8748,7 +8748,6 @@
...
@@ -8748,7 +8748,6 @@
{
{
var
sBinary
=
window
[
"
Asc
"
][
"
editor
"
].
wb
.
clipboard
.
copyProcessor
.
getBinaryForCopy
(
this
,
newRange
);
var
sBinary
=
window
[
"
Asc
"
][
"
editor
"
].
wb
.
clipboard
.
copyProcessor
.
getBinaryForCopy
(
this
,
newRange
);
window
[
'
AscCommon
'
].
g_clipboardBase
.
specialPasteUndoData
.
data
=
sBinary
;
window
[
'
AscCommon
'
].
g_clipboardBase
.
specialPasteUndoData
.
data
=
sBinary
;
//window['AscCommon'].g_clipboardBase.specialPasteUndoData.images = images;
}
}
checkRange
=
[
newRange
];
checkRange
=
[
newRange
];
...
@@ -8762,21 +8761,33 @@
...
@@ -8762,21 +8761,33 @@
WorksheetView
.
prototype
.
specialPaste
=
function
(
props
)
{
WorksheetView
.
prototype
.
specialPaste
=
function
(
props
)
{
var
api
=
window
[
"
Asc
"
][
"
editor
"
];
var
api
=
window
[
"
Asc
"
][
"
editor
"
];
var
g_clipboardBase
=
window
[
'
AscCommon
'
].
g_clipboardBase
;
//откатываемся до того, что было до вставки
//откатываемся до того, что было до вставки
if
(
window
[
'
AscCommon
'
].
g_clipboardBase
.
specialPasteUndoData
.
data
)
if
(
g_clipboardBase
.
specialPasteUndoData
.
data
)
{
{
var
tempProps
=
new
AscCommonExcel
.
SpecialPasteProps
();
var
tempProps
=
new
AscCommonExcel
.
SpecialPasteProps
();
api
.
wb
.
clipboard
.
specialPasteProps
=
tempProps
;
api
.
wb
.
clipboard
.
specialPasteProps
=
tempProps
;
//меняем activeRange
//меняем activeRange
if
(
window
[
'
AscCommon
'
].
g_clipboardBase
.
specialPasteData
&&
window
[
'
AscCommon
'
].
g_clipboardBase
.
specialPasteData
.
activeRange
)
if
(
g_clipboardBase
.
specialPasteData
&&
g_clipboardBase
.
specialPasteData
.
activeRange
)
{
{
this
.
model
.
selectionRange
=
window
[
'
AscCommon
'
].
g_clipboardBase
.
specialPasteData
.
activeRange
.
clone
(
this
.
model
);
this
.
model
.
selectionRange
=
g_clipboardBase
.
specialPasteData
.
activeRange
.
clone
(
this
.
model
);
}
}
//откатываем данные в ячейках
//откатываем данные в ячейках
api
.
wb
.
clipboard
.
pasteProcessor
.
pasteFromBinary
(
this
,
window
[
'
AscCommon
'
].
g_clipboardBase
.
specialPasteUndoData
.
data
);
api
.
wb
.
clipboard
.
pasteProcessor
.
pasteFromBinary
(
this
,
g_clipboardBase
.
specialPasteUndoData
.
data
);
//удаляем вставленные изображения
//удаляем вставленные изображения
if
(
g_clipboardBase
.
specialPasteUndoData
.
images
)
{
var
images
=
g_clipboardBase
.
specialPasteUndoData
.
images
;
for
(
var
i
=
0
;
i
<
images
.
length
;
i
++
)
{
var
id
=
images
[
i
];
var
oObject
=
AscCommon
.
g_oTableId
.
Get_ById
(
id
);
oObject
.
deleteDrawingBase
(
true
);
oObject
.
setBDeleted
(
true
);
}
}
}
}
//далее специальная вставка
//далее специальная вставка
...
...
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