[SSE] Add mode 'editole' for ole objects

This commit is contained in:
Julia Radzhabova 2022-03-11 13:58:15 +03:00
parent 45186d4a0c
commit fab188cb23
16 changed files with 189 additions and 77 deletions

View file

@ -913,7 +913,7 @@
if ( typeof(customization) == 'object' && ( customization.toolbarNoTabs ||
(config.editorConfig.targetApp!=='desktop') && (customization.loaderName || customization.loaderLogo))) {
index = "/index_loader.html";
} else if (config.editorConfig.mode === 'editdiagram' || config.editorConfig.mode === 'editmerge')
} else if (config.editorConfig.mode === 'editdiagram' || config.editorConfig.mode === 'editmerge' || config.editorConfig.mode === 'editole')
index = "/index_internal.html";
}
@ -947,7 +947,7 @@
}
}
if (config.editorConfig && (config.editorConfig.mode == 'editdiagram' || config.editorConfig.mode == 'editmerge'))
if (config.editorConfig && (config.editorConfig.mode == 'editdiagram' || config.editorConfig.mode == 'editmerge' || config.editorConfig.mode == 'editole'))
params += "&internal=true";
if (config.frameEditorId)

View file

@ -95,7 +95,7 @@ define([
if (this.mode.canCoAuthoring && this.mode.canChat)
this.api.asc_registerCallback('asc_onCoAuthoringChatReceiveMessage', _.bind(this.onReceiveMessage, this));
if ( !this.mode.isEditDiagram && !this.mode.isEditMailMerge ) {
if ( !this.mode.isEditDiagram && !this.mode.isEditMailMerge && !this.mode.isEditOle ) {
this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.onUsersChanged, this));
this.api.asc_registerCallback('asc_onConnectionStateChanged', _.bind(this.onUserConnection, this));
this.api.asc_coAuthoringGetUsers();

View file

@ -69,8 +69,7 @@ define([
}
},
editorConfig: {
// mode : 'editole',
mode : 'editdiagram',
mode : 'editole',
targetApp : targetApp,
lang : appLang,
canCoAuthoring : false,

View file

@ -63,7 +63,7 @@ define([
'render:before' : function (toolbar) {
var appOptions = me.getApplication().getController('Main').appOptions;
if ( !appOptions.isEditMailMerge && !appOptions.isEditDiagram ) {
if ( !appOptions.isEditMailMerge && !appOptions.isEditDiagram && !appOptions.isEditOle ) {
var tab = {action: 'plugins', caption: me.panelPlugins.groupCaption, dataHintTitle: 'E', layoutname: 'toolbar-plugins'};
me.$toolbarPanelPlugins = me.panelPlugins.getPanel();

View file

@ -97,7 +97,7 @@ define([
this.mode = mode;
this.editor.$btnfunc[this.mode.isEdit?'removeClass':'addClass']('disabled');
this.editor.btnNamedRanges.setVisible(this.mode.isEdit && !this.mode.isEditDiagram && !this.mode.isEditMailMerge);
this.editor.btnNamedRanges.setVisible(this.mode.isEdit && !this.mode.isEditDiagram && !this.mode.isEditMailMerge && !this.mode.isEditOle);
if ( this.mode.isEdit ) {
this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onApiSelectionChanged, this));
@ -156,7 +156,7 @@ define([
if (this.viewmode) return; // signed file
var seltype = info.asc_getSelectionType(),
coauth_disable = (!this.mode.isEditMailMerge && !this.mode.isEditDiagram) ? (info.asc_getLocked() === true || info.asc_getLockedTable() === true || info.asc_getLockedPivotTable()===true) : false;
coauth_disable = (!this.mode.isEditMailMerge && !this.mode.isEditDiagram && !this.mode.isEditOle) ? (info.asc_getLocked() === true || info.asc_getLockedTable() === true || info.asc_getLockedPivotTable()===true) : false;
var is_chart_text = seltype == Asc.c_oAscSelectionType.RangeChartText,
is_chart = seltype == Asc.c_oAscSelectionType.RangeChart,
@ -326,14 +326,14 @@ define([
SetDisabled: function(disabled) {
this.editor.$btnfunc[!disabled && this.mode.isEdit ?'removeClass':'addClass']('disabled');
this.editor.btnNamedRanges.setVisible(!disabled && this.mode.isEdit && !this.mode.isEditDiagram && !this.mode.isEditMailMerge);
this.editor.btnNamedRanges.setVisible(!disabled && this.mode.isEdit && !this.mode.isEditDiagram && !this.mode.isEditMailMerge && !this.mode.isEditOle);
},
setPreviewMode: function(mode) {
if (this.viewmode === mode) return;
this.viewmode = mode;
this.editor.$btnfunc[!mode && this.mode.isEdit?'removeClass':'addClass']('disabled');
this.editor.cellNameDisabled(mode && !(this.mode.isEdit && !this.mode.isEditDiagram && !this.mode.isEditMailMerge));
this.editor.cellNameDisabled(mode && !(this.mode.isEdit && !this.mode.isEditDiagram && !this.mode.isEditMailMerge && !this.mode.isEditOle));
}
});
});

View file

@ -440,7 +440,7 @@ define([
},
onApiSheetChanged: function() {
if (!this.toolbar.mode || !this.toolbar.mode.isEdit || this.toolbar.mode.isEditDiagram || this.toolbar.mode.isEditMailMerge) return;
if (!this.toolbar.mode || !this.toolbar.mode.isEdit || this.toolbar.mode.isEditDiagram || this.toolbar.mode.isEditMailMerge || this.toolbar.mode.isEditOle) return;
var currentSheet = this.api.asc_getActiveWorksheetIndex();
this.onWorksheetLocked(currentSheet, this.api.asc_isWorksheetLockedOrDeleted(currentSheet));

View file

@ -1832,7 +1832,7 @@ define([
isPivotLocked = cellinfo.asc_getLockedPivotTable()===true,
isObjLocked = false,
commentsController = this.getApplication().getController('Common.Controllers.Comments'),
internaleditor = this.permissions.isEditMailMerge || this.permissions.isEditDiagram,
internaleditor = this.permissions.isEditMailMerge || this.permissions.isEditDiagram || this.permissions.isEditOle,
xfs = cellinfo.asc_getXfs(),
isSmartArt = false,
isSmartArtInternal = false;
@ -2059,8 +2059,10 @@ define([
if (showMenu) this.showPopupMenu(documentHolder.textInShapeMenu, {}, event);
documentHolder.menuParagraphBullets.setDisabled(isSmartArt || isSmartArtInternal);
} else if (!this.permissions.isEditMailMerge && !this.permissions.isEditDiagram || (seltype !== Asc.c_oAscSelectionType.RangeImage && seltype !== Asc.c_oAscSelectionType.RangeShape &&
seltype !== Asc.c_oAscSelectionType.RangeChart && seltype !== Asc.c_oAscSelectionType.RangeChartText && seltype !== Asc.c_oAscSelectionType.RangeShapeText && seltype !== Asc.c_oAscSelectionType.RangeSlicer)) {
} else if (!this.permissions.isEditMailMerge && !this.permissions.isEditDiagram && !this.permissions.isEditOle ||
(seltype !== Asc.c_oAscSelectionType.RangeImage && seltype !== Asc.c_oAscSelectionType.RangeShape &&
seltype !== Asc.c_oAscSelectionType.RangeChart && seltype !== Asc.c_oAscSelectionType.RangeChartText &&
seltype !== Asc.c_oAscSelectionType.RangeShapeText && seltype !== Asc.c_oAscSelectionType.RangeSlicer)) {
if (!documentHolder.ssMenu || !showMenu && !documentHolder.ssMenu.isVisible()) return;
var iscelledit = this.api.isCellEdited,
@ -2213,9 +2215,9 @@ define([
isCellLocked = cellinfo.asc_getLocked(),
isTableLocked = cellinfo.asc_getLockedTable()===true,
commentsController = this.getApplication().getController('Common.Controllers.Comments'),
iscellmenu = (seltype==Asc.c_oAscSelectionType.RangeCells) && !this.permissions.isEditMailMerge && !this.permissions.isEditDiagram,
iscellmenu = (seltype==Asc.c_oAscSelectionType.RangeCells) && !this.permissions.isEditMailMerge && !this.permissions.isEditDiagram && !this.permissions.isEditOle,
iscelledit = this.api.isCellEdited,
isimagemenu = (seltype==Asc.c_oAscSelectionType.RangeShape || seltype==Asc.c_oAscSelectionType.RangeImage) && !this.permissions.isEditMailMerge && !this.permissions.isEditDiagram,
isimagemenu = (seltype==Asc.c_oAscSelectionType.RangeShape || seltype==Asc.c_oAscSelectionType.RangeImage) && !this.permissions.isEditMailMerge && !this.permissions.isEditDiagram && !this.permissions.isEditOle,
signGuid;
if (!documentHolder.viewModeMenu)

View file

@ -176,7 +176,7 @@ define([
}
}
/** coauthoring end **/
if (!this.mode.isEditMailMerge && !this.mode.isEditDiagram)
if (!this.mode.isEditMailMerge && !this.mode.isEditDiagram && !this.mode.isEditOle)
this.api.asc_registerCallback('asc_onEditCell', _.bind(this.onApiEditCell, this));
this.leftMenu.getMenu('file').setApi(api);
if (this.mode.canUseHistory)
@ -249,7 +249,7 @@ define([
(this.mode.trialMode || this.mode.isBeta) && this.leftMenu.setDeveloperMode(this.mode.trialMode, this.mode.isBeta, this.mode.buildVersion);
/** coauthoring end **/
Common.util.Shortcuts.resumeEvents();
if (!this.mode.isEditMailMerge && !this.mode.isEditDiagram)
if (!this.mode.isEditMailMerge && !this.mode.isEditDiagram && !this.mode.isEditOle)
Common.NotificationCenter.on('cells:range', _.bind(this.onCellsRange, this));
return this;
},
@ -867,6 +867,7 @@ define([
if (this.mode.isEditDiagram && s!='escape') return false;
if (this.mode.isEditMailMerge && s!='escape' && s!='search') return false;
if (this.mode.isEditOle && s!='escape' && s!='search') return false;
switch (s) {
case 'replace':
@ -877,7 +878,8 @@ define([
this.leftMenu.btnSearch.toggle(true,true);
this.leftMenu.btnAbout.toggle(false);
this.leftMenu.menuFile.hide();
if ( this.leftMenu.menuFile.isVisible() )
this.leftMenu.menuFile.hide();
}
return false;
case 'save':
@ -931,7 +933,7 @@ define([
}
return false;
}
if (this.mode.isEditDiagram || this.mode.isEditMailMerge) {
if (this.mode.isEditDiagram || this.mode.isEditMailMerge || this.mode.isEditOle) {
menu_opened = $(document.body).find('.open > .dropdown-menu');
if (!this.api.isCellEdited && !menu_opened.length) {
Common.Gateway.internalMessage('shortcut', {key:'escape'});

View file

@ -398,6 +398,7 @@ define([
this.appOptions.fileChoiceUrl = this.editorConfig.fileChoiceUrl;
this.appOptions.isEditDiagram = this.editorConfig.mode == 'editdiagram';
this.appOptions.isEditMailMerge = this.editorConfig.mode == 'editmerge';
this.appOptions.isEditOle = this.editorConfig.mode == 'editole';
this.appOptions.canRequestClose = this.editorConfig.canRequestClose;
this.appOptions.canBackToFolder = (this.editorConfig.canBackToFolder!==false) && (typeof (this.editorConfig.customization) == 'object') && (typeof (this.editorConfig.customization.goback) == 'object')
&& (!_.isEmpty(this.editorConfig.customization.goback.url) || this.editorConfig.customization.goback.requestClose && this.appOptions.canRequestClose);
@ -414,7 +415,7 @@ define([
this.appOptions.canFeaturePivot = true;
this.appOptions.canFeatureViews = true;
if (this.appOptions.user.guest && this.appOptions.canRenameAnonymous && !this.appOptions.isEditDiagram && !this.appOptions.isEditMailMerge)
if (this.appOptions.user.guest && this.appOptions.canRenameAnonymous && !this.appOptions.isEditDiagram && !this.appOptions.isEditMailMerge && !this.appOptions.isEditOle)
Common.NotificationCenter.on('user:rename', _.bind(this.showRenameUserDialog, this));
this.headerView = this.getApplication().getController('Viewport').getView('Common.Views.Header');
@ -464,7 +465,7 @@ define([
this.appOptions.wopi = this.editorConfig.wopi;
this.isFrameClosed = (this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge);
this.isFrameClosed = (this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle);
Common.Controllers.Desktop.init(this.appOptions);
if (this.appOptions.isEditDiagram) {
@ -852,7 +853,7 @@ define([
me.hidePreloader();
me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
value = (this.appOptions.isEditMailMerge || this.appOptions.isEditDiagram) ? 100 : Common.localStorage.getItem("sse-settings-zoom");
value = (this.appOptions.isEditMailMerge || this.appOptions.isEditDiagram || this.appOptions.isEditOle) ? 100 : Common.localStorage.getItem("sse-settings-zoom");
Common.Utils.InternalSettings.set("sse-settings-zoom", value);
var zf = (value!==null) ? parseInt(value)/100 : (this.appOptions.customization && this.appOptions.customization.zoom ? parseInt(this.appOptions.customization.zoom)/100 : 1);
this.api.asc_setZoom(zf>0 ? zf : 1);
@ -908,14 +909,14 @@ define([
leftMenuView.getMenu('file').loadDocument({doc:me.appOptions.spreadsheet});
leftmenuController.setMode(me.appOptions).createDelayedElements().setApi(me.api);
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram) {
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram && !me.appOptions.isEditOle) {
pluginsController.setApi(me.api);
this.api && this.api.asc_setFrozenPaneBorderType(Common.localStorage.getBool('sse-freeze-shadow', true) ? Asc.c_oAscFrozenPaneBorderType.shadow : Asc.c_oAscFrozenPaneBorderType.line);
}
leftMenuView.disableMenu('all',false);
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram && me.appOptions.canBranding) {
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram && !me.appOptions.isEditOle && me.appOptions.canBranding) {
me.getApplication().getController('LeftMenu').leftMenu.getMenu('about').setLicInfo(me.editorConfig.customization);
}
@ -952,7 +953,7 @@ define([
}
var timer_sl = setInterval(function(){
if (window.styles_loaded || me.appOptions.isEditDiagram || me.appOptions.isEditMailMerge) {
if (window.styles_loaded || me.appOptions.isEditDiagram || me.appOptions.isEditMailMerge || me.appOptions.isEditOle) {
clearInterval(timer_sl);
Common.NotificationCenter.trigger('comments:updatefilter', ['doc', 'sheet' + me.api.asc_getActiveWorksheetId()]);
@ -961,7 +962,7 @@ define([
toolbarController.createDelayedElements();
me.setLanguages();
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram) {
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram && !me.appOptions.isEditOle) {
var shapes = me.api.asc_getPropertyEditorShapes();
if (shapes)
me.fillAutoShapes(shapes[0], shapes[1]);
@ -994,7 +995,7 @@ define([
me.applyLicense();
}
// TODO bug 43960
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram) {
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram && !me.appOptions.isEditOle) {
var dummyClass = ~~(1e6*Math.random());
$('.toolbar').prepend(Common.Utils.String.format('<div class="lazy-{0} x-huge"><div class="toolbar__icon" style="position: absolute; width: 1px; height: 1px;"></div>', dummyClass));
setTimeout(function() { $(Common.Utils.String.format('.toolbar .lazy-{0}', dummyClass)).remove(); }, 10);
@ -1031,12 +1032,12 @@ define([
} else checkWarns();
Common.Gateway.documentReady();
if (this.appOptions.user.guest && this.appOptions.canRenameAnonymous && !this.appOptions.isEditDiagram && !this.appOptions.isEditMailMerge && (Common.Utils.InternalSettings.get("guest-username")===null))
if (this.appOptions.user.guest && this.appOptions.canRenameAnonymous && !this.appOptions.isEditDiagram && !this.appOptions.isEditMailMerge && !this.appOptions.isEditOle && (Common.Utils.InternalSettings.get("guest-username")===null))
this.showRenameUserDialog();
},
onLicenseChanged: function(params) {
if (this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) return;
if (this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle) return;
var licType = params.asc_getLicenseType();
if (licType !== undefined && (this.appOptions.canEdit || this.appOptions.isRestrictedEdit) && this.editorConfig.mode !== 'view' &&
@ -1089,7 +1090,7 @@ define([
}
});
}
} else if (!this.appOptions.isDesktopApp && !this.appOptions.canBrandingExt && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) &&
} else if (!this.appOptions.isDesktopApp && !this.appOptions.canBrandingExt && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle) &&
this.editorConfig && this.editorConfig.customization && (this.editorConfig.customization.loaderName || this.editorConfig.customization.loaderLogo)) {
Common.UI.warning({
title: this.textPaidFeature,
@ -1185,7 +1186,7 @@ define([
onEditorPermissions: function(params) {
var licType = params ? params.asc_getLicenseType() : Asc.c_oLicenseResult.Error;
if ( params && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge)) {
if ( params && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle)) {
if (Asc.c_oLicenseResult.Expired === licType || Asc.c_oLicenseResult.Error === licType || Asc.c_oLicenseResult.ExpiredTrial === licType) {
Common.UI.warning({
title: this.titleLicenseExp,
@ -1251,10 +1252,10 @@ define([
this.appOptions.canRequestEditRights = this.editorConfig.canRequestEditRights;
this.appOptions.canEdit = this.permissions.edit !== false && // can edit
(this.editorConfig.canRequestEditRights || this.editorConfig.mode !== 'view'); // if mode=="view" -> canRequestEditRights must be defined
this.appOptions.isEdit = (this.appOptions.canLicense || this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && this.permissions.edit !== false && this.editorConfig.mode !== 'view';
this.appOptions.isEdit = (this.appOptions.canLicense || this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle) && this.permissions.edit !== false && this.editorConfig.mode !== 'view';
this.appOptions.canDownload = (this.permissions.download !== false);
this.appOptions.canPrint = (this.permissions.print !== false);
this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) &&
this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle) &&
(typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave);
this.appOptions.forcesave = this.appOptions.canForcesave;
this.appOptions.canEditComments= this.appOptions.isOffline || !this.permissions.editCommentAuthorOnly;
@ -1265,17 +1266,17 @@ define([
this.appOptions.canEditComments = this.appOptions.canDeleteComments = this.appOptions.isOffline;
}
this.appOptions.isSignatureSupport= this.appOptions.isEdit && this.appOptions.isDesktopApp && this.appOptions.isOffline && this.api.asc_isSignaturesSupport() && (this.permissions.protect!==false)
&& !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge);
&& !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle);
this.appOptions.isPasswordSupport = this.appOptions.isEdit && this.api.asc_isProtectionSupport() && (this.permissions.protect!==false)
&& !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge);
&& !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle);
this.appOptions.canProtect = (this.appOptions.isSignatureSupport || this.appOptions.isPasswordSupport);
this.appOptions.canHelp = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.help===false);
this.appOptions.isRestrictedEdit = !this.appOptions.isEdit && this.appOptions.canComments;
this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && this.appOptions.canCoAuthoring &&
this.appOptions.canChangeCoAuthoring = this.appOptions.isEdit && !(this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle) && this.appOptions.canCoAuthoring &&
!(typeof this.editorConfig.coEditing == 'object' && this.editorConfig.coEditing.change===false);
if (!this.appOptions.isEditDiagram && !this.appOptions.isEditMailMerge) {
if (!this.appOptions.isEditDiagram && !this.appOptions.isEditMailMerge && !this.appOptions.isEditOle) {
this.appOptions.canBrandingExt = params.asc_getCanBranding() && (typeof this.editorConfig.customization == 'object' || this.editorConfig.plugins);
this.getApplication().getController('Common.Controllers.Plugins').setMode(this.appOptions);
this.appOptions.canBrandingExt && this.editorConfig.customization && Common.UI.LayoutManager.init(this.editorConfig.customization.layout);
@ -1354,7 +1355,7 @@ define([
statusbarView = app.getController('Statusbar').getView('Statusbar');
if (this.headerView) {
this.headerView.setVisible(!this.appOptions.isEditMailMerge && !this.appOptions.isDesktopApp && !this.appOptions.isEditDiagram);
this.headerView.setVisible(!this.appOptions.isEditMailMerge && !this.appOptions.isDesktopApp && !this.appOptions.isEditDiagram && !this.appOptions.isEditOle);
}
viewport && viewport.setMode(this.appOptions, true);
@ -1366,6 +1367,8 @@ define([
if (this.appOptions.isEditMailMerge || this.appOptions.isEditDiagram) {
statusbarView.hide();
}
if (this.appOptions.isEditMailMerge || this.appOptions.isEditDiagram || this.appOptions.isEditOle) {
app.getController('LeftMenu').getView('LeftMenu').hide();
$(window)
@ -1379,7 +1382,7 @@ define([
},this));
}
if (!this.appOptions.isEditMailMerge && !this.appOptions.isEditDiagram) {
if (!this.appOptions.isEditMailMerge && !this.appOptions.isEditDiagram && !this.appOptions.isEditOle) {
this.api.asc_registerCallback('asc_onSendThemeColors', _.bind(this.onSendThemeColors, this));
this.api.asc_registerCallback('asc_onDownloadUrl', _.bind(this.onDownloadUrl, this));
this.api.asc_registerCallback('asc_onDocumentModifiedChanged', _.bind(this.onDocumentModifiedChanged, this));
@ -1434,10 +1437,11 @@ define([
application.getController('WBProtection').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
if (statusbarController) {
statusbarController.getView('Statusbar').changeViewMode(true);
statusbarController.getView('Statusbar').changeViewMode(!me.appOptions.isEditOle);
me.appOptions.isEditOle && statusbarController.onChangeViewMode(null, true, true); // set compact status bar for ole editing mode
}
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram && me.appOptions.canFeaturePivot)
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram && !me.appOptions.isEditOle && me.appOptions.canFeaturePivot)
application.getController('PivotTable').setMode(me.appOptions);
var viewport = this.getApplication().getController('Viewport').getView('Viewport');
@ -1446,7 +1450,7 @@ define([
this.toolbarView = toolbarController.getView('Toolbar');
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram) {
if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram && !me.appOptions.isEditOle) {
var options = {};
JSON.parse(Common.localStorage.getItem('sse-hidden-formula')) && (options.formula = true);
application.getController('Toolbar').hideElements(options);
@ -2063,7 +2067,7 @@ define([
onBeforeUnload: function() {
Common.localStorage.save();
var isEdit = this.permissions.edit !== false && this.editorConfig.mode !== 'view' && this.editorConfig.mode !== 'editdiagram' && this.editorConfig.mode !== 'editmerge';
var isEdit = this.permissions.edit !== false && this.editorConfig.mode !== 'view' && this.editorConfig.mode !== 'editdiagram' && this.editorConfig.mode !== 'editmerge' && this.editorConfig.mode !== 'editole';
if (isEdit && this.api.asc_isDocumentModified()) {
var me = this;
this.api.asc_stopSaving();
@ -2228,7 +2232,7 @@ define([
if (!this.appOptions.isEditMailMerge && !this.appOptions.isEditDiagram && window.editor_elements_prepared) {
this.application.getController('Statusbar').selectTab(index);
if (this.appOptions.canViewComments && !this.dontCloseDummyComment) {
if (!this.appOptions.isEditOle && this.appOptions.canViewComments && !this.dontCloseDummyComment) {
Common.NotificationCenter.trigger('comments:updatefilter', ['doc', 'sheet' + this.api.asc_getWorksheetId(index)], false ); // hide popover
}
}
@ -2465,7 +2469,7 @@ define([
onSendThemeColors: function(colors, standart_colors) {
Common.Utils.ThemeColor.setColors(colors, standart_colors);
if (window.styles_loaded && !this.appOptions.isEditMailMerge && !this.appOptions.isEditDiagram) {
if (window.styles_loaded && !this.appOptions.isEditMailMerge && !this.appOptions.isEditDiagram && !this.appOptions.isEditOle) {
this.updateThemeColors();
var me = this;
setTimeout(function(){

View file

@ -779,9 +779,9 @@ define([
this._sheetViewTip.hide();
},
onChangeViewMode: function(item, compact) {
onChangeViewMode: function(item, compact, suppressEvent) {
this.statusbar.fireEvent('view:compact', [this.statusbar, compact]);
Common.localStorage.setBool('sse-compact-statusbar', compact);
!suppressEvent && Common.localStorage.setBool('sse-compact-statusbar', compact);
Common.NotificationCenter.trigger('layout:changed', 'status');
this.statusbar.onChangeCompact(compact);

View file

@ -301,6 +301,17 @@ define([
toolbar.btnSortUp.on('click', _.bind(this.onSortType, this, Asc.c_oAscSortOptions.Descending));
toolbar.btnSetAutofilter.on('click', _.bind(this.onAutoFilter, this));
toolbar.btnClearAutofilter.on('click', _.bind(this.onClearFilter, this));
} else
if ( me.appConfig.isEditOle ) {
toolbar.btnUndo.on('click', _.bind(this.onUndo, this));
toolbar.btnRedo.on('click', _.bind(this.onRedo, this));
toolbar.btnCopy.on('click', _.bind(this.onCopyPaste, this, true));
toolbar.btnPaste.on('click', _.bind(this.onCopyPaste, this, false));
toolbar.btnSearch.on('click', _.bind(this.onSearch, this));
toolbar.btnSortDown.on('click', _.bind(this.onSortType, this, Asc.c_oAscSortOptions.Ascending));
toolbar.btnSortUp.on('click', _.bind(this.onSortType, this, Asc.c_oAscSortOptions.Descending));
toolbar.btnSetAutofilter.on('click', _.bind(this.onAutoFilter, this));
toolbar.btnClearAutofilter.on('click', _.bind(this.onClearFilter, this));
} else {
toolbar.btnPrint.on('click', _.bind(this.onPrint, this));
toolbar.btnPrint.on('disabled', _.bind(this.onBtnChangeState, this, 'print:disabled'));
@ -419,7 +430,7 @@ define([
var config = SSE.getController('Main').appOptions;
if (config.isEdit) {
if ( !config.isEditDiagram && !config.isEditMailMerge ) {
if ( !config.isEditDiagram && !config.isEditMailMerge && !config.isEditOle ) {
this.api.asc_registerCallback('asc_onSendThemeColors', _.bind(this.onSendThemeColors, this));
this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onApiMathTypes, this));
this.api.asc_registerCallback('asc_onContextMenu', _.bind(this.onContextMenu, this));
@ -1846,7 +1857,7 @@ define([
this.toolbar.createDelayedElements();
this.attachUIEvents(this.toolbar);
if ( !this.appConfig.isEditDiagram && !this.appConfig.isEditMailMerge ) {
if ( !this.appConfig.isEditDiagram && !this.appConfig.isEditMailMerge && !this.appConfig.isEditOle ) {
this.api.asc_registerCallback('asc_onSheetsChanged', _.bind(this.onApiSheetChanged, this));
this.api.asc_registerCallback('asc_onUpdateSheetViewSettings', _.bind(this.onApiSheetChanged, this));
this.api.asc_registerCallback('asc_onEndAddShape', _.bind(this.onApiEndAddShape, this));
@ -1901,7 +1912,7 @@ define([
e.stopPropagation();
},
'command+k,ctrl+k': function (e) {
if (me.editMode && !me.toolbar.mode.isEditMailMerge && !me.toolbar.mode.isEditDiagram && !me.api.isCellEdited && !me._state.multiselect && !me._state.inpivot &&
if (me.editMode && !me.toolbar.mode.isEditMailMerge && !me.toolbar.mode.isEditDiagram && !me.toolbar.mode.isEditOle && !me.api.isCellEdited && !me._state.multiselect && !me._state.inpivot &&
!me.getApplication().getController('LeftMenu').leftMenu.menuFile.isVisible() && !me._state.wsProps['InsertHyperlinks']) {
var cellinfo = me.api.asc_getCellInfo(),
selectionType = cellinfo.asc_getSelectionType();
@ -1911,7 +1922,7 @@ define([
e.preventDefault();
},
'command+1,ctrl+1': function(e) {
if (me.editMode && !me.toolbar.mode.isEditMailMerge && !me.api.isCellEdited && !me.toolbar.cmbNumberFormat.isDisabled()) {
if (me.editMode && !me.toolbar.mode.isEditMailMerge && !me.toolbar.mode.isEditOle && !me.api.isCellEdited && !me.toolbar.cmbNumberFormat.isDisabled()) {
me.onCustomNumberFormat();
}
@ -2192,7 +2203,7 @@ define([
if ($('.asc-window.enable-key-events:visible').length>0) return;
var toolbar = this.toolbar;
if (toolbar.mode.isEditDiagram || toolbar.mode.isEditMailMerge) {
if (toolbar.mode.isEditDiagram || toolbar.mode.isEditMailMerge || toolbar.mode.isEditOle) {
is_cell_edited = (state == Asc.c_oAscCellEditorState.editStart);
toolbar.lockToolbar(Common.enumLock.editCell, state == Asc.c_oAscCellEditorState.editStart, {array: [toolbar.btnDecDecimal,toolbar.btnIncDecimal,toolbar.cmbNumberFormat, toolbar.btnEditChartData, toolbar.btnEditChartType]});
} else
@ -2243,7 +2254,7 @@ define([
onApiSheetChanged: function() {
if (!this.toolbar.mode || !this.toolbar.mode.isEdit || this.toolbar.mode.isEditDiagram || this.toolbar.mode.isEditMailMerge) return;
if (!this.toolbar.mode || !this.toolbar.mode.isEdit || this.toolbar.mode.isEditDiagram || this.toolbar.mode.isEditMailMerge || this.toolbar.mode.isEditOle) return;
var currentSheet = this.api.asc_getActiveWorksheetIndex(),
props = this.api.asc_getPageOptions(currentSheet),
@ -2401,7 +2412,7 @@ define([
Common.NotificationCenter.trigger('fonts:change', fontobj);
/* read font params */
if (!toolbar.mode.isEditMailMerge && !toolbar.mode.isEditDiagram) {
if (!toolbar.mode.isEditMailMerge && !toolbar.mode.isEditDiagram && !toolbar.mode.isEditOle) {
val = fontobj.asc_getFontBold();
if (this._state.bold !== val) {
toolbar.btnBold.toggle(val === true, true);
@ -2508,10 +2519,12 @@ define([
if ( this.toolbar.mode.isEditDiagram )
return this.onApiSelectionChanged_DiagramEditor(info); else
if ( this.toolbar.mode.isEditMailMerge )
return this.onApiSelectionChanged_MailMergeEditor(info);
return this.onApiSelectionChanged_MailMergeEditor(info); else
if ( this.toolbar.mode.isEditOle )
return this.onApiSelectionChanged_OleEditor(info);
var selectionType = info.asc_getSelectionType(),
coauth_disable = (!this.toolbar.mode.isEditMailMerge && !this.toolbar.mode.isEditDiagram) ? (info.asc_getLocked()===true || info.asc_getLockedTable()===true || info.asc_getLockedPivotTable()===true) : false,
coauth_disable = (!this.toolbar.mode.isEditMailMerge && !this.toolbar.mode.isEditDiagram && !this.toolbar.mode.isEditOle) ? (info.asc_getLocked()===true || info.asc_getLockedTable()===true || info.asc_getLockedPivotTable()===true) : false,
editOptionsDisabled = this._disableEditOptions(selectionType, coauth_disable),
me = this,
toolbar = this.toolbar,
@ -2570,7 +2583,7 @@ define([
if (editOptionsDisabled) return;
/* read font params */
if (!toolbar.mode.isEditMailMerge && !toolbar.mode.isEditDiagram) {
if (!toolbar.mode.isEditMailMerge && !toolbar.mode.isEditDiagram && !toolbar.mode.isEditOle) {
val = xfs.asc_getFontBold();
if (this._state.bold !== val) {
toolbar.btnBold.toggle(val === true, true);
@ -3067,6 +3080,63 @@ define([
}
},
onApiSelectionChanged_OleEditor: function(info) {
if ( !this.editMode || this.api.isCellEdited || this.api.isRangeSelection) return;
var me = this;
var _disableEditOptions = function(seltype, coauth_disable) {
var is_chart_text = seltype == Asc.c_oAscSelectionType.RangeChartText,
is_chart = seltype == Asc.c_oAscSelectionType.RangeChart,
is_shape_text = seltype == Asc.c_oAscSelectionType.RangeShapeText,
is_shape = seltype == Asc.c_oAscSelectionType.RangeShape,
is_image = seltype == Asc.c_oAscSelectionType.RangeImage || seltype == Asc.c_oAscSelectionType.RangeSlicer,
is_mode_2 = is_shape_text || is_shape || is_chart_text || is_chart,
is_objLocked = false;
if (!(is_mode_2 || is_image) &&
me._state.selection_type === seltype &&
me._state.coauthdisable === coauth_disable)
return seltype === Asc.c_oAscSelectionType.RangeImage;
if ( is_mode_2 ) {
var selectedObjects = me.api.asc_getGraphicObjectProps();
is_objLocked = selectedObjects.some(function (object) {
return object.asc_getObjectType() == Asc.c_oAscTypeSelectElement.Image && object.asc_getObjectValue().asc_getLocked();
});
}
me.toolbar.lockToolbar(Common.enumLock.coAuthText, is_objLocked);
return is_image;
};
var selectionType = info.asc_getSelectionType(),
coauth_disable = false,
editOptionsDisabled = _disableEditOptions(selectionType, coauth_disable),
val, need_disable = false;
if (editOptionsDisabled) return;
if (selectionType == Asc.c_oAscSelectionType.RangeChart || selectionType == Asc.c_oAscSelectionType.RangeChartText)
return;
if ( !me.toolbar.mode.isEditDiagram ) {
var filterInfo = info.asc_getAutoFilterInfo();
val = filterInfo ? filterInfo.asc_getIsAutoFilter() : null;
if ( this._state.filter !== val ) {
me.toolbar.btnSetAutofilter.toggle(val===true, true);
this._state.filter = val;
}
need_disable = this._state.controlsdisabled.filters || (val===null);
me.toolbar.lockToolbar(Common.enumLock.ruleFilter, need_disable,
{ array: [me.toolbar.btnSetAutofilter, me.toolbar.btnSortDown, me.toolbar.btnSortUp] });
need_disable = this._state.controlsdisabled.filters || !filterInfo || (filterInfo.asc_getIsApplyAutoFilter()!==true);
me.toolbar.lockToolbar(Common.enumLock.ruleDelFilter, need_disable, {array: [me.toolbar.btnClearAutofilter]});
}
},
onApiStyleChange: function() {
this.toolbar.btnCopyStyle.toggle(false, true);
this.modeAlwaysSetStyle = false;
@ -3511,7 +3581,7 @@ define([
case Asc.c_oAscSelectionType.RangeSlicer: type = _set.selSlicer; break;
}
if ( !this.appConfig.isEditDiagram && !this.appConfig.isEditMailMerge )
if ( !this.appConfig.isEditDiagram && !this.appConfig.isEditMailMerge && !this.appConfig.isEditOle )
toolbar.lockToolbar(type, type != seltype, {
array: [
toolbar.btnClearStyle.menu.items[1],
@ -3723,8 +3793,8 @@ define([
var me = this;
me.appConfig = config;
var compactview = !config.isEdit;
if ( config.isEdit && !config.isEditDiagram && !config.isEditMailMerge ) {
var compactview = !config.isEdit || config.isEditOle;
if ( config.isEdit && !config.isEditDiagram && !config.isEditMailMerge && !config.isEditOle ) {
if ( Common.localStorage.itemExists("sse-compact-toolbar") ) {
compactview = Common.localStorage.getBool("sse-compact-toolbar");
} else
@ -3734,7 +3804,7 @@ define([
me.toolbar.render(_.extend({isCompactView: compactview}, config));
if ( !config.isEditDiagram && !config.isEditMailMerge ) {
if ( !config.isEditDiagram && !config.isEditMailMerge && !config.isEditOle ) {
var tab = {action: 'review', caption: me.toolbar.textTabCollaboration, layoutname: 'toolbar-collaboration', dataHintTitle: 'U'};
var $panel = me.getApplication().getController('Common.Controllers.ReviewChanges').createToolbarPanel();
if ($panel) {
@ -3752,7 +3822,7 @@ define([
me.toolbar.btnPrint && me.toolbar.btnPrint.on('disabled', _.bind(me.onBtnChangeState, me, 'print:disabled'));
me.toolbar.setApi(me.api);
if ( !config.isEditDiagram && !config.isEditMailMerge ) {
if ( !config.isEditDiagram && !config.isEditMailMerge && !config.isEditOle ) {
var datatab = me.getApplication().getController('DataTab');
datatab.setApi(me.api).setConfig({toolbar: me});
@ -3810,7 +3880,7 @@ define([
}
}
}
if ( !config.isEditDiagram && !config.isEditMailMerge ) {
if ( !config.isEditDiagram && !config.isEditMailMerge && !config.isEditOle ) {
tab = {caption: me.toolbar.textTabView, action: 'view', extcls: config.isEdit ? 'canedit' : '', layoutname: 'toolbar-view', dataHintTitle: 'W'};
var viewtab = me.getApplication().getController('ViewTab');
viewtab.setApi(me.api).setConfig({toolbar: me, mode: config});

View file

@ -251,7 +251,7 @@ define([
},
onApiSheetChanged: function() {
if (!this.toolbar.mode || !this.toolbar.mode.isEdit || this.toolbar.mode.isEditDiagram || this.toolbar.mode.isEditMailMerge) return;
if (!this.toolbar.mode || !this.toolbar.mode.isEdit || this.toolbar.mode.isEditDiagram || this.toolbar.mode.isEditMailMerge || this.toolbar.mode.isEditOle) return;
var params = this.api.asc_getSheetViewSettings();
this.view.chHeadings.setValue(!!params.asc_getShowRowColHeaders(), true);

View file

@ -79,7 +79,7 @@ define([
'Toolbar': {
'render:before' : function (toolbar) {
var config = SSE.getController('Main').appOptions;
if (!config.isEditDiagram && !config.isEditMailMerge)
if (!config.isEditDiagram && !config.isEditMailMerge && !config.isEditOle)
toolbar.setExtra('right', me.header.getPanel('right', config));
if (!config.isEdit || config.customization && !!config.customization.compactHeader)
@ -148,11 +148,11 @@ define([
{
me.viewport.vlayout.getItem('toolbar').height = _intvars.get('toolbar-height-compact');
} else
if ( config.isEditDiagram || config.isEditMailMerge ) {
if ( config.isEditDiagram || config.isEditMailMerge || config.isEditOle ) {
me.viewport.vlayout.getItem('toolbar').height = 41;
}
if ( config.isEdit && !config.isEditDiagram && !config.isEditMailMerge && !(config.customization && config.customization.compactHeader)) {
if ( config.isEdit && !config.isEditDiagram && !config.isEditMailMerge && !config.isEditOle && !(config.customization && config.customization.compactHeader)) {
var $title = me.viewport.vlayout.getItem('title').el;
$title.html(me.header.getPanel('title', config)).show();
$title.find('.extra').html(me.header.getPanel('left', config));

View file

@ -71,5 +71,40 @@
</div>
<div class="group" style="width: 100%;"></div>
</section>
<% } else if ( isEditOle ) { %>
<!----------------------->
<!-- Edit ole object -->
<!----------------------->
<section class="simple-bar">
<div class="group small">
<div class="elset">
<span class="btn-slot split" id="slot-btn-copy"></span>
<span class="btn-slot split" id="slot-btn-paste"></span>
<span class="btn-slot split" id="slot-btn-undo"></span>
<span class="btn-slot" id="slot-btn-redo"></span>
</div>
</div>
<div class="separator short"></div>
<div class="group small">
<div class="elset">
<span class="btn-slot split" id="slot-btn-sortdesc"></span>
<span class="btn-slot" id="slot-btn-sortasc"></span>
</div>
</div>
<div class="separator short" style="margin-left: 5px;"></div>
<div class="group small">
<div class="elset">
<span class="btn-slot split" id="slot-btn-setfilter"></span>
<span class="btn-slot" id="slot-btn-clear-filter"></span>
</div>
</div>
<div class="separator short"></div>
<div class="group small">
<div class="elset">
<span class="btn-slot" id="slot-btn-search"></span>
</div>
</div>
<div class="group" style="width: 100%;"></div>
</section>
<% } %>
</div>

View file

@ -516,7 +516,7 @@ define([
this.mode = _.extend({}, this.mode, mode);
// this.$el.find('.el-edit')[mode.isEdit?'show':'hide']();
//this.btnAddWorksheet.setVisible(this.mode.isEdit);
$('#status-addtabs-box')[this.mode.isEdit ? 'show' : 'hide']();
$('#status-addtabs-box')[(this.mode.isEdit && !this.mode.isEditOle ) ? 'show' : 'hide']();
this.btnAddWorksheet.setDisabled(this.mode.isDisconnected || this.api && (this.api.asc_isWorkbookLocked() || this.api.isCellEdited) || this.rangeSelectionMode!=Asc.c_oAscSelectionDialogType.None);
this.updateTabbarBorders();
},
@ -607,7 +607,7 @@ define([
this.tabbar.setTabVisible(sindex);
this.btnAddWorksheet.setDisabled(me.mode.isDisconnected || me.api.asc_isWorkbookLocked() || wbprotected || me.api.isCellEdited);
if (this.mode.isEdit) {
if (this.mode.isEdit && !this.mode.isEditOle) {
this.tabbar.addDataHint(_.findIndex(items, function (item) {
return item.sheetindex === sindex;
}));
@ -698,7 +698,7 @@ define([
this.tabbar.setTabVisible(index);
}
if (this.mode.isEdit) {
if (this.mode.isEdit && !this.mode.isEditOle) {
this.tabbar.addDataHint(index);
}
@ -710,7 +710,7 @@ define([
onTabMenu: function (o, index, tab, select) {
var me = this;
if (this.mode.isEdit && !this.isEditFormula && (this.rangeSelectionMode !== Asc.c_oAscSelectionDialogType.Chart) &&
if (this.mode.isEdit && !this.mode.isEditOle && !this.isEditFormula && (this.rangeSelectionMode !== Asc.c_oAscSelectionDialogType.Chart) &&
(this.rangeSelectionMode !== Asc.c_oAscSelectionDialogType.FormatTable) &&
(this.rangeSelectionMode !== Asc.c_oAscSelectionDialogType.PrintTitles) &&
!this.mode.isDisconnected ) {

View file

@ -342,7 +342,7 @@ define([
dataHintOffset: 'medium'
});
} else
if ( config.isEditMailMerge ) {
if ( config.isEditMailMerge || config.isEditOle ) {
me.$layout = $(_.template(simple)(config));
me.btnSearch = new Common.UI.Button({
@ -1781,7 +1781,7 @@ define([
});
if ( mode.isEdit ) {
if (!mode.isEditDiagram && !mode.isEditMailMerge) {
if (!mode.isEditDiagram && !mode.isEditMailMerge && !mode.isEditOle) {
var top = Common.localStorage.getItem("sse-pgmargins-top"),
left = Common.localStorage.getItem("sse-pgmargins-left"),
bottom = Common.localStorage.getItem("sse-pgmargins-bottom"),
@ -2361,7 +2361,7 @@ define([
}));
}
if (!this.mode.isEditMailMerge && !this.mode.isEditDiagram)
if (!this.mode.isEditMailMerge && !this.mode.isEditDiagram && !this.mode.isEditOle)
this.updateMetricUnit();
},
@ -2412,7 +2412,7 @@ define([
setApi: function(api) {
this.api = api;
if (!this.mode.isEditMailMerge && !this.mode.isEditDiagram) {
if (!this.mode.isEditMailMerge && !this.mode.isEditDiagram && !this.mode.isEditOle) {
this.api.asc_registerCallback('asc_onCollaborativeChanges', _.bind(this.onApiCollaborativeChanges, this));
this.api.asc_registerCallback('asc_onSendThemeColorSchemes', _.bind(this.onApiSendThemeColorSchemes, this));
this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.onApiUsersChanged, this));
@ -2572,7 +2572,7 @@ define([
},
onAppReady: function (config) {
if (!this.mode.isEdit || this.mode.isEditMailMerge || this.mode.isEditDiagram) return;
if (!this.mode.isEdit || this.mode.isEditMailMerge || this.mode.isEditDiagram || this.mode.isEditOle) return;
var me = this;
var _holder_view = SSE.getController('DocumentHolder').getView('DocumentHolder');