3.0 source code
This commit is contained in:
@@ -1,83 +1,83 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.Main", {
|
||||
extend: "DE.controller.Main",
|
||||
requires: ["Ext.Anim"],
|
||||
config: {
|
||||
refs: {
|
||||
editToolbar: "edittoolbar",
|
||||
viewToolbar: "viewtoolbar",
|
||||
searchToolbar: "searchtoolbar",
|
||||
readableBtn: "#id-tb-btn-readable"
|
||||
},
|
||||
control: {}
|
||||
},
|
||||
launch: function () {
|
||||
this.callParent(arguments);
|
||||
},
|
||||
initControl: function () {
|
||||
this.callParent(arguments);
|
||||
},
|
||||
initApi: function () {
|
||||
this.callParent(arguments);
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
},
|
||||
setMode: function (mode) {
|
||||
var editToolbar = this.getEditToolbar(),
|
||||
viewToolbar = this.getViewToolbar(),
|
||||
searchToolbar = this.getSearchToolbar(),
|
||||
popClipController = this.getApplication().getController("Common.controller.PopClip");
|
||||
if (mode == "edit") {
|
||||
viewToolbar && viewToolbar.hide();
|
||||
searchToolbar && searchToolbar.hide();
|
||||
editToolbar && editToolbar.show();
|
||||
this.api && this.api.asc_enableKeyEvents(true);
|
||||
this.api && this.api.SetViewMode(false);
|
||||
} else {
|
||||
editToolbar && editToolbar.hide();
|
||||
viewToolbar && viewToolbar.show();
|
||||
this.api && this.api.asc_enableKeyEvents(false);
|
||||
this.api && this.api.SetViewMode(true);
|
||||
}
|
||||
if (popClipController) {
|
||||
popClipController.setMode(mode);
|
||||
}
|
||||
},
|
||||
setReadableMode: function (readable) {
|
||||
var readableBtn = this.getReadableBtn();
|
||||
if (readableBtn) {
|
||||
readable ? readableBtn.show() : readableBtn.hide();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.Main", {
|
||||
extend: "DE.controller.Main",
|
||||
requires: ["Ext.Anim"],
|
||||
config: {
|
||||
refs: {
|
||||
editToolbar: "edittoolbar",
|
||||
viewToolbar: "viewtoolbar",
|
||||
searchToolbar: "searchtoolbar",
|
||||
readableBtn: "#id-tb-btn-readable"
|
||||
},
|
||||
control: {}
|
||||
},
|
||||
launch: function () {
|
||||
this.callParent(arguments);
|
||||
},
|
||||
initControl: function () {
|
||||
this.callParent(arguments);
|
||||
},
|
||||
initApi: function () {
|
||||
this.callParent(arguments);
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
},
|
||||
setMode: function (mode) {
|
||||
var editToolbar = this.getEditToolbar(),
|
||||
viewToolbar = this.getViewToolbar(),
|
||||
searchToolbar = this.getSearchToolbar(),
|
||||
popClipController = this.getApplication().getController("Common.controller.PopClip");
|
||||
if (mode == "edit") {
|
||||
viewToolbar && viewToolbar.hide();
|
||||
searchToolbar && searchToolbar.hide();
|
||||
editToolbar && editToolbar.show();
|
||||
this.api && this.api.asc_enableKeyEvents(true);
|
||||
this.api && this.api.SetViewMode(false);
|
||||
} else {
|
||||
editToolbar && editToolbar.hide();
|
||||
viewToolbar && viewToolbar.show();
|
||||
this.api && this.api.asc_enableKeyEvents(false);
|
||||
this.api && this.api.SetViewMode(true);
|
||||
}
|
||||
if (popClipController) {
|
||||
popClipController.setMode(mode);
|
||||
}
|
||||
},
|
||||
setReadableMode: function (readable) {
|
||||
var readableBtn = this.getReadableBtn();
|
||||
if (readableBtn) {
|
||||
readable ? readableBtn.show() : readableBtn.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,298 +1,298 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.Font", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
fontPanel: "fontpanel",
|
||||
navigateView: "#id-font-navigate",
|
||||
fontSizeSpinner: "fontpanel planarspinnerfield",
|
||||
fontView: "#id-font-root",
|
||||
fontNameView: "#id-font-name",
|
||||
fontNameButton: "#id-btn-fontname",
|
||||
fontButton: "#id-tb-btn-font",
|
||||
fontBaseToggle: "#id-toggle-baseline",
|
||||
fontBaseUp: "#id-btn-baseline-up",
|
||||
fontBaseDown: "#id-btn-baseline-down"
|
||||
},
|
||||
control: {
|
||||
fontPanel: {
|
||||
show: "onFontPanelShow",
|
||||
hide: "onFontPanelHide"
|
||||
},
|
||||
navigateView: {
|
||||
push: "onNavigateViewPush",
|
||||
pop: "onNavigateViewPop",
|
||||
back: "onNavigateViewBack"
|
||||
},
|
||||
fontNameButton: {
|
||||
tap: "onFontNameButtonTap"
|
||||
},
|
||||
fontSizeSpinner: {
|
||||
blur: "onFontSizeSpinnerBlur",
|
||||
focus: "onFontSizeSpinnerFocus",
|
||||
keyup: "onFontSizeSpinnerKeyUp",
|
||||
spin: "onFontSizeSpinnerSpin"
|
||||
},
|
||||
fontNameView: {
|
||||
select: "onFontNameSelect",
|
||||
itemtap: "onFontNameItemTap"
|
||||
},
|
||||
fontBaseUp: {
|
||||
tap: "onFontBaseUpTap"
|
||||
},
|
||||
fontBaseDown: {
|
||||
tap: "onFontBaseDownTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onFontFamily", Ext.bind(this.onApiFontChange, this));
|
||||
this.api.asc_registerCallback("asc_onInitEditorFonts", Ext.bind(this.onApiLoadFonts, this));
|
||||
this.api.asc_registerCallback("asc_onFontSize", Ext.bind(this.onApiFontSize, this));
|
||||
this.api.asc_registerCallback("asc_onVerticalAlign", Ext.bind(this.onApiVerticalAlign, this));
|
||||
this.api.asc_registerCallback("asc_onDocumentContentReady", Ext.bind(this.onDocumentContentReady, this));
|
||||
}
|
||||
},
|
||||
onFontPanelShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onFontPanelHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
var navigateView = this.getNavigateView(),
|
||||
fontSizeSpinner = this.getFontSizeSpinner();
|
||||
if (fontSizeSpinner) {
|
||||
Ext.defer(function () {
|
||||
fontSizeSpinner.blur();
|
||||
},
|
||||
200);
|
||||
}
|
||||
if (navigateView) {
|
||||
navigateView.reset();
|
||||
navigateView.addCls("plain");
|
||||
navigateView.getNavigationBar().hide();
|
||||
var activeItem = navigateView.getActiveItem(),
|
||||
panelSize = this.getSizeById(activeItem && activeItem.id);
|
||||
cmp.setSize(panelSize.width, panelSize.height);
|
||||
}
|
||||
},
|
||||
onFontNameButtonTap: function () {
|
||||
var navigateView = this.getNavigateView(),
|
||||
fontNameView = this.getFontNameView();
|
||||
if (navigateView) {
|
||||
var navigationBar = navigateView.getNavigationBar();
|
||||
if (navigationBar) {
|
||||
navigationBar.show();
|
||||
}
|
||||
navigateView.push(fontNameView);
|
||||
}
|
||||
},
|
||||
onFontSizeSpinnerFocus: function () {
|
||||
this.api && this.api.asc_enableKeyEvents(false);
|
||||
},
|
||||
onFontSizeSpinnerBlur: function (field) {
|
||||
this.api && this.api.asc_enableKeyEvents(true);
|
||||
this.getFontSizeSpinner().setValue(field.getValue());
|
||||
if (this.api) {
|
||||
this.api.put_TextPrFontSize(field.getValue());
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Font Size");
|
||||
}
|
||||
},
|
||||
onFontSizeSpinnerKeyUp: function (field, event) {
|
||||
if (event.browserEvent.keyCode == 13 || event.browserEvent.keyCode == 10) {
|
||||
event.stopEvent();
|
||||
field.element.dom.blur();
|
||||
if (this.api) {
|
||||
this.api.put_TextPrFontSize(field.getValue());
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Font Size");
|
||||
}
|
||||
}
|
||||
},
|
||||
onFontSizeSpinnerSpin: function (spin, value) {
|
||||
if (this.api) {
|
||||
this.api.put_TextPrFontSize(value);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Font Size");
|
||||
}
|
||||
},
|
||||
getSizeById: function (id) {
|
||||
switch (id) {
|
||||
case "id-font-name":
|
||||
return {
|
||||
width: 350,
|
||||
height: 300
|
||||
};
|
||||
default:
|
||||
case "id-font-root":
|
||||
return {
|
||||
width: 440,
|
||||
height: 46
|
||||
};
|
||||
}
|
||||
},
|
||||
toggleSegmentedButton: function (btn) {
|
||||
var toggler = this.getFontBaseToggle();
|
||||
if (toggler) {
|
||||
var pressedButtonsNew = [];
|
||||
if (btn) {
|
||||
pressedButtonsNew.push(btn);
|
||||
}
|
||||
toggler.setPressedButtons(pressedButtonsNew);
|
||||
}
|
||||
},
|
||||
onNavigateViewPush: function (cmp, view) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
panelSize = this.getSizeById(view && view.id);
|
||||
if (parentCmp) {
|
||||
parentCmp.setSize(panelSize.width, panelSize.height);
|
||||
var navigationView = this.getNavigateView();
|
||||
if (navigationView) {
|
||||
navigationView.removeCls("plain");
|
||||
navigationView.getNavigationBar().show();
|
||||
}
|
||||
var fontButton = this.getFontButton();
|
||||
if (fontButton) {
|
||||
parentCmp.alignTo(fontButton);
|
||||
}
|
||||
}
|
||||
},
|
||||
onNavigateViewPop: function (cmp, view) {},
|
||||
onNavigateViewBack: function (cmp) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
activeItem = cmp.getActiveItem(),
|
||||
panelSize = this.getSizeById(activeItem && activeItem.id);
|
||||
if (activeItem && activeItem.id == "id-font-root") {
|
||||
var navigationView = this.getNavigateView();
|
||||
if (navigationView) {
|
||||
navigationView.addCls("plain");
|
||||
navigationView.getNavigationBar().hide();
|
||||
}
|
||||
}
|
||||
if (parentCmp) {
|
||||
parentCmp.setSize(panelSize.width, panelSize.height);
|
||||
var fontButton = this.getFontButton();
|
||||
if (fontButton) {
|
||||
parentCmp.alignTo(fontButton);
|
||||
}
|
||||
}
|
||||
},
|
||||
onFontNameSelect: function (cmp, rec) {
|
||||
var fontNameButton = this.getFontNameButton();
|
||||
if (fontNameButton) {
|
||||
fontNameButton.setText(rec.get("setting"));
|
||||
}
|
||||
},
|
||||
onFontNameItemTap: function (cmp, index, item, rec) {
|
||||
if (this.api) {
|
||||
this.api.put_TextPrFontName(rec.get("setting"));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Font Name");
|
||||
}
|
||||
},
|
||||
onFontBaseUpTap: function (btn) {
|
||||
if (this.api) {
|
||||
var toggler = this.getFontBaseToggle();
|
||||
if (toggler) {
|
||||
this.api.put_TextPrBaseline(toggler.isPressed(btn) ? 1 : 0);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Superscript");
|
||||
}
|
||||
}
|
||||
},
|
||||
onFontBaseDownTap: function (btn) {
|
||||
if (this.api) {
|
||||
var toggler = this.getFontBaseToggle();
|
||||
if (toggler) {
|
||||
this.api.put_TextPrBaseline(toggler.isPressed(btn) ? 2 : 0);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Subscript");
|
||||
}
|
||||
}
|
||||
},
|
||||
onDocumentContentReady: function () {
|
||||
if (this.api) {
|
||||
var fl = this.api.get_PropertyEditorFonts();
|
||||
if (fl) {
|
||||
this.onApiLoadFonts(fl);
|
||||
}
|
||||
}
|
||||
},
|
||||
onApiFontChange: function (font) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
var fontNameView = this.getFontNameView();
|
||||
if (fontNameView) {
|
||||
var fontName = font.get_Name(),
|
||||
fontRec = fontNameView.getStore().findRecord("setting", fontName);
|
||||
if (fontRec) {
|
||||
fontNameView.select(fontRec);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onApiLoadFonts: function (fl) {
|
||||
var fontNameView = this.getFontNameView();
|
||||
if (fontNameView) {
|
||||
var rawFontsArray = [];
|
||||
Ext.each(fl, function (font) {
|
||||
rawFontsArray.push({
|
||||
setting: font.asc_getFontName(),
|
||||
group: "font"
|
||||
});
|
||||
});
|
||||
fontNameView.getStore().setData(rawFontsArray);
|
||||
}
|
||||
},
|
||||
onApiFontSize: function (size) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
var fontSizeSpinner = this.getFontSizeSpinner();
|
||||
if (fontSizeSpinner) {
|
||||
fontSizeSpinner.setValue(size);
|
||||
}
|
||||
}
|
||||
},
|
||||
onApiVerticalAlign: function (type) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
switch (type) {
|
||||
case 1:
|
||||
this.toggleSegmentedButton(this.getFontBaseUp());
|
||||
break;
|
||||
case 2:
|
||||
this.toggleSegmentedButton(this.getFontBaseDown());
|
||||
break;
|
||||
default:
|
||||
this.toggleSegmentedButton();
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.Font", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
fontPanel: "fontpanel",
|
||||
navigateView: "#id-font-navigate",
|
||||
fontSizeSpinner: "fontpanel planarspinnerfield",
|
||||
fontView: "#id-font-root",
|
||||
fontNameView: "#id-font-name",
|
||||
fontNameButton: "#id-btn-fontname",
|
||||
fontButton: "#id-tb-btn-font",
|
||||
fontBaseToggle: "#id-toggle-baseline",
|
||||
fontBaseUp: "#id-btn-baseline-up",
|
||||
fontBaseDown: "#id-btn-baseline-down"
|
||||
},
|
||||
control: {
|
||||
fontPanel: {
|
||||
show: "onFontPanelShow",
|
||||
hide: "onFontPanelHide"
|
||||
},
|
||||
navigateView: {
|
||||
push: "onNavigateViewPush",
|
||||
pop: "onNavigateViewPop",
|
||||
back: "onNavigateViewBack"
|
||||
},
|
||||
fontNameButton: {
|
||||
tap: "onFontNameButtonTap"
|
||||
},
|
||||
fontSizeSpinner: {
|
||||
blur: "onFontSizeSpinnerBlur",
|
||||
focus: "onFontSizeSpinnerFocus",
|
||||
keyup: "onFontSizeSpinnerKeyUp",
|
||||
spin: "onFontSizeSpinnerSpin"
|
||||
},
|
||||
fontNameView: {
|
||||
select: "onFontNameSelect",
|
||||
itemtap: "onFontNameItemTap"
|
||||
},
|
||||
fontBaseUp: {
|
||||
tap: "onFontBaseUpTap"
|
||||
},
|
||||
fontBaseDown: {
|
||||
tap: "onFontBaseDownTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onFontFamily", Ext.bind(this.onApiFontChange, this));
|
||||
this.api.asc_registerCallback("asc_onInitEditorFonts", Ext.bind(this.onApiLoadFonts, this));
|
||||
this.api.asc_registerCallback("asc_onFontSize", Ext.bind(this.onApiFontSize, this));
|
||||
this.api.asc_registerCallback("asc_onVerticalAlign", Ext.bind(this.onApiVerticalAlign, this));
|
||||
this.api.asc_registerCallback("asc_onDocumentContentReady", Ext.bind(this.onDocumentContentReady, this));
|
||||
}
|
||||
},
|
||||
onFontPanelShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onFontPanelHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
var navigateView = this.getNavigateView(),
|
||||
fontSizeSpinner = this.getFontSizeSpinner();
|
||||
if (fontSizeSpinner) {
|
||||
Ext.defer(function () {
|
||||
fontSizeSpinner.blur();
|
||||
},
|
||||
200);
|
||||
}
|
||||
if (navigateView) {
|
||||
navigateView.reset();
|
||||
navigateView.addCls("plain");
|
||||
navigateView.getNavigationBar().hide();
|
||||
var activeItem = navigateView.getActiveItem(),
|
||||
panelSize = this.getSizeById(activeItem && activeItem.id);
|
||||
cmp.setSize(panelSize.width, panelSize.height);
|
||||
}
|
||||
},
|
||||
onFontNameButtonTap: function () {
|
||||
var navigateView = this.getNavigateView(),
|
||||
fontNameView = this.getFontNameView();
|
||||
if (navigateView) {
|
||||
var navigationBar = navigateView.getNavigationBar();
|
||||
if (navigationBar) {
|
||||
navigationBar.show();
|
||||
}
|
||||
navigateView.push(fontNameView);
|
||||
}
|
||||
},
|
||||
onFontSizeSpinnerFocus: function () {
|
||||
this.api && this.api.asc_enableKeyEvents(false);
|
||||
},
|
||||
onFontSizeSpinnerBlur: function (field) {
|
||||
this.api && this.api.asc_enableKeyEvents(true);
|
||||
this.getFontSizeSpinner().setValue(field.getValue());
|
||||
if (this.api) {
|
||||
this.api.put_TextPrFontSize(field.getValue());
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Font Size");
|
||||
}
|
||||
},
|
||||
onFontSizeSpinnerKeyUp: function (field, event) {
|
||||
if (event.browserEvent.keyCode == 13 || event.browserEvent.keyCode == 10) {
|
||||
event.stopEvent();
|
||||
field.element.dom.blur();
|
||||
if (this.api) {
|
||||
this.api.put_TextPrFontSize(field.getValue());
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Font Size");
|
||||
}
|
||||
}
|
||||
},
|
||||
onFontSizeSpinnerSpin: function (spin, value) {
|
||||
if (this.api) {
|
||||
this.api.put_TextPrFontSize(value);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Font Size");
|
||||
}
|
||||
},
|
||||
getSizeById: function (id) {
|
||||
switch (id) {
|
||||
case "id-font-name":
|
||||
return {
|
||||
width: 350,
|
||||
height: 300
|
||||
};
|
||||
default:
|
||||
case "id-font-root":
|
||||
return {
|
||||
width: 440,
|
||||
height: 46
|
||||
};
|
||||
}
|
||||
},
|
||||
toggleSegmentedButton: function (btn) {
|
||||
var toggler = this.getFontBaseToggle();
|
||||
if (toggler) {
|
||||
var pressedButtonsNew = [];
|
||||
if (btn) {
|
||||
pressedButtonsNew.push(btn);
|
||||
}
|
||||
toggler.setPressedButtons(pressedButtonsNew);
|
||||
}
|
||||
},
|
||||
onNavigateViewPush: function (cmp, view) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
panelSize = this.getSizeById(view && view.id);
|
||||
if (parentCmp) {
|
||||
parentCmp.setSize(panelSize.width, panelSize.height);
|
||||
var navigationView = this.getNavigateView();
|
||||
if (navigationView) {
|
||||
navigationView.removeCls("plain");
|
||||
navigationView.getNavigationBar().show();
|
||||
}
|
||||
var fontButton = this.getFontButton();
|
||||
if (fontButton) {
|
||||
parentCmp.alignTo(fontButton);
|
||||
}
|
||||
}
|
||||
},
|
||||
onNavigateViewPop: function (cmp, view) {},
|
||||
onNavigateViewBack: function (cmp) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
activeItem = cmp.getActiveItem(),
|
||||
panelSize = this.getSizeById(activeItem && activeItem.id);
|
||||
if (activeItem && activeItem.id == "id-font-root") {
|
||||
var navigationView = this.getNavigateView();
|
||||
if (navigationView) {
|
||||
navigationView.addCls("plain");
|
||||
navigationView.getNavigationBar().hide();
|
||||
}
|
||||
}
|
||||
if (parentCmp) {
|
||||
parentCmp.setSize(panelSize.width, panelSize.height);
|
||||
var fontButton = this.getFontButton();
|
||||
if (fontButton) {
|
||||
parentCmp.alignTo(fontButton);
|
||||
}
|
||||
}
|
||||
},
|
||||
onFontNameSelect: function (cmp, rec) {
|
||||
var fontNameButton = this.getFontNameButton();
|
||||
if (fontNameButton) {
|
||||
fontNameButton.setText(rec.get("setting"));
|
||||
}
|
||||
},
|
||||
onFontNameItemTap: function (cmp, index, item, rec) {
|
||||
if (this.api) {
|
||||
this.api.put_TextPrFontName(rec.get("setting"));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Font Name");
|
||||
}
|
||||
},
|
||||
onFontBaseUpTap: function (btn) {
|
||||
if (this.api) {
|
||||
var toggler = this.getFontBaseToggle();
|
||||
if (toggler) {
|
||||
this.api.put_TextPrBaseline(toggler.isPressed(btn) ? 1 : 0);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Superscript");
|
||||
}
|
||||
}
|
||||
},
|
||||
onFontBaseDownTap: function (btn) {
|
||||
if (this.api) {
|
||||
var toggler = this.getFontBaseToggle();
|
||||
if (toggler) {
|
||||
this.api.put_TextPrBaseline(toggler.isPressed(btn) ? 2 : 0);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Subscript");
|
||||
}
|
||||
}
|
||||
},
|
||||
onDocumentContentReady: function () {
|
||||
if (this.api) {
|
||||
var fl = this.api.get_PropertyEditorFonts();
|
||||
if (fl) {
|
||||
this.onApiLoadFonts(fl);
|
||||
}
|
||||
}
|
||||
},
|
||||
onApiFontChange: function (font) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
var fontNameView = this.getFontNameView();
|
||||
if (fontNameView) {
|
||||
var fontName = font.get_Name(),
|
||||
fontRec = fontNameView.getStore().findRecord("setting", fontName);
|
||||
if (fontRec) {
|
||||
fontNameView.select(fontRec);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onApiLoadFonts: function (fl) {
|
||||
var fontNameView = this.getFontNameView();
|
||||
if (fontNameView) {
|
||||
var rawFontsArray = [];
|
||||
Ext.each(fl, function (font) {
|
||||
rawFontsArray.push({
|
||||
setting: font.asc_getFontName(),
|
||||
group: "font"
|
||||
});
|
||||
});
|
||||
fontNameView.getStore().setData(rawFontsArray);
|
||||
}
|
||||
},
|
||||
onApiFontSize: function (size) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
var fontSizeSpinner = this.getFontSizeSpinner();
|
||||
if (fontSizeSpinner) {
|
||||
fontSizeSpinner.setValue(size);
|
||||
}
|
||||
}
|
||||
},
|
||||
onApiVerticalAlign: function (type) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
switch (type) {
|
||||
case 1:
|
||||
this.toggleSegmentedButton(this.getFontBaseUp());
|
||||
break;
|
||||
case 2:
|
||||
this.toggleSegmentedButton(this.getFontBaseDown());
|
||||
break;
|
||||
default:
|
||||
this.toggleSegmentedButton();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,130 +1,130 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.FontStyle", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
fontStylePanel: "fontstylepanel",
|
||||
fontStylesToggle: "#id-toggle-fontstyles",
|
||||
fontStyleBold: "#id-btn-fontstyle-bold",
|
||||
fontStyleItalic: "#id-btn-fontstyle-italic",
|
||||
fontStyleUnderline: "#id-btn-fontstyle-underline"
|
||||
},
|
||||
control: {
|
||||
fontStylePanel: {
|
||||
show: "onFontStyleShow",
|
||||
hide: "onFontStyleHide"
|
||||
},
|
||||
fontStyleBold: {
|
||||
tap: "onBoldButtonTap"
|
||||
},
|
||||
fontStyleItalic: {
|
||||
tap: "onItalicButtonTap"
|
||||
},
|
||||
fontStyleUnderline: {
|
||||
tap: "onUnderlineButtonTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onBold", Ext.bind(this.onApiBold, this));
|
||||
this.api.asc_registerCallback("asc_onItalic", Ext.bind(this.onApiItalic, this));
|
||||
this.api.asc_registerCallback("asc_onUnderline", Ext.bind(this.onApiUnderline, this));
|
||||
}
|
||||
},
|
||||
onFontStyleShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onFontStyleHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
},
|
||||
_toggleSegmentedButton: function (btn, toggle) {
|
||||
var toggler = this.getFontStylesToggle();
|
||||
if (toggler && btn) {
|
||||
var pressedButtonsOld = toggler.getPressedButtons().slice(),
|
||||
pressedButtonsNew = toggler.getPressedButtons(),
|
||||
pressedIndex = pressedButtonsNew.indexOf(btn);
|
||||
if (toggle) {
|
||||
if (pressedIndex < 0) {
|
||||
pressedButtonsNew.push(btn);
|
||||
}
|
||||
} else {
|
||||
if (pressedIndex > -1) {
|
||||
pressedButtonsNew.splice(pressedIndex, 1);
|
||||
}
|
||||
}
|
||||
toggler.updatePressedButtons(pressedButtonsNew, pressedButtonsOld);
|
||||
}
|
||||
},
|
||||
onApiBold: function (on) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
this._toggleSegmentedButton(this.getFontStyleBold(), on);
|
||||
}
|
||||
},
|
||||
onApiItalic: function (on) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
this._toggleSegmentedButton(this.getFontStyleItalic(), on);
|
||||
}
|
||||
},
|
||||
onApiUnderline: function (on) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
this._toggleSegmentedButton(this.getFontStyleUnderline(), on);
|
||||
}
|
||||
},
|
||||
onBoldButtonTap: function (btn) {
|
||||
var toggler = this.getFontStylesToggle();
|
||||
if (toggler && this.api) {
|
||||
this.api.put_TextPrBold(toggler.isPressed(btn));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Bold");
|
||||
}
|
||||
},
|
||||
onItalicButtonTap: function (btn) {
|
||||
var toggler = this.getFontStylesToggle();
|
||||
if (toggler && this.api) {
|
||||
this.api.put_TextPrItalic(toggler.isPressed(btn));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Italic");
|
||||
}
|
||||
},
|
||||
onUnderlineButtonTap: function (btn) {
|
||||
var toggler = this.getFontStylesToggle();
|
||||
if (toggler && this.api) {
|
||||
this.api.put_TextPrUnderline(toggler.isPressed(btn));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Underline");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.FontStyle", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
fontStylePanel: "fontstylepanel",
|
||||
fontStylesToggle: "#id-toggle-fontstyles",
|
||||
fontStyleBold: "#id-btn-fontstyle-bold",
|
||||
fontStyleItalic: "#id-btn-fontstyle-italic",
|
||||
fontStyleUnderline: "#id-btn-fontstyle-underline"
|
||||
},
|
||||
control: {
|
||||
fontStylePanel: {
|
||||
show: "onFontStyleShow",
|
||||
hide: "onFontStyleHide"
|
||||
},
|
||||
fontStyleBold: {
|
||||
tap: "onBoldButtonTap"
|
||||
},
|
||||
fontStyleItalic: {
|
||||
tap: "onItalicButtonTap"
|
||||
},
|
||||
fontStyleUnderline: {
|
||||
tap: "onUnderlineButtonTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onBold", Ext.bind(this.onApiBold, this));
|
||||
this.api.asc_registerCallback("asc_onItalic", Ext.bind(this.onApiItalic, this));
|
||||
this.api.asc_registerCallback("asc_onUnderline", Ext.bind(this.onApiUnderline, this));
|
||||
}
|
||||
},
|
||||
onFontStyleShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onFontStyleHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
},
|
||||
_toggleSegmentedButton: function (btn, toggle) {
|
||||
var toggler = this.getFontStylesToggle();
|
||||
if (toggler && btn) {
|
||||
var pressedButtonsOld = toggler.getPressedButtons().slice(),
|
||||
pressedButtonsNew = toggler.getPressedButtons(),
|
||||
pressedIndex = pressedButtonsNew.indexOf(btn);
|
||||
if (toggle) {
|
||||
if (pressedIndex < 0) {
|
||||
pressedButtonsNew.push(btn);
|
||||
}
|
||||
} else {
|
||||
if (pressedIndex > -1) {
|
||||
pressedButtonsNew.splice(pressedIndex, 1);
|
||||
}
|
||||
}
|
||||
toggler.updatePressedButtons(pressedButtonsNew, pressedButtonsOld);
|
||||
}
|
||||
},
|
||||
onApiBold: function (on) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
this._toggleSegmentedButton(this.getFontStyleBold(), on);
|
||||
}
|
||||
},
|
||||
onApiItalic: function (on) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
this._toggleSegmentedButton(this.getFontStyleItalic(), on);
|
||||
}
|
||||
},
|
||||
onApiUnderline: function (on) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
this._toggleSegmentedButton(this.getFontStyleUnderline(), on);
|
||||
}
|
||||
},
|
||||
onBoldButtonTap: function (btn) {
|
||||
var toggler = this.getFontStylesToggle();
|
||||
if (toggler && this.api) {
|
||||
this.api.put_TextPrBold(toggler.isPressed(btn));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Bold");
|
||||
}
|
||||
},
|
||||
onItalicButtonTap: function (btn) {
|
||||
var toggler = this.getFontStylesToggle();
|
||||
if (toggler && this.api) {
|
||||
this.api.put_TextPrItalic(toggler.isPressed(btn));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Italic");
|
||||
}
|
||||
},
|
||||
onUnderlineButtonTap: function (btn) {
|
||||
var toggler = this.getFontStylesToggle();
|
||||
if (toggler && this.api) {
|
||||
this.api.put_TextPrUnderline(toggler.isPressed(btn));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Underline");
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,218 +1,218 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.Insert", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
insertPanel: "insertpanel",
|
||||
navigateView: "#id-insert-navigate",
|
||||
insertListView: "#id-insert-root",
|
||||
insertTableView: "#id-insert-table-container",
|
||||
insertPictureView: "#id-insert-picture-container",
|
||||
insertTableButton: "#id-btn-insert-table",
|
||||
tableColumnsSpinner: "#id-spinner-table-columns",
|
||||
tableRowsSpinner: "#id-spinner-table-rows",
|
||||
insertImageList: "#id-insert-picture-container"
|
||||
},
|
||||
control: {
|
||||
insertPanel: {
|
||||
hide: "onInsertPanelHide"
|
||||
},
|
||||
navigateView: {
|
||||
push: "onNavigateViewPush",
|
||||
pop: "onNavigateViewPop",
|
||||
back: "onNavigateViewBack"
|
||||
},
|
||||
insertListView: {
|
||||
itemsingletap: "onInsertListItemTap"
|
||||
},
|
||||
insertTableButton: {
|
||||
tap: "onInsertTableButtonTap"
|
||||
},
|
||||
insertImageList: {
|
||||
itemtap: "onInsertImageItemTap"
|
||||
}
|
||||
}
|
||||
},
|
||||
init: function () {},
|
||||
onInsertImageListShow: function (list) {
|
||||
var me = this,
|
||||
inputInlineMedia = document.querySelector("#id-insert-picture-inline input[type=file]"),
|
||||
inputFloatMedia = document.querySelector("#id-insert-picture-float input[type=file]");
|
||||
var onChangeInput = function (input) {
|
||||
if (Ext.isDefined(input)) {
|
||||
var file = input.files[0];
|
||||
if (Ext.isDefined(file)) {
|
||||
var panel = me.getInsertPanel(),
|
||||
mpImg = new MegaPixImage(file);
|
||||
mpImg.imageLoadListeners.push(function () {
|
||||
var canvas = document.createElement("canvas"),
|
||||
imgProperty = new CImgProperty();
|
||||
mpImg.render(canvas, {
|
||||
maxWidth: 1024,
|
||||
maxHeight: 1024
|
||||
});
|
||||
imgProperty.put_WrappingStyle((input == inputInlineMedia) ? c_oAscWrapStyle2.Inline : c_oAscWrapStyle2.Square);
|
||||
me.api.AddImageUrl(canvas.toDataURL(), imgProperty);
|
||||
Ext.Viewport.unmask();
|
||||
});
|
||||
input.value = "";
|
||||
panel && panel.hide();
|
||||
Ext.Viewport.setMasked({
|
||||
xtype: "loadmask",
|
||||
message: me.uploadingText + "..."
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
inputInlineMedia && (inputInlineMedia.onchange = Ext.bind(onChangeInput, me, [inputInlineMedia]));
|
||||
inputFloatMedia && (inputFloatMedia.onchange = Ext.bind(onChangeInput, me, [inputFloatMedia]));
|
||||
},
|
||||
launch: function () {
|
||||
var insertImageList = this.getInsertImageList();
|
||||
insertImageList && insertImageList.on("show", Ext.bind(this.onInsertImageListShow, this), this, {
|
||||
delay: 1000,
|
||||
single: true
|
||||
});
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
},
|
||||
onInsertPanelHide: function (cmp) {
|
||||
var navigateView = this.getNavigateView(),
|
||||
tableColumnsSpinner = this.getTableColumnsSpinner(),
|
||||
tableRowsSpinner = this.getTableRowsSpinner();
|
||||
if (navigateView) {
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getInAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getInAnimation().stop();
|
||||
}
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getOutAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getOutAnimation().stop();
|
||||
}
|
||||
navigateView.reset();
|
||||
var activeItem = navigateView.getActiveItem(),
|
||||
panelHeight = this.getHeightById(activeItem && activeItem.id);
|
||||
cmp.setHeight(panelHeight);
|
||||
}
|
||||
tableColumnsSpinner && tableColumnsSpinner.setValue(tableColumnsSpinner.getMinValue());
|
||||
tableRowsSpinner && tableRowsSpinner.setValue(tableRowsSpinner.getMinValue());
|
||||
},
|
||||
onInsertListItemTap: function (cmp, index, target, record) {
|
||||
var navigateView = this.getNavigateView(),
|
||||
cmdId = record.get("id");
|
||||
if (!Ext.isEmpty(cmdId)) {
|
||||
if (cmdId == "id-insert-table-row") {
|
||||
this.insertTableObject("row");
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Insert Row");
|
||||
} else {
|
||||
if (cmdId == "id-insert-table-column") {
|
||||
this.insertTableObject("column");
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Insert Column");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (navigateView) {
|
||||
var cmpId = record.get("child");
|
||||
if (!Ext.isEmpty(cmpId)) {
|
||||
var childCmp = Ext.getCmp(cmpId);
|
||||
if (childCmp) {
|
||||
navigateView.push(childCmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
getHeightById: function (id) {
|
||||
switch (id) {
|
||||
case "id-insert-table-container":
|
||||
return 225;
|
||||
case "id-insert-picture-container":
|
||||
return 174;
|
||||
default:
|
||||
case "id-insert-root":
|
||||
return 283;
|
||||
}
|
||||
},
|
||||
onNavigateViewPush: function (cmp, view) {
|
||||
var parentCmp = cmp.getParent();
|
||||
if (parentCmp) {
|
||||
parentCmp.setHeight(this.getHeightById(view && view.id));
|
||||
}
|
||||
},
|
||||
onNavigateViewPop: function (cmp, view) {},
|
||||
onNavigateViewBack: function (cmp) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
activeItem = cmp.getActiveItem();
|
||||
if (parentCmp && activeItem) {
|
||||
parentCmp.setHeight(this.getHeightById(activeItem && activeItem.id));
|
||||
}
|
||||
},
|
||||
onInsertTableButtonTap: function (btn) {
|
||||
var insertPanel = this.getInsertPanel(),
|
||||
tableColumnsSpinner = this.getTableColumnsSpinner(),
|
||||
tableRowsSpinner = this.getTableRowsSpinner();
|
||||
if (this.api && tableColumnsSpinner && tableRowsSpinner) {
|
||||
this.api.put_Table(tableColumnsSpinner.getValue(), tableRowsSpinner.getValue());
|
||||
}
|
||||
if (insertPanel) {
|
||||
insertPanel.hide();
|
||||
}
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Table");
|
||||
},
|
||||
onInsertImageItemTap: function (list) {
|
||||
if ((Ext.os.is.iOS && Ext.os.version.lt("6.0")) || (Ext.os.is.Android && Ext.os.version.lt("3.0"))) {
|
||||
Ext.Msg.show({
|
||||
message: this.unsupportUploadText,
|
||||
promptConfig: false,
|
||||
buttons: [{
|
||||
text: "OK",
|
||||
itemId: "ok",
|
||||
ui: "base"
|
||||
}]
|
||||
});
|
||||
}
|
||||
},
|
||||
insertTableObject: function (type) {
|
||||
if (this.api) {
|
||||
var selectedElements = this.api.getSelectedElements();
|
||||
if (selectedElements && selectedElements.length > 0) {
|
||||
var elementType = selectedElements[0].get_ObjectType();
|
||||
if (c_oAscTypeSelectElement.Table == elementType) {
|
||||
type === "row" ? this.api.addRowBelow() : type === "column" ? this.api.addColumnRight() : this.api.put_Table(1, 1);
|
||||
} else {
|
||||
this.api.put_Table(1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
uploadingText: "Uploading",
|
||||
unsupportUploadText: "Feature is not supported on this device."
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.Insert", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
insertPanel: "insertpanel",
|
||||
navigateView: "#id-insert-navigate",
|
||||
insertListView: "#id-insert-root",
|
||||
insertTableView: "#id-insert-table-container",
|
||||
insertPictureView: "#id-insert-picture-container",
|
||||
insertTableButton: "#id-btn-insert-table",
|
||||
tableColumnsSpinner: "#id-spinner-table-columns",
|
||||
tableRowsSpinner: "#id-spinner-table-rows",
|
||||
insertImageList: "#id-insert-picture-container"
|
||||
},
|
||||
control: {
|
||||
insertPanel: {
|
||||
hide: "onInsertPanelHide"
|
||||
},
|
||||
navigateView: {
|
||||
push: "onNavigateViewPush",
|
||||
pop: "onNavigateViewPop",
|
||||
back: "onNavigateViewBack"
|
||||
},
|
||||
insertListView: {
|
||||
itemsingletap: "onInsertListItemTap"
|
||||
},
|
||||
insertTableButton: {
|
||||
tap: "onInsertTableButtonTap"
|
||||
},
|
||||
insertImageList: {
|
||||
itemtap: "onInsertImageItemTap"
|
||||
}
|
||||
}
|
||||
},
|
||||
init: function () {},
|
||||
onInsertImageListShow: function (list) {
|
||||
var me = this,
|
||||
inputInlineMedia = document.querySelector("#id-insert-picture-inline input[type=file]"),
|
||||
inputFloatMedia = document.querySelector("#id-insert-picture-float input[type=file]");
|
||||
var onChangeInput = function (input) {
|
||||
if (Ext.isDefined(input)) {
|
||||
var file = input.files[0];
|
||||
if (Ext.isDefined(file)) {
|
||||
var panel = me.getInsertPanel(),
|
||||
mpImg = new MegaPixImage(file);
|
||||
mpImg.imageLoadListeners.push(function () {
|
||||
var canvas = document.createElement("canvas"),
|
||||
imgProperty = new CImgProperty();
|
||||
mpImg.render(canvas, {
|
||||
maxWidth: 1024,
|
||||
maxHeight: 1024
|
||||
});
|
||||
imgProperty.put_WrappingStyle((input == inputInlineMedia) ? c_oAscWrapStyle2.Inline : c_oAscWrapStyle2.Square);
|
||||
me.api.AddImageUrl(canvas.toDataURL(), imgProperty);
|
||||
Ext.Viewport.unmask();
|
||||
});
|
||||
input.value = "";
|
||||
panel && panel.hide();
|
||||
Ext.Viewport.setMasked({
|
||||
xtype: "loadmask",
|
||||
message: me.uploadingText + "..."
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
inputInlineMedia && (inputInlineMedia.onchange = Ext.bind(onChangeInput, me, [inputInlineMedia]));
|
||||
inputFloatMedia && (inputFloatMedia.onchange = Ext.bind(onChangeInput, me, [inputFloatMedia]));
|
||||
},
|
||||
launch: function () {
|
||||
var insertImageList = this.getInsertImageList();
|
||||
insertImageList && insertImageList.on("show", Ext.bind(this.onInsertImageListShow, this), this, {
|
||||
delay: 1000,
|
||||
single: true
|
||||
});
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
},
|
||||
onInsertPanelHide: function (cmp) {
|
||||
var navigateView = this.getNavigateView(),
|
||||
tableColumnsSpinner = this.getTableColumnsSpinner(),
|
||||
tableRowsSpinner = this.getTableRowsSpinner();
|
||||
if (navigateView) {
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getInAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getInAnimation().stop();
|
||||
}
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getOutAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getOutAnimation().stop();
|
||||
}
|
||||
navigateView.reset();
|
||||
var activeItem = navigateView.getActiveItem(),
|
||||
panelHeight = this.getHeightById(activeItem && activeItem.id);
|
||||
cmp.setHeight(panelHeight);
|
||||
}
|
||||
tableColumnsSpinner && tableColumnsSpinner.setValue(tableColumnsSpinner.getMinValue());
|
||||
tableRowsSpinner && tableRowsSpinner.setValue(tableRowsSpinner.getMinValue());
|
||||
},
|
||||
onInsertListItemTap: function (cmp, index, target, record) {
|
||||
var navigateView = this.getNavigateView(),
|
||||
cmdId = record.get("id");
|
||||
if (!Ext.isEmpty(cmdId)) {
|
||||
if (cmdId == "id-insert-table-row") {
|
||||
this.insertTableObject("row");
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Insert Row");
|
||||
} else {
|
||||
if (cmdId == "id-insert-table-column") {
|
||||
this.insertTableObject("column");
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Insert Column");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (navigateView) {
|
||||
var cmpId = record.get("child");
|
||||
if (!Ext.isEmpty(cmpId)) {
|
||||
var childCmp = Ext.getCmp(cmpId);
|
||||
if (childCmp) {
|
||||
navigateView.push(childCmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
getHeightById: function (id) {
|
||||
switch (id) {
|
||||
case "id-insert-table-container":
|
||||
return 225;
|
||||
case "id-insert-picture-container":
|
||||
return 174;
|
||||
default:
|
||||
case "id-insert-root":
|
||||
return 283;
|
||||
}
|
||||
},
|
||||
onNavigateViewPush: function (cmp, view) {
|
||||
var parentCmp = cmp.getParent();
|
||||
if (parentCmp) {
|
||||
parentCmp.setHeight(this.getHeightById(view && view.id));
|
||||
}
|
||||
},
|
||||
onNavigateViewPop: function (cmp, view) {},
|
||||
onNavigateViewBack: function (cmp) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
activeItem = cmp.getActiveItem();
|
||||
if (parentCmp && activeItem) {
|
||||
parentCmp.setHeight(this.getHeightById(activeItem && activeItem.id));
|
||||
}
|
||||
},
|
||||
onInsertTableButtonTap: function (btn) {
|
||||
var insertPanel = this.getInsertPanel(),
|
||||
tableColumnsSpinner = this.getTableColumnsSpinner(),
|
||||
tableRowsSpinner = this.getTableRowsSpinner();
|
||||
if (this.api && tableColumnsSpinner && tableRowsSpinner) {
|
||||
this.api.put_Table(tableColumnsSpinner.getValue(), tableRowsSpinner.getValue());
|
||||
}
|
||||
if (insertPanel) {
|
||||
insertPanel.hide();
|
||||
}
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Table");
|
||||
},
|
||||
onInsertImageItemTap: function (list) {
|
||||
if ((Ext.os.is.iOS && Ext.os.version.lt("6.0")) || (Ext.os.is.Android && Ext.os.version.lt("3.0"))) {
|
||||
Ext.Msg.show({
|
||||
message: this.unsupportUploadText,
|
||||
promptConfig: false,
|
||||
buttons: [{
|
||||
text: "OK",
|
||||
itemId: "ok",
|
||||
ui: "base"
|
||||
}]
|
||||
});
|
||||
}
|
||||
},
|
||||
insertTableObject: function (type) {
|
||||
if (this.api) {
|
||||
var selectedElements = this.api.getSelectedElements();
|
||||
if (selectedElements && selectedElements.length > 0) {
|
||||
var elementType = selectedElements[0].get_ObjectType();
|
||||
if (c_oAscTypeSelectElement.Table == elementType) {
|
||||
type === "row" ? this.api.addRowBelow() : type === "column" ? this.api.addColumnRight() : this.api.put_Table(1, 1);
|
||||
} else {
|
||||
this.api.put_Table(1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
uploadingText: "Uploading",
|
||||
unsupportUploadText: "Feature is not supported on this device."
|
||||
});
|
||||
@@ -1,152 +1,152 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.ParagraphAlignment", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
paraAlignPanel: "paragraphalignmentpanel",
|
||||
paraAlignsToggle: "#id-toggle-paragraphalignment",
|
||||
paragraphAlignmentButton: "#id-tb-btn-align",
|
||||
paraAlignLeft: "#id-btn-paragraphalignment-left",
|
||||
paraAlignCenter: "#id-btn-paragraphalignment-center",
|
||||
paraAlignRight: "#id-btn-paragraphalignment-right",
|
||||
paraAlignFill: "#id-btn-paragraphalignment-fill"
|
||||
},
|
||||
control: {
|
||||
paraAlignPanel: {
|
||||
show: "onParaAlignPanelShow",
|
||||
hide: "onParaAlignPanelHide"
|
||||
},
|
||||
paraAlignLeft: {
|
||||
tap: "onParaAlignLeftTap"
|
||||
},
|
||||
paraAlignCenter: {
|
||||
tap: "onParaAlignCenterTap"
|
||||
},
|
||||
paraAlignRight: {
|
||||
tap: "onParaAlignRightTap"
|
||||
},
|
||||
paraAlignFill: {
|
||||
tap: "onParaAlignFillTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
onParaAlignPanelShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onParaAlignPanelHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onPrAlign", Ext.bind(this.onApiParagraphAlign, this));
|
||||
}
|
||||
},
|
||||
onParaAlignLeftTap: function (btn) {
|
||||
if (this.api) {
|
||||
this.api.put_PrAlign(1);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Align");
|
||||
}
|
||||
},
|
||||
onParaAlignCenterTap: function (btn) {
|
||||
if (this.api) {
|
||||
this.api.put_PrAlign(2);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Align");
|
||||
}
|
||||
},
|
||||
onParaAlignRightTap: function (btn) {
|
||||
if (this.api) {
|
||||
this.api.put_PrAlign(0);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Align");
|
||||
}
|
||||
},
|
||||
onParaAlignFillTap: function (btn) {
|
||||
if (this.api) {
|
||||
this.api.put_PrAlign(3);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Align");
|
||||
}
|
||||
},
|
||||
toggleSegmentedButton: function (btn) {
|
||||
var toggler = this.getParaAlignsToggle();
|
||||
if (toggler) {
|
||||
var pressedButtonsNew = [];
|
||||
if (btn) {
|
||||
pressedButtonsNew.push(btn);
|
||||
}
|
||||
toggler.setPressedButtons(pressedButtonsNew);
|
||||
}
|
||||
},
|
||||
onApiParagraphAlign: function (v) {
|
||||
var paragraphAlignmentButton = this.getParagraphAlignmentButton();
|
||||
if (paragraphAlignmentButton && Ext.isDefined(v)) {
|
||||
switch (v) {
|
||||
case 0:
|
||||
paragraphAlignmentButton.setIconCls("align-right");
|
||||
break;
|
||||
case 1:
|
||||
paragraphAlignmentButton.setIconCls("align-left");
|
||||
break;
|
||||
case 2:
|
||||
paragraphAlignmentButton.setIconCls("align-center");
|
||||
break;
|
||||
default:
|
||||
case 3:
|
||||
paragraphAlignmentButton.setIconCls("align-fill");
|
||||
}
|
||||
}
|
||||
if (this.getHandleApiEvent()) {
|
||||
if (!Ext.isDefined(v)) {
|
||||
this.toggleSegmentedButton();
|
||||
return;
|
||||
}
|
||||
switch (v) {
|
||||
case 0:
|
||||
this.toggleSegmentedButton(this.getParaAlignRight());
|
||||
break;
|
||||
case 1:
|
||||
this.toggleSegmentedButton(this.getParaAlignLeft());
|
||||
break;
|
||||
case 2:
|
||||
this.toggleSegmentedButton(this.getParaAlignCenter());
|
||||
break;
|
||||
default:
|
||||
case 3:
|
||||
this.toggleSegmentedButton(this.getParaAlignFill());
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.ParagraphAlignment", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
paraAlignPanel: "paragraphalignmentpanel",
|
||||
paraAlignsToggle: "#id-toggle-paragraphalignment",
|
||||
paragraphAlignmentButton: "#id-tb-btn-align",
|
||||
paraAlignLeft: "#id-btn-paragraphalignment-left",
|
||||
paraAlignCenter: "#id-btn-paragraphalignment-center",
|
||||
paraAlignRight: "#id-btn-paragraphalignment-right",
|
||||
paraAlignFill: "#id-btn-paragraphalignment-fill"
|
||||
},
|
||||
control: {
|
||||
paraAlignPanel: {
|
||||
show: "onParaAlignPanelShow",
|
||||
hide: "onParaAlignPanelHide"
|
||||
},
|
||||
paraAlignLeft: {
|
||||
tap: "onParaAlignLeftTap"
|
||||
},
|
||||
paraAlignCenter: {
|
||||
tap: "onParaAlignCenterTap"
|
||||
},
|
||||
paraAlignRight: {
|
||||
tap: "onParaAlignRightTap"
|
||||
},
|
||||
paraAlignFill: {
|
||||
tap: "onParaAlignFillTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
onParaAlignPanelShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onParaAlignPanelHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onPrAlign", Ext.bind(this.onApiParagraphAlign, this));
|
||||
}
|
||||
},
|
||||
onParaAlignLeftTap: function (btn) {
|
||||
if (this.api) {
|
||||
this.api.put_PrAlign(1);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Align");
|
||||
}
|
||||
},
|
||||
onParaAlignCenterTap: function (btn) {
|
||||
if (this.api) {
|
||||
this.api.put_PrAlign(2);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Align");
|
||||
}
|
||||
},
|
||||
onParaAlignRightTap: function (btn) {
|
||||
if (this.api) {
|
||||
this.api.put_PrAlign(0);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Align");
|
||||
}
|
||||
},
|
||||
onParaAlignFillTap: function (btn) {
|
||||
if (this.api) {
|
||||
this.api.put_PrAlign(3);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Align");
|
||||
}
|
||||
},
|
||||
toggleSegmentedButton: function (btn) {
|
||||
var toggler = this.getParaAlignsToggle();
|
||||
if (toggler) {
|
||||
var pressedButtonsNew = [];
|
||||
if (btn) {
|
||||
pressedButtonsNew.push(btn);
|
||||
}
|
||||
toggler.setPressedButtons(pressedButtonsNew);
|
||||
}
|
||||
},
|
||||
onApiParagraphAlign: function (v) {
|
||||
var paragraphAlignmentButton = this.getParagraphAlignmentButton();
|
||||
if (paragraphAlignmentButton && Ext.isDefined(v)) {
|
||||
switch (v) {
|
||||
case 0:
|
||||
paragraphAlignmentButton.setIconCls("align-right");
|
||||
break;
|
||||
case 1:
|
||||
paragraphAlignmentButton.setIconCls("align-left");
|
||||
break;
|
||||
case 2:
|
||||
paragraphAlignmentButton.setIconCls("align-center");
|
||||
break;
|
||||
default:
|
||||
case 3:
|
||||
paragraphAlignmentButton.setIconCls("align-fill");
|
||||
}
|
||||
}
|
||||
if (this.getHandleApiEvent()) {
|
||||
if (!Ext.isDefined(v)) {
|
||||
this.toggleSegmentedButton();
|
||||
return;
|
||||
}
|
||||
switch (v) {
|
||||
case 0:
|
||||
this.toggleSegmentedButton(this.getParaAlignRight());
|
||||
break;
|
||||
case 1:
|
||||
this.toggleSegmentedButton(this.getParaAlignLeft());
|
||||
break;
|
||||
case 2:
|
||||
this.toggleSegmentedButton(this.getParaAlignCenter());
|
||||
break;
|
||||
default:
|
||||
case 3:
|
||||
this.toggleSegmentedButton(this.getParaAlignFill());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,180 +1,180 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.Spacing", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
spacingPanel: "spacingpanel",
|
||||
navigateView: "#id-spacing-navigate",
|
||||
spacingListView: "#id-spacing-root",
|
||||
spacingValueListView: "#id-spacing-linespacing"
|
||||
},
|
||||
control: {
|
||||
spacingPanel: {
|
||||
show: "onSpacingPanelShow",
|
||||
hide: "onSpacingPanelHide"
|
||||
},
|
||||
navigateView: {
|
||||
push: "onSpacingListViewPush",
|
||||
pop: "onSpacingListViewPop",
|
||||
back: "onSpacingListViewBack"
|
||||
},
|
||||
spacingListView: {
|
||||
itemsingletap: "onSpacingListItemTap"
|
||||
},
|
||||
spacingValueListView: {
|
||||
itemsingletap: "onSpacingValueListItemTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onParaSpacingLine", Ext.bind(this.onApiLineSpacing, this));
|
||||
}
|
||||
},
|
||||
onSpacingPanelShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onSpacingPanelHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
var navigateView = this.getNavigateView();
|
||||
if (navigateView) {
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getInAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getInAnimation().stop();
|
||||
}
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getOutAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getOutAnimation().stop();
|
||||
}
|
||||
navigateView.reset();
|
||||
var activeItem = navigateView.getActiveItem(),
|
||||
panelHeight = this.getHeightById(activeItem && activeItem.id);
|
||||
cmp.setHeight(panelHeight);
|
||||
}
|
||||
},
|
||||
onSpacingListItemTap: function (cmp, index, target, record) {
|
||||
var navigateView = this.getNavigateView(),
|
||||
cmdId = record.get("id");
|
||||
if (!Ext.isEmpty(cmdId)) {
|
||||
if (cmdId == "id-linespacing-increaseindent") {
|
||||
this.api && this.api.IncreaseIndent();
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Indent");
|
||||
} else {
|
||||
if (cmdId == "id-linespacing-decrementindent") {
|
||||
this.api && this.api.DecreaseIndent();
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Indent");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (navigateView) {
|
||||
var cmpId = record.get("child");
|
||||
if (!Ext.isEmpty(cmpId)) {
|
||||
var childCmp = Ext.getCmp(cmpId);
|
||||
if (childCmp) {
|
||||
navigateView.push(childCmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onSpacingValueListItemTap: function (cmp, index, target, record) {
|
||||
var spacingVal = parseFloat(record.get("setting")),
|
||||
LINERULE_AUTO = 1;
|
||||
this.api && this.api.put_PrLineSpacing(LINERULE_AUTO, spacingVal);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Line Spacing");
|
||||
},
|
||||
getHeightById: function (id) {
|
||||
switch (id) {
|
||||
case "id-spacing-linespacing":
|
||||
return 360;
|
||||
default:
|
||||
case "id-spacing-root":
|
||||
return 235;
|
||||
}
|
||||
},
|
||||
onSpacingListViewPush: function (cmp, view) {
|
||||
var parentCmp = cmp.getParent();
|
||||
if (parentCmp) {
|
||||
parentCmp.setHeight(this.getHeightById(view.id));
|
||||
}
|
||||
},
|
||||
onSpacingListViewPop: function (cmp, view) {},
|
||||
onSpacingListViewBack: function (cmp) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
activeItem = cmp.getActiveItem();
|
||||
if (parentCmp && activeItem) {
|
||||
parentCmp.setHeight(this.getHeightById(activeItem && activeItem.id));
|
||||
}
|
||||
},
|
||||
onApiLineSpacing: function (info) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
if (Ext.isDefined(info)) {
|
||||
var spacingValueListView = this.getSpacingValueListView();
|
||||
if (spacingValueListView) {
|
||||
if (info.get_Line() === null || info.get_LineRule() === null || info.get_LineRule() != 1) {
|
||||
spacingValueListView.deselectAll();
|
||||
return;
|
||||
}
|
||||
var line = info.get_Line();
|
||||
if (Math.abs(line - 1) < 0.0001) {
|
||||
spacingValueListView.select(0);
|
||||
} else {
|
||||
if (Math.abs(line - 1.15) < 0.0001) {
|
||||
spacingValueListView.select(1);
|
||||
} else {
|
||||
if (Math.abs(line - 1.5) < 0.0001) {
|
||||
spacingValueListView.select(2);
|
||||
} else {
|
||||
if (Math.abs(line - 2) < 0.0001) {
|
||||
spacingValueListView.select(3);
|
||||
} else {
|
||||
if (Math.abs(line - 2.5) < 0.0001) {
|
||||
spacingValueListView.select(4);
|
||||
} else {
|
||||
if (Math.abs(line - 3) < 0.0001) {
|
||||
spacingValueListView.select(5);
|
||||
} else {
|
||||
spacingValueListView.deselectAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.Spacing", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
spacingPanel: "spacingpanel",
|
||||
navigateView: "#id-spacing-navigate",
|
||||
spacingListView: "#id-spacing-root",
|
||||
spacingValueListView: "#id-spacing-linespacing"
|
||||
},
|
||||
control: {
|
||||
spacingPanel: {
|
||||
show: "onSpacingPanelShow",
|
||||
hide: "onSpacingPanelHide"
|
||||
},
|
||||
navigateView: {
|
||||
push: "onSpacingListViewPush",
|
||||
pop: "onSpacingListViewPop",
|
||||
back: "onSpacingListViewBack"
|
||||
},
|
||||
spacingListView: {
|
||||
itemsingletap: "onSpacingListItemTap"
|
||||
},
|
||||
spacingValueListView: {
|
||||
itemsingletap: "onSpacingValueListItemTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onParaSpacingLine", Ext.bind(this.onApiLineSpacing, this));
|
||||
}
|
||||
},
|
||||
onSpacingPanelShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onSpacingPanelHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
var navigateView = this.getNavigateView();
|
||||
if (navigateView) {
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getInAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getInAnimation().stop();
|
||||
}
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getOutAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getOutAnimation().stop();
|
||||
}
|
||||
navigateView.reset();
|
||||
var activeItem = navigateView.getActiveItem(),
|
||||
panelHeight = this.getHeightById(activeItem && activeItem.id);
|
||||
cmp.setHeight(panelHeight);
|
||||
}
|
||||
},
|
||||
onSpacingListItemTap: function (cmp, index, target, record) {
|
||||
var navigateView = this.getNavigateView(),
|
||||
cmdId = record.get("id");
|
||||
if (!Ext.isEmpty(cmdId)) {
|
||||
if (cmdId == "id-linespacing-increaseindent") {
|
||||
this.api && this.api.IncreaseIndent();
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Indent");
|
||||
} else {
|
||||
if (cmdId == "id-linespacing-decrementindent") {
|
||||
this.api && this.api.DecreaseIndent();
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Indent");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (navigateView) {
|
||||
var cmpId = record.get("child");
|
||||
if (!Ext.isEmpty(cmpId)) {
|
||||
var childCmp = Ext.getCmp(cmpId);
|
||||
if (childCmp) {
|
||||
navigateView.push(childCmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onSpacingValueListItemTap: function (cmp, index, target, record) {
|
||||
var spacingVal = parseFloat(record.get("setting")),
|
||||
LINERULE_AUTO = 1;
|
||||
this.api && this.api.put_PrLineSpacing(LINERULE_AUTO, spacingVal);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Line Spacing");
|
||||
},
|
||||
getHeightById: function (id) {
|
||||
switch (id) {
|
||||
case "id-spacing-linespacing":
|
||||
return 360;
|
||||
default:
|
||||
case "id-spacing-root":
|
||||
return 235;
|
||||
}
|
||||
},
|
||||
onSpacingListViewPush: function (cmp, view) {
|
||||
var parentCmp = cmp.getParent();
|
||||
if (parentCmp) {
|
||||
parentCmp.setHeight(this.getHeightById(view.id));
|
||||
}
|
||||
},
|
||||
onSpacingListViewPop: function (cmp, view) {},
|
||||
onSpacingListViewBack: function (cmp) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
activeItem = cmp.getActiveItem();
|
||||
if (parentCmp && activeItem) {
|
||||
parentCmp.setHeight(this.getHeightById(activeItem && activeItem.id));
|
||||
}
|
||||
},
|
||||
onApiLineSpacing: function (info) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
if (Ext.isDefined(info)) {
|
||||
var spacingValueListView = this.getSpacingValueListView();
|
||||
if (spacingValueListView) {
|
||||
if (info.get_Line() === null || info.get_LineRule() === null || info.get_LineRule() != 1) {
|
||||
spacingValueListView.deselectAll();
|
||||
return;
|
||||
}
|
||||
var line = info.get_Line();
|
||||
if (Math.abs(line - 1) < 0.0001) {
|
||||
spacingValueListView.select(0);
|
||||
} else {
|
||||
if (Math.abs(line - 1.15) < 0.0001) {
|
||||
spacingValueListView.select(1);
|
||||
} else {
|
||||
if (Math.abs(line - 1.5) < 0.0001) {
|
||||
spacingValueListView.select(2);
|
||||
} else {
|
||||
if (Math.abs(line - 2) < 0.0001) {
|
||||
spacingValueListView.select(3);
|
||||
} else {
|
||||
if (Math.abs(line - 2.5) < 0.0001) {
|
||||
spacingValueListView.select(4);
|
||||
} else {
|
||||
if (Math.abs(line - 3) < 0.0001) {
|
||||
spacingValueListView.select(5);
|
||||
} else {
|
||||
spacingValueListView.deselectAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,156 +1,156 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.Style", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
listStylePanel: "liststylepanel",
|
||||
navigateView: "#id-liststyle-navigate",
|
||||
listStyleView: "#id-liststyle-root",
|
||||
bulletsListView: "#id-liststyle-bullets",
|
||||
numberingListView: "#id-liststyle-numbering",
|
||||
outlineListView: "#id-liststyle-outline",
|
||||
bulletsList: "#id-liststyle-bullets dataview",
|
||||
numberingList: "#id-liststyle-numbering dataview",
|
||||
outlineList: "#id-liststyle-outline dataview"
|
||||
},
|
||||
control: {
|
||||
listStylePanel: {
|
||||
show: "onListStylePanelShow",
|
||||
hide: "onListStylePanelHide"
|
||||
},
|
||||
navigateView: {
|
||||
push: "onListStyleViewPush",
|
||||
pop: "onListStyleViewPop",
|
||||
back: "onListStyleViewBack"
|
||||
},
|
||||
listStyleView: {
|
||||
itemsingletap: "onListStyleItemTap"
|
||||
},
|
||||
bulletsList: {
|
||||
itemsingletap: "onCommonListItemTap"
|
||||
},
|
||||
numberingList: {
|
||||
itemsingletap: "onCommonListItemTap"
|
||||
},
|
||||
outlineList: {
|
||||
itemsingletap: "onCommonListItemTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
},
|
||||
onListStylePanelShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onListStylePanelHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
var navigateView = this.getNavigateView();
|
||||
if (navigateView) {
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getInAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getInAnimation().stop();
|
||||
}
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getOutAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getOutAnimation().stop();
|
||||
}
|
||||
navigateView.reset();
|
||||
var activeItem = navigateView.getActiveItem(),
|
||||
panelHeight = this.getHeightById(activeItem && activeItem.id);
|
||||
cmp.setHeight(panelHeight);
|
||||
}
|
||||
},
|
||||
onListStyleItemTap: function (cmp, index, target, record) {
|
||||
var navigateView = this.getNavigateView(),
|
||||
cmdId = record.get("id");
|
||||
if (!Ext.isEmpty(cmdId)) {
|
||||
if (cmdId == "id-list-indent-increment") {
|
||||
this.onIncrementIndentButton();
|
||||
} else {
|
||||
if (cmdId == "id-list-indent-decrement") {
|
||||
this.onDecrementIndentButton();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (navigateView) {
|
||||
var childId = record.get("child");
|
||||
if (!Ext.isEmpty(childId)) {
|
||||
var childCmp = Ext.getCmp(childId);
|
||||
if (childCmp) {
|
||||
navigateView.push(childCmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
getHeightById: function (id) {
|
||||
switch (id) {
|
||||
case "id-liststyle-bullets":
|
||||
case "id-liststyle-numbering":
|
||||
return 225;
|
||||
case "id-liststyle-outline":
|
||||
return 150;
|
||||
default:
|
||||
case "id-liststyle-root":
|
||||
return 328;
|
||||
}
|
||||
},
|
||||
onListStyleViewPush: function (cmp, view) {
|
||||
var parentCmp = cmp.getParent();
|
||||
if (parentCmp) {
|
||||
parentCmp.setHeight(this.getHeightById(view.id));
|
||||
}
|
||||
},
|
||||
onListStyleViewPop: function (cmp, view) {},
|
||||
onListStyleViewBack: function (cmp) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
activeItem = cmp.getActiveItem();
|
||||
if (parentCmp && activeItem) {
|
||||
parentCmp.setHeight(this.getHeightById(activeItem && activeItem.id));
|
||||
}
|
||||
},
|
||||
onCommonListItemTap: function (view, index, target, record) {
|
||||
this.api && this.api.put_ListType(parseInt(record.get("type")), parseInt(record.get("subtype")));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "List Type");
|
||||
},
|
||||
onIncrementIndentButton: function () {
|
||||
this.api && this.api.IncreaseIndent();
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Indent");
|
||||
},
|
||||
onDecrementIndentButton: function () {
|
||||
this.api && this.api.DecreaseIndent();
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Indent");
|
||||
}
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.Style", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
listStylePanel: "liststylepanel",
|
||||
navigateView: "#id-liststyle-navigate",
|
||||
listStyleView: "#id-liststyle-root",
|
||||
bulletsListView: "#id-liststyle-bullets",
|
||||
numberingListView: "#id-liststyle-numbering",
|
||||
outlineListView: "#id-liststyle-outline",
|
||||
bulletsList: "#id-liststyle-bullets dataview",
|
||||
numberingList: "#id-liststyle-numbering dataview",
|
||||
outlineList: "#id-liststyle-outline dataview"
|
||||
},
|
||||
control: {
|
||||
listStylePanel: {
|
||||
show: "onListStylePanelShow",
|
||||
hide: "onListStylePanelHide"
|
||||
},
|
||||
navigateView: {
|
||||
push: "onListStyleViewPush",
|
||||
pop: "onListStyleViewPop",
|
||||
back: "onListStyleViewBack"
|
||||
},
|
||||
listStyleView: {
|
||||
itemsingletap: "onListStyleItemTap"
|
||||
},
|
||||
bulletsList: {
|
||||
itemsingletap: "onCommonListItemTap"
|
||||
},
|
||||
numberingList: {
|
||||
itemsingletap: "onCommonListItemTap"
|
||||
},
|
||||
outlineList: {
|
||||
itemsingletap: "onCommonListItemTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
},
|
||||
onListStylePanelShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onListStylePanelHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
var navigateView = this.getNavigateView();
|
||||
if (navigateView) {
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getInAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getInAnimation().stop();
|
||||
}
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getOutAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getOutAnimation().stop();
|
||||
}
|
||||
navigateView.reset();
|
||||
var activeItem = navigateView.getActiveItem(),
|
||||
panelHeight = this.getHeightById(activeItem && activeItem.id);
|
||||
cmp.setHeight(panelHeight);
|
||||
}
|
||||
},
|
||||
onListStyleItemTap: function (cmp, index, target, record) {
|
||||
var navigateView = this.getNavigateView(),
|
||||
cmdId = record.get("id");
|
||||
if (!Ext.isEmpty(cmdId)) {
|
||||
if (cmdId == "id-list-indent-increment") {
|
||||
this.onIncrementIndentButton();
|
||||
} else {
|
||||
if (cmdId == "id-list-indent-decrement") {
|
||||
this.onDecrementIndentButton();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (navigateView) {
|
||||
var childId = record.get("child");
|
||||
if (!Ext.isEmpty(childId)) {
|
||||
var childCmp = Ext.getCmp(childId);
|
||||
if (childCmp) {
|
||||
navigateView.push(childCmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
getHeightById: function (id) {
|
||||
switch (id) {
|
||||
case "id-liststyle-bullets":
|
||||
case "id-liststyle-numbering":
|
||||
return 225;
|
||||
case "id-liststyle-outline":
|
||||
return 150;
|
||||
default:
|
||||
case "id-liststyle-root":
|
||||
return 328;
|
||||
}
|
||||
},
|
||||
onListStyleViewPush: function (cmp, view) {
|
||||
var parentCmp = cmp.getParent();
|
||||
if (parentCmp) {
|
||||
parentCmp.setHeight(this.getHeightById(view.id));
|
||||
}
|
||||
},
|
||||
onListStyleViewPop: function (cmp, view) {},
|
||||
onListStyleViewBack: function (cmp) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
activeItem = cmp.getActiveItem();
|
||||
if (parentCmp && activeItem) {
|
||||
parentCmp.setHeight(this.getHeightById(activeItem && activeItem.id));
|
||||
}
|
||||
},
|
||||
onCommonListItemTap: function (view, index, target, record) {
|
||||
this.api && this.api.put_ListType(parseInt(record.get("type")), parseInt(record.get("subtype")));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "List Type");
|
||||
},
|
||||
onIncrementIndentButton: function () {
|
||||
this.api && this.api.IncreaseIndent();
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Indent");
|
||||
},
|
||||
onDecrementIndentButton: function () {
|
||||
this.api && this.api.DecreaseIndent();
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Indent");
|
||||
}
|
||||
});
|
||||
@@ -1,258 +1,258 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.TextColor", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
textColorPanel: "textcolorsettingspanel",
|
||||
navigateView: "#id-textcolor-navigate",
|
||||
textColorView: "#id-textcolor-root",
|
||||
highlightColorList: "#id-textcolor-highlight dataview",
|
||||
textColorList: "#id-textcolor-text dataview",
|
||||
noFillColorButton: "#id-btn-highlight-none"
|
||||
},
|
||||
control: {
|
||||
textColorPanel: {
|
||||
show: "onTextColorPanelShow",
|
||||
hide: "onTextColorPanelHide"
|
||||
},
|
||||
navigateView: {
|
||||
push: "onNavigateViewPush",
|
||||
pop: "onNavigateViewPop",
|
||||
back: "onNavigateViewBack"
|
||||
},
|
||||
textColorView: {
|
||||
itemsingletap: "onTextColorItemTap"
|
||||
},
|
||||
highlightColorList: {
|
||||
itemsingletap: "onHighlightListItemTap"
|
||||
},
|
||||
noFillColorButton: {
|
||||
tap: "onNoFillColorTap"
|
||||
},
|
||||
textColorList: {
|
||||
itemsingletap: "onTextColorListItemTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onTextColor", Ext.bind(this.onApiTextColor, this));
|
||||
this.api.asc_registerCallback("asc_onTextHighLight", Ext.bind(this.onApiHighlightColor, this));
|
||||
}
|
||||
},
|
||||
onTextColorPanelShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onTextColorPanelHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
var navigateView = this.getNavigateView();
|
||||
if (navigateView) {
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getInAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getInAnimation().stop();
|
||||
}
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getOutAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getOutAnimation().stop();
|
||||
}
|
||||
navigateView.reset();
|
||||
var activeItem = navigateView.getActiveItem(),
|
||||
panelHeight = this.getHeightById(activeItem && activeItem.id);
|
||||
cmp.setHeight(panelHeight);
|
||||
}
|
||||
},
|
||||
onTextColorItemTap: function (cmp, index, target, record) {
|
||||
var navigateView = this.getNavigateView();
|
||||
if (navigateView) {
|
||||
var cmpId = record.get("child");
|
||||
if (!Ext.isEmpty(cmpId)) {
|
||||
var childCmp = Ext.getCmp(cmpId);
|
||||
if (childCmp) {
|
||||
navigateView.push(childCmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onHighlightListItemTap: function (cmp, index, target, record) {
|
||||
var noFillColorButton = this.getNoFillColorButton(),
|
||||
highlightColorList = this.getHighlightColorList();
|
||||
if (noFillColorButton && highlightColorList) {
|
||||
noFillColorButton.removeCls("x-button-pressing pressed");
|
||||
highlightColorList.select(record);
|
||||
var color = record.get("color"),
|
||||
r = color[0] + color[1],
|
||||
g = color[2] + color[3],
|
||||
b = color[4] + color[5];
|
||||
this.api && this.api.SetMarkerFormat(true, true, parseInt(r, 16), parseInt(g, 16), parseInt(b, 16));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Highlight Color");
|
||||
}
|
||||
},
|
||||
onNoFillColorTap: function (btn) {
|
||||
var noFillColorButton = this.getNoFillColorButton(),
|
||||
highlightColorList = this.getHighlightColorList();
|
||||
if (noFillColorButton && highlightColorList) {
|
||||
if (!btn.element.hasCls("x-button-pressing pressed")) {
|
||||
highlightColorList.deselectAll();
|
||||
noFillColorButton.addCls("x-button-pressing pressed");
|
||||
this.api && this.api.SetMarkerFormat(true, false);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Highlight Color");
|
||||
}
|
||||
}
|
||||
},
|
||||
onTextColorListItemTap: function (cmp, index, target, record) {
|
||||
var textColorList = this.getTextColorList();
|
||||
if (textColorList) {
|
||||
textColorList.select(record);
|
||||
var color = record.get("color"),
|
||||
ascColor = new CAscColor();
|
||||
ascColor.put_r(parseInt((color[0] + color[1]), 16));
|
||||
ascColor.put_g(parseInt((color[2] + color[3]), 16));
|
||||
ascColor.put_b(parseInt((color[4] + color[5]), 16));
|
||||
this.api && this.api.put_TextColor(ascColor);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Text Color");
|
||||
}
|
||||
},
|
||||
scrollToSelected: function (view) {
|
||||
if (view && view.isXType("dataview")) {
|
||||
var el = view.element,
|
||||
cls = view.getSelectedCls(),
|
||||
selected = el.down("." + cls),
|
||||
y;
|
||||
if (selected) {
|
||||
y = selected.dom.offsetTop;
|
||||
Ext.defer(function () {
|
||||
var scroller = view.getScrollable().getScroller().getTranslatable()._element;
|
||||
if (scroller && y > scroller.getHeight() - view.element.getHeight()) {
|
||||
y = scroller.getHeight() - view.element.getHeight();
|
||||
}
|
||||
view.getScrollable().getScroller().scrollTo(0, y, true);
|
||||
},
|
||||
500);
|
||||
}
|
||||
}
|
||||
},
|
||||
animateSetHeight: function (cmp, height) {
|
||||
if (Ext.isDefined(cmp)) {
|
||||
cmp.setHeight(height);
|
||||
}
|
||||
},
|
||||
getHeightById: function (id) {
|
||||
switch (id) {
|
||||
case "id-textcolor-root":
|
||||
return 172;
|
||||
case "id-textcolor-highlight":
|
||||
return 326;
|
||||
default:
|
||||
case "id-textcolor-text":
|
||||
return 336;
|
||||
}
|
||||
},
|
||||
onNavigateViewPush: function (cmp, view) {
|
||||
this.animateSetHeight(cmp.getParent(), this.getHeightById(view.id));
|
||||
if (view.id == "id-textcolor-highlight") {
|
||||
this.scrollToSelected(this.getHighlightColorList());
|
||||
} else {
|
||||
if (view.id == "id-textcolor-text") {
|
||||
this.scrollToSelected(this.getTextColorList());
|
||||
}
|
||||
}
|
||||
},
|
||||
onNavigateViewPop: function (cmp, view) {},
|
||||
onNavigateViewBack: function (cmp) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
activeItem = cmp.getActiveItem();
|
||||
if (parentCmp && activeItem) {
|
||||
this.animateSetHeight(parentCmp, this.getHeightById(activeItem && activeItem.id));
|
||||
}
|
||||
},
|
||||
onApiTextColor: function (color) {
|
||||
if (this.getHandleApiEvent() && Ext.isDefined(color)) {
|
||||
var textColorList = this.getTextColorList();
|
||||
if (textColorList) {
|
||||
var colorToHex = function (r, g, b) {
|
||||
var r = r.toString(16),
|
||||
g = g.toString(16),
|
||||
b = b.toString(16);
|
||||
if (r.length == 1) {
|
||||
r = "0" + r;
|
||||
}
|
||||
if (g.length == 1) {
|
||||
g = "0" + g;
|
||||
}
|
||||
if (b.length == 1) {
|
||||
b = "0" + b;
|
||||
}
|
||||
return (r + g + b).toUpperCase();
|
||||
};
|
||||
var hexColor = colorToHex(color.get_r(), color.get_g(), color.get_b()),
|
||||
recColor = textColorList.getStore().findRecord("color", hexColor);
|
||||
if (recColor) {
|
||||
textColorList.select(recColor);
|
||||
} else {
|
||||
textColorList.deselectAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onApiHighlightColor: function (color) {
|
||||
if (this.getHandleApiEvent() && Ext.isDefined(color)) {
|
||||
var textPara = this.api.get_TextProps().get_TextPr(),
|
||||
highlightColorList = this.getHighlightColorList(),
|
||||
noFillColorButton = this.getNoFillColorButton();
|
||||
var pressNoColor = function () {
|
||||
highlightColorList.deselectAll();
|
||||
noFillColorButton.addCls("x-button-pressing pressed");
|
||||
};
|
||||
if (textPara) {
|
||||
color = textPara.get_HighLight();
|
||||
if (color == -1) {
|
||||
pressNoColor();
|
||||
} else {
|
||||
var hexColor = color.get_hex().toUpperCase();
|
||||
if (highlightColorList) {
|
||||
var recColor = highlightColorList.getStore().findRecord("color", hexColor);
|
||||
if (recColor) {
|
||||
noFillColorButton.removeCls("x-button-pressing pressed");
|
||||
highlightColorList.select(recColor);
|
||||
} else {
|
||||
pressNoColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.TextColor", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
textColorPanel: "textcolorsettingspanel",
|
||||
navigateView: "#id-textcolor-navigate",
|
||||
textColorView: "#id-textcolor-root",
|
||||
highlightColorList: "#id-textcolor-highlight dataview",
|
||||
textColorList: "#id-textcolor-text dataview",
|
||||
noFillColorButton: "#id-btn-highlight-none"
|
||||
},
|
||||
control: {
|
||||
textColorPanel: {
|
||||
show: "onTextColorPanelShow",
|
||||
hide: "onTextColorPanelHide"
|
||||
},
|
||||
navigateView: {
|
||||
push: "onNavigateViewPush",
|
||||
pop: "onNavigateViewPop",
|
||||
back: "onNavigateViewBack"
|
||||
},
|
||||
textColorView: {
|
||||
itemsingletap: "onTextColorItemTap"
|
||||
},
|
||||
highlightColorList: {
|
||||
itemsingletap: "onHighlightListItemTap"
|
||||
},
|
||||
noFillColorButton: {
|
||||
tap: "onNoFillColorTap"
|
||||
},
|
||||
textColorList: {
|
||||
itemsingletap: "onTextColorListItemTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onTextColor", Ext.bind(this.onApiTextColor, this));
|
||||
this.api.asc_registerCallback("asc_onTextHighLight", Ext.bind(this.onApiHighlightColor, this));
|
||||
}
|
||||
},
|
||||
onTextColorPanelShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onTextColorPanelHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
var navigateView = this.getNavigateView();
|
||||
if (navigateView) {
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getInAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getInAnimation().stop();
|
||||
}
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getOutAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getOutAnimation().stop();
|
||||
}
|
||||
navigateView.reset();
|
||||
var activeItem = navigateView.getActiveItem(),
|
||||
panelHeight = this.getHeightById(activeItem && activeItem.id);
|
||||
cmp.setHeight(panelHeight);
|
||||
}
|
||||
},
|
||||
onTextColorItemTap: function (cmp, index, target, record) {
|
||||
var navigateView = this.getNavigateView();
|
||||
if (navigateView) {
|
||||
var cmpId = record.get("child");
|
||||
if (!Ext.isEmpty(cmpId)) {
|
||||
var childCmp = Ext.getCmp(cmpId);
|
||||
if (childCmp) {
|
||||
navigateView.push(childCmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onHighlightListItemTap: function (cmp, index, target, record) {
|
||||
var noFillColorButton = this.getNoFillColorButton(),
|
||||
highlightColorList = this.getHighlightColorList();
|
||||
if (noFillColorButton && highlightColorList) {
|
||||
noFillColorButton.removeCls("x-button-pressing pressed");
|
||||
highlightColorList.select(record);
|
||||
var color = record.get("color"),
|
||||
r = color[0] + color[1],
|
||||
g = color[2] + color[3],
|
||||
b = color[4] + color[5];
|
||||
this.api && this.api.SetMarkerFormat(true, true, parseInt(r, 16), parseInt(g, 16), parseInt(b, 16));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Highlight Color");
|
||||
}
|
||||
},
|
||||
onNoFillColorTap: function (btn) {
|
||||
var noFillColorButton = this.getNoFillColorButton(),
|
||||
highlightColorList = this.getHighlightColorList();
|
||||
if (noFillColorButton && highlightColorList) {
|
||||
if (!btn.element.hasCls("x-button-pressing pressed")) {
|
||||
highlightColorList.deselectAll();
|
||||
noFillColorButton.addCls("x-button-pressing pressed");
|
||||
this.api && this.api.SetMarkerFormat(true, false);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Highlight Color");
|
||||
}
|
||||
}
|
||||
},
|
||||
onTextColorListItemTap: function (cmp, index, target, record) {
|
||||
var textColorList = this.getTextColorList();
|
||||
if (textColorList) {
|
||||
textColorList.select(record);
|
||||
var color = record.get("color"),
|
||||
ascColor = new CAscColor();
|
||||
ascColor.put_r(parseInt((color[0] + color[1]), 16));
|
||||
ascColor.put_g(parseInt((color[2] + color[3]), 16));
|
||||
ascColor.put_b(parseInt((color[4] + color[5]), 16));
|
||||
this.api && this.api.put_TextColor(ascColor);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Text Color");
|
||||
}
|
||||
},
|
||||
scrollToSelected: function (view) {
|
||||
if (view && view.isXType("dataview")) {
|
||||
var el = view.element,
|
||||
cls = view.getSelectedCls(),
|
||||
selected = el.down("." + cls),
|
||||
y;
|
||||
if (selected) {
|
||||
y = selected.dom.offsetTop;
|
||||
Ext.defer(function () {
|
||||
var scroller = view.getScrollable().getScroller().getTranslatable()._element;
|
||||
if (scroller && y > scroller.getHeight() - view.element.getHeight()) {
|
||||
y = scroller.getHeight() - view.element.getHeight();
|
||||
}
|
||||
view.getScrollable().getScroller().scrollTo(0, y, true);
|
||||
},
|
||||
500);
|
||||
}
|
||||
}
|
||||
},
|
||||
animateSetHeight: function (cmp, height) {
|
||||
if (Ext.isDefined(cmp)) {
|
||||
cmp.setHeight(height);
|
||||
}
|
||||
},
|
||||
getHeightById: function (id) {
|
||||
switch (id) {
|
||||
case "id-textcolor-root":
|
||||
return 172;
|
||||
case "id-textcolor-highlight":
|
||||
return 326;
|
||||
default:
|
||||
case "id-textcolor-text":
|
||||
return 336;
|
||||
}
|
||||
},
|
||||
onNavigateViewPush: function (cmp, view) {
|
||||
this.animateSetHeight(cmp.getParent(), this.getHeightById(view.id));
|
||||
if (view.id == "id-textcolor-highlight") {
|
||||
this.scrollToSelected(this.getHighlightColorList());
|
||||
} else {
|
||||
if (view.id == "id-textcolor-text") {
|
||||
this.scrollToSelected(this.getTextColorList());
|
||||
}
|
||||
}
|
||||
},
|
||||
onNavigateViewPop: function (cmp, view) {},
|
||||
onNavigateViewBack: function (cmp) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
activeItem = cmp.getActiveItem();
|
||||
if (parentCmp && activeItem) {
|
||||
this.animateSetHeight(parentCmp, this.getHeightById(activeItem && activeItem.id));
|
||||
}
|
||||
},
|
||||
onApiTextColor: function (color) {
|
||||
if (this.getHandleApiEvent() && Ext.isDefined(color)) {
|
||||
var textColorList = this.getTextColorList();
|
||||
if (textColorList) {
|
||||
var colorToHex = function (r, g, b) {
|
||||
var r = r.toString(16),
|
||||
g = g.toString(16),
|
||||
b = b.toString(16);
|
||||
if (r.length == 1) {
|
||||
r = "0" + r;
|
||||
}
|
||||
if (g.length == 1) {
|
||||
g = "0" + g;
|
||||
}
|
||||
if (b.length == 1) {
|
||||
b = "0" + b;
|
||||
}
|
||||
return (r + g + b).toUpperCase();
|
||||
};
|
||||
var hexColor = colorToHex(color.get_r(), color.get_g(), color.get_b()),
|
||||
recColor = textColorList.getStore().findRecord("color", hexColor);
|
||||
if (recColor) {
|
||||
textColorList.select(recColor);
|
||||
} else {
|
||||
textColorList.deselectAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onApiHighlightColor: function (color) {
|
||||
if (this.getHandleApiEvent() && Ext.isDefined(color)) {
|
||||
var textPara = this.api.get_TextProps().get_TextPr(),
|
||||
highlightColorList = this.getHighlightColorList(),
|
||||
noFillColorButton = this.getNoFillColorButton();
|
||||
var pressNoColor = function () {
|
||||
highlightColorList.deselectAll();
|
||||
noFillColorButton.addCls("x-button-pressing pressed");
|
||||
};
|
||||
if (textPara) {
|
||||
color = textPara.get_HighLight();
|
||||
if (color == -1) {
|
||||
pressNoColor();
|
||||
} else {
|
||||
var hexColor = color.get_hex().toUpperCase();
|
||||
if (highlightColorList) {
|
||||
var recColor = highlightColorList.getStore().findRecord("color", hexColor);
|
||||
if (recColor) {
|
||||
noFillColorButton.removeCls("x-button-pressing pressed");
|
||||
highlightColorList.select(recColor);
|
||||
} else {
|
||||
pressNoColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user