diff --git a/apps/common/mobile/resources/img/shapes/shape-01.svg b/apps/common/mobile/resources/img/shapes/shape-01.svg new file mode 100644 index 000000000..13cfaf42f --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-01.svg @@ -0,0 +1,11 @@ + + + diff --git a/apps/common/mobile/resources/img/shapes/shape-02.svg b/apps/common/mobile/resources/img/shapes/shape-02.svg new file mode 100644 index 000000000..f51177cf9 --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-02.svg @@ -0,0 +1,9 @@ + + + diff --git a/apps/common/mobile/resources/img/shapes/shape-03.svg b/apps/common/mobile/resources/img/shapes/shape-03.svg new file mode 100644 index 000000000..0f8f54f9f --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-03.svg @@ -0,0 +1,11 @@ + + + diff --git a/apps/common/mobile/resources/img/shapes/shape-04.svg b/apps/common/mobile/resources/img/shapes/shape-04.svg new file mode 100644 index 000000000..5fad06de9 --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-04.svg @@ -0,0 +1,12 @@ + + + diff --git a/apps/common/mobile/resources/img/shapes/shape-05.svg b/apps/common/mobile/resources/img/shapes/shape-05.svg new file mode 100644 index 000000000..c6bf7893f --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-05.svg @@ -0,0 +1,9 @@ + + + diff --git a/apps/common/mobile/resources/img/shapes/shape-06.svg b/apps/common/mobile/resources/img/shapes/shape-06.svg new file mode 100644 index 000000000..b081f5b0f --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-06.svg @@ -0,0 +1,9 @@ + + + diff --git a/apps/common/mobile/resources/img/shapes/shape-07.svg b/apps/common/mobile/resources/img/shapes/shape-07.svg new file mode 100644 index 000000000..e2b7398a5 --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-07.svg @@ -0,0 +1,9 @@ + + + diff --git a/apps/common/mobile/resources/img/shapes/shape-08.svg b/apps/common/mobile/resources/img/shapes/shape-08.svg new file mode 100644 index 000000000..4156f446c --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-08.svg @@ -0,0 +1,9 @@ + + + diff --git a/apps/common/mobile/resources/img/shapes/shape-09.svg b/apps/common/mobile/resources/img/shapes/shape-09.svg new file mode 100644 index 000000000..92fe894d9 --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-09.svg @@ -0,0 +1,9 @@ + + + diff --git a/apps/common/mobile/resources/img/shapes/shape-10.svg b/apps/common/mobile/resources/img/shapes/shape-10.svg new file mode 100644 index 000000000..16a0ba509 --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-10.svg @@ -0,0 +1,9 @@ + + + diff --git a/apps/common/mobile/resources/img/shapes/shape-11.svg b/apps/common/mobile/resources/img/shapes/shape-11.svg new file mode 100644 index 000000000..da12ca41c --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-11.svg @@ -0,0 +1,9 @@ + + + diff --git a/apps/common/mobile/resources/img/shapes/shape-12.svg b/apps/common/mobile/resources/img/shapes/shape-12.svg new file mode 100644 index 000000000..d322fa71f --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-12.svg @@ -0,0 +1,9 @@ + + + diff --git a/apps/common/mobile/resources/img/shapes/shape-13.svg b/apps/common/mobile/resources/img/shapes/shape-13.svg new file mode 100644 index 000000000..592ca104e --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-13.svg @@ -0,0 +1,9 @@ + + + diff --git a/apps/common/mobile/resources/img/shapes/shape-14.svg b/apps/common/mobile/resources/img/shapes/shape-14.svg new file mode 100644 index 000000000..62ea20419 --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-14.svg @@ -0,0 +1,9 @@ + + + diff --git a/apps/common/mobile/resources/img/shapes/shape-15.svg b/apps/common/mobile/resources/img/shapes/shape-15.svg new file mode 100644 index 000000000..630a50d74 --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-15.svg @@ -0,0 +1,8 @@ + + + diff --git a/apps/common/mobile/resources/img/shapes/shape-16.svg b/apps/common/mobile/resources/img/shapes/shape-16.svg new file mode 100644 index 000000000..03a3400ae --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-16.svg @@ -0,0 +1,8 @@ + + + diff --git a/apps/common/mobile/resources/img/shapes/shape-17.svg b/apps/common/mobile/resources/img/shapes/shape-17.svg new file mode 100644 index 000000000..98a2704a0 --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-17.svg @@ -0,0 +1,9 @@ + + + diff --git a/apps/common/mobile/resources/img/shapes/shape-18.svg b/apps/common/mobile/resources/img/shapes/shape-18.svg new file mode 100644 index 000000000..33d272bbc --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-18.svg @@ -0,0 +1,7 @@ + + + diff --git a/apps/common/mobile/resources/img/shapes/shape-19.svg b/apps/common/mobile/resources/img/shapes/shape-19.svg new file mode 100644 index 000000000..78525ff8d --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-19.svg @@ -0,0 +1,9 @@ + + + diff --git a/apps/common/mobile/resources/img/shapes/shape-20.svg b/apps/common/mobile/resources/img/shapes/shape-20.svg new file mode 100644 index 000000000..0eeb8fa9b --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-20.svg @@ -0,0 +1,12 @@ + + + diff --git a/apps/common/mobile/resources/img/shapes/shape-21.svg b/apps/common/mobile/resources/img/shapes/shape-21.svg new file mode 100644 index 000000000..49a14666d --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-21.svg @@ -0,0 +1,9 @@ + + + diff --git a/apps/common/mobile/resources/img/shapes/shape-22.svg b/apps/common/mobile/resources/img/shapes/shape-22.svg new file mode 100644 index 000000000..8e71ed33e --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-22.svg @@ -0,0 +1,9 @@ + + + diff --git a/apps/common/mobile/resources/img/shapes/shape-23.svg b/apps/common/mobile/resources/img/shapes/shape-23.svg new file mode 100644 index 000000000..bead67aad --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-23.svg @@ -0,0 +1,13 @@ + + + diff --git a/apps/common/mobile/resources/img/shapes/shape-24.svg b/apps/common/mobile/resources/img/shapes/shape-24.svg new file mode 100644 index 000000000..cd3d00b13 --- /dev/null +++ b/apps/common/mobile/resources/img/shapes/shape-24.svg @@ -0,0 +1,12 @@ + + + diff --git a/apps/spreadsheeteditor/mobile/app-dev.js b/apps/spreadsheeteditor/mobile/app-dev.js index 9bf929fc5..54891f3a8 100644 --- a/apps/spreadsheeteditor/mobile/app-dev.js +++ b/apps/spreadsheeteditor/mobile/app-dev.js @@ -132,7 +132,7 @@ require([ // ,'EditHyperlink' ,'AddContainer' // ,'AddTable' - // ,'AddShape' + ,'AddShape' // ,'AddImage' // ,'AddOther' ] @@ -192,7 +192,7 @@ require([ , 'spreadsheeteditor/mobile/app/controller/CellEditor' , 'spreadsheeteditor/mobile/app/controller/Statusbar' , 'spreadsheeteditor/mobile/app/controller/Settings' - ,'spreadsheeteditor/mobile/app/controller/edit/EditContainer' + , 'spreadsheeteditor/mobile/app/controller/edit/EditContainer' // ,'spreadsheeteditor/mobile/app/controller/edit/EditText' // ,'spreadsheeteditor/mobile/app/controller/edit/EditParagraph' // ,'spreadsheeteditor/mobile/app/controller/edit/EditTable' @@ -202,7 +202,7 @@ require([ // ,'spreadsheeteditor/mobile/app/controller/edit/EditHyperlink' ,'spreadsheeteditor/mobile/app/controller/add/AddContainer' // ,'spreadsheeteditor/mobile/app/controller/add/AddTable' - // ,'spreadsheeteditor/mobile/app/controller/add/AddShape' + ,'spreadsheeteditor/mobile/app/controller/add/AddShape' // ,'spreadsheeteditor/mobile/app/controller/add/AddImage' // ,'spreadsheeteditor/mobile/app/controller/add/AddOther' ], function() { diff --git a/apps/spreadsheeteditor/mobile/app/controller/add/AddContainer.js b/apps/spreadsheeteditor/mobile/app/controller/add/AddContainer.js index 4ea25f073..f9d61dd40 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/add/AddContainer.js +++ b/apps/spreadsheeteditor/mobile/app/controller/add/AddContainer.js @@ -121,7 +121,7 @@ define([ addViews.push({ caption: me.textShape, id: 'add-shape', - layout: me._dummyEditController().getLayout() + layout: SSE.getController('AddShape').getView('AddShape').rootLayout() }); addViews.push({ diff --git a/apps/spreadsheeteditor/mobile/app/controller/add/AddShape.js b/apps/spreadsheeteditor/mobile/app/controller/add/AddShape.js new file mode 100644 index 000000000..d2908f132 --- /dev/null +++ b/apps/spreadsheeteditor/mobile/app/controller/add/AddShape.js @@ -0,0 +1,231 @@ +/* + * + * (c) Copyright Ascensio System Limited 2010-2016 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, + * EU, LV-1021. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ + +/** + * AddShape.js + * Document Editor + * + * Created by Maxim Kadushkin on 12/07/2016 + * Copyright (c) 2016 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'core', + 'spreadsheeteditor/mobile/app/view/add/AddShape' +], function (core) { + 'use strict'; + + SSE.Controllers.AddShape = Backbone.Controller.extend(_.extend((function() { + var _styles = []; + + return { + models: [], + collections: [], + views: [ + 'AddShape' + ], + + initialize: function () { + Common.NotificationCenter.on('addcontainer:show', _.bind(this.initEvents, this)); + + // Fill shapes + + function randomColor() { + return '#' + Math.floor(Math.random()*16777215).toString(16); + } + + _styles = [ + { + title: 'Text', + thumb: 'shape-01.svg', + type: 'textRect' + }, + { + title: 'Line', + thumb: 'shape-02.svg', + type: 'line' + }, + { + title: 'Line with arrow', + thumb: 'shape-03.svg', + type: 'lineWithArrow' + }, + { + title: 'Line with two arrows', + thumb: 'shape-04.svg', + type: 'lineWithTwoArrows' + }, + { + title: 'Rect', + thumb: 'shape-05.svg', + type: 'rect' + }, + { + title: 'Hexagon', + thumb: 'shape-06.svg', + type: 'hexagon' + }, + { + title: 'Round rect', + thumb: 'shape-07.svg', + type: 'roundRect' + }, + { + title: 'Ellipse', + thumb: 'shape-08.svg', + type: 'ellipse' + }, + { + title: 'Triangle', + thumb: 'shape-09.svg', + type: 'triangle' + }, + { + title: 'Triangle', + thumb: 'shape-10.svg', + type: 'rtTriangle' + }, + { + title: 'Trapezoid', + thumb: 'shape-11.svg', + type: 'trapezoid' + }, + { + title: 'Diamond', + thumb: 'shape-12.svg', + type: 'diamond' + }, + { + title: 'Right arrow', + thumb: 'shape-13.svg', + type: 'rightArrow' + }, + { + title: 'Left-right arrow', + thumb: 'shape-14.svg', + type: 'leftRightArrow' + }, + { + title: 'Left arrow callout', + thumb: 'shape-15.svg', + type: 'leftArrowCallout' + }, + { + title: 'Right arrow callout', + thumb: 'shape-16.svg', + type: 'rightArrowCallout' + }, + { + title: 'Flow chart off page connector', + thumb: 'shape-17.svg', + type: 'flowChartOffpageConnector' + }, + { + title: 'Heart', + thumb: 'shape-18.svg', + type: 'heart' + }, + { + title: 'Math minus', + thumb: 'shape-19.svg', + type: 'mathMinus' + }, + { + title: 'Math plus', + thumb: 'shape-20.svg', + type: 'mathPlus' + }, + { + title: 'Parallelogram', + thumb: 'shape-21.svg', + type: 'parallelogram' + }, + { + title: 'Wedge rect callout', + thumb: 'shape-22.svg', + type: 'wedgeRectCallout' + }, + { + title: 'Wedge ellipse callout', + thumb: 'shape-23.svg', + type: 'wedgeEllipseCallout' + }, + { + title: 'Cloud callout', + thumb: 'shape-24.svg', + type: 'cloudCallout' + } + ]; + + var elementsInRow = 4; + var groups = _.chain(_styles).groupBy(function(element, index){ + return Math.floor(index/elementsInRow); + }).toArray().value(); + + Common.SharedSettings.set('shapes', groups); + Common.NotificationCenter.trigger('shapes:load', groups); + }, + + setApi: function (api) { + this.api = api; + }, + + onLaunch: function () { + this.createView('AddShape').render(); + }, + + initEvents: function () { + var me = this; + + $('#add-shape li').single('click', _.buffered(me.onShapeClick, 100, me)); + }, + + onShapeClick: function (e) { + var $target = $(e.currentTarget); + + if ($target && this.api) { + this.api.addShapeOnSheet($target.data('type')); + } + + SSE.getController('AddContainer').hideModal(); + }, + + // Public + + getStyles: function () { + return _styles; + } + } + })(), SSE.Controllers.AddShape || {})) +}); \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/app/template/AddShape.template b/apps/spreadsheeteditor/mobile/app/template/AddShape.template index 252e4163d..04c30ec01 100644 --- a/apps/spreadsheeteditor/mobile/app/template/AddShape.template +++ b/apps/spreadsheeteditor/mobile/app/template/AddShape.template @@ -5,7 +5,7 @@