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
f74e196a
Commit
f74e196a
authored
Jul 04, 2016
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
for paste from cell/word editor into cell
parent
ce440aa9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
134 additions
and
17 deletions
+134
-17
cell/model/clipboard.js
cell/model/clipboard.js
+134
-17
No files found.
cell/model/clipboard.js
View file @
f74e196a
...
@@ -146,8 +146,17 @@
...
@@ -146,8 +146,17 @@
break
;
break
;
}
}
case
AscCommon
.
c_oAscClipboardDataFormat
.
Internal
:
case
AscCommon
.
c_oAscClipboardDataFormat
.
Internal
:
{
if
(
ws
.
getCellEditMode
()
===
true
)
{
var
text
=
t
.
pasteProcessor
.
pasteFromBinary
(
ws
,
data1
,
true
);
window
[
"
Asc
"
][
"
editor
"
].
wb
.
cellEditor
.
pasteText
(
text
);
}
else
{
{
t
.
pasteProcessor
.
pasteFromBinary
(
ws
,
data1
);
t
.
pasteProcessor
.
pasteFromBinary
(
ws
,
data1
);
}
break
;
break
;
}
}
case
AscCommon
.
c_oAscClipboardDataFormat
.
Text
:
case
AscCommon
.
c_oAscClipboardDataFormat
.
Text
:
...
@@ -733,7 +742,7 @@
...
@@ -733,7 +742,7 @@
constructor
:
PasteProcessorExcel
,
constructor
:
PasteProcessorExcel
,
pasteFromBinary
:
function
(
worksheet
,
binary
)
pasteFromBinary
:
function
(
worksheet
,
binary
,
isCellEditMode
)
{
{
var
base64
=
null
,
base64FromWord
=
null
,
base64FromPresentation
=
null
,
t
=
this
;
var
base64
=
null
,
base64FromWord
=
null
,
base64FromPresentation
=
null
,
t
=
this
;
...
@@ -754,12 +763,12 @@
...
@@ -754,12 +763,12 @@
var
isIntoShape
=
worksheet
.
objectRender
.
controller
.
getTargetDocContent
();
var
isIntoShape
=
worksheet
.
objectRender
.
controller
.
getTargetDocContent
();
if
(
base64
!=
null
)
//from excel
if
(
base64
!=
null
)
//from excel
{
{
result
=
this
.
_pasteFromBinaryExcel
(
worksheet
,
base64
,
isIntoShape
);
result
=
this
.
_pasteFromBinaryExcel
(
worksheet
,
base64
,
isIntoShape
,
isCellEditMode
);
}
}
else
if
(
base64FromWord
)
//from word
else
if
(
base64FromWord
)
//from word
{
{
this
.
activeRange
=
worksheet
.
activeRange
.
clone
(
true
);
this
.
activeRange
=
worksheet
.
activeRange
.
clone
(
true
);
result
=
this
.
_pasteFromBinaryWord
(
worksheet
,
base64FromWord
,
isIntoShape
);
result
=
this
.
_pasteFromBinaryWord
(
worksheet
,
base64FromWord
,
isIntoShape
,
isCellEditMode
);
}
}
else
if
(
base64FromPresentation
)
else
if
(
base64FromPresentation
)
{
{
...
@@ -769,7 +778,7 @@
...
@@ -769,7 +778,7 @@
return
result
;
return
result
;
},
},
_pasteFromBinaryExcel
:
function
(
worksheet
,
base64
,
isIntoShape
)
_pasteFromBinaryExcel
:
function
(
worksheet
,
base64
,
isIntoShape
,
isCellEditMode
)
{
{
var
oBinaryFileReader
=
new
AscCommonExcel
.
BinaryFileReader
(
true
);
var
oBinaryFileReader
=
new
AscCommonExcel
.
BinaryFileReader
(
true
);
var
tempWorkbook
=
new
AscCommonExcel
.
Workbook
();
var
tempWorkbook
=
new
AscCommonExcel
.
Workbook
();
...
@@ -783,10 +792,18 @@
...
@@ -783,10 +792,18 @@
var
pasteData
=
null
;
var
pasteData
=
null
;
if
(
tempWorkbook
)
if
(
tempWorkbook
)
pasteData
=
tempWorkbook
.
aWorksheets
[
0
];
pasteData
=
tempWorkbook
.
aWorksheets
[
0
];
if
(
pasteData
)
{
var
res
=
false
;
if
(
isCellEditMode
)
{
res
=
this
.
_getTextFromWorksheet
(
pasteData
);
}
else
if
(
pasteData
)
{
if
(
pasteData
.
Drawings
&&
pasteData
.
Drawings
.
length
)
if
(
pasteData
.
Drawings
&&
pasteData
.
Drawings
.
length
)
{
{
if
(
window
[
"
NativeCorrectImageUrlOnPaste
"
])
{
if
(
window
[
"
NativeCorrectImageUrlOnPaste
"
])
{
var
url
;
var
url
;
for
(
var
i
=
0
,
length
=
aPastedImages
.
length
;
i
<
length
;
++
i
)
for
(
var
i
=
0
,
length
=
aPastedImages
.
length
;
i
<
length
;
++
i
)
{
{
...
@@ -828,18 +845,23 @@
...
@@ -828,18 +845,23 @@
}
}
}
}
re
turn
true
;
re
s
=
true
;
}
}
return
false
;
return
res
;
},
},
_pasteFromBinaryWord
:
function
(
worksheet
,
base64
,
isIntoShape
)
_pasteFromBinaryWord
:
function
(
worksheet
,
base64
,
isIntoShape
,
isCellEditMode
)
{
{
var
res
=
true
;
var
pasteData
=
this
.
ReadFromBinaryWord
(
base64
,
worksheet
);
var
pasteData
=
this
.
ReadFromBinaryWord
(
base64
,
worksheet
);
if
(
isCellEditMode
)
{
res
=
this
.
_getTextFromWord
(
pasteData
);
}
//insert binary from word into SHAPE
//insert binary from word into SHAPE
if
(
isIntoShape
)
else
if
(
isIntoShape
)
{
{
this
.
_insertBinaryIntoShapeContent
(
worksheet
,
pasteData
.
content
,
true
);
this
.
_insertBinaryIntoShapeContent
(
worksheet
,
pasteData
.
content
,
true
);
}
}
...
@@ -849,7 +871,7 @@
...
@@ -849,7 +871,7 @@
oPasteFromBinaryWord
.
_paste
(
worksheet
,
pasteData
);
oPasteFromBinaryWord
.
_paste
(
worksheet
,
pasteData
);
}
}
return
true
;
return
res
;
},
},
_pasteFromBinaryPresentation
:
function
(
worksheet
,
base64
,
isIntoShape
)
_pasteFromBinaryPresentation
:
function
(
worksheet
,
base64
,
isIntoShape
)
...
@@ -880,6 +902,7 @@
...
@@ -880,6 +902,7 @@
}
}
else
else
{
{
History
.
TurnOff
();
var
oPasteFromBinaryWord
=
new
pasteFromBinaryWord
(
this
,
worksheet
);
var
oPasteFromBinaryWord
=
new
pasteFromBinaryWord
(
this
,
worksheet
);
var
oTempDrawingDocument
=
worksheet
.
model
.
DrawingDocument
;
var
oTempDrawingDocument
=
worksheet
.
model
.
DrawingDocument
;
...
@@ -903,6 +926,8 @@
...
@@ -903,6 +926,8 @@
}
}
docContent
=
newContent
;
docContent
=
newContent
;
History
.
TurnOn
();
oPasteFromBinaryWord
.
_paste
(
worksheet
,
{
content
:
docContent
});
oPasteFromBinaryWord
.
_paste
(
worksheet
,
{
content
:
docContent
});
}
}
...
@@ -955,6 +980,7 @@
...
@@ -955,6 +980,7 @@
//ещё раз вызваем getTargetDocContent с флагом true после создания точки в истории(getTargetDocContent добавляет данные в историю)
//ещё раз вызваем getTargetDocContent с флагом true после создания точки в истории(getTargetDocContent добавляет данные в историю)
var
isIntoShape
=
worksheet
.
objectRender
.
controller
.
getTargetDocContent
(
true
);
var
isIntoShape
=
worksheet
.
objectRender
.
controller
.
getTargetDocContent
(
true
);
isIntoShape
.
Remove
(
1
,
true
,
true
);
var
insertContent
=
new
CSelectedContent
();
var
insertContent
=
new
CSelectedContent
();
var
target_doc_content
=
isIntoShape
;
var
target_doc_content
=
isIntoShape
;
...
@@ -1721,6 +1747,12 @@
...
@@ -1721,6 +1747,12 @@
//читаем контент, здесь только параграфы
//читаем контент, здесь только параграфы
//var newDocContent = new CDocumentContent(shape.txBody, editor.WordControl.m_oDrawingDocument, 0 , 0, 0, 0, false, false);
//var newDocContent = new CDocumentContent(shape.txBody, editor.WordControl.m_oDrawingDocument, 0 , 0, 0, 0, false, false);
var
elements
=
[],
paragraph
,
selectedElement
;
var
elements
=
[],
paragraph
,
selectedElement
;
if
(
!
cDocumentContent
)
{
cDocumentContent
=
worksheet
;
}
for
(
var
i
=
0
;
i
<
count
;
++
i
)
for
(
var
i
=
0
;
i
<
count
;
++
i
)
{
{
loader
.
stream
.
Skip2
(
1
);
// must be 0
loader
.
stream
.
Skip2
(
1
);
// must be 0
...
@@ -1824,9 +1856,8 @@
...
@@ -1824,9 +1856,8 @@
History
.
StartTransaction
();
History
.
StartTransaction
();
oPasteProcessor
.
_Execute
(
node
,
{},
true
,
true
,
false
);
oPasteProcessor
.
_Execute
(
node
,
{},
true
,
true
,
false
);
if
(
!
oPasteProcessor
.
aContent
||
!
oPasteProcessor
.
aContent
.
length
)
{
if
(
!
oPasteProcessor
.
aContent
||
!
oPasteProcessor
.
aContent
.
length
)
window
.
GlobalPasteFlag
=
false
;
{
window
.
GlobalPasteFlagCounter
=
0
;
History
.
EndTransaction
();
History
.
EndTransaction
();
return
false
;
return
false
;
}
}
...
@@ -1840,8 +1871,6 @@
...
@@ -1840,8 +1871,6 @@
oTargetTextObject
&&
oTargetTextObject
.
checkExtentsByDocContent
&&
oTargetTextObject
.
checkExtentsByDocContent
();
oTargetTextObject
&&
oTargetTextObject
.
checkExtentsByDocContent
&&
oTargetTextObject
.
checkExtentsByDocContent
();
worksheet
.
objectRender
.
controller
.
startRecalculate
();
worksheet
.
objectRender
.
controller
.
startRecalculate
();
worksheet
.
objectRender
.
controller
.
cursorMoveRight
(
false
,
false
);
worksheet
.
objectRender
.
controller
.
cursorMoveRight
(
false
,
false
);
window
.
GlobalPasteFlag
=
false
;
window
.
GlobalPasteFlagCounter
=
0
;
History
.
EndTransaction
();
History
.
EndTransaction
();
});
});
...
@@ -1956,6 +1985,94 @@
...
@@ -1956,6 +1985,94 @@
},
},
text
:
''
});
text
:
''
});
return
res
;
},
_getTextFromWorksheet
:
function
(
worksheet
)
{
var
res
=
""
;
for
(
var
i
in
worksheet
.
aGCells
)
{
var
row
=
worksheet
.
aGCells
[
i
];
for
(
var
j
in
row
.
c
)
{
var
cell
=
row
.
c
[
j
];
if
(
null
!=
cell
)
{
res
+=
cell
.
getValue
();
}
res
+=
"
"
;
}
res
+=
"
\n
"
;
}
return
res
;
},
_getTextFromWord
:
function
(
data
)
{
var
res
=
""
;
var
getTextFromCell
=
function
(
cell
)
{
if
(
cell
.
Content
&&
cell
.
Content
.
Content
)
{
getTextFromDocumentContent
(
cell
.
Content
.
Content
,
true
);
}
};
var
getTextFromTable
=
function
(
table
)
{
for
(
var
i
=
0
;
i
<
table
.
Content
.
length
;
i
++
)
{
var
row
=
table
.
Content
[
i
];
for
(
var
j
=
0
;
j
<
row
.
Content
.
length
;
j
++
)
{
res
+=
"
"
;
var
cell
=
row
.
Content
[
j
];
getTextFromCell
(
cell
);
}
res
+=
"
\n
"
;
}
};
var
getTextFromDocumentContent
=
function
(
documentContent
,
test
)
{
for
(
var
i
=
0
;
i
<
documentContent
.
length
;
i
++
)
{
var
item
=
documentContent
[
i
];
if
(
type_Paragraph
===
item
.
GetType
())
{
if
(
test
)
{
res
+=
"
\n
"
;
}
getTextFromParagraph
(
item
);
}
else
if
(
type_Table
===
item
.
GetType
())
{
getTextFromTable
(
item
);
}
}
};
var
getTextFromParagraph
=
function
(
paragraph
)
{
for
(
var
j
=
0
;
j
<
paragraph
.
Content
.
length
;
j
++
)
{
res
+=
paragraph
.
Content
[
j
].
Get_SelectedText
(
true
)
}
};
getTextFromDocumentContent
(
data
.
content
);
return
res
;
return
res
;
}
}
...
...
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