[DE] Locking paragraph options for a form (bug 59062)

This commit is contained in:
Alexei Koshelev 2022-12-14 23:30:08 +03:00
parent 3ddbc065e9
commit 80fb58cd26
3 changed files with 30 additions and 6 deletions

View file

@ -171,6 +171,7 @@ define([
isProtected = this._state.docProtection.isReadOnly || this._state.docProtection.isFormsOnly || this._state.docProtection.isCommentsOnly;
var control_props = this.api.asc_IsContentControl() ? this.api.asc_GetContentControlProperties() : null,
is_form = control_props && control_props.get_FormPr(),
control_lock = false;
for (i=0; i<SelectedObjects.length; i++)
{
@ -202,7 +203,7 @@ define([
}
}
control_lock = control_lock || value.get_Locked();
} else if (settingsType == Common.Utils.documentSettingsType.Paragraph) {
} else if (settingsType == Common.Utils.documentSettingsType.Paragraph && !(is_form && is_form.get_Fixed())) {
this._settings[settingsType].panel.isChart = isChart;
this._settings[settingsType].panel.isSmartArtInternal = isSmartArtInternal;
can_add_table = value.get_CanAddTable();
@ -217,7 +218,11 @@ define([
this._settings[Common.Utils.documentSettingsType.Signature].locked = value.get_Locked() || isProtected;
}
if (control_props && control_props.get_FormPr() && this.rightmenu.formSettings) {
if(is_form && is_form.get_Fixed()) {
this._settings[Common.Utils.documentSettingsType.Paragraph].hidden = 1;
}
if (is_form && this.rightmenu.formSettings) {
var spectype = control_props.get_SpecificType();
if (spectype==Asc.c_oAscContentControlSpecificType.CheckBox || spectype==Asc.c_oAscContentControlSpecificType.Picture || spectype==Asc.c_oAscContentControlSpecificType.Complex ||
spectype==Asc.c_oAscContentControlSpecificType.ComboBox || spectype==Asc.c_oAscContentControlSpecificType.DropDownList || spectype==Asc.c_oAscContentControlSpecificType.None) {
@ -225,7 +230,7 @@ define([
this._settings[settingsType].props = control_props;
this._settings[settingsType].locked = control_lock || isProtected;
this._settings[settingsType].hidden = 0;
if (control_props.get_FormPr().get_Fixed())
if (is_form.get_Fixed())
this._settings[Common.Utils.documentSettingsType.TextArt].hidden = 1;
}
}

View file

@ -854,16 +854,35 @@ define([
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();
var hasParagraphInForm = if_form && selectedObjects.some(function(item) {
return item.get_ObjectType() == Asc.c_oAscTypeSelectElement.Paragraph;
});
if (!toolbar.btnContentControls.isDisabled()) {
var control_disable = control_plain || content_locked,
if_form = control_props && control_props.get_FormPr();
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);
}
if (if_form && if_form.get_Fixed() && hasParagraphInForm) {
toolbar.btnAlignLeft.setDisabled(true);
toolbar.btnAlignCenter.setDisabled(true);
toolbar.btnAlignRight.setDisabled(true);
toolbar.btnAlignJust.setDisabled(true);
toolbar.btnMarkers.setDisabled(true);
toolbar.btnNumbers.setDisabled(true);
toolbar.btnMultilevels.setDisabled(true);
toolbar.btnDecLeftOffset.setDisabled(true);
toolbar.btnIncLeftOffset.setDisabled(true);
toolbar.btnLineSpace.setDisabled(true);
}
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) {

View file

@ -1920,7 +1920,7 @@ define([
me.menuParagraphBreakBefore.setDisabled(disabled || !_.isUndefined(value.headerProps) || !_.isUndefined(value.imgProps));
me.menuParagraphKeepLines.setDisabled(disabled);
me.menuParagraphAdvanced.setDisabled(disabled);
me.menuParagraphAdvanced.setDisabled(disabled || (is_form && is_form.get_Fixed()));
me.menuFrameAdvanced.setDisabled(disabled);
me.menuDropCapAdvanced.setDisabled(disabled);
me.menuParagraphVAlign.setDisabled(disabled);