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
130b2763
Commit
130b2763
authored
Jul 05, 2016
by
alexey.musinov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
https://github.com/ONLYOFFICE/sdkjs
into develop
parents
1442522b
dc7592e6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
276 additions
and
84 deletions
+276
-84
common/Native/native.js
common/Native/native.js
+0
-1
common/wordcopypaste.js
common/wordcopypaste.js
+87
-23
word/Editor/Footnotes.js
word/Editor/Footnotes.js
+189
-60
No files found.
common/Native/native.js
View file @
130b2763
...
...
@@ -598,7 +598,6 @@ window['AscFonts'].CFontManager = function CFontManager() {
this
.
Initialize
=
function
(){};
this
.
ClearFontsRasterCache
=
function
(){};
};
window
[
"
use_native_fonts_only
"
]
=
true
;
// FT_Common
function
_FT_Common
()
{
...
...
common/wordcopypaste.js
View file @
130b2763
...
...
@@ -3108,9 +3108,7 @@ PasteProcessor.prototype =
}
else
if
(
base64FromExcel
)
//вставляем в презентации из таблиц
{
History
.
TurnOff
();
var
excelContent
=
this
.
_readFromBinaryExcel
(
base64FromExcel
);
History
.
TurnOn
();
var
excelContent
=
AscFormat
.
ExecuteNoHistory
(
this
.
_readFromBinaryExcel
,
this
,
[
base64FromExcel
]);
var
aContentExcel
=
excelContent
.
workbook
;
var
aPastedImages
=
excelContent
.
arrImages
;
...
...
@@ -3118,22 +3116,6 @@ PasteProcessor.prototype =
//если есть шейпы, то вставляем их из excel
if
(
aContentExcel
&&
aContentExcel
.
aWorksheets
&&
aContentExcel
.
aWorksheets
[
0
]
&&
aContentExcel
.
aWorksheets
[
0
].
Drawings
&&
aContentExcel
.
aWorksheets
[
0
].
Drawings
.
length
)
{
var
arr_shapes
=
aContentExcel
.
aWorksheets
[
0
].
Drawings
;
var
shape
;
var
aImagesToDownload
=
[];
for
(
var
i
=
0
;
i
<
aPastedImages
.
length
;
i
++
)
{
aImagesToDownload
.
push
(
aPastedImages
[
i
].
Url
);
}
var
aContent
=
{
aPastedImages
:
aPastedImages
,
images
:
aImagesToDownload
};
//var arrTransforms = objects.arrTransforms;
var
presentation
=
editor
.
WordControl
.
m_oLogicDocument
;
oThis
=
this
;
var
font_map
=
{};
var
paste_callback
=
function
()
{
if
(
false
==
oThis
.
bNested
)
...
...
@@ -3154,20 +3136,42 @@ PasteProcessor.prototype =
presentation
.
Insert_Content
(
presentationSelectedContent
);
presentation
.
Recalculate
();
presentation
.
Check_CursorMoveRight
();
presentation
.
Check_CursorMoveRight
();
presentation
.
Document_UpdateInterfaceState
();
}
};
var
arr_shapes
=
aContentExcel
.
aWorksheets
[
0
].
Drawings
;
var
aImagesToDownload
=
[];
for
(
var
i
=
0
;
i
<
aPastedImages
.
length
;
i
++
)
{
aImagesToDownload
.
push
(
aPastedImages
[
i
].
Url
);
}
var
aContent
=
{
aPastedImages
:
aPastedImages
,
images
:
aImagesToDownload
};
//var arrTransforms = objects.arrTransforms;
var
presentation
=
editor
.
WordControl
.
m_oLogicDocument
;
oThis
=
this
;
//fonts
var
font_map
=
{};
for
(
var
i
=
0
;
i
<
arr_shapes
.
length
;
++
i
)
{
var
shape
=
arr_shapes
[
i
].
graphicObject
;
shape
.
getAllFonts
(
font_map
);
}
var
fonts
=
[];
//грузим картинки и фонты
for
(
var
i
in
font_map
)
fonts
.
push
(
new
CFont
(
i
,
0
,
""
,
0
));
//images
var
images
=
aContent
.
images
;
var
arrImages
=
aContent
.
aPastedImages
;
var
oObjectsForDownload
=
GetObjectsForImageDownload
(
arrImages
);
if
(
oObjectsForDownload
.
aUrls
.
length
>
0
)
{
...
...
@@ -3190,10 +3194,70 @@ PasteProcessor.prototype =
this
.
api
.
pre_Paste
(
fonts
,
im_arr
,
paste_callback
);
}
return
;
}
else
{
var
presentationSelectedContent
=
new
PresentationSelectedContent
();
presentationSelectedContent
.
DocContent
=
new
CSelectedContent
();
var
aContent
=
AscFormat
.
ExecuteNoHistory
(
this
.
_convertExcelBinary
,
this
,
[
excelContent
]);
var
elements
=
[],
selectedElement
,
element
,
drawings
=
[],
pDrawings
=
[],
drawingCopyObject
;
var
defaultTableStyleId
=
presentation
.
DefaultTableStyleId
;
for
(
var
i
=
0
;
i
<
aContent
.
content
.
length
;
++
i
)
{
selectedElement
=
new
CSelectedElement
();
element
=
aContent
.
content
[
i
];
if
(
type_Table
==
element
.
GetType
())
//table
{
//TODO переделать количество строк и ширину
var
W
=
100
;
var
Rows
=
3
;
var
graphic_frame
=
new
CGraphicFrame
();
graphic_frame
.
setSpPr
(
new
AscFormat
.
CSpPr
());
graphic_frame
.
spPr
.
setParent
(
graphic_frame
);
graphic_frame
.
spPr
.
setXfrm
(
new
AscFormat
.
CXfrm
());
graphic_frame
.
spPr
.
xfrm
.
setParent
(
graphic_frame
.
spPr
);
graphic_frame
.
spPr
.
xfrm
.
setOffX
((
this
.
oDocument
.
Width
-
W
)
/
2
);
graphic_frame
.
spPr
.
xfrm
.
setOffY
(
this
.
oDocument
.
Height
/
5
);
graphic_frame
.
spPr
.
xfrm
.
setExtX
(
W
);
graphic_frame
.
spPr
.
xfrm
.
setExtY
(
7.478268771701388
*
Rows
);
graphic_frame
.
setNvSpPr
(
new
AscFormat
.
UniNvPr
());
element
=
this
.
_convertTableToPPTX
(
element
);
graphic_frame
.
setGraphicObject
(
element
.
Copy
(
graphic_frame
));
graphic_frame
.
graphicObject
.
Set_TableStyle
(
defaultTableStyleId
);
drawingCopyObject
=
new
DrawingCopyObject
();
drawingCopyObject
.
Drawing
=
graphic_frame
;
pDrawings
.
push
(
drawingCopyObject
);
}
}
presentationSelectedContent
.
Drawings
=
pDrawings
;
var
presentation
=
editor
.
WordControl
.
m_oLogicDocument
;
//вставка
var
paste_callback
=
function
()
{
if
(
false
==
oThis
.
bNested
)
{
presentation
.
Insert_Content
(
presentationSelectedContent
);
presentation
.
Recalculate
();
presentation
.
Check_CursorMoveRight
();
presentation
.
Document_UpdateInterfaceState
();
}
}
oThis
.
api
.
pre_Paste
(
aContent
.
content
.
fonts
,
null
,
paste_callback
);
return
;
}
}
}
this
.
oRootNode
=
node
;
this
.
_Prepeare
(
node
,
function
(){
...
...
word/Editor/Footnotes.js
View file @
130b2763
...
...
@@ -673,6 +673,16 @@ CFootnotesController.prototype.private_GetFootnotesLogicRange = function(oFootno
{
return
this
.
LogicDocument
.
Get_FootnotesList
(
oFootnote1
,
oFootnote2
);
};
CFootnotesController
.
prototype
.
private_GetSelectionArray
=
function
()
{
if
(
true
!==
this
.
Selection
.
Use
||
0
===
this
.
Selection
.
Direction
)
return
[
this
.
CurFootnote
];
if
(
1
===
this
.
Selection
.
Direction
)
return
this
.
private_GetFootnotesLogicRange
(
this
.
Selection
.
Start
.
Footnote
,
this
.
Selection
.
End
.
Footnote
);
else
return
this
.
private_GetFootnotesLogicRange
(
this
.
Selection
.
End
.
Footnote
,
this
.
Selection
.
Start
.
Footnote
);
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Controller area
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -1801,83 +1811,136 @@ CFootnotesController.prototype.DrawSelectionOnPage = function(PageAbs)
};
CFootnotesController
.
prototype
.
GetSelectionBounds
=
function
()
{
// TODO: Доделать селект и курсор
if
(
true
===
this
.
Selection
.
Use
)
{
if
(
0
===
this
.
Selection
.
Direction
)
{
return
this
.
CurFootnote
.
Get_SelectionBounds
();
}
else
if
(
1
===
this
.
Selection
.
Direction
)
{
var
Result
=
{};
Result
.
Start
=
this
.
Selection
.
Start
.
Footnote
.
Get_SelectionBounds
().
Start
;
Result
.
End
=
this
.
Selection
.
End
.
Footnote
.
Get_SelectionBounds
().
End
;
Result
.
Direction
=
1
;
return
Result
;
}
else
{
var
Result
=
{};
Result
.
Start
=
this
.
Selection
.
End
.
Footnote
.
Get_SelectionBounds
().
Start
;
Result
.
End
=
this
.
Selection
.
Start
.
Footnote
.
Get_SelectionBounds
().
End
;
Result
.
Direction
=
-
1
;
return
Result
;
}
}
return
null
;
};
CFootnotesController
.
prototype
.
IsMovingTableBorder
=
function
()
{
// TODO: Доделать селект и курсор
if
(
true
===
this
.
Selection
.
Use
)
{
}
else
{
if
(
null
!==
this
.
CurFootnote
)
return
this
.
CurFootnote
.
Selection_Is_TableBorderMove
();
}
if
(
true
!==
this
.
private_IsOnFootnoteSelected
())
return
false
;
return
false
;
return
this
.
CurFootnote
.
Selection_Is_TableBorderMove
()
;
};
CFootnotesController
.
prototype
.
CheckPosInSelection
=
function
(
X
,
Y
,
PageAbs
,
NearPos
)
{
// TODO: Доделать селект и курсор
if
(
true
===
this
.
Selection
.
Use
)
{
}
else
// TODO: Доделать с NearPos
var
oResult
=
this
.
private_GetFootnoteByXY
(
X
,
Y
,
PageAbs
);
if
(
oResult
)
{
if
(
null
!==
this
.
CurFootnote
)
return
this
.
CurFootnote
.
Selection_Check
(
X
,
Y
,
PageAbs
,
NearPos
);
var
oFootnote
=
oResult
.
Footnote
;
var
PageRel
=
oFootnote
.
GetRelaitivePageIndex
(
PageAbs
);
return
oFootnote
.
Selection_Check
(
X
,
Y
,
PageRel
,
NearPos
);
}
return
false
;
};
CFootnotesController
.
prototype
.
SelectAll
=
function
()
CFootnotesController
.
prototype
.
SelectAll
=
function
(
nDirection
)
{
// TODO: Доделать селект и курсор
if
(
true
===
this
.
Selection
.
Use
)
var
arrFootnotes
=
this
.
private_GetFootnotesLogicRange
(
null
,
null
);
if
(
!
arrFootnotes
||
arrFootnotes
.
length
<=
0
)
return
;
if
(
1
===
arrFootnotes
.
length
)
{
var
oFootnote
=
arrFootnotes
[
0
];
this
.
Selection
.
Use
=
true
;
this
.
Selection
.
Start
.
Footnote
=
oFootnote
;
this
.
Selection
.
End
.
Footnote
=
oFootnote
;
this
.
CurFootnote
=
oFootnote
;
this
.
Selection
.
Footnotes
=
{};
this
.
Selection
.
Direction
=
0
;
this
.
Selection
.
Footnotes
[
oFootnote
.
Get_Id
()]
=
oFootnote
;
oFootnote
.
Select_All
(
nDirection
);
}
else
{
if
(
null
!==
this
.
CurFootnote
)
this
.
CurFootnote
.
Select_All
();
var
StartFootnote
,
EndFootnote
;
if
(
nDirection
<
0
)
{
StartFootnote
=
arrFootnotes
[
arrFootnotes
.
length
-
1
];
EndFootnote
=
arrFootnotes
[
0
];
this
.
Selection
.
Direction
=
-
1
;
}
else
{
StartFootnote
=
arrFootnotes
[
0
];
EndFootnote
=
arrFootnotes
[
arrFootnotes
.
length
-
1
];
this
.
Selection
.
Direction
=
-
1
;
}
this
.
Selection
.
Use
=
true
;
this
.
Selection
.
Start
.
Footnote
=
StartFootnote
;
this
.
Selection
.
End
.
Footnote
=
EndFootnote
;
this
.
CurFootnote
=
EndFootnote
;
this
.
Selection
.
Footnotes
=
{};
for
(
var
nPos
=
0
,
nCount
=
arrFootnotes
.
length
;
nPos
<
nCount
;
++
nPos
)
{
var
oFootnote
=
arrFootnotes
[
nPos
];
oFootnote
.
Select_All
(
nDirection
);
this
.
Selection
.
Footnotes
[
oFootnote
.
Get_Id
()]
=
oFootnote
;
}
}
};
CFootnotesController
.
prototype
.
GetSelectedContent
=
function
(
SelectedContent
)
{
// TODO: Доделать селект и курсор
if
(
true
===
this
.
Selection
.
Use
)
if
(
true
!==
this
.
Selection
.
Use
)
return
;
if
(
0
===
this
.
Selection
.
Direction
)
{
this
.
CurFootnote
.
Get_SelectedContent
(
SelectedContent
);
}
else
{
if
(
null
!==
this
.
CurFootnote
)
this
.
CurFootnote
.
Get_SelectedContent
(
SelectedContent
);
var
arrFootnotes
=
this
.
private_GetSelectionArray
();
for
(
var
nPos
=
0
,
nCount
=
arrFootnotes
.
length
;
nPos
<
nCount
;
++
nPos
)
{
arrFootnotes
[
nPos
].
Get_SelectedContent
(
SelectedContent
);
}
}
};
CFootnotesController
.
prototype
.
UpdateCursorType
=
function
(
X
,
Y
,
PageAbs
,
MouseEvent
)
{
// TODO: Доделать селект и курсор
if
(
true
===
this
.
Selection
.
Use
)
{
}
else
var
oResult
=
this
.
private_GetFootnoteByXY
(
X
,
Y
,
PageAbs
);
if
(
oResult
)
{
if
(
null
!==
this
.
CurFootnote
)
this
.
CurFootnote
.
Update_CursorType
(
X
,
Y
,
PageAbs
,
MouseEvent
);
var
oFootnote
=
oResult
.
Footnote
;
var
PageRel
=
oFootnote
.
GetRelaitivePageIndex
(
PageAbs
);
oFootnote
.
Update_CursorType
(
X
,
Y
,
PageRel
,
MouseEvent
);
}
};
CFootnotesController
.
prototype
.
PasteFormatting
=
function
(
TextPr
,
ParaPr
)
{
// TODO: Доделать селект и курсор
if
(
true
===
this
.
Selection
.
Use
)
{
}
else
for
(
var
sId
in
this
.
Selection
.
Footnotes
)
{
if
(
null
!==
this
.
CurFootnote
)
this
.
CurFootnote
.
Paragraph_Format_Paste
(
TextPr
,
ParaPr
,
true
);
this
.
Selection
.
Footnotes
[
sId
].
Paragraph_Format_Paste
(
TextPr
,
ParaPr
,
true
);
}
};
CFootnotesController
.
prototype
.
IsSelectionUse
=
function
()
...
...
@@ -1886,23 +1949,49 @@ CFootnotesController.prototype.IsSelectionUse = function()
};
CFootnotesController
.
prototype
.
IsTextSelectionUse
=
function
()
{
// TODO: Реализовать
return
false
;
if
(
true
!==
this
.
Selection
.
Use
)
return
false
;
if
(
0
===
this
.
Selection
.
Direction
)
return
this
.
CurFootnote
.
Is_TextSelectionUse
();
return
true
;
};
CFootnotesController
.
prototype
.
GetCurPosXY
=
function
()
{
// TODO: Реализовать
if
(
this
.
CurFootnote
)
return
this
.
CurFootnote
.
Get_CurPosXY
();
return
{
X
:
0
,
Y
:
0
};
};
CFootnotesController
.
prototype
.
GetSelectedText
=
function
(
bClearText
)
{
// TODO: Реализовать
return
""
;
if
(
true
===
bClearText
)
{
if
(
true
!==
this
.
Selection
.
Use
||
0
!==
this
.
Selection
.
Direction
)
return
null
;
return
this
.
CurFootnote
.
Get_SelectedText
(
true
);
}
else
{
var
sResult
=
""
;
var
arrFootnotes
=
this
.
private_GetSelectionArray
();
for
(
var
nPos
=
0
,
nCount
=
arrFootnotes
.
length
;
nPos
<
nCount
;
++
nPos
)
{
var
sTempResult
=
arrFootnotes
[
nPos
].
Get_SelectedText
(
false
);
if
(
null
==
sTempResult
)
return
null
;
sResult
+=
sTempResult
;
}
return
sResult
;
}
};
CFootnotesController
.
prototype
.
GetCurrentParagraph
=
function
()
{
// TODO: Реализовать
return
null
;
return
this
.
CurFootnote
.
Get_CurrentParagraph
();
};
CFootnotesController
.
prototype
.
GetSelectedElementsInfo
=
function
(
oInfo
)
{
...
...
@@ -1913,45 +2002,85 @@ CFootnotesController.prototype.GetSelectedElementsInfo = function(oInfo)
};
CFootnotesController
.
prototype
.
AddTableRow
=
function
(
bBefore
)
{
// TODO: Реализовать
if
(
false
===
this
.
private_CheckFootnotesSelectionBeforeAction
())
return
;
this
.
CurFootnote
.
Table_AddRow
(
bBefore
);
};
CFootnotesController
.
prototype
.
AddTableCol
=
function
(
bBefore
)
{
// TODO: Реализовать
if
(
false
===
this
.
private_CheckFootnotesSelectionBeforeAction
())
return
;
this
.
CurFootnote
.
Table_AddCol
(
bBefore
);
};
CFootnotesController
.
prototype
.
RemoveTableRow
=
function
()
{
// TODO: Реализовать
if
(
false
===
this
.
private_CheckFootnotesSelectionBeforeAction
())
return
;
this
.
CurFootnote
.
Table_RemoveRow
();
};
CFootnotesController
.
prototype
.
RemoveTableCol
=
function
()
{
// TODO: Реализовать
if
(
false
===
this
.
private_CheckFootnotesSelectionBeforeAction
())
return
;
this
.
CurFootnote
.
Table_RemoveCol
();
};
CFootnotesController
.
prototype
.
MergeTableCells
=
function
()
{
// TODO: Реализовать
if
(
false
===
this
.
private_CheckFootnotesSelectionBeforeAction
())
return
;
this
.
CurFootnote
.
Table_MergeCells
();
};
CFootnotesController
.
prototype
.
SplitTableCells
=
function
(
Cols
,
Rows
)
{
// TODO: Реализовать
if
(
false
===
this
.
private_CheckFootnotesSelectionBeforeAction
())
return
;
this
.
CurFootnote
.
Table_SplitCell
(
Cols
,
Rows
);
};
CFootnotesController
.
prototype
.
RemoveTable
=
function
()
{
// TODO: Реализовать
if
(
false
===
this
.
private_CheckFootnotesSelectionBeforeAction
())
return
;
this
.
CurFootnote
.
Table_RemoveTable
();
};
CFootnotesController
.
prototype
.
SelectTable
=
function
(
Type
)
{
// TODO: Реализовать
if
(
false
===
this
.
private_CheckFootnotesSelectionBeforeAction
())
return
;
this
.
RemoveSelection
();
this
.
CurFootnote
.
Table_Select
(
Type
);
if
(
true
===
this
.
CurFootnote
.
Is_SelectionUse
())
{
this
.
Selection
.
Use
=
true
;
this
.
Selection
.
Start
.
Footnote
=
this
.
CurFootnote
;
this
.
Selection
.
End
.
Footnote
=
this
.
CurFootnote
;
this
.
Selection
.
Footnotes
=
{};
this
.
Selection
.
Direction
=
0
;
this
.
Selection
.
Footnotes
[
this
.
CurFootnote
.
Get_Id
()]
=
this
.
CurFootnote
;
}
};
CFootnotesController
.
prototype
.
CanMergeTableCells
=
function
()
{
// TODO: Реализовать
return
false
;
if
(
false
===
this
.
private_CheckFootnotesSelectionBeforeAction
())
return
false
;
return
this
.
CurFootnote
.
Table_CheckMerge
();
};
CFootnotesController
.
prototype
.
CanSplitTableCells
=
function
()
{
// TODO: Реализовать
return
false
;
if
(
false
===
this
.
private_CheckFootnotesSelectionBeforeAction
())
return
false
;
return
this
.
CurFootnote
.
Table_CheckSplit
();
};
CFootnotesController
.
prototype
.
UpdateInterfaceState
=
function
()
{
...
...
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