diff --git a/apps/documenteditor/mobile/src/controller/settings/ApplicationSettings.jsx b/apps/documenteditor/mobile/src/controller/settings/ApplicationSettings.jsx index 4f5da84f09..44b6b37246 100644 --- a/apps/documenteditor/mobile/src/controller/settings/ApplicationSettings.jsx +++ b/apps/documenteditor/mobile/src/controller/settings/ApplicationSettings.jsx @@ -6,9 +6,67 @@ class ApplicationSettingsController extends Component { super(props); } + setUnitMeasurement(value) { + const api = Common.EditorApi.get(); + value = (value !== null) ? parseInt(value) : Common.Utils.Metric.getDefaultMetric(); + Common.Utils.Metric.setCurrentMetric(value); + // Common.localStorage.setItem("de-mobile-settings-unit", value); + api.asc_SetDocumentUnits((value == Common.Utils.Metric.c_MetricUnits.inch) ? Asc.c_oAscDocumentUnits.Inch : ((value == Common.Utils.Metric.c_MetricUnits.pt) ? Asc.c_oAscDocumentUnits.Point : Asc.c_oAscDocumentUnits.Millimeter)); + } + + switchSpellCheck(value) { + const api = Common.EditorApi.get(); + // let state = value === '1' ? true : false; + // Common.localStorage.setItem("de-mobile-spellcheck", value ? 1 : 0); + // Common.Utils.InternalSettings.set("de-mobile-spellcheck", value); + Common.Utils.InternalSettings.set("de-mobile-spellcheck", value); + api.asc_setSpellCheck(value); + } + + switchNoCharacters(value) { + const api = Common.EditorApi.get(); + // Common.localStorage.setItem("de-mobile-no-characters", value); + api.put_ShowParaMarks(value); + } + + switchShowTableEmptyLine(value) { + const api = Common.EditorApi.get(); + // Common.localStorage.setItem("de-mobile-hidden-borders", state); + api.put_ShowTableEmptyLine(value); + } + + switchDisplayComments(value) { + const api = Common.EditorApi.get(); + if (!value) { + api.asc_hideComments(); + this.switchDisplayResolved(value); + // Common.localStorage.setBool("de-settings-resolvedcomment", false); + } else { + // let resolved = Common.localStorage.getBool("de-settings-resolvedcomment"); + api.asc_showComments(value); + } + // Common.localStorage.setBool("de-mobile-settings-livecomment", value); + } + + switchDisplayResolved(value) { + const api = Common.EditorApi.get(); + // let displayComments = Common.localStorage.getBool("de-mobile-settings-livecomment"); + if (value) { + api.asc_showComments(value); + } + // Common.localStorage.setBool("de-settings-resolvedcomment", value); + } + render() { return ( - + ) } } diff --git a/apps/documenteditor/mobile/src/store/applicationSettings.js b/apps/documenteditor/mobile/src/store/applicationSettings.js index dfa1f6bb79..988e4eb919 100644 --- a/apps/documenteditor/mobile/src/store/applicationSettings.js +++ b/apps/documenteditor/mobile/src/store/applicationSettings.js @@ -1,31 +1,62 @@ -import {action, observable, computed} from 'mobx'; +import {action, observable} from 'mobx'; export class storeApplicationSettings { @observable isActiveUnitCentimeter = false; @observable isActiveUnitPoint = true; @observable isActiveUnitInch = false; + @observable isSpellChecking = true; + + @observable isNonprintingCharacters = false; + @observable isHiddenTableBorders = false; + + @observable isComments = true; + @observable isResolvedComments = true; + @action changeUnitMeasurement(value) { - const api = Common.EditorApi.get(); + value = (value !== null) ? parseInt(value) : Common.Utils.Metric.getDefaultMetric(); console.log(value); - if(+value === Common.Utils.Metric.c_MetricUnits.inch) { - api.asc_SetDocumentUnits(Asc.c_oAscDocumentUnits.Inch); + + if(value === Common.Utils.Metric.c_MetricUnits.inch) { this.isActiveUnitCentimeter = false; this.isActiveUnitPoint = false; this.isActiveUnitInch = true; } - else if(+value === Common.Utils.Metric.c_MetricUnits.pt) { - api.asc_SetDocumentUnits(Asc.c_oAscDocumentUnits.Point); + else if(value === Common.Utils.Metric.c_MetricUnits.pt) { this.isActiveUnitCentimeter = false; this.isActiveUnitPoint = true; this.isActiveUnitInch = false; } else { - api.asc_SetDocumentUnits(Asc.c_oAscDocumentUnits.Millimeter); this.isActiveUnitCentimeter = true; this.isActiveUnitPoint = false; this.isActiveUnitInch = false; } } - + + @action changeSpellCheck(value) { + this.isSpellChecking = value; + console.log(this.isSpellChecking); + } + + @action changeNoCharacters(value) { + this.isNonprintingCharacters = value; + console.log(this.isNonprintingCharacters); + } + + @action changeShowTableEmptyLine(value) { + this.isHiddenTableBorders = value; + console.log(this.isHiddenTableBorders); + } + + @action changeDisplayComments(value) { + this.isComments = value; + if (!value) this.changeDisplayResolved(value); + console.log(this.isComments); + } + + @action changeDisplayResolved(value) { + this.isResolvedComments = value; + console.log(this.isResolvedComments); + } } \ No newline at end of file diff --git a/apps/documenteditor/mobile/src/view/settings/ApplicationSettings.jsx b/apps/documenteditor/mobile/src/view/settings/ApplicationSettings.jsx index 16541d2926..ae5d2b1aaf 100644 --- a/apps/documenteditor/mobile/src/view/settings/ApplicationSettings.jsx +++ b/apps/documenteditor/mobile/src/view/settings/ApplicationSettings.jsx @@ -10,51 +10,76 @@ const PageApplicationSettings = (props) => { const isActiveUnitCentimeter = store.isActiveUnitCentimeter; const isActiveUnitPoint = store.isActiveUnitPoint; const isActiveUnitInch = store.isActiveUnitInch; - // const changeUnitMeasurement = store.changeUnitMeasurement; + const isSpellChecking = store.isSpellChecking; + const isNonprintingCharacters = store.isNonprintingCharacters; + const isHiddenTableBorders = store.isHiddenTableBorders; + const isComments = store.isComments; + const isResolvedComments = store.isResolvedComments; - // const unitMeasurementChange = e => { - // const api = Common.EditorApi.get(); - // let value = e.target.value; - // value = (value!==null) ? parseInt(value) : Common.Utils.Metric.getDefaultMetric(); - // Common.Utils.Metric.setCurrentMetric(value); - // // Common.localStorage.setItem("de-mobile-settings-unit", value); - // api.asc_SetDocumentUnits((value==Common.Utils.Metric.c_MetricUnits.inch) ? Asc.c_oAscDocumentUnits.Inch : ((value==Common.Utils.Metric.c_MetricUnits.pt) ? Asc.c_oAscDocumentUnits.Point : Asc.c_oAscDocumentUnits.Millimeter)); - // } + const changeMeasure = (e) => { + store.changeUnitMeasurement(e.target.value); + props.setUnitMeasurement(e.target.value); + } return ( {_t.textUnitOfMeasurement} - store.changeUnitMeasurement(e.target.value)}> - store.changeUnitMeasurement(e.target.value)}> - store.changeUnitMeasurement(e.target.value)}> + + + {_t.textSpellcheck} - + { + store.changeSpellCheck(!isSpellChecking); + props.switchSpellCheck(!isSpellChecking); + }} + /> {_t.textNoCharacters} - + { + store.changeNoCharacters(!isNonprintingCharacters); + props.switchNoCharacters(!isNonprintingCharacters); + }} + /> {_t.textHiddenTableBorders} - + { + store.changeShowTableEmptyLine(!isHiddenTableBorders); + props.switchShowTableEmptyLine(!isHiddenTableBorders); + }} + /> {_t.textCommentsDisplay} {_t.textComments} - + { + store.changeDisplayComments(!isComments); + props.switchDisplayComments(!isComments); + }} + /> {_t.textResolvedComments} - + { + store.changeDisplayResolved(!isResolvedComments); + props.switchDisplayResolved(!isResolvedComments); + }} + />