[SSE mobile] Changes for code decomposition
This commit is contained in:
parent
02b0697607
commit
7c72e8cb1b
|
@ -187,6 +187,8 @@ class MainController extends Component {
|
||||||
// 'translate': translate
|
// 'translate': translate
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Common.EditorApi = {get: () => this.api};
|
||||||
|
|
||||||
this.appOptions = {};
|
this.appOptions = {};
|
||||||
this.bindEvents();
|
this.bindEvents();
|
||||||
|
|
||||||
|
@ -202,7 +204,6 @@ class MainController extends Component {
|
||||||
Common.Gateway.appReady();
|
Common.Gateway.appReady();
|
||||||
|
|
||||||
Common.Notifications.trigger('engineCreated', this.api);
|
Common.Notifications.trigger('engineCreated', this.api);
|
||||||
Common.EditorApi = {get: () => this.api};
|
|
||||||
}, error => {
|
}, error => {
|
||||||
console.log('promise failed ' + error);
|
console.log('promise failed ' + error);
|
||||||
});
|
});
|
||||||
|
@ -227,58 +228,21 @@ class MainController extends Component {
|
||||||
// me.api.asc_registerCallback('asc_onDocumentName', _.bind(me.onDocumentName, me));
|
// me.api.asc_registerCallback('asc_onDocumentName', _.bind(me.onDocumentName, me));
|
||||||
me.api.asc_registerCallback('asc_onEndAction', me._onLongActionEnd.bind(me));
|
me.api.asc_registerCallback('asc_onEndAction', me._onLongActionEnd.bind(me));
|
||||||
|
|
||||||
const storeSpreadsheetSettings = this.props.storeSpreadsheetSettings;
|
EditorUIController.initThemeColors && EditorUIController.initThemeColors();
|
||||||
const storeFocusObjects = this.props.storeFocusObjects;
|
|
||||||
const storeCellSettings = this.props.storeCellSettings;
|
|
||||||
const storeTextSettings = this.props.storeTextSettings;
|
|
||||||
const storeChartSettings = this.props.storeChartSettings;
|
|
||||||
const styleSize = storeCellSettings.styleSize;
|
|
||||||
|
|
||||||
this.api.asc_registerCallback('asc_onSelectionChanged', cellInfo => {
|
|
||||||
console.log(cellInfo);
|
|
||||||
|
|
||||||
storeFocusObjects.resetCellInfo(cellInfo);
|
|
||||||
storeCellSettings.initCellSettings(cellInfo);
|
|
||||||
storeTextSettings.initTextSettings(cellInfo);
|
|
||||||
|
|
||||||
let selectedObjects = Common.EditorApi.get().asc_getGraphicObjectProps();
|
EditorUIController.initCellInfo && EditorUIController.initCellInfo(this.props);
|
||||||
|
|
||||||
if(selectedObjects.length) {
|
EditorUIController.initEditorStyles && EditorUIController.initEditorStyles(this.props.storeCellSettings);
|
||||||
storeFocusObjects.resetFocusObjects(selectedObjects);
|
|
||||||
|
|
||||||
// Chart Settings
|
EditorUIController.initFonts && EditorUIController.initFonts(this.props);
|
||||||
|
|
||||||
if (storeFocusObjects.chartObject) {
|
|
||||||
storeChartSettings.updateChartStyles(this.api.asc_getChartPreviews(storeFocusObjects.chartObject.get_ChartProperties().getType()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
const styleSize = this.props.storeCellSettings.styleSize;
|
||||||
this.api.asc_setThumbnailStylesSizes(styleSize.width, styleSize.height);
|
this.api.asc_setThumbnailStylesSizes(styleSize.width, styleSize.height);
|
||||||
|
|
||||||
this.api.asc_registerCallback('asc_onInitEditorFonts', (fonts, select) => {
|
|
||||||
storeCellSettings.initEditorFonts(fonts, select);
|
|
||||||
storeTextSettings.initEditorFonts(fonts, select);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.api.asc_registerCallback('asc_onEditorSelectionChanged', fontObj => {
|
|
||||||
console.log(fontObj)
|
|
||||||
storeCellSettings.initFontInfo(fontObj);
|
|
||||||
storeTextSettings.initFontInfo(fontObj);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.api.asc_registerCallback('asc_onInitEditorStyles', styles => {
|
|
||||||
storeCellSettings.initCellStyles(styles);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.api.asc_registerCallback('asc_onSendThemeColors', (colors, standart_colors) => {
|
|
||||||
Common.Utils.ThemeColor.setColors(colors, standart_colors);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Spreadsheet Settings
|
// Spreadsheet Settings
|
||||||
|
|
||||||
this.api.asc_registerCallback('asc_onSendThemeColorSchemes', schemes => {
|
this.api.asc_registerCallback('asc_onSendThemeColorSchemes', schemes => {
|
||||||
storeSpreadsheetSettings.addSchemes(schemes);
|
this.props.storeSpreadsheetSettings.addSchemes(schemes);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Downloaded Advanced Options
|
// Downloaded Advanced Options
|
||||||
|
|
|
@ -61,140 +61,19 @@ export class storeFocusObjects {
|
||||||
}
|
}
|
||||||
|
|
||||||
get selections () {
|
get selections () {
|
||||||
const _selections = [];
|
return !!this.intf ? this.intf.getSelections() : null;
|
||||||
|
|
||||||
let isCell, isRow, isCol, isAll, isChart, isImage, isTextShape, isShape, isTextChart,
|
|
||||||
selType = this._cellInfo.asc_getSelectionType(),
|
|
||||||
isObjLocked = false;
|
|
||||||
|
|
||||||
switch (selType) {
|
|
||||||
case Asc.c_oAscSelectionType.RangeCells: isCell = true; break;
|
|
||||||
case Asc.c_oAscSelectionType.RangeRow: isRow = true; break;
|
|
||||||
case Asc.c_oAscSelectionType.RangeCol: isCol = true; break;
|
|
||||||
case Asc.c_oAscSelectionType.RangeMax: isAll = true; break;
|
|
||||||
case Asc.c_oAscSelectionType.RangeImage: isImage = true; break;
|
|
||||||
case Asc.c_oAscSelectionType.RangeShape: isShape = true; break;
|
|
||||||
case Asc.c_oAscSelectionType.RangeChart: isChart = true; break;
|
|
||||||
case Asc.c_oAscSelectionType.RangeChartText:isTextChart = true; break;
|
|
||||||
case Asc.c_oAscSelectionType.RangeShapeText: isTextShape = true; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isImage || isShape || isChart) {
|
|
||||||
isImage = isShape = isChart = false;
|
|
||||||
let has_chartprops = false;
|
|
||||||
let selectedObjects = Common.EditorApi.get().asc_getGraphicObjectProps();
|
|
||||||
|
|
||||||
for (let i = 0; i < selectedObjects.length; i++) {
|
|
||||||
if (selectedObjects[i].asc_getObjectType() == Asc.c_oAscTypeSelectElement.Image) {
|
|
||||||
const elValue = selectedObjects[i].asc_getObjectValue();
|
|
||||||
isObjLocked = isObjLocked || elValue.asc_getLocked();
|
|
||||||
const shapeProps = elValue.asc_getShapeProperties();
|
|
||||||
|
|
||||||
if (shapeProps) {
|
|
||||||
if (shapeProps.asc_getFromChart()) {
|
|
||||||
isChart = true;
|
|
||||||
} else {
|
|
||||||
isShape = true;
|
|
||||||
|
|
||||||
}
|
|
||||||
} else if (elValue.asc_getChartProperties()) {
|
|
||||||
isChart = true;
|
|
||||||
has_chartprops = true;
|
|
||||||
} else {
|
|
||||||
isImage = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (isTextShape || isTextChart) {
|
|
||||||
const selectedObjects = Common.EditorApi.get().asc_getGraphicObjectProps();
|
|
||||||
let isEquation = false;
|
|
||||||
|
|
||||||
for (var i = 0; i < selectedObjects.length; i++) {
|
|
||||||
const elType = selectedObjects[i].asc_getObjectType();
|
|
||||||
if (elType == Asc.c_oAscTypeSelectElement.Image) {
|
|
||||||
const value = selectedObjects[i].asc_getObjectValue();
|
|
||||||
isObjLocked = isObjLocked || value.asc_getLocked();
|
|
||||||
} else if (elType == Asc.c_oAscTypeSelectElement.Paragraph) {
|
|
||||||
} else if (elType == Asc.c_oAscTypeSelectElement.Math) {
|
|
||||||
isEquation = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isChart || isTextChart) {
|
|
||||||
_selections.push('chart');
|
|
||||||
|
|
||||||
if (isTextChart) {
|
|
||||||
_selections.push('text');
|
|
||||||
}
|
|
||||||
} else if ((isShape || isTextShape) && !isImage) {
|
|
||||||
_selections.push('shape');
|
|
||||||
|
|
||||||
if (isTextShape) {
|
|
||||||
_selections.push('text');
|
|
||||||
}
|
|
||||||
} else if (isImage) {
|
|
||||||
_selections.push('image');
|
|
||||||
|
|
||||||
if (isShape) {
|
|
||||||
_selections.push('shape');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
_selections.push('cell');
|
|
||||||
|
|
||||||
if (this._cellInfo.asc_getHyperlink()) {
|
|
||||||
_selections.push('hyperlink');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return _selections;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get shapeObject() {
|
get shapeObject() {
|
||||||
const shapes = [];
|
return !!this.intf ? this.intf.getShapeObject() : null;
|
||||||
for (let object of this._focusObjects) {
|
|
||||||
if (object.get_ObjectType() === Asc.c_oAscTypeSelectElement.Image) {
|
|
||||||
if (object.get_ObjectValue() && object.get_ObjectValue().get_ShapeProperties()) {
|
|
||||||
shapes.push(object);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (shapes.length > 0) {
|
|
||||||
const object = shapes[shapes.length - 1]; // get top
|
|
||||||
return object.get_ObjectValue();
|
|
||||||
} else {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get imageObject() {
|
get imageObject() {
|
||||||
const images = [];
|
return !!this.intf ? this.intf.getImageObject() : null;
|
||||||
for (let object of this._focusObjects) {
|
|
||||||
if (object.get_ObjectType() === Asc.c_oAscTypeSelectElement.Image) {
|
|
||||||
images.push(object);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (images.length > 0) {
|
|
||||||
const object = images[images.length - 1]; // get top
|
|
||||||
return object.get_ObjectValue();
|
|
||||||
} else {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get chartObject() {
|
get chartObject() {
|
||||||
const charts = [];
|
return !!this.intf ? this.intf.getChartObject() : null;
|
||||||
for (let object of this._focusObjects) {
|
|
||||||
if (object.get_ObjectType() === Asc.c_oAscTypeSelectElement.Image) {
|
|
||||||
if (object.get_ObjectValue() && object.get_ObjectValue().get_ChartProperties()) {
|
|
||||||
charts.push(object);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (charts.length > 0) {
|
|
||||||
const object = charts[charts.length - 1]; // get top
|
|
||||||
return object.get_ObjectValue();
|
|
||||||
} else {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue