Refactoring pdf

This commit is contained in:
Julia Radzhabova
2023-05-12 23:15:50 +03:00
parent 77ae429e18
commit 472da85de9
5 changed files with 76 additions and 605 deletions

View File

@ -62,12 +62,6 @@ define([
'Common.Views.Chat': {
'hide': _.bind(this.onHideChat, this)
},
'Common.Views.Header': {
'history:show': function () {
if ( !this.leftMenu.panelHistory.isVisible() )
this.clickMenuFileItem('header', 'history');
}.bind(this)
},
'Common.Views.About': {
'show': _.bind(this.aboutShowHide, this, false),
'hide': _.bind(this.aboutShowHide, this, true)
@ -109,11 +103,6 @@ define([
Common.NotificationCenter.on('leftmenu:change', _.bind(this.onMenuChange, this));
Common.NotificationCenter.on('app:comment:add', _.bind(this.onAppAddComment, this));
Common.NotificationCenter.on('collaboration:history', _.bind(function () {
if ( !this.leftMenu.panelHistory.isVisible() )
this.clickMenuFileItem(null, 'history');
}, this));
Common.NotificationCenter.on('protect:doclock', _.bind(this.onChangeProtectDocument, this));
Common.NotificationCenter.on('file:print', _.bind(this.clickToolbarPrint, this));
},
@ -121,19 +110,12 @@ define([
this.leftMenu = this.createView('LeftMenu').render();
this.leftMenu.btnSearchBar.on('toggle', _.bind(this.onMenuSearchBar, this));
this._state = {
disableEditing: false,
docProtection: {
isReadOnly: false,
isReviewOnly: false,
isFormsOnly: false,
isCommentsOnly: false
}
disableEditing: false
};
var keymap = {
'command+shift+s,ctrl+shift+s': _.bind(this.onShortcut, this, 'save'),
'command+f,ctrl+f': _.bind(this.onShortcut, this, 'search'),
'ctrl+h': _.bind(this.onShortcut, this, 'replace'),
'esc': _.bind(this.onShortcut, this, 'escape'),
/** coauthoring begin **/
'command+shift+h,ctrl+shift+h': _.bind(this.onShortcut, this, 'comments'),
@ -159,7 +141,7 @@ define([
this.api.asc_registerCallback('asc_onAddComment', _.bind(this.onApiAddComment, this));
this.api.asc_registerCallback('asc_onAddComments', _.bind(this.onApiAddComments, this));
var collection = this.getApplication().getCollection('Common.Collections.Comments'),
resolved = Common.Utils.InternalSettings.get("de-settings-resolvedcomment");
resolved = Common.Utils.InternalSettings.get("pdfe-settings-resolvedcomment");
for (var i = 0; i < collection.length; ++i) {
var comment = collection.at(i);
if (!comment.get('hide') && comment.get('userid') !== this.mode.user.id && (resolved || !comment.get('resolved'))) {
@ -171,8 +153,6 @@ define([
}
/** coauthoring end **/
this.leftMenu.getMenu('file').setApi(api);
if (this.mode.canUseHistory)
this.getApplication().getController('Common.Controllers.History').setApi(this.api).setMode(this.mode);
this.getApplication().getController('PageThumbnails').setApi(this.api).setMode(this.mode);
this.getApplication().getController('Search').setApi(this.api).setMode(this.mode);
this.leftMenu.setOptionsPanel('advancedsearch', this.getApplication().getController('Search').getView('Common.Views.SearchPanel'));
@ -212,9 +192,6 @@ define([
}
/** coauthoring end **/
if (this.mode.canUseHistory)
this.leftMenu.setOptionsPanel('history', this.getApplication().getController('Common.Controllers.History').getView('Common.Views.History'));
this.leftMenu.setOptionsPanel('navigation', this.getApplication().getController('Navigation').getView('Navigation'));
if (this.mode.canUseThumbnails) {
@ -224,7 +201,6 @@ define([
}
(this.mode.trialMode || this.mode.isBeta) && this.leftMenu.setDeveloperMode(this.mode.trialMode, this.mode.isBeta, this.mode.buildVersion);
this.onChangeProtectDocument();
Common.util.Shortcuts.resumeEvents();
return this;
},
@ -263,31 +239,6 @@ define([
if ( isopts ) close_menu = false;
else this.onCreateNew(undefined, 'blank');
break;
case 'history':
if (!this.leftMenu.panelHistory.isVisible()) {
if (this.api.isDocumentModified()) {
var me = this;
this.api.asc_stopSaving();
Common.UI.warning({
closable: false,
width: 500,
title: this.notcriticalErrorTitle,
msg: this.leavePageText,
buttons: ['ok', 'cancel'],
primary: 'ok',
callback: function(btn) {
if (btn == 'ok') {
me.api.asc_undoAllChanges();
me.api.asc_continueSaving();
me.showHistory();
} else
me.api.asc_continueSaving();
}
});
} else
this.showHistory();
}
break;
case 'rename':
var me = this,
documentCaption = me.api.asc_getDocumentName();
@ -336,7 +287,7 @@ define([
}, this)
});
} else if (format == Asc.c_oAscFileType.DOCX) {
if (!Common.Utils.InternalSettings.get("de-settings-compatible") && !Common.localStorage.getBool("de-hide-save-compatible") && this.api.asc_isCompatibilityMode()) {
if (!Common.Utils.InternalSettings.get("pdfe-settings-compatible") && !Common.localStorage.getBool("pdfe-hide-save-compatible") && this.api.asc_isCompatibilityMode()) {
Common.UI.warning({
closable: false,
width: 600,
@ -345,7 +296,7 @@ define([
buttons: ['ok', 'cancel'],
dontshow: true,
callback: _.bind(function(btn, dontshow){
if (dontshow) Common.localStorage.setItem("de-hide-save-compatible", 1);
if (dontshow) Common.localStorage.setItem("pdfe-hide-save-compatible", 1);
if (btn == 'ok') {
this.isFromFileDownloadAs = ext;
this.api.asc_DownloadAs(options);
@ -355,7 +306,7 @@ define([
});
} else {
this.isFromFileDownloadAs = ext;
options.asc_setCompatible(!!Common.Utils.InternalSettings.get("de-settings-compatible"));
options.asc_setCompatible(!!Common.Utils.InternalSettings.get("pdfe-settings-compatible"));
this.api.asc_DownloadAs(options);
menu.hide();
}
@ -444,17 +395,17 @@ define([
applySettings: function(menu) {
var value;
var fast_coauth = Common.Utils.InternalSettings.get("de-settings-coauthmode");
var fast_coauth = Common.Utils.InternalSettings.get("pdfe-settings-coauthmode");
/** coauthoring begin **/
if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring ) {
if (this.mode.canChangeCoAuthoring) {
fast_coauth = Common.localStorage.getBool("de-settings-coauthmode", true);
Common.Utils.InternalSettings.set("de-settings-coauthmode", fast_coauth);
fast_coauth = Common.localStorage.getBool("pdfe-settings-coauthmode", true);
Common.Utils.InternalSettings.set("pdfe-settings-coauthmode", fast_coauth);
this.api.asc_SetFastCollaborative(fast_coauth);
}
value = Common.localStorage.getItem((fast_coauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict");
Common.Utils.InternalSettings.set((fast_coauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict", value);
value = Common.localStorage.getItem((fast_coauth) ? "pdfe-settings-showchanges-fast" : "pdfe-settings-showchanges-strict");
Common.Utils.InternalSettings.set((fast_coauth) ? "pdfe-settings-showchanges-fast" : "pdfe-settings-showchanges-strict", value);
switch(value) {
case 'all': value = Asc.c_oAscCollaborativeMarksShowType.All; break;
case 'none': value = Asc.c_oAscCollaborativeMarksShowType.None; break;
@ -463,27 +414,27 @@ define([
}
this.api.SetCollaborativeMarksShowType(value);
} else if (this.mode.canLiveView && !this.mode.isOffline && this.mode.canChangeCoAuthoring) { // viewer
fast_coauth = Common.localStorage.getBool("de-settings-view-coauthmode", false);
Common.Utils.InternalSettings.set("de-settings-coauthmode", fast_coauth);
fast_coauth = Common.localStorage.getBool("pdfe-settings-view-coauthmode", false);
Common.Utils.InternalSettings.set("pdfe-settings-coauthmode", fast_coauth);
this.api.asc_SetFastCollaborative(fast_coauth);
}
value = Common.localStorage.getBool("de-settings-livecomment", true);
Common.Utils.InternalSettings.set("de-settings-livecomment", value);
var resolved = Common.localStorage.getBool("de-settings-resolvedcomment");
Common.Utils.InternalSettings.set("de-settings-resolvedcomment", resolved);
value = Common.localStorage.getBool("pdfe-settings-livecomment", true);
Common.Utils.InternalSettings.set("pdfe-settings-livecomment", value);
var resolved = Common.localStorage.getBool("pdfe-settings-resolvedcomment");
Common.Utils.InternalSettings.set("pdfe-settings-resolvedcomment", resolved);
if (this.mode.canViewComments && this.leftMenu.panelComments && this.leftMenu.panelComments.isVisible())
value = resolved = true;
(value) ? this.api.asc_showComments(resolved) : this.api.asc_hideComments();
// this.getApplication().getController('Common.Controllers.ReviewChanges').commentsShowHide(value ? 'show' : 'hide');
/** coauthoring end **/
value = Common.localStorage.getBool("de-settings-cachemode", true);
Common.Utils.InternalSettings.set("de-settings-cachemode", value);
value = Common.localStorage.getBool("pdfe-settings-cachemode", true);
Common.Utils.InternalSettings.set("pdfe-settings-cachemode", value);
this.api.asc_setDefaultBlitMode(value);
value = Common.localStorage.getItem("de-settings-fontrender");
Common.Utils.InternalSettings.set("de-settings-fontrender", value);
value = Common.localStorage.getItem("pdfe-settings-fontrender");
Common.Utils.InternalSettings.set("pdfe-settings-fontrender", value);
switch (value) {
case '1': this.api.SetFontRenderingMode(1); break;
case '2': this.api.SetFontRenderingMode(2); break;
@ -492,31 +443,13 @@ define([
if (this.mode.isEdit) {
if (this.mode.canChangeCoAuthoring || !fast_coauth) {// can change co-auth. mode or for strict mode
value = parseInt(Common.localStorage.getItem("de-settings-autosave"));
Common.Utils.InternalSettings.set("de-settings-autosave", value);
value = parseInt(Common.localStorage.getItem("pdfe-settings-autosave"));
Common.Utils.InternalSettings.set("pdfe-settings-autosave", value);
this.api.asc_setAutoSaveGap(value);
}
if (Common.UI.FeaturesManager.canChange('spellcheck')) {
value = Common.localStorage.getBool("de-settings-spellcheck", true);
Common.Utils.InternalSettings.set("de-settings-spellcheck", value);
this.api.asc_setSpellCheck(value);
var spprops = new AscCommon.CSpellCheckSettings();
value = Common.localStorage.getBool("de-spellcheck-ignore-uppercase-words", true);
Common.Utils.InternalSettings.set("de-spellcheck-ignore-uppercase-words", value);
spprops.put_IgnoreWordsInUppercase(value);
value = Common.localStorage.getBool("de-spellcheck-ignore-numbers-words", true);
Common.Utils.InternalSettings.set("de-spellcheck-ignore-numbers-words", value);
spprops.put_IgnoreWordsWithNumbers(value);
this.api.asc_setSpellCheckSettings(spprops);
}
value = parseInt(Common.localStorage.getItem("de-settings-paste-button"));
Common.Utils.InternalSettings.set("de-settings-paste-button", value);
this.api.asc_setVisiblePasteButton(!!value);
}
this.api.put_ShowSnapLines(Common.Utils.InternalSettings.get("de-settings-showsnaplines"));
this.api.put_ShowSnapLines(Common.Utils.InternalSettings.get("pdfe-settings-showsnaplines"));
menu.hide();
},
@ -601,11 +534,9 @@ define([
},
updatePreviewMode: function() {
var viewmode = this._state.disableEditing || this._state.docProtection.isReadOnly || this._state.docProtection.isFormsOnly || this._state.docProtection.isCommentsOnly;
var viewmode = this._state.disableEditing;
if (this.viewmode === viewmode) return;
this.viewmode = viewmode;
this.leftMenu.panelSearch && this.leftMenu.panelSearch.setSearchMode(this.viewmode ? 'no-replace' : 'search');
},
SetDisabled: function(disable, options) {
@ -639,13 +570,13 @@ define([
},
onApiAddComment: function(id, data) {
var resolved = Common.Utils.InternalSettings.get("de-settings-resolvedcomment");
var resolved = Common.Utils.InternalSettings.get("pdfe-settings-resolvedcomment");
if (data && data.asc_getUserId() !== this.mode.user.id && (resolved || !data.asc_getSolved()) && AscCommon.UserInfoParser.canViewComment(data.asc_getUserName()))
this.leftMenu.markCoauthOptions('comments');
},
onApiAddComments: function(data) {
var resolved = Common.Utils.InternalSettings.get("de-settings-resolvedcomment");
var resolved = Common.Utils.InternalSettings.get("pdfe-settings-resolvedcomment");
for (var i = 0; i < data.length; ++i) {
if (data[i].asc_getUserId() !== this.mode.user.id && (resolved || !data[i].asc_getSolved()) && AscCommon.UserInfoParser.canViewComment(data.asc_getUserName())) {
this.leftMenu.markCoauthOptions('comments');
@ -671,8 +602,8 @@ define([
},
commentsShowHide: function(mode) {
var value = Common.Utils.InternalSettings.get("de-settings-livecomment"),
resolved = Common.Utils.InternalSettings.get("de-settings-resolvedcomment");
var value = Common.Utils.InternalSettings.get("pdfe-settings-livecomment"),
resolved = Common.Utils.InternalSettings.get("pdfe-settings-resolvedcomment");
if (!value || !resolved) {
(mode === 'show') ? this.api.asc_showComments(true) : ((value) ? this.api.asc_showComments(resolved) : this.api.asc_hideComments());
@ -732,7 +663,6 @@ define([
if (!this.mode) return;
switch (s) {
case 'replace':
case 'search':
this.leftMenu.btnAbout.toggle(false);
Common.UI.Menu.Manager.hideAll();
@ -850,17 +780,6 @@ define([
}
},
showHistory: function() {
if (!this.mode.wopi) {
var maincontroller = PDFE.getController('Main');
if (!maincontroller.loadMask)
maincontroller.loadMask = new Common.UI.LoadMask({owner: $('#viewport')});
maincontroller.loadMask.setTitle(this.textLoadHistory);
maincontroller.loadMask.show();
}
Common.Gateway.requestHistory();
},
onShowHideChat: function(state) {
if (this.mode.canCoAuthoring && this.mode.canChat && !this.mode.isLightVersion) {
if (state) {
@ -899,8 +818,7 @@ define([
onMenuSearchBar: function(obj, show) {
if (show) {
var mode = this.mode.isEdit && !this.viewmode ? undefined : 'no-replace';
this.leftMenu.panelSearch.setSearchMode(mode);
this.leftMenu.panelSearch.setSearchMode('no-replace');
}
},
@ -912,22 +830,11 @@ define([
return this.leftMenu && this.leftMenu.panelComments && this.leftMenu.panelComments.isVisible();
},
onChangeProtectDocument: function(props) {
if (!props) {
var docprotect = this.getApplication().getController('DocProtection');
props = docprotect ? docprotect.getDocProps() : null;
}
if (props) {
this._state.docProtection = props;
this.updatePreviewMode();
}
},
onLeftMenuHide: function (view, status) {
if (this.leftMenu) {
!status && this.leftMenu.close();
status ? this.leftMenu.show() : this.leftMenu.hide();
Common.localStorage.setBool('de-hidden-leftmenu', !status);
Common.localStorage.setBool('pdfe-hidden-leftmenu', !status);
!view && this.leftMenu.fireEvent('view:hide', [this, !status]);
}
@ -945,16 +852,13 @@ define([
newDocumentTitle : 'Unnamed document',
requestEditRightsText : 'Requesting editing rights...',
textReplaceSuccess : 'Search has been done. {0} occurrences have been replaced',
textReplaceSkipped : 'The replacement has been made. {0} occurrences were skipped.',
textLoadHistory : 'Loading version history...',
notcriticalErrorTitle: 'Warning',
leavePageText: 'All unsaved changes in this document will be lost.<br> Click \'Cancel\' then \'Save\' to save them. Click \'OK\' to discard all the unsaved changes.',
warnDownloadAs : 'If you continue saving in this format all features except the text will be lost.<br>Are you sure you want to continue?',
warnDownloadAsRTF : 'If you continue saving in this format some of the formatting might be lost.<br>Are you sure you want to continue?',
txtUntitled: 'Untitled',
txtCompatible: 'The document will be saved to the new format. It will allow to use all the editor features, but might affect the document layout.<br>Use the \'Compatibility\' option of the advanced settings if you want to make the files compatible with older MS Word versions.',
warnDownloadAsPdf: 'Your {0} will be converted to an editable format. This may take a while. The resulting document will be optimized to allow you to edit the text, so it might not look exactly like the original {0}, especially if the original file contained lots of graphics.',
warnReplaceString: '{0} is not a valid special character for the Replace With box.'
warnDownloadAsPdf: 'Your {0} will be converted to an editable format. This may take a while. The resulting document will be optimized to allow you to edit the text, so it might not look exactly like the original {0}, especially if the original file contained lots of graphics.'
}, PDFE.Controllers.LeftMenu || {}));
});

View File

@ -1339,9 +1339,8 @@ define([
toolbarController && toolbarController.setApi(me.api);
if (this.appOptions.isEdit) {
var fontsControllers = application.getController('Common.Controllers.Fonts');
fontsControllers && fontsControllers.setApi(me.api);
// var fontsControllers = application.getController('Common.Controllers.Fonts');
// fontsControllers && fontsControllers.setApi(me.api);
// application.getController('Common.Controllers.Protection').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
var viewport = this.getApplication().getController('Viewport').getView('Viewport');

View File

@ -65,7 +65,6 @@ define([
lock_doc: undefined,
can_copycut: undefined
};
this.flg = {};
this.editMode = true;
this.binding = {};
@ -242,23 +241,11 @@ 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,
disable_dropcapadv = true,
frame_pr = undefined,
shape_pr = undefined,
toolbar = this.toolbar,
in_header = false,
in_chart = false,
in_equation = false,
btn_eq_state = false,
in_image = false,
in_control = false,
in_para = false,
in_footnote = this.api.asc_IsCursorInFootnote() || this.api.asc_IsCursorInEndnote();
in_para = false;
while (++i < selectedObjects.length) {
type = selectedObjects[i].get_ObjectType();
@ -266,152 +253,17 @@ define([
if (type === Asc.c_oAscTypeSelectElement.Paragraph) {
paragraph_locked = pr.get_Locked();
can_add_table = pr.get_CanAddTable();
can_add_image = pr.get_CanAddImage();
frame_pr = pr;
sh = pr.get_Shade();
in_para = true;
} else if (type === Asc.c_oAscTypeSelectElement.Header) {
header_locked = pr.get_Locked();
in_header = true;
} else if (type === Asc.c_oAscTypeSelectElement.Image) {
in_image = true;
image_locked = pr.get_Locked();
if (pr && pr.get_ChartProperties())
in_chart = true;
if (pr && pr.get_ShapeProperties())
shape_pr = pr.get_ShapeProperties();
} else if (type === Asc.c_oAscTypeSelectElement.Math) {
in_equation = true;
if (Asc.c_oAscMathInterfaceType.Common === pr.get_Type())
btn_eq_state = true;
}
if (type === Asc.c_oAscTypeSelectElement.Table || type === Asc.c_oAscTypeSelectElement.Header || type === Asc.c_oAscTypeSelectElement.Image) {
enable_dropcap = false;
}
if (enable_dropcap!==false && type == Asc.c_oAscTypeSelectElement.Paragraph)
enable_dropcap = true;
}
if (sh)
this.onParagraphColor(sh);
var rich_del_lock = (frame_pr) ? !frame_pr.can_DeleteBlockContentControl() : false,
rich_edit_lock = (frame_pr) ? !frame_pr.can_EditBlockContentControl() : false,
plain_del_lock = (frame_pr) ? !frame_pr.can_DeleteInlineContentControl() : false,
plain_edit_lock = (frame_pr) ? !frame_pr.can_EditInlineContentControl() : false,
in_smart_art = shape_pr && shape_pr.asc_getFromSmartArt(),
in_smart_art_internal = shape_pr && shape_pr.asc_getFromSmartArtInternal();
this.toolbar.lockToolbar(Common.enumLock.paragraphLock, paragraph_locked, {array: this.toolbar.paragraphControls.concat([toolbar.btnContentControls, toolbar.btnClearStyle])});
this.toolbar.lockToolbar(Common.enumLock.headerLock, header_locked, {array: this.toolbar.paragraphControls.concat([toolbar.btnContentControls, toolbar.btnClearStyle, toolbar.btnWatermark])});
this.toolbar.lockToolbar(Common.enumLock.richEditLock, rich_edit_lock, {array: this.toolbar.paragraphControls.concat([toolbar.btnClearStyle])});
this.toolbar.lockToolbar(Common.enumLock.plainEditLock, plain_edit_lock, {array: this.toolbar.paragraphControls.concat([toolbar.btnClearStyle])});
this.toolbar.lockToolbar(Common.enumLock.richDelLock, rich_del_lock, {array: toolbar.btnsPageBreak.concat(this.btnsComment).concat([toolbar.btnInsertTable, toolbar.btnInsertImage, toolbar.btnInsertChart, toolbar.btnInsertTextArt,
toolbar.btnInsDateTime, toolbar.btnBlankPage, toolbar.btnInsertEquation, toolbar.btnInsertSymbol ])});
this.toolbar.lockToolbar(Common.enumLock.plainDelLock, plain_del_lock, {array: toolbar.btnsPageBreak.concat(this.btnsComment).concat([toolbar.btnInsertTable, toolbar.btnInsertImage, toolbar.btnInsertChart, toolbar.btnInsertTextArt,
toolbar.btnInsDateTime, toolbar.btnBlankPage, toolbar.btnInsertEquation, toolbar.btnInsertSymbol ])});
this.toolbar.lockToolbar(Common.enumLock.inChart, in_chart, {array: toolbar.textOnlyControls.concat([toolbar.btnClearStyle, toolbar.btnInsertEquation])});
this.toolbar.lockToolbar(Common.enumLock.inSmartart, in_smart_art, {array: toolbar.textOnlyControls.concat([toolbar.btnClearStyle, toolbar.btnContentControls])});
this.toolbar.lockToolbar(Common.enumLock.inSmartartInternal, in_smart_art_internal, {array: toolbar.textOnlyControls.concat([toolbar.btnClearStyle, toolbar.btnDecLeftOffset, toolbar.btnIncLeftOffset, toolbar.btnContentControls])});
this.toolbar.lockToolbar(Common.enumLock.inEquation, in_equation, {array: toolbar.btnsPageBreak.concat([toolbar.btnDropCap, toolbar.btnInsertTable, toolbar.btnBlankPage, toolbar.btnInsertShape,
toolbar.btnInsertText, toolbar.btnInsertTextArt, toolbar.btnInsertImage, toolbar.btnInsertSmartArt, toolbar.btnSuperscript, toolbar.btnSubscript, toolbar.btnEditHeader])});
in_control = this.api.asc_IsContentControl();
var control_props = in_control ? this.api.asc_GetContentControlProperties() : null,
lock_type = (in_control&&control_props) ? control_props.get_Lock() : Asc.c_oAscSdtLockType.Unlocked,
control_plain = (in_control&&control_props) ? (control_props.get_ContentControlType()==Asc.c_oAscSdtLevelType.Inline) : false;
(lock_type===undefined) && (lock_type = Asc.c_oAscSdtLockType.Unlocked);
var content_locked = lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.ContentLocked;
var if_form = control_props && control_props.get_FormPr();
if (!toolbar.btnContentControls.isDisabled()) {
var control_disable = control_plain || content_locked;
for (var i=0; i<7; i++)
toolbar.btnContentControls.menu.items[i].setDisabled(control_disable);
toolbar.btnContentControls.menu.items[8].setDisabled(!in_control || lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.SdtLocked || if_form);
toolbar.btnContentControls.menu.items[10].setDisabled(!in_control || if_form);
}
this.toolbar.lockToolbar(Common.enumLock.fixedForm, if_form && if_form.get_Fixed() && in_para, {array: [
toolbar.btnAlignLeft, toolbar.btnAlignCenter, toolbar.btnAlignRight, toolbar.btnAlignJust,
toolbar.btnMarkers, toolbar.btnNumbers, toolbar.btnMultilevels,
toolbar.btnDecLeftOffset, toolbar.btnIncLeftOffset,
toolbar.btnLineSpace
]});
this.toolbar.lockToolbar(Common.enumLock.controlPlain, control_plain, {array: [toolbar.btnInsertTable, toolbar.btnInsertImage, toolbar.btnInsertChart, toolbar.btnInsertText, toolbar.btnInsertTextArt,
toolbar.btnInsertShape, toolbar.btnInsertSmartArt, toolbar.btnInsertEquation, toolbar.btnDropCap, toolbar.btnColumns, toolbar.mnuInsertPageNum ]});
if (enable_dropcap && frame_pr) {
var value = frame_pr.get_FramePr(),
drop_value = Asc.c_oAscDropCap.None;
if (value!==undefined) {
drop_value = value.get_DropCap();
enable_dropcap = ( drop_value === Asc.c_oAscDropCap.Drop || drop_value === Asc.c_oAscDropCap.Margin);
disable_dropcapadv = false;
} else {
enable_dropcap = frame_pr.get_CanAddDropCap();
}
if (enable_dropcap)
this.onDropCap(drop_value);
}
this.toolbar.lockToolbar(Common.enumLock.dropcapLock, !enable_dropcap, {array: [toolbar.btnDropCap]});
if ( !toolbar.btnDropCap.isDisabled() )
toolbar.mnuDropCapAdvanced.setDisabled(disable_dropcapadv);
this.toolbar.lockToolbar(Common.enumLock.cantAddTable, !can_add_table, {array: [toolbar.btnInsertTable]});
this.toolbar.lockToolbar(Common.enumLock.cantAddPageNum, toolbar.mnuPageNumCurrentPos.isDisabled() && toolbar.mnuPageNumberPosPicker.isDisabled(), {array: [toolbar.mnuInsertPageNum]});
this.toolbar.lockToolbar(Common.enumLock.inHeader, in_header, {array: toolbar.btnsPageBreak.concat([toolbar.btnBlankPage])});
this.toolbar.lockToolbar(Common.enumLock.inControl, in_control, {array: toolbar.btnsPageBreak.concat([toolbar.btnBlankPage])});
this.toolbar.lockToolbar(Common.enumLock.cantPageBreak, in_image && !btn_eq_state, {array: toolbar.btnsPageBreak.concat([toolbar.btnBlankPage])});
this.toolbar.lockToolbar(Common.enumLock.contentLock, content_locked, {array: [toolbar.btnInsertShape, toolbar.btnInsertText, toolbar.btnInsertImage, toolbar.btnInsertTextArt, toolbar.btnInsertChart, toolbar.btnInsertSmartArt ]});
this.toolbar.lockToolbar(Common.enumLock.inFootnote, in_footnote, {array: toolbar.btnsPageBreak.concat([toolbar.btnBlankPage, toolbar.btnInsertShape, toolbar.btnInsertText, toolbar.btnInsertTextArt, toolbar.btnInsertSmartArt ])});
this.toolbar.lockToolbar(Common.enumLock.cantAddImagePara, in_para && !can_add_image, {array: [toolbar.btnInsertImage, toolbar.btnInsertTextArt]});
if (in_chart !== this._state.in_chart) {
toolbar.btnInsertChart.updateHint(in_chart ? toolbar.tipChangeChart : toolbar.tipInsertChart);
this._state.in_chart = in_chart;
}
var need_disable = paragraph_locked || header_locked || in_equation || control_plain || rich_del_lock || plain_del_lock || content_locked || in_para && !can_add_image;
need_disable = !in_chart && need_disable;
this.toolbar.lockToolbar(Common.enumLock.cantAddChart, need_disable, {array: [toolbar.btnInsertChart]});
this.toolbar.lockToolbar(Common.enumLock.chartLock, in_chart && image_locked, {array: [toolbar.btnInsertChart]});
this.toolbar.lockToolbar(Common.enumLock.cantAddEquation, !can_add_image&&!in_equation, {array: [toolbar.btnInsertEquation]});
this.toolbar.lockToolbar(Common.enumLock.noParagraphSelected, !in_para, {array: [toolbar.btnInsertSymbol, toolbar.btnInsDateTime]});
this.toolbar.lockToolbar(Common.enumLock.inImage, in_image, {array: [toolbar.btnColumns]});
this.toolbar.lockToolbar(Common.enumLock.inImagePara, in_image && in_para, {array: [toolbar.btnLineNumbers]});
if (toolbar.listStylesAdditionalMenuItem && (frame_pr===undefined) !== toolbar.listStylesAdditionalMenuItem.isDisabled())
toolbar.listStylesAdditionalMenuItem.setDisabled(frame_pr===undefined);
if (this.btnsComment) {
// comments
this.toolbar.lockToolbar(Common.enumLock.cantAddQuotedComment, !this.api.can_AddQuotedComment(), {array: this.btnsComment});
this.toolbar.lockToolbar(Common.enumLock.imageLock, image_locked, {array: this.btnsComment});
this.mode.compatibleFeatures && this.toolbar.lockToolbar(Common.enumLock.inImage, in_image, {array: this.btnsComment});
if (control_props) {
var spectype = control_props.get_SpecificType();
this.toolbar.lockToolbar(Common.enumLock.inSpecificForm, spectype==Asc.c_oAscContentControlSpecificType.CheckBox || spectype==Asc.c_oAscContentControlSpecificType.Picture ||
spectype==Asc.c_oAscContentControlSpecificType.ComboBox || spectype==Asc.c_oAscContentControlSpecificType.DropDownList || spectype==Asc.c_oAscContentControlSpecificType.DateTime,
{array: this.btnsComment});
} else
this.toolbar.lockToolbar(Common.enumLock.inSpecificForm, false, {array: this.btnsComment});
}
if (frame_pr) {
this._state.suppress_num = !!frame_pr.get_SuppressLineNumbers();
}
this._state.in_equation = in_equation;
var listId = this.api.asc_GetCurrentNumberingId(),
numformat = (listId !== null) ? this.api.asc_GetNumberingPr(listId).get_Lvl(this.api.asc_GetCurrentNumberingLvl()).get_Format() : Asc.c_oAscNumberingFormat.None;
this.toolbar.btnMarkers.toggle(numformat===Asc.c_oAscNumberingFormat.Bullet, true);
this.toolbar.btnNumbers.toggle(numformat!==Asc.c_oAscNumberingFormat.None && numformat!==Asc.c_oAscNumberingFormat.Bullet, true);
this.toolbar.lockToolbar(Common.enumLock.paragraphLock, paragraph_locked, {array: this.toolbar.paragraphControls});
},
onApiZoomChange: function(percent, type) {},
@ -659,9 +511,6 @@ define([
})).then(function () {
me.toolbar && me.toolbar.btnHandTool.toggle(true, true);
me.api && me.api.asc_setViewerTargetType('hand');
if ( config.isEdit ) {
}
});
},

View File

@ -53,12 +53,9 @@ define([
formats: [[
{name: 'DOCX', imgCls: 'docx', type: Asc.c_oAscFileType.DOCX},
{name: 'PDF', imgCls: 'pdf', type: Asc.c_oAscFileType.PDF},
{name: 'ODT', imgCls: 'odt', type: Asc.c_oAscFileType.ODT},
{name: 'DOCXF', imgCls: 'docxf', type: Asc.c_oAscFileType.DOCXF},
{name: 'OFORM', imgCls: 'oform', type: Asc.c_oAscFileType.OFORM}
{name: 'ODT', imgCls: 'odt', type: Asc.c_oAscFileType.ODT}
],[
{name: 'DOTX', imgCls: 'dotx', type: Asc.c_oAscFileType.DOTX},
{name: 'DOCM', imgCls: 'docm', type: Asc.c_oAscFileType.DOCM},
{name: 'PDFA', imgCls: 'pdfa', type: Asc.c_oAscFileType.PDFA},
{name: 'OTT', imgCls: 'ott', type: Asc.c_oAscFileType.OTT}
],[
@ -78,11 +75,9 @@ define([
'<div class="format-items">',
'<% _.each(rows, function(row) { %>',
'<% _.each(row, function(item) { %>',
'<% if (item.type!==Asc.c_oAscFileType.DOCM || fileType=="docm") { %>',
'<div class="format-item"><div class="btn-doc-format" format="<%= item.type %>" data-hint="2" data-hint-direction="left-top" data-hint-offset="4, 4">',
'<div class ="svg-format-<%= item.imgCls %>"></div>',
'</div></div>',
'<% } %>',
'<div class="format-item"><div class="btn-doc-format" format="<%= item.type %>" data-hint="2" data-hint-direction="left-top" data-hint-offset="4, 4">',
'<div class ="svg-format-<%= item.imgCls %>"></div>',
'</div></div>',
'<% }) %>',
'<div class="divider"></div>',
'<% }) %>',
@ -111,7 +106,7 @@ define([
render: function() {
if (/^pdf$/.test(this.fileType)) {
this.formats[0].splice(1, 1, {name: 'PDF', imgCls: 'pdf', type: ''}); // remove pdf
this.formats[1].splice(2, 1); // remove pdfa
this.formats[1].splice(1, 1); // remove pdfa
} else if (/^xps|oxps$/.test(this.fileType)) {
this.formats[0].push({name: this.fileType.toUpperCase(), imgCls: this.fileType, type: ''}); // original xps/oxps
} else if (/^djvu$/.test(this.fileType)) {
@ -121,10 +116,6 @@ define([
]];
}
if (this.mode && !this.mode.canFeatureForms && this.formats.length>2) {
this.formats[0].splice(3, 2); // remove docxf and oform
}
this.$el.html(this.template({rows:this.formats, fileType: (this.fileType || 'docx').toLowerCase(), header: this.textDownloadAs}));
$('.btn-doc-format',this.el).on('click', _.bind(this.onFormatClick,this));
@ -176,12 +167,9 @@ define([
formats: [[
{name: 'DOCX', imgCls: 'docx', type: Asc.c_oAscFileType.DOCX, ext: '.docx'},
{name: 'PDF', imgCls: 'pdf', type: Asc.c_oAscFileType.PDF, ext: '.pdf'},
{name: 'ODT', imgCls: 'odt', type: Asc.c_oAscFileType.ODT, ext: '.odt'},
{name: 'DOCXF', imgCls: 'docxf', type: Asc.c_oAscFileType.DOCXF, ext: '.docxf'},
{name: 'OFORM', imgCls: 'oform', type: Asc.c_oAscFileType.OFORM, ext: '.oform'}
{name: 'ODT', imgCls: 'odt', type: Asc.c_oAscFileType.ODT, ext: '.odt'}
],[
{name: 'DOTX', imgCls: 'dotx', type: Asc.c_oAscFileType.DOTX, ext: '.dotx'},
{name: 'DOCM', imgCls: 'docm', type: Asc.c_oAscFileType.DOCM, ext: '.docm'},
{name: 'PDFA', imgCls: 'pdfa', type: Asc.c_oAscFileType.PDFA, ext: '.pdf'},
{name: 'OTT', imgCls: 'ott', type: Asc.c_oAscFileType.OTT, ext: '.ott'}
],[
@ -202,11 +190,9 @@ define([
'<div class="format-items">',
'<% _.each(rows, function(row) { %>',
'<% _.each(row, function(item) { %>',
'<% if (item.type!==Asc.c_oAscFileType.DOCM || fileType=="docm") { %>',
'<div class="format-item"><div class="btn-doc-format" format="<%= item.type %>" format-ext="<%= item.ext %>" data-hint="2" data-hint-direction="left-top" data-hint-offset="4, 4">',
'<div class ="svg-format-<%= item.imgCls %>"></div>',
'</div></div>',
'<% } %>',
'<div class="format-item"><div class="btn-doc-format" format="<%= item.type %>" format-ext="<%= item.ext %>" data-hint="2" data-hint-direction="left-top" data-hint-offset="4, 4">',
'<div class ="svg-format-<%= item.imgCls %>"></div>',
'</div></div>',
'<% }) %>',
'<div class="divider"></div>',
'<% }) %>',
@ -235,7 +221,7 @@ define([
render: function() {
if (/^pdf$/.test(this.fileType)) {
this.formats[0].splice(1, 1, {name: 'PDF', imgCls: 'pdf', type: '', ext: true}); // remove pdf
this.formats[1].splice(2, 1); // remove pdfa
this.formats[1].splice(1, 1); // remove pdfa
} else if (/^xps|oxps$/.test(this.fileType)) {
this.formats[0].push({name: this.fileType.toUpperCase(), imgCls: this.fileType, type: '', ext: true}); // original xps/oxps
} else if (/^djvu$/.test(this.fileType)) {
@ -245,10 +231,6 @@ define([
]];
}
if (this.mode && !this.mode.canFeatureForms && this.formats.length>2) {
this.formats[0].splice(3, 2); // remove docxf and oform
}
this.$el.html(this.template({rows:this.formats, fileType: (this.fileType || 'docx').toLowerCase(), header: this.textSaveCopyAs}));
$('.btn-doc-format',this.el).on('click', _.bind(this.onFormatClick,this));
@ -311,12 +293,6 @@ define([
'<tr class="forcesave">',
'<td colspan="2"><span id="fms-chb-forcesave"></span></td>',
'</tr>',
'<tr class="edit">',
'<td colspan="2"><div id="fms-chb-paste-settings"></div></td>',
'</tr>',
'<tr class="edit">',
'<td colspan="2"><span id="fms-chb-compatible"></span></td>',
'</tr>',
'<tr class ="editsave divider-group"></tr>',
'<tr class="collaboration">',
'<td colspan="2" class="group-name"><label><%= scope.txtCollaboration %></label></td>',
@ -337,16 +313,6 @@ define([
'</div></td>',
'</tr>',
'<tr class ="divider-subgroup coauth changes-mode"></tr>',
'<tr class="view-review">',
'<td colspan="2" class="subgroup-name"><label><%= scope.txtShowTrackChanges %></label></td>',
'</tr>',
'<tr class="view-review">',
'<td colspan="2"><div id="fms-rb-show-track-ballons"></div></td>',
'</tr>',
'<tr class="view-review">',
'<td colspan="2"><div id="fms-rb-show-track-tooltips"></div></td>',
'</tr>',
'<tr class ="divider-subgroup view-review"></tr>',
'<tr class="coauth changes-show">',
'<td colspan="2" class="subgroup-name"><label><%= scope.strShowChanges %></label></td>',
'</tr>',
@ -370,28 +336,9 @@ define([
'<td colspan="2"><div id="fms-chb-resolved-comment"></div></td>',
'</tr>',
'<tr class ="collaboration divider-group"></tr>',
'<tr class ="edit">',
'<td colspan="2" class="group-name proofing"><label><%= scope.txtProofing %></label></td>',
'</tr>',
'<tr class="edit spellcheck">',
'<td colspan="2"><div id="fms-chb-spell-check"></div></td>',
'</tr>',
'<tr class="edit spellcheck">',
'<td colspan="2"><span id="fms-chb-ignore-uppercase-words"></span></td>',
'</tr>',
'<tr class="edit spellcheck">',
'<td colspan="2"><span id="fms-chb-ignore-numbers-words"></span></td>',
'</tr>',
'<tr class="edit">',
'<td colspan="2"><button type="button" class="btn btn-text-default" id="fms-btn-auto-correct" style="width:auto; display: inline-block;padding-right: 10px;padding-left: 10px;" data-hint="2" data-hint-direction="bottom" data-hint-offset="medium"><%= scope.txtAutoCorrect %></button></div></td>',
'</tr>',
'<tr class ="edit divider-group"></tr>',
'<tr>',
'<td colspan="2" class="group-name"><label><%= scope.txtWorkspace %></label></td>',
'</tr>',
'<tr class="edit">',
'<td colspan="2"><span id="fms-chb-align-guides"></span></td>',
'</tr>',
'<tr>',
'<td colspan="2"><div id="fms-chb-use-alt-key"></div></td>',
'</tr>',
@ -410,10 +357,6 @@ define([
'<div><div id="fms-cmb-theme"></div>',
'<div id="fms-chb-dark-mode"></div></div></td>',
'</tr>',
'<tr class="edit">',
'<td><label><%= scope.strUnit %></label></td>',
'<td><span id="fms-cmb-unit"></span></td>',
'</tr>',
'<tr>',
'<td><label><%= scope.strZoom %></label></td>',
'<td><div id="fms-cmb-zoom" class="input-group-nr"></div></td>',
@ -422,11 +365,6 @@ define([
'<td><label><%= scope.strFontRender %></label></td>',
'<td><span id="fms-cmb-font-render"></span></td>',
'</tr>',
'<tr class="macros">',
'<td><label><%= scope.strMacrosSettings %></label></td>',
'<td>',
'<div><div id="fms-cmb-macros"></div>',
'</tr>',
'<tr class ="divider-group"></tr>',
'<tr class="fms-btn-apply">',
'<td style="padding-top:15px; padding-bottom: 15px;"><button class="btn normal dlg-btn primary" data-hint="2" data-hint-direction="bottom" data-hint-offset="medium"><%= scope.okButtonText %></button></td>',
@ -484,41 +422,6 @@ define([
});
/** coauthoring end **/
this.chSpell = new Common.UI.CheckBox({
el: $markup.findById('#fms-chb-spell-check'),
labelText: this.txtSpellCheck,
dataHint: '2',
dataHintDirection: 'left',
dataHintOffset: 'small'
}).on('change', function(field, newValue, oldValue, eOpts){
me.chIgnoreUppercase.setDisabled(field.getValue()!=='checked');
me.chIgnoreNumbers.setDisabled(field.getValue()!=='checked');
});
this.chIgnoreUppercase = new Common.UI.CheckBox({
el: $markup.findById('#fms-chb-ignore-uppercase-words'),
labelText: this.strIgnoreWordsInUPPERCASE,
dataHint: '2',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.chIgnoreNumbers = new Common.UI.CheckBox({
el: $markup.findById('#fms-chb-ignore-numbers-words'),
labelText: this.strIgnoreWordsWithNumbers,
dataHint: '2',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.chCompatible = new Common.UI.CheckBox({
el: $markup.findById('#fms-chb-compatible'),
labelText: this.textOldVersions,
dataHint: '2',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.chAutosave = new Common.UI.CheckBox({
el: $markup.findById('#fms-chb-autosave'),
labelText: this.textAutoSave,
@ -540,14 +443,6 @@ define([
dataHintOffset: 'small'
});
this.chAlignGuides = new Common.UI.CheckBox({
el: $markup.findById('#fms-chb-align-guides'),
labelText: this.textAlignGuides,
dataHint: '2',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.cmbZoom = new Common.UI.ComboBox({
el : $markup.findById('#fms-cmb-zoom'),
style : 'width: 160px;',
@ -601,24 +496,6 @@ define([
this.rbCoAuthModeStrict.on('change', _.bind(this.onChangeCoAuthMode, this,0));
this.rbCoAuthModeStrict.$el.parent().on('click', function (){me.rbCoAuthModeStrict.setValue(true);});
this.rbChangesBallons = new Common.UI.RadioBox({
el :$markup.findById('#fms-rb-show-track-ballons'),
name : 'show-track-changes',
labelText : this.txtChangesBalloons,
dataHint: '2',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.rbChangesTip = new Common.UI.RadioBox({
el :$markup.findById('#fms-rb-show-track-tooltips'),
name : 'show-track-changes',
labelText : this.txtChangesTip,
dataHint: '2',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.rbShowChangesNone = new Common.UI.RadioBox({
el :$markup.findById('#fms-rb-show-changes-none'),
name : 'show-changes',
@ -682,59 +559,6 @@ define([
});
this.cmbFontRender.on('selected', _.bind(this.onFontRenderSelected, this));
this.cmbUnit = new Common.UI.ComboBox({
el : $markup.findById('#fms-cmb-unit'),
style : 'width: 160px;',
menuCls : 'menu-aligned',
menuStyle : 'min-width:100%;',
editable : false,
cls : 'input-group-nr',
data : [
{ value: Common.Utils.Metric.c_MetricUnits['cm'], displayValue: this.txtCm },
{ value: Common.Utils.Metric.c_MetricUnits['pt'], displayValue: this.txtPt },
{ value: Common.Utils.Metric.c_MetricUnits['inch'], displayValue: this.txtInch }
],
dataHint: '2',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
});
this.cmbMacros = new Common.UI.ComboBox({
el : $markup.findById('#fms-cmb-macros'),
style : 'width: 160px;',
editable : false,
menuCls : 'menu-aligned',
menuStyle : 'min-width:100%;',
cls : 'input-group-nr',
data : [
{ value: 2, displayValue: this.txtStopMacros, descValue: this.txtStopMacrosDesc },
{ value: 0, displayValue: this.txtWarnMacros, descValue: this.txtWarnMacrosDesc },
{ value: 1, displayValue: this.txtRunMacros, descValue: this.txtRunMacrosDesc }
],
itemsTemplate: _.template([
'<% _.each(items, function(item) { %>',
'<li id="<%= item.id %>" data-value="<%- item.value %>"><a tabindex="-1" type="menuitem" style ="display: flex; flex-direction: column;">',
'<label><%= scope.getDisplayValue(item) %></label><label class="comment-text"><%= item.descValue %></label></a></li>',
'<% }); %>'
].join('')),
dataHint: '2',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
});
this.chPaste = new Common.UI.CheckBox({
el: $markup.findById('#fms-chb-paste-settings'),
labelText: this.strPasteButton,
dataHint: '2',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.btnAutoCorrect = new Common.UI.Button({
el: $markup.findById('#fms-btn-auto-correct')
});
this.btnAutoCorrect.on('click', _.bind(this.autoCorrect, this));
this.cmbTheme = new Common.UI.ComboBox({
el : $markup.findById('#fms-cmb-theme'),
style : 'width: 160px;',
@ -828,7 +652,7 @@ define([
setMode: function(mode) {
this.mode = mode;
var fast_coauth = Common.Utils.InternalSettings.get("de-settings-coauthmode");
var fast_coauth = Common.Utils.InternalSettings.get("pdfe-settings-coauthmode");
$('tr.edit', this.el)[mode.isEdit?'show':'hide']();
$('tr.autosave', this.el)[mode.isEdit && (mode.canChangeCoAuthoring || !fast_coauth) ? 'show' : 'hide']();
@ -843,13 +667,10 @@ define([
$('tr.coauth.changes-mode', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring && mode.canChangeCoAuthoring ? 'show' : 'hide']();
$('tr.coauth.changes-show', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring ? 'show' : 'hide']();
$('tr.live-viewer', this.el)[mode.canLiveView && !mode.isOffline && mode.canChangeCoAuthoring ? 'show' : 'hide']();
$('tr.view-review', this.el)[mode.canViewReview ? 'show' : 'hide']();
$('tr.spellcheck', this.el)[mode.isEdit && Common.UI.FeaturesManager.canChange('spellcheck') ? 'show' : 'hide']();
$('tr.comments', this.el)[mode.canCoAuthoring ? 'show' : 'hide']();
/** coauthoring end **/
$('tr.quick-print', this.el)[mode.canQuickPrint && !(mode.customization && mode.customization.compactHeader && mode.isEdit) ? 'show' : 'hide']();
$('tr.macros', this.el)[(mode.customization && mode.customization.macros===false) ? 'hide' : 'show']();
if ( !Common.UI.Themes.available() ) {
$('tr.themes, tr.themes + tr.divider', this.el).hide();
}
@ -861,65 +682,48 @@ define([
},
updateSettings: function() {
this.chUseAltKey.setValue(Common.Utils.InternalSettings.get("de-settings-show-alt-hints"));
this.chUseAltKey.setValue(Common.Utils.InternalSettings.get("pdfe-settings-show-alt-hints"));
var value = Common.Utils.InternalSettings.get("de-settings-zoom");
var value = Common.Utils.InternalSettings.get("pdfe-settings-zoom");
value = (value!==null) ? parseInt(value) : (this.mode.customization && this.mode.customization.zoom ? parseInt(this.mode.customization.zoom) : 100);
var item = this.cmbZoom.store.findWhere({value: value});
this.cmbZoom.setValue(item ? parseInt(item.get('value')) : (value>0 ? value+'%' : 100));
/** coauthoring begin **/
this.chLiveComment.setValue(Common.Utils.InternalSettings.get("de-settings-livecomment"));
this.chResolvedComment.setValue(Common.Utils.InternalSettings.get("de-settings-resolvedcomment"));
this.chLiveComment.setValue(Common.Utils.InternalSettings.get("pdfe-settings-livecomment"));
this.chResolvedComment.setValue(Common.Utils.InternalSettings.get("pdfe-settings-resolvedcomment"));
var fast_coauth = Common.Utils.InternalSettings.get("de-settings-coauthmode");
var fast_coauth = Common.Utils.InternalSettings.get("pdfe-settings-coauthmode");
this.rbCoAuthModeFast.setValue(fast_coauth);
this.rbCoAuthModeStrict.setValue(!fast_coauth);
this.fillShowChanges(fast_coauth);
this.chLiveViewer.setValue(Common.Utils.InternalSettings.get("de-settings-coauthmode"));
this.chLiveViewer.setValue(Common.Utils.InternalSettings.get("pdfe-settings-coauthmode"));
value = Common.Utils.InternalSettings.get((fast_coauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict");
value = Common.Utils.InternalSettings.get((fast_coauth) ? "pdfe-settings-showchanges-fast" : "pdfe-settings-showchanges-strict");
this.rbShowChangesNone.setValue(value=='none');
this.rbShowChangesLast.setValue(value=='last');
this.rbShowChangesAll.setValue(value=='all');
/** coauthoring end **/
value = Common.Utils.InternalSettings.get("de-settings-fontrender");
value = Common.Utils.InternalSettings.get("pdfe-settings-fontrender");
item = this.cmbFontRender.store.findWhere({value: parseInt(value)});
this.cmbFontRender.setValue(item ? item.get('value') : 0);
this._fontRender = this.cmbFontRender.getValue();
value = Common.Utils.InternalSettings.get("de-settings-cachemode");
value = Common.Utils.InternalSettings.get("pdfe-settings-cachemode");
item = this.cmbFontRender.store.findWhere({value: 'custom'});
item && value && item.set('checked', !!value);
item && value && this.cmbFontRender.cmpEl.find('#' + item.get('id') + ' a').addClass('checked');
value = Common.Utils.InternalSettings.get("de-settings-unit");
item = this.cmbUnit.store.findWhere({value: value});
this.cmbUnit.setValue(item ? parseInt(item.get('value')) : Common.Utils.Metric.getDefaultMetric());
this._oldUnits = this.cmbUnit.getValue();
value = Common.Utils.InternalSettings.get("de-settings-autosave");
value = Common.Utils.InternalSettings.get("pdfe-settings-autosave");
this.chAutosave.setValue(value == 1);
if (this.mode.canForcesave)
this.chForcesave.setValue(Common.Utils.InternalSettings.get("de-settings-forcesave"));
this.chForcesave.setValue(Common.Utils.InternalSettings.get("pdfe-settings-forcesave"));
if (Common.UI.FeaturesManager.canChange('spellcheck')) {
this.chSpell.setValue(Common.Utils.InternalSettings.get("de-settings-spellcheck"));
this.chIgnoreUppercase.setValue(Common.Utils.InternalSettings.get("de-spellcheck-ignore-uppercase-words"));
this.chIgnoreNumbers.setValue(Common.Utils.InternalSettings.get("de-spellcheck-ignore-numbers-words"));
}
this.chAlignGuides.setValue(Common.Utils.InternalSettings.get("de-settings-showsnaplines"));
this.chCompatible.setValue(Common.Utils.InternalSettings.get("de-settings-compatible"));
item = this.cmbMacros.store.findWhere({value: Common.Utils.InternalSettings.get("de-macros-mode")});
this.cmbMacros.setValue(item ? item.get('value') : 0);
this.chPaste.setValue(Common.Utils.InternalSettings.get("de-settings-paste-button"));
this.chQuickPrint.setValue(Common.Utils.InternalSettings.get("de-settings-quick-print-button"));
this.chQuickPrint.setValue(Common.Utils.InternalSettings.get("pdfe-settings-quick-print-button"));
var data = [];
for (var t in Common.UI.Themes.map()) {
@ -934,65 +738,39 @@ define([
this.chDarkMode.setValue(Common.UI.Themes.isContentThemeDark());
this.chDarkMode.setDisabled(!Common.UI.Themes.isDarkTheme());
this.chRTL.setValue(Common.localStorage.getBool("ui-rtl"));
if (this.mode.canViewReview) {
value = Common.Utils.InternalSettings.get("de-settings-review-hover-mode");
this.rbChangesTip.setValue(value);
this.rbChangesBallons.setValue(!value);
}
},
applySettings: function() {
Common.UI.Themes.setTheme(this.cmbTheme.getValue());
if (!this.chDarkMode.isDisabled() && (this.chDarkMode.isChecked() !== Common.UI.Themes.isContentThemeDark()))
Common.UI.Themes.toggleContentTheme();
Common.localStorage.setItem("de-settings-show-alt-hints", this.chUseAltKey.isChecked() ? 1 : 0);
Common.Utils.InternalSettings.set("de-settings-show-alt-hints", Common.localStorage.getBool("de-settings-show-alt-hints"));
Common.localStorage.setItem("de-settings-zoom", this.cmbZoom.getValue());
Common.Utils.InternalSettings.set("de-settings-zoom", Common.localStorage.getItem("de-settings-zoom"));
Common.localStorage.setItem("pdfe-settings-show-alt-hints", this.chUseAltKey.isChecked() ? 1 : 0);
Common.Utils.InternalSettings.set("pdfe-settings-show-alt-hints", Common.localStorage.getBool("pdfe-settings-show-alt-hints"));
Common.localStorage.setItem("pdfe-settings-zoom", this.cmbZoom.getValue());
Common.Utils.InternalSettings.set("pdfe-settings-zoom", Common.localStorage.getItem("pdfe-settings-zoom"));
/** coauthoring begin **/
Common.localStorage.setItem("de-settings-livecomment", this.chLiveComment.isChecked() ? 1 : 0);
Common.localStorage.setItem("de-settings-resolvedcomment", this.chResolvedComment.isChecked() ? 1 : 0);
Common.localStorage.setItem("pdfe-settings-livecomment", this.chLiveComment.isChecked() ? 1 : 0);
Common.localStorage.setItem("pdfe-settings-resolvedcomment", this.chResolvedComment.isChecked() ? 1 : 0);
if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring) {
this.mode.canChangeCoAuthoring && Common.localStorage.setItem("de-settings-coauthmode", this.rbCoAuthModeFast.getValue() ? 1 : 0 );
Common.localStorage.setItem(this.rbCoAuthModeFast.getValue() ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict",
this.mode.canChangeCoAuthoring && Common.localStorage.setItem("pdfe-settings-coauthmode", this.rbCoAuthModeFast.getValue() ? 1 : 0 );
Common.localStorage.setItem(this.rbCoAuthModeFast.getValue() ? "pdfe-settings-showchanges-fast" : "pdfe-settings-showchanges-strict",
this.rbShowChangesNone.getValue()?'none':this.rbShowChangesLast.getValue()?'last':'all');
} else if (this.mode.canLiveView && !this.mode.isOffline && this.mode.canChangeCoAuthoring) { // viewer
Common.localStorage.setItem("de-settings-view-coauthmode", this.chLiveViewer.isChecked() ? 1 : 0);
Common.localStorage.setItem("pdfe-settings-view-coauthmode", this.chLiveViewer.isChecked() ? 1 : 0);
}
/** coauthoring end **/
Common.localStorage.setItem("de-settings-fontrender", this.cmbFontRender.getValue());
Common.localStorage.setItem("pdfe-settings-fontrender", this.cmbFontRender.getValue());
var item = this.cmbFontRender.store.findWhere({value: 'custom'});
Common.localStorage.setItem("de-settings-cachemode", item && !item.get('checked') ? 0 : 1);
Common.localStorage.setItem("de-settings-unit", this.cmbUnit.getValue());
if (this.mode.isEdit && (this.mode.canChangeCoAuthoring || !Common.Utils.InternalSettings.get("de-settings-coauthmode")))
Common.localStorage.setItem("de-settings-autosave", this.chAutosave.isChecked() ? 1 : 0);
Common.localStorage.setItem("pdfe-settings-cachemode", item && !item.get('checked') ? 0 : 1);
if (this.mode.isEdit && (this.mode.canChangeCoAuthoring || !Common.Utils.InternalSettings.get("pdfe-settings-coauthmode")))
Common.localStorage.setItem("pdfe-settings-autosave", this.chAutosave.isChecked() ? 1 : 0);
if (this.mode.canForcesave)
Common.localStorage.setItem("de-settings-forcesave", this.chForcesave.isChecked() ? 1 : 0);
if (Common.UI.FeaturesManager.canChange('spellcheck') && this.mode.isEdit) {
Common.localStorage.setItem("de-settings-spellcheck", this.chSpell.isChecked() ? 1 : 0);
Common.localStorage.setBool("de-spellcheck-ignore-uppercase-words", this.chIgnoreUppercase.isChecked());
Common.localStorage.setBool("de-spellcheck-ignore-numbers-words", this.chIgnoreNumbers.isChecked());
}
Common.localStorage.setItem("de-settings-compatible", this.chCompatible.isChecked() ? 1 : 0);
Common.Utils.InternalSettings.set("de-settings-compatible", this.chCompatible.isChecked() ? 1 : 0);
Common.Utils.InternalSettings.set("de-settings-showsnaplines", this.chAlignGuides.isChecked());
Common.localStorage.setItem("pdfe-settings-forcesave", this.chForcesave.isChecked() ? 1 : 0);
Common.localStorage.setItem("de-macros-mode", this.cmbMacros.getValue());
Common.Utils.InternalSettings.set("de-macros-mode", this.cmbMacros.getValue());
if (this.mode.canViewReview) {
var val = this.rbChangesTip.getValue();
Common.localStorage.setBool("de-settings-review-hover-mode", val);
Common.Utils.InternalSettings.set("de-settings-review-hover-mode", val);
this.mode.reviewHoverMode = val;
}
Common.localStorage.setItem("de-settings-paste-button", this.chPaste.isChecked() ? 1 : 0);
var isRtlChanged = this.chRTL.$el.is(':visible') && Common.localStorage.getBool("ui-rtl") !== this.chRTL.isChecked();
Common.localStorage.setBool("ui-rtl", this.chRTL.isChecked());
Common.localStorage.setBool("de-settings-quick-print-button", this.chQuickPrint.isChecked());
Common.localStorage.setBool("pdfe-settings-quick-print-button", this.chQuickPrint.isChecked());
Common.localStorage.save();
@ -1037,14 +815,6 @@ define([
this._fontRender = combo.getValue();
},
autoCorrect: function() {
// if (this.dlgAutoCorrect && this.dlgAutoCorrect.isVisible()) return;
// this.dlgAutoCorrect = new Common.Views.AutoCorrectDialog({
// api: this.api
// });
// this.dlgAutoCorrect.show();
},
strZoom: 'Default Zoom Value',
/** coauthoring begin **/
strShowChanges: 'Real-time Collaboration Changes',
@ -1057,40 +827,20 @@ define([
txtMac: 'as OS X',
txtNative: 'Native',
strFontRender: 'Font Hinting',
strUnit: 'Unit of Measurement',
txtCm: 'Centimeter',
txtPt: 'Point',
textAutoSave: 'Autosave',
txtSpellCheck: 'Spell Checking',
textAlignGuides: 'Alignment Guides',
strCoAuthMode: 'Co-editing mode',
strFast: 'Fast',
strStrict: 'Strict',
textAutoRecover: 'Autorecover',
txtInch: 'Inch',
txtFitPage: 'Fit to Page',
txtFitWidth: 'Fit to Width',
textForceSave: 'Save to Server',
textOldVersions: 'Make the files compatible with older MS Word versions when saved as DOCX',
txtCacheMode: 'Default cache mode',
strRTLSupport: 'RTL interface',
strMacrosSettings: 'Macros Settings',
txtWarnMacros: 'Show Notification',
txtRunMacros: 'Enable All',
txtStopMacros: 'Disable All',
txtWarnMacrosDesc: 'Disable all macros with notification',
txtRunMacrosDesc: 'Enable all macros without notification',
txtStopMacrosDesc: 'Disable all macros without notification',
strPasteButton: 'Show Paste Options button when content is pasted',
txtProofing: 'Proofing',
strTheme: 'Theme',
txtAutoCorrect: 'AutoCorrect options...',
txtChangesTip: 'Show by hover in tooltips',
txtChangesBalloons: 'Show by click in balloons',
txtDarkMode: 'Turn on document dark mode',
txtEditingSaving: 'Editing and saving',
txtCollaboration: 'Collaboration',
txtShowTrackChanges: 'Show track changes',
txtWorkspace: 'Workspace',
txtHieroglyphs: 'Hieroglyphs',
txtUseAltKey: 'Use Alt key to navigate the user interface using the keyboard',
@ -1099,8 +849,6 @@ define([
strShowResolvedComments: 'Show resolved comments',
txtFastTip: 'Real-time co-editing. All changes are saved automatically',
txtStrictTip: 'Use the \'Save\' button to sync the changes you and others make',
strIgnoreWordsInUPPERCASE: 'Ignore words in UPPERCASE',
strIgnoreWordsWithNumbers: 'Ignore words with numbers',
strShowOthersChanges: 'Show changes from other users',
txtAdvancedSettings: 'Advanced Settings',
txtQuickPrint: 'Show the Quick Print button in the editor header',
@ -1412,12 +1160,6 @@ define([
this.authors = [];
this._state = {
_locked: false,
docProtection: {
isReadOnly: false,
isReviewOnly: false,
isFormsOnly: false,
isCommentsOnly: false
},
disableEditing: false
};
},
@ -1832,8 +1574,6 @@ define([
this.api.asc_registerCallback('asc_onGetDocInfoEnd', _.bind(this._onGetDocInfoEnd, this));
// this.api.asc_registerCallback('asc_onDocumentName', _.bind(this.onDocumentName, this));
this.api.asc_registerCallback('asc_onLockCore', _.bind(this.onLockCore, this));
Common.NotificationCenter.on('protect:doclock', _.bind(this.onChangeProtectDocument, this));
this.onChangeProtectDocument();
this.updateInfo(this.doc);
return this;
},
@ -1915,19 +1655,8 @@ define([
this.updateFileInfo();
},
onChangeProtectDocument: function(props) {
// if (!props) {
// var docprotect = DE.getController('DocProtection');
// props = docprotect ? docprotect.getDocProps() : null;
// }
// if (props) {
// this._state.docProtection = props;
// }
},
SetDisabled: function() {
var isProtected = this._state.docProtection.isReadOnly || this._state.docProtection.isFormsOnly || this._state.docProtection.isCommentsOnly;
var disable = !this.mode.isEdit || this._state._locked || isProtected || this._state.disableEditing;
var disable = !this.mode.isEdit || this._state._locked || this._state.disableEditing;
this.inputTitle.setDisabled(disable);
this.inputTags.setDisabled(disable);
this.inputSubject.setDisabled(disable);

View File

@ -205,11 +205,11 @@ define([
if (btn.pressed) {
if (!(this.$el.width() > SCALE_MIN)) {
this.$el.width(parseInt(Common.localStorage.getItem('de-mainmenu-width')) || MENU_SCALE_PART);
this.$el.width(parseInt(Common.localStorage.getItem('pdfe-mainmenu-width')) || MENU_SCALE_PART);
}
} else if (!this._state.pluginIsRunning) {
var width = this.$el.width();
this.isVisible() && (width>SCALE_MIN) && Common.localStorage.setItem('de-mainmenu-width', width);
this.isVisible() && (width>SCALE_MIN) && Common.localStorage.setItem('pdfe-mainmenu-width', width);
this.$el.width(SCALE_MIN);
}
@ -277,9 +277,6 @@ define([
} else if (name == 'comment') {
this.panelComments = panel;
} else /** coauthoring end **/
if (name == 'history') {
this.panelHistory = panel.render('#left-panel-history');
} else
if (name == 'plugins' && !this.panelPlugins) {
this.panelPlugins = panel.render(/*'#left-panel-plugins'*/);
} else
@ -425,13 +422,6 @@ define([
return this;
},
showHistory: function() {
this._state.pluginIsRunning = false;
this.panelHistory.show();
this.panelHistory.$el.width((parseInt(Common.localStorage.getItem('de-mainmenu-width')) || MENU_SCALE_PART) - SCALE_MIN);
Common.NotificationCenter.trigger('layout:changed', 'history');
},
setDeveloperMode: function(mode, beta, version) {
if ( !this.$el.is(':visible') ) return;