[SSE] Add equations.

This commit is contained in:
Julia Radzhabova 2016-10-21 12:33:49 +03:00
parent 9d8bcd6a06
commit 6bb7470932
10 changed files with 1135 additions and 36 deletions

View file

@ -0,0 +1,416 @@
/*
*
* (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
*
*/
if (Common === undefined) {
var Common = {};
}
define(function(){ 'use strict';
Common.define = {};
Common.define.c_oAscMathMainType = {
Symbol : 0x00,
Fraction : 0x01,
Script : 0x02,
Radical : 0x03,
Integral : 0x04,
LargeOperator: 0x05,
Bracket : 0x06,
Function : 0x07,
Accent : 0x08,
LimitLog : 0x09,
Operator : 0x0a,
Matrix : 0x0b
};
// [translate, count cells, scroll]
// equations sub groups
// equations types
Common.define.c_oAscMathType = {
Symbol_pm : 0x00000000,
Symbol_infinity : 0x00000001,
Symbol_equals : 0x00000002,
Symbol_neq : 0x00000003,
Symbol_about : 0x00000004,
Symbol_times : 0x00000005,
Symbol_div : 0x00000006,
Symbol_factorial : 0x00000007,
Symbol_propto : 0x00000008,
Symbol_less : 0x00000009,
Symbol_ll : 0x0000000a,
Symbol_greater : 0x0000000b,
Symbol_gg : 0x0000000c,
Symbol_leq : 0x0000000d,
Symbol_geq : 0x0000000e,
Symbol_mp : 0x0000000f,
Symbol_cong : 0x00000010,
Symbol_approx : 0x00000011,
Symbol_equiv : 0x00000012,
Symbol_forall : 0x00000013,
Symbol_additional : 0x00000014,
Symbol_partial : 0x00000015,
Symbol_sqrt : 0x00000016,
Symbol_cbrt : 0x00000017,
Symbol_qdrt : 0x00000018,
Symbol_cup : 0x00000019,
Symbol_cap : 0x0000001a,
Symbol_emptyset : 0x0000001b,
Symbol_percent : 0x0000001c,
Symbol_degree : 0x0000001d,
Symbol_fahrenheit : 0x0000001e,
Symbol_celsius : 0x0000001f,
Symbol_inc : 0x00000020,
Symbol_nabla : 0x00000021,
Symbol_exists : 0x00000022,
Symbol_notexists : 0x00000023,
Symbol_in : 0x00000024,
Symbol_ni : 0x00000025,
Symbol_leftarrow : 0x00000026,
Symbol_uparrow : 0x00000027,
Symbol_rightarrow : 0x00000028,
Symbol_downarrow : 0x00000029,
Symbol_leftrightarrow : 0x0000002a,
Symbol_therefore : 0x0000002b,
Symbol_plus : 0x0000002c,
Symbol_minus : 0x0000002d,
Symbol_not : 0x0000002e,
Symbol_ast : 0x0000002f,
Symbol_bullet : 0x00000030,
Symbol_vdots : 0x00000031,
Symbol_cdots : 0x00000032,
Symbol_rddots : 0x00000033,
Symbol_ddots : 0x00000034,
Symbol_aleph : 0x00000035,
Symbol_beth : 0x00000036,
Symbol_QED : 0x00000037,
Symbol_alpha : 0x00010000,
Symbol_beta : 0x00010001,
Symbol_gamma : 0x00010002,
Symbol_delta : 0x00010003,
Symbol_varepsilon : 0x00010004,
Symbol_epsilon : 0x00010005,
Symbol_zeta : 0x00010006,
Symbol_eta : 0x00010007,
Symbol_theta : 0x00010008,
Symbol_vartheta : 0x00010009,
Symbol_iota : 0x0001000a,
Symbol_kappa : 0x0001000b,
Symbol_lambda : 0x0001000c,
Symbol_mu : 0x0001000d,
Symbol_nu : 0x0001000e,
Symbol_xsi : 0x0001000f,
Symbol_o : 0x00010010,
Symbol_pi : 0x00010011,
Symbol_varpi : 0x00010012,
Symbol_rho : 0x00010013,
Symbol_varrho : 0x00010014,
Symbol_sigma : 0x00010015,
Symbol_varsigma : 0x00010016,
Symbol_tau : 0x00010017,
Symbol_upsilon : 0x00010018,
Symbol_varphi : 0x00010019,
Symbol_phi : 0x0001001a,
Symbol_chi : 0x0001001b,
Symbol_psi : 0x0001001c,
Symbol_omega : 0x0001001d,
Symbol_Alpha : 0x00020000,
Symbol_Beta : 0x00020001,
Symbol_Gamma : 0x00020002,
Symbol_Delta : 0x00020003,
Symbol_Epsilon : 0x00020004,
Symbol_Zeta : 0x00020005,
Symbol_Eta : 0x00020006,
Symbol_Theta : 0x00020007,
Symbol_Iota : 0x00020008,
Symbol_Kappa : 0x00020009,
Symbol_Lambda : 0x0002000a,
Symbol_Mu : 0x0002000b,
Symbol_Nu : 0x0002000c,
Symbol_Xsi : 0x0002000d,
Symbol_O : 0x0002000e,
Symbol_Pi : 0x0002000f,
Symbol_Rho : 0x00020010,
Symbol_Sigma : 0x00020011,
Symbol_Tau : 0x00020012,
Symbol_Upsilon : 0x00020013,
Symbol_Phi : 0x00020014,
Symbol_Chi : 0x00020015,
Symbol_Psi : 0x00020016,
Symbol_Omega : 0x00020017,
FractionVertical : 0x01000000,
FractionDiagonal : 0x01000001,
FractionHorizontal : 0x01000002,
FractionSmall : 0x01000003,
FractionDifferential_1 : 0x01010000,
FractionDifferential_2 : 0x01010001,
FractionDifferential_3 : 0x01010002,
FractionDifferential_4 : 0x01010003,
FractionPi_2 : 0x01010004,
ScriptSup : 0x02000000,
ScriptSub : 0x02000001,
ScriptSubSup : 0x02000002,
ScriptSubSupLeft : 0x02000003,
ScriptCustom_1 : 0x02010000,
ScriptCustom_2 : 0x02010001,
ScriptCustom_3 : 0x02010002,
ScriptCustom_4 : 0x02010003,
RadicalSqrt : 0x03000000,
RadicalRoot_n : 0x03000001,
RadicalRoot_2 : 0x03000002,
RadicalRoot_3 : 0x03000003,
RadicalCustom_1 : 0x03010000,
RadicalCustom_2 : 0x03010001,
Integral : 0x04000000,
IntegralSubSup : 0x04000001,
IntegralCenterSubSup : 0x04000002,
IntegralDouble : 0x04000003,
IntegralDoubleSubSup : 0x04000004,
IntegralDoubleCenterSubSup : 0x04000005,
IntegralTriple : 0x04000006,
IntegralTripleSubSup : 0x04000007,
IntegralTripleCenterSubSup : 0x04000008,
IntegralOriented : 0x04010000,
IntegralOrientedSubSup : 0x04010001,
IntegralOrientedCenterSubSup : 0x04010002,
IntegralOrientedDouble : 0x04010003,
IntegralOrientedDoubleSubSup : 0x04010004,
IntegralOrientedDoubleCenterSubSup : 0x04010005,
IntegralOrientedTriple : 0x04010006,
IntegralOrientedTripleSubSup : 0x04010007,
IntegralOrientedTripleCenterSubSup : 0x04010008,
Integral_dx : 0x04020000,
Integral_dy : 0x04020001,
Integral_dtheta : 0x04020002,
LargeOperator_Sum : 0x05000000,
LargeOperator_Sum_CenterSubSup : 0x05000001,
LargeOperator_Sum_SubSup : 0x05000002,
LargeOperator_Sum_CenterSub : 0x05000003,
LargeOperator_Sum_Sub : 0x05000004,
LargeOperator_Prod : 0x05010000,
LargeOperator_Prod_CenterSubSup : 0x05010001,
LargeOperator_Prod_SubSup : 0x05010002,
LargeOperator_Prod_CenterSub : 0x05010003,
LargeOperator_Prod_Sub : 0x05010004,
LargeOperator_CoProd : 0x05010005,
LargeOperator_CoProd_CenterSubSup : 0x05010006,
LargeOperator_CoProd_SubSup : 0x05010007,
LargeOperator_CoProd_CenterSub : 0x05010008,
LargeOperator_CoProd_Sub : 0x05010009,
LargeOperator_Union : 0x05020000,
LargeOperator_Union_CenterSubSup : 0x05020001,
LargeOperator_Union_SubSup : 0x05020002,
LargeOperator_Union_CenterSub : 0x05020003,
LargeOperator_Union_Sub : 0x05020004,
LargeOperator_Intersection : 0x05020005,
LargeOperator_Intersection_CenterSubSup : 0x05020006,
LargeOperator_Intersection_SubSup : 0x05020007,
LargeOperator_Intersection_CenterSub : 0x05020008,
LargeOperator_Intersection_Sub : 0x05020009,
LargeOperator_Disjunction : 0x05030000,
LargeOperator_Disjunction_CenterSubSup : 0x05030001,
LargeOperator_Disjunction_SubSup : 0x05030002,
LargeOperator_Disjunction_CenterSub : 0x05030003,
LargeOperator_Disjunction_Sub : 0x05030004,
LargeOperator_Conjunction : 0x05030005,
LargeOperator_Conjunction_CenterSubSup : 0x05030006,
LargeOperator_Conjunction_SubSup : 0x05030007,
LargeOperator_Conjunction_CenterSub : 0x05030008,
LargeOperator_Conjunction_Sub : 0x05030009,
LargeOperator_Custom_1 : 0x05040000,
LargeOperator_Custom_2 : 0x05040001,
LargeOperator_Custom_3 : 0x05040002,
LargeOperator_Custom_4 : 0x05040003,
LargeOperator_Custom_5 : 0x05040004,
Bracket_Round : 0x06000000,
Bracket_Square : 0x06000001,
Bracket_Curve : 0x06000002,
Bracket_Angle : 0x06000003,
Bracket_LowLim : 0x06000004,
Bracket_UppLim : 0x06000005,
Bracket_Line : 0x06000006,
Bracket_LineDouble : 0x06000007,
Bracket_Square_OpenOpen : 0x06000008,
Bracket_Square_CloseClose : 0x06000009,
Bracket_Square_CloseOpen : 0x0600000a,
Bracket_SquareDouble : 0x0600000b,
Bracket_Round_Delimiter_2 : 0x06010000,
Bracket_Curve_Delimiter_2 : 0x06010001,
Bracket_Angle_Delimiter_2 : 0x06010002,
Bracket_Angle_Delimiter_3 : 0x06010003,
Bracket_Round_OpenNone : 0x06020000,
Bracket_Round_NoneOpen : 0x06020001,
Bracket_Square_OpenNone : 0x06020002,
Bracket_Square_NoneOpen : 0x06020003,
Bracket_Curve_OpenNone : 0x06020004,
Bracket_Curve_NoneOpen : 0x06020005,
Bracket_Angle_OpenNone : 0x06020006,
Bracket_Angle_NoneOpen : 0x06020007,
Bracket_LowLim_OpenNone : 0x06020008,
Bracket_LowLim_NoneNone : 0x06020009,
Bracket_UppLim_OpenNone : 0x0602000a,
Bracket_UppLim_NoneOpen : 0x0602000b,
Bracket_Line_OpenNone : 0x0602000c,
Bracket_Line_NoneOpen : 0x0602000d,
Bracket_LineDouble_OpenNone : 0x0602000e,
Bracket_LineDouble_NoneOpen : 0x0602000f,
Bracket_SquareDouble_OpenNone : 0x06020010,
Bracket_SquareDouble_NoneOpen : 0x06020011,
Bracket_Custom_1 : 0x06030000,
Bracket_Custom_2 : 0x06030001,
Bracket_Custom_3 : 0x06030002,
Bracket_Custom_4 : 0x06030003,
Bracket_Custom_5 : 0x06040000,
Bracket_Custom_6 : 0x06040001,
Bracket_Custom_7 : 0x06040002,
Function_Sin : 0x07000000,
Function_Cos : 0x07000001,
Function_Tan : 0x07000002,
Function_Csc : 0x07000003,
Function_Sec : 0x07000004,
Function_Cot : 0x07000005,
Function_1_Sin : 0x07010000,
Function_1_Cos : 0x07010001,
Function_1_Tan : 0x07010002,
Function_1_Csc : 0x07010003,
Function_1_Sec : 0x07010004,
Function_1_Cot : 0x07010005,
Function_Sinh : 0x07020000,
Function_Cosh : 0x07020001,
Function_Tanh : 0x07020002,
Function_Csch : 0x07020003,
Function_Sech : 0x07020004,
Function_Coth : 0x07020005,
Function_1_Sinh : 0x07030000,
Function_1_Cosh : 0x07030001,
Function_1_Tanh : 0x07030002,
Function_1_Csch : 0x07030003,
Function_1_Sech : 0x07030004,
Function_1_Coth : 0x07030005,
Function_Custom_1 : 0x07040000,
Function_Custom_2 : 0x07040001,
Function_Custom_3 : 0x07040002,
Accent_Dot : 0x08000000,
Accent_DDot : 0x08000001,
Accent_DDDot : 0x08000002,
Accent_Hat : 0x08000003,
Accent_Check : 0x08000004,
Accent_Accent : 0x08000005,
Accent_Grave : 0x08000006,
Accent_Smile : 0x08000007,
Accent_Tilde : 0x08000008,
Accent_Bar : 0x08000009,
Accent_DoubleBar : 0x0800000a,
Accent_CurveBracketTop : 0x0800000b,
Accent_CurveBracketBot : 0x0800000c,
Accent_GroupTop : 0x0800000d,
Accent_GroupBot : 0x0800000e,
Accent_ArrowL : 0x0800000f,
Accent_ArrowR : 0x08000010,
Accent_ArrowD : 0x08000011,
Accent_HarpoonL : 0x08000012,
Accent_HarpoonR : 0x08000013,
Accent_BorderBox : 0x08010000,
Accent_BorderBoxCustom : 0x08010001,
Accent_BarTop : 0x08020000,
Accent_BarBot : 0x08020001,
Accent_Custom_1 : 0x08030000,
Accent_Custom_2 : 0x08030001,
Accent_Custom_3 : 0x08030002,
LimitLog_LogBase : 0x09000000,
LimitLog_Log : 0x09000001,
LimitLog_Lim : 0x09000002,
LimitLog_Min : 0x09000003,
LimitLog_Max : 0x09000004,
LimitLog_Ln : 0x09000005,
LimitLog_Custom_1 : 0x09010000,
LimitLog_Custom_2 : 0x09010001,
Operator_ColonEquals : 0x0a000000,
Operator_EqualsEquals : 0x0a000001,
Operator_PlusEquals : 0x0a000002,
Operator_MinusEquals : 0x0a000003,
Operator_Definition : 0x0a000004,
Operator_UnitOfMeasure : 0x0a000005,
Operator_DeltaEquals : 0x0a000006,
Operator_ArrowL_Top : 0x0a010000,
Operator_ArrowR_Top : 0x0a010001,
Operator_ArrowL_Bot : 0x0a010002,
Operator_ArrowR_Bot : 0x0a010003,
Operator_DoubleArrowL_Top : 0x0a010004,
Operator_DoubleArrowR_Top : 0x0a010005,
Operator_DoubleArrowL_Bot : 0x0a010006,
Operator_DoubleArrowR_Bot : 0x0a010007,
Operator_ArrowD_Top : 0x0a010008,
Operator_ArrowD_Bot : 0x0a010009,
Operator_DoubleArrowD_Top : 0x0a01000a,
Operator_DoubleArrowD_Bot : 0x0a01000b,
Operator_Custom_1 : 0x0a020000,
Operator_Custom_2 : 0x0a020001,
Matrix_1_2 : 0x0b000000,
Matrix_2_1 : 0x0b000001,
Matrix_1_3 : 0x0b000002,
Matrix_3_1 : 0x0b000003,
Matrix_2_2 : 0x0b000004,
Matrix_2_3 : 0x0b000005,
Matrix_3_2 : 0x0b000006,
Matrix_3_3 : 0x0b000007,
Matrix_Dots_Center : 0x0b010000,
Matrix_Dots_Baseline : 0x0b010001,
Matrix_Dots_Vertical : 0x0b010002,
Matrix_Dots_Diagonal : 0x0b010003,
Matrix_Identity_2 : 0x0b020000,
Matrix_Identity_2_NoZeros : 0x0b020001,
Matrix_Identity_3 : 0x0b020002,
Matrix_Identity_3_NoZeros : 0x0b020003,
Matrix_2_2_RoundBracket : 0x0b030000,
Matrix_2_2_SquareBracket : 0x0b030001,
Matrix_2_2_LineBracket : 0x0b030002,
Matrix_2_2_DLineBracket : 0x0b030003,
Matrix_Flat_Round : 0x0b040000,
Matrix_Flat_Square : 0x0b040001
};
});

