[SSE] Add chart editing to ole editor

This commit is contained in:
Julia Radzhabova 2022-03-16 18:39:50 +03:00
parent da4c5b0e82
commit 05996df295
3 changed files with 82 additions and 6 deletions

View file

@ -241,6 +241,8 @@ define([
view.pmiTextAdvanced.on('click', _.bind(me.onTextAdvanced, me));
view.mnuShapeAdvanced.on('click', _.bind(me.onShapeAdvanced, me));
view.mnuChartEdit.on('click', _.bind(me.onChartEdit, me));
view.mnuChartData.on('click', _.bind(me.onChartData, me));
view.mnuChartType.on('click', _.bind(me.onChartType, me));
view.mnuImgAdvanced.on('click', _.bind(me.onImgAdvanced, me));
view.mnuSlicerAdvanced.on('click', _.bind(me.onSlicerAdvanced, me));
view.textInShapeMenu.on('render:after', _.bind(me.onTextInShapeAfterRender, me));
@ -1034,6 +1036,60 @@ define([
}
},
onChartData: function(btn) {
var me = this;
var props;
if (me.api){
props = me.api.asc_getChartObject();
if (props) {
me._isEditRanges = true;
props.startEdit();
var win = new SSE.Views.ChartDataDialog({
chartSettings: props,
api: me.api,
handler: function(result, value) {
if (result == 'ok') {
props.endEdit();
me._isEditRanges = false;
}
Common.NotificationCenter.trigger('edit:complete', me);
}
}).on('close', function() {
me._isEditRanges && props.cancelEdit();
me._isEditRanges = false;
});
win.show();
}
}
},
onChartType: function(btn) {
var me = this;
var props;
if (me.api){
props = me.api.asc_getChartObject();
if (props) {
me._isEditType = true;
props.startEdit();
var win = new SSE.Views.ChartTypeDialog({
chartSettings: props,
api: me.api,
handler: function(result, value) {
if (result == 'ok') {
props.endEdit();
me._isEditType = false;
}
Common.NotificationCenter.trigger('edit:complete', me);
}
}).on('close', function() {
me._isEditType && props.cancelEdit();
me._isEditType = false;
});
win.show();
}
}
},
onImgMacro: function(item) {
var me = this;
@ -1843,11 +1899,11 @@ define([
case Asc.c_oAscSelectionType.RangeCol: iscolmenu = true; break;
case Asc.c_oAscSelectionType.RangeMax: isallmenu = true; break;
case Asc.c_oAscSelectionType.RangeSlicer:
case Asc.c_oAscSelectionType.RangeImage: isimagemenu = !internaleditor; break;
case Asc.c_oAscSelectionType.RangeShape: isshapemenu = !internaleditor; break;
case Asc.c_oAscSelectionType.RangeChart: ischartmenu = !internaleditor; break;
case Asc.c_oAscSelectionType.RangeChartText:istextchartmenu = !internaleditor; break;
case Asc.c_oAscSelectionType.RangeShapeText: istextshapemenu = !internaleditor; break;
case Asc.c_oAscSelectionType.RangeImage: isimagemenu = !(this.permissions.isEditMailMerge || this.permissions.isEditDiagram); break;
case Asc.c_oAscSelectionType.RangeShape: isshapemenu = !(this.permissions.isEditMailMerge || this.permissions.isEditDiagram); break;
case Asc.c_oAscSelectionType.RangeChart: ischartmenu = !(this.permissions.isEditMailMerge || this.permissions.isEditDiagram); break;
case Asc.c_oAscSelectionType.RangeChartText:istextchartmenu = !(this.permissions.isEditMailMerge || this.permissions.isEditDiagram); break;
case Asc.c_oAscSelectionType.RangeShapeText: istextshapemenu = !(this.permissions.isEditMailMerge || this.permissions.isEditDiagram); break;
}
if (this.api.asc_getHeaderFooterMode()) {
@ -1918,6 +1974,10 @@ define([
documentHolder.mnuShapeAdvanced.setDisabled(isObjLocked);
documentHolder.mnuChartEdit.setVisible(ischartmenu && !isimagemenu && !isshapemenu && has_chartprops);
documentHolder.mnuChartEdit.setDisabled(isObjLocked);
documentHolder.mnuChartData.setVisible(this.permissions.isEditOle && ischartmenu && !isimagemenu && !isshapemenu && has_chartprops);
documentHolder.mnuChartData.setDisabled(isObjLocked);
documentHolder.mnuChartType.setVisible(this.permissions.isEditOle && ischartmenu && !isimagemenu && !isshapemenu && has_chartprops);
documentHolder.mnuChartType.setDisabled(isObjLocked);
documentHolder.pmiImgCut.setDisabled(isObjLocked);
documentHolder.pmiImgPaste.setDisabled(isObjLocked);
documentHolder.mnuImgAdvanced.setVisible(isimagemenu && (!isshapemenu || isimageonly) && !ischartmenu);
@ -1946,6 +2006,7 @@ define([
documentHolder.menuSignatureEditSetup.setVisible(isInSign);
documentHolder.menuEditSignSeparator.setVisible(isInSign);
documentHolder.menuImgMacro.setVisible(!internaleditor);
documentHolder.menuImgMacro.setDisabled(isObjLocked);
var canEditPoints = this.api && this.api.asc_canEditGeometry();

View file

@ -634,6 +634,15 @@ define([
caption : me.chartText
});
me.mnuChartData = new Common.UI.MenuItem({
iconCls : 'menu__icon btn-select-range',
caption : me.chartDataText
});
me.mnuChartType = new Common.UI.MenuItem({
caption : me.chartTypeText
});
me.pmiImgCut = new Common.UI.MenuItem({
iconCls: 'menu__icon btn-cut',
caption : me.txtCut,
@ -849,6 +858,8 @@ define([
me.menuImgMacro,
me.mnuShapeSeparator,
me.menuImgCrop,
me.mnuChartData,
me.mnuChartType,
me.mnuChartEdit,
me.mnuShapeAdvanced,
me.menuImgOriginalSize,
@ -1279,7 +1290,9 @@ define([
tipMarkersArrow: 'Arrow bullets',
tipMarkersCheckmark: 'Checkmark bullets',
tipMarkersFRhombus: 'Filled rhombus bullets',
tipMarkersDash: 'Dash bullets'
tipMarkersDash: 'Dash bullets',
chartDataText: 'Select Chart Data',
chartTypeText: 'Change Chart Type'
}, SSE.Views.DocumentHolder || {}));
});

View file

@ -1993,6 +1993,8 @@
"SSE.Views.DocumentHolder.txtUngroup": "Ungroup",
"SSE.Views.DocumentHolder.txtWidth": "Width",
"SSE.Views.DocumentHolder.vertAlignText": "Vertical Alignment",
"SSE.Views.DocumentHolder.chartDataText": "Select Chart Data",
"SSE.Views.DocumentHolder.chartTypeText": "Change Chart Type",
"SSE.Views.FieldSettingsDialog.strLayout": "Layout",
"SSE.Views.FieldSettingsDialog.strSubtotals": "Subtotals",
"SSE.Views.FieldSettingsDialog.textReport": "Report Form",