[SSE] Refactoring ole editor: add toolbar buttons
This commit is contained in:
parent
7a282063ef
commit
fc47f0f167
|
@ -647,7 +647,7 @@ Common.UI.HintManager = new(function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
var _setMode = function (mode) {
|
var _setMode = function (mode) {
|
||||||
_isEditDiagram = mode.isEditDiagram;
|
_isEditDiagram = mode.isEditDiagram || mode.isEditMailMerge || mode.isEditOle;
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -468,7 +468,7 @@ define([
|
||||||
this.isFrameClosed = (this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle);
|
this.isFrameClosed = (this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle);
|
||||||
Common.Controllers.Desktop.init(this.appOptions);
|
Common.Controllers.Desktop.init(this.appOptions);
|
||||||
|
|
||||||
if (this.appOptions.isEditDiagram) {
|
if (this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle) {
|
||||||
Common.UI.HintManager.setMode(this.appOptions);
|
Common.UI.HintManager.setMode(this.appOptions);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1437,7 +1437,7 @@ define([
|
||||||
application.getController('WBProtection').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
|
application.getController('WBProtection').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
|
||||||
|
|
||||||
if (statusbarController) {
|
if (statusbarController) {
|
||||||
statusbarController.getView('Statusbar').changeViewMode(!me.appOptions.isEditOle);
|
statusbarController.getView('Statusbar').changeViewMode(me.appOptions);
|
||||||
me.appOptions.isEditOle && statusbarController.onChangeViewMode(null, true, true); // set compact status bar for ole editing mode
|
me.appOptions.isEditOle && statusbarController.onChangeViewMode(null, true, true); // set compact status bar for ole editing mode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -312,6 +312,14 @@ define([
|
||||||
toolbar.btnSortUp.on('click', _.bind(this.onSortType, this, Asc.c_oAscSortOptions.Descending));
|
toolbar.btnSortUp.on('click', _.bind(this.onSortType, this, Asc.c_oAscSortOptions.Descending));
|
||||||
toolbar.btnSetAutofilter.on('click', _.bind(this.onAutoFilter, this));
|
toolbar.btnSetAutofilter.on('click', _.bind(this.onAutoFilter, this));
|
||||||
toolbar.btnClearAutofilter.on('click', _.bind(this.onClearFilter, this));
|
toolbar.btnClearAutofilter.on('click', _.bind(this.onClearFilter, this));
|
||||||
|
toolbar.btnInsertFormula.on('click', _.bind(this.onInsertFormulaMenu, this));
|
||||||
|
toolbar.btnInsertFormula.menu.on('item:click', _.bind(this.onInsertFormulaMenu, this));
|
||||||
|
toolbar.btnDecDecimal.on('click', _.bind(this.onDecrement, this));
|
||||||
|
toolbar.btnIncDecimal.on('click', _.bind(this.onIncrement, this));
|
||||||
|
toolbar.cmbNumberFormat.on('selected', _.bind(this.onNumberFormatSelect, this));
|
||||||
|
toolbar.cmbNumberFormat.on('show:before', _.bind(this.onNumberFormatOpenBefore, this, true));
|
||||||
|
if (toolbar.cmbNumberFormat.cmpEl)
|
||||||
|
toolbar.cmbNumberFormat.cmpEl.on('click', '#id-toolbar-mnu-item-more-formats a', _.bind(this.onNumberFormatSelect, this));
|
||||||
} else {
|
} else {
|
||||||
toolbar.btnPrint.on('click', _.bind(this.onPrint, this));
|
toolbar.btnPrint.on('click', _.bind(this.onPrint, this));
|
||||||
toolbar.btnPrint.on('disabled', _.bind(this.onBtnChangeState, this, 'print:disabled'));
|
toolbar.btnPrint.on('disabled', _.bind(this.onBtnChangeState, this, 'print:disabled'));
|
||||||
|
@ -3105,12 +3113,28 @@ define([
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _set = Common.enumLock;
|
||||||
|
var type = seltype;
|
||||||
|
switch ( seltype ) {
|
||||||
|
case Asc.c_oAscSelectionType.RangeSlicer:
|
||||||
|
case Asc.c_oAscSelectionType.RangeImage: type = _set.selImage; break;
|
||||||
|
case Asc.c_oAscSelectionType.RangeShape: type = _set.selShape; break;
|
||||||
|
case Asc.c_oAscSelectionType.RangeShapeText: type = _set.selShapeText; break;
|
||||||
|
case Asc.c_oAscSelectionType.RangeChart: type = _set.selChart; break;
|
||||||
|
case Asc.c_oAscSelectionType.RangeChartText: type = _set.selChartText; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
me.toolbar.lockToolbar(type, type != seltype, {
|
||||||
|
clear: [_set.selImage, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.coAuth]
|
||||||
|
});
|
||||||
|
|
||||||
me.toolbar.lockToolbar(Common.enumLock.coAuthText, is_objLocked);
|
me.toolbar.lockToolbar(Common.enumLock.coAuthText, is_objLocked);
|
||||||
|
|
||||||
return is_image;
|
return is_image;
|
||||||
};
|
};
|
||||||
|
|
||||||
var selectionType = info.asc_getSelectionType(),
|
var selectionType = info.asc_getSelectionType(),
|
||||||
|
xfs = info.asc_getXfs(),
|
||||||
coauth_disable = false,
|
coauth_disable = false,
|
||||||
editOptionsDisabled = _disableEditOptions(selectionType, coauth_disable),
|
editOptionsDisabled = _disableEditOptions(selectionType, coauth_disable),
|
||||||
val, need_disable = false;
|
val, need_disable = false;
|
||||||
|
@ -3135,6 +3159,17 @@ define([
|
||||||
need_disable = this._state.controlsdisabled.filters || !filterInfo || (filterInfo.asc_getIsApplyAutoFilter()!==true);
|
need_disable = this._state.controlsdisabled.filters || !filterInfo || (filterInfo.asc_getIsApplyAutoFilter()!==true);
|
||||||
me.toolbar.lockToolbar(Common.enumLock.ruleDelFilter, need_disable, {array: [me.toolbar.btnClearAutofilter]});
|
me.toolbar.lockToolbar(Common.enumLock.ruleDelFilter, need_disable, {array: [me.toolbar.btnClearAutofilter]});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var val = xfs.asc_getNumFormatInfo();
|
||||||
|
if ( val ) {
|
||||||
|
this._state.numformat = xfs.asc_getNumFormat();
|
||||||
|
this._state.numformatinfo = val;
|
||||||
|
val = val.asc_getType();
|
||||||
|
if (this._state.numformattype !== val) {
|
||||||
|
me.toolbar.cmbNumberFormat.setValue(val, me.toolbar.txtCustom);
|
||||||
|
this._state.numformattype = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onApiStyleChange: function() {
|
onApiStyleChange: function() {
|
||||||
|
@ -3793,7 +3828,7 @@ define([
|
||||||
var me = this;
|
var me = this;
|
||||||
me.appConfig = config;
|
me.appConfig = config;
|
||||||
|
|
||||||
var compactview = !config.isEdit || config.isEditOle;
|
var compactview = !config.isEdit;
|
||||||
if ( config.isEdit && !config.isEditDiagram && !config.isEditMailMerge && !config.isEditOle ) {
|
if ( config.isEdit && !config.isEditDiagram && !config.isEditMailMerge && !config.isEditOle ) {
|
||||||
if ( Common.localStorage.itemExists("sse-compact-toolbar") ) {
|
if ( Common.localStorage.itemExists("sse-compact-toolbar") ) {
|
||||||
compactview = Common.localStorage.getBool("sse-compact-toolbar");
|
compactview = Common.localStorage.getBool("sse-compact-toolbar");
|
||||||
|
|
|
@ -85,6 +85,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="separator short"></div>
|
<div class="separator short"></div>
|
||||||
|
<div class="group small">
|
||||||
|
<div class="elset">
|
||||||
|
<span class="btn-slot split" id="slot-btn-formula"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="separator short"></div>
|
||||||
<div class="group small">
|
<div class="group small">
|
||||||
<div class="elset">
|
<div class="elset">
|
||||||
<span class="btn-slot split" id="slot-btn-sortdesc"></span>
|
<span class="btn-slot split" id="slot-btn-sortdesc"></span>
|
||||||
|
@ -99,6 +105,14 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="separator short"></div>
|
<div class="separator short"></div>
|
||||||
|
<div class="group small">
|
||||||
|
<div class="elset">
|
||||||
|
<span class="btn-slot split" id="slot-btn-digit-dec"></span>
|
||||||
|
<span class="btn-slot split" id="slot-btn-digit-inc"></span>
|
||||||
|
<span class="btn-slot" id="slot-btn-format" style="width: 84px; vertical-align: middle;"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="separator short"></div>
|
||||||
<div class="group small">
|
<div class="group small">
|
||||||
<div class="elset">
|
<div class="elset">
|
||||||
<span class="btn-slot" id="slot-btn-search"></span>
|
<span class="btn-slot" id="slot-btn-search"></span>
|
||||||
|
|
|
@ -516,7 +516,8 @@ define([
|
||||||
this.mode = _.extend({}, this.mode, mode);
|
this.mode = _.extend({}, this.mode, mode);
|
||||||
// this.$el.find('.el-edit')[mode.isEdit?'show':'hide']();
|
// this.$el.find('.el-edit')[mode.isEdit?'show':'hide']();
|
||||||
//this.btnAddWorksheet.setVisible(this.mode.isEdit);
|
//this.btnAddWorksheet.setVisible(this.mode.isEdit);
|
||||||
$('#status-addtabs-box')[(this.mode.isEdit && !this.mode.isEditOle ) ? 'show' : 'hide']();
|
$('#status-addtabs-box')[(this.mode.isEdit) ? 'show' : 'hide']();
|
||||||
|
this.btnAddWorksheet.setVisible(!this.mode.isEditOle);
|
||||||
this.btnAddWorksheet.setDisabled(this.mode.isDisconnected || this.api && (this.api.asc_isWorkbookLocked() || this.api.isCellEdited) || this.rangeSelectionMode!=Asc.c_oAscSelectionDialogType.None);
|
this.btnAddWorksheet.setDisabled(this.mode.isDisconnected || this.api && (this.api.asc_isWorkbookLocked() || this.api.isCellEdited) || this.rangeSelectionMode!=Asc.c_oAscSelectionDialogType.None);
|
||||||
this.updateTabbarBorders();
|
this.updateTabbarBorders();
|
||||||
},
|
},
|
||||||
|
@ -890,11 +891,12 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
changeViewMode: function (edit) {
|
changeViewMode: function (mode) {
|
||||||
|
var edit = mode.isEdit && !mode.isEditOle;
|
||||||
if (edit) {
|
if (edit) {
|
||||||
this.tabBarBox.css('left', '175px');
|
this.tabBarBox.css('left', '175px');
|
||||||
} else {
|
} else {
|
||||||
this.tabBarBox.css('left', '');
|
this.tabBarBox.css('left', mode.isEditOle ? '152px' : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tabbar.options.draggable = edit;
|
this.tabbar.options.draggable = edit;
|
||||||
|
|
|
@ -197,7 +197,7 @@ define([
|
||||||
cls : 'btn-toolbar',
|
cls : 'btn-toolbar',
|
||||||
iconCls : 'toolbar__icon btn-copy',
|
iconCls : 'toolbar__icon btn-copy',
|
||||||
dataHint: '1',
|
dataHint: '1',
|
||||||
dataHintDirection: config.isEditDiagram ? 'bottom' : 'top',
|
dataHintDirection: (config.isEditDiagram || config.isEditMailMerge || config.isEditOle) ? 'bottom' : 'top',
|
||||||
dataHintTitle: 'C'
|
dataHintTitle: 'C'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ define([
|
||||||
iconCls : 'toolbar__icon btn-paste',
|
iconCls : 'toolbar__icon btn-paste',
|
||||||
lock : [/*_set.editCell,*/ _set.coAuth, _set.lostConnect],
|
lock : [/*_set.editCell,*/ _set.coAuth, _set.lostConnect],
|
||||||
dataHint : '1',
|
dataHint : '1',
|
||||||
dataHintDirection: config.isEditDiagram ? 'bottom' : 'top',
|
dataHintDirection: (config.isEditDiagram || config.isEditMailMerge || config.isEditOle) ? 'bottom' : 'top',
|
||||||
dataHintTitle: 'V'
|
dataHintTitle: 'V'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -235,9 +235,9 @@ define([
|
||||||
dataHintTitle: 'Y'
|
dataHintTitle: 'Y'
|
||||||
});
|
});
|
||||||
|
|
||||||
if ( config.isEditDiagram ) {
|
if (config.isEditDiagram || config.isEditMailMerge || config.isEditOle ) {
|
||||||
me.$layout = $(_.template(simple)(config));
|
me.$layout = $(_.template(simple)(config));
|
||||||
|
if ( config.isEditDiagram || config.isEditOle ) {
|
||||||
me.btnInsertFormula = new Common.UI.Button({
|
me.btnInsertFormula = new Common.UI.Button({
|
||||||
id : 'id-toolbar-btn-insertformula',
|
id : 'id-toolbar-btn-insertformula',
|
||||||
cls : 'btn-toolbar',
|
cls : 'btn-toolbar',
|
||||||
|
@ -304,10 +304,11 @@ define([
|
||||||
editable : false,
|
editable : false,
|
||||||
data : me.numFormatData,
|
data : me.numFormatData,
|
||||||
dataHint : '1',
|
dataHint : '1',
|
||||||
dataHintDirection: config.isEditDiagram ? 'bottom' : 'top',
|
dataHintDirection: 'bottom',
|
||||||
dataHintOffset: config.isEditDiagram ? 'big' : undefined
|
dataHintOffset: 'big'
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
if ( config.isEditDiagram ) {
|
||||||
me.btnEditChart = new Common.UI.Button({
|
me.btnEditChart = new Common.UI.Button({
|
||||||
id : 'id-toolbar-rtn-edit-chart',
|
id : 'id-toolbar-rtn-edit-chart',
|
||||||
cls : 'btn-toolbar btn-text-default auto',
|
cls : 'btn-toolbar btn-text-default auto',
|
||||||
|
@ -341,29 +342,33 @@ define([
|
||||||
dataHintDirection: 'left',
|
dataHintDirection: 'left',
|
||||||
dataHintOffset: 'medium'
|
dataHintOffset: 'medium'
|
||||||
});
|
});
|
||||||
} else
|
}
|
||||||
if ( config.isEditMailMerge || config.isEditOle ) {
|
if ( config.isEditMailMerge || config.isEditOle ) {
|
||||||
me.$layout = $(_.template(simple)(config));
|
|
||||||
|
|
||||||
me.btnSearch = new Common.UI.Button({
|
me.btnSearch = new Common.UI.Button({
|
||||||
id : 'id-toolbar-btn-search',
|
id : 'id-toolbar-btn-search',
|
||||||
cls : 'btn-toolbar',
|
cls : 'btn-toolbar',
|
||||||
iconCls : 'toolbar__icon btn-menu-search',
|
iconCls : 'toolbar__icon btn-menu-search',
|
||||||
lock : [_set.lostConnect]
|
lock : [_set.lostConnect],
|
||||||
|
dataHint : '1',
|
||||||
|
dataHintDirection: 'bottom'
|
||||||
});
|
});
|
||||||
|
|
||||||
me.btnSortDown = new Common.UI.Button({
|
me.btnSortDown = new Common.UI.Button({
|
||||||
id : 'id-toolbar-btn-sort-down',
|
id : 'id-toolbar-btn-sort-down',
|
||||||
cls : 'btn-toolbar',
|
cls : 'btn-toolbar',
|
||||||
iconCls : 'toolbar__icon btn-sort-down',
|
iconCls : 'toolbar__icon btn-sort-down',
|
||||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot]
|
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot],
|
||||||
|
dataHint : '1',
|
||||||
|
dataHintDirection: 'bottom'
|
||||||
});
|
});
|
||||||
|
|
||||||
me.btnSortUp = new Common.UI.Button({
|
me.btnSortUp = new Common.UI.Button({
|
||||||
id : 'id-toolbar-btn-sort-up',
|
id : 'id-toolbar-btn-sort-up',
|
||||||
cls : 'btn-toolbar',
|
cls : 'btn-toolbar',
|
||||||
iconCls : 'toolbar__icon btn-sort-up',
|
iconCls : 'toolbar__icon btn-sort-up',
|
||||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot]
|
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot],
|
||||||
|
dataHint : '1',
|
||||||
|
dataHintDirection: 'bottom'
|
||||||
});
|
});
|
||||||
|
|
||||||
me.btnSetAutofilter = new Common.UI.Button({
|
me.btnSetAutofilter = new Common.UI.Button({
|
||||||
|
@ -371,17 +376,21 @@ define([
|
||||||
cls : 'btn-toolbar',
|
cls : 'btn-toolbar',
|
||||||
iconCls : 'toolbar__icon btn-autofilter',
|
iconCls : 'toolbar__icon btn-autofilter',
|
||||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot],
|
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot],
|
||||||
enableToggle: true
|
enableToggle: true,
|
||||||
|
dataHint : '1',
|
||||||
|
dataHintDirection: 'bottom'
|
||||||
});
|
});
|
||||||
|
|
||||||
me.btnClearAutofilter = new Common.UI.Button({
|
me.btnClearAutofilter = new Common.UI.Button({
|
||||||
id : 'id-toolbar-btn-clearfilter',
|
id : 'id-toolbar-btn-clearfilter',
|
||||||
cls : 'btn-toolbar',
|
cls : 'btn-toolbar',
|
||||||
iconCls : 'toolbar__icon btn-clear-filter',
|
iconCls : 'toolbar__icon btn-clear-filter',
|
||||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleDelFilter, _set.editPivot]
|
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleDelFilter, _set.editPivot],
|
||||||
|
dataHint : '1',
|
||||||
|
dataHintDirection: 'bottom'
|
||||||
});
|
});
|
||||||
} else
|
}
|
||||||
if ( config.isEdit ) {
|
} else if ( config.isEdit ) {
|
||||||
Common.UI.Mixtbar.prototype.initialize.call(this, {
|
Common.UI.Mixtbar.prototype.initialize.call(this, {
|
||||||
template: _.template(template),
|
template: _.template(template),
|
||||||
tabs: [
|
tabs: [
|
||||||
|
|
Loading…
Reference in a new issue