[SSE] Add new methods in sdk

This commit is contained in:
Julia Radzhabova 2020-05-15 13:52:52 +03:00
parent 5c1774efcf
commit 0b4f282ac9
6 changed files with 42 additions and 37 deletions

View file

@ -1572,7 +1572,8 @@ define([
isTableLocked = cellinfo.asc_getLockedTable()===true, isTableLocked = cellinfo.asc_getLockedTable()===true,
isObjLocked = false, isObjLocked = false,
commentsController = this.getApplication().getController('Common.Controllers.Comments'), commentsController = this.getApplication().getController('Common.Controllers.Comments'),
internaleditor = this.permissions.isEditMailMerge || this.permissions.isEditDiagram; internaleditor = this.permissions.isEditMailMerge || this.permissions.isEditDiagram,
xfs = cellinfo.asc_getXfs();
switch (seltype) { switch (seltype) {
case Asc.c_oAscSelectionType.RangeCells: iscellmenu = true; break; case Asc.c_oAscSelectionType.RangeCells: iscellmenu = true; break;
@ -1742,8 +1743,8 @@ define([
isintable = (formatTableInfo !== null), isintable = (formatTableInfo !== null),
ismultiselect = cellinfo.asc_getMultiselect(); ismultiselect = cellinfo.asc_getMultiselect();
documentHolder.ssMenu.formatTableName = (isintable) ? formatTableInfo.asc_getTableName() : null; documentHolder.ssMenu.formatTableName = (isintable) ? formatTableInfo.asc_getTableName() : null;
documentHolder.ssMenu.cellColor = cellinfo.asc_getFillColor(); documentHolder.ssMenu.cellColor = xfs.asc_getFillColor();
documentHolder.ssMenu.fontColor = cellinfo.asc_getXfs().asc_getFontColor(); documentHolder.ssMenu.fontColor = xfs.asc_getFontColor();
documentHolder.pmiInsertEntire.setVisible(isrowmenu||iscolmenu); documentHolder.pmiInsertEntire.setVisible(isrowmenu||iscolmenu);
documentHolder.pmiInsertEntire.setCaption((isrowmenu) ? this.textInsertTop : this.textInsertLeft); documentHolder.pmiInsertEntire.setCaption((isrowmenu) ? this.textInsertTop : this.textInsertLeft);
@ -1819,8 +1820,8 @@ define([
documentHolder.pmiEntriesList.setVisible(!iscelledit && !inPivot); documentHolder.pmiEntriesList.setVisible(!iscelledit && !inPivot);
documentHolder.pmiNumFormat.setVisible(!iscelledit); documentHolder.pmiNumFormat.setVisible(!iscelledit);
documentHolder.pmiAdvancedNumFormat.options.numformatinfo = documentHolder.pmiNumFormat.menu.options.numformatinfo = cellinfo.asc_getNumFormatInfo(); documentHolder.pmiAdvancedNumFormat.options.numformatinfo = documentHolder.pmiNumFormat.menu.options.numformatinfo = xfs.asc_getNumFormatInfo();
documentHolder.pmiAdvancedNumFormat.options.numformat = cellinfo.asc_getNumFormat(); documentHolder.pmiAdvancedNumFormat.options.numformat = xfs.asc_getNumFormat();
_.each(documentHolder.ssMenu.items, function(item) { _.each(documentHolder.ssMenu.items, function(item) {
item.setDisabled(isCellLocked); item.setDisabled(isCellLocked);

View file

@ -2075,17 +2075,17 @@ define([
editOptionsDisabled = this._disableEditOptions(selectionType, coauth_disable), editOptionsDisabled = this._disableEditOptions(selectionType, coauth_disable),
me = this, me = this,
toolbar = this.toolbar, toolbar = this.toolbar,
fontobj = info.asc_getXfs(), xfs = info.asc_getXfs(),
val, need_disable = false; val, need_disable = false;
/* read font name */ /* read font name */
var fontparam = fontobj.asc_getFontName(); var fontparam = xfs.asc_getFontName();
if (fontparam != toolbar.cmbFontName.getValue()) { if (fontparam != toolbar.cmbFontName.getValue()) {
Common.NotificationCenter.trigger('fonts:change', fontobj); Common.NotificationCenter.trigger('fonts:change', xfs);
} }
/* read font size */ /* read font size */
var str_size = fontobj.asc_getFontSize(); var str_size = xfs.asc_getFontSize();
if (this._state.fontsize !== str_size) { if (this._state.fontsize !== str_size) {
toolbar.cmbFontSize.setValue((str_size !== undefined) ? str_size : ''); toolbar.cmbFontSize.setValue((str_size !== undefined) ? str_size : '');
this._state.fontsize = str_size; this._state.fontsize = str_size;
@ -2124,29 +2124,29 @@ define([
/* read font params */ /* read font params */
if (!toolbar.mode.isEditMailMerge && !toolbar.mode.isEditDiagram) { if (!toolbar.mode.isEditMailMerge && !toolbar.mode.isEditDiagram) {
val = fontobj.asc_getFontBold(); val = xfs.asc_getFontBold();
if (this._state.bold !== val) { if (this._state.bold !== val) {
toolbar.btnBold.toggle(val === true, true); toolbar.btnBold.toggle(val === true, true);
this._state.bold = val; this._state.bold = val;
} }
val = fontobj.asc_getFontItalic(); val = xfs.asc_getFontItalic();
if (this._state.italic !== val) { if (this._state.italic !== val) {
toolbar.btnItalic.toggle(val === true, true); toolbar.btnItalic.toggle(val === true, true);
this._state.italic = val; this._state.italic = val;
} }
val = fontobj.asc_getFontUnderline(); val = xfs.asc_getFontUnderline();
if (this._state.underline !== val) { if (this._state.underline !== val) {
toolbar.btnUnderline.toggle(val === true, true); toolbar.btnUnderline.toggle(val === true, true);
this._state.underline = val; this._state.underline = val;
} }
val = fontobj.asc_getFontStrikeout(); val = xfs.asc_getFontStrikeout();
if (this._state.strikeout !== val) { if (this._state.strikeout !== val) {
toolbar.btnStrikeout.toggle(val === true, true); toolbar.btnStrikeout.toggle(val === true, true);
this._state.strikeout = val; this._state.strikeout = val;
} }
var subsc = fontobj.asc_getFontSubscript(), var subsc = xfs.asc_getFontSubscript(),
supersc = fontobj.asc_getFontSuperscript(); supersc = xfs.asc_getFontSuperscript();
if (this._state.subscript !== subsc || this._state.superscript !== supersc) { if (this._state.subscript !== subsc || this._state.superscript !== supersc) {
var index = (supersc) ? 0 : (subsc ? 1 : -1), var index = (supersc) ? 0 : (subsc ? 1 : -1),
@ -2176,7 +2176,7 @@ define([
paragraphColorPicker = this.toolbar.mnuBackColorPicker; paragraphColorPicker = this.toolbar.mnuBackColorPicker;
if (!toolbar.btnTextColor.ischanged && !fontColorPicker.isDummy) { if (!toolbar.btnTextColor.ischanged && !fontColorPicker.isDummy) {
color = fontobj.asc_getFontColor(); color = xfs.asc_getFontColor();
if (color) { if (color) {
if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) {
clr = {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }; clr = {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() };
@ -2210,7 +2210,7 @@ define([
/* read cell background color */ /* read cell background color */
if (!toolbar.btnBackColor.ischanged && !paragraphColorPicker.isDummy) { if (!toolbar.btnBackColor.ischanged && !paragraphColorPicker.isDummy) {
color = info.asc_getFillColor(); color = xfs.asc_getFillColor();
if (color) { if (color) {
if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) {
clr = {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }; clr = {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() };
@ -2261,7 +2261,7 @@ define([
formatTableInfo = info.asc_getFormatTableInfo(); formatTableInfo = info.asc_getFormatTableInfo();
if (!toolbar.mode.isEditMailMerge) { if (!toolbar.mode.isEditMailMerge) {
/* read cell horizontal align */ /* read cell horizontal align */
fontparam = info.asc_getHorAlign(); fontparam = xfs.asc_getHorAlign();
if (this._state.pralign !== fontparam) { if (this._state.pralign !== fontparam) {
this._state.pralign = fontparam; this._state.pralign = fontparam;
@ -2291,7 +2291,7 @@ define([
toolbar.btnTextOrient.menu.items[2].setDisabled(need_disable); toolbar.btnTextOrient.menu.items[2].setDisabled(need_disable);
/* read cell vertical align */ /* read cell vertical align */
fontparam = info.asc_getVertAlign(); fontparam = xfs.asc_getVertAlign();
if (this._state.valign !== fontparam) { if (this._state.valign !== fontparam) {
this._state.valign = fontparam; this._state.valign = fontparam;
@ -2320,7 +2320,7 @@ define([
/* read cell text wrapping */ /* read cell text wrapping */
if (!toolbar.btnWrap.isDisabled()) { if (!toolbar.btnWrap.isDisabled()) {
val = info.asc_getWrapText(); val = xfs.asc_getWrapText();
if (this._state.wrap !== val) { if (this._state.wrap !== val) {
toolbar.btnWrap.toggle(val===true, true); toolbar.btnWrap.toggle(val===true, true);
this._state.wrap = val; this._state.wrap = val;
@ -2374,9 +2374,9 @@ define([
} }
val = info.asc_getNumFormatInfo(); val = xfs.asc_getNumFormatInfo();
if (val) { if (val) {
this._state.numformat = info.asc_getNumFormat(); this._state.numformat = xfs.asc_getNumFormat();
this._state.numformatinfo = val; this._state.numformatinfo = val;
val = val.asc_getType(); val = val.asc_getType();
if (this._state.numformattype !== val) { if (this._state.numformattype !== val) {
@ -2385,7 +2385,7 @@ define([
} }
} }
val = info.asc_getAngle(); val = xfs.asc_getAngle();
if (this._state.angle !== val) { if (this._state.angle !== val) {
toolbar.btnTextOrient.menu.clearAll(); toolbar.btnTextOrient.menu.clearAll();
switch(val) { switch(val) {
@ -2499,6 +2499,7 @@ define([
}; };
var selectionType = info.asc_getSelectionType(), var selectionType = info.asc_getSelectionType(),
xfs = info.asc_getXfs(),
coauth_disable = false; coauth_disable = false;
if ( _disableEditOptions(selectionType, coauth_disable) ) return; if ( _disableEditOptions(selectionType, coauth_disable) ) return;
@ -2506,9 +2507,9 @@ define([
if (selectionType == Asc.c_oAscSelectionType.RangeChart || selectionType == Asc.c_oAscSelectionType.RangeChartText) if (selectionType == Asc.c_oAscSelectionType.RangeChart || selectionType == Asc.c_oAscSelectionType.RangeChartText)
return; return;
var val = info.asc_getNumFormatInfo(); var val = xfs.asc_getNumFormatInfo();
if ( val ) { if ( val ) {
this._state.numformat = info.asc_getNumFormat(); this._state.numformat = xfs.asc_getNumFormat();
this._state.numformatinfo = val; this._state.numformatinfo = val;
val = val.asc_getType(); val = val.asc_getType();
if (this._state.numformattype !== val) { if (this._state.numformattype !== val) {

View file

@ -446,12 +446,13 @@ define([
if (props ) { if (props ) {
this._noApply = true; this._noApply = true;
var value = props.asc_getAngle(); var xfs = props.asc_getXfs(),
value = xfs.asc_getAngle();
if (Math.abs(this._state.CellAngle - value) > 0.1 || (this._state.CellAngle === undefined) && (this._state.CellAngle !== value)) { if (Math.abs(this._state.CellAngle - value) > 0.1 || (this._state.CellAngle === undefined) && (this._state.CellAngle !== value)) {
this.spnAngle.setValue((value !== null) ? value : '', true); this.spnAngle.setValue((value !== null) ? value : '', true);
this._state.CellAngle = value; this._state.CellAngle = value;
} }
this.fill = props.asc_getFill(); this.fill = xfs.asc_getFill();
if (this.fill) { if (this.fill) {
this.pattern = this.fill.asc_getPatternFill(); this.pattern = this.fill.asc_getPatternFill();
this.gradient = this.fill.asc_getGradientFill(); this.gradient = this.fill.asc_getGradientFill();

View file

@ -311,7 +311,8 @@ define([
var iscellmenu, isrowmenu, iscolmenu, isallmenu, ischartmenu, isimagemenu, istextshapemenu, isshapemenu, istextchartmenu; var iscellmenu, isrowmenu, iscolmenu, isallmenu, ischartmenu, isimagemenu, istextshapemenu, isshapemenu, istextchartmenu;
var iscelllocked = cellinfo.asc_getLocked(), var iscelllocked = cellinfo.asc_getLocked(),
seltype = cellinfo.asc_getSelectionType(); seltype = cellinfo.asc_getSelectionType(),
xfs = cellinfo.asc_getXfs();
switch (seltype) { switch (seltype) {
case Asc.c_oAscSelectionType.RangeCells: iscellmenu = true; break; case Asc.c_oAscSelectionType.RangeCells: iscellmenu = true; break;
@ -420,7 +421,7 @@ define([
}); });
arrItems.push( arrItems.push(
cellinfo.asc_getWrapText() ? xfs.asc_getWrapText() ?
{ {
caption: me.menuUnwrap, caption: me.menuUnwrap,
event: 'unwrap' event: 'unwrap'

View file

@ -215,11 +215,12 @@ define([
var me = this, var me = this,
$pageTextFormat = $('.page[data-page=edit-text-format]'), $pageTextFormat = $('.page[data-page=edit-text-format]'),
hAlign = me._cellInfo.asc_getHorAlign(), xfs = me._cellInfo.asc_getXfs(),
vAlign = me._cellInfo.asc_getVertAlign(), hAlign = xfs.asc_getHorAlign(),
vAlign = xfs.asc_getVertAlign(),
hAlignStr = 'left', hAlignStr = 'left',
vAlignStr = 'bottom', vAlignStr = 'bottom',
isWrapText = me._cellInfo.asc_getWrapText(); isWrapText = xfs.asc_getWrapText();
if (vAlign == Asc.c_oAscVAlign.Top) if (vAlign == Asc.c_oAscVAlign.Top)
vAlignStr = 'top'; vAlignStr = 'top';
@ -319,14 +320,14 @@ define([
selectionType = cellInfo.asc_getSelectionType(), selectionType = cellInfo.asc_getSelectionType(),
// coAuthDisable = (!this.toolbar.mode.isEditMailMerge && !this.toolbar.mode.isEditDiagram) ? (cellInfo.asc_getLocked()===true || cellInfo.asc_getLockedTable()===true) : false, // coAuthDisable = (!this.toolbar.mode.isEditMailMerge && !this.toolbar.mode.isEditDiagram) ? (cellInfo.asc_getLocked()===true || cellInfo.asc_getLockedTable()===true) : false,
// editOptionsDisabled = this._disableEditOptions(selectionType, coAuthDisable), // editOptionsDisabled = this._disableEditOptions(selectionType, coAuthDisable),
_fontInfo = cellInfo.asc_getXfs(), xfs = cellInfo.asc_getXfs(),
val, val,
need_disable = false; need_disable = false;
me.initFontSettings(_fontInfo); me.initFontSettings(xfs);
// Init fill color // Init fill color
var color = cellInfo.asc_getFillColor(), var color = xfs.asc_getFillColor(),
clr = me._sdkToThemeColor(color); clr = me._sdkToThemeColor(color);
$('#fill-color .color-preview').css('background-color', '#' + (_.isObject(clr) ? clr.color : clr)); $('#fill-color .color-preview').css('background-color', '#' + (_.isObject(clr) ? clr.color : clr));

View file

@ -156,8 +156,8 @@ define([
// Align // Align
$('#edit-text-align-block').css('display', (_textIn == TextType.inShape) ? 'block' : 'none'); $('#edit-text-align-block').css('display', (_textIn == TextType.inShape) ? 'block' : 'none');
var hAlign = _cellInfo.asc_getHorAlign(), var hAlign = _fontInfo.asc_getHorAlign(),
vAlign = _cellInfo.asc_getVertAlign(); vAlign = _fontInfo.asc_getVertAlign();
$('#font-left').toggleClass('active', hAlign===AscCommon.align_Left); $('#font-left').toggleClass('active', hAlign===AscCommon.align_Left);
$('#font-center').toggleClass('active', hAlign===AscCommon.align_Center); $('#font-center').toggleClass('active', hAlign===AscCommon.align_Center);