Merge pull request #2114 from ONLYOFFICE/feature/save-as-picture

Feature/save as picture
This commit is contained in:
Julia Radzhabova 2022-12-07 12:33:22 +03:00 committed by GitHub
commit 27b2f463cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 130 additions and 79 deletions

View file

@ -427,6 +427,7 @@ define([
view.menuParaTOCSettings.on('click', _.bind(me.onParaTOCSettings, me));
view.menuTableEquation.menu.on('item:click', _.bind(me.convertEquation, me));
view.menuParagraphEquation.menu.on('item:click', _.bind(me.convertEquation, me));
view.menuSaveAsPicture.on('click', _.bind(me.saveAsPicture, me));
me.onChangeProtectDocument();
},
@ -2484,6 +2485,12 @@ define([
}
},
saveAsPicture: function() {
if(this.api) {
this.api.asc_SaveDrawingAsPicture();
}
},
onChangeProtectDocument: function(props) {
if (!props) {
var docprotect = this.getApplication().getController('DocProtection');

View file

@ -271,6 +271,12 @@ define([
});
var menuInsertCaptionSeparator = new Common.UI.MenuItem({ caption: '--' });
me.menuSaveAsPicture = new Common.UI.MenuItem({
caption : me.textSaveAsPicture
});
var menuSaveAsPictureSeparator = new Common.UI.MenuItem({ caption: '--'});
me.menuEquationInsertCaption = new Common.UI.MenuItem({
caption : me.txtInsertCaption
});
@ -455,10 +461,6 @@ define([
caption : me.editChartText
});
var menuChartEditSeparator = new Common.UI.MenuItem({
caption : '--'
});
me.menuOriginalSize = new Common.UI.MenuItem({
caption : me.originalSizeText
});
@ -591,10 +593,6 @@ define([
caption: me.textEditPoints
});
var menuImgEditPointsSeparator = new Common.UI.MenuItem({
caption : '--'
});
this.pictureMenu = new Common.UI.Menu({
cls: 'shifted-right',
restoreHeightAndTop: true,
@ -703,8 +701,6 @@ define([
if (me.menuChartEdit.isVisible())
me.menuChartEdit.setDisabled(islocked || value.imgProps.value.get_SeveralCharts());
menuChartEditSeparator.setVisible(me.menuChartEdit.isVisible());
me.menuOriginalSize.setDisabled(islocked || value.imgProps.value.get_ImageUrl()===null || value.imgProps.value.get_ImageUrl()===undefined);
me.menuImageAdvanced.setDisabled(islocked);
me.menuImageAlign.setDisabled( islocked || (wrapping == Asc.c_oAscWrapStyle2.Inline) );
@ -755,7 +751,6 @@ define([
var canEditPoints = me.api && me.api.asc_canEditGeometry();
me.menuImgEditPoints.setVisible(canEditPoints);
menuImgEditPointsSeparator.setVisible(canEditPoints);
canEditPoints && me.menuImgEditPoints.setDisabled(islocked);
},
items: [
@ -773,8 +768,6 @@ define([
me.menuImgRemoveControl,
me.menuImgControlSettings,
menuImgControlSeparator,
me.menuImgEditPoints,
menuImgEditPointsSeparator,
me.menuImageArrange,
me.menuImageAlign,
me.menuImageWrap,
@ -782,11 +775,13 @@ define([
{ caption: '--' },
me.menuInsertCaption,
menuInsertCaptionSeparator,
me.menuSaveAsPicture,
menuSaveAsPictureSeparator,
me.menuImgCrop,
me.menuOriginalSize,
me.menuImgReplace,
me.menuChartEdit,
menuChartEditSeparator,
me.menuImgEditPoints,
me.menuImageAdvanced
]
}).on('hide:after', function(menu, e, isFromInputControl) {
@ -3149,6 +3144,7 @@ define([
textCells: 'Cells',
textSeveral: 'Several Rows/Columns',
txtInsertCaption: 'Insert Caption',
textSaveAsPicture: 'Save as picture',
txtEmpty: '(Empty)',
textFromStorage: 'From Storage',
advancedDropCapText: 'Drop Cap Settings',

View file

@ -1835,6 +1835,7 @@
"DE.Views.DocumentHolder.txtInsertArgBefore": "Insert argument before",
"DE.Views.DocumentHolder.txtInsertBreak": "Insert manual break",
"DE.Views.DocumentHolder.txtInsertCaption": "Insert caption",
"DE.Views.DocumentHolder.textSaveAsPicture": "Save as picture",
"DE.Views.DocumentHolder.txtInsertEqAfter": "Insert equation after",
"DE.Views.DocumentHolder.txtInsertEqBefore": "Insert equation before",
"DE.Views.DocumentHolder.txtKeepTextOnly": "Keep text only",

View file

@ -1835,6 +1835,7 @@
"DE.Views.DocumentHolder.txtInsertArgBefore": "Вставить аргумент перед",
"DE.Views.DocumentHolder.txtInsertBreak": "Вставить принудительный разрыв",
"DE.Views.DocumentHolder.txtInsertCaption": "Вставить название",
"DE.Views.DocumentHolder.textSaveAsPicture": "Сохранить как рисунок",
"DE.Views.DocumentHolder.txtInsertEqAfter": "Вставить уравнение после",
"DE.Views.DocumentHolder.txtInsertEqBefore": "Вставить уравнение перед",
"DE.Views.DocumentHolder.txtKeepTextOnly": "Сохранить только текст",

View file

@ -374,7 +374,8 @@ define([
view.menuRemoveHyperlinkPara.on('click', _.bind(me.removeHyperlink, me));
view.menuRemoveHyperlinkTable.on('click', _.bind(me.removeHyperlink, me));
view.menuChartEdit.on('click', _.bind(me.editChartClick, me, undefined));
view.menuSaveAsPicture.on('click', _.bind(me.saveAsPicture, me));
view.menuImgSaveAsPicture.on('click', _.bind(me.saveAsPicture, me));
view.menuTableSaveAsPicture.on('click', _.bind(me.saveAsPicture, me));
view.menuAddCommentPara.on('click', _.bind(me.addComment, me));
view.menuAddCommentTable.on('click', _.bind(me.addComment, me));
view.menuAddCommentImg.on('click', _.bind(me.addComment, me));
@ -432,7 +433,7 @@ define([
view.mnuGuides.menu.on('item:click', _.bind(me.onGuidesClick, me));
view.mnuGridlines.menu.on('item:click', _.bind(me.onGridlinesClick, me));
view.mnuRulers.on('click', _.bind(me.onRulersClick, me));
view.menuTableEquation.menu.on('item:click', _.bind(me.convertEquation, me));
view.menuTableEquationSettings.menu.on('item:click', _.bind(me.convertEquation, me));
view.menuParagraphEquation.menu.on('item:click', _.bind(me.convertEquation, me));
},

View file

@ -1249,6 +1249,14 @@ define([
})
});
me.menuTableSaveAsPicture = new Common.UI.MenuItem({
caption : me.textSaveAsPicture
});
var menuTableSaveAsPictureSeparator = new Common.UI.MenuItem({
caption : '--'
});
me.menuTableDistRows = new Common.UI.MenuItem({
caption : me.textDistributeRows
});
@ -1465,6 +1473,10 @@ define([
caption : me.advancedTableText
});
var menuTableSettingsSeparator = new Common.UI.MenuItem({
caption : '--'
});
me.menuImageAdvanced = new Common.UI.MenuItem({
iconCls: 'menu__icon btn-menu-image',
caption : me.advancedImageText
@ -1485,6 +1497,10 @@ define([
caption : me.advancedChartText
});
var menuAdvancedSettingsSeparator = new Common.UI.MenuItem({
caption : '--'
});
var menuCommentParaSeparator = new Common.UI.MenuItem({
caption : '--'
});
@ -1805,11 +1821,11 @@ define([
})
});
me.menuSaveAsPicture = new Common.UI.MenuItem({
me.menuImgSaveAsPicture = new Common.UI.MenuItem({
caption : me.textSaveAsPicture
});
var menuSaveAsPictureSeparator = new Common.UI.MenuItem({
var menuImgSaveAsPictureSeparator = new Common.UI.MenuItem({
caption : '--'
});
@ -1900,7 +1916,11 @@ define([
caption : '--'
});
var menuEquationSeparatorInTable = new Common.UI.MenuItem({
var menuTableEquationSeparator = new Common.UI.MenuItem({
caption : '--'
});
var menuTableEquationSettingsSeparator = new Common.UI.MenuItem({
caption : '--'
});
@ -1909,7 +1929,7 @@ define([
menu : me.createEquationMenu('popupparaeqinput', 'tl-tr')
});
me.menuTableEquation = new Common.UI.MenuItem({
me.menuTableEquationSettings = new Common.UI.MenuItem({
caption : me.advancedEquationText,
menu : me.createEquationMenu('popuptableeqinput', 'tl-tr')
});
@ -1922,10 +1942,6 @@ define([
caption: me.textEditPoints
});
var menuImgEditPointsSeparator = new Common.UI.MenuItem({
caption : '--'
});
me.textMenu = new Common.UI.Menu({
cls: 'shifted-right',
initMenu: function(value){
@ -2101,7 +2117,7 @@ define([
return;
var isEquation= (value.mathProps && value.mathProps.value);
for (var i = 6; i < 19; i++) {
for (var i = 6; i < 18; i++) {
me.tableMenu.items[i].setVisible(!isEquation);
}
@ -2136,7 +2152,13 @@ define([
me.tableMenu.items[8].setDisabled(value.tableProps.locked || disabled);
me.menuTableCellAlign.setDisabled(value.tableProps.locked || disabled);
me.menuTableSaveAsPicture.setVisible(!isEquation);
menuTableSaveAsPictureSeparator.setVisible(!isEquation);
me.menuTableAdvanced.setVisible(!isEquation);
me.menuTableAdvanced.setDisabled(value.tableProps.locked || disabled);
menuTableSettingsSeparator.setVisible(me.menuTableAdvanced.isVisible());
var cancopy = me.api && me.api.can_CopyCut();
me.menuTableCopy.setDisabled(!cancopy);
@ -2152,6 +2174,7 @@ define([
me.menuAddHyperlinkTable.setVisible(!_.isUndefined(value.paraProps) && _.isUndefined(value.hyperProps) && text!==false);
menuHyperlinkTable.setVisible(!_.isUndefined(value.paraProps) && !_.isUndefined(value.hyperProps));
menuHyperlinkSeparator.setVisible(me.menuAddHyperlinkTable.isVisible() || menuHyperlinkTable.isVisible());
me.menuEditHyperlinkTable.hyperProps = value.hyperProps;
@ -2169,8 +2192,8 @@ define([
/** coauthoring begin **/
me.menuAddCommentTable.setVisible(me.api.can_AddQuotedComment()!==false && me.mode.canCoAuthoring && me.mode.canComments);
me.menuAddCommentTable.setDisabled(!_.isUndefined(value.paraProps) && value.paraProps.locked || disabled);
menuHyperlinkSeparator.setVisible(menuHyperlinkSeparator.isVisible() || me.menuAddCommentTable.isVisible());
/** coauthoring end **/
menuHyperlinkSeparator.setVisible(me.menuAddHyperlinkTable.isVisible() || menuHyperlinkTable.isVisible() /** coauthoring begin **/|| me.menuAddCommentTable.isVisible()/** coauthoring end **/);
me.menuSpellCheckTable.setVisible(value.spellProps!==undefined && value.spellProps.value.get_Checked()===false);
me.menuToDictionaryTable.setVisible(me.mode.isDesktopApp);
@ -2194,47 +2217,52 @@ define([
var eqlen = 0;
if (isEquation) {
eqlen = me.addEquationMenu(false, 6);
menuHyperlinkSeparator.setVisible(menuHyperlinkSeparator.isVisible() && eqlen>0);
} else
me.clearEquationMenu(false, 6);
me.menuTableEquation.setVisible(isEquation);
me.menuTableEquation.setDisabled(disabled);
menuTableEquationSeparator.setVisible(eqlen>0);
me.menuTableEquationSettings.setVisible(isEquation);
menuTableEquationSettingsSeparator.setVisible(isEquation);
me.menuTableEquationSettings.setDisabled(disabled);
if (isEquation) {
var eq = me.api.asc_GetMathInputType();
me.menuTableEquation.menu.items[0].setChecked(eq===Asc.c_oAscMathInputType.Unicode);
me.menuTableEquation.menu.items[1].setChecked(eq===Asc.c_oAscMathInputType.LaTeX);
me.menuTableEquationSettings.menu.items[0].setChecked(eq===Asc.c_oAscMathInputType.Unicode);
me.menuTableEquationSettings.menu.items[1].setChecked(eq===Asc.c_oAscMathInputType.LaTeX);
}
},
items: [
me.menuSpellCheckTable,
menuSpellcheckTableSeparator,
me.menuTableCut,
me.menuTableCopy,
me.menuTablePaste,
{ caption: '--' },
me.menuTableSelectText,
me.menuTableInsertText,
me.menuTableDeleteText,
{ caption: '--' },
me.mnuTableMerge,
me.mnuTableSplit,
{ caption: '--' },
me.menuTableDistRows,
me.menuTableDistCols,
{ caption: '--' },
me.menuTableCellAlign,
{ caption: '--' },
me.menuTableAdvanced,
menuHyperlinkSeparator,
me.menuSpellCheckTable, //0
menuSpellcheckTableSeparator, //1
me.menuTableCut, //2
me.menuTableCopy, //3
me.menuTablePaste, //4
{ caption: '--' }, //5
me.menuTableSelectText, //6
me.menuTableInsertText, //7
me.menuTableDeleteText, //8
{ caption: '--' }, //9
me.mnuTableMerge, //10
me.mnuTableSplit, //11
{ caption: '--' }, //12
me.menuTableDistRows, //13
me.menuTableDistCols, //14
{ caption: '--' }, //15
me.menuTableCellAlign, //16
{ caption: '--'}, //17
menuTableEquationSeparator, //18
me.menuTableSaveAsPicture, //19
menuTableSaveAsPictureSeparator,//20
me.menuTableAdvanced, //21
menuTableSettingsSeparator, //22
me.menuTableEquationSettings, //23
menuTableEquationSettingsSeparator, //24
/** coauthoring begin **/
me.menuAddCommentTable,
me.menuTableEquation,
me.menuAddCommentTable, //25
/** coauthoring end **/
me.menuAddHyperlinkTable,
menuHyperlinkTable,
{ caption: '--' },
me.menuAddToLayoutTable
me.menuAddHyperlinkTable, //26
menuHyperlinkTable, //27
menuHyperlinkSeparator, //28
me.menuAddToLayoutTable //29
]
}).on('hide:after', function(menu, e, isFromInputControl) {
if (me.suppressEditComplete) {
@ -2291,7 +2319,6 @@ define([
var canEditPoints = me.api && me.api.asc_canEditGeometry();
me.menuImgEditPoints.setVisible(canEditPoints);
menuImgEditPointsSeparator.setVisible(canEditPoints);
canEditPoints && me.menuImgEditPoints.setDisabled(disabled);
me.menuImageAdvanced.setVisible(isimage);
@ -2299,6 +2326,12 @@ define([
me.menuChartEdit.setVisible(_.isUndefined(value.imgProps) && !_.isUndefined(value.chartProps) && (_.isUndefined(value.shapeProps) || value.shapeProps.isChart));
me.menuChartAdvanced.setVisible(_.isUndefined(value.imgProps) && !_.isUndefined(value.chartProps) && (_.isUndefined(value.shapeProps) || value.shapeProps.isChart));
menuImgShapeSeparator.setVisible(me.menuImageAdvanced.isVisible() || me.menuShapeAdvanced.isVisible() || me.menuChartEdit.isVisible() || me.menuChartAdvanced.isVisible());
menuAdvancedSettingsSeparator.setVisible(
me.menuImgCrop.isVisible() || me.menuImgOriginalSize.isVisible() ||
me.menuImgReplace.isVisible() || me.menuImageAdvanced.isVisible() ||
me.menuImgEditPoints.isVisible() || me.menuShapeAdvanced.isVisible() ||
me.menuChartEdit.isVisible() || me.menuChartAdvanced.isVisible()
);
/** coauthoring begin **/
me.menuAddCommentImg.setVisible(me.api.can_AddQuotedComment()!==false && me.mode.canCoAuthoring && me.mode.canComments);
@ -2318,39 +2351,38 @@ define([
if (me.menuChartEdit.isVisible())
me.menuChartEdit.setDisabled(disabled);
var cancopy = me.api && me.api.can_CopyCut();
me.menuImgCopy.setDisabled(!cancopy);
me.menuImgCut.setDisabled(disabled || !cancopy);
me.menuImgPaste.setDisabled(disabled);
menuImgShapeArrange.setDisabled(disabled);
me.menuSaveAsPicture.setDisabled(disabled);
me.menuAddToLayoutImg.setDisabled(disabled);
},
items: [
me.menuImgCut,
me.menuImgCopy,
me.menuImgPaste,
{ caption: '--' },
me.menuImgEditPoints,
menuImgEditPointsSeparator,
{ caption: '--' }, //Separator
menuImgShapeArrange,
me.menuImgShapeAlign,
me.menuImgShapeRotate,
menuImgShapeSeparator,
menuImgShapeSeparator, //Separator
me.menuImgSaveAsPicture,
menuImgSaveAsPictureSeparator, //Separator
me.menuImgCrop,
me.menuImgOriginalSize,
me.menuImgReplace,
me.menuImageAdvanced,
me.menuShapeAdvanced
,me.menuChartEdit
,me.menuChartAdvanced
,menuSaveAsPictureSeparator
,me.menuSaveAsPicture
me.menuImgEditPoints,
me.menuShapeAdvanced,
me.menuChartEdit,
me.menuChartAdvanced,
menuAdvancedSettingsSeparator, //Separator
/** coauthoring begin **/
,menuCommentSeparatorImg,
me.menuAddCommentImg,
menuCommentSeparatorImg, //Separator
/** coauthoring end **/
{ caption: '--' },
me.menuAddToLayoutImg
]
}).on('hide:after', function(menu, e, isFromInputControl) {

View file

@ -264,7 +264,9 @@ define([
view.menuImgMacro.on('click', _.bind(me.onImgMacro, me));
view.menuImgEditPoints.on('click', _.bind(me.onImgEditPoints, me));
view.pmiGetRangeList.on('click', _.bind(me.onGetLink, me));
view.menuParagraphEquation.menu.on('item:click', _.bind(me.convertEquation, me));
view.menuParagraphEquation.menu.on('item:click', _.bind(me.convertEquation, me));
view.menuSaveAsPicture.on('click', _.bind(me.saveAsPicture, me));
if (!me.permissions.isEditMailMerge && !me.permissions.isEditDiagram && !me.permissions.isEditOle) {
var oleEditor = me.getApplication().getController('Common.Controllers.ExternalOleEditor').getView('Common.Views.ExternalOleEditor');
@ -2140,7 +2142,6 @@ define([
var canEditPoints = this.api && this.api.asc_canEditGeometry();
documentHolder.menuImgEditPoints.setVisible(canEditPoints);
documentHolder.menuImgEditPointsSeparator.setVisible(canEditPoints);
canEditPoints && documentHolder.menuImgEditPoints.setDisabled(isObjLocked);
if (showMenu) this.showPopupMenu(documentHolder.imgMenu, {}, event);
@ -4411,6 +4412,12 @@ define([
}
},
saveAsPicture: function() {
if(this.api) {
this.api.asc_SaveDrawingAsPicture();
}
},
getUserName: function(id){
var usersStore = SSE.getCollection('Common.Collections.Users');
if (usersStore){

View file

@ -851,12 +851,14 @@ define([
caption: me.textMacro
});
me.menuImgEditPoints = new Common.UI.MenuItem({
caption: me.textEditPoints
me.menuSaveAsPicture = new Common.UI.MenuItem({
caption : me.textSaveAsPicture
});
me.menuImgEditPointsSeparator = new Common.UI.MenuItem({
caption : '--'
var menuSaveAsPictureSeparator = new Common.UI.MenuItem({ caption: '--'});
me.menuImgEditPoints = new Common.UI.MenuItem({
caption: me.textEditPoints
});
this.imgMenu = new Common.UI.Menu({
@ -870,17 +872,18 @@ define([
me.menuSignatureEditSign,
me.menuSignatureEditSetup,
me.menuEditSignSeparator,
me.menuImgEditPoints,
me.menuImgEditPointsSeparator,
me.menuImageArrange,
me.menuImageAlign,
me.menuImgRotate,
me.menuImgMacro,
menuSaveAsPictureSeparator,
me.menuSaveAsPicture,
me.mnuShapeSeparator,
me.menuImgCrop,
me.mnuChartData,
me.mnuChartType,
me.mnuChartEdit,
me.menuImgEditPoints,
me.mnuShapeAdvanced,
me.menuImgOriginalSize,
me.menuImgReplace,
@ -1366,6 +1369,7 @@ define([
textBullets: 'Bullets',
textNumbering: 'Numbering',
textMacro: 'Assign Macro',
textSaveAsPicture: 'Save as picture',
textEditPoints: 'Edit Points',
tipNumCapitalLetters: 'A. B. C.',
tipNumLettersParentheses: 'a) b) c)',

View file

@ -2184,6 +2184,7 @@
"SSE.Views.DocumentHolder.textFromUrl": "From URL",
"SSE.Views.DocumentHolder.textListSettings": "List Settings",
"SSE.Views.DocumentHolder.textMacro": "Assign Macro",
"SSE.Views.DocumentHolder.textSaveAsPicture": "Save as picture",
"SSE.Views.DocumentHolder.textMax": "Max",
"SSE.Views.DocumentHolder.textMin": "Min",
"SSE.Views.DocumentHolder.textMore": "More functions",

View file

@ -2184,6 +2184,7 @@
"SSE.Views.DocumentHolder.textFromUrl": "По URL",
"SSE.Views.DocumentHolder.textListSettings": "Параметры списка",
"SSE.Views.DocumentHolder.textMacro": "Назначить макрос",
"SSE.Views.DocumentHolder.textSaveAsPicture": "Сохранить как рисунок",
"SSE.Views.DocumentHolder.textMax": "Макс",
"SSE.Views.DocumentHolder.textMin": "Мин",
"SSE.Views.DocumentHolder.textMore": "Другие функции",