View file

@ -0,0 +1,53 @@
/*
*
* (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
*
*/
/**
* EquationGroups.js
*
* Created by Alexey Musinov on 29/10/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
*
*/
define([
'backbone',
'spreadsheeteditor/main/app/model/EquationGroup'
], function(Backbone){ 'use strict';
if (Common === undefined)
var Common = {};
Common.Collections = Common.Collections || {};
SSE.Collections.EquationGroups = Backbone.Collection.extend({
model: SSE.Models.EquationGroup
});
});

View file

@ -52,6 +52,7 @@ define([
'common/main/lib/util/LanguageInfo',
'spreadsheeteditor/main/app/collection/ShapeGroups',
'spreadsheeteditor/main/app/collection/TableTemplates',
'spreadsheeteditor/main/app/collection/EquationGroups',
'spreadsheeteditor/main/app/controller/FormulaDialog',
'spreadsheeteditor/main/app/view/FormulaLang'
], function () {

View file

@ -43,6 +43,7 @@ define([
'common/main/lib/component/Window',
'common/main/lib/view/CopyWarningDialog',
'common/main/lib/view/ImageFromUrlDialog',
'common/main/lib/util/define',
'spreadsheeteditor/main/app/view/Toolbar',
'spreadsheeteditor/main/app/collection/TableTemplates',
'spreadsheeteditor/main/app/view/HyperlinkSettingsDialog',
@ -208,6 +209,7 @@ define([
toolbar.btnInsertText.on('click', _.bind(this.onBtnInsertTextClick, this));
toolbar.btnInsertText.menu.on('item:click', _.bind(this.onInsertTextClick, this));
toolbar.btnInsertShape.menu.on('hide:after', _.bind(this.onInsertShapeHide, this));
toolbar.btnInsertEquation.on('click', _.bind(this.onInsertEquationClick, this));
toolbar.btnSortDown.on('click', _.bind(this.onSortType, this, Asc.c_oAscSortOptions.Ascending));
toolbar.btnSortUp.on('click', _.bind(this.onSortType, this, Asc.c_oAscSortOptions.Descending));
toolbar.mnuitemSortAZ.on('click', _.bind(this.onSortType, this, Asc.c_oAscSortOptions.Ascending));
@ -273,6 +275,7 @@ define([
Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
this.api.asc_registerCallback('asc_onLockDefNameManager', _.bind(this.onLockDefNameManager, this));
this.api.asc_registerCallback('asc_onZoomChanged', _.bind(this.onApiZoomChange, this));
this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onMathTypes, this));
},
onNewDocument: function(btn, e) {
@ -1260,6 +1263,9 @@ define([
if (me.toolbar.btnTableTemplate.rendered)
me.fillTableTemplates();
if (me.toolbar.btnInsertEquation.rendered)
me.fillEquations();
}, 100);
}
@ -2047,6 +2053,200 @@ define([
}
},
fillEquations: function() {
if (!this.toolbar.btnInsertEquation.rendered) return;
var me = this, equationsStore = this.getApplication().getCollection('EquationGroups');
me.equationPickers = [];
me.toolbar.btnInsertEquation.menu.removeAll();
for (var i = 0; i < equationsStore.length; ++i) {
var equationGroup = equationsStore.at(i);
var menuItem = new Common.UI.MenuItem({
caption: equationGroup.get('groupName'),
menu: new Common.UI.Menu({
menuAlign: 'tl-tr',
items: [
{ template: _.template('<div id="id-toolbar-menu-equationgroup' + i +
'" class="menu-shape" style="width:' + (equationGroup.get('groupWidth') + 8) + 'px; ' +
equationGroup.get('groupHeight') + 'margin-left:5px;"></div>') }
]
})
});
me.toolbar.btnInsertEquation.menu.addItem(menuItem);
var equationPicker = new Common.UI.DataView({
el: $('#id-toolbar-menu-equationgroup' + i),
store: equationGroup.get('groupStore'),
parentMenu: menuItem.menu,
showLast: false,
itemTemplate: _.template('<div class="item-equation" '+
'style="background-position:<%= posX %>px <%= posY %>px;" >' +
'<div style="width:<%= width %>px;height:<%= height %>px;" id="<%= id %>">')
});
if (equationGroup.get('groupHeight').length) {
me.equationPickers.push(equationPicker);
me.toolbar.btnInsertEquation.menu.on('show:after', function () {
if (me.equationPickers.length) {
var element = $(this.el).find('.over').find('.menu-shape');
if (element.length) {
for (var i = 0; i < me.equationPickers.length; ++i) {
if (element[0].id == me.equationPickers[i].el.id) {
me.equationPickers[i].scroller.update({alwaysVisibleY: true});
me.equationPickers.splice(i, 1);
return;
}
}
}
}
});
}
equationPicker.on('item:click', function(picker, item, record, e) {
if (me.api) {
me.api.asc_AddMath(record.get('data').equationType);
if (me.toolbar.btnInsertText.pressed) {
me.toolbar.btnInsertText.toggle(false, true);
}
if (me.toolbar.btnInsertShape.pressed) {
me.toolbar.btnInsertShape.toggle(false, true);
}
if (e.type !== 'click')
me.toolbar.btnInsertEquation.menu.hide();
Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertEquation);
Common.component.Analytics.trackEvent('ToolBar', 'Add Equation');
}
});
}
},
onInsertEquationClick: function() {
if (this.api && !this._state.in_equation) {
this.api.asc_AddMath();
Common.component.Analytics.trackEvent('ToolBar', 'Add Equation');
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertEquation);
},
onMathTypes: function(equation) {
var equationgrouparray = [],
equationsStore = this.getCollection('EquationGroups');
equationsStore.reset();
// equations groups
var c_oAscMathMainTypeStrings = {};
// [translate, count cells, scroll]
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Symbol ] = [this.textSymbols, 11];
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Fraction ] = [this.textFraction, 4];
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Script ] = [this.textScript, 4];
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Radical ] = [this.textRadical, 4];
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Integral ] = [this.textIntegral, 3, true];
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.LargeOperator] = [this.textLargeOperator, 5, true];
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Bracket ] = [this.textBracket, 4, true];
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Function ] = [this.textFunction, 3, true];
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Accent ] = [this.textAccent, 4];
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.LimitLog ] = [this.textLimitAndLog, 3];
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Operator ] = [this.textOperator, 4];
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Matrix ] = [this.textMatrix, 4, true];
// equations sub groups
// equations types
var translationTable = {}, name = '', translate = '';
for (name in Common.define.c_oAscMathType) {
if (Common.define.c_oAscMathType.hasOwnProperty(name)) {
var arr = name.split('_');
if (arr.length==2 && arr[0]=='Symbol') {
translate = 'txt' + arr[0] + '_' + arr[1].toLocaleLowerCase();
} else
translate = 'txt' + name;
translationTable[Common.define.c_oAscMathType[name]] = this[translate];
}
}
var i,id = 0, count = 0, length = 0, width = 0, height = 0, store = null, list = null, eqStore = null, eq = null;
if (equation) {
count = equation.get_Data().length;
if (count) {
for (var j = 0; j < count; ++j) {
id = equation.get_Data()[j].get_Id();
width = equation.get_Data()[j].get_W();
height = equation.get_Data()[j].get_H();
store = new Backbone.Collection([], {
model: SSE.Models.EquationModel
});
if (store) {
var allItemsCount = 0, itemsCount = 0, ids = 0;
length = equation.get_Data()[j].get_Data().length;
for (i = 0; i < length; ++i) {
eqStore = equation.get_Data()[j].get_Data()[i];
itemsCount = eqStore.get_Data().length;
for (var p = 0; p < itemsCount; ++p) {
eq = eqStore.get_Data()[p];
ids = eq.get_Id();
translate = '';
if (translationTable.hasOwnProperty(ids)) {
translate = translationTable[ids];
}
store.add({
data : {equationType: ids},
tip : translate,
allowSelected : true,
selected : false,
width : eqStore.get_W(),
height : eqStore.get_H(),
posX : -eq.get_X(),
posY : -eq.get_Y()
});
}
allItemsCount += itemsCount;
}
width = c_oAscMathMainTypeStrings[id][1] * (width + 10); // 4px margin + 4px margin + 1px border + 1px border
var normHeight = parseInt(370 / (height + 10)) * (height + 10);
equationgrouparray.push({
groupName : c_oAscMathMainTypeStrings[id][0],
groupStore : store,
groupWidth : width,
groupHeight : c_oAscMathMainTypeStrings[id][2] ? ' height:'+ normHeight +'px!important; ' : ''
});
}
}
equationsStore.add(equationgrouparray);
this.fillEquations();
}
}
},
attachToControlEvents: function() {
// this.control({
// 'menu[action=table-templates]':{
@ -2096,7 +2296,8 @@ define([
is_shape_text = seltype == Asc.c_oAscSelectionType.RangeShapeText,
is_shape = seltype == Asc.c_oAscSelectionType.RangeShape,
is_image = seltype == Asc.c_oAscSelectionType.RangeImage,
is_mode_2 = is_shape_text || is_shape || is_chart_text || is_chart;
is_equation = seltype == Asc.c_oAscSelectionType.RangeMath,
is_mode_2 = is_shape_text || is_shape || is_chart_text || is_chart || is_equation;
if ( coauth_disable ) {
toolbar.lockToolbar(SSE.enumLock.coAuth, coauth_disable);
@ -2109,6 +2310,7 @@ define([
case Asc.c_oAscSelectionType.RangeShapeText: type = _set.selShapeText; break;
case Asc.c_oAscSelectionType.RangeChart: type = _set.selChart; break;
case Asc.c_oAscSelectionType.RangeChartText: type = _set.selChartText; break;
case Asc.c_oAscSelectionType.RangeMath: type = _set.selEquation; break;
}
toolbar.lockToolbar(type, type != seltype, {
@ -2123,7 +2325,7 @@ define([
toolbar.mnuitemClearFilter
],
merge: true,
clear: [_set.selImage, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.coAuth]
clear: [_set.selImage, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selEquation, _set.coAuth]
});
}
@ -2275,6 +2477,347 @@ define([
textWarning : 'Warning',
textFontSizeErr : 'The entered value is incorrect.<br>Please enter a numeric value between 1 and 409',
textCancel : 'Cancel',
confirmAddFontName : 'The font you are going to save is not available on the current device.<br>The text style will be displayed using one of the device fonts, the saved font will be used when it is available.<br>Do you want to continue?'
confirmAddFontName : 'The font you are going to save is not available on the current device.<br>The text style will be displayed using one of the device fonts, the saved font will be used when it is available.<br>Do you want to continue?',
textSymbols : 'Symbols',
textFraction : 'Fraction',
textScript : 'Script',
textRadical : 'Radical',
textIntegral : 'Integral',
textLargeOperator : 'Large Operator',
textBracket : 'Bracket',
textFunction : 'Function',
textAccent : 'Accent',
textLimitAndLog : 'Limit And Log',
textOperator : 'Operator',
textMatrix : 'Matrix',
txtSymbol_pm : 'Plus Minus',
txtSymbol_infinity : 'Infinity',
txtSymbol_equals : 'Equal',
txtSymbol_neq : 'Not Equal To',
txtSymbol_about : 'Approximately',
txtSymbol_times : 'Multiplication Sign',
txtSymbol_div : 'Division Sign',
txtSymbol_factorial : 'Factorial',
txtSymbol_propto : 'Proportional To',
txtSymbol_less : 'Less Than',
txtSymbol_ll : 'Much Less Than',
txtSymbol_greater : 'Greater Than',
txtSymbol_gg : 'Much Greater Than',
txtSymbol_leq : 'Less Than or Equal To',
txtSymbol_geq : 'Greater Than or Equal To',
txtSymbol_mp : 'Minus Plus',
txtSymbol_cong : 'Approximately Equal To',
txtSymbol_approx : 'Almost Equal To',
txtSymbol_equiv : 'Identical To',
txtSymbol_forall : 'For All',
txtSymbol_additional : 'Complement',
txtSymbol_partial : 'Partial Differential',
txtSymbol_sqrt : 'Radical Sign',
txtSymbol_cbrt : 'Cube Root',
txtSymbol_qdrt : 'Fourth Root',
txtSymbol_cup : 'Union',
txtSymbol_cap : 'Intersection',
txtSymbol_emptyset : 'Empty Set',
txtSymbol_percent : 'Percentage',
txtSymbol_degree : 'Degrees',
txtSymbol_fahrenheit : 'Degrees Fahrenheit',
txtSymbol_celsius : 'Degrees Celsius',
txtSymbol_inc : 'Increment',
txtSymbol_nabla : 'Nabla',
txtSymbol_exists : 'There Exist',
txtSymbol_notexists : 'There Does Not Exist',
txtSymbol_in : 'Element Of',
txtSymbol_ni : 'Contains as Member',
txtSymbol_leftarrow : 'Left Arrow',
txtSymbol_uparrow : 'Up Arrow',
txtSymbol_rightarrow : 'Right Arrow',
txtSymbol_downarrow : 'Down Arrow',
txtSymbol_leftrightarrow : 'Left-Right Arrow',
txtSymbol_therefore : 'Therefore',
txtSymbol_plus : 'Plus',
txtSymbol_minus : 'Minus',
txtSymbol_not : 'Not Sign',
txtSymbol_ast : 'Asterisk Operator',
txtSymbol_bullet : 'Bulet Operator',
txtSymbol_vdots : 'Vertical Ellipsis',
txtSymbol_cdots : 'Midline Horizontal Ellipsis',
txtSymbol_rddots : 'Up Right Diagonal Ellipsis',
txtSymbol_ddots : 'Down Right Diagonal Ellipsis',
txtSymbol_aleph : 'Alef',
txtSymbol_beth : 'Bet',
txtSymbol_qed : 'End of Proof',
txtSymbol_alpha : 'Alpha',
txtSymbol_beta : 'Beta',
txtSymbol_gamma : 'Gamma',
txtSymbol_delta : 'Delta',
txtSymbol_varepsilon : 'Epsilon Variant',
txtSymbol_epsilon : 'Epsilon',
txtSymbol_zeta : 'Zeta',
txtSymbol_eta : 'Eta',
txtSymbol_theta : 'Theta',
txtSymbol_vartheta : 'Theta Variant',
txtSymbol_iota : 'Iota',
txtSymbol_kappa : 'Kappa',
txtSymbol_lambda : 'Lambda',
txtSymbol_mu : 'Mu',
txtSymbol_nu : 'Nu',
txtSymbol_xsi : 'Xi',
txtSymbol_o : 'Omicron',
txtSymbol_pi : 'Pi',
txtSymbol_varpi : 'Pi Variant',
txtSymbol_rho : 'Rho',
txtSymbol_varrho : 'Rho Variant',
txtSymbol_sigma : 'Sigma',
txtSymbol_varsigma : 'Sigma Variant',
txtSymbol_tau : 'Tau',
txtSymbol_upsilon : 'Upsilon',
txtSymbol_varphi : 'Phi Variant',
txtSymbol_phi : 'Phi',
txtSymbol_chi : 'Chi',
txtSymbol_psi : 'Psi',
txtSymbol_omega : 'Omega',
txtFractionVertical : 'Stacked Fraction',
txtFractionDiagonal : 'Skewed Fraction',
txtFractionHorizontal : 'Linear Fraction',
txtFractionSmall : 'Small Fraction',
txtFractionDifferential_1 : 'Differential',
txtFractionDifferential_2 : 'Differential',
txtFractionDifferential_3 : 'Differential',
txtFractionDifferential_4 : 'Differential',
txtFractionPi_2 : 'Pi Over 2',
txtScriptSup : 'Superscript',
txtScriptSub : 'Subscript',
txtScriptSubSup : 'Subscript-Superscript',
txtScriptSubSupLeft : 'Left Subscript-Superscript',
txtScriptCustom_1 : 'Script',
txtScriptCustom_2 : 'Script',
txtScriptCustom_3 : 'Script',
txtScriptCustom_4 : 'Script',
txtRadicalSqrt : 'Square Root',
txtRadicalRoot_n : 'Radical With Degree',
txtRadicalRoot_2 : 'Square Root With Degree',
txtRadicalRoot_3 : 'Cubic Root',
txtRadicalCustom_1 : 'Radical',
txtRadicalCustom_2 : 'Radical',
txtIntegral : 'Integral',
txtIntegralSubSup : 'Integral',
txtIntegralCenterSubSup : 'Integral',
txtIntegralDouble : 'Double Integral',
txtIntegralDoubleSubSup : 'Double Integral',
txtIntegralDoubleCenterSubSup : 'Double Integral',
txtIntegralTriple : 'Triple Integral',
txtIntegralTripleSubSup : 'Triple Integral',
txtIntegralTripleCenterSubSup : 'Triple Integral',
txtIntegralOriented : 'Contour Integral',
txtIntegralOrientedSubSup : 'Contour Integral',
txtIntegralOrientedCenterSubSup : 'Contour Integral',
txtIntegralOrientedDouble : 'Surface Integral',
txtIntegralOrientedDoubleSubSup : 'Surface Integral',
txtIntegralOrientedDoubleCenterSubSup : 'Surface Integral',
txtIntegralOrientedTriple : 'Volume Integral',
txtIntegralOrientedTripleSubSup : 'Volume Integral',
txtIntegralOrientedTripleCenterSubSup : 'Volume Integral',
txtIntegral_dx : 'Differential x',
txtIntegral_dy : 'Differential y',
txtIntegral_dtheta : 'Differential theta',
txtLargeOperator_Sum : 'Summation',
txtLargeOperator_Sum_CenterSubSup : 'Summation',
txtLargeOperator_Sum_SubSup : 'Summation',
txtLargeOperator_Sum_CenterSub : 'Summation',
txtLargeOperator_Sum_Sub : 'Summation',
txtLargeOperator_Prod : 'Product',
txtLargeOperator_Prod_CenterSubSup : 'Product',
txtLargeOperator_Prod_SubSup : 'Product',
txtLargeOperator_Prod_CenterSub : 'Product',
txtLargeOperator_Prod_Sub : 'Product',
txtLargeOperator_CoProd : 'Co-Product',
txtLargeOperator_CoProd_CenterSubSup : 'Co-Product',
txtLargeOperator_CoProd_SubSup : 'Co-Product',
txtLargeOperator_CoProd_CenterSub : 'Co-Product',
txtLargeOperator_CoProd_Sub : 'Co-Product',
txtLargeOperator_Union : 'Union',
txtLargeOperator_Union_CenterSubSup : 'Union',
txtLargeOperator_Union_SubSup : 'Union',
txtLargeOperator_Union_CenterSub : 'Union',
txtLargeOperator_Union_Sub : 'Union',
txtLargeOperator_Intersection : 'Intersection',
txtLargeOperator_Intersection_CenterSubSup : 'Intersection',
txtLargeOperator_Intersection_SubSup : 'Intersection',
txtLargeOperator_Intersection_CenterSub : 'Intersection',
txtLargeOperator_Intersection_Sub : 'Intersection',
txtLargeOperator_Disjunction : 'Vee',
txtLargeOperator_Disjunction_CenterSubSup : 'Vee',
txtLargeOperator_Disjunction_SubSup : 'Vee',
txtLargeOperator_Disjunction_CenterSub : 'Vee',
txtLargeOperator_Disjunction_Sub : 'Vee',
txtLargeOperator_Conjunction : 'Wedge',
txtLargeOperator_Conjunction_CenterSubSup : 'Wedge',
txtLargeOperator_Conjunction_SubSup : 'Wedge',
txtLargeOperator_Conjunction_CenterSub : 'Wedge',
txtLargeOperator_Conjunction_Sub : 'Wedge',
txtLargeOperator_Custom_1 : 'Summation',
txtLargeOperator_Custom_2 : 'Summation',
txtLargeOperator_Custom_3 : 'Summation',
txtLargeOperator_Custom_4 : 'Product',
txtLargeOperator_Custom_5 : 'Union',
txtBracket_Round : 'Brackets',
txtBracket_Square : 'Brackets',
txtBracket_Curve : 'Brackets',
txtBracket_Angle : 'Brackets',
txtBracket_LowLim : 'Brackets',
txtBracket_UppLim : 'Brackets',
txtBracket_Line : 'Brackets',
txtBracket_LineDouble : 'Brackets',
txtBracket_Square_OpenOpen : 'Brackets',
txtBracket_Square_CloseClose : 'Brackets',
txtBracket_Square_CloseOpen : 'Brackets',
txtBracket_SquareDouble : 'Brackets',
txtBracket_Round_Delimiter_2 : 'Brackets with Separators',
txtBracket_Curve_Delimiter_2 : 'Brackets with Separators',
txtBracket_Angle_Delimiter_2 : 'Brackets with Separators',
txtBracket_Angle_Delimiter_3 : 'Brackets with Separators',
txtBracket_Round_OpenNone : 'Single Bracket',
txtBracket_Round_NoneOpen : 'Single Bracket',
txtBracket_Square_OpenNone : 'Single Bracket',
txtBracket_Square_NoneOpen : 'Single Bracket',
txtBracket_Curve_OpenNone : 'Single Bracket',
txtBracket_Curve_NoneOpen : 'Single Bracket',
txtBracket_Angle_OpenNone : 'Single Bracket',
txtBracket_Angle_NoneOpen : 'Single Bracket',
txtBracket_LowLim_OpenNone : 'Single Bracket',
txtBracket_LowLim_NoneNone : 'Single Bracket',
txtBracket_UppLim_OpenNone : 'Single Bracket',
txtBracket_UppLim_NoneOpen : 'Single Bracket',
txtBracket_Line_OpenNone : 'Single Bracket',
txtBracket_Line_NoneOpen : 'Single Bracket',
txtBracket_LineDouble_OpenNone : 'Single Bracket',
txtBracket_LineDouble_NoneOpen : 'Single Bracket',
txtBracket_SquareDouble_OpenNone : 'Single Bracket',
txtBracket_SquareDouble_NoneOpen : 'Single Bracket',
txtBracket_Custom_1 : 'Case (Two Conditions)',
txtBracket_Custom_2 : 'Cases (Three Conditions)',
txtBracket_Custom_3 : 'Stack Object',
txtBracket_Custom_4 : 'Stack Object',
txtBracket_Custom_5 : 'Cases Example',
txtBracket_Custom_6 : 'Binomial Coefficient',
txtBracket_Custom_7 : 'Binomial Coefficient',
txtFunction_Sin : 'Sine Function',
txtFunction_Cos : 'Cosine Function',
txtFunction_Tan : 'Tangent Function',
txtFunction_Csc : 'Cosecant Function',
txtFunction_Sec : 'Secant Function',
txtFunction_Cot : 'Cotangent Function',
txtFunction_1_Sin : 'Inverse Sine Function',
txtFunction_1_Cos : 'Inverse Cosine Function',
txtFunction_1_Tan : 'Inverse Tangent Function',
txtFunction_1_Csc : 'Inverse Cosecant Function',
txtFunction_1_Sec : 'Inverse Secant Function',
txtFunction_1_Cot : 'Inverse Cotangent Function',
txtFunction_Sinh : 'Hyperbolic Sine Function',
txtFunction_Cosh : 'Hyperbolic Cosine Function',
txtFunction_Tanh : 'Hyperbolic Tangent Function',
txtFunction_Csch : 'Hyperbolic Cosecant Function',
txtFunction_Sech : 'Hyperbolic Secant Function',
txtFunction_Coth : 'Hyperbolic Cotangent Function',
txtFunction_1_Sinh : 'Hyperbolic Inverse Sine Function',
txtFunction_1_Cosh : 'Hyperbolic Inverse Cosine Function',
txtFunction_1_Tanh : 'Hyperbolic Inverse Tangent Function',
txtFunction_1_Csch : 'Hyperbolic Inverse Cosecant Function',
txtFunction_1_Sech : 'Hyperbolic Inverse Secant Function',
txtFunction_1_Coth : 'Hyperbolic Inverse Cotangent Function',
txtFunction_Custom_1 : 'Sine theta',
txtFunction_Custom_2 : 'Cos 2x',
txtFunction_Custom_3 : 'Tangent formula',
txtAccent_Dot : 'Dot',
txtAccent_DDot : 'Double Dot',
txtAccent_DDDot : 'Triple Dot',
txtAccent_Hat : 'Hat',
txtAccent_Check : 'Check',
txtAccent_Accent : 'Acute',
txtAccent_Grave : 'Grave',
txtAccent_Smile : 'Breve',
txtAccent_Tilde : 'Tilde',
txtAccent_Bar : 'Bar',
txtAccent_DoubleBar : 'Double Overbar',
txtAccent_CurveBracketTop : 'Overbrace',
txtAccent_CurveBracketBot : 'Underbrace',
txtAccent_GroupTop : 'Grouping Character Above',
txtAccent_GroupBot : 'Grouping Character Below',
txtAccent_ArrowL : 'Leftwards Arrow Above',
txtAccent_ArrowR : 'Rightwards Arrow Above',
txtAccent_ArrowD : 'Right-Left Arrow Above',
txtAccent_HarpoonL : 'Leftwards Harpoon Above',
txtAccent_HarpoonR : 'Rightwards Harpoon Above',
txtAccent_BorderBox : 'Boxed Formula (With Placeholder)',
txtAccent_BorderBoxCustom : 'Boxed Formula (Example)',
txtAccent_BarTop : 'Overbar',
txtAccent_BarBot : 'Underbar',
txtAccent_Custom_1 : 'Vector A',
txtAccent_Custom_2 : 'ABC With Overbar',
txtAccent_Custom_3 : 'x XOR y With Overbar',
txtLimitLog_LogBase : 'Logarithm',
txtLimitLog_Log : 'Logarithm',
txtLimitLog_Lim : 'Limit',
txtLimitLog_Min : 'Minimum',
txtLimitLog_Max : 'Maximum',
txtLimitLog_Ln : 'Natural Logarithm',
txtLimitLog_Custom_1 : 'Limit Example',
txtLimitLog_Custom_2 : 'Maximum Example',
txtOperator_ColonEquals : 'Colon Equal',
txtOperator_EqualsEquals : 'Equal Equal',
txtOperator_PlusEquals : 'Plus Equal',
txtOperator_MinusEquals : 'Minus Equal',
txtOperator_Definition : 'Equal to By Definition',
txtOperator_UnitOfMeasure : 'Measured By',
txtOperator_DeltaEquals : 'Delta Equal To',
txtOperator_ArrowL_Top : 'Leftwards Arrow Above',
txtOperator_ArrowR_Top : 'Rightwards Arrow Above',
txtOperator_ArrowL_Bot : 'Leftwards Arrow Below',
txtOperator_ArrowR_Bot : 'Rightwards Arrow Below',
txtOperator_DoubleArrowL_Top : 'Leftwards Arrow Above',
txtOperator_DoubleArrowR_Top : 'Rightwards Arrow Above',
txtOperator_DoubleArrowL_Bot : 'Leftwards Arrow Below',
txtOperator_DoubleArrowR_Bot : 'Rightwards Arrow Below',
txtOperator_ArrowD_Top : 'Right-Left Arrow Above',
txtOperator_ArrowD_Bot : 'Right-Left Arrow Above',
txtOperator_DoubleArrowD_Top : 'Right-Left Arrow Below',
txtOperator_DoubleArrowD_Bot : 'Right-Left Arrow Below',
txtOperator_Custom_1 : 'Yileds',
txtOperator_Custom_2 : 'Delta Yields',
txtMatrix_1_2 : '1x2 Empty Matrix',
txtMatrix_2_1 : '2x1 Empty Matrix',
txtMatrix_1_3 : '1x3 Empty Matrix',
txtMatrix_3_1 : '3x1 Empty Matrix',
txtMatrix_2_2 : '2x2 Empty Matrix',
txtMatrix_2_3 : '2x3 Empty Matrix',
txtMatrix_3_2 : '3x2 Empty Matrix',
txtMatrix_3_3 : '3x3 Empty Matrix',
txtMatrix_Dots_Center : 'Midline Dots',
txtMatrix_Dots_Baseline : 'Baseline Dots',
txtMatrix_Dots_Vertical : 'Vertical Dots',
txtMatrix_Dots_Diagonal : 'Diagonal Dots',
txtMatrix_Identity_2 : '2x2 Identity Matrix',
txtMatrix_Identity_2_NoZeros : '3x3 Identity Matrix',
txtMatrix_Identity_3 : '3x3 Identity Matrix',
txtMatrix_Identity_3_NoZeros : '3x3 Identity Matrix',
txtMatrix_2_2_RoundBracket : 'Empty Matrix with Brackets',
txtMatrix_2_2_SquareBracket : 'Empty Matrix with Brackets',
txtMatrix_2_2_LineBracket : 'Empty Matrix with Brackets',
txtMatrix_2_2_DLineBracket : 'Empty Matrix with Brackets',
txtMatrix_Flat_Round : 'Sparse Matrix',
txtMatrix_Flat_Square : 'Sparse Matrix'
}, SSE.Controllers.Toolbar || {}));
});

View file

@ -0,0 +1,71 @@
/*
*
* (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
*
*/
/**
* EquationGroup.js
*
* Created by Alexey Musinov on 29/10/14
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
*
*/
define([
'backbone'
], function(Backbone){ 'use strict';
SSE.Models = SSE.Models || {};
SSE.Models.EquationModel = Backbone.Model.extend({
defaults: function() {
return {
id : Common.UI.getId(),
data : null,
width : 0,
height : 0,
posX : 0,
posY : 0
}
}
});
SSE.Models.EquationGroup = Backbone.Model.extend({
defaults: function() {
return {
id : Common.UI.getId(),
groupName : null,
groupId : null,
groupStore : null
}
}
});
});

View file

@ -222,7 +222,8 @@
</div>
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-inserthyperlink"></span>
<span class="btn-placeholder " id="id-toolbar-full-placeholder-btn-insertshape"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-insertshape"></span>
<span class="btn-placeholder hidden" id="id-toolbar-full-placeholder-btn-insertequation"></span>
</div>
</div>
<div class="separator long"></div>

View file

@ -75,7 +75,8 @@ define([
ruleFilter: 'rule-filter',
ruleDelFilter: 'rule-clear-filter',
menuFileOpen: 'menu-file-open',
cantPrint: 'cant-print'
cantPrint: 'cant-print',
selEquation: 'sel-equation'
};
SSE.Views.Toolbar = Backbone.View.extend(_.extend({
@ -325,7 +326,7 @@ define([
icls : 'btn-border-out',
borderId : 'outer',
borderswidth: 'thin',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth],
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.lostConnect, _set.coAuth],
split : true,
menu : true
});
@ -373,7 +374,7 @@ define([
enableToggle: true,
allowDepress: true,
split : true,
lock : [_set.editCell, _set.selShape, _set.selShapeText, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleMerge],
lock : [_set.editCell, _set.selShape, _set.selShapeText, _set.selChart, _set.selChartText, _set.selImage, _set.selEquation, _set.lostConnect, _set.coAuth, _set.ruleMerge],
menu : new Common.UI.Menu({
items: [
{
@ -427,7 +428,7 @@ define([
id : 'id-toolbar-rtn-wrap',
cls : 'btn-toolbar',
iconCls : 'btn-wrap',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth],
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.lostConnect, _set.coAuth],
enableToggle: true,
allowDepress: true
});
@ -436,7 +437,7 @@ define([
id : 'id-toolbar-rtn-textorient',
cls : 'btn-toolbar',
iconCls : 'btn-text-orient',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth],
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.lostConnect, _set.coAuth],
menu : new Common.UI.Menu({
items: [
{
@ -547,25 +548,34 @@ define([
})
});
this.btnInsertEquation = new Common.UI.Button({
id : 'id-toolbar-btn-insertequation',
cls : 'btn-toolbar',
iconCls : 'btn-insertequation',
split : true,
lock : [_set.editCell, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth],
menu : new Common.UI.Menu({cls: 'menu-shapes'})
});
me.btnSortDown = new Common.UI.Button({
id : 'id-toolbar-btn-sort-down',
cls : 'btn-toolbar',
iconCls : 'btn-sort-down',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter]
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.lostConnect, _set.coAuth, _set.ruleFilter]
});
me.btnSortUp = new Common.UI.Button({
id : 'id-toolbar-btn-sort-up',
cls : 'btn-toolbar',
iconCls : 'btn-sort-up',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter]
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.lostConnect, _set.coAuth, _set.ruleFilter]
});
me.btnSetAutofilter = new Common.UI.Button({
id : 'id-toolbar-btn-setautofilter',
cls : 'btn-toolbar',
iconCls : 'btn-autofilter',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter],
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.lostConnect, _set.coAuth, _set.ruleFilter],
enableToggle: true
});
@ -573,7 +583,7 @@ define([
id : 'id-toolbar-btn-clearfilter',
cls : 'btn-toolbar',
iconCls : 'btn-clear-filter',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleDelFilter]
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.lostConnect, _set.coAuth, _set.ruleDelFilter]
});
me.btnSearch = new Common.UI.Button({
@ -587,7 +597,7 @@ define([
id : 'id-toolbar-btn-ttempl',
cls : 'btn-toolbar',
iconCls : 'btn-ttempl',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter],
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.lostConnect, _set.coAuth, _set.ruleFilter],
menu : new Common.UI.Menu({
items: [
{ template: _.template('<div id="id-toolbar-menu-table-templates" style="width: 288px; height: 300px; margin: 0px 4px;"></div>') }
@ -602,7 +612,7 @@ define([
itemHeight : 38,
hint : this.tipCellStyle,
menuMaxHeight : 226,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth],
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.lostConnect, _set.coAuth],
beforeOpenHandler: function(e) {
var cmp = this,
menu = cmp.openButton.menu,
@ -638,7 +648,7 @@ define([
cls : 'btn-toolbar btn-text-value',
caption : me.txtGeneral,
style : 'width: 100%;',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selRange, _set.lostConnect, _set.coAuth],
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selRange, _set.selEquation, _set.lostConnect, _set.coAuth],
menu : true
});
@ -646,7 +656,7 @@ define([
id : 'id-toolbar-btn-percent-style',
cls : 'btn-toolbar',
iconCls : 'btn-percent-style',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth],
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.lostConnect, _set.coAuth],
styleName : 'Percent'
});
@ -654,7 +664,7 @@ define([
id : 'id-toolbar-btn-accounting-style',
cls : 'btn-toolbar',
iconCls : 'btn-currency-style',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth],
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.lostConnect, _set.coAuth],
styleName : 'Currency',
split : true,
menu : new Common.UI.Menu({
@ -688,14 +698,14 @@ define([
id : 'id-toolbar-btn-decdecimal',
cls : 'btn-toolbar',
iconCls : 'btn-decdecimal',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth]
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.lostConnect, _set.coAuth]
});
me.btnIncDecimal = new Common.UI.Button({
id : 'id-toolbar-btn-incdecimal',
cls : 'btn-toolbar',
iconCls : 'btn-incdecimal',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth]
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.lostConnect, _set.coAuth]
});
me.btnInsertFormula = new Common.UI.Button({
@ -703,7 +713,7 @@ define([
cls : 'btn-toolbar',
iconCls : 'btn-formula',
split : true,
lock : [_set.editText, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selRange, _set.lostConnect, _set.coAuth],
lock : [_set.editText, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selRange, _set.selEquation, _set.lostConnect, _set.coAuth],
menu : new Common.UI.Menu({
style : 'min-width: 110px',
items : [
@ -724,7 +734,7 @@ define([
id : 'id-toolbar-btn-insertrange',
cls : 'btn-toolbar',
iconCls : 'btn-named-range',
lock : [_set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.selRange],
lock : [_set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.lostConnect, _set.coAuth, _set.selRange],
menu : new Common.UI.Menu({
style : 'min-width: 110px',
items : [
@ -760,22 +770,22 @@ define([
},
{
caption : me.txtClearText,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.coAuth],
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.coAuth],
value : Asc.c_oAscCleanOptions.Text
},
{
caption : me.txtClearFormat,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.coAuth],
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.coAuth],
value : Asc.c_oAscCleanOptions.Format
},
{
caption : me.txtClearComments,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.coAuth],
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.coAuth],
value : Asc.c_oAscCleanOptions.Comments
},
{
caption : me.txtClearHyper,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.coAuth],
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.coAuth],
value : Asc.c_oAscCleanOptions.Hyperlinks
}
]
@ -794,7 +804,7 @@ define([
id : 'id-toolbar-btn-addcell',
cls : 'btn-toolbar',
iconCls : 'btn-addcell',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth],
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.lostConnect, _set.coAuth],
menu : new Common.UI.Menu({
items : [
{
@ -821,7 +831,7 @@ define([
id : 'id-toolbar-btn-delcell',
cls : 'btn-toolbar',
iconCls : 'btn-delcell',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth],
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.lostConnect, _set.coAuth],
menu : new Common.UI.Menu({
items : [
{
@ -1011,32 +1021,32 @@ define([
id : 'id-toolbar-btn-autofilter',
cls : 'btn-toolbar',
iconCls : 'btn-autofilter',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter],
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.lostConnect, _set.coAuth, _set.ruleFilter],
menu : new Common.UI.Menu({
items : [
me.mnuitemSortAZ = new Common.UI.MenuItem({
caption : me.txtSortAZ,
iconCls : 'mnu-sort-asc',
lock : [_set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.coAuth, _set.ruleFilter],
lock : [_set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.coAuth, _set.ruleFilter],
value : Asc.c_oAscSortOptions.Ascending
}),
me.mnuitemSortZA = new Common.UI.MenuItem({
caption : me.txtSortZA,
iconCls : 'mnu-sort-desc',
lock : [_set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.coAuth, _set.ruleFilter],
lock : [_set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.coAuth, _set.ruleFilter],
value : Asc.c_oAscSortOptions.Descending
}),
me.mnuitemAutoFilter = new Common.UI.MenuItem({
caption : me.txtFilter,
iconCls : 'mnu-filter-add',
checkable: true,
lock : [_set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.coAuth, _set.ruleFilter],
lock : [_set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.coAuth, _set.ruleFilter],
value : 'set-filter'
}),
me.mnuitemClearFilter = new Common.UI.MenuItem({
caption : me.txtClearFilter,
iconCls : 'mnu-filter-clear',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.coAuth, _set.ruleDelFilter],
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selEquation, _set.coAuth, _set.ruleDelFilter],
value : 'clear-filter'
})
/*,{
@ -1058,7 +1068,7 @@ define([
me.btnItalic, me.btnUnderline, me.btnTextColor, me.btnHorizontalAlign, me.btnAlignLeft,
me.btnAlignCenter,me.btnAlignRight,me.btnAlignJust, me.btnVerticalAlign, me.btnAlignTop,
me.btnAlignMiddle, me.btnAlignBottom, me.btnWrap, me.btnTextOrient, me.btnBackColor,
me.btnMerge, me.btnInsertFormula, me.btnNamedRange, me.btnIncDecimal, me.btnInsertShape,
me.btnMerge, me.btnInsertFormula, me.btnNamedRange, me.btnIncDecimal, me.btnInsertShape, me.btnInsertEquation,
me.btnInsertText, me.btnSortUp, me.btnSortDown, me.btnSetAutofilter, me.btnClearAutofilter, me.btnTableTemplate,
me.btnPercentStyle, me.btnCurrencyStyle, me.btnDecDecimal, me.btnAddCell, me.btnDeleteCell,
me.btnNumberFormat, me.btnBorders, me.btnInsertImage, me.btnInsertHyperlink,
@ -1075,7 +1085,7 @@ define([
var _temp_array = [me.cmbFontName, me.cmbFontSize, me.btnAlignLeft,me.btnAlignCenter,me.btnAlignRight,me.btnAlignJust,me.btnAlignTop,
me.btnAlignMiddle, me.btnAlignBottom, me.btnHorizontalAlign, me.btnVerticalAlign,
me.btnInsertImage, me.btnInsertText, me.btnInsertShape, me.btnIncFontSize, me.btnDecFontSize,
me.btnInsertImage, me.btnInsertText, me.btnInsertShape, me.btnInsertEquation, me.btnIncFontSize, me.btnDecFontSize,
me.btnBold, me.btnItalic, me.btnUnderline, me.btnTextColor, me.btnBackColor,
me.btnInsertHyperlink, me.btnBorders, me.btnTextOrient, me.btnPercentStyle, me.btnCurrencyStyle, me.btnColorSchemas,
me.btnSettings, me.btnInsertFormula, me.btnNamedRange, me.btnDecDecimal, me.btnIncDecimal, me.btnNumberFormat, me.btnWrap,
@ -1204,6 +1214,7 @@ define([
replacePlacholder('#id-toolbar-' + mode + '-placeholder-btn-inserthyperlink',this.btnInsertHyperlink);
replacePlacholder('#id-toolbar-' + mode + '-placeholder-btn-insertshape', this.btnInsertShape);
replacePlacholder('#id-toolbar-' + mode + '-placeholder-btn-text', this.btnInsertText);
replacePlacholder('#id-toolbar-' + mode + '-placeholder-btn-insertequation', this.btnInsertEquation);
replacePlacholder('#id-toolbar-' + mode + '-placeholder-btn-sortdesc', this.btnSortDown);
replacePlacholder('#id-toolbar-' + mode + '-placeholder-btn-sortasc', this.btnSortUp);
replacePlacholder('#id-toolbar-' + mode + '-placeholder-btn-setfilter', this.btnSetAutofilter);
@ -1268,6 +1279,7 @@ define([
this.btnInsertText.updateHint(this.tipInsertText);
this.btnInsertHyperlink.updateHint(this.tipInsertHyperlink + Common.Utils.String.platformKey('Ctrl+K'));
this.btnInsertShape.updateHint(this.tipInsertShape);
this.btnInsertEquation.updateHint(this.tipInsertEquation);
this.btnSortDown.updateHint(this.txtSortAZ);
this.btnSortUp.updateHint(this.txtSortZA);
this.btnSetAutofilter.updateHint(this.txtFilter + ' (Ctrl+Shift+L)');
@ -2010,6 +2022,7 @@ define([
txtManageRange: 'Name manager',
txtPasteRange: 'Paste name',
textInsText: 'Insert text box',
textInsTextArt: 'Insert Text Art'
textInsTextArt: 'Insert Text Art',
tipInsertEquation: 'Insert Equation'
}, SSE.Views.Toolbar || {}));
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View file

@ -188,6 +188,7 @@
.toolbar-btn-icon(btn-border-diagdown, 43, @toolbar-icon-size);
.toolbar-btn-icon(btn-named-range, 77, @toolbar-icon-size);
.toolbar-btn-icon(btn-insertequation, 82, @toolbar-icon-size);
@menu-icon-size: 22px;
.menu-btn-icon(mnu-align-center, 0, @menu-icon-size);