Skip to content

Commit

Permalink
Merge branch 'feature/shapes-merge' into fix/merge
Browse files Browse the repository at this point in the history
Bug 58631
  • Loading branch information
JuliaRadzhabova committed Dec 12, 2024
2 parents 3502950 + 2ad4483 commit b075161
Show file tree
Hide file tree
Showing 60 changed files with 558 additions and 16 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions apps/documenteditor/main/app/controller/DocumentHolder.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ define([
view.menuTableInsertText.menu.on('item:click', _.bind(me.tableInsertText, me));
view.menuTableDeleteText.menu.on('item:click', _.bind(me.tableDeleteText, me));
view.menuImageAlign.menu.on('item:click', _.bind(me.onImgAlign, me));
view.menuShapesMerge.menu.on('item:click', _.bind(me.onShapesMerge, me));
view.menuImageArrange.menu.on('item:click', _.bind(me.onImgArrange, me));
view.mnuGroup.on('click', _.bind(me.onImgGroup, me));
view.mnuUnGroup.on('click', _.bind(me.onImgUnGroup, me));
Expand Down Expand Up @@ -2416,6 +2417,15 @@ define([
me.editComplete();
},

onShapesMerge : function(menu, item, e) {
var me = this;
if (item && item.value) {
me.api.asc_mergeSelectedShapes(item.value);
Common.component.Analytics.trackEvent('DocumentHolder', 'Shapes Merge');
}
me.editComplete();
},

onImgArrange: function(menu, item, e) {
var me = this;
if (me.api && item.options.valign!==undefined) {
Expand Down
26 changes: 22 additions & 4 deletions apps/documenteditor/main/app/controller/PageLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ define([
toolbar.btnImgForward.on('click', me.onClickMenuForward.bind(me, 'forward'));
toolbar.btnImgBackward.on('click', me.onClickMenuForward.bind(me, 'backward'));

toolbar.btnShapesMerge.menu.on('item:click', me.onClickMenuShapesMerge.bind(me));
toolbar.btnShapesMerge.menu.on('show:before', me.onBeforeShapesMerge.bind(me));

toolbar.btnsPageBreak.forEach( function(btn) {
var _menu_section_break = btn.menu.items[2].menu;
_menu_section_break.on('item:click', function (menu, item, e) {
Expand Down Expand Up @@ -179,10 +182,11 @@ define([
paraProps = objects[i].get_ObjectValue()
}
}
me.toolbar.lockToolbar(Common.enumLock.noObjectSelected, no_object, {array: [me.toolbar.btnImgAlign, me.toolbar.btnImgGroup, me.toolbar.btnImgWrapping, me.toolbar.btnImgForward, me.toolbar.btnImgBackward]});
me.toolbar.lockToolbar(Common.enumLock.imageLock, islocked, {array: [me.toolbar.btnImgAlign, me.toolbar.btnImgGroup, me.toolbar.btnImgWrapping]});
me.toolbar.lockToolbar(Common.enumLock.contentLock, content_locked, {array: [me.toolbar.btnImgAlign, me.toolbar.btnImgGroup, me.toolbar.btnImgWrapping, me.toolbar.btnImgForward, me.toolbar.btnImgBackward]});
me.toolbar.lockToolbar(Common.enumLock.inImageInline, wrapping == Asc.c_oAscWrapStyle2.Inline, {array: [me.toolbar.btnImgAlign, me.toolbar.btnImgGroup]});
me.toolbar.lockToolbar(Common.enumLock.cantMergeShape, !me.api.asc_canMergeSelectedShapes(), { array: [me.toolbar.btnShapesMerge] });
me.toolbar.lockToolbar(Common.enumLock.noObjectSelected, no_object, {array: [me.toolbar.btnImgAlign, me.toolbar.btnImgGroup, me.toolbar.btnImgWrapping, me.toolbar.btnImgForward, me.toolbar.btnImgBackward, me.toolbar.btnShapesMerge]});
me.toolbar.lockToolbar(Common.enumLock.imageLock, islocked, {array: [me.toolbar.btnImgAlign, me.toolbar.btnImgGroup, me.toolbar.btnImgWrapping, me.toolbar.btnShapesMerge]});
me.toolbar.lockToolbar(Common.enumLock.contentLock, content_locked, {array: [me.toolbar.btnImgAlign, me.toolbar.btnImgGroup, me.toolbar.btnImgWrapping, me.toolbar.btnImgForward, me.toolbar.btnImgBackward, me.toolbar.btnShapesMerge]});
me.toolbar.lockToolbar(Common.enumLock.inImageInline, wrapping == Asc.c_oAscWrapStyle2.Inline, {array: [me.toolbar.btnImgAlign, me.toolbar.btnImgGroup, me.toolbar.btnShapesMerge]});
me.toolbar.lockToolbar(Common.enumLock.inSmartartInternal, shapeProps && shapeProps.asc_getFromSmartArtInternal(), {array: [me.toolbar.btnImgForward, me.toolbar.btnImgBackward]});
me.toolbar.lockToolbar(Common.enumLock.cantGroup, !canGroupUngroup, {array: [me.toolbar.btnImgGroup]});
me.toolbar.lockToolbar(Common.enumLock.cantWrap, disable.wrapping, {array: [me.toolbar.btnImgWrapping]});
Expand Down Expand Up @@ -222,6 +226,20 @@ define([
this.toolbar.fireEvent('editcomplete', this.toolbar);
},

onBeforeShapesMerge: function() {
this.toolbar.btnShapesMerge.menu.items.forEach(function (item) {
item.setDisabled(!this.api.asc_canMergeSelectedShapes(item.value));
}, this);
},

onClickMenuShapesMerge: function (menu, item, e) {
if (item && item.value) {
this.api.asc_mergeSelectedShapes(item.value);
Common.component.Analytics.trackEvent('ToolBar', 'Shapes Merge');
}
this.toolbar.fireEvent('editcomplete', this.toolbar);
},

onClickMenuWrapping: function (menu, item, e) {
if (item.options.wrapType=='edit') {
this.api.StartChangeWrapPolygon();
Expand Down
1 change: 1 addition & 0 deletions apps/documenteditor/main/app/template/Toolbar.template
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
<span class="btn-slot text x-huge" id="slot-img-movebkwd"></span>
<span class="btn-slot text x-huge" id="slot-img-align"></span>
<span class="btn-slot text x-huge" id="slot-img-group"></span>
<span class="btn-slot text x-huge" id="slot-shapes-merge"></span>
</div>
<div class="separator long"></div>
<div class="group">
Expand Down
46 changes: 46 additions & 0 deletions apps/documenteditor/main/app/view/DocumentHolderExt.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,45 @@ define([], function () {
})
});

var _toolbar_view = DE.getController('Toolbar').getView();
me.menuShapesMerge = new Common.UI.MenuItem({
iconCls: 'menu__icon btn-combine-shapes',
caption : me.textShapesMerge,
menu : new Common.UI.Menu({
cls: 'ppm-toolbar shifted-right',
menuAlign: 'tl-tr',
items: [
new Common.UI.MenuItem({
caption : _toolbar_view.textShapesUnion,
iconCls : 'menu__icon btn-union-shapes',
value : 'unite',
}),
new Common.UI.MenuItem({
caption : _toolbar_view.textShapesCombine,
iconCls : 'menu__icon btn-combine-shapes',
value : 'exclude',
}),
new Common.UI.MenuItem({
caption : _toolbar_view.textShapesFragment,
iconCls : 'menu__icon btn-fragment-shapes',
value : 'divide',
}),
new Common.UI.MenuItem({
caption : _toolbar_view.textShapesIntersect,
iconCls : 'menu__icon btn-intersect-shapes',
value : 'intersect',
}),
new Common.UI.MenuItem({
caption : _toolbar_view.textShapesSubstract,
iconCls : 'menu__icon btn-substract-shapes',
value : 'subtract',
})
]
})
});



me.mnuGroup = new Common.UI.MenuItem({
caption : this.txtGroup,
iconCls : 'menu__icon btn-shape-group'
Expand Down Expand Up @@ -513,6 +552,12 @@ define([], function () {
me.menuImageAlign.menu.items[7].setDisabled(objcount==2 && (!alignto || alignto==3));
me.menuImageAlign.menu.items[8].setDisabled(objcount==2 && (!alignto || alignto==3));
}
me.menuShapesMerge.setDisabled(islocked || !me.api.asc_canMergeSelectedShapes());
if (!me.menuShapesMerge.isDisabled()) {
me.menuShapesMerge.menu.items.forEach(function (item) {
item.setDisabled(!me.api.asc_canMergeSelectedShapes(item.value));
});
}
me.menuImageArrange.setDisabled( (wrapping == Asc.c_oAscWrapStyle2.Inline) && !value.imgProps.value.get_FromGroup() || content_locked ||
(me.api && !me.api.CanUnGroup() && !me.api.CanGroup() && value.imgProps.isSmartArtInternal));
me.menuImageArrange.menu.items[0].setDisabled(value.imgProps.isSmartArtInternal);
Expand Down Expand Up @@ -575,6 +620,7 @@ define([], function () {
menuImgControlSeparator,
me.menuImageArrange,
me.menuImageAlign,
me.menuShapesMerge,
me.menuImageWrap,
me.menuImgRotate,
{ caption: '--' },
Expand Down
53 changes: 50 additions & 3 deletions apps/documenteditor/main/app/view/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ define([
fixedForm: 'fixed-form',
fileMenuOpened: 'file-menu-opened',
changeModeLock: 'change-mode-lock',
noStyles: 'no-styles'
noStyles: 'no-styles',
cantMergeShape: 'merge-shape-lock'
};
for (var key in enumLock) {
if (enumLock.hasOwnProperty(key)) {
Expand Down Expand Up @@ -1561,6 +1562,19 @@ define([
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});

me.btnShapesMerge = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-merge-shapes',
lock: [_set.imageLock, _set.contentLock, _set.noObjectSelected, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockForms, _set.docLockComments, _set.viewMode, _set.cantMergeShape],
caption: me.capShapesMerge,
menu: true,
action: 'shapes-merge',
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});

me.btnImgForward = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-img-frwd',
Expand Down Expand Up @@ -1643,7 +1657,7 @@ define([
});

me.toolbarControls.push(me.btnImgAlign,
me.btnImgGroup, me.btnImgForward, me.btnImgBackward, me.btnImgWrapping, me.btnWatermark, me.btnPageColor);
me.btnImgGroup, me.btnImgForward, me.btnImgBackward, me.btnImgWrapping, me.btnWatermark, me.btnPageColor, me.btnShapesMerge);

//
// Menus
Expand Down Expand Up @@ -2112,10 +2126,11 @@ define([
_injectComponent('#slot-btn-paracolor', this.btnParagraphColor);
_injectComponent('#slot-field-styles', this.listStyles);
_injectComponent('#slot-img-align', this.btnImgAlign);
_injectComponent('#slot-img-group', this.btnImgGroup);
_injectComponent('#slot-img-group', this.btnImgGroup);
_injectComponent('#slot-img-movefrwd', this.btnImgForward);
_injectComponent('#slot-img-movebkwd', this.btnImgBackward);
_injectComponent('#slot-img-wrapping', this.btnImgWrapping);
_injectComponent('#slot-shapes-merge', this.btnShapesMerge);
_injectComponent('#slot-btn-watermark', this.btnWatermark);
_injectComponent('#slot-btn-hyphenation', this.btnHyphenation);
_injectComponent('#slot-spin-ind-left', this.numIndentsLeft);
Expand Down Expand Up @@ -2364,6 +2379,38 @@ define([
]
}));

me.btnShapesMerge.updateHint(me.tipShapesMerge);
me.btnShapesMerge.setMenu(new Common.UI.Menu({
cls: 'shifted-right',
items: [
{
caption: me.textShapesUnion,
iconCls: 'menu__icon btn-union-shapes',
value: 'unite',
},
{
caption: me.textShapesCombine,
iconCls: 'menu__icon btn-combine-shapes',
value: 'exclude',
},
{
caption: me.textShapesFragment,
iconCls: 'menu__icon btn-fragment-shapes',
value: 'divide',
},
{
caption: me.textShapesIntersect,
iconCls: 'menu__icon btn-intersect-shapes',
value: 'intersect',
},
{
caption: me.textShapesSubstract,
iconCls: 'menu__icon btn-substract-shapes',
value: 'subtract',
},
]
}));

me.btnImgGroup.updateHint(me.tipImgGroup);
me.btnImgGroup.setMenu(new Common.UI.Menu({
items: [{
Expand Down
8 changes: 8 additions & 0 deletions apps/documenteditor/main/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1951,6 +1951,7 @@
"DE.Views.DocumentHolder.tableText": "Table",
"DE.Views.DocumentHolder.textAccept": "Accept change",
"DE.Views.DocumentHolder.textAlign": "Align",
"DE.Views.DocumentHolder.textShapesMerge": "Merge shapes",
"DE.Views.DocumentHolder.textArrange": "Arrange",
"DE.Views.DocumentHolder.textArrangeBack": "Send to background",
"DE.Views.DocumentHolder.textArrangeBackward": "Send backward",
Expand Down Expand Up @@ -3397,6 +3398,7 @@
"DE.Views.Toolbar.capImgBackward": "Send Backward",
"DE.Views.Toolbar.capImgForward": "Bring Forward",
"DE.Views.Toolbar.capImgGroup": "Group",
"DE.Views.Toolbar.capShapesMerge": "Merge Shapes",
"DE.Views.Toolbar.capImgWrapping": "Wrapping",
"DE.Views.Toolbar.mniCapitalizeWords": "Capitalize Each Word",
"DE.Views.Toolbar.mniCustomTable": "Insert custom table",
Expand Down Expand Up @@ -3540,6 +3542,11 @@
"DE.Views.Toolbar.textTradeMark": "Trade Mark Sign",
"DE.Views.Toolbar.textUnderline": "Underline",
"DE.Views.Toolbar.textYen": "Yen Sign",
"DE.Views.Toolbar.textShapesUnion": "Union",
"DE.Views.Toolbar.textShapesCombine": "Combine",
"DE.Views.Toolbar.textShapesFragment": "Fragment",
"DE.Views.Toolbar.textShapesIntersect": "Intersect",
"DE.Views.Toolbar.textShapesSubstract": "Substract",
"DE.Views.Toolbar.tipAlignCenter": "Align center",
"DE.Views.Toolbar.tipAlignJust": "Justified",
"DE.Views.Toolbar.tipAlignLeft": "Align left",
Expand Down Expand Up @@ -3570,6 +3577,7 @@
"DE.Views.Toolbar.tipHyphenation": "Change hyphenation",
"DE.Views.Toolbar.tipImgAlign": "Align objects",
"DE.Views.Toolbar.tipImgGroup": "Group objects",
"DE.Views.Toolbar.tipShapesMerge": "Merge shapes",
"DE.Views.Toolbar.tipImgWrapping": "Wrap text",
"DE.Views.Toolbar.tipIncFont": "Increment font size",
"DE.Views.Toolbar.tipIncPrLeft": "Increase indent",
Expand Down
Loading

0 comments on commit b075161

Please sign in to comment.