Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
web-apps
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
web-apps
Commits
cb05587b
Commit
cb05587b
authored
Dec 16, 2016
by
Julia Radzhabova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DE] [PE] Change chart type from the toolbar when chart is selected .
parent
3fe8ee25
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
25 deletions
+71
-25
apps/documenteditor/main/app/controller/Toolbar.js
apps/documenteditor/main/app/controller/Toolbar.js
+42
-15
apps/presentationeditor/main/app/controller/Toolbar.js
apps/presentationeditor/main/app/controller/Toolbar.js
+29
-10
No files found.
apps/documenteditor/main/app/controller/Toolbar.js
View file @
cb05587b
...
...
@@ -563,6 +563,7 @@ define([
var
pr
,
sh
,
i
=
-
1
,
type
,
paragraph_locked
=
false
,
header_locked
=
false
,
image_locked
=
false
,
can_add_table
=
false
,
can_add_image
=
false
,
enable_dropcap
=
undefined
,
...
...
@@ -590,6 +591,7 @@ define([
in_header
=
true
;
}
else
if
(
type
===
Asc
.
c_oAscTypeSelectElement
.
Image
)
{
in_image
=
in_header
=
true
;
image_locked
=
pr
.
get_Locked
();
if
(
pr
&&
pr
.
get_ChartProperties
())
in_chart
=
true
;
}
else
if
(
type
===
Asc
.
c_oAscTypeSelectElement
.
Math
)
{
...
...
@@ -670,16 +672,18 @@ define([
}
need_disable
=
paragraph_locked
||
header_locked
||
!
can_add_image
||
in_equation
;
if
(
need_disable
!=
toolbar
.
btnInsertChart
.
isDisabled
())
{
toolbar
.
btnInsertChart
.
setDisabled
(
need_disable
);
if
(
need_disable
!=
toolbar
.
btnInsertImage
.
isDisabled
())
{
toolbar
.
btnInsertImage
.
setDisabled
(
need_disable
);
toolbar
.
btnInsertShape
.
setDisabled
(
need_disable
);
toolbar
.
btnInsertText
.
setDisabled
(
need_disable
);
}
need_disable
=
need_disable
||
in_image
;
if
(
need_disable
!=
toolbar
.
mnuInsertTextArt
.
isDisabled
())
toolbar
.
mnuInsertTextArt
.
setDisabled
(
need_disable
);
if
((
need_disable
||
in_image
)
!=
toolbar
.
mnuInsertTextArt
.
isDisabled
())
toolbar
.
mnuInsertTextArt
.
setDisabled
(
need_disable
||
in_image
);
need_disable
=
in_chart
&&
image_locked
||
!
in_chart
&&
need_disable
;
if
(
need_disable
!=
toolbar
.
btnInsertChart
.
isDisabled
())
toolbar
.
btnInsertChart
.
setDisabled
(
need_disable
);
need_disable
=
paragraph_locked
||
header_locked
||
in_chart
||
!
can_add_image
&&!
in_equation
;
if
(
need_disable
!==
toolbar
.
btnInsertEquation
.
isDisabled
())
toolbar
.
btnInsertEquation
.
setDisabled
(
need_disable
);
...
...
@@ -1675,20 +1679,43 @@ define([
onSelectChart
:
function
(
picker
,
item
,
record
)
{
var
me
=
this
,
type
=
record
.
get
(
'
type
'
);
type
=
record
.
get
(
'
type
'
),
chart
=
false
;
var
selectedElements
=
me
.
api
.
getSelectedElements
();
if
(
selectedElements
&&
_
.
isArray
(
selectedElements
))
{
for
(
var
i
=
0
;
i
<
selectedElements
.
length
;
i
++
)
{
if
(
Asc
.
c_oAscTypeSelectElement
.
Image
==
selectedElements
[
i
].
get_ObjectType
())
{
var
elValue
=
selectedElements
[
i
].
get_ObjectValue
().
get_ChartProperties
();
if
(
elValue
)
{
chart
=
elValue
;
break
;
}
}
}
}
if
(
chart
)
{
var
props
=
new
Asc
.
asc_CImgProperty
();
chart
.
changeType
(
type
);
props
.
put_ChartProperties
(
chart
);
this
.
api
.
ImgApply
(
props
);
if
(
!
this
.
diagramEditor
)
this
.
diagramEditor
=
this
.
getApplication
().
getController
(
'
Common.Controllers.ExternalDiagramEditor
'
).
getView
(
'
Common.Views.ExternalDiagramEditor
'
);
Common
.
NotificationCenter
.
trigger
(
'
edit:complete
'
,
this
.
toolbar
);
}
else
{
if
(
!
this
.
diagramEditor
)
this
.
diagramEditor
=
this
.
getApplication
().
getController
(
'
Common.Controllers.ExternalDiagramEditor
'
).
getView
(
'
Common.Views.ExternalDiagramEditor
'
);
if
(
this
.
diagramEditor
&&
me
.
api
)
{
this
.
diagramEditor
.
setEditMode
(
false
);
this
.
diagramEditor
.
show
();
if
(
this
.
diagramEditor
&&
me
.
api
)
{
this
.
diagramEditor
.
setEditMode
(
false
);
this
.
diagramEditor
.
show
();
var
chart
=
me
.
api
.
asc_getChartObject
(
type
);
if
(
chart
)
{
this
.
diagramEditor
.
setChartData
(
new
Asc
.
asc_CChartBinary
(
chart
));
chart
=
me
.
api
.
asc_getChartObject
(
type
);
if
(
chart
)
{
this
.
diagramEditor
.
setChartData
(
new
Asc
.
asc_CChartBinary
(
chart
));
}
me
.
toolbar
.
fireEvent
(
'
insertchart
'
,
me
.
toolbar
);
}
me
.
toolbar
.
fireEvent
(
'
insertchart
'
,
me
.
toolbar
);
}
},
...
...
apps/presentationeditor/main/app/controller/Toolbar.js
View file @
cb05587b
...
...
@@ -1450,20 +1450,39 @@ define([
onSelectChart
:
function
(
picker
,
item
,
record
)
{
var
me
=
this
,
type
=
record
.
get
(
'
type
'
);
type
=
record
.
get
(
'
type
'
),
chart
=
false
;
var
selectedElements
=
me
.
api
.
getSelectedElements
();
if
(
selectedElements
&&
_
.
isArray
(
selectedElements
))
{
for
(
var
i
=
0
;
i
<
selectedElements
.
length
;
i
++
)
{
if
(
Asc
.
c_oAscTypeSelectElement
.
Chart
==
selectedElements
[
i
].
get_ObjectType
())
{
chart
=
true
;
break
;
}
}
}
if
(
!
this
.
diagramEditor
)
this
.
diagramEditor
=
this
.
getApplication
().
getController
(
'
Common.Controllers.ExternalDiagramEditor
'
).
getView
(
'
Common.Views.ExternalDiagramEditor
'
);
if
(
chart
)
{
var
props
=
new
Asc
.
CAscChartProp
();
props
.
changeType
(
type
);
this
.
api
.
ChartApply
(
props
);
if
(
this
.
diagramEditor
&&
me
.
api
)
{
this
.
diagramEditor
.
setEditMode
(
false
);
this
.
diagramEditor
.
show
();
Common
.
NotificationCenter
.
trigger
(
'
edit:complete
'
,
this
.
toolbar
);
}
else
{
if
(
!
this
.
diagramEditor
)
this
.
diagramEditor
=
this
.
getApplication
().
getController
(
'
Common.Controllers.ExternalDiagramEditor
'
).
getView
(
'
Common.Views.ExternalDiagramEditor
'
);
var
chart
=
me
.
api
.
asc_getChartObject
(
type
);
if
(
chart
)
{
this
.
diagramEditor
.
setChartData
(
new
Asc
.
asc_CChartBinary
(
chart
));
if
(
this
.
diagramEditor
&&
me
.
api
)
{
this
.
diagramEditor
.
setEditMode
(
false
);
this
.
diagramEditor
.
show
();
chart
=
me
.
api
.
asc_getChartObject
(
type
);
if
(
chart
)
{
this
.
diagramEditor
.
setChartData
(
new
Asc
.
asc_CChartBinary
(
chart
));
}
me
.
toolbar
.
fireEvent
(
'
insertchart
'
,
me
.
toolbar
);
}
me
.
toolbar
.
fireEvent
(
'
insertchart
'
,
me
.
toolbar
);
}
},
...
...
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