[SSE] Update layout properties and lock/unlock layout buttons
This commit is contained in:
parent
3658506052
commit
e0690974f0
|
@ -162,7 +162,8 @@ define([
|
|||
langId: undefined,
|
||||
pgsize: [0, 0],
|
||||
pgmargins: undefined,
|
||||
pgorient: undefined
|
||||
pgorient: undefined,
|
||||
lock_doc: undefined
|
||||
};
|
||||
|
||||
var checkInsertAutoshape = function(e, action) {
|
||||
|
@ -1402,6 +1403,9 @@ define([
|
|||
this.api.asc_registerCallback('asc_onUpdateSheetViewSettings', _.bind(this.onApiSheetChanged, this));
|
||||
this.api.asc_registerCallback('asc_onEndAddShape', _.bind(this.onApiEndAddShape, this));
|
||||
this.api.asc_registerCallback('asc_onEditorSelectionChanged', _.bind(this.onApiEditorSelectionChanged, this));
|
||||
this.api.asc_registerCallback('asc_onUpdateDocumentProps', _.bind(this.onUpdateDocumentProps, this));
|
||||
this.api.asc_registerCallback('asc_onLockDocumentProps', _.bind(this.onApiLockDocumentProps, this));
|
||||
this.api.asc_registerCallback('asc_onUnLockDocumentProps', _.bind(this.onApiUnLockDocumentProps, this));
|
||||
}
|
||||
|
||||
if ( !this.appConfig.isEditMailMerge ) {
|
||||
|
@ -1685,15 +1689,24 @@ define([
|
|||
|
||||
onApiZoomChange: function(zf, type){},
|
||||
|
||||
|
||||
onApiSheetChanged: function() {
|
||||
if (!this.toolbar.mode || !this.toolbar.mode.isEdit) return;
|
||||
|
||||
var props = this.api.asc_getPageOptions(this.api.asc_getActiveWorksheetIndex()),
|
||||
var currentSheet = this.api.asc_getActiveWorksheetIndex(),
|
||||
props = this.api.asc_getPageOptions(currentSheet),
|
||||
opt = props.asc_getPageSetup();
|
||||
|
||||
this.onApiPageOrient(opt.asc_getOrientation());
|
||||
this.onApiPageSize(opt.asc_getWidth(), opt.asc_getHeight());
|
||||
this.onApiPageMargins(props.asc_getPageMargins());
|
||||
|
||||
this.api.asc_isLayoutLocked(currentSheet) ? this.onApiLockDocumentProps(currentSheet) : this.onApiUnLockDocumentProps(currentSheet);
|
||||
},
|
||||
|
||||
onUpdateDocumentProps: function(nIndex) {
|
||||
if (nIndex == this.api.asc_getActiveWorksheetIndex())
|
||||
this.onApiSheetChanged();
|
||||
},
|
||||
|
||||
onApiPageSize: function(w, h) {
|
||||
|
@ -1748,6 +1761,20 @@ define([
|
|||
}
|
||||
},
|
||||
|
||||
onApiLockDocumentProps: function(nIndex) {
|
||||
if (this._state.lock_doc!==true && nIndex == this.api.asc_getActiveWorksheetIndex()) {
|
||||
this.toolbar.lockToolbar(SSE.enumLock.docPropsLock, true, {array: [this.toolbar.btnPageSize, this.toolbar.btnPageMargins, this.toolbar.btnPageOrient]});
|
||||
this._state.lock_doc = true;
|
||||
}
|
||||
},
|
||||
|
||||
onApiUnLockDocumentProps: function(nIndex) {
|
||||
if (this._state.lock_doc!==false && nIndex == this.api.asc_getActiveWorksheetIndex()) {
|
||||
this.toolbar.lockToolbar(SSE.enumLock.docPropsLock, false, {array: [this.toolbar.btnPageSize, this.toolbar.btnPageMargins, this.toolbar.btnPageOrient]});
|
||||
this._state.lock_doc = false;
|
||||
}
|
||||
},
|
||||
|
||||
onApiEditorSelectionChanged: function(fontobj) {
|
||||
if (!this.editMode) return;
|
||||
|
||||
|
|
|
@ -84,6 +84,7 @@ define([
|
|||
cantModifyFilter: 'cant-filter',
|
||||
cantGroup: 'cant-group',
|
||||
cantGroupUngroup: 'cant-group-ungroup',
|
||||
docPropsLock: 'doc-props-lock'
|
||||
};
|
||||
|
||||
SSE.Views.Toolbar = Common.UI.Mixtbar.extend(_.extend({
|
||||
|
@ -1212,7 +1213,7 @@ define([
|
|||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'btn-pageorient',
|
||||
caption: me.capBtnPageOrient,
|
||||
lock : [_set.lostConnect, _set.coAuth],
|
||||
lock : [_set.docPropsLock, _set.lostConnect, _set.coAuth],
|
||||
menu: new Common.UI.Menu({
|
||||
cls: 'ppm-toolbar',
|
||||
items: [
|
||||
|
@ -1247,7 +1248,7 @@ define([
|
|||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'btn-pagemargins',
|
||||
caption: me.capBtnMargins,
|
||||
lock : [_set.lostConnect, _set.coAuth],
|
||||
lock : [_set.docPropsLock, _set.lostConnect, _set.coAuth],
|
||||
menu: new Common.UI.Menu({
|
||||
items: [
|
||||
{
|
||||
|
@ -1292,7 +1293,7 @@ define([
|
|||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'btn-pagesize',
|
||||
caption: me.capBtnPageSize,
|
||||
lock : [_set.lostConnect, _set.coAuth],
|
||||
lock : [_set.docPropsLock, _set.lostConnect, _set.coAuth],
|
||||
menu: new Common.UI.Menu({
|
||||
items: [
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue