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
3127f59b
Commit
3127f59b
authored
Aug 08, 2016
by
Sergey Luzyanin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inserting ole objects in presentation
parent
b37073dd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
147 additions
and
2 deletions
+147
-2
common/plugins.js
common/plugins.js
+2
-1
slide/Editor/Format/Presentation.js
slide/Editor/Format/Presentation.js
+39
-0
slide/Editor/Format/Slide.js
slide/Editor/Format/Slide.js
+21
-1
slide/api.js
slide/api.js
+51
-0
slide/apiBuilder.js
slide/apiBuilder.js
+34
-0
No files found.
common/plugins.js
View file @
3127f59b
...
@@ -386,7 +386,8 @@
...
@@ -386,7 +386,8 @@
if
(
pluginData
.
getAttribute
(
"
recalculate
"
)
==
true
)
if
(
pluginData
.
getAttribute
(
"
recalculate
"
)
==
true
)
{
{
var
editorId
=
window
.
g_asc_plugins
.
api
.
getEditorId
();
var
editorId
=
window
.
g_asc_plugins
.
api
.
getEditorId
();
if
(
AscCommon
.
c_oEditorId
.
Word
===
editorId
)
if
(
AscCommon
.
c_oEditorId
.
Word
===
editorId
||
AscCommon
.
c_oEditorId
.
Presentation
===
editorId
)
{
{
var
oLogicDocument
=
window
.
g_asc_plugins
.
api
.
WordControl
?
var
oLogicDocument
=
window
.
g_asc_plugins
.
api
.
WordControl
?
window
.
g_asc_plugins
.
api
.
WordControl
.
m_oLogicDocument
:
null
;
window
.
g_asc_plugins
.
api
.
WordControl
.
m_oLogicDocument
:
null
;
...
...
slide/Editor/Format/Presentation.js
View file @
3127f59b
...
@@ -1507,6 +1507,28 @@ CPresentation.prototype =
...
@@ -1507,6 +1507,28 @@ CPresentation.prototype =
}
}
},
},
Add_OleObject
:
function
(
fWidth
,
fHeight
,
nWidthPix
,
nHeightPix
,
sLocalUrl
,
sData
,
sApplicationId
){
if
(
this
.
Slides
[
this
.
CurPage
]){
var
fPosX
=
(
this
.
Width
-
fWidth
)
/
2
;
var
fPosY
=
(
this
.
Height
-
fHeight
)
/
2
;
var
Image
=
this
.
Slides
[
this
.
CurPage
].
graphicObjects
.
createOleObject
(
sData
,
sApplicationId
,
sLocalUrl
,
fPosX
,
fPosY
,
fWidth
,
fHeight
,
nWidthPix
,
nHeightPix
);
Image
.
setParent
(
this
.
Slides
[
this
.
CurPage
]);
Image
.
addToDrawingObjects
();
this
.
Slides
[
this
.
CurPage
].
graphicObjects
.
resetSelection
();
this
.
Slides
[
this
.
CurPage
].
graphicObjects
.
selectObject
(
Image
,
0
);
this
.
Recalculate
();
this
.
Document_UpdateInterfaceState
();
}
},
Edit_OleObject
:
function
(
oOleObject
,
sData
,
sImageUrl
,
nPixWidth
,
nPixHeight
){
oOleObject
.
setData
(
sData
);
var
_blipFill
=
new
AscFormat
.
CBlipFill
();
_blipFill
.
RasterImageId
=
sImageUrl
;
oOleObject
.
setBlipFill
(
_blipFill
);
oOleObject
.
setPixSizes
(
nPixWidth
,
nPixHeight
);
},
addChart
:
function
(
binary
)
addChart
:
function
(
binary
)
{
{
var
_this
=
this
;
var
_this
=
this
;
...
@@ -3332,6 +3354,23 @@ CPresentation.prototype =
...
@@ -3332,6 +3354,23 @@ CPresentation.prototype =
},
},
Get_AllImageUrls
:
function
(
aImages
){
if
(
!
Array
.
isArray
(
aImages
)){
aImages
=
[];
}
for
(
var
i
=
0
;
i
<
this
.
Slides
.
length
;
++
i
){
this
.
Slides
[
i
].
getAllRasterImages
(
aImages
);
}
return
aImages
;
},
Reassign_ImageUrls
:
function
(
images_rename
)
{
for
(
var
i
=
0
;
i
<
this
.
Slides
.
length
;
++
i
){
this
.
Slides
[
i
].
Reassign_ImageUrls
(
images_rename
);
}
},
Get_GraphicObjectsProps
:
function
()
Get_GraphicObjectsProps
:
function
()
{
{
if
(
this
.
Slides
[
this
.
CurPage
])
if
(
this
.
Slides
[
this
.
CurPage
])
...
...
slide/Editor/Format/Slide.js
View file @
3127f59b
...
@@ -117,6 +117,12 @@ Slide.prototype =
...
@@ -117,6 +117,12 @@ Slide.prototype =
return
editor
.
WordControl
.
m_oLogicDocument
.
DrawingDocument
;
return
editor
.
WordControl
.
m_oLogicDocument
.
DrawingDocument
;
},
},
Reassign_ImageUrls
:
function
(
images_rename
){
for
(
var
i
=
0
;
i
<
this
.
cSld
.
spTree
.
length
;
++
i
){
this
.
cSld
.
spTree
[
i
].
Reassign_ImageUrls
(
images_rename
);
}
},
createDuplicate
:
function
()
createDuplicate
:
function
()
{
{
var
copy
=
new
Slide
(
this
.
presentation
,
this
.
Layout
,
0
),
i
;
var
copy
=
new
Slide
(
this
.
presentation
,
this
.
Layout
,
0
),
i
;
...
@@ -942,7 +948,7 @@ Slide.prototype =
...
@@ -942,7 +948,7 @@ Slide.prototype =
return
oRet
;
return
oRet
;
},
},
getAllImage
s
:
function
(
images
)
Get_AllImageUrl
s
:
function
(
images
)
{
{
if
(
this
.
cSld
.
Bg
&&
this
.
cSld
.
Bg
.
bgPr
&&
this
.
cSld
.
Bg
.
bgPr
.
Fill
&&
this
.
cSld
.
Bg
.
bgPr
.
Fill
.
fill
instanceof
AscFormat
.
CBlipFill
&&
typeof
this
.
cSld
.
Bg
.
bgPr
.
Fill
.
fill
.
RasterImageId
===
"
string
"
)
if
(
this
.
cSld
.
Bg
&&
this
.
cSld
.
Bg
.
bgPr
&&
this
.
cSld
.
Bg
.
bgPr
.
Fill
&&
this
.
cSld
.
Bg
.
bgPr
.
Fill
.
fill
instanceof
AscFormat
.
CBlipFill
&&
typeof
this
.
cSld
.
Bg
.
bgPr
.
Fill
.
fill
.
RasterImageId
===
"
string
"
)
{
{
...
@@ -957,6 +963,20 @@ Slide.prototype =
...
@@ -957,6 +963,20 @@ Slide.prototype =
}
}
},
},
getAllRasterImages
:
function
(
images
){
if
(
this
.
cSld
.
Bg
&&
this
.
cSld
.
Bg
.
bgPr
&&
this
.
cSld
.
Bg
.
bgPr
.
Fill
&&
this
.
cSld
.
Bg
.
bgPr
.
Fill
.
fill
instanceof
AscFormat
.
CBlipFill
&&
typeof
this
.
cSld
.
Bg
.
bgPr
.
Fill
.
fill
.
RasterImageId
===
"
string
"
)
{
images
.
push
(
AscCommon
.
getFullImageSrc2
(
this
.
cSld
.
Bg
.
bgPr
.
Fill
.
fill
.
RasterImageId
));
}
for
(
var
i
=
0
;
i
<
this
.
cSld
.
spTree
.
length
;
++
i
)
{
if
(
typeof
this
.
cSld
.
spTree
[
i
].
getAllRasterImages
===
"
function
"
)
{
this
.
cSld
.
spTree
[
i
].
getAllRasterImages
(
images
);
}
}
},
changeSize
:
function
(
width
,
height
)
changeSize
:
function
(
width
,
height
)
{
{
var
kw
=
width
/
this
.
Width
,
kh
=
height
/
this
.
Height
;
var
kw
=
width
/
this
.
Width
,
kh
=
height
/
this
.
Height
;
...
...
slide/api.js
View file @
3127f59b
...
@@ -3661,6 +3661,37 @@ background-repeat: no-repeat;\
...
@@ -3661,6 +3661,37 @@ background-repeat: no-repeat;\
}
}
};
};
asc_docs_api
.
prototype
.
asc_addOleObjectAction
=
function
(
sLocalUrl
,
sData
,
sApplicationId
,
fWidth
,
fHeight
,
nWidthPix
,
nHeightPix
)
{
var
_image
=
this
.
ImageLoader
.
LoadImage
(
AscCommon
.
getFullImageSrc2
(
sLocalUrl
),
1
);
if
(
null
!=
_image
)
//картинка уже должна быть загружена
{
if
(
false
===
this
.
WordControl
.
m_oLogicDocument
.
Document_Is_SelectionLocked
(
AscCommon
.
changestype_Drawing_Props
))
{
this
.
WordControl
.
m_oLogicDocument
.
Create_NewHistoryPoint
(
AscDFH
.
historydescription_Document_AddOleObject
);
this
.
WordControl
.
m_oLogicDocument
.
Add_OleObject
(
fWidth
,
fHeight
,
nWidthPix
,
nHeightPix
,
sLocalUrl
,
sData
,
sApplicationId
);
}
}
};
asc_docs_api
.
prototype
.
asc_editOleObjectAction
=
function
(
bResize
,
oOleObject
,
sImageUrl
,
sData
,
nPixWidth
,
nPixHeight
)
{
if
(
oOleObject
)
{
if
(
!
bResize
)
{
this
.
WordControl
.
m_oLogicDocument
.
Create_NewHistoryPoint
(
AscDFH
.
historydescription_Document_EditOleObject
);
this
.
WordControl
.
m_oLogicDocument
.
Edit_OleObject
(
oOleObject
,
sData
,
sImageUrl
,
nPixWidth
,
nPixHeight
);
this
.
WordControl
.
m_oLogicDocument
.
Recalculate
();
}
else
{
this
.
WordControl
.
m_oLogicDocument
.
Edit_OleObject
(
oOleObject
,
sData
,
sImageUrl
,
nPixWidth
,
nPixHeight
);
this
.
WordControl
.
m_oLogicDocument
.
Recalculate
();
}
}
};
asc_docs_api
.
prototype
.
AddTextArt
=
function
(
nStyle
)
asc_docs_api
.
prototype
.
AddTextArt
=
function
(
nStyle
)
{
{
if
(
editor
.
WordControl
.
m_oLogicDocument
.
Document_Is_SelectionLocked
(
changestype_Drawing_Props
)
===
false
)
if
(
editor
.
WordControl
.
m_oLogicDocument
.
Document_Is_SelectionLocked
(
changestype_Drawing_Props
)
===
false
)
...
@@ -6042,6 +6073,26 @@ background-repeat: no-repeat;\
...
@@ -6042,6 +6073,26 @@ background-repeat: no-repeat;\
};
};
asc_docs_api
.
prototype
.
asc_Recalculate
=
function
(
bIsUpdateInterface
)
{
if
(
!
this
.
WordControl
.
m_oLogicDocument
)
return
;
this
.
WordControl
.
m_oLogicDocument
.
Recalculate
({
Drawings
:
{
All
:
true
,
Map
:
{}}});
this
.
WordControl
.
m_oLogicDocument
.
DrawingDocument
.
OnEndRecalculate
();
};
asc_docs_api
.
prototype
.
asc_canPaste
=
function
()
{
if
(
!
this
.
WordControl
||
!
this
.
WordControl
.
m_oLogicDocument
||
this
.
WordControl
.
m_oLogicDocument
.
Document_Is_SelectionLocked
(
AscCommon
.
changestype_Drawing_Props
))
return
false
;
this
.
WordControl
.
m_oLogicDocument
.
Create_NewHistoryPoint
(
AscDFH
.
historydescription_Document_AddSectionBreak
);
return
true
;
};
// input
// input
asc_docs_api
.
prototype
.
Begin_CompositeInput
=
function
()
asc_docs_api
.
prototype
.
Begin_CompositeInput
=
function
()
{
{
...
...
slide/apiBuilder.js
View file @
3127f59b
...
@@ -728,6 +728,16 @@
...
@@ -728,6 +728,16 @@
}
}
};
};
/**
* Create new history point.
*/
ApiPresentation
.
prototype
.
CreateNewHistoryPoint
=
function
()
{
this
.
Presentation
.
Create_NewHistoryPoint
(
AscDFH
.
historydescription_Document_ApiBuilder
);
};
/**
//------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------
//
//
...
@@ -783,6 +793,27 @@
...
@@ -783,6 +793,27 @@
this
.
Slide
.
changeBackground
(
bg
);
this
.
Slide
.
changeBackground
(
bg
);
}
}
};
};
/**
* Getting slide width
* */
ApiSlide
.
prototype
.
GetWidth
=
function
(){
if
(
this
.
Slide
){
return
this
.
Slide
.
Width
*
36000
;
}
return
0
;
};
/**
* Getting slide height
* */
ApiSlide
.
prototype
.
GetHeight
=
function
(){
if
(
this
.
Slide
){
return
this
.
Slide
.
Height
*
36000
;
}
return
0
;
};
//------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------
//
//
// ApiDrawingContent
// ApiDrawingContent
...
@@ -1605,11 +1636,14 @@
...
@@ -1605,11 +1636,14 @@
ApiPresentation
.
prototype
[
"
GetSlideByIndex
"
]
=
ApiPresentation
.
prototype
.
GetSlideByIndex
;
ApiPresentation
.
prototype
[
"
GetSlideByIndex
"
]
=
ApiPresentation
.
prototype
.
GetSlideByIndex
;
ApiPresentation
.
prototype
[
"
GetCurrentSlide
"
]
=
ApiPresentation
.
prototype
.
GetCurrentSlide
;
ApiPresentation
.
prototype
[
"
GetCurrentSlide
"
]
=
ApiPresentation
.
prototype
.
GetCurrentSlide
;
ApiPresentation
.
prototype
[
"
AddSlide
"
]
=
ApiPresentation
.
prototype
.
AddSlide
;
ApiPresentation
.
prototype
[
"
AddSlide
"
]
=
ApiPresentation
.
prototype
.
AddSlide
;
ApiPresentation
.
prototype
[
"
CreateNewHistoryPoint
"
]
=
ApiPresentation
.
prototype
.
CreateNewHistoryPoint
;
ApiSlide
.
prototype
[
"
GetClassType
"
]
=
ApiSlide
.
prototype
.
GetClassType
;
ApiSlide
.
prototype
[
"
GetClassType
"
]
=
ApiSlide
.
prototype
.
GetClassType
;
ApiSlide
.
prototype
[
"
RemoveAllObjects
"
]
=
ApiSlide
.
prototype
.
RemoveAllObjects
;
ApiSlide
.
prototype
[
"
RemoveAllObjects
"
]
=
ApiSlide
.
prototype
.
RemoveAllObjects
;
ApiSlide
.
prototype
[
"
AddObject
"
]
=
ApiSlide
.
prototype
.
AddObject
;
ApiSlide
.
prototype
[
"
AddObject
"
]
=
ApiSlide
.
prototype
.
AddObject
;
ApiSlide
.
prototype
[
"
SetBackground
"
]
=
ApiSlide
.
prototype
.
SetBackground
;
ApiSlide
.
prototype
[
"
SetBackground
"
]
=
ApiSlide
.
prototype
.
SetBackground
;
ApiSlide
.
prototype
[
"
GetWidth
"
]
=
ApiSlide
.
prototype
.
GetWidth
;
ApiSlide
.
prototype
[
"
GetHeight
"
]
=
ApiSlide
.
prototype
.
GetHeight
;
ApiDrawingContent
.
prototype
[
"
GetClassType
"
]
=
ApiDrawingContent
.
prototype
.
GetClassType
;
ApiDrawingContent
.
prototype
[
"
GetClassType
"
]
=
ApiDrawingContent
.
prototype
.
GetClassType
;
ApiDrawingContent
.
prototype
[
"
GetElementsCount
"
]
=
ApiDrawingContent
.
prototype
.
GetElementsCount
;
ApiDrawingContent
.
prototype
[
"
GetElementsCount
"
]
=
ApiDrawingContent
.
prototype
.
GetElementsCount
;
...
...
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