[DE] Updated icons. Added context menu for content controls.

This commit is contained in:
Julia Radzhabova 2017-12-13 16:52:14 +03:00
parent 8f659ad314
commit e7b722c021
11 changed files with 148 additions and 44 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View file

@ -293,4 +293,4 @@
.button-normal-icon(btn-img-bkwd, 27, @toolbar-big-icon-size);
.button-normal-icon(btn-img-frwd, 28, @toolbar-big-icon-size);
.button-normal-icon(btn-img-wrap, 29, @toolbar-big-icon-size);
.button-normal-icon(btn-controls, 18, @toolbar-big-icon-size);
.button-normal-icon(btn-controls, 54, @toolbar-big-icon-size);

View file

@ -689,6 +689,19 @@ define([
}, this);
}
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() : AscCommonWord.sdtlock_Unlocked,
control_plain = (in_control&&control_props) ? (control_props.get_ContentControlType()==AscCommonWord.sdttype_InlineLevel) : false;
(lock_type===undefined) && (lock_type = AscCommonWord.sdtlock_Unlocked);
if (!paragraph_locked && !header_locked) {
toolbar.btnContentControls.menu.items[0].setDisabled(control_plain || lock_type==AscCommonWord.sdtlock_SdtContentLocked || lock_type==AscCommonWord.sdtlock_ContentLocked);
toolbar.btnContentControls.menu.items[1].setDisabled(control_plain || lock_type==AscCommonWord.sdtlock_SdtContentLocked || lock_type==AscCommonWord.sdtlock_ContentLocked);
toolbar.btnContentControls.menu.items[3].setDisabled(!in_control || lock_type==AscCommonWord.sdtlock_SdtContentLocked || lock_type==AscCommonWord.sdtlock_SdtLocked);
toolbar.btnContentControls.menu.items[5].setDisabled(!in_control);
}
var need_text_disable = paragraph_locked || header_locked || in_chart;
if (this._state.textonlycontrolsdisable != need_text_disable) {
if (this._state.activated) this._state.textonlycontrolsdisable = need_text_disable;
@ -717,35 +730,22 @@ define([
this.onDropCap(drop_value);
}
need_disable = need_disable || !enable_dropcap || in_equation;
need_disable = need_disable || !enable_dropcap || in_equation || control_plain;
toolbar.btnDropCap.setDisabled(need_disable);
if ( !toolbar.btnDropCap.isDisabled() )
toolbar.mnuDropCapAdvanced.setDisabled(disable_dropcapadv);
if (!paragraph_locked && !header_locked) {
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() : AscCommonWord.sdtlock_Unlocked,
control_plain = (in_control&&control_props) ? (control_props.get_ContentControlType()==AscCommonWord.sdttype_InlineLevel) : false;
(lock_type===undefined) && (lock_type = AscCommonWord.sdtlock_Unlocked);
toolbar.btnContentControls.menu.items[0].setDisabled(control_plain || lock_type==AscCommonWord.sdtlock_SdtContentLocked || lock_type==AscCommonWord.sdtlock_ContentLocked);
toolbar.btnContentControls.menu.items[1].setDisabled(control_plain || lock_type==AscCommonWord.sdtlock_SdtContentLocked || lock_type==AscCommonWord.sdtlock_ContentLocked);
toolbar.btnContentControls.menu.items[2].setDisabled(!in_control || lock_type==AscCommonWord.sdtlock_SdtContentLocked || lock_type==AscCommonWord.sdtlock_SdtLocked);
toolbar.btnContentControls.menu.items[4].setDisabled(!in_control);
}
need_disable = !can_add_table || header_locked || in_equation;
need_disable = !can_add_table || header_locked || in_equation || control_plain;
toolbar.btnInsertTable.setDisabled(need_disable);
need_disable = toolbar.mnuPageNumCurrentPos.isDisabled() && toolbar.mnuPageNumberPosPicker.isDisabled();
need_disable = toolbar.mnuPageNumCurrentPos.isDisabled() && toolbar.mnuPageNumberPosPicker.isDisabled() || control_plain;
toolbar.mnuInsertPageNum.setDisabled(need_disable);
need_disable = paragraph_locked || header_locked || in_header || in_equation && !btn_eq_state || this.api.asc_IsCursorInFootnote();
need_disable = paragraph_locked || header_locked || in_header || in_equation && !btn_eq_state || this.api.asc_IsCursorInFootnote() || in_control;
toolbar.btnsPageBreak.disable(need_disable);
need_disable = paragraph_locked || header_locked || !can_add_image || in_equation;
need_disable = paragraph_locked || header_locked || !can_add_image || in_equation || control_plain;
toolbar.btnInsertImage.setDisabled(need_disable);
toolbar.btnInsertShape.setDisabled(need_disable);
toolbar.btnInsertText.setDisabled(need_disable);
@ -756,10 +756,10 @@ define([
this._state.in_chart = in_chart;
}
need_disable = in_chart && image_locked || !in_chart && need_disable;
need_disable = in_chart && image_locked || !in_chart && need_disable || control_plain;
toolbar.btnInsertChart.setDisabled(need_disable);
need_disable = paragraph_locked || header_locked || in_chart || !can_add_image&&!in_equation;
need_disable = paragraph_locked || header_locked || in_chart || !can_add_image&&!in_equation || control_plain;
toolbar.btnInsertEquation.setDisabled(need_disable);
need_disable = paragraph_locked || header_locked || in_equation;
@ -768,11 +768,11 @@ define([
toolbar.btnEditHeader.setDisabled(in_equation);
need_disable = paragraph_locked || in_equation || in_image || in_header;
need_disable = paragraph_locked || in_equation || in_image || in_header || control_plain;
if (need_disable !== toolbar.btnNotes.isDisabled())
toolbar.btnNotes.setDisabled(need_disable);
need_disable = paragraph_locked || header_locked || in_image;
need_disable = paragraph_locked || header_locked || in_image || control_plain;
if (need_disable != toolbar.btnColumns.isDisabled())
toolbar.btnColumns.setDisabled(need_disable);
@ -1693,7 +1693,6 @@ define([
var me = this;
(new DE.Views.ControlSettingsDialog({
props: props,
api: me.api,
handler: function(result, value) {
if (result == 'ok') {
me.api.asc_SetContentControlProperties(value, id);

View file

@ -49,7 +49,7 @@ define([
DE.Views.ControlSettingsDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({
options: {
contentWidth: 300,
height: 250
height: 275
},
initialize : function(options) {
@ -74,6 +74,11 @@ define([
'<div id="control-settings-txt-tag"></div>',
'</td>',
'</tr>',
'<tr>',
'<td class="padding-small">',
'<label class="header">', me.textLock, '</label>',
'</td>',
'</tr>',
'<tr>',
'<td class="padding-small">',
'<div id="control-settings-chb-lock-delete"></div>',
@ -95,7 +100,6 @@ define([
].join('')
}, options);
this.api = options.api;
this.handler = options.handler;
this.props = options.props;
@ -200,6 +204,7 @@ define([
textTag: 'Tag',
txtLockDelete: 'Content control cannot be deleted',
txtLockEdit: 'Contents cannot be edited',
textLock: 'Locking',
cancelButtonText: 'Cancel',
okButtonText: 'Ok'

View file

@ -52,7 +52,8 @@ define([
'documenteditor/main/app/view/DropcapSettingsAdvanced',
'documenteditor/main/app/view/HyperlinkSettingsDialog',
'documenteditor/main/app/view/ParagraphSettingsAdvanced',
'documenteditor/main/app/view/TableSettingsAdvanced'
'documenteditor/main/app/view/TableSettingsAdvanced',
'documenteditor/main/app/view/ControlSettingsDialog'
], function ($, _, Backbone, gateway) { 'use strict';
DE.Views.DocumentHolder = Backbone.View.extend(_.extend({
@ -1791,6 +1792,28 @@ define([
me.fireEvent('editcomplete', me);
},
onControlsSelect: function(item, e) {
var props = this.api.asc_GetContentControlProperties();
if (props) {
if (item.value == 'settings') {
var me = this;
(new DE.Views.ControlSettingsDialog({
props: props,
handler: function (result, value) {
if (result == 'ok') {
me.api.asc_SetContentControlProperties(value, props.get_InternalId());
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
})).show();
} else if (item.value == 'remove') {
this.api.asc_RemoveContentControlWrapper(props.get_InternalId());
}
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
createDelayedElementsViewer: function() {
var me = this;
@ -2484,6 +2507,27 @@ define([
})
});
var menuTableRemoveControl = new Common.UI.MenuItem({
caption: me.textRemove,
value: 'remove'
}).on('click', _.bind(me.onControlsSelect, me));
var menuTableControlSettings = new Common.UI.MenuItem({
caption: me.textSettings,
value: 'settings'
}).on('click', _.bind(me.onControlsSelect, me));
var menuTableControl = new Common.UI.MenuItem({
caption: me.textContentControls,
menu : new Common.UI.Menu({
menuAlign: 'tl-tr',
items : [
menuTableRemoveControl,
menuTableControlSettings
]
})
});
/** coauthoring begin **/
var menuAddCommentTable = new Common.UI.MenuItem({
caption : me.addCommentText
@ -2742,6 +2786,14 @@ define([
} else
me.clearEquationMenu(false, 6);
menuEquationSeparatorInTable.setVisible(isEquation && eqlen>0);
var in_control = me.api.asc_IsContentControl();
menuTableControl.setVisible(in_control);
if (in_control) {
var control_props = me.api.asc_GetContentControlProperties(),
lock_type = (control_props) ? control_props.get_Lock() : AscCommonWord.sdtlock_Unlocked;
menuTableRemoveControl.setDisabled(lock_type==AscCommonWord.sdtlock_SdtContentLocked || lock_type==AscCommonWord.sdtlock_SdtLocked);
}
},
items: [
me.menuSpellCheckTable,
@ -2862,6 +2914,7 @@ define([
menuAddHyperlinkTable,
menuHyperlinkTable,
menuHyperlinkSeparator,
menuTableControl,
menuParagraphAdvancedInTable
]
}).on('hide:after', function(menu, e, isFromInputControl) {
@ -3117,6 +3170,21 @@ define([
caption : '--'
});
var menuParaRemoveControl = new Common.UI.MenuItem({
caption: me.textRemoveControl,
value: 'remove'
}).on('click', _.bind(me.onControlsSelect, me));
var menuParaControlSettings = new Common.UI.MenuItem(
{
caption: me.textEditControls,
value: 'settings'
}).on('click', _.bind(me.onControlsSelect, me));
var menuParaControlSeparator = new Common.UI.MenuItem({
caption : '--'
});
this.textMenu = new Common.UI.Menu({
initMenu: function(value){
var isInShape = (value.imgProps && value.imgProps.value && !_.isNull(value.imgProps.value.get_ShapeProperties()));
@ -3216,6 +3284,16 @@ define([
if (me.mode.canEditStyles && !isInChart) {
me.menuStyleUpdate.setCaption(me.updateStyleText.replace('%1', DE.getController('Main').translationTable[window.currentStyleName] || window.currentStyleName));
}
var in_control = me.api.asc_IsContentControl();
menuParaRemoveControl.setVisible(in_control);
menuParaControlSettings.setVisible(in_control);
menuParaControlSeparator.setVisible(in_control);
if (in_control) {
var control_props = me.api.asc_GetContentControlProperties(),
lock_type = (control_props) ? control_props.get_Lock() : AscCommonWord.sdtlock_Unlocked;
menuParaRemoveControl.setDisabled(lock_type==AscCommonWord.sdtlock_SdtContentLocked || lock_type==AscCommonWord.sdtlock_SdtLocked);
}
},
items: [
me.menuSpellPara,
@ -3230,6 +3308,9 @@ define([
menuParaPaste,
{ caption: '--' },
menuEquationSeparator,
menuParaRemoveControl,
menuParaControlSettings,
menuParaControlSeparator,
menuParagraphBreakBefore,
menuParagraphKeepLines,
menuParagraphVAlign,
@ -3546,7 +3627,12 @@ define([
strSign: 'Sign',
strDetails: 'Signature Details',
strSetup: 'Signature Setup',
strDelete: 'Remove Signature'
strDelete: 'Remove Signature',
textContentControls: 'Content control',
textRemove: 'Remove',
textSettings: 'Settings',
textRemoveControl: 'Remove content control',
textEditControls: 'Content control settings'
}, DE.Views.DocumentHolder || {}));
});

View file

@ -616,16 +616,20 @@ define([
menu: new Common.UI.Menu({
cls: 'ppm-toolbar',
items: [
{
caption: this.textRichControl,
value: AscCommonWord.sdttype_BlockLevel
},
{
caption: this.textPlainControl,
iconCls: 'mnu-control-plain',
value: AscCommonWord.sdttype_InlineLevel
},
{
caption: this.textRichControl,
iconCls: 'mnu-control-rich',
value: AscCommonWord.sdttype_BlockLevel
},
{caption: '--'},
{
caption: this.textRemoveControl,
iconCls: 'mnu-control-remove',
value: 'remove'
},
{caption: '--'},
@ -2503,12 +2507,12 @@ define([
textColumnsCustom: 'Custom Columns',
textSurface: 'Surface',
textTabProtect: 'Protection',
capBtnInsControls: 'Content Controls',
textRichControl: 'Insert rich text content control',
textPlainControl: 'Insert plain text content control',
textRemoveControl: 'Remove content control',
mniEditControls: 'Control Settings',
tipControls: 'Insert content controls'
capBtnInsControls: 'Content Control',
textRichControl: 'Rich text',
textPlainControl: 'Plain text',
textRemoveControl: 'Remove',
mniEditControls: 'Settings',
tipControls: 'Insert content control'
}
})(), DE.Views.Toolbar || {}));
});

View file

@ -788,6 +788,7 @@
"DE.Views.ControlSettingsDialog.textTag": "Tag",
"DE.Views.ControlSettingsDialog.txtLockDelete": "Content control cannot be deleted",
"DE.Views.ControlSettingsDialog.txtLockEdit": "Contents cannot be edited",
"DE.Views.ControlSettingsDialog.textLock": "Locking",
"DE.Views.ControlSettingsDialog.cancelButtonText": "Cancel",
"DE.Views.ControlSettingsDialog.okButtonText": "Ok",
"DE.Views.CustomColumnsDialog.cancelButtonText": "Cancel",
@ -968,6 +969,11 @@
"DE.Views.DocumentHolder.txtUngroup": "Ungroup",
"DE.Views.DocumentHolder.updateStyleText": "Update %1 style",
"DE.Views.DocumentHolder.vertAlignText": "Vertical Alignment",
"DE.Views.DocumentHolder.textContentControls": "Content control",
"DE.Views.DocumentHolder.textRemove": "Remove",
"DE.Views.DocumentHolder.textSettings": "Settings",
"DE.Views.DocumentHolder.textRemoveControl": "Remove content control",
"DE.Views.DocumentHolder.textEditControls": "Content control settings",
"DE.Views.DropcapSettingsAdvanced.cancelButtonText": "Cancel",
"DE.Views.DropcapSettingsAdvanced.okButtonText": "Ok",
"DE.Views.DropcapSettingsAdvanced.strBorders": "Borders & Fill",
@ -1799,10 +1805,10 @@
"DE.Views.Toolbar.txtScheme7": "Equity",
"DE.Views.Toolbar.txtScheme8": "Flow",
"DE.Views.Toolbar.txtScheme9": "Foundry",
"DE.Views.Toolbar.capBtnInsControls": "Content Controls",
"DE.Views.Toolbar.textRichControl": "Insert rich text content control",
"DE.Views.Toolbar.textPlainControl": "Insert plain text content control",
"DE.Views.Toolbar.textRemoveControl": "Remove content control",
"DE.Views.Toolbar.mniEditControls": "Control Settings",
"DE.Views.Toolbar.tipControls": "Insert content controls"
"DE.Views.Toolbar.capBtnInsControls": "Content Control",
"DE.Views.Toolbar.textRichControl": "Rich text",
"DE.Views.Toolbar.textPlainControl": "Plain text",
"DE.Views.Toolbar.textRemoveControl": "Remove",
"DE.Views.Toolbar.mniEditControls": "Settings",
"DE.Views.Toolbar.tipControls": "Insert content control"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -364,6 +364,10 @@
.menu-icon-normal(mnu-orient-portrait, 36, @menu-icon-size);
.menu-icon-normal(mnu-orient-landscape, 37, @menu-icon-size);
.menu-icon-normal(mnu-control-plain, 38, @menu-icon-size);
.menu-icon-normal(mnu-control-rich, 39, @menu-icon-size);
.menu-icon-normal(mnu-control-remove, 40, @menu-icon-size);
.menu-otherstates-icon(ppm-toolbar, @menu-icon-size);