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
d6f2b100
Commit
d6f2b100
authored
May 25, 2017
by
SergeyLuzyanin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
photo editor in cell and slide
parent
2f2b518d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
164 additions
and
5 deletions
+164
-5
cell/apiBuilder.js
cell/apiBuilder.js
+89
-3
cell/model/DrawingObjects/Format/ShapePrototype.js
cell/model/DrawingObjects/Format/ShapePrototype.js
+1
-1
common/Drawings/CommonController.js
common/Drawings/CommonController.js
+1
-0
common/Drawings/Format/ChartFormat.js
common/Drawings/Format/ChartFormat.js
+1
-1
slide/apiBuilder.js
slide/apiBuilder.js
+72
-0
No files found.
cell/apiBuilder.js
View file @
d6f2b100
...
...
@@ -494,7 +494,93 @@
ApiWorksheet
.
prototype
.
AddImage
=
function
(
sImageSrc
,
nWidth
,
nHeight
,
nFromCol
,
nColOffset
,
nFromRow
,
nRowOffset
){
var
oImage
=
AscFormat
.
DrawingObjectsController
.
prototype
.
createImage
(
sImageSrc
,
0
,
0
,
nWidth
/
36000
,
nHeight
/
36000
);
private_SetCoords
(
oImage
,
this
.
worksheet
,
nWidth
,
nHeight
,
nFromCol
,
nColOffset
,
nFromRow
,
nRowOffset
);
return
new
ApiImage
(
AscFormat
.
DrawingObjectsController
.
prototype
.
createImage
(
sImageSrc
,
0
,
0
,
nWidth
/
36000
,
nHeight
/
36000
));
return
new
ApiImage
(
oImage
);
};
/**
*/
ApiWorksheet
.
prototype
.
ReplaceCurrentImage
=
function
(
sImageUrl
,
Width
,
Height
){
var
oWorksheet
=
Asc
.
editor
.
wb
.
getWorksheet
();
if
(
oWorksheet
&&
oWorksheet
.
objectRender
&&
oWorksheet
.
objectRender
.
controller
){
var
oController
=
oWorksheet
.
objectRender
.
controller
;
var
_w
=
Width
/
36000.0
;
var
_h
=
Height
/
36000.0
;
var
oImage
=
oController
.
createImage
(
sImageUrl
,
0
,
0
,
_w
,
_h
);
oImage
.
setWorksheet
(
oWorksheet
.
model
);
var
selectedObjects
,
spTree
;
if
(
oController
.
selection
.
groupSelection
){
selectedObjects
=
oController
.
selection
.
groupSelection
.
selectedObjects
;
}
else
{
selectedObjects
=
oController
.
selectedObjects
;
}
if
(
selectedObjects
.
length
>
0
){
if
(
selectedObjects
[
0
].
group
){
spTree
=
selectedObjects
[
0
].
group
.
spTree
;
}
else
{
spTree
=
oController
.
getDrawingArray
();
}
for
(
var
i
=
0
;
i
<
spTree
.
length
;
++
i
){
if
(
spTree
[
i
]
===
selectedObjects
[
0
]){
if
(
spTree
[
i
].
getObjectType
()
===
AscDFH
.
historyitem_type_ImageShape
){
spTree
[
i
].
setBlipFill
(
AscFormat
.
CreateBlipFillRasterImageId
(
sImageUrl
));
if
(
selectedObjects
[
0
].
group
){
oController
.
selection
.
groupSelection
.
resetInternalSelection
();
_group
.
selectObject
(
spTree
[
i
],
0
);
}
else
{
oController
.
resetSelection
();
oController
.
selectObject
(
spTree
[
i
],
0
);
}
}
else
{
var
_xfrm
=
spTree
[
i
].
spPr
&&
spTree
[
i
].
spPr
.
xfrm
;
var
_xfrm2
=
oImage
.
spPr
.
xfrm
;
if
(
_xfrm
){
_xfrm2
.
setOffX
(
_xfrm
.
offX
);
_xfrm2
.
setOffY
(
_xfrm
.
offY
);
}
else
{
if
(
AscFormat
.
isRealNumber
(
spTree
[
i
].
x
)
&&
AscFormat
.
isRealNumber
(
spTree
[
i
].
y
)){
_xfrm2
.
setOffX
(
spTree
[
i
].
x
);
_xfrm2
.
setOffY
(
spTree
[
i
].
y
);
}
}
if
(
selectedObjects
[
0
].
group
){
var
_group
=
selectedObjects
[
0
].
group
;
_group
.
removeFromSpTreeByPos
(
i
);
_group
.
addToSpTree
(
i
,
oImage
);
oImage
.
setGroup
(
_group
);
oController
.
selection
.
groupSelection
.
resetInternalSelection
();
_group
.
selectObject
(
oImage
,
0
);
}
else
{
var
_object
=
spTree
[
i
];
_object
.
deleteDrawingBase
();
oImage
.
setBDeleted
(
false
);
oImage
.
setWorksheet
(
oWorksheet
.
model
);
oImage
.
setBFromSerialize
(
true
);
oImage
.
addToDrawingObjects
(
i
);
oImage
.
setDrawingBaseType
(
AscCommon
.
c_oAscCellAnchorType
.
cellanchorAbsolute
);
oImage
.
setDrawingBaseCoords
(
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
_object
.
x
,
_object
.
y
,
oImage
.
spPr
.
xfrm
.
extX
,
oImage
.
spPr
.
xfrm
.
extY
);
oImage
.
setDrawingBaseExt
(
oImage
.
spPr
.
xfrm
.
extX
,
oImage
.
spPr
.
xfrm
.
extY
);
oController
.
resetSelection
();
oController
.
selectObject
(
oImage
,
0
);
}
}
return
;
}
}
}
var
cell
=
this
.
worksheet
.
selectionRange
.
activeCell
;
private_SetCoords
(
oImage
,
oWorksheet
.
model
,
Width
,
Height
,
cell
?
cell
.
col
:
0
,
0
,
cell
?
cell
.
row
:
0
,
0
,
undefined
);
oController
.
resetSelection
();
oController
.
selectObject
(
oImage
,
0
);
}
};
/**
...
...
@@ -1189,7 +1275,7 @@
ApiColor
.
prototype
[
"
GetClassType
"
]
=
ApiColor
.
prototype
.
GetClassType
;
function
private_SetCoords
(
oDrawing
,
oWorksheet
,
nExtX
,
nExtY
,
nFromCol
,
nColOffset
,
nFromRow
,
nRowOffset
){
function
private_SetCoords
(
oDrawing
,
oWorksheet
,
nExtX
,
nExtY
,
nFromCol
,
nColOffset
,
nFromRow
,
nRowOffset
,
pos
){
oDrawing
.
x
=
0
;
oDrawing
.
y
=
0
;
oDrawing
.
extX
=
0
;
...
...
@@ -1200,7 +1286,7 @@
oDrawing
.
setBDeleted
(
false
);
oDrawing
.
setWorksheet
(
oWorksheet
);
oDrawing
.
setBFromSerialize
(
true
);
oDrawing
.
addToDrawingObjects
();
oDrawing
.
addToDrawingObjects
(
pos
);
oDrawing
.
setDrawingBaseType
(
AscCommon
.
c_oAscCellAnchorType
.
cellanchorOneCell
);
oDrawing
.
setDrawingBaseCoords
(
nFromCol
,
nColOffset
/
36000.0
,
nFromRow
,
nRowOffset
/
36000.0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
);
oDrawing
.
setDrawingBaseExt
(
nExtX
/
36000.0
,
nExtY
/
36000.0
);
...
...
cell/model/DrawingObjects/Format/ShapePrototype.js
View file @
d6f2b100
...
...
@@ -260,7 +260,7 @@ function CChangesDrawingObjectsRemoveFromDrawingObjects(Class, Pos){
CShape
.
prototype
.
addToDrawingObjects
=
function
(
pos
,
type
)
{
var
position
=
addToDrawings
(
this
.
worksheet
,
this
,
pos
,
/*lockByDefault*/
undefined
,
undefined
);
var
position
=
addToDrawings
(
this
.
worksheet
,
this
,
pos
,
/*lockByDefault*/
undefined
,
type
);
//var data = {Type: AscDFH.historyitem_AutoShapes_AddToDrawingObjects, Pos: position};
History
.
Add
(
new
CChangesDrawingObjectsAddToDrawingObjects
(
this
,
position
));
//this.worksheet.addContentChanges(new AscCommon.CContentChangesElement(AscCommon.contentchanges_Add, data.Pos, 1, data));
...
...
common/Drawings/CommonController.js
View file @
d6f2b100
...
...
@@ -11068,4 +11068,5 @@ function ApplyPresetToChartSpace(oChartSpace, aPreset, bCreate){
window
[
'
AscFormat
'
].
CreateBlipFillUniFillFromUrl
=
CreateBlipFillUniFillFromUrl
;
window
[
'
AscFormat
'
].
fGetListTypeFromBullet
=
fGetListTypeFromBullet
;
window
[
'
AscFormat
'
].
fGetPresentationBulletByNumInfo
=
fGetPresentationBulletByNumInfo
;
window
[
'
AscFormat
'
].
CreateBlipFillRasterImageId
=
CreateBlipFillRasterImageId
;
})(
window
);
common/Drawings/Format/ChartFormat.js
View file @
d6f2b100
...
...
@@ -11651,7 +11651,7 @@ CSurfaceChart.prototype =
isWireframe
:
function
(){
return
this
.
wireframe
!==
fals
e
;
return
this
.
wireframe
===
tru
e
;
},
getBandFmtByIndex
:
function
(
idx
){
...
...
slide/apiBuilder.js
View file @
d6f2b100
...
...
@@ -418,6 +418,77 @@
};
/**
* Replace current image
*/
ApiPresentation
.
prototype
.
ReplaceCurrentImage
=
function
(
sImageUrl
,
Width
,
Height
)
{
var
oPr
=
this
.
Presentation
;
if
(
oPr
.
Slides
[
oPr
.
CurPage
]){
var
_slide
=
oPr
.
Slides
[
oPr
.
CurPage
];
var
oController
=
_slide
.
graphicObjects
;
var
_w
=
Width
/
36000.0
;
var
_h
=
Height
/
36000.0
;
var
oImage
=
oController
.
createImage
(
sImageUrl
,
0
,
0
,
_w
,
_h
);
oImage
.
setParent
(
_slide
);
var
selectedObjects
,
spTree
;
if
(
oController
.
selection
.
groupSelection
){
selectedObjects
=
oController
.
selection
.
groupSelection
.
selectedObjects
;
}
else
{
selectedObjects
=
oController
.
selectedObjects
;
}
if
(
selectedObjects
.
length
>
0
){
if
(
selectedObjects
[
0
].
group
){
spTree
=
selectedObjects
[
0
].
group
.
spTree
;
}
else
{
spTree
=
_slide
.
cSld
.
spTree
;
}
for
(
var
i
=
0
;
i
<
spTree
.
length
;
++
i
){
if
(
spTree
[
i
]
===
selectedObjects
[
0
]){
var
_xfrm
=
spTree
[
i
].
spPr
&&
spTree
[
i
].
spPr
.
xfrm
;
var
_xfrm2
=
oImage
.
spPr
.
xfrm
;
if
(
_xfrm
){
_xfrm2
.
setOffX
(
_xfrm
.
offX
);
_xfrm2
.
setOffY
(
_xfrm
.
offY
);
//_xfrm2.setRot(_xfrm.rot);
}
else
{
if
(
AscFormat
.
isRealNumber
(
spTree
[
i
].
x
)
&&
AscFormat
.
isRealNumber
(
spTree
[
i
].
y
)){
_xfrm2
.
setOffX
(
spTree
[
i
].
x
);
_xfrm2
.
setOffY
(
spTree
[
i
].
y
);
}
}
if
(
selectedObjects
[
0
].
group
){
var
_group
=
selectedObjects
[
0
].
group
;
_group
.
removeFromSpTreeByPos
(
i
);
_group
.
addToSpTree
(
i
,
oImage
);
oImage
.
setGroup
(
_group
);
oController
.
selection
.
groupSelection
.
resetInternalSelection
();
_group
.
selectObject
(
oImage
,
oPr
.
CurPage
);
}
else
{
_slide
.
removeFromSpTreeByPos
(
i
);
_slide
.
addToSpTreeToPos
(
i
,
oImage
);
oController
.
resetSelection
();
oController
.
selectObject
(
oImage
,
oPr
.
CurPage
);
}
return
;
}
}
}
var
_x
=
(
this
.
Presentation
.
Width
-
_w
)
/
2.0
;
var
_y
=
(
this
.
Presentation
.
Height
-
_h
)
/
2.0
;
oImage
.
spPr
.
xfrm
.
setOffX
(
_x
);
oImage
.
spPr
.
xfrm
.
setOffY
(
_y
);
_slide
.
addToSpTreeToPos
(
_slide
.
cSld
.
spTree
.
length
,
oImage
);
oController
.
resetSelection
();
oController
.
selectObject
(
oImage
,
oPr
.
CurPage
);
}
};
/**
//------------------------------------------------------------------------------------------------------------------
...
...
@@ -843,6 +914,7 @@
ApiPresentation
.
prototype
[
"
AddSlide
"
]
=
ApiPresentation
.
prototype
.
AddSlide
;
ApiPresentation
.
prototype
[
"
CreateNewHistoryPoint
"
]
=
ApiPresentation
.
prototype
.
CreateNewHistoryPoint
;
ApiPresentation
.
prototype
[
"
SetSizes
"
]
=
ApiPresentation
.
prototype
.
SetSizes
;
ApiPresentation
.
prototype
[
"
ReplaceCurrentImage
"
]
=
ApiPresentation
.
prototype
.
ReplaceCurrentImage
;
ApiSlide
.
prototype
[
"
GetClassType
"
]
=
ApiSlide
.
prototype
.
GetClassType
;
ApiSlide
.
prototype
[
"
RemoveAllObjects
"
]
=
ApiSlide
.
prototype
.
RemoveAllObjects
;
...
...
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